Struct s2protocol::parser::MPQHashTableEntry
source · pub struct MPQHashTableEntry {
pub hash_a: u32,
pub hash_b: u32,
pub locale: u16,
pub platform: u16,
pub block_table_index: u32,
}Expand description
The hash table entry definition
Fields§
§hash_a: u32The hash of the file path, using method A.
hash_b: u32The hash of the file path, using method B.
locale: u16The language of the file.
See MPQHashTableEntry::parse_locale for more information.
platform: u16The platform the file is used for.
See MPQHashTableEntry::parse_platform for more information.
block_table_index: u32Index into the block table of the file.
See MPQHashTableEntry::parse_block_table_index for more information.
Implementations§
source§impl MPQHashTableEntry
impl MPQHashTableEntry
sourcepub fn new(
hash_a: u32,
hash_b: u32,
locale: u16,
platform: u16,
block_table_index: u32
) -> MPQHashTableEntry
pub fn new( hash_a: u32, hash_b: u32, locale: u16, platform: u16, block_table_index: u32 ) -> MPQHashTableEntry
This method is not related to parsing but for testing, maybe we should consider further splitting this into a MPQHashTableEntryParser, maybe overkill.
sourcepub fn parse(
input: &[u8]
) -> Result<(&[u8], MPQHashTableEntry), Err<Error<&[u8]>>>
pub fn parse( input: &[u8] ) -> Result<(&[u8], MPQHashTableEntry), Err<Error<&[u8]>>>
Parses all the fields in the expected order
sourcepub fn parse_hash_a(input: &[u8]) -> Result<(&[u8], u32), Err<Error<&[u8]>>>
pub fn parse_hash_a(input: &[u8]) -> Result<(&[u8], u32), Err<Error<&[u8]>>>
Offset 0x00: int32 FilePathHashA
The hash of the file path, using method A.
sourcepub fn parse_hash_b(input: &[u8]) -> Result<(&[u8], u32), Err<Error<&[u8]>>>
pub fn parse_hash_b(input: &[u8]) -> Result<(&[u8], u32), Err<Error<&[u8]>>>
Offset 0x04: int32 FilePathHashB
The hash of the file path, using method B.
sourcepub fn parse_locale(input: &[u8]) -> Result<(&[u8], u16), Err<Error<&[u8]>>>
pub fn parse_locale(input: &[u8]) -> Result<(&[u8], u16), Err<Error<&[u8]>>>
Offset 0x08: int16 Language
The language of the file. This is a Windows LANGID data type, and uses the same values. 0 indicates the default language (American English), or that the file is language-neutral.
sourcepub fn parse_platform(input: &[u8]) -> Result<(&[u8], u16), Err<Error<&[u8]>>>
pub fn parse_platform(input: &[u8]) -> Result<(&[u8], u16), Err<Error<&[u8]>>>
Offset 0x0a: int16 Platform
The platform the file is used for. 0 indicates the default platform. No other values have been observed.
sourcepub fn parse_block_table_index(
input: &[u8]
) -> Result<(&[u8], u32), Err<Error<&[u8]>>>
pub fn parse_block_table_index( input: &[u8] ) -> Result<(&[u8], u32), Err<Error<&[u8]>>>
Offset 0x0c: int32 FileBlockIndex
If the hash table entry is valid, this is the index into the block table of the file. Otherwise, one of the following two values:
0xffffffff- Hash table entry is empty, and has always been empty. Terminates searches for a given file.0xfffffffe- Hash table entry is empty, but was valid at some point (in other words, the file was deleted). Does not terminate searches for a given file.
Trait Implementations§
source§impl Clone for MPQHashTableEntry
impl Clone for MPQHashTableEntry
source§fn clone(&self) -> MPQHashTableEntry
fn clone(&self) -> MPQHashTableEntry
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for MPQHashTableEntry
impl Debug for MPQHashTableEntry
source§impl Default for MPQHashTableEntry
impl Default for MPQHashTableEntry
source§fn default() -> MPQHashTableEntry
fn default() -> MPQHashTableEntry
source§impl PartialEq for MPQHashTableEntry
impl PartialEq for MPQHashTableEntry
source§fn eq(&self, other: &MPQHashTableEntry) -> bool
fn eq(&self, other: &MPQHashTableEntry) -> bool
self and other values to be equal, and is used
by ==.