Browse files with Left & Right
Added feature to browse a folder with Left & Right buttons to skip over half a screens worth of files (13 files). Signed-off-by: Mahyar Koshkouei <deltabeard@users.noreply.github.com>
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user