[Debugger] Add copy buttons to memviewer popup menu
This commit is contained in:
parent
37e6af66ed
commit
e7e91b878f
|
@ -254,6 +254,15 @@ LRESULT CDebugMemoryView::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND, BOOL&
|
||||||
case ID_POPUPMENU_ADDSYMBOL:
|
case ID_POPUPMENU_ADDSYMBOL:
|
||||||
m_AddSymbolDlg.DoModal(m_Debugger, m_CtxMenuAddr);
|
m_AddSymbolDlg.DoModal(m_Debugger, m_CtxMenuAddr);
|
||||||
break;
|
break;
|
||||||
|
case ID_POPUPMENU_COPY_WORD:
|
||||||
|
CopyNumber(m_CtxMenuAddr, sizeof(uint32_t));
|
||||||
|
break;
|
||||||
|
case ID_POPUPMENU_COPY_HALFWORD:
|
||||||
|
CopyNumber(m_CtxMenuAddr, sizeof(uint16_t));
|
||||||
|
break;
|
||||||
|
case ID_POPUPMENU_COPY_BYTE:
|
||||||
|
CopyNumber(m_CtxMenuAddr, sizeof(uint8_t));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -776,3 +785,45 @@ void CDebugMemoryView::SelectColors(uint32_t vaddr, bool changed, COLORREF& bgCo
|
||||||
m_SymbolColorStride--;
|
m_SymbolColorStride--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CDebugMemoryView::CopyNumber(uint32_t address, int numBytes)
|
||||||
|
{
|
||||||
|
stdstr str;
|
||||||
|
|
||||||
|
uint32_t u32;
|
||||||
|
uint16_t u16;
|
||||||
|
uint8_t u8;
|
||||||
|
|
||||||
|
switch (numBytes)
|
||||||
|
{
|
||||||
|
case 4:
|
||||||
|
address &= ~3;
|
||||||
|
g_MMU->LW_VAddr(address, u32);
|
||||||
|
str = stdstr_f("%08X", u32);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
address &= ~1;
|
||||||
|
g_MMU->LH_VAddr(address, u16);
|
||||||
|
str = stdstr_f("%04X", u16);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
g_MMU->LB_VAddr(address, u8);
|
||||||
|
str = stdstr_f("%02X", u8);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (str.length() == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, str.length() + 1);
|
||||||
|
str.copy((char*)GlobalLock(hMem), str.length() + 1);
|
||||||
|
GlobalUnlock(hMem);
|
||||||
|
OpenClipboard();
|
||||||
|
EmptyClipboard();
|
||||||
|
SetClipboardData(CF_TEXT, hMem);
|
||||||
|
CloseClipboard();
|
||||||
|
}
|
||||||
|
|
|
@ -58,6 +58,8 @@ private:
|
||||||
bool GetItemOffset(LPNMHDR lpNMHDR, uint32_t &offset);
|
bool GetItemOffset(LPNMHDR lpNMHDR, uint32_t &offset);
|
||||||
bool GetItemAddress(LPNMHDR lpNMHDR, uint32_t &address);
|
bool GetItemAddress(LPNMHDR lpNMHDR, uint32_t &address);
|
||||||
|
|
||||||
|
void CopyNumber(uint32_t address, int numBytes);
|
||||||
|
|
||||||
enum { MemoryToDisplay = 0x100 };
|
enum { MemoryToDisplay = 0x100 };
|
||||||
|
|
||||||
static CDebugMemoryView* _this;
|
static CDebugMemoryView* _this;
|
||||||
|
|
|
@ -1914,6 +1914,13 @@ BEGIN
|
||||||
MENUITEM "View disassembly...", ID_POPUPMENU_VIEWDISASM
|
MENUITEM "View disassembly...", ID_POPUPMENU_VIEWDISASM
|
||||||
MENUITEM SEPARATOR
|
MENUITEM SEPARATOR
|
||||||
MENUITEM "Add symbol...", ID_POPUPMENU_ADDSYMBOL
|
MENUITEM "Add symbol...", ID_POPUPMENU_ADDSYMBOL
|
||||||
|
MENUITEM SEPARATOR
|
||||||
|
POPUP "Copy"
|
||||||
|
BEGIN
|
||||||
|
MENUITEM "Word", ID_POPUPMENU_COPY_WORD
|
||||||
|
MENUITEM "Halfword", ID_POPUPMENU_COPY_HALFWORD
|
||||||
|
MENUITEM "Byte", ID_POPUPMENU_COPY_BYTE
|
||||||
|
END
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
|
||||||
|
|
|
@ -724,6 +724,9 @@
|
||||||
#define ID_RESULTS_ADDALLTOWATCHLIST 40080
|
#define ID_RESULTS_ADDALLTOWATCHLIST 40080
|
||||||
#define ID_WATCHLIST_CHANGE_ADDRESS 40082
|
#define ID_WATCHLIST_CHANGE_ADDRESS 40082
|
||||||
#define ID_WATCHLIST_CHANGE_ADDRESSBY 40084
|
#define ID_WATCHLIST_CHANGE_ADDRESSBY 40084
|
||||||
|
#define ID_POPUPMENU_COPY_WORD 40089
|
||||||
|
#define ID_POPUPMENU_COPY_HALFWORD 40090
|
||||||
|
#define ID_POPUPMENU_COPY_BYTE 40091
|
||||||
#define ID_POPUPMENU_ROMDIRECTORY 40137
|
#define ID_POPUPMENU_ROMDIRECTORY 40137
|
||||||
#define ID_POPUPMENU_REFRESHROMLIST 40138
|
#define ID_POPUPMENU_REFRESHROMLIST 40138
|
||||||
#define ID_POPUPMENU_PLAYGAME 40152
|
#define ID_POPUPMENU_PLAYGAME 40152
|
||||||
|
@ -741,7 +744,7 @@
|
||||||
#ifdef APSTUDIO_INVOKED
|
#ifdef APSTUDIO_INVOKED
|
||||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||||
#define _APS_NEXT_RESOURCE_VALUE 213
|
#define _APS_NEXT_RESOURCE_VALUE 213
|
||||||
#define _APS_NEXT_COMMAND_VALUE 40085
|
#define _APS_NEXT_COMMAND_VALUE 40092
|
||||||
#define _APS_NEXT_CONTROL_VALUE 1538
|
#define _APS_NEXT_CONTROL_VALUE 1538
|
||||||
#define _APS_NEXT_SYMED_VALUE 102
|
#define _APS_NEXT_SYMED_VALUE 102
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue