all repos — mgba @ 0b6bc9ae82012475ee567f16823ef8019cac6a52

mGBA Game Boy Advance Emulator

GB MBC: Fix ROM bank overflows getting set to bank 0
Jeffrey Pfau jeffrey@endrift.com
Wed, 11 Jan 2017 01:35:53 -0800
commit

0b6bc9ae82012475ee567f16823ef8019cac6a52

parent

ae12068d2f4b35dc8a61b47625751f028dd234c9

2 files changed, 4 insertions(+), 0 deletions(-)

jump to
M CHANGESCHANGES

@@ -16,6 +16,7 @@ - ARM7: Fix MLA/*MULL/*MLAL timing

- 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
M src/gb/mbc.csrc/gb/mbc.c

@@ -34,6 +34,9 @@ if (bankStart + GB_SIZE_CART_BANK0 > memory->romSize) {

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;