mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 21:39:52 +00:00
Add range selection
This commit is contained in:
parent
f388697f88
commit
524fd29716
@ -177,8 +177,8 @@ void CtrlDisplayListView::onPaint(WPARAM wParam, LPARAM lParam)
|
||||
// draw background
|
||||
COLORREF backgroundColor = stall ? 0xCCCCFF : 0xFFFFFF;
|
||||
COLORREF textColor = 0x000000;
|
||||
|
||||
if (address == curAddress)
|
||||
|
||||
if (address >= selectRangeStart && address < selectRangeEnd)
|
||||
{
|
||||
if (hasFocus)
|
||||
{
|
||||
@ -259,16 +259,22 @@ void CtrlDisplayListView::onMouseDown(WPARAM wParam, LPARAM lParam, int button)
|
||||
|
||||
int line = y/rowHeight;
|
||||
u32 newAddress = windowStart + line*instructionSize;
|
||||
|
||||
|
||||
bool extend = GetAsyncKeyState(VK_SHIFT) != 0;
|
||||
if (button == 1)
|
||||
{
|
||||
if (newAddress == curAddress && hasFocus)
|
||||
{
|
||||
toggleBreakpoint();
|
||||
}
|
||||
} else if (button == 2)
|
||||
{
|
||||
// Maintain the current selection if right clicking into it.
|
||||
if (newAddress >= selectRangeStart && newAddress < selectRangeEnd)
|
||||
extend = true;
|
||||
}
|
||||
|
||||
setCurAddress(newAddress);
|
||||
setCurAddress(newAddress,extend);
|
||||
|
||||
SetFocus(wnd);
|
||||
redraw();
|
||||
@ -293,9 +299,19 @@ void CtrlDisplayListView::onMouseUp(WPARAM wParam, LPARAM lParam, int button)
|
||||
redraw();
|
||||
break;
|
||||
case ID_DISASM_COPYINSTRUCTIONDISASM:
|
||||
{
|
||||
GPUDebugOp op = gpuDebug->DissassembleOp(curAddress);
|
||||
W32Util::CopyTextToClipboard(wnd, op.desc.c_str());
|
||||
{
|
||||
int space = 256 * (selectRangeEnd - selectRangeStart) / instructionSize;
|
||||
char *temp = new char[space];
|
||||
|
||||
char *p = temp, *end = temp + space;
|
||||
for (u32 pos = selectRangeStart; pos < selectRangeEnd; pos += instructionSize)
|
||||
{
|
||||
GPUDebugOp op = gpuDebug->DissassembleOp(pos);
|
||||
p += snprintf(p, end - p, "%s\r\n", op.desc.c_str());
|
||||
}
|
||||
|
||||
W32Util::CopyTextToClipboard(wnd, temp);
|
||||
delete [] temp;
|
||||
}
|
||||
break;
|
||||
case ID_DISASM_COPYADDRESS:
|
||||
@ -321,9 +337,15 @@ void CtrlDisplayListView::onMouseUp(WPARAM wParam, LPARAM lParam, int button)
|
||||
break;
|
||||
case ID_DISASM_COPYINSTRUCTIONHEX:
|
||||
{
|
||||
char temp[16];
|
||||
sprintf(temp,"%08X",Memory::ReadUnchecked_U32(curAddress));
|
||||
int space = 24 * (selectRangeEnd - selectRangeStart) / instructionSize;
|
||||
char *temp = new char[space];
|
||||
|
||||
char *p = temp, *end = temp + space;
|
||||
for (u32 pos = selectRangeStart; pos < selectRangeEnd; pos += instructionSize)
|
||||
p += snprintf(p, end - p, "%08X\r\n", Memory::ReadUnchecked_U32(pos));
|
||||
|
||||
W32Util::CopyTextToClipboard(wnd, temp);
|
||||
delete [] temp;
|
||||
}
|
||||
break;
|
||||
case ID_DISASM_RUNTOHERE:
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include "Common/CommonWindows.h"
|
||||
#include "Globals.h"
|
||||
#include "GPU/Common/GPUDebugInterface.h"
|
||||
#include <algorithm>
|
||||
|
||||
class CtrlDisplayListView
|
||||
{
|
||||
@ -15,6 +16,9 @@ class CtrlDisplayListView
|
||||
HFONT boldfont;
|
||||
u32 windowStart;
|
||||
u32 curAddress;
|
||||
u32 selectRangeStart;
|
||||
u32 selectRangeEnd;
|
||||
|
||||
int visibleRows;
|
||||
int charWidth;
|
||||
int rowHeight;
|
||||
@ -71,7 +75,10 @@ public:
|
||||
|
||||
void setCurAddress(u32 newAddress, bool extend = false)
|
||||
{
|
||||
u32 after = newAddress + instructionSize;
|
||||
curAddress = newAddress;
|
||||
selectRangeStart = extend ? std::min(selectRangeStart, newAddress) : newAddress;
|
||||
selectRangeEnd = extend ? std::max(selectRangeEnd, after) : after;
|
||||
}
|
||||
|
||||
void scrollAddressIntoView();
|
||||
|
@ -558,7 +558,7 @@ BEGIN
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Run to Cursor", ID_DISASM_RUNTOHERE
|
||||
MENUITEM "Jump to Cursor", ID_DISASM_SETPCTOHERE
|
||||
MENUITEM "Set Stall" IDC_DEBUG_LIST_SETSTALL
|
||||
MENUITEM "Set Stall" IDC_DEBUG_LIST_SETSTALL
|
||||
MENUITEM "Toggle Breakpoint", ID_DISASM_TOGGLEBREAKPOINT
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Go to in Memory View", ID_DISASM_GOTOINMEMORYVIEW
|
||||
|
Loading…
Reference in New Issue
Block a user