mirror of https://github.com/mgba-emu/mgba.git
GBA Serialize: Ensure program counter is aligned when loading
This commit is contained in:
parent
67cf9b78b3
commit
b4623c4b34
1
CHANGES
1
CHANGES
|
@ -24,6 +24,7 @@ Other fixes:
|
|||
- GBA: Disable more checks when loading GS save with checks disabled (fixes mgba.io/i/1851)
|
||||
- GBA: Fix endianness issues in renderer proxy
|
||||
- GBA Core: Fix memory leak when loading symbols
|
||||
- GBA Serialize: Ensure program counter is aligned when loading
|
||||
- Qt: Add dummy English translation file (fixes mgba.io/i/1469)
|
||||
- Qt: Fix Battle Chip view not displaying chips on some DPI settings
|
||||
- Qt: Fix camera image being upside-down sometimes (fixes mgba.io/i/829 again)
|
||||
|
|
|
@ -152,6 +152,11 @@ 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;
|
||||
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;
|
||||
}
|
||||
gba->cpu->memory.setActiveRegion(gba->cpu, gba->cpu->gprs[ARM_PC]);
|
||||
if (state->biosPrefetch) {
|
||||
LOAD_32(gba->memory.biosPrefetch, 0, &state->biosPrefetch);
|
||||
|
|
Loading…
Reference in New Issue