Merge pull request #733 from lioncash/readability

DolphinWX: More readable variable names in BreakpointView
This commit is contained in:
shuffle2 2014-09-03 01:28:17 -07:00
commit 46c1a0f03b
1 changed files with 27 additions and 32 deletions

View File

@ -15,6 +15,7 @@
#include "Common/BreakPoints.h" #include "Common/BreakPoints.h"
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/StringUtil.h"
#include "Core/PowerPC/PowerPC.h" #include "Core/PowerPC/PowerPC.h"
#include "Core/PowerPC/PPCSymbolDB.h" #include "Core/PowerPC/PPCSymbolDB.h"
#include "DolphinWX/WxUtils.h" #include "DolphinWX/WxUtils.h"
@ -42,61 +43,55 @@ void CBreakPointView::Update()
InsertColumn(3, _("Address")); InsertColumn(3, _("Address"));
InsertColumn(4, _("Flags")); InsertColumn(4, _("Flags"));
char szBuffer[64];
const BreakPoints::TBreakPoints& rBreakPoints = PowerPC::breakpoints.GetBreakPoints(); const BreakPoints::TBreakPoints& rBreakPoints = PowerPC::breakpoints.GetBreakPoints();
for (const auto& rBP : rBreakPoints) for (const auto& rBP : rBreakPoints)
{ {
if (!rBP.bTemporary) if (!rBP.bTemporary)
{ {
wxString temp; wxString breakpoint_enabled_str = StrToWxStr(rBP.bOn ? "on" : " ");
temp = StrToWxStr(rBP.bOn ? "on" : " "); int item = InsertItem(0, breakpoint_enabled_str);
int Item = InsertItem(0, temp); SetItem(item, 1, StrToWxStr("BP"));
temp = StrToWxStr("BP");
SetItem(Item, 1, temp);
Symbol *symbol = g_symbolDB.GetSymbolFromAddr(rBP.iAddress); Symbol *symbol = g_symbolDB.GetSymbolFromAddr(rBP.iAddress);
if (symbol) if (symbol)
{ {
temp = StrToWxStr(g_symbolDB.GetDescription(rBP.iAddress)); wxString symbol_description = StrToWxStr(g_symbolDB.GetDescription(rBP.iAddress));
SetItem(Item, 2, temp); SetItem(item, 2, symbol_description);
} }
sprintf(szBuffer, "%08x", rBP.iAddress); std::string address = StringFromFormat("%08x", rBP.iAddress);
temp = StrToWxStr(szBuffer); SetItem(item, 3, StrToWxStr(address));
SetItem(Item, 3, temp);
SetItemData(Item, rBP.iAddress); SetItemData(item, rBP.iAddress);
} }
} }
const MemChecks::TMemChecks& rMemChecks = PowerPC::memchecks.GetMemChecks(); const MemChecks::TMemChecks& rMemChecks = PowerPC::memchecks.GetMemChecks();
for (const auto& rMemCheck : rMemChecks) for (const auto& rMemCheck : rMemChecks)
{ {
wxString temp; wxString memcheck_on_str = StrToWxStr((rMemCheck.Break || rMemCheck.Log) ? "on" : " ");
temp = StrToWxStr((rMemCheck.Break || rMemCheck.Log) ? "on" : " "); int item = InsertItem(0, memcheck_on_str);
int Item = InsertItem(0, temp); SetItem(item, 1, StrToWxStr("MC"));
temp = StrToWxStr("MC");
SetItem(Item, 1, temp);
Symbol *symbol = g_symbolDB.GetSymbolFromAddr(rMemCheck.StartAddress); Symbol *symbol = g_symbolDB.GetSymbolFromAddr(rMemCheck.StartAddress);
if (symbol) if (symbol)
{ {
temp = StrToWxStr(g_symbolDB.GetDescription(rMemCheck.StartAddress)); wxString memcheck_start_addr = StrToWxStr(g_symbolDB.GetDescription(rMemCheck.StartAddress));
SetItem(Item, 2, temp); SetItem(item, 2, memcheck_start_addr);
} }
sprintf(szBuffer, "%08x to %08x", rMemCheck.StartAddress, rMemCheck.EndAddress); std::string address_range_str = StringFromFormat("%08x to %08x", rMemCheck.StartAddress, rMemCheck.EndAddress);
temp = StrToWxStr(szBuffer); SetItem(item, 3, StrToWxStr(address_range_str));
SetItem(Item, 3, temp);
size_t c = 0; std::string mode;
if (rMemCheck.OnRead) szBuffer[c++] = 'r'; if (rMemCheck.OnRead)
if (rMemCheck.OnWrite) szBuffer[c++] = 'w'; mode += 'r';
szBuffer[c] = 0x00; if (rMemCheck.OnWrite)
temp = StrToWxStr(szBuffer); mode += 'w';
SetItem(Item, 4, temp);
SetItemData(Item, rMemCheck.StartAddress); SetItem(item, 4, StrToWxStr(mode));
SetItemData(item, rMemCheck.StartAddress);
} }
Refresh(); Refresh();
@ -104,10 +99,10 @@ void CBreakPointView::Update()
void CBreakPointView::DeleteCurrentSelection() void CBreakPointView::DeleteCurrentSelection()
{ {
int Item = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); int item = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
if (Item >= 0) if (item >= 0)
{ {
u32 Address = (u32)GetItemData(Item); u32 Address = (u32)GetItemData(item);
PowerPC::breakpoints.Remove(Address); PowerPC::breakpoints.Remove(Address);
PowerPC::memchecks.Remove(Address); PowerPC::memchecks.Remove(Address);
Update(); Update();