ssbh_lib 0.6.1

Reading and writing SSBH file formats in Rust
Documentation

ssbh_lib

An SSBH parsing library in Rust. Each SSBH format has a major and minor version. All versions used by Smash Ultimate are supported. This library also serves as documentation for the SSBH format. Report any bugs in any of these projects in issues. See Comparing two SSBH files for debugging tips to provide more useful feedback if a file isn't parsed or saved correctly.

SSBH Formats

Click the links below to see the corresponding Rust source file in src/formats/ with the file format's struct definitions. The src/lib.rs file contains shared parsing logic for arrays, enums, etc.

Format Supported Versions (major.minor)
Hlpb (.nuhlpb) 1.1
Matl (.numatb) 1.6
Modl (.numdlb,.nusrcmdlb) 1.7
Mesh (.numshb) 1.8, 1.10
Skel (.nusktb) 1.0
Anim (.nuanmb) 2.0, 2.1
Nrpd (.nurpdb) 1.6
Nufx (.nufxlb) 1.0, 1.1
Shdr (.nushdb) 1.2

Non SSBH Formats:

ssbh_data

A higher level data access layer for some SSBH formats. Python bindings are available with ssbh_data_py.

ssbh_lib_json

A program for creating and editing SSBH binary data using JSON. Drag a properly formatted JSON file onto the executable to create a binary file. Drag a supported file format onto the executable to create a JSON file. Byte arrays are encoded as hex strings. JSON files are text files, so they can be viewed and edited in any text editor such as VSCode.

Usage

ssbh_lib_json.exe <input>
ssbh_lib_json.exe <input> <output>

Editing an SSBH file

  • Output the JSON with ssbh_lib_json.exe model.numshb mesh.json
  • Make changes to the JSON file such as adding elements to an array or changing field values
  • Save the changes to a new file with ssbh_lib_json.exe mesh.json model.new.numshb

Comparing two SSBH files

ssbh_lib_json is used frequently during the development of ssbh_lib and ssbh_data for determining changes to a file without manually inspecting the file in a hex editor.

  • Output the JSON for both files with ssbh_lib_json.exe matl1.numatb matl1.json and ssbh_lib_json.exe matl2.numatb matl2.json
  • Compare the text output for both JSON files to see changes, additions, and deletions to the data stored file using a diffing tool or diff using VSCode.

Comparing the binary and JSON representations of two files gives clues as to how and why the binary files differ.

JSON Identical Binary Identical Conclusion
:x: :x: The two files do not contain the same data or the struct definitions do not capture all the data in the given file format.
:heavy_check_mark: :x: The files differ in padding or alignment but contain the same data.
:heavy_check_mark: :heavy_check_mark: The files are identical and contain the same data

Credits

The original C# implementation can be found in the SSBHLib repo.