From 585501515e09d8462ebadd7cda128b1af2f7afbb Mon Sep 17 00:00:00 2001 From: RocketRobz Date: Fri, 8 Mar 2019 15:47:07 -0700 Subject: [PATCH] Add GBA SRAM dumping --- arm7/source/main.c | 1 - arm9/source/driveMenu.cpp | 7 +++++++ arm9/source/main.cpp | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/arm7/source/main.c b/arm7/source/main.c index 825af61..24cc386 100644 --- a/arm7/source/main.c +++ b/arm7/source/main.c @@ -28,7 +28,6 @@ ---------------------------------------------------------------------------------*/ #include -#include unsigned int * SCFG_EXT=(unsigned int*)0x4004008; diff --git a/arm9/source/driveMenu.cpp b/arm9/source/driveMenu.cpp index c67efa2..dbbe3a2 100644 --- a/arm9/source/driveMenu.cpp +++ b/arm9/source/driveMenu.cpp @@ -100,7 +100,9 @@ void gbaCartDump(void) { } u8 gbaHeaderSoftwareVersion = *(u8*)(0x080000BC); char destPath[256]; + char destSavPath[256]; 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(); printf("Dumping...\n"); printf("Do not remove the GBA cart.\n"); @@ -118,6 +120,11 @@ void gbaCartDump(void) { FILE* destinationFile = fopen(destPath, "wb"); fwrite((void*)0x08000000, 1, romSize, destinationFile); fclose(destinationFile); + // Save file + remove(destSavPath); + destinationFile = fopen(destSavPath, "wb"); + fwrite((void*)0x0A000000, 1, 0x10000, destinationFile); + fclose(destinationFile); break; } if (pressed & KEY_B) { diff --git a/arm9/source/main.cpp b/arm9/source/main.cpp index a2b679a..a4e69d0 100644 --- a/arm9/source/main.cpp +++ b/arm9/source/main.cpp @@ -77,7 +77,7 @@ int main(int argc, char **argv) { 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 videoSetMode(MODE_4_2D);