mirror of https://github.com/mgba-emu/mgba.git
GBA: Cap out the ROM loaded size
This commit is contained in:
parent
4731349701
commit
07464e8f2b
|
@ -424,7 +424,10 @@ void GBALoadROM(struct GBA* gba, struct VFile* vf, struct VFile* sav, const char
|
||||||
gba->romVf = vf;
|
gba->romVf = vf;
|
||||||
gba->pristineRomSize = vf->seek(vf, 0, SEEK_END);
|
gba->pristineRomSize = vf->seek(vf, 0, SEEK_END);
|
||||||
vf->seek(vf, 0, SEEK_SET);
|
vf->seek(vf, 0, SEEK_SET);
|
||||||
gba->pristineRom = vf->map(vf, SIZE_CART0, MAP_READ);
|
if (gba->pristineRomSize > SIZE_CART0) {
|
||||||
|
gba->pristineRomSize = SIZE_CART0;
|
||||||
|
}
|
||||||
|
gba->pristineRom = vf->map(vf, gba->pristineRomSize, MAP_READ);
|
||||||
if (!gba->pristineRom) {
|
if (!gba->pristineRom) {
|
||||||
GBALog(gba, GBA_LOG_WARN, "Couldn't map ROM");
|
GBALog(gba, GBA_LOG_WARN, "Couldn't map ROM");
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue