Applied Chrono's UPS Fix patch

This commit is contained in:
squall-leonhart 2009-08-29 21:04:19 +00:00
parent 2e608ad0ba
commit 592843e4f4
1 changed files with 14 additions and 5 deletions

View File

@ -232,16 +232,25 @@ static bool patchApplyUPS(const char *patchname, u8 **rom, int *size)
s64 dstSize = readVarPtr(f); s64 dstSize = readVarPtr(f);
if (crc == srcCRC) { if (crc == srcCRC) {
dataSize = srcSize; if (srcSize != *size) {
} else if (crc == dstCRC) { fclose(f);
return false;
}
dataSize = dstSize; dataSize = dstSize;
} else if (crc == dstCRC) {
if (dstSize != *size) {
fclose(f);
return false;
}
dataSize = srcSize;
} else { } else {
fclose(f); fclose(f);
return false; return false;
} }
if (dataSize != *size) { if (dataSize > *size) {
fclose(f); *rom = (u8*)realloc(*rom, dataSize);
return false; memset(*rom + *size, 0, dataSize - *size);
*size = dataSize;
} }
s64 relative = 0; s64 relative = 0;