MPQSharedConstants.h


Discussion

This header is automatically included by MPQ.h and provides common defines and constants used by the MPQ framework.

Typedefs


MPQCompressionType


Valid compressor constants.
typedef enum {
MPQDCLCompression = 0x08,
MPQWAVCompression = 0x81,
MPQZLIBCompression = 0x02
} MPQCompressionType;

Note that although WAV compression is mentioned here, you may not actually set it as the default compressor or use it in a addition parameters dictionary. Instead, specify DCL compression and set the quality to something else than MPQWavQualityNone.

Constants

MPQDCLCompression
The standard DCL 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.
MPQWAVCompression
A modified version of the DCL compressor which also uses a Huffman compression algorithm and some PCM compression algorithms. You cannot actually set this compressor as the default compressior. WAV compression will be used whenever the DCL compression quality is different than MPQWavQualityNone.
MPQZLIBCompression
The zlib compressors uses the standard zlib library. It is the default framework compressor and is recommended in most cases.

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 flags constants.
typedef enum {
MPQFileValid = 0x80000000,
MPQFileUnknown = 0x40000000,
MPQOffsetAdjustKey = 0x00020000,
MPQEncrypt = 0x00010000,
MPQCompress = 0x00000200,
MPQCompressDiablo = 0x00000100,
MPQReplaceExisting = 0x00000001,
MPQFlagsMask = 0x80030300
} MPQFileFlag;

Constants

MPQFileValid
Marks the file as valid. Automatically added my the framework when a new file is added.
MPQFileUnknown
Unknown file flag.
MPQOffsetAdjustKey
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.
MPQEncrypt
Indicates that the file either should be encrypted upon addition or is encrypted for existing files.
MPQCompress
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 if those are not overridden by addition parameters.
MPQCompressDiablo
Indicates that the file either should be compressed using Diablo compression or is compressed using Diablo compression for existing files. It is not recommended to use Diablo compression.
MPQReplaceExisting
Indicates that upon addition, the framework should delete any conflicting file before proceeding. Otherwise, if a file that hashes to the same hash table position exists (whether is exists or is a deleted file), addition will fail. This flag is actually not part of the MPQ specification and will be dropped upon saving.
MPQFlagsMask
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;

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.

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.

MPQWavQuality


Valid DCL compression quality constants.
typedef enum {
MPQWavQualityHigh = 0,
MPQWavQualityMedium = 1,
MPQWavQualityLow = 2,
MPQWavQualityNone = 0xffffffff
} MPQWavQuality;

MPQWavQualityNone will make the framework use regular DCL compression, while any other constant will make it use WAV compression.

Constants

MPQWavQualityHigh
Does not reduce the qualitty by much, but doesn't compress much either.
MPQWavQualityMedium
The best compromise between quality and compression ratio. Recommended for WAV compression.
MPQWavQualityLow
Will reduce the quality too much to generally be recommended.
MPQWavQualityNone
Switches the DCL compressor to operate in standard mode. This is the default quality for the DCL compressor.

MPQZLIBQuality


Valid zlib compression quality constants.
typedef enum {
MPQZLIBQualityNone = 0,
MPQZLIBQualityDefault = -1,
MPQZLIBQualitySpeed = 1,
MPQZLIBQualityBest = 9
} MPQZLIBQuality;

Those constants are aliases to the compression constants declared in zlib.h. Generally speaking, you may give any valid zlib quality value to the framework when using the zlib compressor.

Constants

MPQZLIBQualityNone
Very little if no compression at all. Not recommended, since you might as well not compress the file if this quality is used.
MPQZLIBQualityDefault
The default zlib compression value. This is the default quality for the zlib compressor.
MPQZLIBQualitySpeed
The fastest compression quality, but will not compress files as much as one may desire.
MPQZLIBQualityBest
This will yield the best compression ration zlib has to offer. Probably slower than the other modes, but generally this quality is recommended unless compression speed is critical.

#defines


MAX_MPQ_PATH



#define MAX_MPQ_PATH 260

This defines the maximum length in bytes of MPQ file paths. Note that MPQS use regular ANSI C strings.


MPQAddCompressor



#define MPQAddCompressor @"Compressor"

Key for the compressor inside file addition parameters dictionaries. Note that this will override the default compressor for that specific file only.


MPQAddFlags



#define MPQAddFlags @"Flags"

Key for the file flags inside file addition parameters dictionaries.


MPQAddLocale



#define MPQAddLocale @"Locale"

Key for the file locale inside file addition parameters dictionaries.


MPQAddQuality



#define MPQAddQuality @"Quality"

Key for the compression quality inside file addition parameters dictionaries. Note that for DCL compression, this will determine if WAV-Huffman compression or regular DCL compression is used. Default is regular DCL compression.


MPQArchiveLength



#define MPQArchiveLength @"Length"

Key for the archive length inside archive information dictionaries.


MPQArchiveOffset



#define MPQArchiveOffset @"Offset"

Key for the archive offset inside archive information dictionaries.


MPQArchivePath



#define MPQArchivePath @"Path"

Key for the archive path inside archive information dictionaries.


MPQBlockSize



#define MPQBlockSize @"BlockSize"

Key for the archive block size inside archive information dictionaries.


MPQFileCRC



#define MPQFileCRC @"CRC"

Key for the file CRC inside file information dictionaries.


MPQFileCompressedLength



#define MPQFileCompressedLength @"CompressedLength"

Key for compressed file length inside file information dictionaries.


MPQFileCreationDate



#define MPQFileCreationDate @"CreationDate"

Key for the file creation date inside file information dictionaries.


MPQFileFlags



#define MPQFileFlags @"Flags"

Key for the file flags inside file information dictionaries.


MPQFileHashA



#define MPQFileHashA @"HashA"

Key for the file hash A inside file information dictionaries.


MPQFileHashB



#define MPQFileHashB @"HashB"

Key for the file hash B inside file information dictionaries.


MPQFileHashPosition



#define MPQFileHashPosition @"Position"

Key for the file hash position inside file information dictionaries.


MPQFileLength



#define MPQFileLength @"Length"

Key for the uncompressed file length inside file information dictionaries.


MPQFileLocale



#define MPQFileLocale @"Locale"

Key for the file locale inside file information dictionaries.


MPQFileMD5



#define MPQFileMD5 @"MD5Sum"

Key for the file MD5 sum inside file information dictionaries.


MPQFileName



#define MPQFileName @"Name"

Key for the file MPQ path inside file information dictionaries.


MPQMaximumNumberOfFiles



#define MPQMaximumNumberOfFiles @"MaxNumFiles"

Key for the maximum number of files inside archive information dictionaries.


MPQNumberOfFiles



#define MPQNumberOfFiles @"NumFiles"

Key for the number of used and delete files inside archive information dictionaries.


MPQNumberOfUsedFiles



#define MPQNumberOfUsedFiles @"NumUsedFiles"

Key for the number of used files inside archive information dictionaries.

(Last Updated 5/8/2004)