+ Removed back reference of FileTable -> HashTable, as it is logically incorrect

+ Optimized patching process so it consimes less memory
+ Added hash table and block table defragmenting for malformed War3 maps
This commit is contained in:
unknown
2015-05-01 07:06:29 +02:00
parent a205159d00
commit 46930855f5
19 changed files with 1443 additions and 1610 deletions

View File

@@ -790,6 +790,7 @@ int SSignFileCreate(TMPQArchive * ha)
if(ha->dwFileFlags3 != 0)
{
// The (signature) file must be non-encrypted and non-compressed
assert(ha->dwFlags & MPQ_FLAG_SIGNATURE_NEW);
assert(ha->dwFileFlags3 == MPQ_FILE_EXISTS);
assert(ha->dwReservedFiles > 0);
@@ -809,11 +810,11 @@ int SSignFileCreate(TMPQArchive * ha)
memset(EmptySignature, 0, sizeof(EmptySignature));
nError = SFileAddFile_Write(hf, EmptySignature, (DWORD)sizeof(EmptySignature), 0);
SFileAddFile_Finish(hf);
}
// Clear the invalid mark
ha->dwFlags &= ~MPQ_FLAG_SIGNATURE_INVALID;
ha->dwReservedFiles--;
// Clear the invalid mark
ha->dwFlags &= ~(MPQ_FLAG_SIGNATURE_NEW | MPQ_FLAG_SIGNATURE_NONE);
ha->dwReservedFiles--;
}
}
return nError;
@@ -1043,7 +1044,7 @@ bool WINAPI SFileSignArchive(HANDLE hMpq, DWORD dwSignatureType)
{
// Turn the signature on. The signature will
// be applied when the archive is closed
ha->dwFlags |= MPQ_FLAG_SIGNATURE_INVALID | MPQ_FLAG_CHANGED;
ha->dwFlags |= MPQ_FLAG_SIGNATURE_NEW | MPQ_FLAG_CHANGED;
ha->dwFileFlags3 = MPQ_FILE_EXISTS;
ha->dwReservedFiles++;
}