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 committed by Vicki Pfau
parent d2e4413591
commit fcf7f30606
2 changed files with 4 additions and 0 deletions

View File

@ -4,6 +4,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:
- Qt: Improved HiDPI support

View File

@ -33,6 +33,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;