From d2e4413591b3968604b52c28e823d1e05fb889fd Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Wed, 11 Jan 2017 01:35:06 -0800 Subject: [PATCH] LR35902: Fix pc overflowing current region off-by-one --- CHANGES | 1 + src/gb/memory.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index c93506386..fdf22f093 100644 --- a/CHANGES +++ b/CHANGES @@ -3,6 +3,7 @@ Bugfixes: - 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 Misc: - Qt: Improved HiDPI support diff --git a/src/gb/memory.c b/src/gb/memory.c index bd6657dea..879865393 100644 --- a/src/gb/memory.c +++ b/src/gb/memory.c @@ -18,7 +18,7 @@ mLOG_DEFINE_CATEGORY(GB_MEM, "GB Memory"); static void _pristineCow(struct GB* gba); static uint8_t GBFastLoad8(struct LR35902Core* cpu, uint16_t address) { - if (UNLIKELY(address > cpu->memory.activeRegionEnd)) { + if (UNLIKELY(address >= cpu->memory.activeRegionEnd)) { cpu->memory.setActiveRegion(cpu, address); return cpu->memory.cpuLoad8(cpu, address); }