Remove all tab/space mismatches from the DolphinWX project (at least 99%. I promise!)

Also fix up the dangling else's. Shit just looks incredibly ugly in terms of actual structure in the code.

I took the liberty of adding comments in FifoPlayerDlg.cpp, LogConfigWindow.cpp, LogWindow.cpp, and FrameAui.cpp to better explain some things.

If any comments are wrong, don't hesitate to complain.
This commit is contained in:
Lioncash
2013-04-08 01:16:50 -04:00
parent 5b2d9a7d9f
commit 1db10b139c
36 changed files with 584 additions and 295 deletions

View File

@ -47,10 +47,12 @@ void BreakPointDlg::OnOK(wxCommandEvent& event)
{
PowerPC::breakpoints.Add(Address);
Parent->NotifyUpdate();
Close();
Close();
}
else
{
PanicAlert("The address %s is invalid.", WxStrToStr(AddressString).c_str());
}
event.Skip();
}

View File

@ -40,10 +40,10 @@ void CBreakPointView::Update()
InsertColumn(0, wxT("Active"));
InsertColumn(1, wxT("Type"));
InsertColumn(2, wxT("Function"));
InsertColumn(3, wxT("Address"));
InsertColumn(4, wxT("Flags"));
InsertColumn(3, wxT("Address"));
InsertColumn(4, wxT("Flags"));
char szBuffer[64];
char szBuffer[64];
const BreakPoints::TBreakPoints& rBreakPoints = PowerPC::breakpoints.GetBreakPoints();
for (size_t i = 0; i < rBreakPoints.size(); i++)
{
@ -63,11 +63,11 @@ void CBreakPointView::Update()
SetItem(Item, 2, temp);
}
sprintf(szBuffer, "%08x", rBP.iAddress);
temp = StrToWxStr(szBuffer);
sprintf(szBuffer, "%08x", rBP.iAddress);
temp = StrToWxStr(szBuffer);
SetItem(Item, 3, temp);
SetItemData(Item, rBP.iAddress);
SetItemData(Item, rBP.iAddress);
}
}
@ -108,12 +108,12 @@ void CBreakPointView::Update()
void CBreakPointView::DeleteCurrentSelection()
{
int Item = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
if (Item >= 0)
{
u32 Address = (u32)GetItemData(Item);
PowerPC::breakpoints.Remove(Address);
PowerPC::memchecks.Remove(Address);
int Item = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
if (Item >= 0)
{
u32 Address = (u32)GetItemData(Item);
PowerPC::breakpoints.Remove(Address);
PowerPC::memchecks.Remove(Address);
Update();
}
}
}

View File

