GBA Hardware: Fix loading states unconditionally overwriting GPIO memory

This commit is contained in:
Vicki Pfau 2024-12-11 16:24:51 -08:00
parent f4595f4578
commit 109fbe60f5
3 changed files with 5 additions and 2 deletions

View File

@ -19,6 +19,7 @@ Other fixes:
- Core: Fix inconsistencies with setting game-specific overrides (fixes mgba.io/i/2963) - Core: Fix inconsistencies with setting game-specific overrides (fixes mgba.io/i/2963)
- Debugger: Fix writing to specific segment in command-line debugger - Debugger: Fix writing to specific segment in command-line debugger
- GB Serialize: Prevent loading invalid states where LY >= 144 in modes other than 1 - GB Serialize: Prevent loading invalid states where LY >= 144 in modes other than 1
- GBA Hardware: Fix loading states unconditionally overwriting GPIO memory
- GBA: Fix getting game info for multiboot ROMs - GBA: Fix getting game info for multiboot ROMs
- Qt: Fix savestate preview sizes with different scales (fixes mgba.io/i/2560) - Qt: Fix savestate preview sizes with different scales (fixes mgba.io/i/2560)
- Qt: Fix potential crash when configuring shortcuts - Qt: Fix potential crash when configuring shortcuts

View File

@ -68,7 +68,9 @@ enum GBAHardwareDevice {
HW_TILT = 16, HW_TILT = 16,
HW_GB_PLAYER = 32, HW_GB_PLAYER = 32,
HW_GB_PLAYER_DETECTION = 64, HW_GB_PLAYER_DETECTION = 64,
HW_EREADER = 128 HW_EREADER = 128,
HW_GPIO = HW_RTC | HW_RUMBLE | HW_LIGHT_SENSOR | HW_GYRO | HW_TILT,
}; };
struct Configuration; struct Configuration;

View File

@ -502,7 +502,7 @@ void GBAHardwareDeserialize(struct GBACartridgeHardware* hw, const struct GBASer
LOAD_16(hw->direction, 0, &state->hw.pinDirection); LOAD_16(hw->direction, 0, &state->hw.pinDirection);
hw->devices = state->hw.devices; hw->devices = state->hw.devices;
if (hw->gpioBase) { if ((hw->devices & HW_GPIO) && hw->gpioBase) {
if (hw->readWrite) { if (hw->readWrite) {
STORE_16(hw->pinState, 0, hw->gpioBase); STORE_16(hw->pinState, 0, hw->gpioBase);
STORE_16(hw->direction, 2, hw->gpioBase); STORE_16(hw->direction, 2, hw->gpioBase);