Skip to content

Commit

Permalink
attempt to use upstream MBC2 save handling. (#474)
Browse files Browse the repository at this point in the history
Taken from upstream VisualBoyAdvance-M code.
Hope i didn't break MBC2 saving this time...
  • Loading branch information
saulfabregwiivc authored Apr 19, 2024
1 parent ffc8f4a commit 9655bf6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions source/vba/gb/GB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2756,7 +2756,7 @@ void gbWriteSaveMBC2(const char * name)
return;
}

fwrite(gbRam,
fwrite(gbMemoryMap[0x0a],
1,
512,
file);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 9655bf6

Please sign in to comment.