Blizzard MPQ

From XentaxWiki

Jump to: navigation, search

Back to index | Edit this page

Contents

BAG

Format Type:   Archive
Endianness:   Little-endian
Date Posted:   17:37, 19 June 2008 (CDT)

Format Specifications

// Archive Header
byte {3}     - Header (MPQ)
byte {1}     - Header/shunt indicator (1A = Header, 1B = Shunt)
if (shunt) {
uint32 {4}   - Unknown
uint32 {4}   - Offset to header (relative to the beginning of the shunt)
}
else if (header) {
uint32 {4}   - Header length
uint32 {4}   - Archive length (Deprecated in World of Warcraft: The Burning Crusade)
uint16 {2}   - Version (0 = Original, 1 = Extended (World of Warcraft: The Burning Crusade and newer)
uint16 {2}   - Block size (Actual block size is calculated with 512 * 2blockSize; because of bugs in the Storm library, this should always be 3 (giving a size of 4096 bytes))
uint32 {4}   - Offset to hash table
uint32 {4}   - Offset to block table
uint32 {4}   - Number of hash table entries (Must be a power of 2, and must be < 216 for the original format, or < 220 for World of Warcraft: The Burning Crusade and later)
uint32 {4}   - Number of block table entries
if (formatVersion = 1) {
uint64 {8}   - Offset to extended block table
uint16 {2}   - High 16 bits of hash table offset for large archives
uint16 {2}   - High 16 bits of block table offset for large archives
}
}

// Hash Table (always encrypted)

// for each file
uint32 {4}   - File path hash (Hash method A)
uint32 {4}   - File path hash (Hash method B)
uint16 {2}   - File locale (Windows LANGID data type; 0 = American English or language-neutral; see also file locale table in Notes and Comments)
uint16 {2}   - File platform (0 = Default; always 0?)
uint32 {4}   - Block table index (If hash table entry is not valid, FFFFFFFF = hash entry is and always was empty (file never existed, file search ends), FFFFFFFE = hash entry is but not always was empty (file was deleted, file search continues))

// Block Table (always encrypted)

// for each file
uint32 {4}   - File offset
uint32 {4}   - Compressed file size
uint32 {4}   - Uncompressed file size
uint32 {4}   - Flags (See also block table flags in Notes and Comments)

// Extended block table (always unencrypted, only if formatVersion = 1)

for each file
uint16 {2}   - High 16 bits of file offset

// File data

// Block Offset Table (blockNumber + 1)
// for each block
uint32 {4}   - Block offset (Final entry stores size of last block)
// for each block
byte {x}     - File data (If data is uncompressed, size is indicated by 512 * 2blockSize (normally 4096 bytes), if data is compressed, size is variable)

Notes and Comments

MPQ files are designed such that they can be inserted into other file types. Blizzard has made use of this by packing MPQ files into executables in a number of their games. The Install.exe file on StarCraft and StarCraft: Brood War installation CDs are actually MPQ files with a different extension.

File locale table

This table lists possible values in the File locale field in hash table entries

Value Language/Locale Value Language/Locale
0 Neutral/English (American) 410 Italian
404 Chinese (Taiwan) 411 Japanese
405 Czech 412 Korean
407 German 415 Polish
409 English 416 Portuguese
40A Spanish 419 Russian
40C French 809 English (UK)

Block table flags

This table lists possible flags used in the block table

Flag name Value Bit number Meaning
MPQ_FILE_IMPLODE 0x00000100 9 File uses PKWARE data compression library
MPQ_FILE_COMPRESS 0x00000200 10 File uses more than one compression method
MPQ_FILE_ENCRYPTED 0x00010000 17 File uses encryption
MPQ_FILE_FIXSEED 0x00020000 18 File's decryption key is altered according to file's position in archive
MPQ_FILE_SINGLE_UNIT 0x01000000 25 File is stored contiguously, instead of in 4096-byte blocks
MPQ_FILE_DUMMY_FILE 0x02000000 26 File is 0 or 1 bytes long and its name is a hash
MPQ_FILE_HAS_EXTRA 0x04000000 27 File has extra data appended to end of regular data; file must be compressed
MPQ_FILE_EXISTS 0x80000000 32 Set if file exists, clear if file was deleted

MexScript

BMS script not applicable.

Supported by Programs

Links

Games

Navigation

Format lists
All Formats · Common Formats · Standard Formats · Malformed Pages
Platforms
Microsoft:
Xbox
Xbox 360
Nintendo:
GameCube
Desktop:
PC
Sega:
Dreamcast
Sony:
PlayStation
PlayStation 2
PlayStation 3
PlayStation Portable
Format Type
Archive · Audio · Miscellaneous · Video/Graphics
Endianness
Little Endian · Big Endian
BMS Scripts
Pages Without a BMS Script · Wrong Format Type for a Script

All Pages with Scripts:
Recently Added Scripts

Program support
No Known Support

MultiEx Commander · Game Extractor · Dragon UnPACKer

Format Specification Completion
Work in Progress · Almost Done · Completed
Compression and Encryption
No Compression or Encryption Used · Unknown Compression or Encryption Used

One or Both Used:
Compression Used · Encryption used · Both Compression and Encryption Used

Personal tools

affiliates

  • Gmbutton.gif