mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 13:20:27 -06:00
Improve register view window (now shows fp, various special regs). If the window is too small, delete the RegisterView section in your Debugger.ini.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1963 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -19,21 +19,74 @@
|
||||
#include "RegisterView.h"
|
||||
#include "PowerPC/PowerPC.h"
|
||||
|
||||
extern const char* GetGPRName(unsigned int index);
|
||||
// F-zero 80005e60 wtf??
|
||||
|
||||
extern const char* GetGPRName(unsigned int index);
|
||||
extern const char* GetFPRName(unsigned int index);
|
||||
|
||||
static const char *special_reg_names[] = {
|
||||
"PC", "LR", "CTR", "CR", "FPSCR", "SRR0", "SRR1",
|
||||
};
|
||||
|
||||
static u32 GetSpecialRegValue(int reg) {
|
||||
switch (reg) {
|
||||
case 0: return PowerPC::ppcState.pc;
|
||||
case 1: return PowerPC::ppcState.spr[SPR_LR];
|
||||
case 2: return PowerPC::ppcState.spr[SPR_CTR];
|
||||
case 3: return GetCR();
|
||||
case 4: return PowerPC::ppcState.fpscr;
|
||||
case 5: return PowerPC::ppcState.spr[SPR_SRR0];
|
||||
case 6: return PowerPC::ppcState.spr[SPR_SRR1];
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
wxString CRegTable::GetValue(int row, int col)
|
||||
{
|
||||
if (col % 2 == 0)
|
||||
return wxString::FromAscii(GetGPRName(16*col/2 + row));
|
||||
else
|
||||
return wxString::Format(wxT("0x%08x"), GPR(col == 1 ? row : 16 + row));
|
||||
if (row < 32) {
|
||||
switch (col) {
|
||||
case 0: return wxString::FromAscii(GetGPRName(row));
|
||||
case 1: return wxString::Format(wxT("0x%08x"), GPR(row));
|
||||
case 2: return wxString::FromAscii(GetFPRName(row));
|
||||
case 3: return wxString::Format(wxT("%f"), rPS0(row));
|
||||
case 4: return wxString::Format(wxT("%f"), rPS1(row));
|
||||
default: return wxString::FromAscii("");
|
||||
}
|
||||
} else {
|
||||
if (row - 32 < NUM_SPECIALS) {
|
||||
switch (col) {
|
||||
case 0: return wxString::FromAscii(special_reg_names[row - 32]);
|
||||
case 1: return wxString::Format(wxT("0x%08x"), GetSpecialRegValue(row - 32));
|
||||
default: return wxString::FromAscii("");
|
||||
}
|
||||
}
|
||||
}
|
||||
return wxString::FromAscii("");
|
||||
}
|
||||
|
||||
void CRegTable::SetValue(int, int, const wxString &)
|
||||
{
|
||||
}
|
||||
|
||||
void CRegTable::UpdateCachedRegs()
|
||||
{
|
||||
for (int i = 0; i < 32; ++i)
|
||||
{
|
||||
m_CachedRegHasChanged[i] = (m_CachedRegs[i] != GPR(i));
|
||||
m_CachedRegs[i] = GPR(i);
|
||||
|
||||
m_CachedFRegHasChanged[i][0] = (m_CachedFRegs[i][0] != rPS0(i));
|
||||
m_CachedFRegs[i][0] = rPS0(i);
|
||||
m_CachedFRegHasChanged[i][1] = (m_CachedFRegs[i][1] != rPS1(i));
|
||||
m_CachedFRegs[i][1] = rPS1(i);
|
||||
}
|
||||
for (int i = 0; i < 6; ++i)
|
||||
{
|
||||
m_CachedSpecialRegHasChanged[i] = (m_CachedSpecialRegs[i] != GetSpecialRegValue(i));
|
||||
m_CachedSpecialRegs[i] = GetSpecialRegValue(i);
|
||||
}
|
||||
}
|
||||
|
||||
wxGridCellAttr *CRegTable::GetAttr(int row, int col, wxGridCellAttr::wxAttrKind)
|
||||
{
|
||||
wxGridCellAttr *attr = new wxGridCellAttr();
|
||||
@ -42,17 +95,15 @@ wxGridCellAttr *CRegTable::GetAttr(int row, int col, wxGridCellAttr::wxAttrKind)
|
||||
attr->SetFont(DefaultFont);
|
||||
attr->SetAlignment(col & 1 ? wxALIGN_CENTER : wxALIGN_LEFT, wxALIGN_CENTER);
|
||||
|
||||
if (col % 2 == 0)
|
||||
if (col == 0)
|
||||
attr->SetTextColour(wxColour(wxT("#000000")));
|
||||
else
|
||||
attr->SetTextColour(((CRegisterView*)GetView())->m_CachedRegHasChanged[col == 1 ? row : 16 + row]
|
||||
? wxColor(wxT("#FF0000")) : wxColor(wxT("#000000")));
|
||||
attr->SetTextColour(m_CachedRegHasChanged[row] ? wxColor(wxT("#FF0000")) : wxColor(wxT("#000000")));
|
||||
|
||||
attr->IncRef();
|
||||
return attr;
|
||||
}
|
||||
|
||||
|
||||
CRegisterView::CRegisterView(wxWindow *parent, wxWindowID id)
|
||||
: wxGrid(parent, id)
|
||||
{
|
||||
@ -68,10 +119,5 @@ CRegisterView::CRegisterView(wxWindow *parent, wxWindowID id)
|
||||
void CRegisterView::Update()
|
||||
{
|
||||
ForceRefresh();
|
||||
|
||||
for (size_t i = 0; i < 32; ++i)
|
||||
{
|
||||
m_CachedRegHasChanged[i] = (m_CachedRegs[i] != GPR(i));
|
||||
m_CachedRegs[i] = GPR(i);
|
||||
}
|
||||
((CRegTable *)GetTable())->UpdateCachedRegs();
|
||||
}
|
||||
|
Reference in New Issue
Block a user