gui: exit prompt for --noguiprompt: suspend while visible

When using --nogui and --noguiprompt and the user presses ESC, a prompt is
displayed asking the user to confirm exiting/closing PCSX2. This patch suspends
the emulation while this prompt is displayed.

Also updated the comment that if LilyPad has "safe fullscreen exit on ESC", then
full screen is not restored automatically if this prompt is canceled.
This commit is contained in:
Avi Halachmi (:avih) 2015-10-06 01:55:18 +03:00
parent 5f2e60d751
commit e4d8af0c97
1 changed files with 9 additions and 6 deletions

View File

@ -281,6 +281,8 @@ namespace Implementations
void Sys_Suspend() void Sys_Suspend()
{ {
CoreThread.Suspend();
GSFrame* gsframe = wxGetApp().GetGsFramePtr(); GSFrame* gsframe = wxGetApp().GetGsFramePtr();
if (gsframe && !wxGetApp().HasGUI() && g_Conf->GSWindow.CloseOnEsc) { if (gsframe && !wxGetApp().HasGUI() && g_Conf->GSWindow.CloseOnEsc) {
// When we run with --nogui, PCSX2 only knows to exit when the gs window closes. // When we run with --nogui, PCSX2 only knows to exit when the gs window closes.
@ -303,16 +305,17 @@ namespace Implementations
else else
{ {
// aborting suspend request // aborting suspend request
// TODO: It's likely that if we were full screen before showing the // Note: if LilyPad is configured to "Safe fullscreen exit on ESC",
// prompt then we're now not in full screen anymore. It would have // then pressing escape will also exit full screen, but won't restore full screen
// been ideal to restore full screen, but the full screen flow is complex // when emulation is resumed if the user doesn't want to exit PCSX2 after the prompt.
// and specifically gsframe->IsFullScreen() is always false when we enter // So when using --nogui and --noguiprompt, consider disabling this option at Lilypad.
// this function - even if we were full screen before displaying the prompt. // Not sure yet why when using the GUI (without --nogiu), it does know to restore
// full screen even if this option is enabled at LilyPad.
CoreThread.Resume();
return; return;
} }
} }
CoreThread.Suspend();
sMainFrame.SetFocus(); sMainFrame.SetFocus();
} }