fixed bug where switching songs doesn't scroll file list

This commit is contained in:
Narayan
2025-08-03 12:27:00 -07:00
parent 8f7d7d6c0f
commit 390d2cf594

View File

@@ -427,8 +427,8 @@ int main(int argc, char **argv)
{ {
fileNum--; fileNum--;
/* 26 is the maximum number of entries that can be printed */ // one line taken up by cwd, other by ../
if(fileMax - fileNum > 26 && from != 0) if(fileMax - fileNum > MAX_LIST-2 && from != 0)
from--; from--;
if(listDir(from, MAX_LIST, fileNum, dirList) < 0) if(listDir(from, MAX_LIST, fileNum, dirList) < 0)
@@ -460,9 +460,8 @@ int main(int argc, char **argv)
fileNum -= skip; fileNum -= skip;
/* 26 is the maximum number of entries that can be printed */ // one line taken up by cwd, other by ../
/* TODO: Not using MAX_LIST here? */ if(fileMax - fileNum > MAX_LIST-2 && from != 0)
if(fileMax - fileNum > 26 && from != 0)
{ {
from -= skip; from -= skip;
if(from < 0) if(from < 0)
@@ -546,6 +545,9 @@ int main(int argc, char **argv)
if (kDown & KEY_ZR && fileNum < fileMax) { if (kDown & KEY_ZR && fileNum < fileMax) {
fileNum += 1; fileNum += 1;
if(fileNum >= MAX_LIST && fileMax - fileNum >= 0 &&
from < fileMax - MAX_LIST)
from++;
consoleSelect(&topScreenInfo); consoleSelect(&topScreenInfo);
consoleClear(); consoleClear();
consoleSelect(&topScreenLog); consoleSelect(&topScreenLog);
@@ -557,8 +559,11 @@ int main(int argc, char **argv)
continue; continue;
} }
if (kDown & KEY_ZL && fileNum > 0) { // don't go to ../
if (kDown & KEY_ZL && fileNum > 1) {
fileNum -= 1; fileNum -= 1;
if(fileMax - fileNum > MAX_LIST-2 && from != 0)
from--;
consoleSelect(&topScreenInfo); consoleSelect(&topScreenInfo);
consoleClear(); consoleClear();
consoleSelect(&topScreenLog); consoleSelect(&topScreenLog);