diff options
author | GaryOderNichts <12049776+GaryOderNichts@users.noreply.github.com> | 2022-03-26 19:34:34 +0100 |
---|---|---|
committer | GaryOderNichts <12049776+GaryOderNichts@users.noreply.github.com> | 2022-03-26 19:34:34 +0100 |
commit | d1b47ab454e9f20589c6b47c78e5875e19888cdf (patch) | |
tree | 707386a3277beaf1a4be3f8be875c9f11168f89d /src | |
parent | 5f6477c7f93fddf3a61c5166f661a8bb9f596730 (diff) |
Big endian fixes
Diffstat (limited to 'src')
-rw-r--r-- | src/SBaseCommon.cpp | 8 | ||||
-rw-r--r-- | src/SFileAttributes.cpp | 4 | ||||
-rw-r--r-- | src/SFilePatchArchives.cpp | 2 | ||||
-rw-r--r-- | src/StormLib.h | 2 |
4 files changed, 8 insertions, 8 deletions
diff --git a/src/SBaseCommon.cpp b/src/SBaseCommon.cpp index 1209719..f90c009 100644 --- a/src/SBaseCommon.cpp +++ b/src/SBaseCommon.cpp @@ -1926,7 +1926,7 @@ void ConvertTMPQHeader(void *header, uint16_t version) TMPQHeader * theHeader = (TMPQHeader *)header;
// Swap header part version 1
- if(version == MPQ_FORMAT_VERSION_1)
+ if(version >= MPQ_FORMAT_VERSION_1)
{
theHeader->dwID = SwapUInt32(theHeader->dwID);
theHeader->dwHeaderSize = SwapUInt32(theHeader->dwHeaderSize);
@@ -1939,21 +1939,21 @@ void ConvertTMPQHeader(void *header, uint16_t version) theHeader->dwBlockTableSize = SwapUInt32(theHeader->dwBlockTableSize);
}
- if(version == MPQ_FORMAT_VERSION_2)
+ if(version >= MPQ_FORMAT_VERSION_2)
{
theHeader->HiBlockTablePos64 = SwapUInt64(theHeader->HiBlockTablePos64);
theHeader->wHashTablePosHi = SwapUInt16(theHeader->wHashTablePosHi);
theHeader->wBlockTablePosHi = SwapUInt16(theHeader->wBlockTablePosHi);
}
- if(version == MPQ_FORMAT_VERSION_3)
+ if(version >= MPQ_FORMAT_VERSION_3)
{
theHeader->ArchiveSize64 = SwapUInt64(theHeader->ArchiveSize64);
theHeader->BetTablePos64 = SwapUInt64(theHeader->BetTablePos64);
theHeader->HetTablePos64 = SwapUInt64(theHeader->HetTablePos64);
}
- if(version == MPQ_FORMAT_VERSION_4)
+ if(version >= MPQ_FORMAT_VERSION_4)
{
theHeader->HashTableSize64 = SwapUInt64(theHeader->HashTableSize64);
theHeader->BlockTableSize64 = SwapUInt64(theHeader->BlockTableSize64);
diff --git a/src/SFileAttributes.cpp b/src/SFileAttributes.cpp index f998e47..e22a09f 100644 --- a/src/SFileAttributes.cpp +++ b/src/SFileAttributes.cpp @@ -180,7 +180,7 @@ static DWORD LoadAttributesFile(TMPQArchive * ha, LPBYTE pbAttrFile, DWORD cbAtt if((pbAttrPtr + cbArraySize) > pbAttrFileEnd)
return ERROR_FILE_CORRUPT;
- BSWAP_ARRAY32_UNSIGNED(ArrayCRC32, cbCRC32Size);
+ BSWAP_ARRAY32_UNSIGNED(ArrayCRC32, cbArraySize);
for(i = 0; i < dwAttributesEntries; i++)
ha->pFileTable[i].dwCrc32 = ArrayCRC32[i];
pbAttrPtr += cbArraySize;
@@ -196,7 +196,7 @@ static DWORD LoadAttributesFile(TMPQArchive * ha, LPBYTE pbAttrFile, DWORD cbAtt if((pbAttrPtr + cbArraySize) > pbAttrFileEnd)
return ERROR_FILE_CORRUPT;
- BSWAP_ARRAY64_UNSIGNED(ArrayFileTime, cbFileTimeSize);
+ BSWAP_ARRAY64_UNSIGNED(ArrayFileTime, cbArraySize);
for(i = 0; i < dwAttributesEntries; i++)
ha->pFileTable[i].FileTime = ArrayFileTime[i];
pbAttrPtr += cbArraySize;
diff --git a/src/SFilePatchArchives.cpp b/src/SFilePatchArchives.cpp index 89f05a0..e5fe32b 100644 --- a/src/SFilePatchArchives.cpp +++ b/src/SFilePatchArchives.cpp @@ -480,7 +480,7 @@ static bool IsMatchingPatchFile( {
// Load the patch header
SFileReadFile(hFile, &PatchHeader, sizeof(MPQ_PATCH_HEADER), &dwTransferred, NULL);
- BSWAP_ARRAY32_UNSIGNED(pPatchHeader, sizeof(DWORD) * 6);
+ BSWAP_ARRAY32_UNSIGNED(&PatchHeader, sizeof(DWORD) * 6);
// If the file contains an incremental patch,
// compare the "MD5 before patching" with the base file MD5
diff --git a/src/StormLib.h b/src/StormLib.h index d95c2a2..048281d 100644 --- a/src/StormLib.h +++ b/src/StormLib.h @@ -635,8 +635,8 @@ typedef struct _TMPQHash #else - BYTE Platform; BYTE Reserved; + BYTE Platform; USHORT lcLocale; #endif |