GBA: Fix RTC on non-standard sized ROMs (fixes #1400)

This commit is contained in:
Vicki Pfau 2019-05-02 16:20:49 -07:00
parent 98a368daad
commit ba6c00637a
2 changed files with 3 additions and 2 deletions

View File

@ -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)

View File

@ -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;
}