attempt to use upstream MBC2 save handling. (#474)

Taken from upstream VisualBoyAdvance-M code.
Hope i didn't break MBC2 saving this time...
This commit is contained in:
saulfabreg Wii VC Project 2024-04-18 21:42:02 -05:00 committed by GitHub
parent ffc8f4aadb
commit 9655bf6a22
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2756,7 +2756,7 @@ void gbWriteSaveMBC2(const char * name)
return; return;
} }
fwrite(gbRam, fwrite(gbMemoryMap[0x0a],
1, 1,
512, 512,
file); file);
@ -2938,7 +2938,7 @@ bool gbReadSaveMBC2(const char * name)
return false; return false;
} }
size_t read = fread(gbRam, size_t read = fread(gbMemoryMap[0x0a],
1, 1,
512, 512,
file); file);
@ -5516,7 +5516,7 @@ int MemgbWriteSaveMBC1(char * membuffer) {
int MemgbWriteSaveMBC2(char * membuffer) { int MemgbWriteSaveMBC2(char * membuffer) {
if (gbRam) { if (gbRam) {
memcpy(membuffer, gbRam, 512); memcpy(membuffer, gbMemoryMap[0x0a], 512);
return 512; return 512;
} }
return 0; return 0;
@ -5604,7 +5604,7 @@ bool MemgbReadSaveMBC2(char * membuffer, int read) {
if (read != 512) if (read != 512)
return false; return false;
else else
memcpy(gbRam, membuffer, read); memcpy(gbMemoryMap[0x0a], membuffer, read);
return true; return true;
} }
return false; return false;