From 1bb1f34af08a0d5b3e8ae24f2068ef6ac030839c Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 5 Feb 2022 19:00:31 -0800 Subject: [PATCH] GE Debugger: Add breakpoint icon in state. --- Windows/BreakpointSmall.ico | Bin 0 -> 270 bytes Windows/GEDebugger/TabState.cpp | 59 ++++++++++++++++++++++---------- Windows/PPSSPP.vcxproj | 1 + Windows/PPSSPP.vcxproj.filters | 3 ++ Windows/W32Util/Misc.cpp | 21 ++++++++++++ Windows/W32Util/Misc.h | 8 ++++- Windows/ppsspp.rc | 1 + Windows/resource.h | 3 +- 8 files changed, 76 insertions(+), 20 deletions(-) create mode 100644 Windows/BreakpointSmall.ico diff --git a/Windows/BreakpointSmall.ico b/Windows/BreakpointSmall.ico new file mode 100644 index 0000000000000000000000000000000000000000..584cf5c253f9a6e08691524b9158f62918fb8cd3 GIT binary patch literal 270 zcmYk0u?<2o3`8#yMUYaYLX1GkNQ}S;DS!D}ZlV7ir=3+z;;OY}D6M+$xPQ#Jn$tVrc;xb}ZTqx2nq)P5VAFDA2fX4( jGuy*wc;t-voEw9`wRp}U4R~DH2U;ck$Fn rowCount_) { return; } const auto info = rows_[row]; + + if (column == STATEVALUES_COL_BREAKPOINT) { + SetItemState(row, ToggleBreakpoint(info) ? 1 : 0); + return; + } + switch (info.fmt) { case CMD_FMT_FLAG: { @@ -887,19 +922,7 @@ void CtrlStateValues::OnRightClick(int row, int column, const POINT &point) { switch (TriggerContextMenu(ContextMenuID::GEDBG_STATE, GetHandle(), ContextPoint::FromClient(point))) { case ID_DISASM_TOGGLEBREAKPOINT: - if (IsCmdBreakpoint(info.cmd)) { - RemoveCmdBreakpoint(info.cmd); - RemoveCmdBreakpoint(info.otherCmd); - RemoveCmdBreakpoint(info.otherCmd2); - } else { - AddCmdBreakpoint(info.cmd); - if (info.otherCmd) { - AddCmdBreakpoint(info.otherCmd); - } - if (info.otherCmd2) { - AddCmdBreakpoint(info.otherCmd2); - } - } + SetItemState(row, ToggleBreakpoint(info) ? 1 : 0); break; case ID_DISASM_COPYINSTRUCTIONHEX: { diff --git a/Windows/PPSSPP.vcxproj b/Windows/PPSSPP.vcxproj index efd5279466..63ecbc1691 100644 --- a/Windows/PPSSPP.vcxproj +++ b/Windows/PPSSPP.vcxproj @@ -1703,6 +1703,7 @@ + diff --git a/Windows/PPSSPP.vcxproj.filters b/Windows/PPSSPP.vcxproj.filters index 3179c6effe..0706f8fb9c 100644 --- a/Windows/PPSSPP.vcxproj.filters +++ b/Windows/PPSSPP.vcxproj.filters @@ -721,6 +721,9 @@ Resource Files + + Resource Files + diff --git a/Windows/W32Util/Misc.cpp b/Windows/W32Util/Misc.cpp index 261e05fe66..7aee7d98ec 100644 --- a/Windows/W32Util/Misc.cpp +++ b/Windows/W32Util/Misc.cpp @@ -203,6 +203,19 @@ GenericListControl::GenericListControl(HWND hwnd, const GenericListViewDef& def) valid = true; } +GenericListControl::~GenericListControl() { + if (images_ != nullptr) + ImageList_Destroy((HIMAGELIST)images_); +} + +void GenericListControl::SetIconList(int w, int h, const std::vector &icons) { + images_ = ImageList_Create(w, h, ILC_COLOR32 | ILC_MASK, 0, (int)icons.size()); + for (const HICON &icon : icons) + ImageList_AddIcon((HIMAGELIST)images_, icon); + + ListView_SetImageList(handle, (HIMAGELIST)images_, LVSIL_STATE); +} + void GenericListControl::HandleNotify(LPARAM lParam) { LPNMHDR mhdr = (LPNMHDR) lParam; @@ -234,6 +247,7 @@ void GenericListControl::HandleNotify(LPARAM lParam) wcscat(stringBuffer,L"Invalid"); dispInfo->item.pszText = stringBuffer; + dispInfo->item.mask |= LVIF_TEXT; return; } @@ -313,6 +327,13 @@ void GenericListControl::SetCheckState(int item, bool state) updating = false; } +void GenericListControl::SetItemState(int item, uint8_t state) { + updating = true; + ListView_SetItemState(handle, item, (state & 0xF) << 12, LVIS_STATEIMAGEMASK); + ListView_RedrawItems(handle, item, item); + updating = false; +} + void GenericListControl::ResizeColumns() { if (inResizeColumns) diff --git a/Windows/W32Util/Misc.h b/Windows/W32Util/Misc.h index 3ac282a6c5..c0ce2c33aa 100644 --- a/Windows/W32Util/Misc.h +++ b/Windows/W32Util/Misc.h @@ -1,6 +1,8 @@ #pragma once +#include #include +#include #include "Common/CommonWindows.h" namespace W32Util @@ -41,14 +43,17 @@ class GenericListControl { public: GenericListControl(HWND hwnd, const GenericListViewDef& def); - virtual ~GenericListControl() { }; + virtual ~GenericListControl(); void HandleNotify(LPARAM lParam); void Update(); int GetSelectedIndex(); HWND GetHandle() { return handle; }; void SetSendInvalidRows(bool enabled) { sendInvalidRows = enabled; }; protected: + void SetIconList(int w, int h, const std::vector &icons); void SetCheckState(int item, bool state); + void SetItemState(int item, uint8_t state); + virtual bool WindowMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT& returnValue) = 0; virtual void GetColumnText(wchar_t* dest, int row, int col) = 0; virtual int GetRowCount() = 0; @@ -66,6 +71,7 @@ private: HWND handle; WNDPROC oldProc; + void *images_ = nullptr; const GenericListViewColumn* columns; int columnCount; wchar_t stringBuffer[256]; diff --git a/Windows/ppsspp.rc b/Windows/ppsspp.rc index 05d72954fc..24603ba3b8 100644 --- a/Windows/ppsspp.rc +++ b/Windows/ppsspp.rc @@ -454,6 +454,7 @@ IDI_PPSSPP ICON "ppsspp.ico" #endif IDI_STOP ICON "icon1.ico" IDI_STOPDISABLE ICON "stop1.ico" +IDI_BREAKPOINT_SMALL ICON "BreakpointSmall.ico" ///////////////////////////////////////////////////////////////////////////// diff --git a/Windows/resource.h b/Windows/resource.h index 0f02787f64..98ecab1e1c 100644 --- a/Windows/resource.h +++ b/Windows/resource.h @@ -324,6 +324,7 @@ #define ID_GEDBG_BREAK_MENU 40211 #define IDC_GEDBG_FLUSH 40212 #define IDC_GEDBG_FLUSHAUTO 40213 +#define IDI_BREAKPOINT_SMALL 40214 // Dummy option to let the buffered rendering hotkey cycle through all the options. #define ID_OPTIONS_BUFFEREDRENDERINGDUMMY 40500 @@ -336,7 +337,7 @@ #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 256 -#define _APS_NEXT_COMMAND_VALUE 40214 +#define _APS_NEXT_COMMAND_VALUE 40215 #define _APS_NEXT_CONTROL_VALUE 1202 #define _APS_NEXT_SYMED_VALUE 101 #endif