Add GBA SRAM dumping

This commit is contained in:
RocketRobz 2019-03-08 15:47:07 -07:00
parent 3a7b91a5fe
commit 585501515e
3 changed files with 8 additions and 2 deletions

View File

@ -28,7 +28,6 @@
---------------------------------------------------------------------------------*/ ---------------------------------------------------------------------------------*/
#include <nds.h> #include <nds.h>
#include <maxmod7.h>
unsigned int * SCFG_EXT=(unsigned int*)0x4004008; unsigned int * SCFG_EXT=(unsigned int*)0x4004008;

View File

@ -100,7 +100,9 @@ void gbaCartDump(void) {
} }
u8 gbaHeaderSoftwareVersion = *(u8*)(0x080000BC); u8 gbaHeaderSoftwareVersion = *(u8*)(0x080000BC);
char destPath[256]; char destPath[256];
char destSavPath[256];
snprintf(destPath, sizeof(destPath), "fat:/gm9i/out/%s_%s%s_%x.gba", gbaHeaderGameTitle, gbaHeaderGameCode, gbaHeaderMakerCode, gbaHeaderSoftwareVersion); snprintf(destPath, sizeof(destPath), "fat:/gm9i/out/%s_%s%s_%x.gba", gbaHeaderGameTitle, gbaHeaderGameCode, gbaHeaderMakerCode, gbaHeaderSoftwareVersion);
snprintf(destSavPath, sizeof(destSavPath), "fat:/gm9i/out/%s_%s%s_%x.sav", gbaHeaderGameTitle, gbaHeaderGameCode, gbaHeaderMakerCode, gbaHeaderSoftwareVersion);
consoleClear(); consoleClear();
printf("Dumping...\n"); printf("Dumping...\n");
printf("Do not remove the GBA cart.\n"); printf("Do not remove the GBA cart.\n");
@ -118,6 +120,11 @@ void gbaCartDump(void) {
FILE* destinationFile = fopen(destPath, "wb"); FILE* destinationFile = fopen(destPath, "wb");
fwrite((void*)0x08000000, 1, romSize, destinationFile); fwrite((void*)0x08000000, 1, romSize, destinationFile);
fclose(destinationFile); fclose(destinationFile);
// Save file
remove(destSavPath);
destinationFile = fopen(destSavPath, "wb");
fwrite((void*)0x0A000000, 1, 0x10000, destinationFile);
fclose(destinationFile);
break; break;
} }
if (pressed & KEY_B) { if (pressed & KEY_B) {

View File

@ -77,7 +77,7 @@ int main(int argc, char **argv) {
bool yHeld = false; bool yHeld = false;
snprintf(titleName, sizeof(titleName), "GodMode9i v%i.%i.%i", 1, 3, 3); snprintf(titleName, sizeof(titleName), "GodMode9i v%i.%i.%i", 1, 3, 4);
// initialize video mode // initialize video mode
videoSetMode(MODE_4_2D); videoSetMode(MODE_4_2D);