From 4bb968158d08a7c808809789f07947f498c9afeb Mon Sep 17 00:00:00 2001 From: KrossX Date: Wed, 7 Aug 2019 14:51:29 -0300 Subject: [PATCH] PCSX2: Wait some frames between F9 SW render toggles. (#3052) Setting the toggle variable is now at the vsync point. FMV toggle should still work as usual, but the F9 toggle should have to wait the full period of around 32 frames. This seems short enough while also depends on how fast those frames can rendered, avoiding having to set a timer in ms. --- pcsx2/gui/AppMain.cpp | 20 +++++++++++++------- pcsx2/gui/GlobalCommands.cpp | 6 +++--- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/pcsx2/gui/AppMain.cpp b/pcsx2/gui/AppMain.cpp index 552021b444..366f8a98ff 100644 --- a/pcsx2/gui/AppMain.cpp +++ b/pcsx2/gui/AppMain.cpp @@ -517,8 +517,9 @@ double FramerateManager::GetFramerate() const // times a second if not (ok, not quite, but you get the idea... I hope.) extern uint eecount_on_last_vdec; extern bool FMVstarted; -extern bool renderswitch; extern bool EnableFMV; +extern bool renderswitch; +extern uint do_renderswitch; void DoFmvSwitch(bool on) { @@ -534,11 +535,8 @@ void DoFmvSwitch(bool on) viewport->DoResize(); } - if (EmuConfig.Gamefixes.FMVinSoftwareHack) { - ScopedCoreThreadPause paused_core(new SysExecEvent_SaveSinglePlugin(PluginId_GS)); - renderswitch = !renderswitch; - paused_core.AllowResume(); - } + if (EmuConfig.Gamefixes.FMVinSoftwareHack) + do_renderswitch = -1; } void Pcsx2App::LogicalVsync() @@ -550,7 +548,7 @@ void Pcsx2App::LogicalVsync() // Update / Calculate framerate! FpsManager.DoFrame(); - + if (EmuConfig.Gamefixes.FMVinSoftwareHack || g_Conf->GSWindow.FMVAspectRatioSwitch != FMV_AspectRatio_Switch_Off) { if (EnableFMV) { DevCon.Warning("FMV on"); @@ -568,6 +566,14 @@ void Pcsx2App::LogicalVsync() } } + if (do_renderswitch == -1) { + ScopedCoreThreadPause paused_core(new SysExecEvent_SaveSinglePlugin(PluginId_GS)); + renderswitch = !renderswitch; + paused_core.AllowResume(); + } + + do_renderswitch >>= 1; + // Only call PADupdate here if we're using GSopen2. Legacy GSopen plugins have the // GS window belonging to the MTGS thread. if( (PADupdate != NULL) && (GSopen2 != NULL) && (wxGetApp().GetGsFramePtr() != NULL) ) diff --git a/pcsx2/gui/GlobalCommands.cpp b/pcsx2/gui/GlobalCommands.cpp index efd1e36d6c..9ddb86cf5b 100644 --- a/pcsx2/gui/GlobalCommands.cpp +++ b/pcsx2/gui/GlobalCommands.cpp @@ -35,6 +35,7 @@ // renderswitch - tells GSdx to go into dx9 sw if "renderswitch" is set. bool renderswitch = false; +uint do_renderswitch = 0; extern bool switchAR; @@ -361,9 +362,8 @@ namespace Implementations void Sys_RenderToggle() { - ScopedCoreThreadPause paused_core( new SysExecEvent_SaveSinglePlugin(PluginId_GS) ); - renderswitch = !renderswitch; - paused_core.AllowResume(); + if (do_renderswitch == 0) + do_renderswitch = -1; } void Sys_LoggingToggle()