From 58238abef5963bb3d22c119dbc35dc8c4dd371dc Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Thu, 7 Oct 2021 07:04:33 -0700 Subject: [PATCH] Debugger: Fix submenu offsets from removing unused. The wrong menus were showing in several places, especially the GE debugger. --- Windows/Debugger/CtrlDisAsmView.cpp | 4 +++- Windows/Debugger/CtrlMemView.cpp | 3 ++- Windows/Debugger/CtrlRegisterList.cpp | 4 +++- Windows/Debugger/Debugger_Lists.cpp | 6 +++--- Windows/GEDebugger/CtrlDisplayListView.cpp | 2 +- Windows/GEDebugger/GEDebugger.cpp | 2 +- Windows/GEDebugger/TabState.cpp | 2 +- 7 files changed, 14 insertions(+), 9 deletions(-) diff --git a/Windows/Debugger/CtrlDisAsmView.cpp b/Windows/Debugger/CtrlDisAsmView.cpp index 391432d1cb..4cbe86f6a4 100644 --- a/Windows/Debugger/CtrlDisAsmView.cpp +++ b/Windows/Debugger/CtrlDisAsmView.cpp @@ -29,6 +29,7 @@ #include TCHAR CtrlDisAsmView::szClassName[] = _T("CtrlDisAsmView"); +constexpr int POPUP_SUBMENU_ID_DISASM = 1; extern HMENU g_hPopupMenus; void CtrlDisAsmView::init() @@ -929,7 +930,8 @@ void CtrlDisAsmView::onMouseUp(WPARAM wParam, LPARAM lParam, int button) //popup menu? POINT pt; GetCursorPos(&pt); - switch(TrackPopupMenuEx(GetSubMenu(g_hPopupMenus,1),TPM_RIGHTBUTTON|TPM_RETURNCMD,pt.x,pt.y,wnd,0)) + HMENU menu = GetSubMenu(g_hPopupMenus, POPUP_SUBMENU_ID_DISASM); + switch (TrackPopupMenuEx(menu, TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, wnd, 0)) { case ID_DISASM_GOTOINMEMORYVIEW: SendMessage(GetParent(wnd),WM_DEB_GOTOHEXEDIT,curAddress,0); diff --git a/Windows/Debugger/CtrlMemView.cpp b/Windows/Debugger/CtrlMemView.cpp index 0c25145710..d7c67fbd1a 100644 --- a/Windows/Debugger/CtrlMemView.cpp +++ b/Windows/Debugger/CtrlMemView.cpp @@ -18,6 +18,7 @@ #include "DumpMemoryWindow.h" wchar_t CtrlMemView::szClassName[] = L"CtrlMemView"; +constexpr int POPUP_SUBMENU_ID_MEMVIEW = 0; extern HMENU g_hPopupMenus; CtrlMemView::CtrlMemView(HWND _wnd) @@ -482,7 +483,7 @@ void CtrlMemView::onMouseUp(WPARAM wParam, LPARAM lParam, int button) bool enable16 = !asciiSelected && (curAddress % 2) == 0; bool enable32 = !asciiSelected && (curAddress % 4) == 0; - HMENU menu = GetSubMenu(g_hPopupMenus,0); + HMENU menu = GetSubMenu(g_hPopupMenus, POPUP_SUBMENU_ID_MEMVIEW); EnableMenuItem(menu,ID_MEMVIEW_COPYVALUE_16,enable16 ? MF_ENABLED : MF_GRAYED); EnableMenuItem(menu,ID_MEMVIEW_COPYVALUE_32,enable32 ? MF_ENABLED : MF_GRAYED); diff --git a/Windows/Debugger/CtrlRegisterList.cpp b/Windows/Debugger/CtrlRegisterList.cpp index 9cd9f36c0a..305da16178 100644 --- a/Windows/Debugger/CtrlRegisterList.cpp +++ b/Windows/Debugger/CtrlRegisterList.cpp @@ -24,6 +24,7 @@ extern HMENU g_hPopupMenus; enum { REGISTER_PC = 32, REGISTER_HI, REGISTER_LO, REGISTERS_END }; TCHAR CtrlRegisterList::szClassName[] = _T("CtrlRegisterList"); +constexpr int POPUP_SUBMENU_ID_REGLIST = 2; void CtrlRegisterList::init() { @@ -511,7 +512,8 @@ void CtrlRegisterList::onMouseUp(WPARAM wParam, LPARAM lParam, int button) } POINT pt; GetCursorPos(&pt); - switch(TrackPopupMenuEx(GetSubMenu(g_hPopupMenus,3),TPM_RIGHTBUTTON|TPM_RETURNCMD,pt.x,pt.y,wnd,0)) + HMENU menu = GetSubMenu(g_hPopupMenus, POPUP_SUBMENU_ID_REGLIST); + switch (TrackPopupMenuEx(menu, TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, wnd, 0)) { case ID_REGLIST_GOTOINMEMORYVIEW: SendMessage(GetParent(wnd),WM_DEB_GOTOHEXEDIT,val,0); diff --git a/Windows/Debugger/Debugger_Lists.cpp b/Windows/Debugger/Debugger_Lists.cpp index 4463678dda..5e57c91a62 100644 --- a/Windows/Debugger/Debugger_Lists.cpp +++ b/Windows/Debugger/Debugger_Lists.cpp @@ -66,9 +66,9 @@ GenericListViewDef moduleListDef = { moduleListColumns, ARRAY_SIZE(moduleListColumns), NULL, false }; -const int POPUP_SUBMENU_ID_BREAKPOINTLIST = 5; -const int POPUP_SUBMENU_ID_THREADLIST = 6; -const int POPUP_SUBMENU_ID_NEWBREAKPOINT = 7; +const int POPUP_SUBMENU_ID_BREAKPOINTLIST = 3; +const int POPUP_SUBMENU_ID_THREADLIST = 4; +const int POPUP_SUBMENU_ID_NEWBREAKPOINT = 5; // // CtrlThreadList diff --git a/Windows/GEDebugger/CtrlDisplayListView.cpp b/Windows/GEDebugger/CtrlDisplayListView.cpp index cdcb68e1f7..236003b1e9 100644 --- a/Windows/GEDebugger/CtrlDisplayListView.cpp +++ b/Windows/GEDebugger/CtrlDisplayListView.cpp @@ -11,7 +11,7 @@ LPCTSTR CtrlDisplayListView::windowClass = _T("CtrlDisplayListView"); -const int POPUP_SUBMENU_ID_DISPLAYLISTVIEW = 8; +const int POPUP_SUBMENU_ID_DISPLAYLISTVIEW = 6; extern HMENU g_hPopupMenus; void CtrlDisplayListView::registerClass() diff --git a/Windows/GEDebugger/GEDebugger.cpp b/Windows/GEDebugger/GEDebugger.cpp index ee8deadbd9..7a349d6dbc 100644 --- a/Windows/GEDebugger/GEDebugger.cpp +++ b/Windows/GEDebugger/GEDebugger.cpp @@ -48,7 +48,7 @@ #include #include -const int POPUP_SUBMENU_ID_GEDBG_PREVIEW = 10; +const int POPUP_SUBMENU_ID_GEDBG_PREVIEW = 8; using namespace GPUBreakpoints; using namespace GPUDebug; diff --git a/Windows/GEDebugger/TabState.cpp b/Windows/GEDebugger/TabState.cpp index 275adfd565..c2bfe260e1 100644 --- a/Windows/GEDebugger/TabState.cpp +++ b/Windows/GEDebugger/TabState.cpp @@ -28,7 +28,7 @@ using namespace GPUBreakpoints; -const int POPUP_SUBMENU_ID_GEDBG_STATE = 9; +const int POPUP_SUBMENU_ID_GEDBG_STATE = 7; // TODO: Show an icon or something for breakpoints, toggle. static const GenericListViewColumn stateValuesCols[] = {