A simple library to handle RSTB/RESTBL (resource size table) files from The
Legend of Zelda: Tears of the Kingdom. Features:
- Quick, zero-allocation parser
- Optional alloc
feature to support editable table which can be serialized to
binary or (with the yaml
feature) YAML.
- no_std
support (optional std
feature)
- optional Serde support (serde
feature)
- aarch64-nintendo-switch-freestanding
support (without the std
feature)
```rust use restbl::bin::ResTblReader;
let bytes = std::fs::read("test/ResourceSizeTable.Product.110.rsizetable").unwrap();
// Setup the quick, zero-allocation reader let reader = ResTblReader::new(bytes.asslice()).unwrap(); // Lookup an RSTB value asserteq!( reader.get("Bake/Scene/MainFieldG26_43.bkres"), Some(31880) );
{
use restbl::ResourceSizeTable;
// Parse RSTB into owned table
let mut table = ResourceSizeTable::fromparser(&reader);
// Set the size for a resource
table.set("TexToGo/EtcBaseCampWallWoodAAlb.txtg", 777);
// Check the size
asserteq!(
table.get("TexToGo/EtcBaseCampWallWoodAAlb.txtg"),
Some(777)
);
// Dump to YAML, if yaml
feature enabled
#[cfg(feature = "yaml")]
{
let jsontable = table.totext();
// From YAML back to RSTB
let newtable = ResourceSizeTable::fromtext(&json_table).unwrap();
}
}
```
To build for Switch, you will need to use the
aarch64-nintendo-switch-freestanding
target. The std
feature is not
supported, so you will need to use --no-default-features
. Since cargo
nx
does not seem to support
passing feature flags, you will need to run the full command yourself, as
follows:
cargo build -Z build-std=core,compiler_builtins,alloc --target aarch64-nintendo-switch-freestanding --no-default-features
This software is licensed under the terms of the GNU General Public License, version 3 or later.
License: GPL-3.0-or-later