Commit 3b87576e authored by retro-wertz's avatar retro-wertz Committed by Rafael Kitover
Browse files

GB: Fix rumble support (MBC5)

- Fix missing call to rumble function on MBC5
- fix rumble flag gets disabled causing rumble not to work at all.
parent 089d7a40
......@@ -193,6 +193,7 @@ uint32_t gbTimeNow = 0;
int gbSynchronizeTicks = GBSYNCHRONIZE_CLOCK_TICKS;
// emulator features
int gbBattery = 0;
int gbRumble = 0;
bool gbBatteryError = false;
int gbCaptureNumber = 0;
bool gbCapture = false;
......@@ -2713,6 +2714,7 @@ void gbReset()
memset(&gbDataMBC5, 0, sizeof(gbDataMBC5));
gbDataMBC5.mapperROMBank = 1;
gbDataMBC5.isRumbleCartridge = gbRumble;
memset(&gbDataHuC1, 0, sizeof(gbDataHuC1));
gbDataHuC1.mapperROMBank = 1;
......@@ -4335,6 +4337,8 @@ bool gbUpdateSizes()
memset(gbRam, gbRamFill, gbRamSize);
}
gbBattery = gbRumble = 0;
switch (gbRomType) {
case 0x03:
case 0x06:
......@@ -4351,17 +4355,15 @@ bool gbUpdateSizes()
break;
}
gbInit();
//gbReset();
switch (gbRomType) {
case 0x1c:
case 0x1d:
case 0x1e:
gbDataMBC5.isRumbleCartridge = 1;
gbRumble = 1;
}
gbInit();
return true;
}
......
......@@ -560,9 +560,10 @@ void mapperMBC5ROM(uint16_t address, uint8_t value)
}
break;
case 0x4000: // RAM bank select
if (gbDataMBC5.isRumbleCartridge)
if (gbDataMBC5.isRumbleCartridge) {
systemCartridgeRumble(value & 8);
value &= 0x07;
else
} else
value &= 0x0f;
if (value == gbDataMBC5.mapperRAMBank)
break;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment