mirror of https://github.com/PCSX2/pcsx2.git
nogui: don't zombie on suspend. --noguiprompt to prompt before exit
when running with --nogui, PCSX2 knows to exit when the GS window closes. However, pressing esc (suspend) didn't close the window and instead hidden it. As a result, PCSX2 didn't exit and remained a zombie process. this patch closes the gs window on suspend in --nogui mode, which makes PCSX2 exit fully. it's now also possibly to use --noguiprompt which prompts if esc will exit PCSX2, and allows the user to abort the suspend and continue using PCSX2. TODO: if PCSX2 was in full screen - then pressing esc exits full screen. it would have been ideal to restore full screen, but for now it doesn't.
This commit is contained in:
parent
576513a6d0
commit
2b567e51ff
|
@ -446,11 +446,15 @@ public:
|
|||
void DispatchUiSettingsEvent( IniInterface& ini );
|
||||
void DispatchVmSettingsEvent( IniInterface& ini );
|
||||
|
||||
bool HasGUI() { return m_UseGUI; };
|
||||
bool ExitPromptWithNoGUI() { return m_NoGuiExitPrompt; };
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
protected:
|
||||
int m_PendingSaves;
|
||||
bool m_ScheduledTermination;
|
||||
bool m_UseGUI;
|
||||
bool m_NoGuiExitPrompt;
|
||||
|
||||
Threading::Mutex m_mtx_Resources;
|
||||
Threading::Mutex m_mtx_LoadingGameDB;
|
||||
|
|
|
@ -222,6 +222,8 @@ void Pcsx2App::OnInitCmdLine( wxCmdLineParser& parser )
|
|||
parser.AddSwitch( wxEmptyString,L"windowed", _("use windowed GS mode") );
|
||||
|
||||
parser.AddSwitch( wxEmptyString,L"nogui", _("disables display of the gui while running games") );
|
||||
parser.AddSwitch( wxEmptyString,L"noguiprompt", _("when nogui - prompt before exiting on suspend") );
|
||||
|
||||
parser.AddOption( wxEmptyString,L"elf", _("executes an ELF image"), wxCMD_LINE_VAL_STRING );
|
||||
parser.AddSwitch( wxEmptyString,L"nodisc", _("boots an empty dvd tray; use to enter the PS2 system menu") );
|
||||
parser.AddSwitch( wxEmptyString,L"usecd", _("boots from the CDVD plugin (overrides IsoFile parameter)") );
|
||||
|
@ -319,6 +321,7 @@ bool Pcsx2App::OnCmdLineParsed( wxCmdLineParser& parser )
|
|||
//wxApp::OnCmdLineParsed( parser );
|
||||
|
||||
m_UseGUI = !parser.Found(L"nogui");
|
||||
m_NoGuiExitPrompt = parser.Found(L"noguiprompt"); // by default no prompt for exit with nogui.
|
||||
|
||||
if( !ParseOverrides(parser) ) return false;
|
||||
|
||||
|
|
|
@ -943,7 +943,8 @@ void Pcsx2App::OnGsFrameClosed( wxWindowID id )
|
|||
|
||||
if( !m_UseGUI )
|
||||
{
|
||||
// [TODO] : Prompt user before exiting, k thx. :)
|
||||
// The user is prompted before suspending (at Sys_Suspend() ), because
|
||||
// right now there's no way to resume from suspend without GUI.
|
||||
PrepForExit();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -281,6 +281,37 @@ namespace Implementations
|
|||
|
||||
void Sys_Suspend()
|
||||
{
|
||||
GSFrame* gsframe = wxGetApp().GetGsFramePtr();
|
||||
if (gsframe && !wxGetApp().HasGUI() && g_Conf->GSWindow.CloseOnEsc) {
|
||||
// When we run with --nogui, PCSX2 only knows to exit when the gs window closes.
|
||||
// However, by default suspend just hides the gs window, so PCSX2 will not exit
|
||||
// and there will also be no way to exit it even if no windows are left.
|
||||
// If the gs window is not set to close on suspend, then the user can still
|
||||
// close it with the X button, which PCSX2 will recognize and exit.
|
||||
// So if we're set to close on esc and nogui:
|
||||
// If the user didn't specify --noguiprompt - exit immediately.
|
||||
// else prompt to either exit or abort the suspend.
|
||||
if (!wxGetApp().ExitPromptWithNoGUI() // the user specified to exit immediately
|
||||
|| (wxOK == wxMessageBox(_("Exit PCSX2?"),
|
||||
L"PCSX2",
|
||||
wxICON_WARNING | wxOK | wxCANCEL)))
|
||||
{
|
||||
// Pcsx2App knows to exit if no gui and the GS window closes.
|
||||
gsframe->Close();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// aborting suspend request
|
||||
// TODO: It's likely that if we were full screen before showing the
|
||||
// prompt then we're now not in full screen anymore. It would have
|
||||
// been ideal to restore full screen, but the full screen flow is complex
|
||||
// and specifically gsframe->IsFullScreen() is always false when we enter
|
||||
// this function - even if we were full screen before displaying the prompt.
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
CoreThread.Suspend();
|
||||
sMainFrame.SetFocus();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue