From fc26beca4b88c57239ba220f1b2b4c547df61d60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sat, 13 Nov 2021 22:24:30 +0100 Subject: [PATCH] Also delay-load the VFPU dialog, just because --- Windows/Debugger/Debugger_Disasm.cpp | 1 + Windows/Debugger/Debugger_VFPUDlg.cpp | 2 -- Windows/Debugger/Debugger_VFPUDlg.h | 3 --- Windows/MainWindow.cpp | 12 ++++++++++++ Windows/MainWindow.h | 1 + Windows/W32Util/DialogManager.cpp | 3 +++ Windows/main.cpp | 2 +- Windows/main.h | 4 ++++ 8 files changed, 22 insertions(+), 6 deletions(-) diff --git a/Windows/Debugger/Debugger_Disasm.cpp b/Windows/Debugger/Debugger_Disasm.cpp index 5c4f0a13ad..8e9c147e7e 100644 --- a/Windows/Debugger/Debugger_Disasm.cpp +++ b/Windows/Debugger/Debugger_Disasm.cpp @@ -466,6 +466,7 @@ BOOL CDisasm::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) break; case IDC_SHOWVFPU: + MainWindow::CreateVFPUWindow(); vfpudlg->Show(true); break; diff --git a/Windows/Debugger/Debugger_VFPUDlg.cpp b/Windows/Debugger/Debugger_VFPUDlg.cpp index 5075e61731..1a6bc43852 100644 --- a/Windows/Debugger/Debugger_VFPUDlg.cpp +++ b/Windows/Debugger/Debugger_VFPUDlg.cpp @@ -13,8 +13,6 @@ #include "Core/MIPS/MIPS.h" // BAD -CVFPUDlg *vfpudlg; - CVFPUDlg::CVFPUDlg(HINSTANCE _hInstance, HWND _hParent, DebugInterface *cpu_) : Dialog((LPCSTR)IDD_VFPU, _hInstance,_hParent) { cpu = cpu_; diff --git a/Windows/Debugger/Debugger_VFPUDlg.h b/Windows/Debugger/Debugger_VFPUDlg.h index 9c3c4deede..0e5763dcfc 100644 --- a/Windows/Debugger/Debugger_VFPUDlg.h +++ b/Windows/Debugger/Debugger_VFPUDlg.h @@ -20,6 +20,3 @@ private: int mode; BOOL DlgProc(UINT message, WPARAM wParam, LPARAM lParam); }; - - -extern CVFPUDlg *vfpudlg; diff --git a/Windows/MainWindow.cpp b/Windows/MainWindow.cpp index 22998cc376..12ba10517b 100644 --- a/Windows/MainWindow.cpp +++ b/Windows/MainWindow.cpp @@ -556,6 +556,13 @@ namespace MainWindow } } + void CreateVFPUWindow() { + if (!vfpudlg) { + vfpudlg = new CVFPUDlg(MainWindow::GetHInstance(), MainWindow::GetHWND(), currentDebugMIPS); + DialogManager::AddDlg(vfpudlg); + } + } + void DestroyDebugWindows() { DialogManager::RemoveDlg(disasmWindow); if (disasmWindow) @@ -573,6 +580,11 @@ namespace MainWindow if (memoryWindow) delete memoryWindow; memoryWindow = nullptr; + + DialogManager::RemoveDlg(vfpudlg); + if (vfpudlg) + delete vfpudlg; + vfpudlg = nullptr; } LRESULT CALLBACK DisplayProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { diff --git a/Windows/MainWindow.h b/Windows/MainWindow.h index 0792222d89..d3e3aa8d13 100644 --- a/Windows/MainWindow.h +++ b/Windows/MainWindow.h @@ -64,6 +64,7 @@ namespace MainWindow void CreateDisasmWindow(); void CreateGeDebuggerWindow(); void CreateMemoryWindow(); + void CreateVFPUWindow(); void DestroyDebugWindows(); void UpdateMenus(bool isMenuSelect = false); void UpdateCommands(); diff --git a/Windows/W32Util/DialogManager.cpp b/Windows/W32Util/DialogManager.cpp index df131d9db4..ee5526f45b 100644 --- a/Windows/W32Util/DialogManager.cpp +++ b/Windows/W32Util/DialogManager.cpp @@ -76,6 +76,9 @@ void DialogManager::AddDlg(Dialog *dialog) void DialogManager::RemoveDlg(Dialog *dialog) { + if (!dialog) { + return; + } dialogs.erase(std::remove(dialogs.begin(), dialogs.end(), dialog), dialogs.end()); } diff --git a/Windows/main.cpp b/Windows/main.cpp index fab160b037..6b0f2d1098 100644 --- a/Windows/main.cpp +++ b/Windows/main.cpp @@ -95,6 +95,7 @@ CGEDebugger* geDebuggerWindow = nullptr; CDisasm *disasmWindow = nullptr; CMemoryDlg *memoryWindow = nullptr; +CVFPUDlg *vfpudlg = nullptr; static std::string langRegion; static std::string osName; @@ -684,7 +685,6 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin #if PPSSPP_API(ANY_GL) CGEDebugger::Init(); #endif - DialogManager::AddDlg(vfpudlg = new CVFPUDlg(_hInstance, hwndMain, currentDebugMIPS)); if (g_Config.bShowDebuggerOnLoad) { MainWindow::CreateDisasmWindow(); diff --git a/Windows/main.h b/Windows/main.h index 890acc845c..44cdbd621a 100644 --- a/Windows/main.h +++ b/Windows/main.h @@ -19,12 +19,16 @@ #pragma once #include "ppsspp_config.h" + #include "Debugger/Debugger_Disasm.h" #include "Debugger/Debugger_MemoryDlg.h" +#include "Debugger/Debugger_VFPUDlg.h" + #include "Common/CommonWindows.h" extern CDisasm *disasmWindow; extern CMemoryDlg *memoryWindow; +extern CVFPUDlg *vfpudlg; #if PPSSPP_API(ANY_GL) #include "Windows/GEDebugger/GEDebugger.h"