add "view as" to the memory view, so we can see ascii interpretation as well as floating points
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4408 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
9b16c36014
commit
7e621119b2
|
@ -35,17 +35,18 @@ enum
|
||||||
IDM_RUNTOHERE,
|
IDM_RUNTOHERE,
|
||||||
IDM_DYNARECRESULTS,
|
IDM_DYNARECRESULTS,
|
||||||
IDM_TOGGLEMEMORY,
|
IDM_TOGGLEMEMORY,
|
||||||
|
IDM_VIEWASFP,
|
||||||
|
IDM_VIEWASASCII,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(CMemoryView, wxControl)
|
BEGIN_EVENT_TABLE(CMemoryView, wxControl)
|
||||||
EVT_ERASE_BACKGROUND(CMemoryView::OnErase)
|
EVT_ERASE_BACKGROUND(CMemoryView::OnErase)
|
||||||
EVT_PAINT(CMemoryView::OnPaint)
|
EVT_PAINT(CMemoryView::OnPaint)
|
||||||
EVT_LEFT_DOWN(CMemoryView::OnMouseDown)
|
EVT_LEFT_DOWN(CMemoryView::OnMouseDownL)
|
||||||
EVT_LEFT_UP(CMemoryView::OnMouseUpL)
|
EVT_LEFT_UP(CMemoryView::OnMouseUpL)
|
||||||
EVT_MOTION(CMemoryView::OnMouseMove)
|
EVT_MOTION(CMemoryView::OnMouseMove)
|
||||||
EVT_RIGHT_DOWN(CMemoryView::OnMouseDown)
|
EVT_RIGHT_DOWN(CMemoryView::OnMouseDownR)
|
||||||
EVT_RIGHT_UP(CMemoryView::OnMouseUpR)
|
|
||||||
EVT_MENU(-1, CMemoryView::OnPopupMenu)
|
EVT_MENU(-1, CMemoryView::OnPopupMenu)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
@ -59,7 +60,8 @@ CMemoryView::CMemoryView(DebugInterface* debuginterface, wxWindow* parent, wxWin
|
||||||
selecting(false),
|
selecting(false),
|
||||||
hasFocus(false),
|
hasFocus(false),
|
||||||
showHex(false),
|
showHex(false),
|
||||||
memory(0)
|
memory(0),
|
||||||
|
viewAsType(VIEWAS_FP)
|
||||||
{
|
{
|
||||||
rowHeight = 13;
|
rowHeight = 13;
|
||||||
align = debuginterface->getInstructionSize(0);
|
align = debuginterface->getInstructionSize(0);
|
||||||
|
@ -85,7 +87,7 @@ int CMemoryView::YToAddress(int y)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CMemoryView::OnMouseDown(wxMouseEvent& event)
|
void CMemoryView::OnMouseDownL(wxMouseEvent& event)
|
||||||
{
|
{
|
||||||
int x = event.m_x;
|
int x = event.m_x;
|
||||||
int y = event.m_y;
|
int y = event.m_y;
|
||||||
|
@ -152,7 +154,7 @@ void CMemoryView::OnMouseMove(wxMouseEvent& event)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
OnMouseDown(event);
|
OnMouseDownL(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -197,12 +199,16 @@ void CMemoryView::OnPopupMenu(wxCommandEvent& event)
|
||||||
wxTheClipboard->SetData(new wxTextDataObject(wxString::FromAscii(temp)));
|
wxTheClipboard->SetData(new wxTextDataObject(wxString::FromAscii(temp)));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
case IDM_TOGGLEMEMORY:
|
case IDM_VIEWASFP:
|
||||||
memory ^= 1;
|
viewAsType = VIEWAS_FP;
|
||||||
|
redraw();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case IDM_VIEWASASCII:
|
||||||
|
viewAsType = VIEWAS_ASCII;
|
||||||
redraw();
|
redraw();
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if wxUSE_CLIPBOARD
|
#if wxUSE_CLIPBOARD
|
||||||
|
@ -212,7 +218,7 @@ void CMemoryView::OnPopupMenu(wxCommandEvent& event)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CMemoryView::OnMouseUpR(wxMouseEvent& event)
|
void CMemoryView::OnMouseDownR(wxMouseEvent& event)
|
||||||
{
|
{
|
||||||
// popup menu
|
// popup menu
|
||||||
wxMenu menu;
|
wxMenu menu;
|
||||||
|
@ -222,7 +228,14 @@ void CMemoryView::OnMouseUpR(wxMouseEvent& event)
|
||||||
menu.Append(IDM_COPYHEX, wxString::FromAscii("Copy &hex"));
|
menu.Append(IDM_COPYHEX, wxString::FromAscii("Copy &hex"));
|
||||||
#endif
|
#endif
|
||||||
menu.Append(IDM_TOGGLEMEMORY, wxString::FromAscii("Toggle &memory (RAM/ARAM)"));
|
menu.Append(IDM_TOGGLEMEMORY, wxString::FromAscii("Toggle &memory (RAM/ARAM)"));
|
||||||
|
|
||||||
|
wxMenu viewAsSubMenu;
|
||||||
|
viewAsSubMenu.Append(IDM_VIEWASFP, wxString::FromAscii("FP value"));
|
||||||
|
viewAsSubMenu.Append(IDM_VIEWASASCII, wxString::FromAscii("ASCII"));
|
||||||
|
menu.AppendSubMenu(&viewAsSubMenu, wxString::FromAscii("View As:"));
|
||||||
|
|
||||||
PopupMenu(&menu);
|
PopupMenu(&menu);
|
||||||
|
|
||||||
event.Skip(true);
|
event.Skip(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -313,8 +326,21 @@ void CMemoryView::OnPaint(wxPaintEvent& event)
|
||||||
{
|
{
|
||||||
char dis[256] = {0};
|
char dis[256] = {0};
|
||||||
u32 mem_data = debugger->readExtraMemory(memory, address);
|
u32 mem_data = debugger->readExtraMemory(memory, address);
|
||||||
float flt = *(float *)(&mem_data);
|
|
||||||
sprintf(dis, "f: %f", flt);
|
if (viewAsType == VIEWAS_FP)
|
||||||
|
{
|
||||||
|
float flt = *(float *)(&mem_data);
|
||||||
|
sprintf(dis, "f: %f", flt);
|
||||||
|
}
|
||||||
|
else if (viewAsType == VIEWAS_ASCII)
|
||||||
|
{
|
||||||
|
sprintf(dis, "%c%c%c%c",
|
||||||
|
(mem_data&0xff000000)>>24, (mem_data&0xff0000)>>16,
|
||||||
|
(mem_data&0xff00)>>8, mem_data&0xff);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
sprintf(dis, "INVALID VIEWAS TYPE");
|
||||||
|
|
||||||
char desc[256] = "";
|
char desc[256] = "";
|
||||||
|
|
||||||
dc.DrawText(wxString::FromAscii(dis), 77 + fontSize*(8 + 8), rowY1);
|
dc.DrawText(wxString::FromAscii(dis), 77 + fontSize*(8 + 8), rowY1);
|
||||||
|
|
|
@ -29,10 +29,10 @@ public:
|
||||||
wxSize DoGetBestSize() const;
|
wxSize DoGetBestSize() const;
|
||||||
void OnPaint(wxPaintEvent& event);
|
void OnPaint(wxPaintEvent& event);
|
||||||
void OnErase(wxEraseEvent& event);
|
void OnErase(wxEraseEvent& event);
|
||||||
void OnMouseDown(wxMouseEvent& event);
|
void OnMouseDownL(wxMouseEvent& event);
|
||||||
void OnMouseMove(wxMouseEvent& event);
|
void OnMouseMove(wxMouseEvent& event);
|
||||||
void OnMouseUpL(wxMouseEvent& event);
|
void OnMouseUpL(wxMouseEvent& event);
|
||||||
void OnMouseUpR(wxMouseEvent& event);
|
void OnMouseDownR(wxMouseEvent& event);
|
||||||
void OnPopupMenu(wxCommandEvent& event);
|
void OnPopupMenu(wxCommandEvent& event);
|
||||||
|
|
||||||
u32 GetSelection() { return selection ; }
|
u32 GetSelection() { return selection ; }
|
||||||
|
@ -63,6 +63,13 @@ private:
|
||||||
|
|
||||||
int memory;
|
int memory;
|
||||||
|
|
||||||
|
enum EViewAsType
|
||||||
|
{
|
||||||
|
VIEWAS_ASCII = 0,
|
||||||
|
VIEWAS_FP,
|
||||||
|
};
|
||||||
|
EViewAsType viewAsType;
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue