From b1a06ed52bd8f9db00dcd722198deedd8a184f69 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Wed, 27 Jan 2021 20:24:26 -0800 Subject: [PATCH] Cheats: Fix indirect write cheats (fixes #2026) --- CHANGES | 1 + src/core/cheats.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 413f1c41e..8623265ce 100644 --- a/CHANGES +++ b/CHANGES @@ -58,6 +58,7 @@ Emulation fixes: Other fixes: - 3DS: Fix thread cleanup - All: Improve export headers (fixes mgba.io/i/1738) + - Cheats: Fix indirect write cheats (fixes mgba.io/i/2026) - CMake: Fix build with downstream minizip that exports incompatible symbols - CMake: Link with correct OpenGL library (fixes mgba.io/i/1872) - Core: Ensure ELF regions can be written before trying diff --git a/src/core/cheats.c b/src/core/cheats.c index 8e2e43b05..090883ac2 100644 --- a/src/core/cheats.c +++ b/src/core/cheats.c @@ -666,7 +666,7 @@ void mCheatRefresh(struct mCheatDevice* device, struct mCheatSet* cheats) { break; case CHEAT_ASSIGN_INDIRECT: value = operand; - address = _readMem(device->p, address + cheat->addressOffset, 4); + address = _readMem(device->p, address, 4) + cheat->addressOffset; performAssignment = true; break; case CHEAT_AND: