Added controls to "Dolphin-Memory" window to let you change values in memory.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@970 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
omegadox 2008-10-26 09:09:53 +00:00
parent 225fb8a4c1
commit fae0a612f9
2 changed files with 31 additions and 1 deletions

View File

@ -35,6 +35,8 @@
#include "Core.h" #include "Core.h"
#include "LogManager.h" #include "LogManager.h"
#include "HW/Memmap.h"
// ugly that this lib included code from the main // ugly that this lib included code from the main
#include "../../DolphinWX/Src/Globals.h" #include "../../DolphinWX/Src/Globals.h"
@ -54,13 +56,16 @@ enum
IDM_DUALCORE, IDM_DUALCORE,
IDM_LOGWINDOW, IDM_LOGWINDOW,
IDM_REGISTERWINDOW, IDM_REGISTERWINDOW,
IDM_BREAKPOINTWINDOW IDM_BREAKPOINTWINDOW,
IDM_VALBOX,
IDM_SETVALBUTTON
}; };
BEGIN_EVENT_TABLE(CMemoryWindow, wxFrame) BEGIN_EVENT_TABLE(CMemoryWindow, wxFrame)
EVT_TEXT(IDM_ADDRBOX, CMemoryWindow::OnAddrBoxChange) EVT_TEXT(IDM_ADDRBOX, CMemoryWindow::OnAddrBoxChange)
EVT_LISTBOX(IDM_SYMBOLLIST, CMemoryWindow::OnSymbolListChange) EVT_LISTBOX(IDM_SYMBOLLIST, CMemoryWindow::OnSymbolListChange)
EVT_HOST_COMMAND(wxID_ANY, CMemoryWindow::OnHostMessage) EVT_HOST_COMMAND(wxID_ANY, CMemoryWindow::OnHostMessage)
EVT_BUTTON(IDM_SETVALBUTTON, CMemoryWindow::SetMemoryValue)
END_EVENT_TABLE() END_EVENT_TABLE()
@ -83,6 +88,8 @@ CMemoryWindow::CMemoryWindow(wxWindow* parent, wxWindowID id,
sizerRight->Add(buttonGo = new wxButton(this, IDM_DEBUG_GO, _T("&Go"))); sizerRight->Add(buttonGo = new wxButton(this, IDM_DEBUG_GO, _T("&Go")));
sizerRight->Add(addrbox = new wxTextCtrl(this, IDM_ADDRBOX, _T(""))); sizerRight->Add(addrbox = new wxTextCtrl(this, IDM_ADDRBOX, _T("")));
sizerRight->Add(new wxButton(this, IDM_SETPC, _T("S&et PC"))); sizerRight->Add(new wxButton(this, IDM_SETPC, _T("S&et PC")));
sizerRight->Add(valbox = new wxTextCtrl(this, IDM_VALBOX, _T("")));
sizerRight->Add(new wxButton(this, IDM_SETVALBUTTON, _T("Set &Value")));
SetSizer(sizerBig); SetSizer(sizerBig);
@ -126,6 +133,26 @@ void CMemoryWindow::JumpToAddress(u32 _Address)
} }
void CMemoryWindow::SetMemoryValue(wxCommandEvent& event)
{
std::string str_addr = std::string(addrbox->GetValue().mb_str());
std::string str_val = std::string(valbox->GetValue().mb_str());
u32 addr;
u32 val;
if (!TryParseUInt(std::string("0x") + str_addr, &addr)) {
PanicAlert("Invalid Address: %s", str_addr);
return;
}
if (!TryParseUInt(std::string("0x") + str_val, &val)) {
PanicAlert("Invalid Value: %s", str_val);
return;
}
Memory::Write_U32(val, addr);
memview->Refresh();
}
void CMemoryWindow::OnAddrBoxChange(wxCommandEvent& event) void CMemoryWindow::OnAddrBoxChange(wxCommandEvent& event)
{ {
wxString txt = addrbox->GetValue(); wxString txt = addrbox->GetValue();

View File

@ -24,6 +24,7 @@
#include "Debugger.h" #include "Debugger.h"
#include "MemoryView.h" #include "MemoryView.h"
#include "Thread.h" #include "Thread.h"
#include "StringUtil.h"
#include "CoreParameter.h" #include "CoreParameter.h"
@ -59,6 +60,7 @@ class CMemoryWindow
wxButton* buttonGo; wxButton* buttonGo;
wxTextCtrl* addrbox; wxTextCtrl* addrbox;
wxTextCtrl* valbox;
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
@ -66,6 +68,7 @@ class CMemoryWindow
void OnCallstackListChange(wxCommandEvent& event); void OnCallstackListChange(wxCommandEvent& event);
void OnAddrBoxChange(wxCommandEvent& event); void OnAddrBoxChange(wxCommandEvent& event);
void OnHostMessage(wxCommandEvent& event); void OnHostMessage(wxCommandEvent& event);
void SetMemoryValue(wxCommandEvent& event);
}; };
#endif /*MEMORYWINDOW_*/ #endif /*MEMORYWINDOW_*/