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 fbb8b2431b
commit 2a8ae75561
3 changed files with 6 additions and 0 deletions

View File

@ -24,6 +24,7 @@ Bugfixes:
- GBA Video: Don't update background scanline params in mode 0 (fixes mgba.io/i/377)
- 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:
- Qt: Improved HiDPI support
- Feature: Support ImageMagick 7

View File

@ -82,6 +82,8 @@ static void GBAInit(void* cpu, struct mCPUComponent* component) {
gba->timersEnabled = 0;
memset(gba->timers, 0, sizeof(gba->timers));
GBAHardwareInit(&gba->memory.hw, NULL);
gba->springIRQ = 0;
gba->keySource = 0;
gba->rotationSource = 0;

View File

@ -73,6 +73,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;