From a26971cdc7fe564a572a06e7320e115cc959895d Mon Sep 17 00:00:00 2001 From: CasualPokePlayer <50538166+CasualPokePlayer@users.noreply.github.com> Date: Sat, 28 Sep 2024 16:39:19 -0700 Subject: [PATCH] This should be in Deserialize not Serialize --- src/gba/cart/gpio.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/gba/cart/gpio.c b/src/gba/cart/gpio.c index 15f082849..562a42b63 100644 --- a/src/gba/cart/gpio.c +++ b/src/gba/cart/gpio.c @@ -465,18 +465,6 @@ void GBAHardwareSerialize(const struct GBACartridgeHardware* hw, struct GBASeria STORE_16(hw->direction, 0, &state->hw.pinDirection); state->hw.devices = 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; - } - } - STORE_32(hw->rtc.bytesRemaining, 0, &state->hw.rtcBytesRemaining); STORE_32(hw->rtc.transferStep, 0, &state->hw.rtcTransferStep); STORE_32(hw->rtc.bitsRead, 0, &state->hw.rtcBitsRead); @@ -514,6 +502,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);