GB MBC: Improve multicart detection heuristic (fixes #1177)
Vicki Pfau vi@endrift.com
Thu, 20 Sep 2018 11:56:52 -0700
2 files changed,
14 insertions(+),
3 deletions(-)
M
CHANGES
→
CHANGES
@@ -57,6 +57,7 @@ - GB, GBA Savedata: Fix unmasking savedata crash
- GBA DMA: Fix temporal sorting of DMAs of different priorities - FFmpeg: Fix encoding audio/video queue issues - GB Serialize: Fix IRQ pending/EI pending confusion + - GB MBC: Improve multicart detection heuristic (fixes mgba.io/i/1177) Misc: - GBA Timer: Use global cycles for timers - GBA: Extend oddly-sized ROMs to full address space (fixes mgba.io/i/722)
M
src/gb/mbc.c
→
src/gb/mbc.c
@@ -95,17 +95,27 @@ }
} static bool _isMulticart(const uint8_t* mem) { - bool success = true; + bool success; struct VFile* vf; vf = VFileFromConstMemory(&mem[GB_SIZE_CART_BANK0 * 0x10], 1024); - success = success && GBIsROM(vf); + success = GBIsROM(vf); vf->close(vf); + + if (!success) { + return false; + } vf = VFileFromConstMemory(&mem[GB_SIZE_CART_BANK0 * 0x20], 1024); - success = success && GBIsROM(vf); + success = GBIsROM(vf); vf->close(vf); + if (!success) { + vf = VFileFromConstMemory(&mem[GB_SIZE_CART_BANK0 * 0x30], 1024); + success = GBIsROM(vf); + vf->close(vf); + } + return success; }