make menu pagination much nicer

This commit is contained in:
Naim2000 2024-05-02 21:16:44 -05:00
parent 60c42a760c
commit 7b47e2800e

View File

@ -1074,10 +1074,15 @@ getList:
} }
else if (buttons & WPAD_BUTTON_RIGHT) else if (buttons & WPAD_BUTTON_RIGHT)
{ {
selected += ENTRIES_PER_PAGE; if (fileCnt - start > ENTRIES_PER_PAGE) {
start += ENTRIES_PER_PAGE;
if (selected >= fileCnt) selected += ENTRIES_PER_PAGE;
if (selected >= fileCnt)
selected = fileCnt - 1;
}
else {
selected = fileCnt - 1; selected = fileCnt - 1;
}
} }
else if (buttons & WPAD_BUTTON_DOWN) else if (buttons & WPAD_BUTTON_DOWN)
{ {
@ -1086,10 +1091,15 @@ getList:
} }
else if (buttons & WPAD_BUTTON_LEFT) else if (buttons & WPAD_BUTTON_LEFT)
{ {
selected -= ENTRIES_PER_PAGE; if (start >= ENTRIES_PER_PAGE) {
start -= ENTRIES_PER_PAGE;
if (selected < 0) selected -= ENTRIES_PER_PAGE;
selected = 0; if (selected < 0)
selected = 0;
}
else {
selected = start = 0;
}
} }
else if (buttons & WPAD_BUTTON_HOME) else if (buttons & WPAD_BUTTON_HOME)
{ {