mirror of
https://github.com/ladislav-zezula/StormLib.git
synced 2026-01-21 15:14:28 +01:00
+ 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:
@@ -159,21 +159,21 @@ bool WINAPI SFileCreateArchive2(const TCHAR * szMpqName, PSFILE_CREATE_MPQ pCrea
|
||||
// Increment the maximum amount of files to have space for (listfile)
|
||||
if(pCreateInfo->dwMaxFileCount && pCreateInfo->dwFileFlags1)
|
||||
{
|
||||
dwMpqFlags |= MPQ_FLAG_LISTFILE_INVALID;
|
||||
dwMpqFlags |= MPQ_FLAG_LISTFILE_NEW;
|
||||
dwReservedFiles++;
|
||||
}
|
||||
|
||||
// Increment the maximum amount of files to have space for (attributes)
|
||||
if(pCreateInfo->dwMaxFileCount && pCreateInfo->dwFileFlags2 && pCreateInfo->dwAttrFlags)
|
||||
{
|
||||
dwMpqFlags |= MPQ_FLAG_ATTRIBUTES_INVALID;
|
||||
dwMpqFlags |= MPQ_FLAG_ATTRIBUTES_NEW;
|
||||
dwReservedFiles++;
|
||||
}
|
||||
|
||||
// Increment the maximum amount of files to have space for (signature)
|
||||
if(pCreateInfo->dwMaxFileCount && pCreateInfo->dwFileFlags3)
|
||||
{
|
||||
dwMpqFlags |= MPQ_FLAG_SIGNATURE_INVALID;
|
||||
dwMpqFlags |= MPQ_FLAG_SIGNATURE_NEW;
|
||||
dwReservedFiles++;
|
||||
}
|
||||
|
||||
@@ -256,11 +256,7 @@ bool WINAPI SFileCreateArchive2(const TCHAR * szMpqName, PSFILE_CREATE_MPQ pCrea
|
||||
// Create initial file table
|
||||
if(nError == ERROR_SUCCESS && ha->dwMaxFileCount != 0)
|
||||
{
|
||||
ha->pFileTable = STORM_ALLOC(TFileEntry, ha->dwMaxFileCount);
|
||||
if(ha->pFileTable != NULL)
|
||||
memset(ha->pFileTable, 0x00, sizeof(TFileEntry) * ha->dwMaxFileCount);
|
||||
else
|
||||
nError = ERROR_NOT_ENOUGH_MEMORY;
|
||||
nError = CreateFileTable(ha, ha->dwMaxFileCount);
|
||||
}
|
||||
|
||||
// Cleanup : If an error, delete all buffers and return
|
||||
|
||||
Reference in New Issue
Block a user