Skip to main content

Module unit_variant

Module unit_variant 

Source
Expand description

This is a module to read/write binary UnitVariant files.

UnitVariants define data about what textures and parts unit models use within a unit. They’re usually xml files covered by the super::text module, but in older games (Shogun 2) they’re binary files instead, and thus they need their own logic.

§UnitVariant Structure

§V1

BytesTypeData
4StringU8Signature of the file.
4u32Version of the file.
4u32Category count.
4u32Index from the start to the begining of the categories data.
4u32Index from the start to the begining of the variants data.

§V2

BytesTypeData
4StringU8Signature of the file.
4u32Version of the file.
4u32Category count.
4u32Index from the start to the begining of the categories data.
4u32Index from the start to the begining of the variants data.
4u32Unknown.

§Data

This is valid for all versions.

BytesTypeData
528 * Category CountCategory ListList of categories in the UnitVariant.
1026 * Variant CountVariant ListList of variants in the categories of the UnitVariant.

§Category Structure

This is valid for all versions.

BytesTypeData
512StringU16Category name. 00-Padded, Max 256 characters.
8u64Category Id.
4u32Variant count for this category.
4u32Variants before the ones of this category.

§Variant Structure

This is valid for all versions.

BytesTypeData
512StringU16Mesh file path. 00-Padded, Max 256 characters.
512StringU16Texture folder path. 00-Padded, Max 256 characters.
2u16Unknown, possibly a termination.

Structs§

Category
This holds a variant category.
UnitVariant
This holds an entire UnitVariant decoded in memory.
Variant
This holds a Variant of a Category.

Constants§

EXTENSION
Extension used by UnitVariants.