From 0f9c4bbe60d4c30e10ac0d15d5c653297c51e034 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Tue, 30 Apr 2019 17:45:38 -0700 Subject: [PATCH] GBA Memory: Fix writing to OBJ memory in modes 3 and 5 --- CHANGES | 1 + src/gba/memory.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 76c9d07ee..d5d08b3e5 100644 --- a/CHANGES +++ b/CHANGES @@ -20,6 +20,7 @@ Emulation fixes: - GB Video: Fix window y changing mid-window (fixes mgba.io/i/1345) - GB Video: Fix more window edge cases (fixes mgba.io/i/1346) - GB Timer: Fix timing adjustments when writing to TAC (fixes mgba.io/i/1340) + - GBA Memory: Fix writing to OBJ memory in modes 3 and 5 Other fixes: - Qt: More app metadata fixes - Qt: Fix load recent from archive (fixes mgba.io/i/1325) diff --git a/src/gba/memory.c b/src/gba/memory.c index 32d707c60..46aecae5b 100644 --- a/src/gba/memory.c +++ b/src/gba/memory.c @@ -938,7 +938,7 @@ void GBAStore8(struct ARMCore* cpu, uint32_t address, int8_t value, int* cycleCo GBAStore16(cpu, address & ~1, ((uint8_t) value) | ((uint8_t) value << 8), cycleCounter); break; case REGION_VRAM: - if ((address & 0x0001FFFF) >= ((GBARegisterDISPCNTGetMode(gba->memory.io[REG_DISPCNT >> 1]) == 4) ? 0x00014000 : 0x00010000)) { + if ((address & 0x0001FFFF) >= ((GBARegisterDISPCNTGetMode(gba->memory.io[REG_DISPCNT >> 1]) >= 3) ? 0x00014000 : 0x00010000)) { // TODO: check BG mode mLOG(GBA_MEM, GAME_ERROR, "Cannot Store8 to OBJ: 0x%08X", address); break;