Defined Types



MPQADPCMQuality


ADPCM compression quality constants.

typedef enum { 
    MPQADPCMQuality4Bits = 4, 
    MPQADPCMQuality2Bits = 2 
} MPQADPCMQuality; 
Constants
MPQADPCMQuality4Bits
Uses 4 bits per sample.
MPQADPCMQuality2Bits
Uses 2 bits per sample.
Discussion

ADPCM compression is only suitable for audio data, and doesn't really compete with more advanced codecs such as MP3, AAC or Vorbis.


MPQAttributesFlag


Valid file attributes constants.

typedef enum { 
    MPQHasCRC = 0x1, 
    MPQHasFiletime = 0x2, 
    MPQHasMD5 = 0x4 
} MPQAttributesFlag; 
Constants
MPQHasCRC
Indicates files have CRC checksums.
MPQHasFiletime
Indicates files have file time information.
MPQHasMD5
Indicates files have MD5 checksums.

MPQCompressorFlag


Valid compressor constants.

typedef enum { 
    MPQPKWARECompression = 0x08, 
    MPQStereoADPCMCompression = 0x81, 
    MPQBZIP2Compression = 0x10, 
    MPQZLIBCompression = 0x02 
} MPQCompressorFlag; 
Constants
MPQPKWARECompression
The standard PKWARE compressor which appeared in Starcraft. You will need to use this compressor for new files in archives that will be used by Starcraft or Diablo II. Note that the Mac OS X version of Starcraft and Diablo II support the zlib compressor as well.

This compressor does not have a compression quality parameter.
MPQStereoADPCMCompression
ADPCM compressor suitable for audio data. Offers a 4:1 compression ratio. Huffman coding is applied on the ADPCM data to further compress the bitstream.

The default compression quality for this compressor is MPQADPCMQualityHigh (see MPQADPCMQuality for details).
MPQBZIP2Compression
The bzip2 compressor was added in World of Warcraft. Offers slightly better compression ratios than zlib.

The default compression quality for this compressor is 0. Please refer to the bzip2 documentation for more information.
MPQZLIBCompression
The zlib compressor was added in Warcraft 3. It is the default compressor.

The default compression quality for this compressor is Z_DEFAULT_COMPRESSION. Please refer to the zlib documentation for more information.
Discussion

You can use the following constants to specify which compression algorithm should be used to compress a particular file, or to set the default compressor for a particular archive. Note that ADPCM compression is only suitable for audio data and will destroy binary data (it is a lossy compression algorithm).


MPQFileDisplacementMode


Valid MPQFile file seeking constants.

typedef enum { 
    MPQFileStart = 0, 
    MPQFileCurrent = 1, 
    MPQFileEnd = 2 
} MPQFileDisplacementMode; 
Constants
MPQFileStart
Seeking is done with respect to the beginning of the file and toward the end of file. In effect, this makes nDistanceToMove an absolute file offset to seek to.
MPQFileCurrent
Seeking is done with respect to the current file pointer and toward the end of file. If nDistanceToMove will move the file pointer beyond the end of file, the file pointer is moved to the end of file.
MPQFileEnd
Seeking is done with respect to the end of file and toward the beginning of the file. If nDistanceToMove will move the file pointer to a negative position, the file pointer is moved to the beginning of the file.

MPQFileFlag


Valid MPQ file flag constants.

typedef enum { 
    MPQFileValid = 0x80000000, 
    MPQFileHasMetadata = 0x04000000, 
    MPQFileDummy = 0x02000000, 
    MPQFileOneSector = 0x01000000, 
    MPQFileOffsetAdjustedKey = 0x00020000, 
    MPQFileEncrypted = 0x00010000, 
    MPQFileCompressed = 0x00000200, 
    MPQFileDiabloCompressed = 0x00000100, 
    MPQFileFlagsMask = 0x87030300 
} MPQFileFlag; 
Constants
MPQFileValid
Marks the file as valid. Automatically added by the framework when a new file is added.
MPQFileHasMetadata
Indicates the file has associated metadata.
MPQFileOneSector
File is compressed in a single large sector.
MPQFileOffsetAdjustedKey
Indicates that this file's encryption key has been offset adjusted. As such, that file's name will be required for rename and compaction operations because if it needs to be moved inside the MPQ archive, it will have to be recompressed and/or reencrypted. It is not recommended to offset adjust file keys.
MPQFileEncrypted
Indicates that the file either should be encrypted upon addition or is encrypted for existing files.
MPQFileCompressed
Indicates that the file either should be compressed upon addition or is compressed for existing files. Compression will use the default compressor and compression quality for the selected compressor unless they are overridden by addition parameters.
MPQFileDiabloCompressed
This flag indicates the file should be or is compressed using PKWARE compression. When this flag is used for addition, the PKWARE compressor will be used for the file regardless of addition parameters or the currently set default compressor. The only reason to use this flag is to produce an archive that will be compatible with Diablo.
MPQFileFlagsMask
A bit mask for valid MPQ file flags.

MPQLocale


Valid MPQ file locale constants.

typedef enum { 
    MPQNeutral = 0, 
    MPQChinese = 0x404, 
    MPQCzech = 0x405, 
    MPQGerman = 0x407, 
    MPQEnglish = 0x409, 
    MPQSpanish = 0x40a, 
    MPQFrench = 0x40c, 
    MPQItalian = 0x410, 
    MPQJapanese = 0x411, 
    MPQKorean = 0x412, 
    MPQDutch = 0x413, 
    MPQPolish = 0x415, 
    MPQPortuguese = 0x416, 
    MPQRusssian = 0x419, 
    MPQEnglishUK = 0x809 
} MPQLocale; 
Constants
MPQNeutral
The default locale. Should be used for any non-localizable files, such as textures, binary tables, executables, etc.
MPQChinese
Chinese (Taiwan) locale constant.
MPQCzech
Czech locale constant.
MPQGerman
German locale constant.
MPQEnglish
English locale constant.
MPQSpanish
Spanish locale constant.
MPQFrench
French locale constant.
MPQItalian
Italian locale constant.
MPQJapanese
Japanese locale constant.
MPQKorean
Korean locale constant.
MPQDutch
Dutch locale constant.
MPQPolish
Polish locale constant.
MPQPortuguese
Portuguese locale constant.
MPQRusssian
Russsian locale constant.
MPQEnglishUK
English (UK) locale constant.
Discussion

MPQ files have a locale attribute which is used in combination with the file path to identify uniquely the file inside a given archive. That means you can have multiple files with the same path and name but with a different locale inside the same archive. The use of locale values seems deprecated by Blizzard.


MPQVersion


High-level constants for known MPQ versions.

typedef enum { 
    MPQOriginalVersion = 0, 
    MPQExtendedVersion = 1, 
} MPQVersion; 
Constants
MPQOriginalVersion
The original archive format.
MPQExtendedVersion
The extended archive format.

(Last Updated April 02, 2007)