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: ```rust use std::fs::read; use rstb::{ResourceSizeTable, Endian};

let buff: Vec = read("ResourceSizeTable.product.srsizetable").unwrap(); // Read RSTB from data, automatically decompressing if yaz0 compressed let mut table: ResourceSizeTable = ResourceSizeTable::frombinary(buff, Endian::Big).unwrap(); // Set the size for a resource table.setsize("Map/MainField/A-1/A-1Dynamic.mubin", 777u32); // Check the size asserteq!( table.getsize("Map/MainField/A-1/A-1Dynamic.mubin").unwrap(), 777 ); // Dump to JSON let jsontable = table.totext().unwrap(); // From JSON back to RSTB let newtable = ResourceSizeTable::fromtext(&jsontable).unwrap(); // Write new binary copy, and we'll yaz0 compress it let outbuf: Vec = table.to_binary(Endian::Big, true).unwrap(); ```

Also provides functions for calculating resource sizes: ```rust use std::fs::read; use rstb::calc::*; // Calculate RSTB value for file on disk asserteq!( calculatesize( "A-1_Dynamic.smubin", Endian::Big, false ).unwrap() .unwrap(), 48800 );

// Or we can calculate from a buffer if we provide the file extension let buf: Vec = read("A-1Dynamic.smubin").unwrap(); asserteq!( calculatesizewith_ext( &buf, ".smubin", Endian::Big, false ).unwrap(), 48800 ); ```