Struct infinite_rs::module::file::ModuleFileEntry
source · pub struct ModuleFileEntry {Show 25 fields
pub unknown: u8,
pub flags: FileEntryFlags,
pub block_count: u16,
pub block_index: i32,
pub resource_index: i32,
pub tag_group: String,
pub data_offset: u64,
pub data_offset_flags: DataOffsetType,
pub total_compressed_size: u32,
pub total_uncompressed_size: u32,
pub tag_id: i32,
pub uncompressed_header_size: u32,
pub uncompressed_tag_data_size: u32,
pub uncompressed_resource_data_size: u32,
pub uncompressed_actual_resource_size: u32,
pub header_alignment: u8,
pub tag_data_alignment: u8,
pub resource_data_alignment: u8,
pub actual_resource_data_alignment: u8,
pub name_offset: u32,
pub parent_index: i32,
pub asset_hash: i128,
pub resource_count: i32,
pub data_stream: Cursor<Vec<u8>>,
pub tag_info: TagFile,
/* private fields */
}Expand description
Module file entry structure containing metadata relating to file and required buffer sizes and offsets for the decompressor, as well as global tag ID, resource references and class.
Fields§
§unknown: u8Unknown, some sort of size?
flags: FileEntryFlagsDetermine how the file should be read.
block_count: u16Number of blocks that make up the file.
block_index: i32Index of the first block in the module.
resource_index: i32Index of the first resource in the module’s resource list.
tag_group: String4 byte-long string for tag group, stored as big endian. This determines how the rest of the tag is read. Example:
- bitm: Bitmap
- mat: Material
data_offset: u64Offset of compressed/uncompressed data in from the start of compressed data in the module.
data_offset_flags: DataOffsetTypeWhere the offset is located. 1 if in HD1.
total_compressed_size: u32Size in bytes of compressed buffer in module.
total_uncompressed_size: u32Size in bytes of buffer to decompress into.
tag_id: i32MurmurHash3_x86_64 32 bit hash of tag path. Referred to in-memory as “global tag id” Is set to -1 if file is resource.
uncompressed_header_size: u32Size in bytes of header in decompressed buffer.
uncompressed_tag_data_size: u32Size in bytes of actual tag data in decompressed buffer.
uncompressed_resource_data_size: u32Size in bytes of resource data in decompressed buffer.
uncompressed_actual_resource_size: u32Size in bytes of “external” resource data in decompressed buffer. (for instance, havok data or bitmaps)
header_alignment: u8Power of 2 to align the header buffer to (e.g. 4 = align to a multiple of 16 bytes).
tag_data_alignment: u8Power of 2 to align the tag data buffer to.
resource_data_alignment: u8Power of 2 to align the resource data buffer to.
actual_resource_data_alignment: u8Power of 2 to align the actual resource data buffer to.
name_offset: u32Offset where the name of the file is located in the string table. This is no longer valid as of module version 52.
parent_index: i32Used with resources to point back to the parent file. -1 = none
asset_hash: i128Murmur3_x64_128 hash of (what appears to be) the original file that this file was built from. This is not always the same thing as the file stored in the module. Only verified if the HasBlocks flag is not set.
resource_count: i32Number of resources owned by the file.
data_stream: Cursor<Vec<u8>>Data stream containing a buffer of bytes to read/seek.
tag_info: TagFileThe actual tag file read from the contents (including header), only valid if file is not a resource.
Implementations§
source§impl ModuleFileEntry
impl ModuleFileEntry
sourcepub fn read_tag(
&mut self,
file_path: &String,
data_offset: u64,
blocks: &[ModuleBlockEntry],
) -> Result<()>
pub fn read_tag( &mut self, file_path: &String, data_offset: u64, blocks: &[ModuleBlockEntry], ) -> Result<()>
Reads and loads tag data from a file.
§Arguments
file_path- Path to the file containing tag data.data_offset- Starting offset of the data in the file.blocks- Metadata for data blocks.
§Returns
Returns Ok(()) if the read operation is successful, or an (anyhow) Error containing
the I/O error if any reading operation fails.