aboutsummaryrefslogtreecommitdiff
path: root/src/SFileCreateArchive.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/SFileCreateArchive.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/SFileCreateArchive.cpp')
-rw-r--r--src/SFileCreateArchive.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/SFileCreateArchive.cpp b/src/SFileCreateArchive.cpp
index 206baff..fb9ed60 100644
--- a/src/SFileCreateArchive.cpp
+++ b/src/SFileCreateArchive.cpp
@@ -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