From 7f858d7263c37ca29cdf983aa393c810e559465d Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 7 Jul 2013 23:28:35 -0700 Subject: [PATCH] Add a context menu to enable/disable breakpoints. Probably it could edit or etc. too... --- Windows/Debugger/Debugger_Disasm.cpp | 56 ++++++++++++++++++++++++--- Windows/Debugger/Debugger_Disasm.h | 1 + Windows/ppsspp.rc | Bin 38368 -> 38588 bytes Windows/resource.h | Bin 24924 -> 25018 bytes 4 files changed, 52 insertions(+), 5 deletions(-) diff --git a/Windows/Debugger/Debugger_Disasm.cpp b/Windows/Debugger/Debugger_Disasm.cpp index 20a3035cf5..a8952c3906 100644 --- a/Windows/Debugger/Debugger_Disasm.cpp +++ b/Windows/Debugger/Debugger_Disasm.cpp @@ -46,6 +46,8 @@ enum { BPL_TYPE, BPL_OFFSET, BPL_SIZELABEL, BPL_OPCODE, BPL_HITS, BPL_ENABLED, B // How long (max) to wait for Core to pause before clearing temp breakpoints. const int TEMP_BREAKPOINT_WAIT_MS = 100; +const int POPUP_SUBMENU_ID_BREAKPOINTLIST = 5; + static FAR WNDPROC DefBreakpointListProc; static LRESULT CALLBACK BreakpointListProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) @@ -332,20 +334,64 @@ void CDisasm::gotoBreakpointAddress(int itemIndex) } } +void CDisasm::showBreakpointMenu(int itemIndex, const POINT &pt) +{ + bool isMemory; + int index = getBreakpointIndex(itemIndex, isMemory); + if (index == -1) return; + + MemCheck mcPrev; + BreakPoint bpPrev; + if (isMemory) { + mcPrev = displayedMemChecks_[index]; + } else { + bpPrev = displayedBreakPoints_[index]; + } + + HWND wnd = GetDlgItem(m_hDlg, IDC_BREAKPOINTLIST); + POINT screenPt(pt); + ClientToScreen(wnd, &screenPt); + + HMENU subMenu = GetSubMenu(g_hPopupMenus, POPUP_SUBMENU_ID_BREAKPOINTLIST); + if (isMemory) { + CheckMenuItem(subMenu, ID_DISASM_DISABLEBREAKPOINT, mcPrev.result & MEMCHECK_BREAK ? MF_CHECKED : MF_UNCHECKED); + } else { + CheckMenuItem(subMenu, ID_DISASM_DISABLEBREAKPOINT, bpPrev.enabled ? MF_CHECKED : MF_UNCHECKED); + } + + switch (TrackPopupMenuEx(subMenu, TPM_RIGHTBUTTON | TPM_RETURNCMD, screenPt.x, screenPt.y, wnd, 0)) + { + case ID_DISASM_DISABLEBREAKPOINT: + if (isMemory) { + CBreakPoints::ChangeMemCheck(mcPrev.start, mcPrev.end, mcPrev.cond, MemCheckResult(mcPrev.result ^ MEMCHECK_BREAK)); + } else { + CBreakPoints::ChangeBreakPoint(bpPrev.addr, !bpPrev.enabled); + } + break; + } +} + static char breakpointText[256]; void CDisasm::handleBreakpointNotify(LPARAM lParam) { - if (((LPNMHDR)lParam)->code == NM_DBLCLK) + const LPNMHDR header = (LPNMHDR)lParam; + if (header->code == NM_DBLCLK) { - LPNMITEMACTIVATE item = (LPNMITEMACTIVATE) lParam; + const LPNMITEMACTIVATE item = (LPNMITEMACTIVATE) lParam; gotoBreakpointAddress(item->iItem); return; } - - if (((LPNMHDR)lParam)->code == LVN_GETDISPINFO) + if (header->code == NM_RCLICK) { - NMLVDISPINFO* dispInfo = (NMLVDISPINFO*)lParam; + const LPNMITEMACTIVATE item = (LPNMITEMACTIVATE)lParam; + showBreakpointMenu(item->iItem, item->ptAction); + return; + } + + if (header->code == LVN_GETDISPINFO) + { + NMLVDISPINFO *dispInfo = (NMLVDISPINFO *)lParam; bool isMemory; int index = getBreakpointIndex(dispInfo->item.iItem,isMemory); diff --git a/Windows/Debugger/Debugger_Disasm.h b/Windows/Debugger/Debugger_Disasm.h index a984068a7f..3f26731400 100644 --- a/Windows/Debugger/Debugger_Disasm.h +++ b/Windows/Debugger/Debugger_Disasm.h @@ -42,6 +42,7 @@ private: int getTotalBreakpointCount(); int getBreakpointIndex(int itemIndex, bool& isMemory); void updateThreadLabel(bool clear); + void showBreakpointMenu(int itemIndex, const POINT &pt); public: int index; //helper diff --git a/Windows/ppsspp.rc b/Windows/ppsspp.rc index 062cb7aa716650c7701081e837a391cebe0b29d9..28e751a457f945a0b7df57ea69f019b70b23c8c1 100644 GIT binary patch delta 112 zcmaE`nrY8krVTSDIdU=tF!%#;C=e?!C@~~46fvYSBr;?(6fop7WHRJ2lrZD~>0%(Q z#K6nI#lXqn#Nf){&fv-52jWlOSSHQv%8)l%ev;|r18riQE`$^BijjGUW$ ICj~PD0Jex3_5c6? delta 18 acmdn9mg&K2rVTSDP0o|i*gR*l0y6+sF$f(1 diff --git a/Windows/resource.h b/Windows/resource.h index bed8c55149ed681a8d418e88f2db6bc308efb119..47c921cb7717e68d4c01702791bb0115027e88d3 100644 GIT binary patch delta 61 zcmV-D0K)&=!U4L&0kE82lZrhSlaN3T2}A%%08;=#078=u9wP}f05AYC0673Nkue#w TuwKvsld=gGliptxld52{Y8n&- delta 33 rcmV++0N($)!vWmF0kE82kv0^Qzyb)f7GKB#liFPtlTcw4lL%q5`@#*^