diff --git a/source/ngc/input.cpp b/source/ngc/input.cpp index 07d89af..75336cb 100644 --- a/source/ngc/input.cpp +++ b/source/ngc/input.cpp @@ -913,15 +913,27 @@ static u32 DecodeJoy(unsigned short pad) return J; } +bool MenuRequested() +{ + for(int i=0; i<4; i++) + { + if ( + (userInput[pad].pad.substickX < -70) || + (userInput[pad].wpad.btns_h & WPAD_BUTTON_HOME) || + (userInput[pad].wpad.btns_h & WPAD_CLASSIC_BUTTON_HOME) || + (DownUsbKeys[KB_ESC]) + ) + { + return true; + } + } + return false; +} + u32 GetJoy(int pad) { // request to go back to menu - if ( - (userInput[pad].pad.substickX < -70) || - (userInput[pad].wpad.btns_h & WPAD_BUTTON_HOME) || - (userInput[pad].wpad.btns_h & WPAD_CLASSIC_BUTTON_HOME) || - (DownUsbKeys[KB_ESC]) - ) + if (MenuRequested()) { ScreenshotRequested = 1; updateRumbleFrame(); diff --git a/source/ngc/input.h b/source/ngc/input.h index e83ba28..8115dcc 100644 --- a/source/ngc/input.h +++ b/source/ngc/input.h @@ -42,5 +42,6 @@ void systemGameRumbleOnlyFor(int OnlyRumbleForFrames); void updateRumbleFrame(); s8 WPAD_Stick(u8 chan,u8 right, int axis); u32 GetJoy(int which); +bool MenuRequested(); #endif diff --git a/source/ngc/menu.cpp b/source/ngc/menu.cpp index 74aa89f..fa581fd 100644 --- a/source/ngc/menu.cpp +++ b/source/ngc/menu.cpp @@ -3544,6 +3544,10 @@ MainMenu (int menu) ShutoffRumble(); #endif + // wait for keys to be depressed + while(MenuRequested()) + usleep(THREAD_SLEEP); + CancelAction(); HaltGui();