pub struct MPQ {
pub archive_header: MPQFileHeader,
pub user_data: Option<MPQUserData>,
pub hash_table_entries: Vec<MPQHashTableEntry>,
pub block_table_entries: Vec<MPQBlockTableEntry>,
pub encryption_table: HashMap<u32, u32>,
}
Expand description
The main MPQ object that contains the parsed entries
Fields§
§archive_header: MPQFileHeader
The Archive Header containing format version, the offsets for the block table and hash table.
user_data: Option<MPQUserData>
The Archive may contain MPQUserData
, which is at the start of the file.
hash_table_entries: Vec<MPQHashTableEntry>
The hash table entries, after decryption and parsing
block_table_entries: Vec<MPQBlockTableEntry>
The block table entries, after decryption and parsing
encryption_table: HashMap<u32, u32>
The internal MPQ encryption table.
Implementations§
Source§impl MPQ
impl MPQ
Sourcepub fn mpq_string_hash(
encryption_table: &HashMap<u32, u32>,
location: &str,
hash_type: MPQHashType,
) -> Result<u32, MPQParserError>
pub fn mpq_string_hash( encryption_table: &HashMap<u32, u32>, location: &str, hash_type: MPQHashType, ) -> Result<u32, MPQParserError>
Hash a string using MPQ’s hash function
_hash
on MPyQ
This function doesn’t use self as the Builder also needs to access the same functionality.
Sourcepub fn get_hash_table_entry(
&self,
filename: &str,
) -> Result<MPQHashTableEntry, MPQParserError>
pub fn get_hash_table_entry( &self, filename: &str, ) -> Result<MPQHashTableEntry, MPQParserError>
Get the hash table entry corresponding to a given filename.
A filename is hashed with both MPQHashType::HashA
and MPQHashType::HashB
to uniquely identify the filename in the archive
Sourcepub fn decompress(input: &[u8]) -> MPQResult<&[u8], Vec<u8>>
pub fn decompress(input: &[u8]) -> MPQResult<&[u8], Vec<u8>>
Read the compression type and decompress file data accordingly.
Sourcepub fn read_mpq_file_sector<'a>(
&'a self,
filename: &str,
force_decompress: bool,
orig_input: &'a [u8],
) -> MPQResult<&'a [u8], Vec<u8>>
pub fn read_mpq_file_sector<'a>( &'a self, filename: &str, force_decompress: bool, orig_input: &'a [u8], ) -> MPQResult<&'a [u8], Vec<u8>>
Reads an embedded file inside the MPQ archive.