Struct infinite_rs::module::header::ModuleHeader

source ·
pub struct ModuleHeader {
Show 14 fields pub magic: String, pub version: i32, pub module_id: i64, pub file_count: u32, pub manifest0_count: u32, pub manifest1_count: u32, pub manifest2_count: u32, pub resource_index: i32, pub strings_size: u32, pub resource_count: u32, pub block_count: u32, pub build_version: u64, pub hd1_delta: u64, pub data_size: u64,
}
Expand description

Module Header structure containing info on the layout of the module file. Version 52+.

Fields§

§magic: String

Should be “mohd”.

§version: i32

Flight 1: 48 / Flight 2: 51 & Retail / Season 3+: 52

§module_id: i64

Unique identifier. (not a hash?)

§file_count: u32

Amount of files in module.

§manifest0_count: u32

Unknown: not in all modules.

§manifest1_count: u32

Unknown: present in most modules.

§manifest2_count: u32

Unknown: not present in any modules.

§resource_index: i32

Index of the first resource entry (file_count - resource_count)

§strings_size: u32

Total size in bytes of the string table.

§resource_count: u32

Number of resource files.

§block_count: u32

Number of data blocks.

§build_version: u64

Same between modules, changes per build?

§hd1_delta: u64

If non-zero, requires hd1 file.

§data_size: u64

Total size of packed data in module. Both compressed and uncompressed Starts after files, blocks, resources have been read.

Implementations§

source§

impl ModuleHeader

source

pub fn new() -> Self

Allocate new ModuleHeader and set it to default values.

source

pub fn read(&mut self, reader: &mut BufReader<File>) -> Result<()>

Reads the module header from the given buffered reader.

§Arguments
  • reader - A mutable reference to a BufReader<File> from which to read the data.
§Returns

Returns Ok(()) if the header is successfully read, or an Err 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 less than or equal to 0x34
  • Any I/O error occurs while reading

Trait Implementations§

source§

impl Debug for ModuleHeader

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for ModuleHeader

source§

fn default() -> ModuleHeader

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.