From cb0b47406f5740e5432a5a30d9262731ce80e132 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Sun, 3 Apr 2022 15:55:34 -0700 Subject: [PATCH] GB MBC: Filter out MBC errors when cartridge is yanked (fixes #2488) --- CHANGES | 1 + src/gb/mbc.c | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 9fd147dd7..6547246ed 100644 --- a/CHANGES +++ b/CHANGES @@ -49,6 +49,7 @@ Misc: - Core: Suspend runloop when a core crashes - Debugger: Save and restore CLI history - Debugger: GDB now works while the game is paused + - GB MBC: Filter out MBC errors when cartridge is yanked (fixes mgba.io/i/2488) - GB Video: Add default SGB border - GBA: Automatically skip BIOS if ROM has invalid logo - GBA: Refine multiboot detection (fixes mgba.io/i/2192) diff --git a/src/gb/mbc.c b/src/gb/mbc.c index 43f6c7a90..9e8724964 100644 --- a/src/gb/mbc.c +++ b/src/gb/mbc.c @@ -18,11 +18,12 @@ const uint32_t GB_LOGO_HASH = 0x46195417; mLOG_DEFINE_CATEGORY(GB_MBC, "GB MBC", "gb.mbc"); static void _GBMBCNone(struct GB* gb, uint16_t address, uint8_t value) { - UNUSED(gb); UNUSED(address); UNUSED(value); - mLOG(GB_MBC, GAME_ERROR, "Wrote to invalid MBC"); + if (!gb->yankedRomSize) { + mLOG(GB_MBC, GAME_ERROR, "Wrote to invalid MBC"); + } } static void _GBMBC1(struct GB*, uint16_t address, uint8_t value);