minor dsp debugger improvements

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2907 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman 2009-04-06 20:32:37 +00:00
parent 957127d505
commit b801e16cd3
2 changed files with 49 additions and 23 deletions

View File

@ -26,9 +26,9 @@
// Event table and class
BEGIN_EVENT_TABLE(DSPDebuggerLLE, wxFrame)
EVT_CLOSE(DSPDebuggerLLE::OnClose)
EVT_SIZE(DSPDebuggerLLE::OnChangeSize)
EVT_MENU_RANGE(ID_RUNTOOL, ID_STEPTOOL, DSPDebuggerLLE::OnChangeState)
EVT_MENU(ID_SHOWPCTOOL, DSPDebuggerLLE::OnShowPC)
EVT_MENU(ID_DUMPCODETOOL, DSPDebuggerLLE::OnDumpCode)
EVT_LIST_ITEM_RIGHT_CLICK(ID_DISASM, DSPDebuggerLLE::OnRightClick)
@ -100,12 +100,6 @@ void DSPDebuggerLLE::OnClose(wxCloseEvent& event)
event.Skip();
}
void DSPDebuggerLLE::OnChangeSize(wxSizeEvent& event)
{
Refresh();
event.Skip();
}
void DSPDebuggerLLE::OnChangeState(wxCommandEvent& event)
{
switch (event.GetId())
@ -122,11 +116,13 @@ void DSPDebuggerLLE::OnChangeState(wxCommandEvent& event)
break;
}
if ((m_State == RUN) || (m_State == RUN_START))
m_Toolbar->FindById(ID_RUNTOOL)->SetLabel(wxT("Pause"));
else
m_Toolbar->FindById(ID_RUNTOOL)->SetLabel(wxT("Run"));
m_Toolbar->Realize();
UpdateState();
}
void DSPDebuggerLLE::OnShowPC(wxCommandEvent& event)
{
Refresh();
FocusOnPC();
}
void DSPDebuggerLLE::OnDumpCode(wxCommandEvent& event)
@ -160,6 +156,40 @@ void DSPDebuggerLLE::Refresh()
UpdateSymbolMap();
UpdateDisAsmListView();
UpdateRegisterFlags();
UpdateState();
}
void DSPDebuggerLLE::FocusOnPC()
{
UnselectAll();
for (int i = 0; i < m_Disasm->GetItemCount(); i++)
{
if (m_Disasm->GetItemData(i) == g_dsp.pc)
{
m_Disasm->EnsureVisible(i - 5);
m_Disasm->EnsureVisible(i + 5);
m_Disasm->SetItemState(i, wxLIST_STATE_FOCUSED|wxLIST_STATE_SELECTED, wxLIST_STATE_FOCUSED|wxLIST_STATE_SELECTED);
break;
}
}
}
void DSPDebuggerLLE::UnselectAll()
{
for (int i = 0; i < m_Disasm->GetItemCount(); i++)
{
m_Disasm->SetItemState(i, 0, wxLIST_STATE_SELECTED);
}
}
void DSPDebuggerLLE::UpdateState()
{
if ((m_State == RUN) || (m_State == RUN_START))
m_Toolbar->FindById(ID_RUNTOOL)->SetLabel(wxT("Pause"));
else
m_Toolbar->FindById(ID_RUNTOOL)->SetLabel(wxT("Run"));
m_Toolbar->Realize();
}
void DSPDebuggerLLE::RebuildDisAsmListView()
@ -280,16 +310,7 @@ void DSPDebuggerLLE::UpdateDisAsmListView()
return;
// show PC
for (int i = 0; i < m_Disasm->GetItemCount(); i++)
{
if (m_Disasm->GetItemData(i) == g_dsp.pc)
{
m_Disasm->EnsureVisible(i - 5);
m_Disasm->EnsureVisible(i + 14);
m_Disasm->SetItemState(i, wxLIST_STATE_FOCUSED|wxLIST_STATE_SELECTED, wxLIST_STATE_FOCUSED|wxLIST_STATE_SELECTED);
break;
}
}
FocusOnPC();
m_CachedStepCounter = g_dsp.step_counter;
@ -319,6 +340,8 @@ void DSPDebuggerLLE::UpdateRegisterFlags()
if (m_CachedCR == g_dsp.cr)
return;
m_Toolbar->ToggleTool(ID_DUMPCODETOOL, g_dsp.dump_imem);
m_Toolbar->ToggleTool(ID_CHECK_ASSERTINT, g_dsp.cr & 0x02 ? true : false);
m_Toolbar->ToggleTool(ID_CHECK_HALT, g_dsp.cr & 0x04 ? true : false);
m_Toolbar->ToggleTool(ID_CHECK_INIT, g_dsp.cr & 0x800 ? true : false);

View File

@ -137,6 +137,7 @@ private:
void UpdateDisAsmListView();
void UpdateRegisterFlags();
void UpdateSymbolMap();
void UpdateState();
void RebuildDisAsmListView();
@ -146,14 +147,16 @@ private:
DSPRegisterView* m_Regs;
void OnClose(wxCloseEvent& event);
void OnChangeSize(wxSizeEvent& event);
void OnChangeState(wxCommandEvent& event);
void OnShowPC(wxCommandEvent& event);
void OnDumpCode(wxCommandEvent& event);
void OnRightClick(wxListEvent& event);
void OnDoubleClick(wxListEvent& event);
void CreateGUIControls();
void Refresh();
void FocusOnPC();
void UnselectAll();
};
#endif //_DSP_DEBUGGER_LLE_H