GUI: Fix recording related hang when PAD plugin is open/closed while game is paused (#3299)

* recording: Resolve hang when opening PAD plugin with the game paused

* pcsx2-gui: Forbid editing the PAD settings while emulation is paused by recording tools

* pcsx2-gui: Resume emulation before configuring PAD plugin, resume on return
This commit is contained in:
Tyler Wilding 2020-09-10 18:05:54 -04:00 committed by GitHub
parent fe872b5caa
commit 79cd8d2190
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 36 additions and 7 deletions

View File

@ -32,9 +32,11 @@
#ifndef DISABLE_RECORDING
# include "Recording/InputRecording.h"
# include "Recording/RecordingControls.h"
# include "Recording/VirtualPad.h"
#endif
using namespace Dialogs;
void MainEmuFrame::Menu_SysSettings_Click(wxCommandEvent &event)
@ -662,13 +664,40 @@ void MainEmuFrame::Menu_ConfigPlugin_Click(wxCommandEvent &event)
PluginsEnum_t pid = (PluginsEnum_t)(eventId / PluginMenuId_Interval);
// Don't try to call the Patches config dialog until we write one.
if (event.GetId() == MenuId_Config_Patches) return;
if (event.GetId() == MenuId_Config_Patches)
return;
if( !pxAssertDev( (eventId >= 0) || (pid < PluginId_Count), "Invalid plugin identifier passed to ConfigPlugin event handler." ) ) return;
if (!pxAssertDev((eventId >= 0) || (pid < PluginId_Count), "Invalid plugin identifier passed to ConfigPlugin event handler."))
return;
wxWindowDisabler disabler;
ScopedCoreThreadPause paused_core(new SysExecEvent_SaveSinglePlugin(pid));
#ifndef DISABLE_RECORDING
if (pid == PluginId_PAD)
{
// The recording features involve pausing emulation, and can be resumed ideally via key-bindings.
//
// However, since the PAD plugin is used to do so, if it's closed then there is nothing to read
// the keybind resulting producing an unrecovable state.
//
// If the CoreThread is paused prior to opening the PAD plugin settings then when the settings
// are closed the PAD will not re-open. To avoid this, we resume emulation prior to the plugins
// configuration handler doing so.
if (g_Conf->EmuOptions.EnableRecordingTools && g_RecordingControls.IsEmulationAndRecordingPaused())
{
g_RecordingControls.Unpause();
GetCorePlugins().Configure(pid);
g_RecordingControls.Pause();
}
else
GetCorePlugins().Configure(pid);
}
else
GetCorePlugins().Configure(pid);
#else
GetCorePlugins().Configure(pid);
#endif
}
void MainEmuFrame::Menu_Debug_Open_Click(wxCommandEvent &event)