[Debugger] Add copy buttons to memviewer popup menu
This commit is contained in:
parent
37e6af66ed
commit
e7e91b878f
|
@ -129,8 +129,8 @@ LRESULT CDebugMemoryView::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM
|
||||||
DWORD dwThreadID = ::GetCurrentThreadId();
|
DWORD dwThreadID = ::GetCurrentThreadId();
|
||||||
hWinMessageHook = SetWindowsHookEx(WH_GETMESSAGE, (HOOKPROC)HookProc, NULL, dwThreadID);
|
hWinMessageHook = SetWindowsHookEx(WH_GETMESSAGE, (HOOKPROC)HookProc, NULL, dwThreadID);
|
||||||
|
|
||||||
LoadWindowPos();
|
LoadWindowPos();
|
||||||
WindowCreated();
|
WindowCreated();
|
||||||
|
|
||||||
m_AutoRefreshThread = CreateThread(NULL, 0, AutoRefreshProc, (void*)this, 0, NULL);
|
m_AutoRefreshThread = CreateThread(NULL, 0, AutoRefreshProc, (void*)this, 0, NULL);
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ DWORD WINAPI CDebugMemoryView::AutoRefreshProc(void* _self)
|
||||||
|
|
||||||
void CDebugMemoryView::OnExitSizeMove()
|
void CDebugMemoryView::OnExitSizeMove()
|
||||||
{
|
{
|
||||||
SaveWindowPos(0);
|
SaveWindowPos(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDebugMemoryView::InterceptMouseWheel(WPARAM wParam, LPARAM /*lParam*/)
|
void CDebugMemoryView::InterceptMouseWheel(WPARAM wParam, LPARAM /*lParam*/)
|
||||||
|
@ -194,10 +194,10 @@ LRESULT CDebugMemoryView::OnDestroy(void)
|
||||||
delete m_MemoryList;
|
delete m_MemoryList;
|
||||||
m_MemoryList = NULL;
|
m_MemoryList = NULL;
|
||||||
}
|
}
|
||||||
m_MemAddr.Detach();
|
m_MemAddr.Detach();
|
||||||
m_SymInfo.Detach();
|
m_SymInfo.Detach();
|
||||||
m_DMAInfo.Detach();
|
m_DMAInfo.Detach();
|
||||||
UnhookWindowsHookEx(hWinMessageHook);
|
UnhookWindowsHookEx(hWinMessageHook);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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();
|
||||||
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ private:
|
||||||
NOTIFY_HANDLER_EX(IDC_MEM_DETAILS, LCN_RIGHTCLICK, OnMemoryRightClicked)
|
NOTIFY_HANDLER_EX(IDC_MEM_DETAILS, LCN_RIGHTCLICK, OnMemoryRightClicked)
|
||||||
NOTIFY_HANDLER_EX(IDC_MEM_DETAILS, LCN_HOTITEMCHANGED, OnHotItemChanged)
|
NOTIFY_HANDLER_EX(IDC_MEM_DETAILS, LCN_HOTITEMCHANGED, OnHotItemChanged)
|
||||||
MESSAGE_HANDLER(WM_ACTIVATE, OnActivate)
|
MESSAGE_HANDLER(WM_ACTIVATE, OnActivate)
|
||||||
MSG_WM_EXITSIZEMOVE(OnExitSizeMove)
|
MSG_WM_EXITSIZEMOVE(OnExitSizeMove)
|
||||||
MSG_WM_DESTROY(OnDestroy)
|
MSG_WM_DESTROY(OnDestroy)
|
||||||
MSG_WM_VSCROLL(OnVScroll)
|
MSG_WM_VSCROLL(OnVScroll)
|
||||||
END_MSG_MAP()
|
END_MSG_MAP()
|
||||||
|
@ -41,7 +41,7 @@ private:
|
||||||
LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled);
|
LRESULT OnClicked(WORD wNotifyCode, WORD wID, HWND /*hWndCtl*/, BOOL& bHandled);
|
||||||
void OnAddrChanged(UINT Code, int id, HWND ctl);
|
void OnAddrChanged(UINT Code, int id, HWND ctl);
|
||||||
void OnVScroll(int request, short Pos, HWND ctrl);
|
void OnVScroll(int request, short Pos, HWND ctrl);
|
||||||
void OnExitSizeMove(void);
|
void OnExitSizeMove(void);
|
||||||
LRESULT OnActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
LRESULT OnActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||||
LRESULT OnMemoryModified(LPNMHDR lpNMHDR);
|
LRESULT OnMemoryModified(LPNMHDR lpNMHDR);
|
||||||
LRESULT OnMemoryRightClicked(LPNMHDR lpNMHDR);
|
LRESULT OnMemoryRightClicked(LPNMHDR lpNMHDR);
|
||||||
|
@ -57,6 +57,8 @@ private:
|
||||||
void SelectColors(uint32_t address, bool changed, COLORREF& bgColor, COLORREF& fgColor, COLORREF& fgHiColor);
|
void SelectColors(uint32_t address, bool changed, COLORREF& bgColor, COLORREF& fgColor, COLORREF& fgHiColor);
|
||||||
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 };
|
||||||
|
|
||||||
|
|
|
@ -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