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
§Header
§V1
| Bytes | Type | Data |
|---|---|---|
| 4 | StringU8 | Signature of the file. |
| 4 | u32 | Version of the file. |
| 4 | u32 | Category count. |
| 4 | u32 | Index from the start to the begining of the categories data. |
| 4 | u32 | Index from the start to the begining of the variants data. |
§V2
| Bytes | Type | Data |
|---|---|---|
| 4 | StringU8 | Signature of the file. |
| 4 | u32 | Version of the file. |
| 4 | u32 | Category count. |
| 4 | u32 | Index from the start to the begining of the categories data. |
| 4 | u32 | Index from the start to the begining of the variants data. |
| 4 | u32 | Unknown. |
§Data
This is valid for all versions.
| Bytes | Type | Data |
|---|---|---|
| 528 * Category Count | Category List | List of categories in the UnitVariant. |
| 1026 * Variant Count | Variant List | List of variants in the categories of the UnitVariant. |
§Category Structure
This is valid for all versions.
| Bytes | Type | Data |
|---|---|---|
| 512 | StringU16 | Category name. 00-Padded, Max 256 characters. |
| 8 | u64 | Category Id. |
| 4 | u32 | Variant count for this category. |
| 4 | u32 | Variants before the ones of this category. |
§Variant Structure
This is valid for all versions.
| Bytes | Type | Data |
|---|---|---|
| 512 | StringU16 | Mesh file path. 00-Padded, Max 256 characters. |
| 512 | StringU16 | Texture folder path. 00-Padded, Max 256 characters. |
| 2 | u16 | Unknown, possibly a termination. |
Structs§
- Category
- This holds a variant category.
- Unit
Variant - This holds an entire UnitVariant decoded in memory.
- Variant
- This holds a
Variantof a Category.
Constants§
- EXTENSION
- Extension used by UnitVariants.