rstb

Crates.iorstb
lib.rsrstb
version0.8.1
sourcesrc
created_at2020-06-16 17:59:32.772933
updated_at2023-05-22 17:55:38.241324
descriptionRust library for manipulating Breath of the Wild's resource size table
homepage
repositoryhttps://github.com/NiceneNerd/rstb-rust
max_upload_size
id254599
size6,538,398
Caleb Smith (NiceneNerd)

documentation

https://docs.rs/rstb

README

BOTW resource size table (RSTB) library in Rust

crates.io api license

A quick and easy library for manipulating the resource size table (RSTB) from The Legend of Zelda: Breath of the Wild in Rust. Can edit an RSTB directly or convert to and from a JSON representation. Basic usage to manipulate an RSTB file:

use rstb::{ResourceSizeTable, Endian};
let buf: Vec<u8> = std::fs::read("test/ResourceSizeTable.product.rsizetable")?;
// Read RSTB from data, can automatically decompress if yaz0 compressed
// (requires `yaz0` feature)
let mut table: ResourceSizeTable = ResourceSizeTable::from_binary(buf)?;
// Set the size for a resource
table.set("Map/MainField/A-1/A-1_Dynamic.mubin", 777);
// Check the size
assert_eq!(
    table.get("Map/MainField/A-1/A-1_Dynamic.mubin").unwrap(),
    777
);
// Dump to JSON, if `json` feature enabled
#[cfg(feature = "json")]
{
    let json_table = table.to_text();
    // From JSON back to RSTB
    let new_table = ResourceSizeTable::from_text(&json_table)?;
}
// Write new binary copy, and we'll yaz0 compress it
#[cfg(feature = "yaz0")]
let out_buf: Vec<u8> = table.to_compressed_binary(Endian::Big);
Commit count: 38

cargo fmt