mirror of
https://github.com/DarkMatterCore/nxdumptool.git
synced 2024-11-12 21:46:39 +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;
|
FsDeviceOperator fsOperatorInstance;
|
||||||
|
|
||||||
|
bool shouldExit = false;
|
||||||
bool shouldWaitForAnyButton = false;
|
bool shouldWaitForAnyButton = false;
|
||||||
|
|
||||||
|
void menuExit() {
|
||||||
|
shouldExit = true;
|
||||||
|
}
|
||||||
|
|
||||||
void menuWaitForAnyButton() {
|
void menuWaitForAnyButton() {
|
||||||
printf(C_DIM "Press any button to return to menu\n");
|
printf(C_DIM "Press any button to return to menu\n");
|
||||||
shouldWaitForAnyButton = true;
|
shouldWaitForAnyButton = true;
|
||||||
|
@ -40,7 +45,7 @@ int main(int argc, char **argv) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
menuSetCurrent(mainMenu);
|
menuSetCurrent(mainMenu, menuExit);
|
||||||
|
|
||||||
while(appletMainLoop())
|
while(appletMainLoop())
|
||||||
{
|
{
|
||||||
|
@ -57,6 +62,8 @@ int main(int argc, char **argv) {
|
||||||
shouldWaitForAnyButton = false;
|
shouldWaitForAnyButton = false;
|
||||||
menuPrint();
|
menuPrint();
|
||||||
}
|
}
|
||||||
|
if (shouldExit)
|
||||||
|
break;
|
||||||
|
|
||||||
gfxFlushBuffers();
|
gfxFlushBuffers();
|
||||||
gfxSwapBuffers();
|
gfxSwapBuffers();
|
||||||
|
|
|
@ -8,6 +8,7 @@ MenuItem* menuCurrent;
|
||||||
int menuCurrentCount;
|
int menuCurrentCount;
|
||||||
bool menuCardIsInserted;
|
bool menuCardIsInserted;
|
||||||
int menuSelIndex = 0;
|
int menuSelIndex = 0;
|
||||||
|
void (*menuExitCallback)();
|
||||||
|
|
||||||
void menuPrint() {
|
void menuPrint() {
|
||||||
consoleClear();
|
consoleClear();
|
||||||
|
@ -43,6 +44,10 @@ int menuHandleInput() {
|
||||||
menuCurrent[menuSelIndex].callback();
|
menuCurrent[menuSelIndex].callback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
if ((keys & KEY_B) && menuExitCallback != NULL) {
|
||||||
|
menuExitCallback();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
if (((keys & KEY_RSTICK_UP) | (keys & KEY_LSTICK_UP)) && menuSelIndex > 0) {
|
if (((keys & KEY_RSTICK_UP) | (keys & KEY_LSTICK_UP)) && menuSelIndex > 0) {
|
||||||
menuSelIndex--;
|
menuSelIndex--;
|
||||||
needsRefresh = true;
|
needsRefresh = true;
|
||||||
|
@ -55,7 +60,8 @@ int menuHandleInput() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void menuSetCurrent(MenuItem* menuItems) {
|
void menuSetCurrent(MenuItem* menuItems, void (*exitCallback)()) {
|
||||||
|
menuExitCallback = exitCallback;
|
||||||
menuCurrent = menuItems;
|
menuCurrent = menuItems;
|
||||||
menuCurrentCount = 0;
|
menuCurrentCount = 0;
|
||||||
while ((menuItems++)->text != NULL)
|
while ((menuItems++)->text != NULL)
|
||||||
|
|
|
@ -8,5 +8,5 @@ typedef struct {
|
||||||
} MenuItem;
|
} MenuItem;
|
||||||
|
|
||||||
void menuPrint();
|
void menuPrint();
|
||||||
void menuSetCurrent(MenuItem* menuItems);
|
void menuSetCurrent(MenuItem* menuItems, void (*exitCallback)());
|
||||||
void menuUpdate(FsDeviceOperator* fsOperator);
|
void menuUpdate(FsDeviceOperator* fsOperator);
|
Loading…
Reference in a new issue