diff --git a/Cargo.toml b/Cargo.toml index f5e7e57..f083b05 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "unity-js-tools" -version = "1.1.0" +version = "1.2.0" edition = "2021" authors = ["神代綺凛 "] license = "MIT" @@ -16,7 +16,7 @@ codegen-units = 1 crate-type = ["cdylib"] [dependencies] -lz4_flex = "0.11.1" -paste = "1.0.14" +lz4_flex = "0.11.3" +paste = "1.0.15" texture2ddecoder = "0.0.5" -wasm-bindgen = "0.2.87" +wasm-bindgen = "0.2.92" diff --git a/src/lib.rs b/src/lib.rs index f3616cb..01f8a61 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,7 @@ mod tools; use lz4_flex::decompress; +use lz4_flex::block::decompress_size_prepended; use texture2ddecoder::*; use tools::*; use wasm_bindgen::prelude::*; @@ -56,3 +57,7 @@ pub fn export_decode_astc( pub fn export_decompress_lz4(data: &[u8], size: usize) -> Result, JsError> { decompress(data, size).map_err(to_js_err) } +#[wasm_bindgen(js_name = decompressLz4SizePrepended)] +pub fn export_decompress_lz4_size_prepended(data: &[u8]) -> Result, JsError> { + decompress_size_prepended(data).map_err(to_js_err) +}