From 68ef5d3a5b32def3a07650d6bf6412ef6d5068ca Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Thu, 30 Jun 2022 04:20:30 -0700 Subject: [PATCH] GB: Fix replacing the ROM crashing when accessing ROM base --- CHANGES | 1 + src/gb/gb.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/CHANGES b/CHANGES index 382ce85ad..3855918da 100644 --- a/CHANGES +++ b/CHANGES @@ -57,6 +57,7 @@ Other fixes: - FFmpeg: Fix crash when encoding audio with some containers - FFmpeg: Fix GIF recording (fixes mgba.io/i/2393) - GB: Fix temporary saves + - GB: Fix replacing the ROM crashing when accessing ROM base - GB, GBA: Save writeback-pending masked saves on unload (fixes mgba.io/i/2396) - mGUI: Fix FPS counter after closing menu - Qt: Fix some hangs when using the debugger console diff --git a/src/gb/gb.c b/src/gb/gb.c index edcd548d1..81d059b00 100644 --- a/src/gb/gb.c +++ b/src/gb/gb.c @@ -189,6 +189,9 @@ bool GBLoadROM(struct GB* gb, struct VFile* vf) { if (gb->cpu) { struct SM83Core* cpu = gb->cpu; + if (!gb->memory.romBase) { + GBMBCSwitchBank0(gb, 0); + } cpu->memory.setActiveRegion(cpu, cpu->pc); }