GB MBC: Fix ROM bank overflows getting set to bank 0

This commit is contained in:
Jeffrey Pfau 2017-01-11 01:35:53 -08:00
parent ae12068d2f
commit 0b6bc9ae82
2 changed files with 4 additions and 0 deletions

View File

@ -16,6 +16,7 @@ Bugfixes:
- GBA: Fix multiboot ROM loading
- Libretro: Fix saving in GB games (fixes mgba.io/i/486)
- LR35902: Fix pc overflowing current region off-by-one
- GB MBC: Fix ROM bank overflows getting set to bank 0
Misc:
- SDL: Remove scancode key input
- GBA Video: Clean up unused timers

View File

@ -34,6 +34,9 @@ void GBMBCSwitchBank(struct GBMemory* memory, int bank) {
mLOG(GB_MBC, GAME_ERROR, "Attempting to switch to an invalid ROM bank: %0X", bank);
bankStart &= (memory->romSize - 1);
bank = bankStart / GB_SIZE_CART_BANK0;
if (!bank) {
++bank;
}
}
memory->romBank = &memory->rom[bankStart];
memory->currentBank = bank;