mirror of
https://github.com/dborth/vbagx.git
synced 2024-11-22 10:39:18 +01:00
Fix MBC2 data saving (F-1 Race, Kirby's Pinball Land, etc.) (#460)
The old MBC2 saving routine based on gbMemory the savedata generated/stored on mapper MBC2 to not save correctly. The affected games by this includes F-1 Race, Kirby's Pinball Land, etc. This fixes said issue, by replacing the save routine from gbMemory to gbRam, like the other mapper saving routines. Also changes the savefile size to 512 kB for avoid saving issues with all MBC2 games. Based on the same fix by Steelskin.
This commit is contained in:
parent
51702bb545
commit
8b49ff30cc
@ -2756,7 +2756,7 @@ void gbWriteSaveMBC2(const char * name)
|
||||
return;
|
||||
}
|
||||
|
||||
fwrite(&gbMemoryMap[0x0a],
|
||||
fwrite(gbRam,
|
||||
1,
|
||||
512,
|
||||
file);
|
||||
@ -2938,7 +2938,7 @@ bool gbReadSaveMBC2(const char * name)
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t read = fread(&gbMemoryMap[0x0a],
|
||||
size_t read = fread(gbRam,
|
||||
1,
|
||||
512,
|
||||
file);
|
||||
@ -5516,8 +5516,8 @@ int MemgbWriteSaveMBC1(char * membuffer) {
|
||||
|
||||
int MemgbWriteSaveMBC2(char * membuffer) {
|
||||
if (gbRam) {
|
||||
memcpy(membuffer, &gbMemory[0xa000], 256);
|
||||
return 256;
|
||||
memcpy(membuffer, gbRam, 512);
|
||||
return 512;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -5601,10 +5601,10 @@ bool MemgbReadSaveMBC1(char * membuffer, int read) {
|
||||
bool MemgbReadSaveMBC2(char * membuffer, int read) {
|
||||
if (gbRam)
|
||||
{
|
||||
if (read != 256)
|
||||
if (read != 512)
|
||||
return false;
|
||||
else
|
||||
memcpy(&gbMemory[0xa000], membuffer, read);
|
||||
memcpy(gbRam, membuffer, read);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user