GBA Serialize: Fix alignment check when loading states

This commit is contained in:
Vicki Pfau 2020-12-13 15:02:08 -08:00
parent beba0cb2c5
commit 346f5dc0b5
2 changed files with 2 additions and 1 deletions

View File

@ -44,6 +44,7 @@ Emulation fixes:
- GBA Memory: Improve robustness of Matrix memory support - GBA Memory: Improve robustness of Matrix memory support
- GBA Memory: Mark Famicom Mini games 22 through 28 as non-mirroring - GBA Memory: Mark Famicom Mini games 22 through 28 as non-mirroring
- GBA Memory: Return correct byte for odd ROM open bus addresses - 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 copying Normal mode transfer values
- GBA SIO: Fix Normal mode being totally broken (fixes mgba.io/i/1800) - GBA SIO: Fix Normal mode being totally broken (fixes mgba.io/i/1800)
- GBA SIO: Fix deseralizing SIO registers - GBA SIO: Fix deseralizing SIO registers

View File

@ -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); LOAD_32(gba->cpu->bankedSPSRs[i], i * sizeof(gba->cpu->bankedSPSRs[0]), state->cpu.bankedSPSRs);
} }
gba->cpu->privilegeMode = gba->cpu->cpsr.priv; 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) { if (gba->cpu->gprs[ARM_PC] & pcMask) {
mLOG(GBA_STATE, WARN, "Savestate has unaligned PC and is probably corrupted"); mLOG(GBA_STATE, WARN, "Savestate has unaligned PC and is probably corrupted");
gba->cpu->gprs[ARM_PC] &= ~pcMask; gba->cpu->gprs[ARM_PC] &= ~pcMask;