GBA Hardware: Fix crash if a savestate lies about game hardware

This commit is contained in:
Vicki Pfau 2017-04-24 13:34:57 -07:00
parent 93122df1f4
commit 422c3a25b8
3 changed files with 6 additions and 0 deletions

View File

@ -46,6 +46,7 @@ Bugfixes:
- Qt: Ensure CLI backend is attached when submitting commands (fixes mgba.io/i/662)
- Core: Fix crash with rewind if savestates shrink
- Test: Fix crash when loading invalid file
- GBA Hardware: Fix crash if a savestate lies about game hardware
Misc:
- SDL: Remove scancode key input
- GBA Video: Clean up unused timers

View File

@ -76,6 +76,8 @@ static void GBAInit(void* cpu, struct mCPUComponent* component) {
gba->sio.p = gba;
GBASIOInit(&gba->sio);
GBAHardwareInit(&gba->memory.hw, NULL);
gba->springIRQ = 0;
gba->keySource = 0;
gba->rotationSource = 0;

View File

@ -77,6 +77,9 @@ void GBAHardwareClear(struct GBACartridgeHardware* hw) {
}
void GBAHardwareGPIOWrite(struct GBACartridgeHardware* hw, uint32_t address, uint16_t value) {
if (!hw->gpioBase) {
return;
}
switch (address) {
case GPIO_REG_DATA:
hw->pinState &= ~hw->direction;