#zelda #resources #gamedev #nintendo #convert-json #botw

rstb

Rust library for manipulating Breath of the Wild's resource size table

22 releases (1 stable)

1.0.0 Jul 29, 2024
0.9.0 Jul 8, 2024
0.8.1 May 22, 2023
0.6.0 Feb 22, 2023
0.1.2 Jun 19, 2020

#405 in Parser implementations

Download history 65/week @ 2024-08-18 89/week @ 2024-08-25 71/week @ 2024-09-01 59/week @ 2024-09-08 91/week @ 2024-09-15 63/week @ 2024-09-22 83/week @ 2024-09-29 74/week @ 2024-10-06 64/week @ 2024-10-13 57/week @ 2024-10-20 80/week @ 2024-10-27 72/week @ 2024-11-03 68/week @ 2024-11-10 80/week @ 2024-11-17 82/week @ 2024-11-24 388/week @ 2024-12-01

627 downloads per month

MIT and maybe GPL-3.0-or-later

1.5MB
5K SLoC

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);

Dependencies

~0.3–2.8MB
~34K SLoC