mirror of https://github.com/mgba-emu/mgba.git
GBA: Fix some patch loading edge cases
This commit is contained in:
parent
aa3f4c0e6e
commit
a5c12df57f
2
CHANGES
2
CHANGES
|
@ -1,6 +1,8 @@
|
||||||
0.9.3: (Future)
|
0.9.3: (Future)
|
||||||
Emulation fixes:
|
Emulation fixes:
|
||||||
- GBA SIO: Fix SI value for unattached MULTI mode
|
- GBA SIO: Fix SI value for unattached MULTI mode
|
||||||
|
Other fixes:
|
||||||
|
- GBA: Fix out of bounds ROM accesses on patched ROMs smaller than 32 MiB
|
||||||
|
|
||||||
0.9.2: (2021-07-10)
|
0.9.2: (2021-07-10)
|
||||||
Emulation fixes:
|
Emulation fixes:
|
||||||
|
|
|
@ -501,7 +501,11 @@ void GBAApplyPatch(struct GBA* gba, struct Patch* patch) {
|
||||||
}
|
}
|
||||||
if (gba->romVf) {
|
if (gba->romVf) {
|
||||||
#ifndef FIXED_ROM_BUFFER
|
#ifndef FIXED_ROM_BUFFER
|
||||||
|
if (!gba->isPristine) {
|
||||||
|
mappedMemoryFree(gba->memory.rom, SIZE_CART0);
|
||||||
|
} else {
|
||||||
gba->romVf->unmap(gba->romVf, gba->memory.rom, gba->pristineRomSize);
|
gba->romVf->unmap(gba->romVf, gba->memory.rom, gba->pristineRomSize);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
gba->romVf->close(gba->romVf);
|
gba->romVf->close(gba->romVf);
|
||||||
gba->romVf = NULL;
|
gba->romVf = NULL;
|
||||||
|
@ -510,7 +514,7 @@ void GBAApplyPatch(struct GBA* gba, struct Patch* patch) {
|
||||||
gba->memory.rom = newRom;
|
gba->memory.rom = newRom;
|
||||||
gba->memory.hw.gpioBase = &((uint16_t*) gba->memory.rom)[GPIO_REG_DATA >> 1];
|
gba->memory.hw.gpioBase = &((uint16_t*) gba->memory.rom)[GPIO_REG_DATA >> 1];
|
||||||
gba->memory.romSize = patchedSize;
|
gba->memory.romSize = patchedSize;
|
||||||
gba->memory.romMask = SIZE_CART0 - 1;
|
gba->memory.romMask = toPow2(patchedSize) - 1;
|
||||||
gba->romCrc32 = doCrc32(gba->memory.rom, gba->memory.romSize);
|
gba->romCrc32 = doCrc32(gba->memory.rom, gba->memory.romSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue