mirror of
https://github.com/libretro/Mesen.git
synced 2024-11-23 09:09:45 +00:00
Backport Fixed issues with PRG sizes under 256 bytes
This commit is contained in:
parent
8b5bfef788
commit
705c291209
@ -80,7 +80,13 @@ void iNesLoader::LoadRom(RomData& romData, vector<uint8_t>& romFile, NESHeader *
|
|||||||
MessageManager::Log("[iNes] Warning: File is larger than excepted (based on the file header).");
|
MessageManager::Log("[iNes] Warning: File is larger than excepted (based on the file header).");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
romData.Info.Hash.PrgCrc32 = CRC32::GetCRC(buffer, prgSize);
|
||||||
|
|
||||||
romData.PrgRom.insert(romData.PrgRom.end(), buffer, buffer + prgSize);
|
romData.PrgRom.insert(romData.PrgRom.end(), buffer, buffer + prgSize);
|
||||||
|
while(romData.PrgRom.size() < 256) {
|
||||||
|
//Ensure the PRG is at least 256 bytes in size by mirroring as needed (mapper code requires it to be 256 bytes at least)
|
||||||
|
romData.PrgRom.insert(romData.PrgRom.end(), buffer, buffer + std::min<int>(prgSize, 256 - romData.PrgRom.size()));
|
||||||
|
}
|
||||||
buffer += prgSize;
|
buffer += prgSize;
|
||||||
romData.ChrRom.insert(romData.ChrRom.end(), buffer, buffer + chrSize);
|
romData.ChrRom.insert(romData.ChrRom.end(), buffer, buffer + chrSize);
|
||||||
buffer += chrSize;
|
buffer += chrSize;
|
||||||
@ -90,8 +96,6 @@ void iNesLoader::LoadRom(RomData& romData, vector<uint8_t>& romFile, NESHeader *
|
|||||||
romData.MiscRomsData.insert(romData.MiscRomsData.end(), buffer, buffer + (dataSize - (prgSize + chrSize)));
|
romData.MiscRomsData.insert(romData.MiscRomsData.end(), buffer, buffer + (dataSize - (prgSize + chrSize)));
|
||||||
}
|
}
|
||||||
|
|
||||||
romData.Info.Hash.PrgCrc32 = CRC32::GetCRC(romData.PrgRom.data(), romData.PrgRom.size());
|
|
||||||
|
|
||||||
Log("PRG CRC32: 0x" + HexUtilities::ToHex(romData.Info.Hash.PrgCrc32, true));
|
Log("PRG CRC32: 0x" + HexUtilities::ToHex(romData.Info.Hash.PrgCrc32, true));
|
||||||
Log("PRG+CHR CRC32: 0x" + HexUtilities::ToHex(romData.Info.Hash.PrgChrCrc32, true));
|
Log("PRG+CHR CRC32: 0x" + HexUtilities::ToHex(romData.Info.Hash.PrgChrCrc32, true));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user