From 01bc8e682ad855ae74193dcfa4bb1e24ac0662b8 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 21 Aug 2002 15:08:01 +0000 Subject: play_list() is now modified to accept a playlist index that is either meant in the unshuffled list or in the shuffled. There's an extra parameter giving that info (which of course only makes sense when shuffle is enabled). This should make resume work with play-all-dir in shuffled mode. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1889 a1c6a512-1295-4272-9138-f99709370657 --- apps/tree.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'apps/tree.c') diff --git a/apps/tree.c b/apps/tree.c index 90e978a0ab..7f0bf4362b 100644 --- a/apps/tree.c +++ b/apps/tree.c @@ -351,6 +351,7 @@ void start_resume(void) play_list(global_settings.resume_file, slash+1, global_settings.resume_index, + true, /* the index is AFTER shuffle */ global_settings.resume_offset, global_settings.resume_seed ); *slash='/'; @@ -368,6 +369,7 @@ void start_resume(void) play_list("/", global_settings.resume_file, global_settings.resume_index, + true, global_settings.resume_offset, global_settings.resume_seed ); } @@ -381,7 +383,8 @@ void start_resume(void) build_playlist(global_settings.resume_index); play_list(global_settings.resume_file, NULL, - global_settings.resume_index, + global_settings.resume_index, + true, global_settings.resume_offset, global_settings.resume_seed); } @@ -505,8 +508,10 @@ bool dirbrowse(char *root) currdir, dircache[dircursor+start].name); play_list(currdir, - dircache[dircursor+start].name, - 0, 0, seed ); + dircache[dircursor+start].name, + 0, + false, + 0, seed ); start_index = 0; } else { @@ -514,10 +519,16 @@ bool dirbrowse(char *root) strncpy(global_settings.resume_file, currdir, MAX_PATH); start_index = build_playlist(dircursor+start); - play_list(currdir, NULL, start_index, 0, seed); + + /* it is important that we get back the index in + the (shuffled) list and stor that */ + start_index = play_list(currdir, NULL, + start_index, false, 0, seed); } if ( global_settings.resume ) { + /* the resume_index must always be the index in the + shuffled list in case shuffle is enabled */ global_settings.resume_index = start_index; global_settings.resume_offset = 0; global_settings.resume_seed = seed; -- cgit v1.2.3