Struct infinite_rs::tag::header::TagHeader

source ·
pub struct TagHeader {
Show 21 fields pub magic: String, pub version: i32, pub root_struct_guid: i64, pub checksum: i64, pub dependency_count: i32, pub datablock_count: i32, pub tagstruct_count: i32, pub data_reference_count: i32, pub tag_reference_count: i32, pub string_table_size: u32, pub zoneset_size: u32, pub unknown: u32, pub header_size: u32, pub data_size: u32, pub resource_size: u32, pub actual_resource_size: u32, pub header_alignment: u8, pub tag_alignment: u8, pub resource_alignment: u8, pub actual_resource_alignment: u8, pub is_resource: bool,
}
Expand description

Tag Header structure containing info on the layout of the tag file.

Fields§

§magic: String

Has to be “ucsh”

§version: i32

Should be 27. Note: this is also the tag version from Halo 5!

§root_struct_guid: i64

Secondary GUID to identify the root structure.

§checksum: i64

Checksum generated from unknown algorithm

§dependency_count: i32

Number of tags required to load tag.

§datablock_count: i32

Number of datablocks that exist within tag (offsets, sections etc).

§tagstruct_count: i32

Number of tag struct definitions that make up the actual structure of the tag.

§data_reference_count: i32

Number of “external” data references (to other tags) in tag.

§tag_reference_count: i32

Number of internal references to structures.

§string_table_size: u32

Size in bytes of string table inside tag. Unused after Halo 5.

§zoneset_size: u32

Size in bytes of “zoneset” section of tag. Unknown use.

§unknown: u32

Unknown. Possibly used to split something in memory.

§header_size: u32

Size of the header and the fields read by it (dependencies, datablocks, etc.). Important as sometimes the offset after reading those fields does not match up to where tag data starts. Might be some sort of internal padding measure.

§data_size: u32

Size of actual data in tag, referenced in tag structs.

§resource_size: u32

Size of resource in tag (after data!)

§actual_resource_size: u32

Size of “external” data, for instance Havok data.

§header_alignment: u8

Power of 2 to align the header to.

§tag_alignment: u8

Power of 2 to align the tag data to.

§resource_alignment: u8

Power of 2 to align resource data to.

§actual_resource_alignment: u8

Power of 2 to align actual resource to.

§is_resource: bool

Unknown if this is consistent: Indicates if the file is a resource.

Implementations§

source§

impl TagHeader

source

pub fn new() -> Self

Allocate new TagHeader and set it to default values.

source

pub fn read<R: BufRead + BufReaderExt>(&mut self, reader: &mut R) -> Result<()>

Reads the tag header from the given readers implementing BufRead and BufReaderExt.

§Arguments
  • reader - A mutable reference to a reader that implements BufRead + BufReaderExt from which to read the data.
§Returns

This function will return an error if:

  • The magic string is not “ucsh”
  • The version is less than or equal to 17
  • Any I/O error occurs while reading

Trait Implementations§

source§

impl Debug for TagHeader

source§

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

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

impl Default for TagHeader

source§

fn default() -> TagHeader

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.