mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-07-11 01:25:07 +02:00
Add a basic context menu to the state list.
This allows us to toggle breakpoints on specific commands.
This commit is contained in:
@@ -233,6 +233,14 @@ bool IsRenderTargetBreakpoint(u32 addr) {
|
||||
return breakRenderTargets.find(addr) != breakRenderTargets.end();
|
||||
}
|
||||
|
||||
bool IsOpBreakpoint(u32 op, bool &temp) {
|
||||
return IsCmdBreakpoint(op >> 24, temp);
|
||||
}
|
||||
|
||||
bool IsOpBreakpoint(u32 op) {
|
||||
return IsCmdBreakpoint(op >> 24);
|
||||
}
|
||||
|
||||
bool IsCmdBreakpoint(u8 cmd, bool &temp) {
|
||||
temp = breakCmdsTemp[cmd];
|
||||
return breakCmds[cmd];
|
||||
|
||||
@@ -50,11 +50,7 @@ namespace GPUBreakpoints {
|
||||
void ClearAllBreakpoints();
|
||||
void ClearTempBreakpoints();
|
||||
|
||||
static inline bool IsOpBreakpoint(u32 op, bool &temp) {
|
||||
return IsCmdBreakpoint(op >> 24, temp);
|
||||
}
|
||||
bool IsOpBreakpoint(u32 op, bool &temp);
|
||||
|
||||
static inline bool IsOpBreakpoint(u32 op) {
|
||||
return IsCmdBreakpoint(op >> 24);
|
||||
}
|
||||
bool IsOpBreakpoint(u32 op);
|
||||
};
|
||||
|
||||
@@ -17,12 +17,18 @@
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "Windows/resource.h"
|
||||
#include "Windows/main.h"
|
||||
#include "Windows/InputBox.h"
|
||||
#include "Windows/GEDebugger/GEDebugger.h"
|
||||
#include "Windows/GEDebugger/TabState.h"
|
||||
#include "GPU/GPUState.h"
|
||||
#include "GPU/GeDisasm.h"
|
||||
#include "GPU/Common/GPUDebugInterface.h"
|
||||
#include "GPU/Debugger/Breakpoints.h"
|
||||
|
||||
using namespace GPUBreakpoints;
|
||||
|
||||
const int POPUP_SUBMENU_ID_GEDBG_STATE = 9;
|
||||
|
||||
// TODO: Show an icon or something for breakpoints, toggle.
|
||||
static const GenericListViewColumn stateValuesCols[] = {
|
||||
@@ -844,12 +850,65 @@ void CtrlStateValues::OnDoubleClick(int row, int column) {
|
||||
}
|
||||
}
|
||||
|
||||
void CtrlStateValues::OnRightClick(int row, int column, const POINT& point) {
|
||||
if (gpuDebug == NULL) {
|
||||
void CtrlStateValues::OnRightClick(int row, int column, const POINT &point) {
|
||||
if (gpuDebug == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: Copy, break, watch... enable?
|
||||
const auto info = rows_[row];
|
||||
const auto state = gpuDebug->GetGState();
|
||||
|
||||
POINT screenPt(point);
|
||||
ClientToScreen(GetHandle(), &screenPt);
|
||||
|
||||
HMENU subMenu = GetSubMenu(g_hPopupMenus, POPUP_SUBMENU_ID_GEDBG_STATE);
|
||||
switch (TrackPopupMenuEx(subMenu, TPM_RIGHTBUTTON | TPM_RETURNCMD, screenPt.x, screenPt.y, GetHandle(), 0))
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case ID_DISASM_COPYINSTRUCTIONHEX: {
|
||||
char temp[16];
|
||||
snprintf(temp, sizeof(temp), "%08x", gstate.cmdmem[info.cmd] & 0x00FFFFFF);
|
||||
W32Util::CopyTextToClipboard(GetHandle(), temp);
|
||||
break;
|
||||
}
|
||||
|
||||
case ID_DISASM_COPYINSTRUCTIONDISASM: {
|
||||
const bool enabled = info.enableCmd == 0 || (state.cmdmem[info.enableCmd] & 1) == 1;
|
||||
const u32 value = state.cmdmem[info.cmd] & 0xFFFFFF;
|
||||
const u32 otherValue = state.cmdmem[info.otherCmd] & 0xFFFFFF;
|
||||
const u32 otherValue2 = state.cmdmem[info.otherCmd2] & 0xFFFFFF;
|
||||
|
||||
wchar_t dest[512];
|
||||
FormatStateRow(dest, info, value, enabled, otherValue, otherValue2);
|
||||
W32Util::CopyTextToClipboard(GetHandle(), dest);
|
||||
break;
|
||||
}
|
||||
|
||||
case ID_DEBDG_COPYALL:
|
||||
CopyRows(0, GetRowCount());
|
||||
break;
|
||||
|
||||
case ID_REGLIST_CHANGE:
|
||||
OnDoubleClick(row, column);
|
||||
break;
|
||||
}
|
||||
|
||||
// TODO: Watch?
|
||||
}
|
||||
|
||||
void CtrlStateValues::SetCmdValue(u32 op) {
|
||||
|
||||
@@ -27,11 +27,13 @@ public:
|
||||
CtrlStateValues(const TabStateRow *rows, int rowCount, HWND hwnd);
|
||||
|
||||
protected:
|
||||
virtual bool WindowMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT& returnValue) { return false; };
|
||||
virtual void GetColumnText(wchar_t* dest, int row, int col);
|
||||
virtual int GetRowCount() { return rowCount_; }
|
||||
virtual void OnDoubleClick(int row, int column);
|
||||
virtual void OnRightClick(int row, int column, const POINT& point);
|
||||
bool WindowMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT& returnValue) override {
|
||||
return false;
|
||||
}
|
||||
void GetColumnText(wchar_t* dest, int row, int col) override;
|
||||
int GetRowCount() override { return rowCount_; }
|
||||
void OnDoubleClick(int row, int column) override;
|
||||
void OnRightClick(int row, int column, const POINT& point) override;
|
||||
|
||||
private:
|
||||
void SetCmdValue(u32 op);
|
||||
|
||||
@@ -626,6 +626,15 @@ BEGIN
|
||||
MENUITEM "Go to Address...", ID_GEDBG_GOTOADDR
|
||||
MENUITEM "Go to in Memory View", ID_DISASM_GOTOINMEMORYVIEW
|
||||
END
|
||||
POPUP "stateoptions"
|
||||
BEGIN
|
||||
MENUITEM "Copy Value (Hex)", ID_DISASM_COPYINSTRUCTIONHEX
|
||||
MENUITEM "Copy Value (Formatted)", ID_DISASM_COPYINSTRUCTIONDISASM
|
||||
MENUITEM "Copy Entire Tab (Formatted)",ID_DEBDG_COPYALL
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Toggle Breakpoint", ID_DISASM_TOGGLEBREAKPOINT
|
||||
MENUITEM "Change...", ID_REGLIST_CHANGE
|
||||
END
|
||||
END
|
||||
|
||||
#endif // English (United States) resources
|
||||
|
||||
+2
-1
@@ -325,6 +325,7 @@
|
||||
#define ID_OPTIONS_DISPLAY_LAYOUT 40160
|
||||
#define ID_OPTIONS_VULKAN 40161
|
||||
#define IDC_GEDBG_BREAKTARGET 40162
|
||||
#define ID_DEBDG_COPYALL 40163
|
||||
|
||||
// Dummy option to let the buffered rendering hotkey cycle through all the options.
|
||||
#define ID_OPTIONS_BUFFEREDRENDERINGDUMMY 40500
|
||||
@@ -337,7 +338,7 @@
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 256
|
||||
#define _APS_NEXT_COMMAND_VALUE 40163
|
||||
#define _APS_NEXT_COMMAND_VALUE 40164
|
||||
#define _APS_NEXT_CONTROL_VALUE 1199
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user