diff --git a/source/main.c b/source/main.c index 1315b42..aed0372 100644 --- a/source/main.c +++ b/source/main.c @@ -347,6 +347,52 @@ int main(int argc, char **argv) err_print("Unable to list directory."); } + if((kDown & KEY_LEFT || + ((kHeld & KEY_LEFT) && (osGetTime() - mill > 500))) && + fileNum > 0) + { + int skip = MAX_LIST / 2; + + if(fileNum < skip) + skip = fileNum; + + fileNum -= skip; + + /* 26 is the maximum number of entries that can be printed */ + if(fileMax - fileNum > 26 && from != 0) + { + from -= skip; + if(from < 0) + from = 0; + } + + if(listDir(from, MAX_LIST, fileNum) < 0) + err_print("Unable to list directory."); + } + + if((kDown & KEY_RIGHT || + ((kHeld & KEY_RIGHT) && (osGetTime() - mill > 500))) && + fileNum < fileMax) + { + int skip = fileMax - fileNum; + + if(skip > MAX_LIST / 2) + skip = MAX_LIST / 2; + + fileNum += skip; + + if(fileNum >= MAX_LIST && fileMax - fileNum >= 0 && + from < fileMax - MAX_LIST) + { + from += skip; + if(from > fileMax - MAX_LIST) + from = fileMax - MAX_LIST; + } + + if(listDir(from, MAX_LIST, fileNum) < 0) + err_print("Unable to list directory."); + } + /* * Pressing B goes up a folder, as well as pressing A or R when ".." * is selected. diff --git a/source/playback.c b/source/playback.c index 6695e60..4c1990f 100644 --- a/source/playback.c +++ b/source/playback.c @@ -210,8 +210,6 @@ void playFile(void* infoIn) gfxFlushBuffers(); gspWaitForVBlank(); - svcSleepThread(100 * 1000); - /* When the last buffer has finished playing, break. */ if(lastbuf == true && waveBuf[0].status == NDSP_WBUF_DONE && waveBuf[1].status == NDSP_WBUF_DONE)