32x - fix crash, fixes #1826
Trigger condition: Any 32x rom smaller than 4MB in total size that tries to read out of bounds between its actual end and the 4MB limit I've fixed the emulator crash, but I do not know if such roms are actually mirroring correctly - they probably aren't
This commit is contained in:
parent
72c0fab145
commit
3b207f54ce
Binary file not shown.
|
@ -184,6 +184,11 @@ static unsigned char *PicoCartAlloc(int filesize, int is_sms)
|
|||
// align to 512K for memhandlers
|
||||
rom_alloc_size = (filesize + 0x7ffff) & ~0x7ffff;
|
||||
}
|
||||
if (rom_alloc_size < 0x400000) {
|
||||
// sh2 memory mapping assumes that there's at least this much readable memory
|
||||
// The comment in that code is `0x3fffff; // FIXME`, but I guess it was never fixed
|
||||
rom_alloc_size = 0x400000;
|
||||
}
|
||||
|
||||
if (rom_alloc_size - filesize < 4)
|
||||
rom_alloc_size += 4; // padding for out-of-bound exec protection
|
||||
|
|
Loading…
Reference in New Issue