Skip to content
Permalink
Browse files

debugger: Muti-byte hex strings can now be pasted into the memory vie…

…w. (#2960)

You can now paste a hex string into the memory view (with Ctrl+V).
  • Loading branch information...
chaoticgd authored and lightningterror committed Jun 1, 2019
1 parent fbafd44 commit 1f1b68a9b4d1c1c48ae6fbba8c309096cd848f5d
Showing with 45 additions and 0 deletions.
  1. +1 −0 bin/docs/debugger.txt
  2. +43 −0 pcsx2/gui/Debugger/CtrlMemView.cpp
  3. +1 −0 pcsx2/gui/Debugger/CtrlMemView.h
@@ -32,6 +32,7 @@ memory view:
right click open context menu
ctrl+wheel zoom memory view
esc return to previous goto address
ctrl+v paste a hex string into memory

breakpoint list:

@@ -489,6 +489,10 @@ void CtrlMemView::keydownEvent(wxKeyEvent& evt)
}
}
break;
case 'v':
case 'V':
pasteHex();
break;
default:
evt.Skip();
break;
@@ -729,3 +733,42 @@ void CtrlMemView::updateReference(u32 address) {
referencedAddress = address;
redraw();
}

void CtrlMemView::pasteHex()
{
if (wxTheClipboard->Open())
{
if (wxTheClipboard->IsSupported(wxDF_TEXT))
{
wxTextDataObject data;
wxTheClipboard->GetData(data);
wxString str = data.GetText();
str.Replace(" ", "");
str.Replace("\n", "");
str.Replace("\r", "");
str.Replace("\t", "");

bool active = !cpu->isCpuPaused();
if (active)
cpu->pauseCpu();

std::size_t i;
for (i = 0; i < str.size() / 2; i++)
{
long byte;
if (str.Mid(i * 2, 2).ToLong(&byte, 16))
{
cpu->write8(curAddress + i, static_cast<u8>(byte));
}
else {
break;
}
}
scrollCursor(i);

if(active)
cpu->resumeCpu();
}
wxTheClipboard->Close();
}
}
@@ -46,6 +46,7 @@ class CtrlMemView: public wxWindow
void scrollCursor(int bytes);
void onPopupClick(wxCommandEvent& evt);
void focusEvent(wxFocusEvent& evt) { Refresh(); };
void pasteHex();

DebugInterface* cpu;
int rowHeight;

0 comments on commit 1f1b68a

Please sign in to comment.
You can’t perform that action at this time.