Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
ad98236e06
|
|||
9d703833e4
|
|||
40f9ea4572
|
|||
3009d73726 | |||
|
108d8bce92 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1 +1,3 @@
|
|||||||
/target
|
/target
|
||||||
|
*.exe
|
||||||
|
*.zip
|
||||||
|
12
Cargo.lock
generated
12
Cargo.lock
generated
@@ -60,6 +60,15 @@ version = "1.0.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "colored"
|
||||||
|
version = "3.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "fde0e0ec90c9dfb3b4b1a0891a7dcd0e2bffde2f7efed5fe7c9bb00e5bfb915e"
|
||||||
|
dependencies = [
|
||||||
|
"windows-sys",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "console"
|
name = "console"
|
||||||
version = "0.15.11"
|
version = "0.15.11"
|
||||||
@@ -295,8 +304,9 @@ checksum = "30bde2b3dc3671ae49d8e2e9f044c7c005836e7a023ee57cffa25ab82764bb9e"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mhws-tex-decompressor"
|
name = "mhws-tex-decompressor"
|
||||||
version = "0.1.2"
|
version = "0.1.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"colored",
|
||||||
"dialoguer",
|
"dialoguer",
|
||||||
"eyre",
|
"eyre",
|
||||||
"indicatif",
|
"indicatif",
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "mhws-tex-decompressor"
|
name = "mhws-tex-decompressor"
|
||||||
version = "0.1.2"
|
version = "0.1.3"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
@@ -16,3 +16,4 @@ eyre = "0.6"
|
|||||||
indicatif = "0.17"
|
indicatif = "0.17"
|
||||||
rayon = "1.10"
|
rayon = "1.10"
|
||||||
parking_lot = "0.12"
|
parking_lot = "0.12"
|
||||||
|
colored = "3.0"
|
||||||
|
35
src/main.rs
35
src/main.rs
@@ -9,6 +9,7 @@ use std::{
|
|||||||
time::Duration,
|
time::Duration,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use colored::Colorize;
|
||||||
use dialoguer::{Input, Select, theme::ColorfulTheme};
|
use dialoguer::{Input, Select, theme::ColorfulTheme};
|
||||||
use indicatif::{HumanBytes, ProgressBar, ProgressStyle};
|
use indicatif::{HumanBytes, ProgressBar, ProgressStyle};
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
@@ -24,13 +25,22 @@ use ree_pak_core::{
|
|||||||
const FILE_NAME_LIST: &[u8] = include_bytes!("../assets/MHWs_STM_Release.list.zst");
|
const FILE_NAME_LIST: &[u8] = include_bytes!("../assets/MHWs_STM_Release.list.zst");
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
std::panic::set_hook(Box::new(panic_hook));
|
||||||
|
|
||||||
println!("Version v{} - Tool by @Eigeen", env!("CARGO_PKG_VERSION"));
|
println!("Version v{} - Tool by @Eigeen", env!("CARGO_PKG_VERSION"));
|
||||||
|
|
||||||
if let Err(e) = main_entry() {
|
if let Err(e) = main_entry() {
|
||||||
eprintln!("Error: {e}");
|
eprintln!("{}: {}", "Error".red().bold(), e);
|
||||||
wait_for_exit();
|
wait_for_exit();
|
||||||
std::process::exit(1);
|
std::process::exit(1);
|
||||||
}
|
}
|
||||||
|
wait_for_exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
fn panic_hook(info: &std::panic::PanicHookInfo) {
|
||||||
|
eprintln!("{}: {}", "Panic".red().bold(), info);
|
||||||
|
wait_for_exit();
|
||||||
|
std::process::exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main_entry() -> eyre::Result<()> {
|
fn main_entry() -> eyre::Result<()> {
|
||||||
@@ -39,7 +49,9 @@ fn main_entry() -> eyre::Result<()> {
|
|||||||
.default("re_chunk_000.pak.sub_000.pak".to_string())
|
.default("re_chunk_000.pak.sub_000.pak".to_string())
|
||||||
.with_prompt("Input .pak file path")
|
.with_prompt("Input .pak file path")
|
||||||
.interact_text()
|
.interact_text()
|
||||||
.unwrap();
|
.unwrap()
|
||||||
|
.trim_matches(|c| c == '\"' || c == '\'')
|
||||||
|
.to_string();
|
||||||
|
|
||||||
let input_path = Path::new(&input);
|
let input_path = Path::new(&input);
|
||||||
if !input_path.is_file() {
|
if !input_path.is_file() {
|
||||||
@@ -49,9 +61,7 @@ fn main_entry() -> eyre::Result<()> {
|
|||||||
const FALSE_TRUE_SELECTION: [&str; 2] = ["False", "True"];
|
const FALSE_TRUE_SELECTION: [&str; 2] = ["False", "True"];
|
||||||
|
|
||||||
let use_full_package_mode = Select::with_theme(&ColorfulTheme::default())
|
let use_full_package_mode = Select::with_theme(&ColorfulTheme::default())
|
||||||
.with_prompt(
|
.with_prompt("Package all files, including non-tex files (for replacing original files)")
|
||||||
"Package all files, including non-tex parts (suitable for replacing original files)",
|
|
||||||
)
|
|
||||||
.default(0)
|
.default(0)
|
||||||
.items(&FALSE_TRUE_SELECTION)
|
.items(&FALSE_TRUE_SELECTION)
|
||||||
.interact()
|
.interact()
|
||||||
@@ -59,8 +69,8 @@ fn main_entry() -> eyre::Result<()> {
|
|||||||
let use_full_package_mode = use_full_package_mode == 1;
|
let use_full_package_mode = use_full_package_mode == 1;
|
||||||
|
|
||||||
let use_feature_clone = Select::with_theme(&ColorfulTheme::default())
|
let use_feature_clone = Select::with_theme(&ColorfulTheme::default())
|
||||||
.with_prompt("Clone feature flags from original file? (experimental)")
|
.with_prompt("Clone feature flags from original file?")
|
||||||
.default(0)
|
.default(1)
|
||||||
.items(&FALSE_TRUE_SELECTION)
|
.items(&FALSE_TRUE_SELECTION)
|
||||||
.interact()
|
.interact()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
@@ -173,10 +183,12 @@ fn main_entry() -> eyre::Result<()> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
bar.finish();
|
bar.finish();
|
||||||
println!("Done!");
|
println!("{}", "Done!".cyan().bold());
|
||||||
println!(
|
if !use_full_package_mode {
|
||||||
"You should rename the output file like `re_chunk_000.pak.sub_000.pak.patch_xxx.pak`, or manage it by your favorite mod manager."
|
println!(
|
||||||
);
|
"You should rename the output file like `re_chunk_000.pak.sub_000.pak.patch_xxx.pak`, or manage it by your favorite mod manager."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@@ -209,6 +221,7 @@ where
|
|||||||
|
|
||||||
fn wait_for_exit() {
|
fn wait_for_exit() {
|
||||||
let _: String = Input::with_theme(&ColorfulTheme::default())
|
let _: String = Input::with_theme(&ColorfulTheme::default())
|
||||||
|
.with_prompt("Press Enter to exit")
|
||||||
.allow_empty(true)
|
.allow_empty(true)
|
||||||
.interact_text()
|
.interact_text()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
Reference in New Issue
Block a user