Skip to content

Commit

Permalink
- Add L/R trigger + L/R D-Pad page skipping support into the file bro…
Browse files Browse the repository at this point in the history
…wser
  • Loading branch information
emukidid committed Mar 31, 2019
1 parent df5bb11 commit f804843
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions cube/swiss/source/swiss.c
Original file line number Diff line number Diff line change
Expand Up @@ -391,10 +391,28 @@ uiDrawObj_t* renderFileBrowser(file_handle** directory, int num_files, uiDrawObj
DrawPublish(filePanel);
DrawDispose(loadingBox);

while ((PAD_StickY(0) > -16 && PAD_StickY(0) < 16) && !(PAD_ButtonsHeld(0) & PAD_BUTTON_B) && !(PAD_ButtonsHeld(0) & PAD_BUTTON_A) && !(PAD_ButtonsHeld(0) & PAD_BUTTON_UP) && !(PAD_ButtonsHeld(0) & PAD_BUTTON_DOWN))
u32 waitButtons = PAD_BUTTON_B|PAD_BUTTON_A|PAD_BUTTON_UP|PAD_BUTTON_DOWN|PAD_BUTTON_LEFT|PAD_BUTTON_RIGHT|PAD_TRIGGER_L|PAD_TRIGGER_R;
while ((PAD_StickY(0) > -16 && PAD_StickY(0) < 16) && !(PAD_ButtonsHeld(0) & waitButtons))
{ VIDEO_WaitVSync (); }
if((PAD_ButtonsHeld(0) & PAD_BUTTON_UP) || PAD_StickY(0) > 16){ curSelection = (--curSelection < 0) ? num_files-1 : curSelection;}
if((PAD_ButtonsHeld(0) & PAD_BUTTON_DOWN) || PAD_StickY(0) < -16) {curSelection = (curSelection + 1) % num_files; }
if(PAD_ButtonsHeld(0) & (PAD_BUTTON_LEFT|PAD_TRIGGER_L)) {
if(curSelection == 0) {
curSelection = num_files-1;
}
else {
curSelection = (curSelection - FILES_PER_PAGE < 0) ? 0 : curSelection - FILES_PER_PAGE;
}
}
if(PAD_ButtonsHeld(0) & (PAD_BUTTON_RIGHT|PAD_TRIGGER_R)) {
if(curSelection == num_files-1) {
curSelection = 0;
}
else {
curSelection = (curSelection + FILES_PER_PAGE > num_files-1) ? num_files-1 : (curSelection + FILES_PER_PAGE) % num_files;
}
}

if((PAD_ButtonsHeld(0) & PAD_BUTTON_A)) {
//go into a folder or select a file
if((*directory)[curSelection].fileAttrib==IS_DIR) {
Expand Down Expand Up @@ -437,7 +455,7 @@ uiDrawObj_t* renderFileBrowser(file_handle** directory, int num_files, uiDrawObj
usleep((abs(PAD_StickY(0)) > 64 ? 50000:100000) - abs(PAD_StickY(0)*64));
}
else {
while (!(!(PAD_ButtonsHeld(0) & PAD_BUTTON_B) && !(PAD_ButtonsHeld(0) & PAD_BUTTON_A) && !(PAD_ButtonsHeld(0) & PAD_BUTTON_UP) && !(PAD_ButtonsHeld(0) & PAD_BUTTON_DOWN)))
while (PAD_ButtonsHeld(0) & waitButtons)
{ VIDEO_WaitVSync (); }
}
}
Expand Down

0 comments on commit f804843

Please sign in to comment.