diff --git a/Cargo.lock b/Cargo.lock index caae4c4..eefe316 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -552,9 +552,9 @@ dependencies = [ [[package]] name = "lotus-utils-audio" -version = "0.1.1" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03ce196fa8a2c707927061acda02a0e44069a11be71e5828b84e7e4ccbe6fb2d" +checksum = "c462e561b6f6c6bd1c63f8012cbf22bb7d1ce7a8d9ae4b72657e3ced8b03daed" dependencies = [ "anyhow", "bytebuffer", @@ -567,9 +567,9 @@ dependencies = [ [[package]] name = "lotus-utils-texture" -version = "0.1.1" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eaa7d7db031be30b4536be7e514ffd44d9be2764a96217451f005b7218d3211" +checksum = "4ad52e3700e2e3acd41d6c92f75345312cbc4c20ac79c8381383af101088ddde" dependencies = [ "anyhow", "bytebuffer", diff --git a/Cargo.toml b/Cargo.toml index 3c9e513..17a073a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,8 +19,8 @@ derivative = "2.2.0" futures = "0.3.30" indoc = "2.0.5" lotus-lib = "4.0.0" -lotus-utils-audio = "0.1.1" -lotus-utils-texture = "0.1.1" +lotus-utils-audio = "0.2.0" +lotus-utils-texture = "0.2.0" ratatui = { version = "0.26.1", features = ["unstable-widget-ref"] } tokio = { version = "1.37.0", features = ["full"] } tokio-util = "0.7.10" diff --git a/src/extract.rs b/src/extract.rs index 1bb31b5..3385bf3 100644 --- a/src/extract.rs +++ b/src/extract.rs @@ -32,10 +32,9 @@ pub fn extract_file( let mut file_name: String = file_name; let file_data: Vec; - if file_name.ends_with(".png") { - file_name = package.get_texture_file_name(file_node); - file_data = package.decompress_texture(file_node).unwrap(); - } else if file_name.ends_with(".wav") { + if package.is_texture(file_node).unwrap() { + (file_data, file_name) = package.decompress_texture(file_node).unwrap(); + } else if package.is_audio(file_node).unwrap() { (file_data, file_name) = package.decompress_audio(file_node).unwrap(); } else { // Decompress and extract a file from the cache without parsing it (e.g. audio, texture)