diff --git a/CHANGES b/CHANGES index 049717040..b45c44b86 100644 --- a/CHANGES +++ b/CHANGES @@ -21,6 +21,7 @@ Emulation fixes: - GB Video: Fix more window edge cases (fixes mgba.io/i/1346) - GB Timer: Fix timing adjustments when writing to TAC (fixes mgba.io/i/1340) - GBA Memory: Fix writing to OBJ memory in modes 3 and 5 + - GBA: Fix RTC on non-standard sized ROMs (fixes mgba.io/i/1400) Other fixes: - Qt: More app metadata fixes - Qt: Fix load recent from archive (fixes mgba.io/i/1325) diff --git a/src/gba/gba.c b/src/gba/gba.c index e144ce45a..4434fc526 100644 --- a/src/gba/gba.c +++ b/src/gba/gba.c @@ -405,8 +405,6 @@ bool GBALoadROM(struct GBA* gba, struct VFile* vf) { gba->memory.romMask = toPow2(gba->memory.romSize) - 1; gba->memory.mirroring = false; gba->romCrc32 = doCrc32(gba->memory.rom, gba->memory.romSize); - GBAHardwareInit(&gba->memory.hw, &((uint16_t*) gba->memory.rom)[GPIO_REG_DATA >> 1]); - GBAVFameDetect(&gba->memory.vfame, gba->memory.rom, gba->memory.romSize); if (popcount32(gba->memory.romSize) != 1) { // This ROM is either a bad dump or homebrew. Emulate flash cart behavior. #ifndef FIXED_ROM_BUFFER @@ -421,6 +419,8 @@ bool GBALoadROM(struct GBA* gba, struct VFile* vf) { if (gba->cpu && gba->memory.activeRegion >= REGION_CART0) { gba->cpu->memory.setActiveRegion(gba->cpu, gba->cpu->gprs[ARM_PC]); } + GBAHardwareInit(&gba->memory.hw, &((uint16_t*) gba->memory.rom)[GPIO_REG_DATA >> 1]); + GBAVFameDetect(&gba->memory.vfame, gba->memory.rom, gba->memory.romSize); // TODO: error check return true; }