small bugfix, fix exiting to game from re-entering menu

This commit is contained in:
dborth 2009-05-28 04:16:11 +00:00
parent 5d2ce57648
commit 4004851fb6
4 changed files with 29 additions and 16 deletions

View File

@ -300,6 +300,7 @@ int main(int argc, char *argv[])
videoReset = -1;
currentMode = GCSettings.render;
currentTiming = GCSettings.timing;
ConfigRequested = 0;
SwitchAudioMode(0);

View File

@ -3664,6 +3664,10 @@ MainMenu (int menu)
ShutoffRumble();
#endif
// wait for keys to be depressed
while(MenuRequested())
usleep(100);
CancelAction();
HaltGui();

View File

@ -559,6 +559,27 @@ static unsigned char DecodeJoy( unsigned short pad )
return J;
}
bool MenuRequested()
{
for(int i=0; i<4; i++)
{
if (
(userInput[i].pad.substickX < -70) ||
(userInput[i].pad.btns_h & PAD_BUTTON_START &&
userInput[i].pad.btns_h & PAD_BUTTON_A &&
userInput[i].pad.btns_h & PAD_BUTTON_B &&
userInput[i].pad.btns_h & PAD_TRIGGER_Z
) ||
(userInput[i].wpad.btns_h & WPAD_BUTTON_HOME) ||
(userInput[i].wpad.btns_h & WPAD_CLASSIC_BUTTON_HOME)
)
{
return true;
}
}
return false;
}
void GetJoy()
{
JSReturn = 0; // reset buttons pressed
@ -573,22 +594,8 @@ void GetJoy()
frameskip = 0;
// request to go back to menu
for(i=0; i<4; i++)
{
if (
(userInput[i].pad.substickX < -70) ||
(userInput[i].pad.btns_h & PAD_BUTTON_START &&
userInput[i].pad.btns_h & PAD_BUTTON_A &&
userInput[i].pad.btns_h & PAD_BUTTON_B &&
userInput[i].pad.btns_h & PAD_TRIGGER_Z
) ||
(userInput[i].wpad.btns_h & WPAD_BUTTON_HOME) ||
(userInput[i].wpad.btns_h & WPAD_CLASSIC_BUTTON_HOME)
)
{
ScreenshotRequested = 1; // go to the menu
}
}
if(MenuRequested())
ScreenshotRequested = 1; // go to the menu
for (i = 0; i < 4; i++)
pad[i] = DecodeJoy(i);

View File

@ -32,5 +32,6 @@ s8 WPAD_StickX(u8 chan,u8 right);
s8 WPAD_StickY(u8 chan, u8 right);
void GetJoy();
void DrawCursor();
bool MenuRequested();
#endif