Made the sanity fatal() milder in rom_load_linear() as well.

This commit is contained in:
OBattler
2020-01-16 00:40:42 +01:00
parent fd71728588
commit 9b80d4b151

View File

@@ -174,18 +174,14 @@ rom_load_linear(wchar_t *fn, uint32_t addr, int sz, int off, uint8_t *ptr)
/* Make sure we only look at the base-256K offset. */
if (addr >= 0x40000)
{
addr = 0;
}
else
{
addr &= 0x03ffff;
}
if (ptr != NULL) {
if (fseek(f, off, SEEK_SET) == -1)
fatal("rom_load_linear(): Error seeking to the beginning of the file\n");
if (fread(ptr+addr, 1, sz, f) != sz)
if (fread(ptr+addr, 1, sz, f) > sz)
fatal("rom_load_linear(): Error reading data\n");
}