Added "Add to watch" context menu items to the Memory and Register windows.
Added "View memory" context menu item to the Register window.
This commit is contained in:
parent
613cae613a
commit
d0a3bb7650
|
@ -25,10 +25,13 @@
|
||||||
#include "Common/DebugInterface.h"
|
#include "Common/DebugInterface.h"
|
||||||
#include "Common/StringUtil.h"
|
#include "Common/StringUtil.h"
|
||||||
#include "Core/HW/Memmap.h"
|
#include "Core/HW/Memmap.h"
|
||||||
|
#include "DolphinWX/Frame.h"
|
||||||
#include "DolphinWX/Globals.h"
|
#include "DolphinWX/Globals.h"
|
||||||
#include "DolphinWX/WxUtils.h"
|
#include "DolphinWX/WxUtils.h"
|
||||||
|
#include "DolphinWX/Debugger/CodeWindow.h"
|
||||||
#include "DolphinWX/Debugger/DebuggerUIUtil.h"
|
#include "DolphinWX/Debugger/DebuggerUIUtil.h"
|
||||||
#include "DolphinWX/Debugger/MemoryView.h"
|
#include "DolphinWX/Debugger/MemoryView.h"
|
||||||
|
#include "DolphinWX/Debugger/WatchWindow.h"
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
@ -162,6 +165,10 @@ void CMemoryView::OnScrollWheel(wxMouseEvent& event)
|
||||||
|
|
||||||
void CMemoryView::OnPopupMenu(wxCommandEvent& event)
|
void CMemoryView::OnPopupMenu(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
|
CFrame* main_frame = (CFrame*)(GetParent()->GetParent()->GetParent());
|
||||||
|
CCodeWindow* code_window = main_frame->g_pCodeWindow;
|
||||||
|
CWatchWindow* watch_window = code_window->m_WatchWindow;
|
||||||
|
|
||||||
#if wxUSE_CLIPBOARD
|
#if wxUSE_CLIPBOARD
|
||||||
wxTheClipboard->Open();
|
wxTheClipboard->Open();
|
||||||
#endif
|
#endif
|
||||||
|
@ -183,6 +190,8 @@ void CMemoryView::OnPopupMenu(wxCommandEvent& event)
|
||||||
|
|
||||||
case IDM_WATCHADDRESS:
|
case IDM_WATCHADDRESS:
|
||||||
debugger->AddWatch(selection);
|
debugger->AddWatch(selection);
|
||||||
|
if (watch_window)
|
||||||
|
watch_window->NotifyUpdate();
|
||||||
Refresh();
|
Refresh();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include <wx/colour.h>
|
#include <wx/colour.h>
|
||||||
#include <wx/defs.h>
|
#include <wx/defs.h>
|
||||||
#include <wx/grid.h>
|
#include <wx/grid.h>
|
||||||
|
#include <wx/menu.h>
|
||||||
#include <wx/string.h>
|
#include <wx/string.h>
|
||||||
#include <wx/windowid.h>
|
#include <wx/windowid.h>
|
||||||
|
|
||||||
|
@ -15,14 +16,25 @@
|
||||||
#include "Core/HW/ProcessorInterface.h"
|
#include "Core/HW/ProcessorInterface.h"
|
||||||
#include "Core/PowerPC/Gekko.h"
|
#include "Core/PowerPC/Gekko.h"
|
||||||
#include "Core/PowerPC/PowerPC.h"
|
#include "Core/PowerPC/PowerPC.h"
|
||||||
|
#include "DolphinWX/Frame.h"
|
||||||
|
#include "DolphinWX/Globals.h"
|
||||||
#include "DolphinWX/WxUtils.h"
|
#include "DolphinWX/WxUtils.h"
|
||||||
|
#include "DolphinWX/Debugger/CodeWindow.h"
|
||||||
#include "DolphinWX/Debugger/DebuggerUIUtil.h"
|
#include "DolphinWX/Debugger/DebuggerUIUtil.h"
|
||||||
|
#include "DolphinWX/Debugger/MemoryWindow.h"
|
||||||
#include "DolphinWX/Debugger/RegisterView.h"
|
#include "DolphinWX/Debugger/RegisterView.h"
|
||||||
|
#include "DolphinWX/Debugger/WatchWindow.h"
|
||||||
|
|
||||||
class wxWindow;
|
class wxWindow;
|
||||||
|
|
||||||
// F-zero 80005e60 wtf??
|
// F-zero 80005e60 wtf??
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
IDM_WATCHADDRESS,
|
||||||
|
IDM_VIEWMEMORY,
|
||||||
|
};
|
||||||
|
|
||||||
static const char *special_reg_names[] = {
|
static const char *special_reg_names[] = {
|
||||||
"PC", "LR", "CTR", "CR", "FPSCR", "MSR", "SRR0", "SRR1", "Exceptions", "Int Mask", "Int Cause", "DSISR", "DAR", "PT hashmask"
|
"PC", "LR", "CTR", "CR", "FPSCR", "MSR", "SRR0", "SRR1", "Exceptions", "Int Mask", "Int Cause", "DSISR", "DAR", "PT hashmask"
|
||||||
};
|
};
|
||||||
|
@ -49,7 +61,7 @@ static u32 GetSpecialRegValue(int reg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString CRegTable::GetValue(int row, int col)
|
static wxString GetValueByRowCol(int row, int col)
|
||||||
{
|
{
|
||||||
if (row < 32)
|
if (row < 32)
|
||||||
{
|
{
|
||||||
|
@ -130,6 +142,11 @@ wxString CRegTable::GetValue(int row, int col)
|
||||||
return wxEmptyString;
|
return wxEmptyString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxString CRegTable::GetValue(int row, int col)
|
||||||
|
{
|
||||||
|
return GetValueByRowCol(row, col);
|
||||||
|
}
|
||||||
|
|
||||||
static void SetSpecialRegValue(int reg, u32 value)
|
static void SetSpecialRegValue(int reg, u32 value)
|
||||||
{
|
{
|
||||||
switch (reg)
|
switch (reg)
|
||||||
|
@ -246,3 +263,42 @@ void CRegisterView::Update()
|
||||||
ForceRefresh();
|
ForceRefresh();
|
||||||
((CRegTable *)GetTable())->UpdateCachedRegs();
|
((CRegTable *)GetTable())->UpdateCachedRegs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CRegisterView::OnMouseDownR(wxGridEvent& event)
|
||||||
|
{
|
||||||
|
// popup menu
|
||||||
|
int row = event.GetRow();
|
||||||
|
int col = event.GetCol();
|
||||||
|
|
||||||
|
wxString strNewVal = GetValueByRowCol(row, col);
|
||||||
|
TryParse("0x" + WxStrToStr(strNewVal), &addr);
|
||||||
|
|
||||||
|
wxMenu* menu = new wxMenu;
|
||||||
|
menu->Append(IDM_WATCHADDRESS, _("Add to &watch"));
|
||||||
|
menu->Append(IDM_VIEWMEMORY, _("View &memory"));
|
||||||
|
PopupMenu(menu);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRegisterView::OnPopupMenu(wxCommandEvent& event)
|
||||||
|
{
|
||||||
|
CFrame* main_frame = (CFrame*)(GetParent()->GetParent());
|
||||||
|
CCodeWindow* code_window = main_frame->g_pCodeWindow;
|
||||||
|
CWatchWindow* watch_window = code_window->m_WatchWindow;
|
||||||
|
CMemoryWindow* memory_window = code_window->m_MemoryWindow;
|
||||||
|
|
||||||
|
switch (event.GetId())
|
||||||
|
{
|
||||||
|
case IDM_WATCHADDRESS:
|
||||||
|
PowerPC::watches.Add(addr);
|
||||||
|
if (watch_window)
|
||||||
|
watch_window->NotifyUpdate();
|
||||||
|
Refresh();
|
||||||
|
break;
|
||||||
|
case IDM_VIEWMEMORY:
|
||||||
|
if (memory_window)
|
||||||
|
memory_window->JumpToAddress(addr);
|
||||||
|
Refresh();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
event.Skip();
|
||||||
|
}
|
||||||
|
|
|
@ -30,14 +30,13 @@ class wxWindow;
|
||||||
// Interrupt Mask (PI)
|
// Interrupt Mask (PI)
|
||||||
// Interrupt Cause(PI)
|
// Interrupt Cause(PI)
|
||||||
|
|
||||||
|
#define NUM_SPECIALS 14
|
||||||
|
|
||||||
class CRegTable : public wxGridTableBase
|
class CRegTable : public wxGridTableBase
|
||||||
{
|
{
|
||||||
enum
|
|
||||||
{
|
|
||||||
NUM_SPECIALS = 14,
|
|
||||||
};
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
CRegTable()
|
CRegTable()
|
||||||
{
|
{
|
||||||
memset(m_CachedRegs, 0, sizeof(m_CachedRegs));
|
memset(m_CachedRegs, 0, sizeof(m_CachedRegs));
|
||||||
|
@ -72,4 +71,9 @@ class CRegisterView : public wxGrid
|
||||||
public:
|
public:
|
||||||
CRegisterView(wxWindow* parent, wxWindowID id);
|
CRegisterView(wxWindow* parent, wxWindowID id);
|
||||||
void Update() override;
|
void Update() override;
|
||||||
|
void OnMouseDownR(wxGridEvent& event);
|
||||||
|
void OnPopupMenu(wxCommandEvent& event);
|
||||||
|
|
||||||
|
private:
|
||||||
|
u32 addr = 0;
|
||||||
};
|
};
|
||||||
|
|
|
@ -11,12 +11,15 @@
|
||||||
#include <wx/string.h>
|
#include <wx/string.h>
|
||||||
#include <wx/windowid.h>
|
#include <wx/windowid.h>
|
||||||
|
|
||||||
|
#include "Core/PowerPC/PowerPC.h"
|
||||||
#include "DolphinWX/Debugger/RegisterView.h"
|
#include "DolphinWX/Debugger/RegisterView.h"
|
||||||
#include "DolphinWX/Debugger/RegisterWindow.h"
|
#include "DolphinWX/Debugger/RegisterWindow.h"
|
||||||
|
|
||||||
class wxWindow;
|
class wxWindow;
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(CRegisterWindow, wxPanel)
|
BEGIN_EVENT_TABLE(CRegisterWindow, wxPanel)
|
||||||
|
EVT_GRID_CELL_RIGHT_CLICK(CRegisterView::OnMouseDownR)
|
||||||
|
EVT_MENU(-1, CRegisterView::OnPopupMenu)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue