GE Debugger: Add breakpoint icon in state.

This commit is contained in:
Unknown W. Brackets 2022-02-05 19:00:31 -08:00
parent 4de217d3e4
commit 1bb1f34af0
8 changed files with 76 additions and 20 deletions

BIN
Windows/BreakpointSmall.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 270 B

View file

@ -15,6 +15,7 @@
// Official git repository and contact information can be found at // Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "Common/CommonFuncs.h"
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Windows/resource.h" #include "Windows/resource.h"
#include "Windows/InputBox.h" #include "Windows/InputBox.h"
@ -28,17 +29,22 @@
using namespace GPUBreakpoints; using namespace GPUBreakpoints;
// TODO: Show an icon or something for breakpoints, toggle. // First column is the breakpoint icon.
static const GenericListViewColumn stateValuesCols[] = { static const GenericListViewColumn stateValuesCols[] = {
{ L"Name", 0.50f }, { L"", 0.03f },
{ L"Value", 0.50f }, { L"Name", 0.40f },
{ L"Value", 0.57f },
}; };
GenericListViewDef stateValuesListDef = { GenericListViewDef stateValuesListDef = {
stateValuesCols, ARRAY_SIZE(stateValuesCols), NULL, false stateValuesCols,
ARRAY_SIZE(stateValuesCols),
nullptr,
false,
}; };
enum StateValuesCols { enum StateValuesCols {
STATEVALUES_COL_BREAKPOINT,
STATEVALUES_COL_NAME, STATEVALUES_COL_NAME,
STATEVALUES_COL_VALUE, STATEVALUES_COL_VALUE,
}; };
@ -279,9 +285,28 @@ static void ToggleWatchList(const TabStateRow &info) {
watchList.push_back(info); watchList.push_back(info);
} }
static bool ToggleBreakpoint(const TabStateRow &info) {
if (IsCmdBreakpoint(info.cmd)) {
RemoveCmdBreakpoint(info.cmd);
RemoveCmdBreakpoint(info.otherCmd);
RemoveCmdBreakpoint(info.otherCmd2);
return false;
}
AddCmdBreakpoint(info.cmd);
if (info.otherCmd) {
AddCmdBreakpoint(info.otherCmd);
}
if (info.otherCmd2) {
AddCmdBreakpoint(info.otherCmd2);
}
return true;
}
CtrlStateValues::CtrlStateValues(const TabStateRow *rows, int rowCount, HWND hwnd) CtrlStateValues::CtrlStateValues(const TabStateRow *rows, int rowCount, HWND hwnd)
: GenericListControl(hwnd, stateValuesListDef), : GenericListControl(hwnd, stateValuesListDef),
rows_(rows), rowCount_(rowCount) { rows_(rows), rowCount_(rowCount) {
SetIconList(12, 12, { (HICON)LoadIcon(GetModuleHandle(0), (LPCWSTR)IDI_BREAKPOINT_SMALL) });
Update(); Update();
} }
@ -810,6 +835,10 @@ void CtrlStateValues::GetColumnText(wchar_t *dest, int row, int col) {
} }
switch (col) { switch (col) {
case STATEVALUES_COL_BREAKPOINT:
wcscpy(dest, L" ");
break;
case STATEVALUES_COL_NAME: case STATEVALUES_COL_NAME:
wcscpy(dest, rows_[row].title); wcscpy(dest, rows_[row].title);
break; break;
@ -835,11 +864,17 @@ void CtrlStateValues::GetColumnText(wchar_t *dest, int row, int col) {
} }
void CtrlStateValues::OnDoubleClick(int row, int column) { void CtrlStateValues::OnDoubleClick(int row, int column) {
if (gpuDebug == NULL) { if (gpuDebug == nullptr || row > rowCount_) {
return; return;
} }
const auto info = rows_[row]; const auto info = rows_[row];
if (column == STATEVALUES_COL_BREAKPOINT) {
SetItemState(row, ToggleBreakpoint(info) ? 1 : 0);
return;
}
switch (info.fmt) { switch (info.fmt) {
case CMD_FMT_FLAG: 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))) switch (TriggerContextMenu(ContextMenuID::GEDBG_STATE, GetHandle(), ContextPoint::FromClient(point)))
{ {
case ID_DISASM_TOGGLEBREAKPOINT: case ID_DISASM_TOGGLEBREAKPOINT:
if (IsCmdBreakpoint(info.cmd)) { SetItemState(row, ToggleBreakpoint(info) ? 1 : 0);
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);
}
}
break; break;
case ID_DISASM_COPYINSTRUCTIONHEX: { case ID_DISASM_COPYINSTRUCTIONHEX: {

View file

@ -1703,6 +1703,7 @@
<None Include="PPSSPP.manifest" /> <None Include="PPSSPP.manifest" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Image Include="BreakpointSmall.ico" />
<Image Include="ppsspp_gold.ico" /> <Image Include="ppsspp_gold.ico" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View file

@ -721,6 +721,9 @@
<Image Include="ppsspp_gold.ico"> <Image Include="ppsspp_gold.ico">
<Filter>Resource Files</Filter> <Filter>Resource Files</Filter>
</Image> </Image>
<Image Include="BreakpointSmall.ico">
<Filter>Resource Files</Filter>
</Image>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Text Include="..\ppge_atlasscript.txt"> <Text Include="..\ppge_atlasscript.txt">

View file

@ -203,6 +203,19 @@ GenericListControl::GenericListControl(HWND hwnd, const GenericListViewDef& def)
valid = true; valid = true;
} }
GenericListControl::~GenericListControl() {
if (images_ != nullptr)
ImageList_Destroy((HIMAGELIST)images_);
}
void GenericListControl::SetIconList(int w, int h, const std::vector<HICON> &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) void GenericListControl::HandleNotify(LPARAM lParam)
{ {
LPNMHDR mhdr = (LPNMHDR) lParam; LPNMHDR mhdr = (LPNMHDR) lParam;
@ -234,6 +247,7 @@ void GenericListControl::HandleNotify(LPARAM lParam)
wcscat(stringBuffer,L"Invalid"); wcscat(stringBuffer,L"Invalid");
dispInfo->item.pszText = stringBuffer; dispInfo->item.pszText = stringBuffer;
dispInfo->item.mask |= LVIF_TEXT;
return; return;
} }
@ -313,6 +327,13 @@ void GenericListControl::SetCheckState(int item, bool state)
updating = false; 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() void GenericListControl::ResizeColumns()
{ {
if (inResizeColumns) if (inResizeColumns)

View file

@ -1,6 +1,8 @@
#pragma once #pragma once
#include <cstdint>
#include <string> #include <string>
#include <vector>
#include "Common/CommonWindows.h" #include "Common/CommonWindows.h"
namespace W32Util namespace W32Util
@ -41,14 +43,17 @@ class GenericListControl
{ {
public: public:
GenericListControl(HWND hwnd, const GenericListViewDef& def); GenericListControl(HWND hwnd, const GenericListViewDef& def);
virtual ~GenericListControl() { }; virtual ~GenericListControl();
void HandleNotify(LPARAM lParam); void HandleNotify(LPARAM lParam);
void Update(); void Update();
int GetSelectedIndex(); int GetSelectedIndex();
HWND GetHandle() { return handle; }; HWND GetHandle() { return handle; };
void SetSendInvalidRows(bool enabled) { sendInvalidRows = enabled; }; void SetSendInvalidRows(bool enabled) { sendInvalidRows = enabled; };
protected: protected:
void SetIconList(int w, int h, const std::vector<HICON> &icons);
void SetCheckState(int item, bool state); 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 bool WindowMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT& returnValue) = 0;
virtual void GetColumnText(wchar_t* dest, int row, int col) = 0; virtual void GetColumnText(wchar_t* dest, int row, int col) = 0;
virtual int GetRowCount() = 0; virtual int GetRowCount() = 0;
@ -66,6 +71,7 @@ private:
HWND handle; HWND handle;
WNDPROC oldProc; WNDPROC oldProc;
void *images_ = nullptr;
const GenericListViewColumn* columns; const GenericListViewColumn* columns;
int columnCount; int columnCount;
wchar_t stringBuffer[256]; wchar_t stringBuffer[256];

View file

@ -454,6 +454,7 @@ IDI_PPSSPP ICON "ppsspp.ico"
#endif #endif
IDI_STOP ICON "icon1.ico" IDI_STOP ICON "icon1.ico"
IDI_STOPDISABLE ICON "stop1.ico" IDI_STOPDISABLE ICON "stop1.ico"
IDI_BREAKPOINT_SMALL ICON "BreakpointSmall.ico"
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////

View file

@ -324,6 +324,7 @@
#define ID_GEDBG_BREAK_MENU 40211 #define ID_GEDBG_BREAK_MENU 40211
#define IDC_GEDBG_FLUSH 40212 #define IDC_GEDBG_FLUSH 40212
#define IDC_GEDBG_FLUSHAUTO 40213 #define IDC_GEDBG_FLUSHAUTO 40213
#define IDI_BREAKPOINT_SMALL 40214
// Dummy option to let the buffered rendering hotkey cycle through all the options. // Dummy option to let the buffered rendering hotkey cycle through all the options.
#define ID_OPTIONS_BUFFEREDRENDERINGDUMMY 40500 #define ID_OPTIONS_BUFFEREDRENDERINGDUMMY 40500
@ -336,7 +337,7 @@
#ifdef APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 256 #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_CONTROL_VALUE 1202
#define _APS_NEXT_SYMED_VALUE 101 #define _APS_NEXT_SYMED_VALUE 101
#endif #endif