pub struct ModuleHeader {Show 14 fields
magic: u32,
pub version: ModuleVersion,
pub module_id: i64,
pub file_count: u32,
loadmanifest_index: i32,
runtimeloadmetadata_index: i32,
resourcemetadata_index: i32,
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.
loadmanifest_index: i32Index of loadmanifest tag, which contains the tag ids that the module will load.
runtimeloadmetadata_index: i32Index of runtimeloadmetadata tag, which contains info on how tags should be loaded at runtime.
resourcemetadata_index: i32Index of resourcemetadata tag, which contains info on how resources should be loaded.
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.
§Errors
- If the magic number is not equal to
HEADER_MAGICModuleError::IncorrectMagic - If the version number is not recognized
ModuleError::IncorrectVersion - If the reader fails to read the exact number of bytes
ReadError