all repos — mgba @ 9150a79efd85450df02ba70908dbfcc3f27924b2

mGBA Game Boy Advance Emulator

GBA: Extend oddly-sized ROMs to full address space (fixes #722)
Vicki Pfau vi@endrift.com
Sun, 09 Jul 2017 09:59:05 -0700
commit

9150a79efd85450df02ba70908dbfcc3f27924b2

parent

691600902c18fbee18ba8ab12cefed8403b3c7ae

2 files changed, 11 insertions(+), 0 deletions(-)

jump to
M CHANGESCHANGES

@@ -4,6 +4,7 @@ - GB Audio: Fix zombie mode bit masking

- GB Audio: Make audio unsigned with bias (fixes mgba.io/i/749) Misc: - GBA Timer: Use global cycles for timers + - GBA: Extend oddly-sized ROMs to full address space (fixes mgba.io/i/722) 0.6.0: (Future) Features:
M src/gba/gba.csrc/gba/gba.c

@@ -342,6 +342,16 @@ 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 _3DS + void* newRom = anonymousMemoryMap(SIZE_CART0); + memcpy(newRom, gba->memory.rom, gba->pristineRomSize); + gba->memory.rom = newRom; +#endif + gba->memory.romSize = SIZE_CART0; + gba->isPristine = false; + } // TODO: error check return true; }