Module rstb::calc [−][src]
Expand description
Provides functions for calculating or estimating resource size values.
Sample usage:
use std::fs::read; use rstb::calc::*; // Calculate RSTB value for file on disk assert_eq!( calculate_size( "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<u8> = read("A-1_Dynamic.smubin").unwrap(); assert_eq!( calculate_size_with_ext( &buf, ".smubin", Endian::Big, false ).unwrap(), 48800 );
Functions
calculate_size | Attempts to calculate the resource size for an existant file from its path, optionally applying
a statistical estimate for some complex resource types. Note that the |
calculate_size_with_ext | Attempts to calculate the resource size for a file given its contents and file extension,
optionally applying a statistical estimate for some complex resource types. Note that the
|
guess_bfres_value_from_file | Estimates the resource size for BFRES files on the file system. Returns a |
guess_bfres_value_from_size | Estimates the resource size for BFRES files from the uncompressed file size. Unlike other RSTB calculators, this will always return a real value. |
guess_size | Estimates the resource size for complex resource types, excluding BFRES. Returns |