mirror of https://github.com/PCSX2/pcsx2.git
Add function list
This commit is contained in:
parent
b37f6e9df1
commit
c4e89bea32
|
@ -77,7 +77,7 @@ inline wxIcon _wxGetIconFromMemory(const unsigned char *data, int length) {
|
|||
}
|
||||
|
||||
CtrlDisassemblyView::CtrlDisassemblyView(wxWindow* parent, DebugInterface* _cpu)
|
||||
: wxWindow(parent,wxID_ANY,wxDefaultPosition,wxDefaultSize,wxWANTS_CHARS|wxBORDER|wxVSCROLL), cpu(_cpu)
|
||||
: wxWindow(parent,wxID_ANY,wxDefaultPosition,wxDefaultSize,wxWANTS_CHARS||wxBORDER_SIMPLE|wxVSCROLL), cpu(_cpu)
|
||||
{
|
||||
manager.setCpu(cpu);
|
||||
windowStart = 0x100000;
|
||||
|
|
|
@ -34,6 +34,10 @@ BEGIN_EVENT_TABLE(CtrlMemView, wxWindow)
|
|||
EVT_CHAR(CtrlMemView::charEvent)
|
||||
EVT_SET_FOCUS(CtrlMemView::focusEvent)
|
||||
EVT_KILL_FOCUS(CtrlMemView::focusEvent)
|
||||
EVT_SCROLLWIN_LINEUP(CtrlMemView::scrollbarEvent)
|
||||
EVT_SCROLLWIN_LINEDOWN(CtrlMemView::scrollbarEvent)
|
||||
EVT_SCROLLWIN_PAGEUP(CtrlMemView::scrollbarEvent)
|
||||
EVT_SCROLLWIN_PAGEDOWN(CtrlMemView::scrollbarEvent)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
enum MemoryViewMenuIdentifiers
|
||||
|
@ -452,6 +456,26 @@ void CtrlMemView::charEvent(wxKeyEvent& evt)
|
|||
redraw();
|
||||
}
|
||||
|
||||
void CtrlMemView::scrollbarEvent(wxScrollWinEvent& evt)
|
||||
{
|
||||
int type = evt.GetEventType();
|
||||
if (type == wxEVT_SCROLLWIN_LINEUP)
|
||||
{
|
||||
scrollCursor(-rowSize);
|
||||
} else if (type == wxEVT_SCROLLWIN_LINEDOWN)
|
||||
{
|
||||
scrollCursor(rowSize);
|
||||
} else if (type == wxEVT_SCROLLWIN_PAGEUP)
|
||||
{
|
||||
scrollWindow(-GetClientSize().y/rowHeight);
|
||||
} else if (type == wxEVT_SCROLLWIN_PAGEDOWN)
|
||||
{
|
||||
scrollWindow(GetClientSize().y/rowHeight);
|
||||
}
|
||||
|
||||
redraw();
|
||||
}
|
||||
|
||||
void CtrlMemView::scrollWindow(int lines)
|
||||
{
|
||||
windowStart += lines*rowSize;
|
||||
|
|
|
@ -27,6 +27,7 @@ public:
|
|||
void paintEvent(wxPaintEvent & evt);
|
||||
void mouseEvent(wxMouseEvent& evt);
|
||||
void keydownEvent(wxKeyEvent& evt);
|
||||
void scrollbarEvent(wxScrollWinEvent& evt);
|
||||
void charEvent(wxKeyEvent& evt);
|
||||
void redraw();
|
||||
void gotoAddress(u32 address);
|
||||
|
|
|
@ -41,7 +41,7 @@ enum DisassemblyMenuIdentifiers
|
|||
|
||||
|
||||
CtrlRegisterList::CtrlRegisterList(wxWindow* parent, DebugInterface* _cpu)
|
||||
: wxWindow(parent,wxID_ANY,wxDefaultPosition,wxDefaultSize,wxWANTS_CHARS|wxBORDER), cpu(_cpu)
|
||||
: wxWindow(parent,wxID_ANY,wxDefaultPosition,wxDefaultSize,wxWANTS_CHARS|wxBORDER_NONE), cpu(_cpu)
|
||||
{
|
||||
rowHeight = g_Conf->EmuOptions.Debugger.FontHeight+2;
|
||||
charWidth = g_Conf->EmuOptions.Debugger.FontWidth;
|
||||
|
@ -194,12 +194,15 @@ void CtrlRegisterList::render(wxDC& dc)
|
|||
dc.SetBrush(wxBrush(wxColor(0xFFFFEFE8)));
|
||||
dc.SetPen(wxPen(wxColor(0xFF000000)));
|
||||
}
|
||||
|
||||
if (i == cpu->getRegisterCategoryCount()-1)
|
||||
piece += size.x-piece*cpu->getRegisterCategoryCount()-1;
|
||||
|
||||
dc.DrawRectangle(x-1,-1,piece+1,rowHeight+1);
|
||||
dc.DrawRectangle(x,0,piece+1,rowHeight);
|
||||
|
||||
// center text
|
||||
x += (piece-strlen(name)*charWidth)/2;
|
||||
dc.DrawText(wxString(name,wxConvUTF8),x,1);
|
||||
dc.DrawText(wxString(name,wxConvUTF8),x,2);
|
||||
}
|
||||
|
||||
int nameStart = 17;
|
||||
|
@ -484,7 +487,7 @@ void CtrlRegisterList::mouseEvent(wxMouseEvent& evt)
|
|||
if (y < rowHeight)
|
||||
{
|
||||
int piece = GetSize().x/cpu->getRegisterCategoryCount();
|
||||
int cat = x/piece;
|
||||
int cat = std::min<int>(x/piece,cpu->getRegisterCategoryCount()-1);
|
||||
|
||||
if (cat != category)
|
||||
{
|
||||
|
|
|
@ -36,9 +36,13 @@ BEGIN_EVENT_TABLE(DisassemblyDialog, wxFrame)
|
|||
EVT_COMMAND( wxID_ANY, debEVT_STEPINTO, DisassemblyDialog::onDebuggerEvent )
|
||||
EVT_COMMAND( wxID_ANY, debEVT_UPDATE, DisassemblyDialog::onDebuggerEvent )
|
||||
EVT_COMMAND( wxID_ANY, debEVT_BREAKPOINTWINDOW, DisassemblyDialog::onDebuggerEvent )
|
||||
EVT_COMMAND( wxID_ANY, debEVT_MAPLOADED, DisassemblyDialog::onDebuggerEvent )
|
||||
EVT_CLOSE( DisassemblyDialog::onClose )
|
||||
END_EVENT_TABLE()
|
||||
|
||||
BEGIN_EVENT_TABLE(CpuTabPage, wxPanel)
|
||||
EVT_LISTBOX_DCLICK( wxID_ANY, CpuTabPage::listBoxHandler)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
DebuggerHelpDialog::DebuggerHelpDialog(wxWindow* parent)
|
||||
: wxDialog(parent,wxID_ANY,L"Help")
|
||||
|
@ -73,9 +77,11 @@ CpuTabPage::CpuTabPage(wxWindow* parent, DebugInterface* _cpu)
|
|||
wxBoxSizer* mainSizer = new wxBoxSizer(wxVERTICAL);
|
||||
SetSizer(mainSizer);
|
||||
|
||||
leftTabs = new wxNotebook(this,wxID_ANY);
|
||||
bottomTabs = new wxNotebook(this,wxID_ANY);
|
||||
disassembly = new CtrlDisassemblyView(this,cpu);
|
||||
registerList = new CtrlRegisterList(this,cpu);
|
||||
registerList = new CtrlRegisterList(leftTabs,cpu);
|
||||
functionList = new wxListBox(leftTabs,wxID_ANY,wxDefaultPosition,wxDefaultSize,0,NULL,wxBORDER_NONE|wxLB_SORT);
|
||||
memory = new CtrlMemView(bottomTabs,cpu);
|
||||
|
||||
// create register list and disassembly section
|
||||
|
@ -84,10 +90,13 @@ CpuTabPage::CpuTabPage(wxWindow* parent, DebugInterface* _cpu)
|
|||
wxBoxSizer* miscStuffSizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
cyclesText = new wxStaticText(this,wxID_ANY,L"");
|
||||
miscStuffSizer->Add(cyclesText,0,wxLEFT|wxTOP|wxBOTTOM,2);
|
||||
|
||||
leftTabs->AddPage(registerList,L"Registers");
|
||||
leftTabs->AddPage(functionList,L"Functions");
|
||||
|
||||
wxBoxSizer* registerSizer = new wxBoxSizer(wxVERTICAL);
|
||||
registerSizer->Add(miscStuffSizer,0);
|
||||
registerSizer->Add(registerList,1);
|
||||
registerSizer->Add(leftTabs,1);
|
||||
|
||||
middleSizer->Add(registerSizer,0,wxEXPAND|wxRIGHT,2);
|
||||
middleSizer->Add(disassembly,2,wxEXPAND);
|
||||
|
@ -107,6 +116,37 @@ CpuTabPage::CpuTabPage(wxWindow* parent, DebugInterface* _cpu)
|
|||
loadCycles();
|
||||
}
|
||||
|
||||
void CpuTabPage::reloadSymbolMap()
|
||||
{
|
||||
functionList->Clear();
|
||||
|
||||
auto funcs = symbolMap.GetAllSymbols(ST_FUNCTION);
|
||||
for (size_t i = 0; i < funcs.size(); i++)
|
||||
{
|
||||
wxString name = wxString(funcs[i].name.c_str(),wxConvUTF8);
|
||||
functionList->Append(name,(void*)funcs[i].address);
|
||||
}
|
||||
}
|
||||
|
||||
void CpuTabPage::listBoxHandler(wxCommandEvent& event)
|
||||
{
|
||||
int index = functionList->GetSelection();
|
||||
if (event.GetEventObject() == functionList && index >= 0)
|
||||
{
|
||||
u32 pos = (u32) functionList->GetClientData(index);
|
||||
postEvent(debEVT_GOTOINDISASM,pos);
|
||||
}
|
||||
}
|
||||
|
||||
void CpuTabPage::postEvent(wxEventType type, int value)
|
||||
{
|
||||
wxCommandEvent event( type, GetId() );
|
||||
event.SetEventObject(this);
|
||||
event.SetClientData(cpu);
|
||||
event.SetInt(value);
|
||||
wxPostEvent(this,event);
|
||||
}
|
||||
|
||||
void CpuTabPage::setBottomTabPage(wxWindow* win)
|
||||
{
|
||||
for (size_t i = 0; i < bottomTabs->GetPageCount(); i++)
|
||||
|
@ -400,7 +440,8 @@ void DisassemblyDialog::onDebuggerEvent(wxCommandEvent& evt)
|
|||
{
|
||||
if (currentCpu != NULL)
|
||||
{
|
||||
currentCpu->getDisassembly()->gotoAddress(r5900Debug.getPC());
|
||||
u32 pos = evt.GetInt();
|
||||
currentCpu->getDisassembly()->gotoAddress(pos);
|
||||
currentCpu->getDisassembly()->SetFocus();
|
||||
update();
|
||||
}
|
||||
|
@ -419,6 +460,10 @@ void DisassemblyDialog::onDebuggerEvent(wxCommandEvent& evt)
|
|||
{
|
||||
wxCommandEvent evt;
|
||||
onBreakpointClick(evt);
|
||||
} else if (type == debEVT_MAPLOADED)
|
||||
{
|
||||
eeTab->reloadSymbolMap();
|
||||
iopTab->reloadSymbolMap();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -443,8 +488,10 @@ void DisassemblyDialog::update()
|
|||
void DisassemblyDialog::reset()
|
||||
{
|
||||
eeTab->getDisassembly()->clearFunctions();
|
||||
eeTab->reloadSymbolMap();
|
||||
iopTab->getDisassembly()->clearFunctions();
|
||||
};
|
||||
iopTab->reloadSymbolMap();
|
||||
}
|
||||
|
||||
void DisassemblyDialog::gotoPc()
|
||||
{
|
||||
|
|
|
@ -42,13 +42,21 @@ public:
|
|||
void update();
|
||||
void showMemoryView() { setBottomTabPage(memory); };
|
||||
void loadCycles();
|
||||
void reloadSymbolMap();
|
||||
|
||||
void listBoxHandler(wxCommandEvent& event);
|
||||
DECLARE_EVENT_TABLE()
|
||||
private:
|
||||
void setBottomTabPage(wxWindow* win);
|
||||
void postEvent(wxEventType type, int value);
|
||||
|
||||
DebugInterface* cpu;
|
||||
CtrlDisassemblyView* disassembly;
|
||||
CtrlRegisterList* registerList;
|
||||
wxListBox* functionList;
|
||||
CtrlMemView* memory;
|
||||
wxNotebook* bottomTabs;
|
||||
wxNotebook* leftTabs;
|
||||
BreakpointList* breakpointList;
|
||||
wxStaticText* cyclesText;
|
||||
u32 lastCycles;
|
||||
|
|
Loading…
Reference in New Issue