Update README and limit pointer speed

Signed-off-by: Mahyar Koshkouei <deltabeard@users.noreply.github.com>
This commit is contained in:
Mahyar Koshkouei
2017-01-02 11:41:41 +00:00
parent d0ce566512
commit 2456166647
2 changed files with 26 additions and 13 deletions

View File

@@ -13,7 +13,7 @@ A or R = Pause/Play
B = Stop B = Stop
### When stopped ### When stopped
A or R = Play selected file. A or R = Play selected file or change directory.
Up and down = Select file. Up and down = Select file.
@@ -23,11 +23,11 @@ Start = Return to Homebrew menu (Only when stopped playing).
* Plays PCM WAV, AIFF, FLAC, Opus files. * Plays PCM WAV, AIFF, FLAC, Opus files.
* Pause and play support. * Pause and play support.
* Plays music via headphones whilst system is closed. * Plays music via headphones whilst system is closed.
* Ability to browse directories.
### Planned features ### Planned features
* Playlist support. * Playlist support.
* Repeat and shuffle support. * Repeat and shuffle support.
* OGG, MP3 file support. * OGG, MP3 file support.
* Ability to browse directories.
* Metadata support. * Metadata support.

View File

@@ -70,6 +70,8 @@ int main(int argc, char **argv)
while(aptMainLoop()) while(aptMainLoop())
{ {
u32 kDown; u32 kDown;
u32 kHeld;
static u64 mill = 0;
hidScanInput(); hidScanInput();
@@ -78,33 +80,47 @@ int main(int argc, char **argv)
gspWaitForVBlank(); gspWaitForVBlank();
kDown = hidKeysDown(); kDown = hidKeysDown();
kHeld = hidKeysHeld();
if(kDown & KEY_START) if(kDown & KEY_START)
break; break;
if((kDown & KEY_UP) && fileNum > 0) consoleSelect(&topScreen);
printf("\rNum: %d, Max: %d, from: %d ", fileNum, fileMax, from);
consoleSelect(&bottomScreen);
if((kHeld & KEY_UP) && fileNum > 0)
{ {
/* Limit the speed of the selector */
if(osGetTime() - mill < 100)
continue;
fileNum--; fileNum--;
if(fileMax - fileNum >= from && from != 0) if(fileMax - fileNum >= from && from != 0)
from--; from--;
mill = osGetTime();
} }
if((kDown & KEY_DOWN) && fileNum < fileMax) if((kHeld & KEY_DOWN) && fileNum < fileMax)
{ {
if(osGetTime() - mill < 100)
continue;
fileNum++; fileNum++;
if(fileNum >= MAX_LIST && fileMax - fileNum >= 0) if(fileNum >= MAX_LIST && fileMax - fileNum >= 0 && from < fileMax - MAX_LIST)
from++; from++;
mill = osGetTime();
} }
if(kDown & (KEY_DOWN | KEY_UP)) if(kHeld & (KEY_DOWN | KEY_UP))
{ {
consoleClear(); consoleClear();
if(listDir(from, MAX_LIST, fileNum) < 0) if(listDir(from, MAX_LIST, fileNum) < 0)
{
err_print("Unable to list directory."); err_print("Unable to list directory.");
}
} }
/* /*
@@ -117,13 +133,13 @@ int main(int argc, char **argv)
if(chdir("..") != 0) if(chdir("..") != 0)
err_print("chdir"); err_print("chdir");
fileNum = 0;
from = 0;
fileMax = getNumberFiles(); fileMax = getNumberFiles();
consoleClear(); consoleClear();
if(listDir(from, MAX_LIST, fileNum) < 0) if(listDir(from, MAX_LIST, fileNum) < 0)
{
err_print("Unable to list directory."); err_print("Unable to list directory.");
}
continue; continue;
} }
@@ -135,7 +151,6 @@ int main(int argc, char **argv)
struct dirent *ep; struct dirent *ep;
char* wd = getcwd(NULL, 0); char* wd = getcwd(NULL, 0);
/* TODO: Error out properly */
if(wd == NULL) if(wd == NULL)
{ {
err_print("wd"); err_print("wd");
@@ -167,9 +182,7 @@ int main(int argc, char **argv)
consoleClear(); consoleClear();
fileMax = getNumberFiles(); fileMax = getNumberFiles();
if(listDir(from, MAX_LIST, fileNum) < 0) if(listDir(from, MAX_LIST, fileNum) < 0)
{
err_print("Unable to list directory."); err_print("Unable to list directory.");
}
closedir(dp); closedir(dp);
free(wd); free(wd);