From 501225c6301c4642477d9ef66959efb87efcae69 Mon Sep 17 00:00:00 2001 From: Gauvain 'GovanifY' Roussel-Tarbouriech Date: Mon, 8 Mar 2021 15:16:10 +0100 Subject: [PATCH] gsdump: force close-shutdown when gsdump is the callee --- pcsx2/PluginManager.cpp | 7 ++++--- pcsx2/gui/AppCorePlugins.cpp | 3 ++- pcsx2/gui/AppMain.cpp | 1 - pcsx2/gui/Dialogs/GSDumpDialog.cpp | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/pcsx2/PluginManager.cpp b/pcsx2/PluginManager.cpp index 565bd8b9fc..fe99b20651 100644 --- a/pcsx2/PluginManager.cpp +++ b/pcsx2/PluginManager.cpp @@ -29,6 +29,7 @@ #endif #include "Utilities/pxStreams.h" +#include "gui/Dialogs/ModalPopups.h" #include "svnrev.h" #include "ConsoleLogger.h" @@ -901,7 +902,7 @@ void SysCorePlugins::Close( PluginsEnum_t pid ) { pxAssert( (uint)pid < PluginId_Count ); - if( !IsOpen(pid) ) return; + if (!(IsOpen(pid) || GSDump::isRunning) ) return; if( !GetMTGS().IsSelf() ) // stop the spam! Console.Indent().WriteLn( "Closing %s", tbl_PluginInfo[pid].shortname ); @@ -920,7 +921,7 @@ void SysCorePlugins::Close( PluginsEnum_t pid ) void SysCorePlugins::Close() { - if( !NeedsClose() ) return; // Spam stopper; returns before writing any logs. >_< + if( !(NeedsClose() || GSDump::isRunning) ) return; // Spam stopper; returns before writing any logs. >_< // Close plugins in reverse order of the initialization procedure, which // ensures the GS gets closed last. @@ -1010,7 +1011,7 @@ bool SysCorePlugins::Init() // bool SysCorePlugins::Shutdown() { - if( !NeedsShutdown() ) return false; + if( !NeedsShutdown()) return false; pxAssertDev( !NeedsClose(), "Cannot shut down plugins prior to Close()" ); diff --git a/pcsx2/gui/AppCorePlugins.cpp b/pcsx2/gui/AppCorePlugins.cpp index 622a31a8e1..71e125bd1b 100644 --- a/pcsx2/gui/AppCorePlugins.cpp +++ b/pcsx2/gui/AppCorePlugins.cpp @@ -24,6 +24,7 @@ #include "Plugins.h" #include "GS.h" #include "AppConfig.h" +#include "gui/Dialogs/ModalPopups.h" using namespace Threading; @@ -328,7 +329,7 @@ bool AppCorePlugins::Shutdown() void AppCorePlugins::Close() { - if (!NeedsClose()) + if (!(NeedsClose() || GSDump::isRunning)) return; PostPluginStatus(CorePlugins_Closing); diff --git a/pcsx2/gui/AppMain.cpp b/pcsx2/gui/AppMain.cpp index cfe8f8d3ae..2c0ac94576 100644 --- a/pcsx2/gui/AppMain.cpp +++ b/pcsx2/gui/AppMain.cpp @@ -68,7 +68,6 @@ #undef ECX #include // needed to implement the app! #endif - wxIMPLEMENT_APP(Pcsx2App); std::unique_ptr g_Conf; diff --git a/pcsx2/gui/Dialogs/GSDumpDialog.cpp b/pcsx2/gui/Dialogs/GSDumpDialog.cpp index 137266663c..f7f0c29265 100644 --- a/pcsx2/gui/Dialogs/GSDumpDialog.cpp +++ b/pcsx2/gui/Dialogs/GSDumpDialog.cpp @@ -178,7 +178,6 @@ void Dialogs::GSDumpDialog::RunDump(wxCommandEvent& event) m_selection->Enable(); m_vsync->Enable(); m_run->Disable(); - GetCorePlugins().Shutdown(); m_thread->m_dump_file = std::make_unique(m_selected_dump, new wxFFileInputStream(m_selected_dump)); @@ -807,13 +806,14 @@ void Dialogs::GSDumpDialog::GSThread::ExecuteTaskInThread() { if (!window->IsShown()) { + GetCorePlugins().Close(); + GetCorePlugins().Shutdown(); sApp.CloseGsPanel(); GSDump::isRunning = false; } } } - GetCorePlugins().Close(); OnStop(); return; }