Expand description
§ssbh_data
ssbh_data provides a more intuitive and minimal API built on ssbh_lib.
§Features
The high level nature of ssbh_data makes it easier to integrate with application code than ssbh_lib. Python bindings are also available with ssbh_data_py.
- Automatic decoding and encoding of buffers and compressed data
- Usage of standard Rust types like Vec and String
- Support for converting files to and from supported versions
- Simpler output when serializing and deserializing
- Errors for invalid data such as out of bounds vertex indices
- Modifications are less likely to produce an invalid file due to reduced dependencies between fields
§Getting Started
The easiest way to access important items like MeshData is to import the prelude. For additional reading and writing options, see the SsbhData trait.
use ssbh_data::prelude::*;
// Read the file from disk.
let mut data = MeshData::from_file("model.numshb")?;
// Make some edits.
data.objects[0].name = "firstMesh".to_string();
// Save the changes.
data.write_to_file("model_new.numshb")?;
§File Differences
The reduction in dependencies between fields and decoding and encoding of buffer data means that ssbh_data does not guarantee an unmodified file to be binary identical after saving. Examples include floating point rounding errors, larger file sizes due to different compression settings, or default values used for unresearched flag values. See the module level documentation for each format for details.
These differences are minor in practice but may cause issues for some applications. Applications needing a stronger guarantee that all data will be preserved should use ssbh_lib.
Modules§
- Types for working with Adj data in .adjb files.
- Types for working with Anim data in .nuanmb files.
- Types for working with Hlpb data in .nuhlpb files.
- Types for working with Matl data in .numatb files.
- Types for working with Mesh data in .numshb files.
- Types for working with MeshEx data in .numshexb files.
- Types for working with Modl data in .numdlb or .nusrcmdlb files.
- Common imports for supported types and important traits.
- Types for working with Shdr data in .nushdb files.
- Types for working with Skel data in .nusktb files.
Structs§
- A null terminated string with a specified alignment. The empty string is represented as
N
null bytes. - 4 contiguous floats for encoding RGBA data.
- 3 contiguous floats for encoding XYZ or RGB data.
- 4 contiguous floats for encoding XYZW or RGBA data.
Traits§
- Functions for reading and writing supported formats.