diff options
Diffstat (limited to 'src/SBaseCommon.cpp')
-rw-r--r-- | src/SBaseCommon.cpp | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/SBaseCommon.cpp b/src/SBaseCommon.cpp index 062a737..b4d62e0 100644 --- a/src/SBaseCommon.cpp +++ b/src/SBaseCommon.cpp @@ -97,7 +97,7 @@ unsigned char AsciiToUpperTable_Slash[256] = #define STORM_BUFFER_SIZE 0x500 -#define HASH_INDEX_MASK(ha) (ha->dwHashTableSize ? (ha->dwHashTableSize - 1) : 0) +#define HASH_INDEX_MASK(ha) (ha->pHeader->dwHashTableSize ? (ha->pHeader->dwHashTableSize - 1) : 0) static DWORD StormBuffer[STORM_BUFFER_SIZE]; // Buffer for the decryption engine static bool bMpqCryptographyInitialized = false; @@ -624,7 +624,8 @@ TMPQHash * GetNextHashEntry(TMPQArchive * ha, TMPQHash * pFirstHash, TMPQHash * // Allocates an entry in the hash table TMPQHash * AllocateHashEntry( TMPQArchive * ha, - TFileEntry * pFileEntry) + TFileEntry * pFileEntry, + LCID lcLocale) { TMPQHash * pHash; DWORD dwStartIndex = ha->pfnHashString(pFileEntry->szFileName, MPQ_HASH_TABLE_INDEX); @@ -632,18 +633,15 @@ TMPQHash * AllocateHashEntry( DWORD dwName2 = ha->pfnHashString(pFileEntry->szFileName, MPQ_HASH_NAME_B); // Attempt to find a free hash entry - pHash = FindFreeHashEntry(ha, dwStartIndex, dwName1, dwName2, pFileEntry->lcLocale); + pHash = FindFreeHashEntry(ha, dwStartIndex, dwName1, dwName2, lcLocale); if(pHash != NULL) { // Fill the free hash entry pHash->dwName1 = dwName1; pHash->dwName2 = dwName2; - pHash->lcLocale = pFileEntry->lcLocale; - pHash->wPlatform = pFileEntry->wPlatform; + pHash->lcLocale = (USHORT)lcLocale; + pHash->wPlatform = 0; pHash->dwBlockIndex = (DWORD)(pFileEntry - ha->pFileTable); - - // Fill the hash index in the file entry - pFileEntry->dwHashIndex = (DWORD)(pHash - ha->pHashTable); } return pHash; @@ -1405,8 +1403,6 @@ void FreeFileHandle(TMPQFile *& hf) // Then free all buffers allocated in the file structure if(hf->pbFileData != NULL) STORM_FREE(hf->pbFileData); - if(hf->pPatchHeader != NULL) - STORM_FREE(hf->pPatchHeader); if(hf->pPatchInfo != NULL) STORM_FREE(hf->pPatchInfo); if(hf->SectorOffsets != NULL) |