KB commands: change Sys_Suspend to Sys_SuspendResume (toggle)

It's now possible to press ESC once to pause, and ESC again to resume (or assign
any other key via PCSX2_keys.ini, e.g. to SPACE).

Note that resume only works if the GS window is NOT set to hide on pause (Emu
options -> GS Window), and if the key is pressed while the GS window is focused.

This includes two related changes:
- The command name at PCSX2_keys.ini is now changed to Sys_SuspendResume.
- If the GS window is NOT set to hide on pause, then it stays focused on pause.

--nogui also gains this behavior, so it's now possible to launch without a GUI
and still suspend/resume if the GS window is not set to hide on pause. If it is
set to hide on pause, then the behavior remains as it was: exit PCSX2 on pause,
or prompt to exit/resume if --noguiprompt is provided.
This commit is contained in:
Avi Halachmi (:avih) 2016-01-03 21:13:20 +02:00
parent 6300a47c15
commit e8b653ddf3
3 changed files with 19 additions and 5 deletions

View File

@ -46,7 +46,9 @@ Framelimiter_MasterToggle = F4
FullscreenToggle = Alt-ENTER
Sys_Suspend = ESC
# Note: toggles suspend, but can resume only if the GS window is not set to hide
# when paused (Emu options -> GS window), and when the GS window is focused.
Sys_SuspendResume = ESC
# Screenshot. Note: must not include shift or ctrl. With these held - it will
# create debug GS dump. The two other shortcuts will be added automatically.

View File

@ -66,7 +66,7 @@ void GSPanel::InitDefaultAccelerators()
m_Accels->Map( AAC( WXK_RIGHT ).Cmd().Alt(), "GSwindow_OffsetXplus" );
m_Accels->Map( AAC( WXK_NUMPAD_DIVIDE ).Cmd().Alt(), "GSwindow_OffsetReset" );
m_Accels->Map( AAC( WXK_ESCAPE ), "Sys_Suspend" );
m_Accels->Map( AAC( WXK_ESCAPE ), "Sys_SuspendResume" );
m_Accels->Map( AAC( WXK_F8 ), "Sys_TakeSnapshot" ); // also shift and ctrl-shift will be added automatically
m_Accels->Map( AAC( WXK_F9 ), "Sys_RenderswitchToggle");

View File

@ -327,6 +327,7 @@ namespace Implementations
}
}
if (g_Conf->GSWindow.CloseOnEsc)
sMainFrame.SetFocus();
}
@ -335,6 +336,17 @@ namespace Implementations
CoreThread.Resume();
}
void Sys_SuspendResume()
{
if (CoreThread.HasPendingStateChangeRequest())
return;
if (CoreThread.IsPaused())
Sys_Resume();
else
Sys_Suspend();
}
void Sys_TakeSnapshot()
{
GSmakeSnapshot( g_Conf->Folders.Snapshots.ToAscii() );
@ -546,8 +558,8 @@ static const GlobalCommandDescriptor CommandDeclarations[] =
{ "GSwindow_OffsetXplus", Implementations::GSwindow_OffsetXplus, NULL, NULL, },
{ "GSwindow_OffsetReset", Implementations::GSwindow_OffsetReset, NULL, NULL, },
{ "Sys_Suspend",
Implementations::Sys_Suspend,
{ "Sys_SuspendResume",
Implementations::Sys_SuspendResume,
NULL,
NULL,
},