win32: add feature: dump all memory (new button in memory viewer; inspect debug.cpp for a map of the file)

This commit is contained in:
zeromus 2010-04-08 20:33:12 +00:00
parent 2f01b6c2a0
commit 264dc80808
5 changed files with 36 additions and 9 deletions

View File

@ -208,6 +208,26 @@ void DEBUG_reset()
printf("DEBUG_reset: %08X\n",&DebugStatistics::print); //force a reference to this function
}
static void DEBUG_dumpMemory_fill(EMUFILE *fp, u32 size)
{
static std::vector<u8> buf;
buf.resize(size);
memset(&buf[0],0,size);
fp->fwrite(&buf[0],size);
}
void DEBUG_dumpMemory(EMUFILE* fp)
{
fp->fseek(0x000000,SEEK_SET); fp->fwrite(MMU.MAIN_MEM,0x800000); //arm9 main mem (8192K)
fp->fseek(0x900000,SEEK_SET); fp->fwrite(MMU.ARM9_DTCM,0x4000); //arm9 DTCM (16K)
fp->fseek(0xA00000,SEEK_SET); fp->fwrite(MMU.ARM9_ITCM,0x8000); //arm9 ITCM (32K)
fp->fseek(0xB00000,SEEK_SET); fp->fwrite(MMU.ARM9_LCD,0xA4000); //LCD mem 656K
fp->fseek(0xC00000,SEEK_SET); fp->fwrite(MMU.ARM9_VMEM,0x800); //OAM
fp->fseek(0xD00000,SEEK_SET); fp->fwrite(MMU.ARM7_ERAM,0x10000); //arm7 WRAM (64K)
fp->fseek(0xE00000,SEEK_SET); fp->fwrite(MMU.ARM7_WIRAM,0x10000); //arm7 wifi RAM ?
fp->fseek(0xF00000,SEEK_SET); fp->fwrite(MMU.SWIRAM,0x8000); //arm9/arm7 shared WRAM (32KB)
}
//----------------------------------------------------
std::vector<Logger *> Logger::channels;

View File

@ -28,6 +28,7 @@
#include "types.h"
#include "mem.h"
#include "emufile.h"
struct DebugStatistics
{
@ -47,6 +48,7 @@ struct DebugStatistics
extern DebugStatistics DEBUG_statistics;
void DEBUG_reset();
void DEBUG_dumpMemory(EMUFILE* fp);
struct armcpu_t;

View File

@ -279,6 +279,7 @@ INT_PTR CALLBACK MemView_DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
}
return 1;
case IDC_DUMPALL:
case IDC_RAWDUMP:
{
char fileName[256] = "";
@ -296,16 +297,19 @@ INT_PTR CALLBACK MemView_DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
if(GetSaveFileName(&ofn))
{
FILE *f;
if(LOWORD(wParam) == IDC_RAWDUMP)
{
EMUFILE_FILE f(fileName,"ab");
u8 memory[0x100];
MMU_DumpMemBlock(wnd->cpu, wnd->address, 0x100, memory);
f = fopen(fileName, "ab");
fwrite(memory, 0x100, 1, f);
fclose(f);
f.fwrite(memory, 0x100);
}
else
{
EMUFILE_FILE f(fileName,"wb");
DEBUG_dumpMemory(&f);
}
}
}
return 1;

View File

@ -336,6 +336,7 @@
#define IDC_SYNCHMODE_SYNCH 1013
#define IDC_FIRMWAREBROWSE 1014
#define IDC_VOLUME 1014
#define IDC_DUMPALL 1014
#define IDC_SYNCHMETHOD_N 1015
#define IDC_FIRMWAREBOOT 1016
#define IDC_SYNCHMETHOD_Z 1016

Binary file not shown.