GBA Serialize: Properly restore GPIO register state (fixes #3294)

This commit is contained in:
CasualPokePlayer 2024-09-29 01:02:04 -07:00 committed by Vicki Pfau
parent 07ac520a9a
commit 7ae9117930
2 changed files with 13 additions and 0 deletions

View File

@ -5,6 +5,7 @@ Emulation fixes:
- GBA GPIO: Fix gyro read-out start (fixes mgba.io/i/3141)
- GBA I/O: Fix HALTCNT access behavior (fixes mgba.io/i/2309)
- GBA I/O: Fix audio register 8-bit write behavior (fixes mgba.io/i/3086)
- GBA Serialize: Properly restore GPIO register state (fixes mgba.io/i/3294)
- GBA SIO: Fix MULTI mode SIOCNT bit 7 writes on secondary GBAs (fixes mgba.io/i/3110)
Other fixes:
- GB: Fix uninitialized save data when loading undersized temporary saves

View File

@ -498,6 +498,18 @@ void GBAHardwareDeserialize(struct GBACartridgeHardware* hw, const struct GBASer
LOAD_16(hw->direction, 0, &state->hw.pinDirection);
hw->devices = state->hw.devices;
if (hw->gpioBase) {
if (hw->readWrite) {
STORE_16(hw->pinState, 0, hw->gpioBase);
STORE_16(hw->direction, 2, hw->gpioBase);
STORE_16(hw->readWrite, 4, hw->gpioBase);
} else {
hw->gpioBase[0] = 0;
hw->gpioBase[1] = 0;
hw->gpioBase[2] = 0;
}
}
LOAD_32(hw->rtc.bytesRemaining, 0, &state->hw.rtcBytesRemaining);
LOAD_32(hw->rtc.transferStep, 0, &state->hw.rtcTransferStep);
LOAD_32(hw->rtc.bitsRead, 0, &state->hw.rtcBitsRead);