Skip to content
This repository has been archived by the owner on Oct 20, 2024. It is now read-only.

Commit

Permalink
refactor: use new is_audio and is_texture functions when extracting a…
Browse files Browse the repository at this point in the history
…ssets
  • Loading branch information
sehnryr committed Apr 4, 2024
1 parent 2dd06d1 commit c137747
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
7 changes: 3 additions & 4 deletions src/extract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ pub fn extract_file(
let mut file_name: String = file_name;
let file_data: Vec<u8>;

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)
Expand Down

0 comments on commit c137747

Please sign in to comment.