From 34692ab826abc8f8faa61bdb2280b742424528f1 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Sat, 7 Dec 2013 15:14:29 -0500 Subject: Remove unnecessary Src/ folders --- Source/Core/DolphinWX/Debugger/MemoryWindow.cpp | 424 ++++++++++++++++++++++++ 1 file changed, 424 insertions(+) create mode 100644 Source/Core/DolphinWX/Debugger/MemoryWindow.cpp (limited to 'Source/Core/DolphinWX/Debugger/MemoryWindow.cpp') diff --git a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp new file mode 100644 index 0000000000..bff24623e1 --- /dev/null +++ b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp @@ -0,0 +1,424 @@ +// Copyright 2013 Dolphin Emulator Project +// Licensed under GPLv2 +// Refer to the license.txt file included. + +#include +#include +#include +#include +#include + +#include "../WxUtils.h" +#include "MemoryWindow.h" +#include "HW/CPU.h" +#include "PowerPC/PowerPC.h" +#include "FileUtil.h" + +#include "Debugger/PPCDebugInterface.h" +#include "PowerPC/PPCSymbolDB.h" + +#include "Core.h" +#include "ConfigManager.h" +#include "LogManager.h" + +#include "HW/Memmap.h" +#include "HW/DSP.h" + +#include "../../DolphinWX/Globals.h" + +enum +{ + IDM_MEM_ADDRBOX = 350, + IDM_SYMBOLLIST, + IDM_SETVALBUTTON, + IDM_DUMP_MEMORY, + IDM_DUMP_MEM2, + IDM_DUMP_FAKEVMEM, + IDM_VALBOX, + IDM_U8, + IDM_U16, + IDM_U32, + IDM_SEARCH, + IDM_ASCII, + IDM_HEX +}; + +BEGIN_EVENT_TABLE(CMemoryWindow, wxPanel) + EVT_TEXT(IDM_MEM_ADDRBOX, CMemoryWindow::OnAddrBoxChange) + EVT_LISTBOX(IDM_SYMBOLLIST, CMemoryWindow::OnSymbolListChange) + EVT_HOST_COMMAND(wxID_ANY, CMemoryWindow::OnHostMessage) + EVT_BUTTON(IDM_SETVALBUTTON, CMemoryWindow::SetMemoryValue) + EVT_BUTTON(IDM_DUMP_MEMORY, CMemoryWindow::OnDumpMemory) + EVT_BUTTON(IDM_DUMP_MEM2, CMemoryWindow::OnDumpMem2) + EVT_BUTTON(IDM_DUMP_FAKEVMEM, CMemoryWindow::OnDumpFakeVMEM) + EVT_CHECKBOX(IDM_U8, CMemoryWindow::U8) + EVT_CHECKBOX(IDM_U16, CMemoryWindow::U16) + EVT_CHECKBOX(IDM_U32, CMemoryWindow::U32) + EVT_BUTTON(IDM_SEARCH, CMemoryWindow::onSearch) + EVT_CHECKBOX(IDM_ASCII, CMemoryWindow::onAscii) + EVT_CHECKBOX(IDM_HEX, CMemoryWindow::onHex) +END_EVENT_TABLE() + +CMemoryWindow::CMemoryWindow(wxWindow* parent, wxWindowID id, + const wxPoint& pos, const wxSize& size, long style, const wxString& name) + : wxPanel(parent, id, pos, size, style, name) +{ + wxBoxSizer* sizerBig = new wxBoxSizer(wxHORIZONTAL); + wxBoxSizer* sizerRight = new wxBoxSizer(wxVERTICAL); + // Didn't see anything useful in the left part + //wxBoxSizer* sizerLeft = new wxBoxSizer(wxVERTICAL); + + DebugInterface* di = &PowerPC::debug_interface; + + //symbols = new wxListBox(this, IDM_SYMBOLLIST, wxDefaultPosition, + // wxSize(20, 100), 0, NULL, wxLB_SORT); + //sizerLeft->Add(symbols, 1, wxEXPAND); + memview = new CMemoryView(di, this); + memview->dataType = 0; + //sizerBig->Add(sizerLeft, 1, wxEXPAND); + sizerBig->Add(memview, 20, wxEXPAND); + sizerBig->Add(sizerRight, 0, wxEXPAND | wxALL, 3); + sizerRight->Add(addrbox = new wxTextCtrl(this, IDM_MEM_ADDRBOX, _T(""))); + sizerRight->Add(valbox = new wxTextCtrl(this, IDM_VALBOX, _T(""))); + sizerRight->Add(new wxButton(this, IDM_SETVALBUTTON, _("Set &Value"))); + + sizerRight->AddSpacer(5); + sizerRight->Add(new wxButton(this, IDM_DUMP_MEMORY, _("&Dump MRAM"))); + sizerRight->Add(new wxButton(this, IDM_DUMP_MEM2, _("&Dump EXRAM"))); + + if (SConfig::GetInstance().m_LocalCoreStartupParameter.bTLBHack == true) + sizerRight->Add(new wxButton(this, IDM_DUMP_FAKEVMEM, _("&Dump FakeVMEM"))); + + wxStaticBoxSizer* sizerSearchType = new wxStaticBoxSizer(wxVERTICAL, this, _("Search")); + + sizerSearchType->Add(btnSearch = new wxButton(this, IDM_SEARCH, _("Search"))); + sizerSearchType->Add(chkAscii = new wxCheckBox(this, IDM_ASCII, _T("&Ascii "))); + sizerSearchType->Add(chkHex = new wxCheckBox(this, IDM_HEX, _("&Hex"))); + sizerRight->Add(sizerSearchType); + wxStaticBoxSizer* sizerDataTypes = new wxStaticBoxSizer(wxVERTICAL, this, _("Data Type")); + + sizerDataTypes->SetMinSize(74, 40); + sizerDataTypes->Add(chk8 = new wxCheckBox(this, IDM_U8, _T("&U8"))); + sizerDataTypes->Add(chk16 = new wxCheckBox(this, IDM_U16, _T("&U16"))); + sizerDataTypes->Add(chk32 = new wxCheckBox(this, IDM_U32, _T("&U32"))); + sizerRight->Add(sizerDataTypes); + SetSizer(sizerBig); + chkHex->SetValue(1); //Set defaults + chk8->SetValue(1); + + //sizerLeft->Fit(this); + sizerRight->Fit(this); + sizerBig->Fit(this); +} + +void CMemoryWindow::Save(IniFile& _IniFile) const +{ + // Prevent these bad values that can happen after a crash or hanging + if(GetPosition().x != -32000 && GetPosition().y != -32000) + { + _IniFile.Set("MemoryWindow", "x", GetPosition().x); + _IniFile.Set("MemoryWindow", "y", GetPosition().y); + _IniFile.Set("MemoryWindow", "w", GetSize().GetWidth()); + _IniFile.Set("MemoryWindow", "h", GetSize().GetHeight()); + } +} + +void CMemoryWindow::Load(IniFile& _IniFile) +{ + int x, y, w, h; + _IniFile.Get("MemoryWindow", "x", &x, GetPosition().x); + _IniFile.Get("MemoryWindow", "y", &y, GetPosition().y); + _IniFile.Get("MemoryWindow", "w", &w, GetSize().GetWidth()); + _IniFile.Get("MemoryWindow", "h", &h, GetSize().GetHeight()); + SetSize(x, y, w, h); +} + +void CMemoryWindow::JumpToAddress(u32 _Address) +{ + memview->Center(_Address); +} + +void CMemoryWindow::SetMemoryValue(wxCommandEvent& event) +{ + std::string str_addr = WxStrToStr(addrbox->GetValue()); + std::string str_val = WxStrToStr(valbox->GetValue()); + u32 addr; + u32 val; + + if (!TryParse(std::string("0x") + str_addr, &addr)) + { + PanicAlert("Invalid Address: %s", str_addr.c_str()); + return; + } + + if (!TryParse(std::string("0x") + str_val, &val)) + { + PanicAlert("Invalid Value: %s", str_val.c_str()); + return; + } + + Memory::Write_U32(val, addr); + memview->Refresh(); +} + +void CMemoryWindow::OnAddrBoxChange(wxCommandEvent& event) +{ + wxString txt = addrbox->GetValue(); + if (txt.size()) + { + u32 addr; + sscanf(WxStrToStr(txt).c_str(), "%08x", &addr); + memview->Center(addr & ~3); + } + + event.Skip(1); +} + +void CMemoryWindow::Update() +{ + memview->Refresh(); + memview->Center(PC); +} + +void CMemoryWindow::NotifyMapLoaded() +{ + symbols->Show(false); // hide it for faster filling + symbols->Clear(); +#if 0 + #ifdef _WIN32 + const FunctionDB::XFuncMap &syms = g_symbolDB.Symbols(); + for (FuntionDB::XFuncMap::iterator iter = syms.begin(); iter != syms.end(); ++iter) + { + int idx = symbols->Append(iter->second.name.c_str()); + symbols->SetClientData(idx, (void*)&iter->second); + } + #endif +#endif + symbols->Show(true); + Update(); +} + +void CMemoryWindow::OnSymbolListChange(wxCommandEvent& event) +{ + int index = symbols->GetSelection(); + if (index >= 0) + { + Symbol* pSymbol = static_cast(symbols->GetClientData(index)); + if (pSymbol != NULL) + { + memview->Center(pSymbol->address); + } + } +} + +void CMemoryWindow::OnHostMessage(wxCommandEvent& event) +{ + switch (event.GetId()) + { + case IDM_NOTIFYMAPLOADED: + NotifyMapLoaded(); + break; + } +} + +void DumpArray(const std::string& filename, const u8* data, size_t length) +{ + if (data) + { + File::IOFile f(filename, "wb"); + f.WriteBytes(data, length); + } +} + +// Write mram to file +void CMemoryWindow::OnDumpMemory( wxCommandEvent& event ) +{ + DumpArray(File::GetUserPath(F_RAMDUMP_IDX), Memory::m_pRAM, Memory::REALRAM_SIZE); +} + +// Write exram (aram or mem2) to file +void CMemoryWindow::OnDumpMem2( wxCommandEvent& event ) +{ + if (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii) + { + DumpArray(File::GetUserPath(F_ARAMDUMP_IDX), Memory::m_pEXRAM, Memory::EXRAM_SIZE); + } + else + { + DumpArray(File::GetUserPath(F_ARAMDUMP_IDX), DSP::GetARAMPtr(), DSP::ARAM_SIZE); + } +} + +// Write fake vmem to file +void CMemoryWindow::OnDumpFakeVMEM( wxCommandEvent& event ) +{ + DumpArray(File::GetUserPath(F_FAKEVMEMDUMP_IDX), Memory::m_pVirtualFakeVMEM, Memory::FAKEVMEM_SIZE); +} + +void CMemoryWindow::U8(wxCommandEvent& event) +{ + chk16->SetValue(0); + chk32->SetValue(0); + memview->dataType = 0; + memview->Refresh(); +} + +void CMemoryWindow::U16(wxCommandEvent& event) +{ + chk8->SetValue(0); + chk32->SetValue(0); + memview->dataType = 1; + memview->Refresh(); +} + +void CMemoryWindow::U32(wxCommandEvent& event) +{ + chk16->SetValue(0); + chk8->SetValue(0); + memview->dataType = 2; + memview->Refresh(); +} + +void CMemoryWindow::onSearch(wxCommandEvent& event) +{ + u8* TheRAM = 0; + u32 szRAM = 0; + switch (memview->GetMemoryType()) + { + case 0: + default: + if (Memory::m_pRAM) + { + TheRAM = Memory::m_pRAM; + szRAM = Memory::REALRAM_SIZE; + } + break; + case 1: + { + u8* aram = DSP::GetARAMPtr(); + if (aram) + { + TheRAM = aram; + szRAM = DSP::ARAM_SIZE; + } + } + break; + } + //Now we have memory to look in + //Are we looking for ASCII string, or hex? + //memview->cu + wxString rawData = valbox->GetValue(); + std::vector Dest; //May need a better name + u32 size = 0; + int pad = rawData.size()%2; //If it's uneven + unsigned int i = 0; + long count = 0; + char copy[3] = {0}; + long newsize = 0; + unsigned char *tmp2 = 0; + char* tmpstr = 0; + + if (chkHex->GetValue()) + { + //We are looking for hex + //If it's uneven + size = (rawData.size()/2) + pad; + Dest.resize(size+32); + newsize = rawData.size(); + + if (pad) + { + tmpstr = new char[newsize + 2]; + memset(tmpstr, 0, newsize + 2); + tmpstr[0] = '0'; + } + else + { + tmpstr = new char[newsize + 1]; + memset(tmpstr, 0, newsize + 1); + } + sprintf(tmpstr, "%s%s", tmpstr, WxStrToStr(rawData).c_str()); + tmp2 = &Dest.front(); + count = 0; + for(i = 0; i < strlen(tmpstr); i++) + { + copy[0] = tmpstr[i]; + copy[1] = tmpstr[i+1]; + copy[2] = 0; + int tmpint; + sscanf(copy, "%02x", &tmpint); + tmp2[count++] = tmpint; + // Dest[count] should now be the hex of what the two chars were! + // Also should add a check to make sure it's A-F only + //sscanf(copy, "%02x", &tmp2[count++]); + i += 1; + } + delete[] tmpstr; + } + else + { + //Looking for an ascii string + size = rawData.size(); + Dest.resize(size+1); + tmpstr = new char[size+1]; + + tmp2 = &Dest.front(); + sprintf(tmpstr, "%s", WxStrToStr(rawData).c_str()); + + for(i = 0; i < size; i++) + tmp2[i] = tmpstr[i]; + + delete[] tmpstr; + } + + if(size) + { + unsigned char* pnt = &Dest.front(); + unsigned int k = 0; + //grab + wxString txt = addrbox->GetValue(); + u32 addr = 0; + if (txt.size()) + { + sscanf(WxStrToStr(txt).c_str(), "%08x", &addr); + } + i = addr+4; + for( ; i < szRAM; i++) + { + for(k = 0; k < size; k++) + { + if(i + k > szRAM) break; + if(k > size) break; + if(pnt[k] != TheRAM[i+k]) + { + k = 0; + break; + } + } + if(k == size) + { + //Match was found + wxMessageBox(_("A match was found. Placing viewer at the offset.")); + wxChar tmpwxstr[128] = {0}; + wxSprintf(tmpwxstr, _T("%08x"), i); + wxString tmpwx(tmpwxstr); + addrbox->SetValue(tmpwx); + //memview->curAddress = i; + //memview->Refresh(); + OnAddrBoxChange(event); + return; + } + } + wxMessageBox(_("No match was found.")); + } +} + +void CMemoryWindow::onAscii(wxCommandEvent& event) +{ + chkHex->SetValue(0); +} + +void CMemoryWindow::onHex(wxCommandEvent& event) +{ + chkAscii->SetValue(0); +} -- cgit v1.2.3 From 404624bf0b0125e5a408021c616ee9b9e2dde382 Mon Sep 17 00:00:00 2001 From: Tillmann Karras Date: Wed, 12 Feb 2014 16:00:34 +0100 Subject: Turn loops into range-based form and some things suggested by cppcheck and compiler warnings. --- Source/Core/DolphinWX/Debugger/MemoryWindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/DolphinWX/Debugger/MemoryWindow.cpp') diff --git a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp index bff24623e1..e49512afea 100644 --- a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp +++ b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp @@ -337,7 +337,7 @@ void CMemoryWindow::onSearch(wxCommandEvent& event) tmpstr = new char[newsize + 1]; memset(tmpstr, 0, newsize + 1); } - sprintf(tmpstr, "%s%s", tmpstr, WxStrToStr(rawData).c_str()); + strcat(tmpstr, WxStrToStr(rawData).c_str()); tmp2 = &Dest.front(); count = 0; for(i = 0; i < strlen(tmpstr); i++) -- cgit v1.2.3 From 3fd87a7636ff434118a5d7f7334550be8db55c0b Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 16 Feb 2014 23:51:41 -0500 Subject: Second and final pass of clearing out tabs. --- Source/Core/DolphinWX/Debugger/MemoryWindow.cpp | 28 ++++++++++++------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'Source/Core/DolphinWX/Debugger/MemoryWindow.cpp') diff --git a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp index e49512afea..6c351b77a5 100644 --- a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp +++ b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp @@ -44,19 +44,19 @@ enum }; BEGIN_EVENT_TABLE(CMemoryWindow, wxPanel) - EVT_TEXT(IDM_MEM_ADDRBOX, CMemoryWindow::OnAddrBoxChange) - EVT_LISTBOX(IDM_SYMBOLLIST, CMemoryWindow::OnSymbolListChange) - EVT_HOST_COMMAND(wxID_ANY, CMemoryWindow::OnHostMessage) - EVT_BUTTON(IDM_SETVALBUTTON, CMemoryWindow::SetMemoryValue) - EVT_BUTTON(IDM_DUMP_MEMORY, CMemoryWindow::OnDumpMemory) - EVT_BUTTON(IDM_DUMP_MEM2, CMemoryWindow::OnDumpMem2) - EVT_BUTTON(IDM_DUMP_FAKEVMEM, CMemoryWindow::OnDumpFakeVMEM) - EVT_CHECKBOX(IDM_U8, CMemoryWindow::U8) - EVT_CHECKBOX(IDM_U16, CMemoryWindow::U16) - EVT_CHECKBOX(IDM_U32, CMemoryWindow::U32) - EVT_BUTTON(IDM_SEARCH, CMemoryWindow::onSearch) - EVT_CHECKBOX(IDM_ASCII, CMemoryWindow::onAscii) - EVT_CHECKBOX(IDM_HEX, CMemoryWindow::onHex) + EVT_TEXT(IDM_MEM_ADDRBOX, CMemoryWindow::OnAddrBoxChange) + EVT_LISTBOX(IDM_SYMBOLLIST, CMemoryWindow::OnSymbolListChange) + EVT_HOST_COMMAND(wxID_ANY, CMemoryWindow::OnHostMessage) + EVT_BUTTON(IDM_SETVALBUTTON, CMemoryWindow::SetMemoryValue) + EVT_BUTTON(IDM_DUMP_MEMORY, CMemoryWindow::OnDumpMemory) + EVT_BUTTON(IDM_DUMP_MEM2, CMemoryWindow::OnDumpMem2) + EVT_BUTTON(IDM_DUMP_FAKEVMEM, CMemoryWindow::OnDumpFakeVMEM) + EVT_CHECKBOX(IDM_U8, CMemoryWindow::U8) + EVT_CHECKBOX(IDM_U16, CMemoryWindow::U16) + EVT_CHECKBOX(IDM_U32, CMemoryWindow::U32) + EVT_BUTTON(IDM_SEARCH, CMemoryWindow::onSearch) + EVT_CHECKBOX(IDM_ASCII, CMemoryWindow::onAscii) + EVT_CHECKBOX(IDM_HEX, CMemoryWindow::onHex) END_EVENT_TABLE() CMemoryWindow::CMemoryWindow(wxWindow* parent, wxWindowID id, @@ -71,7 +71,7 @@ CMemoryWindow::CMemoryWindow(wxWindow* parent, wxWindowID id, DebugInterface* di = &PowerPC::debug_interface; //symbols = new wxListBox(this, IDM_SYMBOLLIST, wxDefaultPosition, - // wxSize(20, 100), 0, NULL, wxLB_SORT); + // wxSize(20, 100), 0, NULL, wxLB_SORT); //sizerLeft->Add(symbols, 1, wxEXPAND); memview = new CMemoryView(di, this); memview->dataType = 0; -- cgit v1.2.3 From 2afe2152712981e21d6bda6f029292ed2b1cf91e Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 17 Feb 2014 05:18:15 -0500 Subject: Convert all includes to relative paths. --- Source/Core/DolphinWX/Debugger/MemoryWindow.cpp | 31 +++++++++++-------------- 1 file changed, 14 insertions(+), 17 deletions(-) (limited to 'Source/Core/DolphinWX/Debugger/MemoryWindow.cpp') diff --git a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp index 6c351b77a5..ac66e0d62a 100644 --- a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp +++ b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp @@ -8,23 +8,20 @@ #include #include -#include "../WxUtils.h" -#include "MemoryWindow.h" -#include "HW/CPU.h" -#include "PowerPC/PowerPC.h" -#include "FileUtil.h" - -#include "Debugger/PPCDebugInterface.h" -#include "PowerPC/PPCSymbolDB.h" - -#include "Core.h" -#include "ConfigManager.h" -#include "LogManager.h" - -#include "HW/Memmap.h" -#include "HW/DSP.h" - -#include "../../DolphinWX/Globals.h" +#include "Common/FileUtil.h" +#include "Common/LogManager.h" +#include "Core/Core.h" +#include "Core/ConfigManager.h" +#include "Core/Debugger/PPCDebugInterface.h" +#include "Core/HW/CPU.h" +#include "Core/HW/DSP.h" +#include "Core/HW/Memmap.h" +#include "Core/PowerPC/PowerPC.h" +#include "Core/PowerPC/PPCSymbolDB.h" + +#include "DolphinWX/Globals.h" +#include "DolphinWX/WxUtils.h" +#include "DolphinWX/Debugger/MemoryWindow.h" enum { -- cgit v1.2.3 From 592ebc5262f13bc587896e678d389fe831df9af7 Mon Sep 17 00:00:00 2001 From: Pierre Bourdon Date: Wed, 19 Feb 2014 02:56:29 +0100 Subject: Fix more header sorting issues in DolphinWX/ (now check-includes clean). --- Source/Core/DolphinWX/Debugger/MemoryWindow.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'Source/Core/DolphinWX/Debugger/MemoryWindow.cpp') diff --git a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp index ac66e0d62a..516ab41788 100644 --- a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp +++ b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp @@ -3,22 +3,20 @@ // Refer to the license.txt file included. #include -#include #include +#include #include -#include #include "Common/FileUtil.h" #include "Common/LogManager.h" -#include "Core/Core.h" #include "Core/ConfigManager.h" +#include "Core/Core.h" #include "Core/Debugger/PPCDebugInterface.h" #include "Core/HW/CPU.h" #include "Core/HW/DSP.h" #include "Core/HW/Memmap.h" #include "Core/PowerPC/PowerPC.h" #include "Core/PowerPC/PPCSymbolDB.h" - #include "DolphinWX/Globals.h" #include "DolphinWX/WxUtils.h" #include "DolphinWX/Debugger/MemoryWindow.h" -- cgit v1.2.3 From f344a43657f609343fec125f374e014692e4ca6a Mon Sep 17 00:00:00 2001 From: Pierre Bourdon Date: Sat, 22 Feb 2014 23:36:30 +0100 Subject: Make DolphinWX/ mostly IWYU clean. --- Source/Core/DolphinWX/Debugger/MemoryWindow.cpp | 33 ++++++++++++++++++++----- 1 file changed, 27 insertions(+), 6 deletions(-) (limited to 'Source/Core/DolphinWX/Debugger/MemoryWindow.cpp') diff --git a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp index 516ab41788..b52305fe1a 100644 --- a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp +++ b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp @@ -2,25 +2,46 @@ // Licensed under GPLv2 // Refer to the license.txt file included. +#include +#include +#include +#include +#include #include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include -#include +#include +#include +#include +#include +#include "Common/Common.h" #include "Common/FileUtil.h" -#include "Common/LogManager.h" +#include "Common/IniFile.h" +#include "Common/StringUtil.h" +#include "Common/SymbolDB.h" #include "Core/ConfigManager.h" -#include "Core/Core.h" +#include "Core/CoreParameter.h" #include "Core/Debugger/PPCDebugInterface.h" -#include "Core/HW/CPU.h" #include "Core/HW/DSP.h" #include "Core/HW/Memmap.h" #include "Core/PowerPC/PowerPC.h" -#include "Core/PowerPC/PPCSymbolDB.h" #include "DolphinWX/Globals.h" #include "DolphinWX/WxUtils.h" +#include "DolphinWX/Debugger/MemoryView.h" #include "DolphinWX/Debugger/MemoryWindow.h" +class DebugInterface; + enum { IDM_MEM_ADDRBOX = 350, -- cgit v1.2.3 From d802d392811be44d34ae9cd23f616db93e54c50f Mon Sep 17 00:00:00 2001 From: Tillmann Karras Date: Sun, 9 Mar 2014 21:14:26 +0100 Subject: clang-modernize -use-nullptr and s/\bNULL\b/nullptr/g for *.cpp/h/mm files not compiled on my machine --- Source/Core/DolphinWX/Debugger/MemoryWindow.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'Source/Core/DolphinWX/Debugger/MemoryWindow.cpp') diff --git a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp index b52305fe1a..5aedae6e68 100644 --- a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp +++ b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp @@ -87,7 +87,7 @@ CMemoryWindow::CMemoryWindow(wxWindow* parent, wxWindowID id, DebugInterface* di = &PowerPC::debug_interface; //symbols = new wxListBox(this, IDM_SYMBOLLIST, wxDefaultPosition, - // wxSize(20, 100), 0, NULL, wxLB_SORT); + // wxSize(20, 100), 0, nullptr, wxLB_SORT); //sizerLeft->Add(symbols, 1, wxEXPAND); memview = new CMemoryView(di, this); memview->dataType = 0; @@ -220,7 +220,7 @@ void CMemoryWindow::OnSymbolListChange(wxCommandEvent& event) if (index >= 0) { Symbol* pSymbol = static_cast(symbols->GetClientData(index)); - if (pSymbol != NULL) + if (pSymbol != nullptr) { memview->Center(pSymbol->address); } @@ -297,7 +297,7 @@ void CMemoryWindow::U32(wxCommandEvent& event) void CMemoryWindow::onSearch(wxCommandEvent& event) { - u8* TheRAM = 0; + u8* TheRAM = nullptr; u32 szRAM = 0; switch (memview->GetMemoryType()) { @@ -331,8 +331,8 @@ void CMemoryWindow::onSearch(wxCommandEvent& event) long count = 0; char copy[3] = {0}; long newsize = 0; - unsigned char *tmp2 = 0; - char* tmpstr = 0; + unsigned char *tmp2 = nullptr; + char* tmpstr = nullptr; if (chkHex->GetValue()) { -- cgit v1.2.3 From 31cfc73a09a8685cbab20502b4bc132e98e2feb5 Mon Sep 17 00:00:00 2001 From: Matthew Parlane Date: Tue, 11 Mar 2014 00:30:55 +1300 Subject: Fixes spacing for "for", "while", "switch" and "if" Also moved && and || to ends of lines instead of start. Fixed misc vertical alignments and some { needed newlining. --- Source/Core/DolphinWX/Debugger/MemoryWindow.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'Source/Core/DolphinWX/Debugger/MemoryWindow.cpp') diff --git a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp index 5aedae6e68..217d94ab6c 100644 --- a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp +++ b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp @@ -130,7 +130,7 @@ CMemoryWindow::CMemoryWindow(wxWindow* parent, wxWindowID id, void CMemoryWindow::Save(IniFile& _IniFile) const { // Prevent these bad values that can happen after a crash or hanging - if(GetPosition().x != -32000 && GetPosition().y != -32000) + if (GetPosition().x != -32000 && GetPosition().y != -32000) { _IniFile.Set("MemoryWindow", "x", GetPosition().x); _IniFile.Set("MemoryWindow", "y", GetPosition().y); @@ -356,7 +356,7 @@ void CMemoryWindow::onSearch(wxCommandEvent& event) strcat(tmpstr, WxStrToStr(rawData).c_str()); tmp2 = &Dest.front(); count = 0; - for(i = 0; i < strlen(tmpstr); i++) + for (i = 0; i < strlen(tmpstr); i++) { copy[0] = tmpstr[i]; copy[1] = tmpstr[i+1]; @@ -381,13 +381,13 @@ void CMemoryWindow::onSearch(wxCommandEvent& event) tmp2 = &Dest.front(); sprintf(tmpstr, "%s", WxStrToStr(rawData).c_str()); - for(i = 0; i < size; i++) + for (i = 0; i < size; i++) tmp2[i] = tmpstr[i]; delete[] tmpstr; } - if(size) + if (size) { unsigned char* pnt = &Dest.front(); unsigned int k = 0; @@ -399,19 +399,19 @@ void CMemoryWindow::onSearch(wxCommandEvent& event) sscanf(WxStrToStr(txt).c_str(), "%08x", &addr); } i = addr+4; - for( ; i < szRAM; i++) + for ( ; i < szRAM; ++i) { - for(k = 0; k < size; k++) + for (k = 0; k < size; ++k) { - if(i + k > szRAM) break; - if(k > size) break; - if(pnt[k] != TheRAM[i+k]) + if (i + k > szRAM) break; + if (k > size) break; + if (pnt[k] != TheRAM[i+k]) { k = 0; break; } } - if(k == size) + if (k == size) { //Match was found wxMessageBox(_("A match was found. Placing viewer at the offset.")); -- cgit v1.2.3 From e1359382be30bb8f61a779846c9ebc1fa72791d0 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 17 May 2014 13:17:28 -0400 Subject: Kill off _T and wxT macros Minor other alterations that relate to above as well. Also added the PanicAlertT version of alerts for some error messages that use PanicAlert. We want the user to actually understand why the error occurred. --- Source/Core/DolphinWX/Debugger/MemoryWindow.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'Source/Core/DolphinWX/Debugger/MemoryWindow.cpp') diff --git a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp index 217d94ab6c..ed2fe66b45 100644 --- a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp +++ b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp @@ -94,8 +94,8 @@ CMemoryWindow::CMemoryWindow(wxWindow* parent, wxWindowID id, //sizerBig->Add(sizerLeft, 1, wxEXPAND); sizerBig->Add(memview, 20, wxEXPAND); sizerBig->Add(sizerRight, 0, wxEXPAND | wxALL, 3); - sizerRight->Add(addrbox = new wxTextCtrl(this, IDM_MEM_ADDRBOX, _T(""))); - sizerRight->Add(valbox = new wxTextCtrl(this, IDM_VALBOX, _T(""))); + sizerRight->Add(addrbox = new wxTextCtrl(this, IDM_MEM_ADDRBOX, "")); + sizerRight->Add(valbox = new wxTextCtrl(this, IDM_VALBOX, "")); sizerRight->Add(new wxButton(this, IDM_SETVALBUTTON, _("Set &Value"))); sizerRight->AddSpacer(5); @@ -108,15 +108,15 @@ CMemoryWindow::CMemoryWindow(wxWindow* parent, wxWindowID id, wxStaticBoxSizer* sizerSearchType = new wxStaticBoxSizer(wxVERTICAL, this, _("Search")); sizerSearchType->Add(btnSearch = new wxButton(this, IDM_SEARCH, _("Search"))); - sizerSearchType->Add(chkAscii = new wxCheckBox(this, IDM_ASCII, _T("&Ascii "))); + sizerSearchType->Add(chkAscii = new wxCheckBox(this, IDM_ASCII, "&Ascii ")); sizerSearchType->Add(chkHex = new wxCheckBox(this, IDM_HEX, _("&Hex"))); sizerRight->Add(sizerSearchType); wxStaticBoxSizer* sizerDataTypes = new wxStaticBoxSizer(wxVERTICAL, this, _("Data Type")); sizerDataTypes->SetMinSize(74, 40); - sizerDataTypes->Add(chk8 = new wxCheckBox(this, IDM_U8, _T("&U8"))); - sizerDataTypes->Add(chk16 = new wxCheckBox(this, IDM_U16, _T("&U16"))); - sizerDataTypes->Add(chk32 = new wxCheckBox(this, IDM_U32, _T("&U32"))); + sizerDataTypes->Add(chk8 = new wxCheckBox(this, IDM_U8, "&U8")); + sizerDataTypes->Add(chk16 = new wxCheckBox(this, IDM_U16, "&U16")); + sizerDataTypes->Add(chk32 = new wxCheckBox(this, IDM_U32, "&U32")); sizerRight->Add(sizerDataTypes); SetSizer(sizerBig); chkHex->SetValue(1); //Set defaults @@ -163,13 +163,13 @@ void CMemoryWindow::SetMemoryValue(wxCommandEvent& event) if (!TryParse(std::string("0x") + str_addr, &addr)) { - PanicAlert("Invalid Address: %s", str_addr.c_str()); + PanicAlertT("Invalid Address: %s", str_addr.c_str()); return; } if (!TryParse(std::string("0x") + str_val, &val)) { - PanicAlert("Invalid Value: %s", str_val.c_str()); + PanicAlertT("Invalid Value: %s", str_val.c_str()); return; } @@ -416,7 +416,7 @@ void CMemoryWindow::onSearch(wxCommandEvent& event) //Match was found wxMessageBox(_("A match was found. Placing viewer at the offset.")); wxChar tmpwxstr[128] = {0}; - wxSprintf(tmpwxstr, _T("%08x"), i); + wxSprintf(tmpwxstr, "%08x", i); wxString tmpwx(tmpwxstr); addrbox->SetValue(tmpwx); //memview->curAddress = i; -- cgit v1.2.3 From f05d3f6e5d6da8be530c0cd4ffaaec0382240ec5 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 16 Jun 2014 01:12:43 -0400 Subject: Use only section-based ini reading. --- Source/Core/DolphinWX/Debugger/MemoryWindow.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'Source/Core/DolphinWX/Debugger/MemoryWindow.cpp') diff --git a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp index ed2fe66b45..53184d7116 100644 --- a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp +++ b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp @@ -127,25 +127,29 @@ CMemoryWindow::CMemoryWindow(wxWindow* parent, wxWindowID id, sizerBig->Fit(this); } -void CMemoryWindow::Save(IniFile& _IniFile) const +void CMemoryWindow::Save(IniFile& ini) const { // Prevent these bad values that can happen after a crash or hanging if (GetPosition().x != -32000 && GetPosition().y != -32000) { - _IniFile.Set("MemoryWindow", "x", GetPosition().x); - _IniFile.Set("MemoryWindow", "y", GetPosition().y); - _IniFile.Set("MemoryWindow", "w", GetSize().GetWidth()); - _IniFile.Set("MemoryWindow", "h", GetSize().GetHeight()); + IniFile::Section* mem_window = ini.GetOrCreateSection("MemoryWindow"); + mem_window->Set("x", GetPosition().x); + mem_window->Set("y", GetPosition().y); + mem_window->Set("w", GetSize().GetWidth()); + mem_window->Set("h", GetSize().GetHeight()); } } -void CMemoryWindow::Load(IniFile& _IniFile) +void CMemoryWindow::Load(IniFile& ini) { int x, y, w, h; - _IniFile.Get("MemoryWindow", "x", &x, GetPosition().x); - _IniFile.Get("MemoryWindow", "y", &y, GetPosition().y); - _IniFile.Get("MemoryWindow", "w", &w, GetSize().GetWidth()); - _IniFile.Get("MemoryWindow", "h", &h, GetSize().GetHeight()); + + IniFile::Section* mem_window = ini.GetOrCreateSection("MemoryWindow"); + mem_window->Get("x", &x, GetPosition().x); + mem_window->Get("y", &y, GetPosition().y); + mem_window->Get("w", &w, GetSize().GetWidth()); + mem_window->Get("h", &h, GetSize().GetHeight()); + SetSize(x, y, w, h); } -- cgit v1.2.3 From 6f9483d161e19c8d655b2271c27a4d3f6eecd543 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 10 Jul 2014 20:39:26 -0400 Subject: DolphinWX: Remove unnecessary true within event Skip calls --- Source/Core/DolphinWX/Debugger/MemoryWindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/DolphinWX/Debugger/MemoryWindow.cpp') diff --git a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp index 53184d7116..aa26ecc926 100644 --- a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp +++ b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp @@ -191,7 +191,7 @@ void CMemoryWindow::OnAddrBoxChange(wxCommandEvent& event) memview->Center(addr & ~3); } - event.Skip(1); + event.Skip(); } void CMemoryWindow::Update() -- cgit v1.2.3 From 22e1aa5bb4a159d6d66a321f978917614aa36331 Mon Sep 17 00:00:00 2001 From: degasus Date: Tue, 8 Jul 2014 14:29:26 +0200 Subject: mark all local functions as static --- Source/Core/DolphinWX/Debugger/MemoryWindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/DolphinWX/Debugger/MemoryWindow.cpp') diff --git a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp index aa26ecc926..8621cb6f5b 100644 --- a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp +++ b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp @@ -241,7 +241,7 @@ void CMemoryWindow::OnHostMessage(wxCommandEvent& event) } } -void DumpArray(const std::string& filename, const u8* data, size_t length) +static void DumpArray(const std::string& filename, const u8* data, size_t length) { if (data) { -- cgit v1.2.3 From 298425920a0e4ac3aa7da635336b8be39eb08788 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 19 Jul 2014 19:59:44 -0400 Subject: DolphinWX: Fix a possible crash when setting debugger memory values. --- Source/Core/DolphinWX/Debugger/MemoryWindow.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'Source/Core/DolphinWX/Debugger/MemoryWindow.cpp') diff --git a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp index 8621cb6f5b..0640142422 100644 --- a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp +++ b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp @@ -160,6 +160,12 @@ void CMemoryWindow::JumpToAddress(u32 _Address) void CMemoryWindow::SetMemoryValue(wxCommandEvent& event) { + if (!Memory::IsInitialized()) + { + PanicAlertT("Cannot set uninitialized memory."); + return; + } + std::string str_addr = WxStrToStr(addrbox->GetValue()); std::string str_val = WxStrToStr(valbox->GetValue()); u32 addr; -- cgit v1.2.3 From 0ed29e1fac94db18451a233e252976b4201bae24 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 24 Jul 2014 21:46:46 -0400 Subject: DolphinWX: Use a regular wxMessageBox instead of a PanicAlert for non-panic errors. --- Source/Core/DolphinWX/Debugger/MemoryWindow.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Source/Core/DolphinWX/Debugger/MemoryWindow.cpp') diff --git a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp index 0640142422..fd3b036a94 100644 --- a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp +++ b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp @@ -162,7 +162,7 @@ void CMemoryWindow::SetMemoryValue(wxCommandEvent& event) { if (!Memory::IsInitialized()) { - PanicAlertT("Cannot set uninitialized memory."); + WxUtils::ShowErrorDialog(_("Cannot set uninitialized memory.")); return; } @@ -173,13 +173,13 @@ void CMemoryWindow::SetMemoryValue(wxCommandEvent& event) if (!TryParse(std::string("0x") + str_addr, &addr)) { - PanicAlertT("Invalid Address: %s", str_addr.c_str()); + WxUtils::ShowErrorDialog(wxString::Format(_("Invalid address: %s"), str_addr.c_str())); return; } if (!TryParse(std::string("0x") + str_val, &val)) { - PanicAlertT("Invalid Value: %s", str_val.c_str()); + WxUtils::ShowErrorDialog(wxString::Format(_("Invalid value: %s"), str_val.c_str())); return; } -- cgit v1.2.3 From fbc64984ca7de7db10b1a8a4f49002f260c93569 Mon Sep 17 00:00:00 2001 From: Rohit Nirmal Date: Sun, 7 Sep 2014 20:06:58 -0500 Subject: Include CommonTypes.h instead of Common.h. --- Source/Core/DolphinWX/Debugger/MemoryWindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/DolphinWX/Debugger/MemoryWindow.cpp') diff --git a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp index fd3b036a94..10ff30f1c8 100644 --- a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp +++ b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp @@ -24,7 +24,7 @@ #include #include -#include "Common/Common.h" +#include "Common/CommonTypes.h" #include "Common/FileUtil.h" #include "Common/IniFile.h" #include "Common/StringUtil.h" -- cgit v1.2.3 From 95660a55639fd55406f9d1a56bcc098b25c2aefc Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 21 Sep 2014 13:59:20 -0400 Subject: DolphinWX: Fix case where the debugger would crash on hiding a pane. These ID values would clash with the window parent IDs of all the actual debugger panes (they are in the 350 range as well). For example, attempting to show and then close the memory window would cause an assertion, because it would attempt to destroy the text control for searching through memory, rather than destroying the actual parent window it's attached to. These IDs are only used locally, so their value doesn't matter. --- Source/Core/DolphinWX/Debugger/MemoryWindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/DolphinWX/Debugger/MemoryWindow.cpp') diff --git a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp index 10ff30f1c8..73dead18d1 100644 --- a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp +++ b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp @@ -44,7 +44,7 @@ class DebugInterface; enum { - IDM_MEM_ADDRBOX = 350, + IDM_MEM_ADDRBOX, IDM_SYMBOLLIST, IDM_SETVALBUTTON, IDM_DUMP_MEMORY, -- cgit v1.2.3 From 8738b1879c993658181d90bbf2dc2f4622e304bf Mon Sep 17 00:00:00 2001 From: skidau Date: Sat, 11 Oct 2014 11:31:16 +1100 Subject: Removed the MMU Speed Hack option. The TLBHack is now enabled if the MMU option is disabled. This will help catch cases where a game requires the TLBHack but the option has not been set in the game ini. It also removes the possibility to mistakenly enable both the MMU and TLBHack. --- Source/Core/DolphinWX/Debugger/MemoryWindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/DolphinWX/Debugger/MemoryWindow.cpp') diff --git a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp index 73dead18d1..60978b6693 100644 --- a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp +++ b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp @@ -102,7 +102,7 @@ CMemoryWindow::CMemoryWindow(wxWindow* parent, wxWindowID id, sizerRight->Add(new wxButton(this, IDM_DUMP_MEMORY, _("&Dump MRAM"))); sizerRight->Add(new wxButton(this, IDM_DUMP_MEM2, _("&Dump EXRAM"))); - if (SConfig::GetInstance().m_LocalCoreStartupParameter.bTLBHack == true) + if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bMMU) sizerRight->Add(new wxButton(this, IDM_DUMP_FAKEVMEM, _("&Dump FakeVMEM"))); wxStaticBoxSizer* sizerSearchType = new wxStaticBoxSizer(wxVERTICAL, this, _("Search")); -- cgit v1.2.3 From dd0aadac9751f93fadbe4d2d3446eb621369a7c5 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Tue, 28 Oct 2014 03:57:28 -0700 Subject: MemoryWindow: Use p_pFakeVMEM, not the virtual mirror They point to the same contents, so there's no reason to use the mirror. This lets us make all the mirrors static. --- Source/Core/DolphinWX/Debugger/MemoryWindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/DolphinWX/Debugger/MemoryWindow.cpp') diff --git a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp index 60978b6693..c620d327c6 100644 --- a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp +++ b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp @@ -278,7 +278,7 @@ void CMemoryWindow::OnDumpMem2( wxCommandEvent& event ) // Write fake vmem to file void CMemoryWindow::OnDumpFakeVMEM( wxCommandEvent& event ) { - DumpArray(File::GetUserPath(F_FAKEVMEMDUMP_IDX), Memory::m_pVirtualFakeVMEM, Memory::FAKEVMEM_SIZE); + DumpArray(File::GetUserPath(F_FAKEVMEMDUMP_IDX), Memory::m_pFakeVMEM, Memory::FAKEVMEM_SIZE); } void CMemoryWindow::U8(wxCommandEvent& event) -- cgit v1.2.3 From 210567a9194af6f218bedd46290975a2ad3df2f9 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 7 Nov 2014 22:16:13 -0500 Subject: DolphinWX: Remove unnecessary forward declarations --- Source/Core/DolphinWX/Debugger/MemoryWindow.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'Source/Core/DolphinWX/Debugger/MemoryWindow.cpp') diff --git a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp index c620d327c6..0d9a474ed0 100644 --- a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp +++ b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp @@ -40,8 +40,6 @@ #include "DolphinWX/Debugger/MemoryView.h" #include "DolphinWX/Debugger/MemoryWindow.h" -class DebugInterface; - enum { IDM_MEM_ADDRBOX, -- cgit v1.2.3 From 20fc2d567465fbbdce68d6e6b34727088b2703f7 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 12 Dec 2014 10:29:07 -0500 Subject: MemoryWindow: Remove wxSprintf call, use wxString::Format instead. --- Source/Core/DolphinWX/Debugger/MemoryWindow.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'Source/Core/DolphinWX/Debugger/MemoryWindow.cpp') diff --git a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp index 0d9a474ed0..f4b127c67b 100644 --- a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp +++ b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp @@ -423,10 +423,7 @@ void CMemoryWindow::onSearch(wxCommandEvent& event) { //Match was found wxMessageBox(_("A match was found. Placing viewer at the offset.")); - wxChar tmpwxstr[128] = {0}; - wxSprintf(tmpwxstr, "%08x", i); - wxString tmpwx(tmpwxstr); - addrbox->SetValue(tmpwx); + addrbox->SetValue(wxString::Format("%08x", i)); //memview->curAddress = i; //memview->Refresh(); OnAddrBoxChange(event); -- cgit v1.2.3 From 6ad5e54970b7889b15991c15f6363fd965a3c826 Mon Sep 17 00:00:00 2001 From: Stevoisiak Date: Sat, 20 Dec 2014 20:36:26 -0500 Subject: DolphinWX/Globals: Variable naming consistency --- Source/Core/DolphinWX/Debugger/MemoryWindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/DolphinWX/Debugger/MemoryWindow.cpp') diff --git a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp index f4b127c67b..1e129d5770 100644 --- a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp +++ b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp @@ -239,7 +239,7 @@ void CMemoryWindow::OnHostMessage(wxCommandEvent& event) { switch (event.GetId()) { - case IDM_NOTIFYMAPLOADED: + case IDM_NOTIFY_MAP_LOADED: NotifyMapLoaded(); break; } -- cgit v1.2.3 From ac54c6a4e2f6790f628f8a8112ff1940732f5068 Mon Sep 17 00:00:00 2001 From: magumagu Date: Sat, 17 Jan 2015 13:17:36 -0800 Subject: Make address translation respect the CPU translation mode. The PowerPC CPU has bits in MSR (DR and IR) which control whether addresses are translated. We should respect these instead of mixing physical addresses and translated addresses into the same address space. This is mostly mass-renaming calls to memory accesses APIs from places which expect address translation to use a different version from those which do not expect address translation. This does very little on its own, but it's the first step to a correct BAT implementation. --- Source/Core/DolphinWX/Debugger/MemoryWindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/DolphinWX/Debugger/MemoryWindow.cpp') diff --git a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp index 1e129d5770..ec6ff6c295 100644 --- a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp +++ b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp @@ -181,7 +181,7 @@ void CMemoryWindow::SetMemoryValue(wxCommandEvent& event) return; } - Memory::Write_U32(val, addr); + PowerPC::HostWrite_U32(val, addr); memview->Refresh(); } -- cgit v1.2.3 From 0c18e5886de0c04cdba38b7304b622943194c06a Mon Sep 17 00:00:00 2001 From: comex Date: Wed, 22 Apr 2015 23:40:00 -0400 Subject: Remove mnemonics in MemoryWindow. On OS X, this broke Cmd-V to paste in the text boxes. Apparently wx thinks having mnemonics (which are Alt-* on Windows) be Cmd-* on OS X, even if this disables standard shortcuts, is a good idea. Lioncash suggested just getting rid of the accelerators on non-menu controls, so I'm doing that rather than disabling them only on OS X. --- Source/Core/DolphinWX/Debugger/MemoryWindow.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'Source/Core/DolphinWX/Debugger/MemoryWindow.cpp') diff --git a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp index ec6ff6c295..7c122b0bdc 100644 --- a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp +++ b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp @@ -94,27 +94,27 @@ CMemoryWindow::CMemoryWindow(wxWindow* parent, wxWindowID id, sizerBig->Add(sizerRight, 0, wxEXPAND | wxALL, 3); sizerRight->Add(addrbox = new wxTextCtrl(this, IDM_MEM_ADDRBOX, "")); sizerRight->Add(valbox = new wxTextCtrl(this, IDM_VALBOX, "")); - sizerRight->Add(new wxButton(this, IDM_SETVALBUTTON, _("Set &Value"))); + sizerRight->Add(new wxButton(this, IDM_SETVALBUTTON, _("Set Value"))); sizerRight->AddSpacer(5); - sizerRight->Add(new wxButton(this, IDM_DUMP_MEMORY, _("&Dump MRAM"))); - sizerRight->Add(new wxButton(this, IDM_DUMP_MEM2, _("&Dump EXRAM"))); + sizerRight->Add(new wxButton(this, IDM_DUMP_MEMORY, _("Dump MRAM"))); + sizerRight->Add(new wxButton(this, IDM_DUMP_MEM2, _("Dump EXRAM"))); if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bMMU) - sizerRight->Add(new wxButton(this, IDM_DUMP_FAKEVMEM, _("&Dump FakeVMEM"))); + sizerRight->Add(new wxButton(this, IDM_DUMP_FAKEVMEM, _("Dump FakeVMEM"))); wxStaticBoxSizer* sizerSearchType = new wxStaticBoxSizer(wxVERTICAL, this, _("Search")); sizerSearchType->Add(btnSearch = new wxButton(this, IDM_SEARCH, _("Search"))); - sizerSearchType->Add(chkAscii = new wxCheckBox(this, IDM_ASCII, "&Ascii ")); - sizerSearchType->Add(chkHex = new wxCheckBox(this, IDM_HEX, _("&Hex"))); + sizerSearchType->Add(chkAscii = new wxCheckBox(this, IDM_ASCII, "Ascii ")); + sizerSearchType->Add(chkHex = new wxCheckBox(this, IDM_HEX, _("Hex"))); sizerRight->Add(sizerSearchType); wxStaticBoxSizer* sizerDataTypes = new wxStaticBoxSizer(wxVERTICAL, this, _("Data Type")); sizerDataTypes->SetMinSize(74, 40); - sizerDataTypes->Add(chk8 = new wxCheckBox(this, IDM_U8, "&U8")); - sizerDataTypes->Add(chk16 = new wxCheckBox(this, IDM_U16, "&U16")); - sizerDataTypes->Add(chk32 = new wxCheckBox(this, IDM_U32, "&U32")); + sizerDataTypes->Add(chk8 = new wxCheckBox(this, IDM_U8, "U8")); + sizerDataTypes->Add(chk16 = new wxCheckBox(this, IDM_U16, "U16")); + sizerDataTypes->Add(chk32 = new wxCheckBox(this, IDM_U32, "U32")); sizerRight->Add(sizerDataTypes); SetSizer(sizerBig); chkHex->SetValue(1); //Set defaults -- cgit v1.2.3 From 3499f2c2d0a447f0d078f1e1293bdf6ee12fe98b Mon Sep 17 00:00:00 2001 From: comex Date: Fri, 24 Apr 2015 22:19:21 -0400 Subject: To make up for it, make pressing enter on the value textbox set the value. --- Source/Core/DolphinWX/Debugger/MemoryWindow.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'Source/Core/DolphinWX/Debugger/MemoryWindow.cpp') diff --git a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp index 7c122b0bdc..8667751109 100644 --- a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp +++ b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp @@ -59,6 +59,7 @@ enum BEGIN_EVENT_TABLE(CMemoryWindow, wxPanel) EVT_TEXT(IDM_MEM_ADDRBOX, CMemoryWindow::OnAddrBoxChange) + EVT_TEXT_ENTER(IDM_VALBOX, CMemoryWindow::SetMemoryValueFromValBox) EVT_LISTBOX(IDM_SYMBOLLIST, CMemoryWindow::OnSymbolListChange) EVT_HOST_COMMAND(wxID_ANY, CMemoryWindow::OnHostMessage) EVT_BUTTON(IDM_SETVALBUTTON, CMemoryWindow::SetMemoryValue) @@ -93,7 +94,7 @@ CMemoryWindow::CMemoryWindow(wxWindow* parent, wxWindowID id, sizerBig->Add(memview, 20, wxEXPAND); sizerBig->Add(sizerRight, 0, wxEXPAND | wxALL, 3); sizerRight->Add(addrbox = new wxTextCtrl(this, IDM_MEM_ADDRBOX, "")); - sizerRight->Add(valbox = new wxTextCtrl(this, IDM_VALBOX, "")); + sizerRight->Add(valbox = new wxTextCtrl(this, IDM_VALBOX, "", wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER)); sizerRight->Add(new wxButton(this, IDM_SETVALBUTTON, _("Set Value"))); sizerRight->AddSpacer(5); @@ -156,6 +157,13 @@ void CMemoryWindow::JumpToAddress(u32 _Address) memview->Center(_Address); } +void CMemoryWindow::SetMemoryValueFromValBox(wxCommandEvent& event) +{ + SetMemoryValue(event); + valbox->SetFocus(); + +} + void CMemoryWindow::SetMemoryValue(wxCommandEvent& event) { if (!Memory::IsInitialized()) -- cgit v1.2.3 From a7e9aea7972c0a0af6fc7e9c4126ccda43118a0f Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 8 May 2015 10:04:40 -0400 Subject: DolphinWX: Remove unnecessary includes --- Source/Core/DolphinWX/Debugger/MemoryWindow.cpp | 9 --------- 1 file changed, 9 deletions(-) (limited to 'Source/Core/DolphinWX/Debugger/MemoryWindow.cpp') diff --git a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp index 8667751109..6277c26375 100644 --- a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp +++ b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp @@ -8,21 +8,12 @@ #include #include #include -#include #include -#include -#include -#include #include #include #include #include -#include #include -#include -#include -#include -#include #include "Common/CommonTypes.h" #include "Common/FileUtil.h" -- cgit v1.2.3 From cefcb0ace9d363b3679b4e93bcc9ec05f1e5f4f8 Mon Sep 17 00:00:00 2001 From: Tillmann Karras Date: Mon, 18 May 2015 01:08:10 +0200 Subject: Update license headers to GPLv2+ --- Source/Core/DolphinWX/Debugger/MemoryWindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/DolphinWX/Debugger/MemoryWindow.cpp') diff --git a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp index 6277c26375..8d8cabc373 100644 --- a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp +++ b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp @@ -1,5 +1,5 @@ // Copyright 2013 Dolphin Emulator Project -// Licensed under GPLv2 +// Licensed under GPLv2+ // Refer to the license.txt file included. #include -- cgit v1.2.3 From 30ebb2459eb97ba544547183854775df8460b475 Mon Sep 17 00:00:00 2001 From: Tillmann Karras Date: Sun, 24 May 2015 06:55:12 +0200 Subject: Set copyright year to when a file was created --- Source/Core/DolphinWX/Debugger/MemoryWindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/DolphinWX/Debugger/MemoryWindow.cpp') diff --git a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp index 8d8cabc373..f08b8103f6 100644 --- a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp +++ b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp @@ -1,4 +1,4 @@ -// Copyright 2013 Dolphin Emulator Project +// Copyright 2008 Dolphin Emulator Project // Licensed under GPLv2+ // Refer to the license.txt file included. -- cgit v1.2.3