mirror of https://github.com/PCSX2/pcsx2.git
debugger: Muti-byte hex strings can now be pasted into the memory view. (#2960)
You can now paste a hex string into the memory view (with Ctrl+V).
This commit is contained in:
parent
fbafd44209
commit
1f1b68a9b4
|
@ -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 @@ private:
|
|||
void scrollCursor(int bytes);
|
||||
void onPopupClick(wxCommandEvent& evt);
|
||||
void focusEvent(wxFocusEvent& evt) { Refresh(); };
|
||||
void pasteHex();
|
||||
|
||||
DebugInterface* cpu;
|
||||
int rowHeight;
|
||||
|
|
Loading…
Reference in New Issue