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
This commit is contained in:
hyperiris 2009-01-21 17:02:01 +00:00
parent 8f4d58e082
commit b71d92126d
3 changed files with 26 additions and 1 deletions

View File

@ -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

View File

@ -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);
}
}

View File

@ -69,6 +69,7 @@ class CMemoryWindow
void OnAddrBoxChange(wxCommandEvent& event);
void OnHostMessage(wxCommandEvent& event);
void SetMemoryValue(wxCommandEvent& event);
void OnDumpMemory(wxCommandEvent& event);
};
#endif /*MEMORYWINDOW_*/