GBA: Cap out the ROM loaded size

This commit is contained in:
Jeffrey Pfau 2014-12-10 01:44:22 -08:00
parent 4731349701
commit 07464e8f2b
1 changed files with 4 additions and 1 deletions

View File

@ -424,7 +424,10 @@ void GBALoadROM(struct GBA* gba, struct VFile* vf, struct VFile* sav, const char
gba->romVf = vf;
gba->pristineRomSize = vf->seek(vf, 0, SEEK_END);
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) {
GBALog(gba, GBA_LOG_WARN, "Couldn't map ROM");
return;