pub struct MPQFileHeader {
pub header_size: u32,
pub archive_size: u32,
pub format_version: u16,
pub sector_size_shift: u16,
pub hash_table_offset: u32,
pub block_table_offset: u32,
pub hash_table_entries: u32,
pub block_table_entries: u32,
pub extended_file_header: Option<MPQFileHeaderExt>,
pub offset: usize,
}
Expand description
The MPQ File Header
Fields§
§header_size: u32
Size of the archive header.
archive_size: u32
Size of the whole archive, including the header.
format_version: u16
MoPaQ format version.
sector_size_shift: u16
Power of two exponent specifying the number of 512-byte disk sectors in each logical sector in the archive.
hash_table_offset: u32
Offset to the beginning of the hash table,
relative to the beginning of the archive header.
To seek
it we must add the MPQFileHeader::offset
block_table_offset: u32
Offset to the beginning of the hash table,
relative to the beginning of the archive header.
To seek
it we must add the MPQFileHeader::offset
hash_table_entries: u32
Number of entries in the hash table.
block_table_entries: u32
Number of entries in the block table.
extended_file_header: Option<MPQFileHeaderExt>
Extended Block Table only present in Burning Crusade format and later:
offset: usize
Store the offset at which the FileHeader was found. this is done because other offsets are relative to this one.
Implementations§
Source§impl MPQFileHeader
impl MPQFileHeader
Sourcepub fn parse(input: &[u8], offset: usize) -> IResult<&[u8], Self>
pub fn parse(input: &[u8], offset: usize) -> IResult<&[u8], Self>
Parses the internal fields in the expected order.
Sourcepub fn parse_header_size(input: &[u8]) -> IResult<&[u8], u32>
pub fn parse_header_size(input: &[u8]) -> IResult<&[u8], u32>
Offset 0x04
: int32 HeaderSize
Size of the archive header.
Sourcepub fn parse_archive_size(input: &[u8]) -> IResult<&[u8], u32>
pub fn parse_archive_size(input: &[u8]) -> IResult<&[u8], u32>
Offset: 0x08
: int32 ArchiveSize
Size of the whole archive, including the header. Does not include the strong digital signature, if present. This size is used, among other things, for determining the region to hash in computing the digital signature. This field is deprecated in the Burning Crusade MoPaQ format, and the size of the archive is calculated as the size from the beginning of the archive to the end of the hash table, block table, or extended block table (whichever is largest).
Sourcepub fn parse_format_version(input: &[u8]) -> IResult<&[u8], u16>
pub fn parse_format_version(input: &[u8]) -> IResult<&[u8], u16>
Offset 0x0c
: int16 FormatVersion
MoPaQ format version. MPQAPI will not open archives where this is negative. Known versions:
0x0000
Original format. HeaderSize should be0x20
, and large archives are not supported.0x0001
Burning Crusade format. Header size should be0x2c
, and large archives are supported.
Sourcepub fn parse_sector_size_shift(input: &[u8]) -> IResult<&[u8], u16>
pub fn parse_sector_size_shift(input: &[u8]) -> IResult<&[u8], u16>
Offset 0x0e
: int8 SectorSizeShift
Power of two exponent specifying the number of 512-byte
disk sectors in each logical sector in the archive. The size
of each logical sector in the archive is:
512
* 2^SectorSizeShift
.
Bugs in the Storm library dictate that this shouldalways be:
3 (4096 byte sectors).
Sourcepub fn parse_hash_table_offset(input: &[u8]) -> IResult<&[u8], u32>
pub fn parse_hash_table_offset(input: &[u8]) -> IResult<&[u8], u32>
Offset 0x10
: int32 HashTableOffset
Offset to the beginning of the hash table, relative to the beginning of the archive.
Sourcepub fn parse_block_table_offset(input: &[u8]) -> IResult<&[u8], u32>
pub fn parse_block_table_offset(input: &[u8]) -> IResult<&[u8], u32>
Offset 0x14
: int32 BlockTableOffset
Offset to the beginning of the block table, relative to the beginning of the archive.
Sourcepub fn parse_hash_table_entries(input: &[u8]) -> IResult<&[u8], u32>
pub fn parse_hash_table_entries(input: &[u8]) -> IResult<&[u8], u32>
Offset 0x18
: int32 HashTableEntries
Number of entries in the hash table.
Must be a power of two, and must be:
less than 2^16
for the original MoPaQ format,
or less than 2^20
for the Burning Crusade format.
Sourcepub fn parse_block_table_entries(input: &[u8]) -> IResult<&[u8], u32>
pub fn parse_block_table_entries(input: &[u8]) -> IResult<&[u8], u32>
Offset 0x1c
: int32 BlockTableEntries
Number of entries in the block table.
Sourcepub fn parse_extended_header_if_needed(
input: &[u8],
format_version: u16,
) -> IResult<&[u8], Option<MPQFileHeaderExt>>
pub fn parse_extended_header_if_needed( input: &[u8], format_version: u16, ) -> IResult<&[u8], Option<MPQFileHeaderExt>>
Offset 0x20
: ExtendedBlockTable
Extended Block Table only present in Burning Crusade format and later:
Trait Implementations§
Source§impl Clone for MPQFileHeader
impl Clone for MPQFileHeader
Source§fn clone(&self) -> MPQFileHeader
fn clone(&self) -> MPQFileHeader
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more