mirror of
https://github.com/DarkMatterCore/nxdumptool.git
synced 2024-11-10 04:31:44 +00:00
Make B exit the app
This commit is contained in:
parent
c7ef15aab1
commit
497052d9df
3 changed files with 16 additions and 3 deletions
|
@ -7,8 +7,13 @@
|
|||
|
||||
FsDeviceOperator fsOperatorInstance;
|
||||
|
||||
bool shouldExit = false;
|
||||
bool shouldWaitForAnyButton = false;
|
||||
|
||||
void menuExit() {
|
||||
shouldExit = true;
|
||||
}
|
||||
|
||||
void menuWaitForAnyButton() {
|
||||
printf(C_DIM "Press any button to return to menu\n");
|
||||
shouldWaitForAnyButton = true;
|
||||
|
@ -40,7 +45,7 @@ int main(int argc, char **argv) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
menuSetCurrent(mainMenu);
|
||||
menuSetCurrent(mainMenu, menuExit);
|
||||
|
||||
while(appletMainLoop())
|
||||
{
|
||||
|
@ -57,6 +62,8 @@ int main(int argc, char **argv) {
|
|||
shouldWaitForAnyButton = false;
|
||||
menuPrint();
|
||||
}
|
||||
if (shouldExit)
|
||||
break;
|
||||
|
||||
gfxFlushBuffers();
|
||||
gfxSwapBuffers();
|
||||
|
|
|
@ -8,6 +8,7 @@ MenuItem* menuCurrent;
|
|||
int menuCurrentCount;
|
||||
bool menuCardIsInserted;
|
||||
int menuSelIndex = 0;
|
||||
void (*menuExitCallback)();
|
||||
|
||||
void menuPrint() {
|
||||
consoleClear();
|
||||
|
@ -43,6 +44,10 @@ int menuHandleInput() {
|
|||
menuCurrent[menuSelIndex].callback();
|
||||
return -1;
|
||||
}
|
||||
if ((keys & KEY_B) && menuExitCallback != NULL) {
|
||||
menuExitCallback();
|
||||
return -1;
|
||||
}
|
||||
if (((keys & KEY_RSTICK_UP) | (keys & KEY_LSTICK_UP)) && menuSelIndex > 0) {
|
||||
menuSelIndex--;
|
||||
needsRefresh = true;
|
||||
|
@ -55,7 +60,8 @@ int menuHandleInput() {
|
|||
}
|
||||
|
||||
|
||||
void menuSetCurrent(MenuItem* menuItems) {
|
||||
void menuSetCurrent(MenuItem* menuItems, void (*exitCallback)()) {
|
||||
menuExitCallback = exitCallback;
|
||||
menuCurrent = menuItems;
|
||||
menuCurrentCount = 0;
|
||||
while ((menuItems++)->text != NULL)
|
||||
|
|
|
@ -8,5 +8,5 @@ typedef struct {
|
|||
} MenuItem;
|
||||
|
||||
void menuPrint();
|
||||
void menuSetCurrent(MenuItem* menuItems);
|
||||
void menuSetCurrent(MenuItem* menuItems, void (*exitCallback)());
|
||||
void menuUpdate(FsDeviceOperator* fsOperator);
|
Loading…
Reference in a new issue