Expand description
A library for reading and writing rendering related file formats.
Xenoblade 1 DE, Xenoblade 2, and Xenoblade 3 are supported with Xenoblade 3 receiving the most testing. Struct documentation contains the corresponding type from Xenoblade 2 binary symbols where appropriate.
Getting Started
Each format has its own module based on the name of the type representing the root of the file. Only these top level types support reading and writing from files.
// Read from disk.
let mxmd = xc3_lib::mxmd::Mxmd::from_file("ch01011013.wimdo")?;
println!("{mxmd:#?}");
// Save to disk after making any changes.
mxmd.save("out.wimdo")?;Design
xc3_lib provides safe, efficient, and robust reading and writing code for binary file formats. Each file format consists of a set of Rust types representing the structures in the binary file. xc3_lib uses derive macros to generate reading and writing code from the type and its attribute annotations. This avoids the need to separately document the format and reading and writing logic.
Each type is intended to be as specific as possible while still being able to generate a binary identical output. Enums are used instead of raw integers to reject unknown variants, for example. Each file is fully parsed and invalid input is not sanitized in any way. xc3_lib can validate the contents of a binary file by parsing it but cannot validate higher level constraints like entry indices being in range. These checks are performed by higher level libraries like xc3_model or xc3_wgpu.
Operations that would be impossible to reverse accurately like compression or byte buffers must be decoded and encoded in a separate step. This allows identical outputs when no modifications are needed to binary buffers.
Modules
- Model archive for character and map models in
.wimdofiles. - Conversions between Mibl and [Dds].
- User interface Mibl images in
.wilayfiles. - Shared error types for read and write operations.
- Camera animations in
.evafiles or embedded in.motfiles. - A collection of non-cryptographic hash functions used in game.
- User interface Mibl images in
.wilayfiles. - User interface data in
.wilayfiles. - Texture container of Mibl images in
.wiltpfiles. - Map data stored in compressed sections in
.wismdafiles. - Textures in
.witxor.witexfiles or embedded in.wismtfiles and other formats. .wismhdfiles for map data that points to data in a corresponding.wismdafiles- Streamed model resources like shaders, geometry, or textures in
.wismtfiles. - Model data in
.wimdofiles. - Simple archive data in
.arc,.chr, or.motfiles. - Compiled shaders in
.wishpfiles or embedded in other formats. - Vertex and geometry data for models and map models.
- Compressed container used to store data in other formats.