aboutsummaryrefslogtreecommitdiff
path: root/src/SFileVerify.cpp
diff options
context:
space:
mode:
authorunknown <E:\Ladik\Mail>2015-05-01 07:06:29 +0200
committerunknown <E:\Ladik\Mail>2015-05-01 07:06:29 +0200
commit46930855f500c1b494e3b16bb7a3323c07d4d5fb (patch)
tree6220cc643761137a930841d8ec828db9f3db53cf /src/SFileVerify.cpp
parenta205159d004871efbedd7cbfb686b8fe82bfb532 (diff)
+ 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
Diffstat (limited to 'src/SFileVerify.cpp')
-rw-r--r--src/SFileVerify.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/SFileVerify.cpp b/src/SFileVerify.cpp
index 65bad00..45ff58e 100644
--- a/src/SFileVerify.cpp
+++ b/src/SFileVerify.cpp
@@ -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++;
}