From 9655bf6a229f43e6b7aba01e3b404a7d35627000 Mon Sep 17 00:00:00 2001 From: saulfabreg Wii VC Project Date: Thu, 18 Apr 2024 21:42:02 -0500 Subject: [PATCH] attempt to use upstream MBC2 save handling. (#474) Taken from upstream VisualBoyAdvance-M code. Hope i didn't break MBC2 saving this time... --- source/vba/gb/GB.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/vba/gb/GB.cpp b/source/vba/gb/GB.cpp index cda3f87..460242f 100644 --- a/source/vba/gb/GB.cpp +++ b/source/vba/gb/GB.cpp @@ -2756,7 +2756,7 @@ void gbWriteSaveMBC2(const char * name) return; } - fwrite(gbRam, + fwrite(gbMemoryMap[0x0a], 1, 512, file); @@ -2938,7 +2938,7 @@ bool gbReadSaveMBC2(const char * name) return false; } - size_t read = fread(gbRam, + size_t read = fread(gbMemoryMap[0x0a], 1, 512, file); @@ -5516,7 +5516,7 @@ int MemgbWriteSaveMBC1(char * membuffer) { int MemgbWriteSaveMBC2(char * membuffer) { if (gbRam) { - memcpy(membuffer, gbRam, 512); + memcpy(membuffer, gbMemoryMap[0x0a], 512); return 512; } return 0; @@ -5604,7 +5604,7 @@ bool MemgbReadSaveMBC2(char * membuffer, int read) { if (read != 512) return false; else - memcpy(gbRam, membuffer, read); + memcpy(gbMemoryMap[0x0a], membuffer, read); return true; } return false;