@ -62,20 +62,20 @@ END_EVENT_TABLE()
CCodeView::CCodeView(DebugInterface* debuginterface, SymbolDB *symboldb,
wxWindow* parent, wxWindowID Id)
: wxControl(parent, Id),
debugger(debuginterface),
debugger(debuginterface),
symbol_db(symboldb),
plain(false),
curAddress(debuginterface->getPC()),
align(debuginterface->getInstructionSize(0)),
rowHeight(13),
selection(0),
oldSelection(0),
selectionChanged(false),
selecting(false),
hasFocus(false),
showHex(false),
lx(-1),
ly(-1)
rowHeight(13),
selection(0),
oldSelection(0),
selectionChanged(false),
selecting(false),
hasFocus(false),
showHex(false),
lx(-1),
ly(-1)
{
}
@ -104,7 +104,9 @@ void CCodeView::OnMouseDown(wxMouseEvent& event)
Refresh();
}
else
{
ToggleBreakpoint(YToAddress(y));
}
event.Skip(true);
}
@ -133,7 +135,9 @@ void CCodeView::OnMouseMove(wxMouseEvent& event)
Refresh();
}
else
{
OnMouseDown(event);
}
}
event.Skip(true);
@ -176,14 +180,17 @@ u32 CCodeView::AddrToBranch(u32 addr)
void CCodeView::InsertBlrNop(int Blr)
{
// Check if this address has been modified
int find = -1;
int find = -1;
for(u32 i = 0; i < BlrList.size(); i++)
{
if(BlrList.at(i).Address == selection)
{ find = i; break; }
{
find = i;
break;
}
}
// Save the old value
// Save the old value
if (find >= 0)
{
debugger->writeExtraMemory(0, BlrList.at(find).OldValue, selection);
@ -196,11 +203,11 @@ void CCodeView::InsertBlrNop(int Blr)
Temp.OldValue = debugger->readMemory(selection);
BlrList.push_back(Temp);
if (Blr == 0)
debugger->insertBLR(selection, 0x4e800020);
debugger->insertBLR(selection, 0x4e800020);
else
debugger->insertBLR(selection, 0x60000000);
debugger->insertBLR(selection, 0x60000000);
}
Refresh();
Refresh();
}
void CCodeView::OnPopupMenu(wxCommandEvent& event)
@ -211,14 +218,14 @@ void CCodeView::OnPopupMenu(wxCommandEvent& event)
switch (event.GetId())
{
case IDM_GOTOINMEMVIEW:
// CMemoryDlg::Goto(selection);
break;
case IDM_GOTOINMEMVIEW:
// CMemoryDlg::Goto(selection);
break;
#if wxUSE_CLIPBOARD
case IDM_COPYADDRESS:
wxTheClipboard->SetData(new wxTextDataObject(wxString::Format(_T("%08x"), selection)));
break;
case IDM_COPYADDRESS:
wxTheClipboard->SetData(new wxTextDataObject(wxString::Format(_T("%08x"), selection)));
break;
case IDM_COPYCODE:
{
@ -228,13 +235,13 @@ void CCodeView::OnPopupMenu(wxCommandEvent& event)
}
break;
case IDM_COPYHEX:
{
char temp[24];
sprintf(temp, "%08x", debugger->readInstruction(selection));
wxTheClipboard->SetData(new wxTextDataObject(StrToWxStr(temp)));
}
break;
case IDM_COPYHEX:
{
char temp[24];
sprintf(temp, "%08x", debugger->readInstruction(selection));
wxTheClipboard->SetData(new wxTextDataObject(StrToWxStr(temp)));
}
break;
case IDM_COPYFUNCTION:
@ -259,11 +266,11 @@ void CCodeView::OnPopupMenu(wxCommandEvent& event)
break;
#endif
case IDM_RUNTOHERE:
debugger->setBreakpoint(selection);
debugger->runToBreakpoint();
Refresh();
break;
case IDM_RUNTOHERE:
debugger->setBreakpoint(selection);
debugger->runToBreakpoint();
Refresh();
break;
// Insert blr or restore old value
case IDM_INSERTBLR:
@ -275,9 +282,9 @@ void CCodeView::OnPopupMenu(wxCommandEvent& event)
Refresh();
break;
case IDM_JITRESULTS:
case IDM_JITRESULTS:
debugger->showJitResults(selection);
break;
break;
case IDM_FOLLOWBRANCH:
{
@ -366,7 +373,7 @@ void CCodeView::OnPaint(wxPaintEvent& event)
dc.GetTextExtent(_T("0WJyq"),&w,&h);
if (h > rowHeight)
rowHeight = h;
rowHeight = h;
dc.GetTextExtent(_T("W"),&w,&h);
int charWidth = w;
@ -507,7 +514,8 @@ void CCodeView::OnPaint(wxPaintEvent& event)
strcpy(desc, debugger->getDescription(address).c_str());
}
if (!plain) {
if (!plain)
{
dc.SetTextForeground(_T("#0000FF")); // blue
//char temp[256];
@ -535,11 +543,11 @@ void CCodeView::OnPaint(wxPaintEvent& event)
for (int i = 0; i < numBranches; i++)
{
int x = 17 + 49 * charWidth + (branches[i].srcAddr % 9) * 8;
_MoveTo(x-2, branches[i].src);
int x = 17 + 49 * charWidth + (branches[i].srcAddr % 9) * 8;
_MoveTo(x-2, branches[i].src);
if (branches[i].dst < rc.height + 400 && branches[i].dst > -400)
{
{
_LineTo(dc, x+2, branches[i].src);
_LineTo(dc, x+2, branches[i].dst);
_LineTo(dc, x-4, branches[i].dst);
@ -547,7 +555,7 @@ void CCodeView::OnPaint(wxPaintEvent& event)
_MoveTo(x, branches[i].dst - 4);
_LineTo(dc, x-4, branches[i].dst);
_LineTo(dc, x+1, branches[i].dst+5);
}
}
//else
//{
// This can be re-enabled when there is a scrollbar or

View File

@ -138,16 +138,16 @@ void CCodeWindow::OnHostMessage(wxCommandEvent& event)
{
switch (event.GetId())
{
case IDM_NOTIFYMAPLOADED:
NotifyMapLoaded();
case IDM_NOTIFYMAPLOADED:
NotifyMapLoaded();
if (m_BreakpointWindow) m_BreakpointWindow->NotifyUpdate();
break;
break;
case IDM_UPDATEDISASMDIALOG:
Update();
case IDM_UPDATEDISASMDIALOG:
Update();
if (codeview) codeview->Center(PC);
if (m_RegisterWindow) m_RegisterWindow->NotifyUpdate();
break;
if (m_RegisterWindow) m_RegisterWindow->NotifyUpdate();
break;
case IDM_UPDATEBREAKPOINTS:
Update();
@ -161,31 +161,31 @@ void CCodeWindow::OnCodeStep(wxCommandEvent& event)
{
switch (event.GetId())
{
case IDM_STEP:
case IDM_STEP:
SingleStep();
break;
break;
case IDM_STEPOVER:
case IDM_STEPOVER:
StepOver();
break;
break;
case IDM_TOGGLE_BREAKPOINT:
ToggleBreakpoint();
break;
case IDM_SKIP:
PC += 4;
Update();
break;
case IDM_SKIP:
PC += 4;
Update();
break;
case IDM_SETPC:
PC = codeview->GetSelection();
Update();
break;
case IDM_SETPC:
PC = codeview->GetSelection();
Update();
break;
case IDM_GOTOPC:
JumpToAddress(PC);
break;
case IDM_GOTOPC:
JumpToAddress(PC);
break;
}
UpdateButtonStates();
@ -227,7 +227,7 @@ void CCodeWindow::OnCallstackListChange(wxCommandEvent& event)
{
int index = callstack->GetSelection();
if (index >= 0)
{
{
u32 address = (u32)(u64)(callstack->GetClientData(index));
if (address)
JumpToAddress(address);
@ -238,7 +238,7 @@ void CCodeWindow::OnCallersListChange(wxCommandEvent& event)
{
int index = callers->GetSelection();
if (index >= 0)
{
{
u32 address = (u32)(u64)(callers->GetClientData(index));
if (address)
JumpToAddress(address);
@ -249,7 +249,7 @@ void CCodeWindow::OnCallsListChange(wxCommandEvent& event)
{
int index = calls->GetSelection();
if (index >= 0)
{
{
u32 address = (u32)(u64)(calls->GetClientData(index));
if (address)
JumpToAddress(address);
@ -283,7 +283,9 @@ void CCodeWindow::StepOver()
Update();
}
else
{
SingleStep();
}
UpdateButtonStates();
// Update all toolbars in the aui manager
@ -307,12 +309,13 @@ void CCodeWindow::UpdateLists()
Symbol *symbol = g_symbolDB.GetSymbolFromAddr(addr);
if (!symbol)
return;
for (int i = 0; i < (int)symbol->callers.size(); i++)
{
u32 caller_addr = symbol->callers[i].callAddress;
Symbol *caller_symbol = g_symbolDB.GetSymbolFromAddr(caller_addr);
if (caller_symbol)
{
{
int idx = callers->Append(StrToWxStr(StringFromFormat
("< %s (%08x)", caller_symbol->name.c_str(), caller_addr).c_str()));
callers->SetClientData(idx, (void*)(u64)caller_addr);
@ -325,7 +328,7 @@ void CCodeWindow::UpdateLists()
u32 call_addr = symbol->calls[i].function;
Symbol *call_symbol = g_symbolDB.GetSymbolFromAddr(call_addr);
if (call_symbol)
{
{
int idx = calls->Append(StrToWxStr(StringFromFormat
("> %s (%08x)", call_symbol->name.c_str(), call_addr).c_str()));
calls->SetClientData(idx, (void*)(u64)call_addr);
@ -354,8 +357,7 @@ void CCodeWindow::UpdateCallstack()
}
// Create CPU Mode menus
void CCodeWindow::CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParameter,
wxMenuBar *pMenuBar)
void CCodeWindow::CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParameter, wxMenuBar *pMenuBar)
{
// CPU Mode
wxMenu* pCoreMenu = new wxMenu;
@ -386,7 +388,7 @@ void CCodeWindow::CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParam
_("Turn off all JIT functions, but still use the JIT core from Jit.cpp"),
wxITEM_CHECK);
pCoreMenu->Append(IDM_JITLSOFF, _("&JIT LoadStore off"),
wxEmptyString, wxITEM_CHECK);
wxEmptyString, wxITEM_CHECK);
pCoreMenu->Append(IDM_JITLSLBZXOFF, _(" &JIT LoadStore lbzx off"),
wxEmptyString, wxITEM_CHECK);
pCoreMenu->Append(IDM_JITLSLXZOFF, _(" &JIT LoadStore lXz off"),
@ -394,17 +396,17 @@ void CCodeWindow::CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParam
pCoreMenu->Append(IDM_JITLSLWZOFF, _("&JIT LoadStore lwz off"),
wxEmptyString, wxITEM_CHECK);
pCoreMenu->Append(IDM_JITLSFOFF, _("&JIT LoadStore Floating off"),
wxEmptyString, wxITEM_CHECK);
wxEmptyString, wxITEM_CHECK);
pCoreMenu->Append(IDM_JITLSPOFF, _("&JIT LoadStore Paired off"),
wxEmptyString, wxITEM_CHECK);
wxEmptyString, wxITEM_CHECK);
pCoreMenu->Append(IDM_JITFPOFF, _("&JIT FloatingPoint off"),
wxEmptyString, wxITEM_CHECK);
wxEmptyString, wxITEM_CHECK);
pCoreMenu->Append(IDM_JITIOFF, _("&JIT Integer off"),
wxEmptyString, wxITEM_CHECK);
wxEmptyString, wxITEM_CHECK);
pCoreMenu->Append(IDM_JITPOFF, _("&JIT Paired off"),
wxEmptyString, wxITEM_CHECK);
wxEmptyString, wxITEM_CHECK);
pCoreMenu->Append(IDM_JITSROFF, _("&JIT SystemRegisters off"),
wxEmptyString, wxITEM_CHECK);
wxEmptyString, wxITEM_CHECK);
pMenuBar->Append(pCoreMenu, _("&JIT"));
@ -448,46 +450,46 @@ void CCodeWindow::OnCPUMode(wxCommandEvent& event)
{
case IDM_INTERPRETER:
PowerPC::SetMode(UseInterpreter() ? PowerPC::MODE_INTERPRETER : PowerPC::MODE_JIT);
break;
break;
case IDM_BOOTTOPAUSE:
bBootToPause = !bBootToPause;
return;
return;
case IDM_AUTOMATICSTART:
bAutomaticStart = !bAutomaticStart;
return;
return;
case IDM_JITOFF:
Core::g_CoreStartupParameter.bJITOff = event.IsChecked();
break;
break;
case IDM_JITLSOFF:
Core::g_CoreStartupParameter.bJITLoadStoreOff = event.IsChecked();
break;
break;
case IDM_JITLSLXZOFF:
Core::g_CoreStartupParameter.bJITLoadStorelXzOff = event.IsChecked();
break;
break;
case IDM_JITLSLWZOFF:
Core::g_CoreStartupParameter.bJITLoadStorelwzOff = event.IsChecked();
break;
break;
case IDM_JITLSLBZXOFF:
Core::g_CoreStartupParameter.bJITLoadStorelbzxOff = event.IsChecked();
break;
break;
case IDM_JITLSFOFF:
Core::g_CoreStartupParameter.bJITLoadStoreFloatingOff = event.IsChecked();
break;
break;
case IDM_JITLSPOFF:
Core::g_CoreStartupParameter.bJITLoadStorePairedOff = event.IsChecked();
break;
break;
case IDM_JITFPOFF:
Core::g_CoreStartupParameter.bJITFloatingPointOff = event.IsChecked();
break;
break;
case IDM_JITIOFF:
Core::g_CoreStartupParameter.bJITIntegerOff = event.IsChecked();
break;
break;
case IDM_JITPOFF:
Core::g_CoreStartupParameter.bJITPairedOff = event.IsChecked();
break;
break;
case IDM_JITSROFF:
Core::g_CoreStartupParameter.bJITSystemRegistersOff = event.IsChecked();
break;
break;
}
// Clear the JIT cache to enable these changes
@ -503,22 +505,22 @@ void CCodeWindow::OnJitMenu(wxCommandEvent& event)
{
case IDM_LOGINSTRUCTIONS:
PPCTables::LogCompiledInstructions();
break;
break;
case IDM_CLEARCODECACHE:
JitInterface::ClearCache();
break;
break;
case IDM_SEARCHINSTRUCTION:
{
wxString str;
str = wxGetTextFromUser(_T(""), wxT("Op?"), wxEmptyString, this);
for (u32 addr = 0x80000000; addr < 0x80100000; addr += 4)
{
{
const char *name = PPCTables::GetInstructionName(Memory::ReadUnchecked_U32(addr));
auto const wx_name = WxStrToStr(str);
if (name && (wx_name == name))
{
{
NOTICE_LOG(POWERPC, "Found %s at %08x", wx_name.c_str(), addr);
}
}
@ -575,10 +577,10 @@ void CCodeWindow::PopulateToolbar(wxAuiToolBar* toolBar)
toolBar->SetToolBitmapSize(wxSize(w, h));
toolBar->AddTool(IDM_STEP, _("Step"), m_Bitmaps[Toolbar_Step]);
toolBar->AddTool(IDM_STEPOVER, _("Step Over"), m_Bitmaps[Toolbar_StepOver]);
toolBar->AddTool(IDM_STEPOVER, _("Step Over"), m_Bitmaps[Toolbar_StepOver]);
toolBar->AddTool(IDM_SKIP, _("Skip"), m_Bitmaps[Toolbar_Skip]);
toolBar->AddSeparator();
toolBar->AddTool(IDM_GOTOPC, _("Show PC"), m_Bitmaps[Toolbar_GotoPC]);
toolBar->AddTool(IDM_GOTOPC, _("Show PC"), m_Bitmaps[Toolbar_GotoPC]);
toolBar->AddTool(IDM_SETPC, _("Set PC"), m_Bitmaps[Toolbar_SetPC]);
toolBar->AddSeparator();
toolBar->AddControl(new wxTextCtrl(toolBar, IDM_ADDRBOX, _T("")));

View File

@ -36,13 +36,13 @@ BEGIN_EVENT_TABLE(DSPDebuggerLLE, wxPanel)
EVT_CLOSE(DSPDebuggerLLE::OnClose)
EVT_MENU_RANGE(ID_RUNTOOL, ID_SHOWPCTOOL, DSPDebuggerLLE::OnChangeState)
EVT_TEXT_ENTER(ID_ADDRBOX, DSPDebuggerLLE::OnAddrBoxChange)
EVT_LISTBOX(ID_SYMBOLLIST, DSPDebuggerLLE::OnSymbolListChange)
EVT_LISTBOX(ID_SYMBOLLIST, DSPDebuggerLLE::OnSymbolListChange)
END_EVENT_TABLE()
DSPDebuggerLLE::DSPDebuggerLLE(wxWindow* parent, wxWindowID id)
: wxPanel(parent, id, wxDefaultPosition, wxDefaultSize,
wxTAB_TRAVERSAL, _("DSP LLE Debugger"))
wxTAB_TRAVERSAL, _("DSP LLE Debugger"))
, m_CachedStepCounter(-1)
{
m_DebuggerFrame = this;
@ -184,14 +184,14 @@ void DSPDebuggerLLE::FocusOnPC()
void DSPDebuggerLLE::UpdateState()
{
if (DSPCore_GetState() == DSPCORE_RUNNING)
{
{
m_Toolbar->SetToolLabel(ID_RUNTOOL, wxT("Pause"));
m_Toolbar->SetToolBitmap(ID_RUNTOOL,
wxArtProvider::GetBitmap(wxART_TICK_MARK, wxART_OTHER, wxSize(10,10)));
m_Toolbar->EnableTool(ID_STEPTOOL, false);
}
else
{
else
{
m_Toolbar->SetToolLabel(ID_RUNTOOL, wxT("Run"));
m_Toolbar->SetToolBitmap(ID_RUNTOOL,
wxArtProvider::GetBitmap(wxART_GO_FORWARD, wxART_OTHER, wxSize(10,10)));

View File

@ -79,9 +79,10 @@ void GFXDebuggerPanel::SaveSettings() const
// TODO: make this work when we close the entire program too, currently on total close we get
// weird values, perhaps because of some conflict with the rendering window
//
// TODO: get the screen resolution and make limits from that
if (GetPosition().x < 1000 && GetPosition().y < 1000
&& GetSize().GetWidth() < 1000
&& GetSize().GetWidth() < 1000
&& GetSize().GetHeight() < 1000)
{
file.Set("VideoWindow", "x", GetPosition().x);

View File

@ -59,15 +59,15 @@ BEGIN_EVENT_TABLE(CJitWindow, wxPanel)
END_EVENT_TABLE()
CJitWindow::CJitWindow(wxWindow* parent, wxWindowID id, const wxPoint& pos,
const wxSize& size, long style, const wxString& name)
const wxSize& size, long style, const wxString& name)
: wxPanel(parent, id, pos, size, style, name)
{
wxBoxSizer* sizerBig = new wxBoxSizer(wxVERTICAL);
wxBoxSizer* sizerSplit = new wxBoxSizer(wxHORIZONTAL);
sizerSplit->Add(ppc_box = new wxTextCtrl(this, IDM_PPC_BOX, _T("(ppc)"),
wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE), 1, wxEXPAND);
wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE), 1, wxEXPAND);
sizerSplit->Add(x86_box = new wxTextCtrl(this, IDM_X86_BOX, _T("(x86)"),
wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE), 1, wxEXPAND);
wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE), 1, wxEXPAND);
sizerBig->Add(block_list = new JitBlockList(this, IDM_BLOCKLIST,
wxDefaultPosition, wxSize(100, 140),
wxLC_REPORT | wxSUNKEN_BORDER | wxLC_ALIGN_LEFT | wxLC_SINGLE_SEL | wxLC_SORT_ASCENDING),
@ -107,21 +107,26 @@ void CJitWindow::Compare(u32 em_address)
int block_num = jit->GetBlockCache()->GetBlockNumberFromStartAddress(em_address);
if (block_num < 0)
{
for (int i = 0; i < 500; i++) {
for (int i = 0; i < 500; i++)
{
block_num = jit->GetBlockCache()->GetBlockNumberFromStartAddress(em_address - 4 * i);
if (block_num >= 0)
break;
}
if (block_num >= 0) {
if (block_num >= 0)
{
JitBlock *block = jit->GetBlockCache()->GetBlock(block_num);
if (!(block->originalAddress <= em_address &&
block->originalSize + block->originalAddress >= em_address))
block->originalSize + block->originalAddress >= em_address))
block_num = -1;
}
// Do not merge this "if" with the above - block_num changes inside it.
if (block_num < 0) {
if (block_num < 0)
{
ppc_box->SetValue(StrToWxStr(StringFromFormat("(non-code address: %08x)",
em_address)));
em_address)));
x86_box->SetValue(StrToWxStr(StringFromFormat("(no translation)")));
delete[] xDis;
return;
@ -186,12 +191,14 @@ void CJitWindow::Compare(u32 em_address)
sptr += sprintf(sptr, "%i estimated cycles\n", st.numCycles);
sptr += sprintf(sptr, "Num instr: PPC: %i x86: %i (blowup: %i%%)\n",
size, num_x86_instructions, 100 * (num_x86_instructions / size - 1));
size, num_x86_instructions, 100 * (num_x86_instructions / size - 1));
sptr += sprintf(sptr, "Num bytes: PPC: %i x86: %i (blowup: %i%%)\n",
size * 4, block->codeSize, 100 * (block->codeSize / (4 * size) - 1));
size * 4, block->codeSize, 100 * (block->codeSize / (4 * size) - 1));
ppc_box->SetValue(StrToWxStr((char*)xDis));
} else {
}
else
{
ppc_box->SetValue(StrToWxStr(StringFromFormat(
"(non-code address: %08x)", em_address)));
x86_box->SetValue("---");
@ -209,9 +216,9 @@ void CJitWindow::OnHostMessage(wxCommandEvent& event)
{
switch (event.GetId())
{
case IDM_NOTIFYMAPLOADED:
//NotifyMapLoaded();
break;
case IDM_NOTIFYMAPLOADED:
//NotifyMapLoaded();
break;
}
}
@ -229,7 +236,7 @@ enum {
};
JitBlockList::JitBlockList(wxWindow* parent, const wxWindowID id,
const wxPoint& pos, const wxSize& size, long style)
const wxPoint& pos, const wxSize& size, long style)
: wxListCtrl(parent, id, pos, size, style) // | wxLC_VIRTUAL)
{
Init();

View File

@ -90,7 +90,7 @@ void CMemoryView::OnMouseDownL(wxMouseEvent& event)
}
else
{
debugger->toggleMemCheck(YToAddress(y));
debugger->toggleMemCheck(YToAddress(y));
Refresh();
Host_UpdateBreakPointView();
@ -143,17 +143,17 @@ void CMemoryView::OnPopupMenu(wxCommandEvent& event)
switch (event.GetId())
{
#if wxUSE_CLIPBOARD
case IDM_COPYADDRESS:
case IDM_COPYADDRESS:
wxTheClipboard->SetData(new wxTextDataObject(wxString::Format(_T("%08x"), selection)));
break;
break;
case IDM_COPYHEX:
{
char temp[24];
sprintf(temp, "%08x", debugger->readExtraMemory(memory, selection));
wxTheClipboard->SetData(new wxTextDataObject(StrToWxStr(temp)));
}
break;
case IDM_COPYHEX:
{
char temp[24];
sprintf(temp, "%08x", debugger->readExtraMemory(memory, selection));
wxTheClipboard->SetData(new wxTextDataObject(StrToWxStr(temp)));
}
break;
#endif
case IDM_TOGGLEMEMORY:
@ -197,7 +197,7 @@ void CMemoryView::OnMouseDownR(wxMouseEvent& event)
viewAsSubMenu->Append(IDM_VIEWASFP, StrToWxStr("FP value"));
viewAsSubMenu->Append(IDM_VIEWASASCII, StrToWxStr("ASCII"));
viewAsSubMenu->Append(IDM_VIEWASHEX, StrToWxStr("Hex"));
menu->AppendSubMenu(viewAsSubMenu, StrToWxStr("View As:"));
menu->AppendSubMenu(viewAsSubMenu, StrToWxStr("View As:"));
PopupMenu(menu);
}
@ -212,10 +212,10 @@ void CMemoryView::OnPaint(wxPaintEvent& event)
wxCoord w,h;
dc.GetTextExtent(_T("0WJyq"),&w,&h,NULL,NULL,&hFont);
if (h > rowHeight)
rowHeight = h;
rowHeight = h;
dc.GetTextExtent(_T("0WJyq"),&w,&h,NULL,NULL,&DebuggerFont);
if (h > rowHeight)
rowHeight = h;
rowHeight = h;
if (viewAsType==VIEWAS_HEX)
dc.SetFont(hFont);
@ -359,7 +359,9 @@ void CMemoryView::OnPaint(wxPaintEvent& event)
curAddress += 32;
}
else
{
sprintf(dis, "INVALID VIEWAS TYPE");
}
char desc[256] = "";
if (viewAsType != VIEWAS_HEX)

View File

@ -341,13 +341,13 @@ void CMemoryWindow::onSearch(wxCommandEvent& event)
newsize = rawData.size();
if (pad)
{
{
tmpstr = new char[newsize + 2];
memset(tmpstr, 0, newsize + 2);
tmpstr[0] = '0';
}
else
{
else
{
tmpstr = new char[newsize + 1];
memset(tmpstr, 0, newsize + 1);
}
@ -368,7 +368,9 @@ void CMemoryWindow::onSearch(wxCommandEvent& event)
i += 1;
}
delete[] tmpstr;
} else {
}
else
{
//Looking for an ascii string
size = rawData.size();
Dest.resize(size+1);

View File

@ -31,8 +31,10 @@ static const char *special_reg_names[] = {
"PC", "LR", "CTR", "CR", "FPSCR", "MSR", "SRR0", "SRR1", "Exceptions", "Int Mask", "Int Cause",
};
static u32 GetSpecialRegValue(int reg) {
switch (reg) {
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];
@ -50,8 +52,10 @@ static u32 GetSpecialRegValue(int reg) {
wxString CRegTable::GetValue(int row, int col)
{
if (row < 32) {
switch (col) {
if (row < 32)
{
switch (col)
{
case 0: return StrToWxStr(GetGPRName(row));
case 1: return wxString::Format(wxT("%08x"), GPR(row));
case 2: return StrToWxStr(GetFPRName(row));
@ -59,20 +63,26 @@ wxString CRegTable::GetValue(int row, int col)
case 4: return wxString::Format(wxT("%016llx"), riPS1(row));
default: return wxEmptyString;
}
} else {
if (row - 32 < NUM_SPECIALS) {
switch (col) {
}
else
{
if (row - 32 < NUM_SPECIALS)
{
switch (col)
{
case 0: return StrToWxStr(special_reg_names[row - 32]);
case 1: return wxString::Format(wxT("%08x"), GetSpecialRegValue(row - 32));
default: return wxEmptyString;
}
}
}
}
return wxEmptyString;
return wxEmptyString;
}
static void SetSpecialRegValue(int reg, u32 value) {
switch (reg) {
static void SetSpecialRegValue(int reg, u32 value)
{
switch (reg)
{
case 0: PowerPC::ppcState.pc = value; break;
case 1: PowerPC::ppcState.spr[SPR_LR] = value; break;
case 2: PowerPC::ppcState.spr[SPR_CTR] = value; break;
@ -94,15 +104,19 @@ void CRegTable::SetValue(int row, int col, const wxString& strNewVal)
u32 newVal = 0;
if (TryParse(WxStrToStr(strNewVal), &newVal))
{
if (row < 32) {
if (row < 32)
{
if (col == 1)
GPR(row) = newVal;
else if (col == 3)
riPS0(row) = newVal;
else if (col == 4)
riPS1(row) = newVal;
} else {
if ((row - 32 < NUM_SPECIALS) && (col == 1)) {
}
else
{
if ((row - 32 < NUM_SPECIALS) && (col == 1))
{
SetSpecialRegValue(row - 32, newVal);
}
}
@ -135,7 +149,8 @@ wxGridCellAttr *CRegTable::GetAttr(int row, int col, wxGridCellAttr::wxAttrKind)
attr->SetBackgroundColour(wxColour(wxT("#FFFFFF"))); //wxWHITE
attr->SetFont(DebuggerFont);
switch (col) {
switch (col)
{
case 1:
attr->SetAlignment(wxALIGN_CENTER, wxALIGN_CENTER);
break;
@ -149,11 +164,13 @@ wxGridCellAttr *CRegTable::GetAttr(int row, int col, wxGridCellAttr::wxAttrKind)
}
bool red = false;
switch (col) {
switch (col)
{
case 1: red = row < 32 ? m_CachedRegHasChanged[row] : m_CachedSpecialRegHasChanged[row-32]; break;
case 3:
case 4: red = row < 32 ? m_CachedFRegHasChanged[row][col-3] : false; break;
}
attr->SetTextColour(red ? wxColor(wxT("#FF0000")) : wxColor(wxT("#000000")));
attr->IncRef();
return attr;

View File

@ -28,8 +28,8 @@ END_EVENT_TABLE()
CRegisterWindow::CRegisterWindow(wxWindow* parent, wxWindowID id,
const wxPoint& position, const wxSize& size,
long style, const wxString& name)
const wxPoint& position, const wxSize& size,
long style, const wxString& name)
: wxPanel(parent, id, position, size, style, name)
, m_GPRGridView(NULL)
{