From: ShadowFlare Date: Sat, 2 Jan 2010 23:35:21 +0000 (-0700) Subject: Add structures needed for large archive support. X-Git-Url: https://sfsrealm.hopto.org/projects/gitweb.cgi?a=commitdiff_plain;h=b54fa405fd2c0d0b3c8ddbd55297b37cdeb833b5;p=SFmpqapi.git Add structures needed for large archive support. --- diff --git a/SFmpqapi.cpp b/SFmpqapi.cpp index bd4164d..e89bf42 100644 --- a/SFmpqapi.cpp +++ b/SFmpqapi.cpp @@ -375,7 +375,7 @@ BOOL WINAPI MpqOpenArchiveEx(LPCSTR lpFileName, DWORD dwPriority, DWORD dwFlags, } memcpy(&mpqOpenArc->MpqHeader.dwMPQID,ID_MPQ,4); mpqOpenArc->MpqHeader.dwHeaderSize = sizeof(MPQHEADER); - mpqOpenArc->MpqHeader.wUnused0C = 0; + mpqOpenArc->MpqHeader.wVersion = 0; if (dwBlockSize & 0xFFFF0000) mpqOpenArc->MpqHeader.wBlockSize = DEFAULT_BLOCK_SIZE; else diff --git a/SFmpqapi.h b/SFmpqapi.h index 7cef69b..768bff4 100644 --- a/SFmpqapi.h +++ b/SFmpqapi.h @@ -309,6 +309,7 @@ struct FILELISTENTRY { struct MPQARCHIVE; struct MPQFILE; struct MPQHEADER; +struct MPQHEADER_EX; struct BLOCKTABLEENTRY; struct HASHTABLEENTRY; @@ -316,7 +317,7 @@ struct MPQHEADER { DWORD dwMPQID; //"MPQ\x1A" for mpq's, "BN3\x1A" for bncache.dat DWORD dwHeaderSize; // Size of this header DWORD dwMPQSize; //The size of the mpq archive - WORD wUnused0C; // Seems to always be 0 + WORD wVersion; // 0 for original format, 1 for large archive WORD wBlockSize; // Size of blocks in files equals 512 << wBlockSize DWORD dwHashTableOffset; // Offset to hash table DWORD dwBlockTableOffset; // Offset to block table @@ -324,6 +325,13 @@ struct MPQHEADER { DWORD dwBlockTableSize; // Number of entries in block table }; +// Large archive format only +struct MPQHEADER_EX { + UINT64 qwExtendedBlockOffsetTable; // Offset to table containing upper 16 bits of block offsets + WORD wHashTableOffsetHigh; // High 16 bits of the hash table offset for large archives + WORD wBlockTableOffsetHigh; // High 16 bits of the block table offset for large archives +}; + #include //Archive handles may be typecasted to this struct so you can access @@ -355,6 +363,8 @@ struct MPQARCHIVE { DWORD dwFlags; //The only flags that should be changed are MOAU_MAINTAIN_LISTFILE and MOAU_MAINTAIN_ATTRIBUTES, changing any others can have unpredictable effects LPSTR lpFileName; DWORD dwExtraFlags; + MPQHEADER_EX MpqHeader_Ex; + WORD * lpFileOffsetsHigh; }; //Handles to files in the archive may be typecasted to this struct @@ -381,6 +391,7 @@ struct MPQFILE { // Extra struct members used by SFmpq HASHTABLEENTRY *lpHashEntry; LPSTR lpFileName; + WORD wFileOffsetHigh; }; #include