+ Added support for an updated Somj2hM16 protection

This commit is contained in:
Ladislav Zezula
2016-05-26 23:46:09 +02:00
parent b86b4e7f63
commit f1655f8afe
2 changed files with 13 additions and 5 deletions

View File

@@ -734,11 +734,15 @@ static int BuildFileTableFromBlockTable(
TMPQHash * pHash;
LPDWORD DefragmentTable = NULL;
DWORD dwItemCount = 0;
DWORD dwFlagMask;
// Sanity checks
assert(ha->pFileTable != NULL);
assert(ha->dwFileTableSize >= ha->dwMaxFileCount);
// MPQs for Warcraft III doesn't know some flags, namely MPQ_FILE_SINGLE_UNIT and MPQ_FILE_PATCH_FILE
dwFlagMask = (ha->dwFlags & MPQ_FLAG_WAR3_MAP) ? ~(MPQ_FILE_SINGLE_UNIT | MPQ_FILE_PATCH_FILE) : 0xFFFFFFFF;
// Defragment the hash table, if needed
if(ha->dwFlags & MPQ_FLAG_HASH_TABLE_CUT)
{
@@ -816,7 +820,7 @@ static int BuildFileTableFromBlockTable(
// Fill the rest of the file entry
pFileEntry->dwFileSize = pBlock->dwFSize;
pFileEntry->dwCmpSize = pBlock->dwCSize;
pFileEntry->dwFlags = pBlock->dwFlags;
pFileEntry->dwFlags = pBlock->dwFlags & dwFlagMask;
}
}