From b71d92126d0df2113f6030811a165ced681e0cae Mon Sep 17 00:00:00 2001 From: hyperiris Date: Wed, 21 Jan 2009 17:02:01 +0000 Subject: [PATCH] Debugger: add a tiny function, dump main memory to a file, mainram.dump in .\User\Cache\, this is for ram data analysis, open the dump in hex/tile editor we can do something... git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1973 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Common/Src/Paths.h | 4 ++++ Source/Core/DebuggerWX/Src/MemoryWindow.cpp | 22 ++++++++++++++++++++- Source/Core/DebuggerWX/Src/MemoryWindow.h | 1 + 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/Source/Core/Common/Src/Paths.h b/Source/Core/Common/Src/Paths.h index 45ffb756a0..862c8ec2b4 100644 --- a/Source/Core/Common/Src/Paths.h +++ b/Source/Core/Common/Src/Paths.h @@ -70,6 +70,8 @@ #define WII_USA_SETTING "setting-usa.txt" #define WII_JAP_SETTING "setting-jpn.txt" +#define MEMORY_DUMP_FILE "mainram.dump" + // Shorts - dirs // User dirs #define FULL_USERDATA_DIR ROOT_DIR DIR_SEP USERDATA_DIR DIR_SEP @@ -91,6 +93,8 @@ #define FULL_MAIL_LOGS_DIR FULL_LOGS_DIR MAIL_LOGS_DIR DIR_SEP #define FULL_MAPS_DIR FULL_USERDATA_DIR MAPS_DIR DIR_SEP +#define FULL_MEMORY_DUMP_DIR FULL_CACHE_DIR MEMORY_DUMP_FILE + // Sys dirs #define FULL_SYSDATA_DIR ROOT_DIR DIR_SEP SYSDATA_DIR DIR_SEP diff --git a/Source/Core/DebuggerWX/Src/MemoryWindow.cpp b/Source/Core/DebuggerWX/Src/MemoryWindow.cpp index c406bc1a84..9a4be1859a 100644 --- a/Source/Core/DebuggerWX/Src/MemoryWindow.cpp +++ b/Source/Core/DebuggerWX/Src/MemoryWindow.cpp @@ -58,7 +58,9 @@ enum IDM_REGISTERWINDOW, IDM_BREAKPOINTWINDOW, IDM_VALBOX, - IDM_SETVALBUTTON + IDM_SETVALBUTTON, + IDM_DUMP_MEMORY, + }; BEGIN_EVENT_TABLE(CMemoryWindow, wxFrame) @@ -66,6 +68,7 @@ BEGIN_EVENT_TABLE(CMemoryWindow, wxFrame) 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) END_EVENT_TABLE() @@ -90,6 +93,9 @@ CMemoryWindow::CMemoryWindow(wxWindow* parent, wxWindowID id, 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"))); + + sizerRight->AddSpacer(5); + sizerRight->Add(new wxButton(this, IDM_DUMP_MEMORY, _T("&Dump Memory"))); SetSizer(sizerBig); @@ -218,4 +224,18 @@ void CMemoryWindow::OnHostMessage(wxCommandEvent& event) } } +// this is a simple main 1Tsram dump, +// so we can view memory in a tile/hex viewer for data analysis +void CMemoryWindow::OnDumpMemory( wxCommandEvent& event ) +{ + FILE* pDumpFile = fopen(FULL_MEMORY_DUMP_DIR, "wb"); + if (pDumpFile) + { + if (Memory::m_pRAM) + { + fwrite(Memory::m_pRAM, Memory::REALRAM_SIZE, 1, pDumpFile); + } + fclose(pDumpFile); + } +} diff --git a/Source/Core/DebuggerWX/Src/MemoryWindow.h b/Source/Core/DebuggerWX/Src/MemoryWindow.h index fb19e171ed..c0d790e533 100644 --- a/Source/Core/DebuggerWX/Src/MemoryWindow.h +++ b/Source/Core/DebuggerWX/Src/MemoryWindow.h @@ -69,6 +69,7 @@ class CMemoryWindow void OnAddrBoxChange(wxCommandEvent& event); void OnHostMessage(wxCommandEvent& event); void SetMemoryValue(wxCommandEvent& event); + void OnDumpMemory(wxCommandEvent& event); }; #endif /*MEMORYWINDOW_*/