From 70dde551e32cd6c0b1cafcba2bdcf2f739972bbe Mon Sep 17 00:00:00 2001 From: Gauvain 'GovanifY' Roussel-Tarbouriech Date: Fri, 14 May 2021 11:23:30 +0200 Subject: [PATCH] gs: introspect gs state directly --- pcsx2/GS/GS.h | 2 ++ pcsx2/gui/AppMain.cpp | 2 +- pcsx2/gui/FrameForGS.cpp | 2 +- pcsx2/gui/GlobalCommands.cpp | 11 +++++------ 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/pcsx2/GS/GS.h b/pcsx2/GS/GS.h index 75a427c553..4b68924256 100644 --- a/pcsx2/GS/GS.h +++ b/pcsx2/GS/GS.h @@ -1965,3 +1965,5 @@ struct GSErrorGlVertexArrayTooSmall : GSError }; extern GSApp theApp; + +extern bool gsopen_done; diff --git a/pcsx2/gui/AppMain.cpp b/pcsx2/gui/AppMain.cpp index 32c17d8b01..2aa4b8bb72 100644 --- a/pcsx2/gui/AppMain.cpp +++ b/pcsx2/gui/AppMain.cpp @@ -868,7 +868,7 @@ void Pcsx2App::OpenGsPanel() gsFrame->SetSize( oldsize ); } - //TODO: MAKE SURE GS IS CLOSED HERE + pxAssertDev( !gsopen_done, "GS Plugin must be closed prior to opening a new Gs Panel!" ); #ifdef __WXGTK__ // The x window/display are actually very deeper in the widget. You need both display and window diff --git a/pcsx2/gui/FrameForGS.cpp b/pcsx2/gui/FrameForGS.cpp index 7af22ef2ec..154bd88473 100644 --- a/pcsx2/gui/FrameForGS.cpp +++ b/pcsx2/gui/FrameForGS.cpp @@ -688,7 +688,7 @@ void GSFrame::AppStatusEvent_OnSettingsApplied() if( g_Conf->GSWindow.CloseOnEsc ) { - if (IsShown() /*&& TODO: CHECK IS GS IS CLOSED */) + if (IsShown() && !gsopen_done) Show( false ); } } diff --git a/pcsx2/gui/GlobalCommands.cpp b/pcsx2/gui/GlobalCommands.cpp index 9f3c760433..7dd4de3cd1 100644 --- a/pcsx2/gui/GlobalCommands.cpp +++ b/pcsx2/gui/GlobalCommands.cpp @@ -400,12 +400,11 @@ namespace Implementations return; if (renderswitch_delay == 0) { - /* TODO: reimplement this: - * ScopedCoreThreadPause paused_core(new SysExecEvent_SaveSinglePlugin(PluginId_GS)); - * renderswitch = !renderswitch; - * paused_core.AllowResume(); - * renderswitch_delay = -1; - */ + ScopedCoreThreadPause paused_core(); + GSfreeze(); + renderswitch = !renderswitch; + paused_core.AllowResume(); + renderswitch_delay = -1; } }