From 95f516e0b9ba03372b2f2b89c9c8adf99b069913 Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Sun, 21 Sep 2008 14:19:18 +0000 Subject: [PATCH] more slight playlist resume cleanuping... dont bother saving the playlist first index value. its reset to 0 before playlistcontrol is loaded anyway, and then reset to 0 after its finished so its completly useless in global_status. runtimes, resume info, etc will be reset again... git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18561 a1c6a512-1295-4272-9138-f99709370657 --- apps/playlist.c | 26 ++------------------------ apps/settings.h | 1 - apps/settings_list.c | 1 - apps/settings_list.h | 2 +- 4 files changed, 3 insertions(+), 27 deletions(-) diff --git a/apps/playlist.c b/apps/playlist.c index 1d42ba3728..5d8d8495bf 100644 --- a/apps/playlist.c +++ b/apps/playlist.c @@ -297,9 +297,6 @@ static void empty_playlist(struct playlist_info* playlist, bool resume) /* start with fresh playlist control file when starting new playlist */ create_control(playlist); - - /* Reset resume settings */ - global_status.resume_first_index = 0; } } @@ -788,11 +785,6 @@ static int add_track_to_playlist(struct playlist_info* playlist, { playlist->first_index++; - if (seek_pos < 0 && playlist->current) - { - global_status.resume_first_index = playlist->first_index; - status_save(); - } } if (insert_position < playlist->last_insert_pos || @@ -903,12 +895,6 @@ static int remove_track_from_playlist(struct playlist_info* playlist, if (position < playlist->first_index) { playlist->first_index--; - - if (write) - { - global_status.resume_first_index = playlist->first_index; - status_save(); - } } if (position <= playlist->last_insert_pos) @@ -1191,12 +1177,6 @@ static void find_and_set_playlist_index(struct playlist_info* playlist, { playlist->index = playlist->first_index = i; - if (playlist->current) - { - global_status.resume_first_index = i; - status_save(); - } - break; } } @@ -2354,7 +2334,6 @@ int playlist_resume(void) /* Terminate on EOF */ if(nread <= 0) { - playlist->first_index = global_status.resume_first_index; break; } } @@ -2406,8 +2385,7 @@ int playlist_shuffle(int random_seed, int start_index) { /* store the seek position before the shuffle */ seek_pos = playlist->indices[start_index]; - playlist->index = global_status.resume_first_index = - playlist->first_index = start_index; + playlist->index = playlist->first_index = start_index; start_current = true; } @@ -2541,7 +2519,7 @@ int playlist_next(int steps) playlist->amount > 1) { /* Repeat shuffle mode. Re-shuffle playlist and resume play */ - playlist->first_index = global_status.resume_first_index = 0; + playlist->first_index = 0; sort_playlist(playlist, false, false); randomise_playlist(playlist, current_tick, false, true); #if CONFIG_CODEC != SWCODEC diff --git a/apps/settings.h b/apps/settings.h index 855072a428..902956e471 100644 --- a/apps/settings.h +++ b/apps/settings.h @@ -269,7 +269,6 @@ bool set_option(const char* string, const void* variable, enum optiontype type, struct system_status { int resume_index; /* index in playlist (-1 for no active resume) */ - int resume_first_index; /* index of first track in playlist */ uint32_t resume_offset; /* byte offset in mp3 file */ int runtime; /* current runtime since last charge */ int topruntime; /* top known runtime */ diff --git a/apps/settings_list.c b/apps/settings_list.c index f94338cc48..e70f587b5a 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c @@ -425,7 +425,6 @@ const struct settings_list settings[] = { /* playback */ OFFON_SETTING(0, playlist_shuffle, LANG_SHUFFLE, false, "shuffle", NULL), SYSTEM_SETTING(NVRAM(4), resume_index, -1), - SYSTEM_SETTING(NVRAM(4), resume_first_index, 0), SYSTEM_SETTING(NVRAM(4), resume_offset, -1), CHOICE_SETTING(0, repeat_mode, LANG_REPEAT, REPEAT_ALL, "repeat", "off,all,one,shuffle" diff --git a/apps/settings_list.h b/apps/settings_list.h index 7d0f750ff9..c3a8cbaf3e 100644 --- a/apps/settings_list.h +++ b/apps/settings_list.h @@ -111,7 +111,7 @@ struct table_setting { #define F_NVRAM_BYTES_MASK 0xE0000 /*0-4 bytes can be stored */ #define F_NVRAM_MASK_SHIFT 17 -#define NVRAM_CONFIG_VERSION 5 +#define NVRAM_CONFIG_VERSION 6 /* Above define should be bumped if - a new NVRAM setting is added between 2 other NVRAM settings - number of bytes for a NVRAM setting is changed