From 1e02e98d4ad21726c34173fea7141bb67d5ef315 Mon Sep 17 00:00:00 2001 From: Linus Nielsen Feltzing Date: Thu, 8 Aug 2002 06:42:02 +0000 Subject: Compensates the starting position for non-mp3 files in the playlist build git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1606 a1c6a512-1295-4272-9138-f99709370657 --- apps/tree.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/apps/tree.c b/apps/tree.c index c1859a6..e094929 100644 --- a/apps/tree.c +++ b/apps/tree.c @@ -109,7 +109,7 @@ extern unsigned char bitmap_icons_6x8[LastIcon][6]; #define TREE_ATTR_M3U 0x80 /* unused by FAT attributes */ #define TREE_ATTR_MP3 0x40 /* unused by FAT attributes */ -static void build_playlist(void) +static int build_playlist(int start_index) { int i; @@ -122,7 +122,15 @@ static void build_playlist(void) DEBUGF("Adding %s\n", dircacheptr[i]->name); playlist_add(dircacheptr[i]->name); } + else + { + /* Adjust the start index when se skip non-MP3 entries */ + if(i < start_index) + start_index--; + } } + + return start_index; } static int compare(const void* p1, const void* p2) @@ -267,7 +275,7 @@ bool dirbrowse(char *root) int lasti=-1; int rc; int button; - + int start_index; memcpy(currdir,root,sizeof(currdir)); numentries = showdir(root, start); @@ -342,8 +350,8 @@ bool dirbrowse(char *root) dircacheptr[dircursor+start]->name, 0); } else { - build_playlist(); - play_list(currdir, NULL, dircursor+start); + start_index = build_playlist(dircursor+start); + play_list(currdir, NULL, start_index); } status_set_playmode(STATUS_PLAY); status_draw(); -- cgit v1.1