diff --git a/common/include/PS2Edefs.h b/common/include/PS2Edefs.h index cf04081e7d..949b9cd77e 100644 --- a/common/include/PS2Edefs.h +++ b/common/include/PS2Edefs.h @@ -166,12 +166,8 @@ typedef void(CALLBACK *_GSosdLog)(const char *utf8, u32 color); typedef void(CALLBACK *_GSosdMonitor)(const char *key, const char *value, u32 color); typedef s32(CALLBACK *_GSopen)(void *pDsp, const char *Title, int multithread); typedef s32(CALLBACK *_GSopen2)(void *pDsp, u32 flags); -typedef void(CALLBACK* _GSReplay)(char* lpszCmdLine, int renderer); typedef void(CALLBACK *_GSvsync)(int field); -typedef s32(CALLBACK* _GSinit)(); typedef s32(CALLBACK* _GSfreeze)(int mode, freezeData* data); -typedef void(CALLBACK* _GSclose)(); -typedef void(CALLBACK* _GSshutdown)(); typedef void(CALLBACK *_GSgifTransfer)(const u32 *pMem, u32 size); typedef void(CALLBACK *_GSgifTransfer1)(u32 *pMem, u32 addr); typedef void(CALLBACK *_GSgifTransfer2)(u32 *pMem, u32 size); @@ -207,11 +203,7 @@ extern _GSosdLog GSosdLog; extern _GSosdMonitor GSosdMonitor; extern _GSopen GSopen; extern _GSopen2 GSopen2; -extern _GSReplay GSReplay; -extern _GSinit GSinit; extern _GSfreeze GSfreeze; -extern _GSclose GSclose; -extern _GSshutdown GSshutdown; extern _GSvsync GSvsync; extern _GSgifTransfer GSgifTransfer; extern _GSgifTransfer1 GSgifTransfer1; diff --git a/pcsx2/PluginManager.cpp b/pcsx2/PluginManager.cpp index f3d4bd4ce8..65c39f5927 100644 --- a/pcsx2/PluginManager.cpp +++ b/pcsx2/PluginManager.cpp @@ -157,11 +157,7 @@ _GSosdLog GSosdLog; _GSosdMonitor GSosdMonitor; _GSopen GSopen; _GSopen2 GSopen2; -_GSReplay GSReplay; -_GSinit GSinit; _GSfreeze GSfreeze; -_GSclose GSclose; -_GSshutdown GSshutdown; _GSgifTransfer GSgifTransfer; _GSgifTransfer1 GSgifTransfer1; _GSgifTransfer2 GSgifTransfer2; @@ -320,7 +316,6 @@ static const LegacyApi_OptMethod s_MethMessOpt_GS[] = { "GSosdLog", (vMeth**)&GSosdLog }, { "GSosdMonitor", (vMeth**)&GSosdMonitor }, { "GSopen2", (vMeth**)&GSopen2 }, - { "GSReplay", (vMeth**)&GSReplay }, { "GSreset", (vMeth**)&GSreset }, { "GSsetupRecording", (vMeth**)&GSsetupRecording }, { "GSendRecording", (vMeth**)&GSendRecording }, diff --git a/pcsx2/gui/Dialogs/GSDumpDialog.cpp b/pcsx2/gui/Dialogs/GSDumpDialog.cpp index f105849adc..a1b5ba0921 100644 --- a/pcsx2/gui/Dialogs/GSDumpDialog.cpp +++ b/pcsx2/gui/Dialogs/GSDumpDialog.cpp @@ -61,6 +61,7 @@ Dialogs::GSDumpDialog::GSDumpDialog(wxWindow* parent) , m_step(new wxButton(this, ID_RUN_START, _("Step"))) , m_selection(new wxButton(this, ID_RUN_START, _("Run to Selection"))) , m_vsync(new wxButton(this, ID_RUN_START, _("Go to next VSync"))) + , m_thread(std::make_unique(this)) { //TODO: figure out how to fix sliders so the destructor doesn't segfault wxFlexGridSizer& general(*new wxFlexGridSizer(2, StdPadding, StdPadding)); @@ -183,7 +184,8 @@ void Dialogs::GSDumpDialog::RunDump(wxCommandEvent& event) m_step->Enable(); m_selection->Enable(); m_vsync->Enable(); - m_thread = std::make_unique(this); + GetCorePlugins().Shutdown(); + m_thread->Start(); return; } @@ -613,15 +615,12 @@ void Dialogs::GSDumpDialog::CheckDebug(wxCommandEvent& event) Dialogs::GSDumpDialog::GSThread::GSThread(GSDumpDialog* dlg) : pxThread("GSDump") + , m_root_window(dlg) { - m_root_window = dlg; - // we start the thread - Start(); } Dialogs::GSDumpDialog::GSThread::~GSThread() { - // destroy the thread try { pxThread::Cancel(); @@ -629,12 +628,28 @@ Dialogs::GSDumpDialog::GSThread::~GSThread() DESTRUCTOR_CATCHALL } +void Dialogs::GSDumpDialog::GSThread::OnStop() +{ + m_root_window->m_debug_mode->Disable(); + m_root_window->m_start->Disable(); + m_root_window->m_step->Disable(); + m_root_window->m_selection->Disable(); + m_root_window->m_vsync->Disable(); + m_root_window->m_gif_list->DeleteAllItems(); + m_root_window->m_gif_packet->DeleteAllItems(); + m_root_window->m_gif_list->Refresh(); + m_root_window->m_button_events.clear(); +} + void Dialogs::GSDumpDialog::GSThread::ExecuteTaskInThread() { pxInputStream dump_file(*m_root_window->m_selected_dump, new wxFFileInputStream(*m_root_window->m_selected_dump)); if (!dump_file.IsOk()) + { + OnStop(); return; + } char freeze_data[sizeof(int) * 2]; u32 crc = 0, ss = 0; @@ -702,21 +717,21 @@ void Dialogs::GSDumpDialog::GSThread::ExecuteTaskInThread() if (m_root_window->m_debug_mode->GetValue()) m_root_window->GenPacketList(m_root_window->m_dump_packets); - return; - - GSinit(); + GetCorePlugins().Init(); GSsetBaseMem((void*)regs); if (GSopen2((void*)pDsp, renderer_override) != 0) + { + OnStop(); return; + } GSsetGameCRC((int)crc, 0); + //OnStop(); + return; if (GSfreeze(0, &fd) == -1) - { - //DumpTooOld = true; - //Running = false; - } + m_running = false; GSvsync(1); GSreset(); GSsetBaseMem((void*)regs); @@ -726,7 +741,7 @@ void Dialogs::GSDumpDialog::GSThread::ExecuteTaskInThread() int RunTo = 0; size_t debug_idx = 0; - while (0 != 1) + while (m_running) { if (m_root_window->m_debug_mode->GetValue()) { @@ -785,6 +800,7 @@ void Dialogs::GSDumpDialog::GSThread::ExecuteTaskInThread() } } - GSclose(); - GSshutdown(); + GetCorePlugins().Shutdown(); + OnStop(); + return; } \ No newline at end of file diff --git a/pcsx2/gui/Dialogs/ModalPopups.h b/pcsx2/gui/Dialogs/ModalPopups.h index ba4bbd4275..6a2ffed175 100644 --- a/pcsx2/gui/Dialogs/ModalPopups.h +++ b/pcsx2/gui/Dialogs/ModalPopups.h @@ -299,7 +299,9 @@ namespace Dialogs // parent thread typedef pxThread _parent; void ExecuteTaskInThread(); + void OnStop(); GSDumpDialog* m_root_window; + bool m_running = true; public: GSThread(GSDumpDialog* dlg);