pub struct ModuleHeader {Show 14 fields
magic: u32,
pub version: ModuleVersion,
pub module_id: i64,
pub file_count: u32,
manifest0_count: u32,
manifest1_count: u32,
manifest2_count: u32,
resource_index: i32,
strings_size: u32,
pub(super) resource_count: u32,
pub(super) block_count: u32,
build_version: u64,
pub(super) hd1_delta: u64,
pub(super) data_size: u64,
}Expand description
Module Header structure containing info on the layout of the module file.
Fields§
§magic: u32Should be “mohd” (0x64686F6D)
version: ModuleVersionRevision number of the module. This determines how offsets are calculated and if tag names should be read.
module_id: i64Unique identifier of module.
file_count: u32Number of files in the module.
manifest0_count: u32Unknown: not in all modules.
manifest1_count: u32Unknown: present in most modules.
manifest2_count: u32Unknown: not present in any modules.
resource_index: i32Index of the first resource entry (file_count - resource_count).
strings_size: u32Total size in bytes of the string table.
resource_count: u32Number of resource files.
block_count: u32Number of data blocks.
build_version: u64Same between modules, changes per build?
hd1_delta: u64If non-zero, requires hd1 file.
data_size: u64Total size of packed data in the module. Both compressed and uncompressed. Starts after files, blocks, and resources have been read.
This does NOT apply for versions before ModuleVersion::Season3.
Implementations§
Source§impl ModuleHeader
impl ModuleHeader
Sourcepub(super) fn read(&mut self, reader: &mut BufReader<File>) -> Result<()>
pub(super) fn read(&mut self, reader: &mut BufReader<File>) -> Result<()>
Reads the module header from the given buffered reader.
§Arguments
reader- A mutable reference to aBufReader<File>from which to read the data.
§Returns
Returns Ok(()) if the header is successfully read, or an Error if an I/O error occurs
or if the header data is invalid.
§Errors
This function will return an error if:
- The magic string is not “mohd”
- The version is not in the valid range defined by
ModuleVersion - Any I/O error occurs while reading