From 346f5dc0b53afa8ea1e11d8c94a0090b5d49abc9 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Sun, 13 Dec 2020 15:02:08 -0800 Subject: [PATCH] GBA Serialize: Fix alignment check when loading states --- CHANGES | 1 + src/gba/serialize.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 1274a5fce..5d2105968 100644 --- a/CHANGES +++ b/CHANGES @@ -44,6 +44,7 @@ Emulation fixes: - GBA Memory: Improve robustness of Matrix memory support - GBA Memory: Mark Famicom Mini games 22 through 28 as non-mirroring - GBA Memory: Return correct byte for odd ROM open bus addresses + - GBA Serialize: Fix alignment check when loading states - GBA SIO: Fix copying Normal mode transfer values - GBA SIO: Fix Normal mode being totally broken (fixes mgba.io/i/1800) - GBA SIO: Fix deseralizing SIO registers diff --git a/src/gba/serialize.c b/src/gba/serialize.c index 464cef460..fbb7d99d9 100644 --- a/src/gba/serialize.c +++ b/src/gba/serialize.c @@ -154,7 +154,7 @@ bool GBADeserialize(struct GBA* gba, const struct GBASerializedState* state) { LOAD_32(gba->cpu->bankedSPSRs[i], i * sizeof(gba->cpu->bankedSPSRs[0]), state->cpu.bankedSPSRs); } gba->cpu->privilegeMode = gba->cpu->cpsr.priv; - uint32_t pcMask = (gba->cpu->executionMode == MODE_THUMB ? WORD_SIZE_THUMB : WORD_SIZE_ARM) - 1; + uint32_t pcMask = (gba->cpu->cpsr.t ? WORD_SIZE_THUMB : WORD_SIZE_ARM) - 1; if (gba->cpu->gprs[ARM_PC] & pcMask) { mLOG(GBA_STATE, WARN, "Savestate has unaligned PC and is probably corrupted"); gba->cpu->gprs[ARM_PC] &= ~pcMask;