summaryrefslogtreecommitdiff
path: root/Source/Core/DebuggerWX/Src/RegisterView.cpp
diff options
context:
space:
mode:
authorShawn Hoffman <godisgovernment@gmail.com>2009-10-17 00:10:22 +0000
committerShawn Hoffman <godisgovernment@gmail.com>2009-10-17 00:10:22 +0000
commitbedc0b039e8bdb7183426d7e2d95ae91d6e4350f (patch)
treea5ede7c99cd807dbe1238c0e7e0c8b459f3c1d7e /Source/Core/DebuggerWX/Src/RegisterView.cpp
parentc8fc5e8f3778f32606e0ae0bb67527207f3f97dc (diff)
allow editing of ppc registers through debugger(all the exposed ones, except the interrupt mask/cause...)
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4430 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/DebuggerWX/Src/RegisterView.cpp')
-rw-r--r--Source/Core/DebuggerWX/Src/RegisterView.cpp42
1 files changed, 40 insertions, 2 deletions
diff --git a/Source/Core/DebuggerWX/Src/RegisterView.cpp b/Source/Core/DebuggerWX/Src/RegisterView.cpp
index 17d438377e..d1071b88bc 100644
--- a/Source/Core/DebuggerWX/Src/RegisterView.cpp
+++ b/Source/Core/DebuggerWX/Src/RegisterView.cpp
@@ -68,8 +68,44 @@ wxString CRegTable::GetValue(int row, int col)
return wxString::FromAscii("");
}
-void CRegTable::SetValue(int, int, const wxString &)
+static void SetSpecialRegValue(int reg, u32 value) {
+ switch (reg) {
+ case 0: PowerPC::ppcState.pc = value;
+ case 1: PowerPC::ppcState.spr[SPR_LR] = value;
+ case 2: PowerPC::ppcState.spr[SPR_CTR] = value;
+ case 3: SetCR(value);
+ case 4: PowerPC::ppcState.fpscr = value;
+ case 5: PowerPC::ppcState.spr[SPR_SRR0] = value;
+ case 6: PowerPC::ppcState.spr[SPR_SRR1] = value;
+ case 7: PowerPC::ppcState.Exceptions = value;
+// Should we just change the value, or use ProcessorInterface::SetInterrupt() to make the system aware?
+// case 8: return ProcessorInterface::GetMask();
+// case 9: return ProcessorInterface::GetCause();
+ default: return;
+ }
+}
+
+void CRegTable::SetValue(int row, int col, const wxString& strNewVal)
{
+ u32 newVal = 0;
+ double newValFP = 0.0;
+ if (TryParseUInt(std::string(strNewVal.mb_str()), &newVal))
+ {
+ if (row < 32) {
+ if (col == 1)
+ GPR(row) = newVal;
+ else if (strNewVal.ToDouble(&newValFP)) {
+ if (col == 3)
+ rPS0(row) = newValFP;
+ else if (col == 4)
+ rPS1(row) = newValFP;
+ }
+ } else {
+ if ((row - 32 < NUM_SPECIALS) && (col == 1)) {
+ SetSpecialRegValue(row - 32, newVal);
+ }
+ }
+ }
}
void CRegTable::UpdateCachedRegs()
@@ -100,9 +136,11 @@ wxGridCellAttr *CRegTable::GetAttr(int row, int col, wxGridCellAttr::wxAttrKind)
switch (col) {
case 1:
+ attr->SetAlignment(wxALIGN_CENTER, wxALIGN_CENTER);
+ break;
case 3:
case 4:
- attr->SetAlignment(wxALIGN_CENTER, wxALIGN_CENTER);
+ attr->SetAlignment(wxALIGN_RIGHT, wxALIGN_CENTER);
break;
default:
attr->SetAlignment(wxALIGN_LEFT, wxALIGN_CENTER);