Windows debugger: Load the dialogs on demand.

I think this is especially good for the Ge dialog since we now can avoid
initializing that extra GL context unless you open the dialog.
This commit is contained in:
Henrik Rydgård 2021-11-13 22:10:37 +01:00
parent a783f49948
commit c004e9ca9d
6 changed files with 36 additions and 16 deletions

View file

@ -899,7 +899,8 @@ void CDisasm::UpdateDialog(bool _bComplete)
_snwprintf(tempTicks, 24, L"%lld", CoreTiming::GetTicks() - lastTicks);
SetDlgItemText(m_hDlg, IDC_DEBUG_COUNT, tempTicks);
}
// Update Register Dialog
// Update memory window
if (memoryWindow)
memoryWindow->Update();

View file

@ -6,6 +6,7 @@
#include "Windows/Debugger/DebuggerShared.h"
#include "Windows/Debugger/CtrlDisAsmView.h"
#include "Windows/W32Util/ContextMenu.h"
#include "Windows/MainWindow.h"
#include "Windows/resource.h"
#include "Windows/main.h"
#include "Common/Data/Encoding/Utf8.h"
@ -373,10 +374,12 @@ void CtrlBreakpointList::gotoBreakpointAddress(int itemIndex)
if (isMemory) {
u32 address = displayedMemChecks_[index].start;
MainWindow::CreateMemoryWindow();
if (memoryWindow)
memoryWindow->Goto(address);
} else {
u32 address = displayedBreakPoints_[index].addr;
MainWindow::CreateDisasmWindow();
if (disasmWindow)
disasmWindow->Goto(address);
}

View file

@ -533,36 +533,46 @@ namespace MainWindow
return TRUE;
}
void CreateDebugWindows() {
disasmWindow = new CDisasm(MainWindow::GetHInstance(), MainWindow::GetHWND(), currentDebugMIPS);
DialogManager::AddDlg(disasmWindow);
disasmWindow->Show(g_Config.bShowDebuggerOnLoad, false);
void CreateDisasmWindow() {
if (!disasmWindow) {
disasmWindow = new CDisasm(MainWindow::GetHInstance(), MainWindow::GetHWND(), currentDebugMIPS);
DialogManager::AddDlg(disasmWindow);
}
}
void CreateGeDebuggerWindow() {
if (!geDebuggerWindow) {
#if PPSSPP_API(ANY_GL)
geDebuggerWindow = new CGEDebugger(MainWindow::GetHInstance(), MainWindow::GetHWND());
DialogManager::AddDlg(geDebuggerWindow);
geDebuggerWindow = new CGEDebugger(MainWindow::GetHInstance(), MainWindow::GetHWND());
DialogManager::AddDlg(geDebuggerWindow);
#endif
memoryWindow = new CMemoryDlg(MainWindow::GetHInstance(), MainWindow::GetHWND(), currentDebugMIPS);
DialogManager::AddDlg(memoryWindow);
}
}
void CreateMemoryWindow() {
if (!memoryWindow) {
memoryWindow = new CMemoryDlg(MainWindow::GetHInstance(), MainWindow::GetHWND(), currentDebugMIPS);
DialogManager::AddDlg(memoryWindow);
}
}
void DestroyDebugWindows() {
DialogManager::RemoveDlg(disasmWindow);
if (disasmWindow)
delete disasmWindow;
disasmWindow = 0;
disasmWindow = nullptr;
#if PPSSPP_API(ANY_GL)
DialogManager::RemoveDlg(geDebuggerWindow);
if (geDebuggerWindow)
delete geDebuggerWindow;
geDebuggerWindow = 0;
geDebuggerWindow = nullptr;
#endif
DialogManager::RemoveDlg(memoryWindow);
if (memoryWindow)
delete memoryWindow;
memoryWindow = 0;
memoryWindow = nullptr;
}
LRESULT CALLBACK DisplayProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) {
@ -928,7 +938,6 @@ namespace MainWindow
disasmWindow->NotifyMapLoaded();
if (memoryWindow)
memoryWindow->NotifyMapLoaded();
if (disasmWindow)
disasmWindow->UpdateDialog();
break;

View file

@ -61,9 +61,10 @@ namespace MainWindow
void Init(HINSTANCE hInstance);
BOOL Show(HINSTANCE hInstance);
void CreateDebugWindows();
void CreateDisasmWindow();
void CreateGeDebuggerWindow();
void CreateMemoryWindow();
void DestroyDebugWindows();
void Close();
void UpdateMenus(bool isMenuSelect = false);
void UpdateCommands();
void UpdateSwitchUMD();

View file

@ -896,18 +896,21 @@ namespace MainWindow {
break;
case ID_DEBUG_DISASSEMBLY:
CreateDisasmWindow();
if (disasmWindow)
disasmWindow->Show(true);
break;
case ID_DEBUG_GEDEBUGGER:
#if PPSSPP_API(ANY_GL)
CreateGeDebuggerWindow();
if (geDebuggerWindow)
geDebuggerWindow->Show(true);
#endif
break;
case ID_DEBUG_MEMORYVIEW:
CreateMemoryWindow();
if (memoryWindow)
memoryWindow->Show(true);
break;

View file

@ -686,7 +686,10 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin
#endif
DialogManager::AddDlg(vfpudlg = new CVFPUDlg(_hInstance, hwndMain, currentDebugMIPS));
MainWindow::CreateDebugWindows();
if (g_Config.bShowDebuggerOnLoad) {
MainWindow::CreateDisasmWindow();
disasmWindow->Show(g_Config.bShowDebuggerOnLoad, false);
}
const bool minimized = iCmdShow == SW_MINIMIZE || iCmdShow == SW_SHOWMINIMIZED || iCmdShow == SW_SHOWMINNOACTIVE;
if (minimized) {