Pack 7zip archive
This commit is contained in:
104
Cargo.lock
generated
104
Cargo.lock
generated
@@ -1,4 +1,108 @@
|
||||
[[package]]
|
||||
name = "Inflector"
|
||||
version = "0.11.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "0.6.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"memchr 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "lazy_static"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"version_check 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.43"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"version_check 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.0.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"aho-corasick 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"memchr 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex-syntax 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"utf8-ranges 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.6.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thread_local"
|
||||
version = "0.3.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ucd-util"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "ui-compiler"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"Inflector 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "utf8-ranges"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "version_check"
|
||||
version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[metadata]
|
||||
"checksum Inflector 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4467f98bb61f615f8273359bf1c989453dfc1ea4a45ae9298f1dcd0672febe5d"
|
||||
"checksum aho-corasick 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "68f56c7353e5a9547cbd76ed90f7bb5ffc3ba09d4ea9bd1d8c06c8b1142eeb5a"
|
||||
"checksum cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0c4e7bb64a8ebb0d856483e1e682ea3422f883c5f5615a90d51a2c82fe87fdd3"
|
||||
"checksum lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca488b89a5657b0a2ecd45b95609b3e848cf1755da332a0da46e2b2b1cb371a7"
|
||||
"checksum libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)" = "76e3a3ef172f1a0b9a9ff0dd1491ae5e6c948b94479a3021819ba7d860c8645d"
|
||||
"checksum memchr 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4b3629fe9fdbff6daa6c33b90f7c08355c1aca05a3d01fa8063b822fcf185f3b"
|
||||
"checksum regex 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "2069749032ea3ec200ca51e4a31df41759190a88edca0d2d86ee8bedf7073341"
|
||||
"checksum regex-syntax 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "747ba3b235651f6e2f67dfa8bcdcd073ddb7c243cb21c442fc12395dfcac212d"
|
||||
"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b"
|
||||
"checksum ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fd2be2d6639d0f8fe6cdda291ad456e23629558d466e2789d2c3e9892bda285d"
|
||||
"checksum utf8-ranges 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fd70f467df6810094968e2fce0ee1bd0e87157aceb026a8c083bcf5e25b9efe4"
|
||||
"checksum version_check 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "7716c242968ee87e5542f8021178248f267f295a5c4803beae8b8b7fd9bc6051"
|
||||
|
||||
@@ -4,3 +4,4 @@ version = "0.1.0"
|
||||
authors = ["Jáchym Toušek <enumag@gmail.com>"]
|
||||
|
||||
[dependencies]
|
||||
Inflector = "*"
|
||||
|
||||
39
src/main.rs
39
src/main.rs
@@ -1,9 +1,12 @@
|
||||
extern crate inflector;
|
||||
|
||||
use std::env;
|
||||
use std::process::Command;
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
use std::collections::HashMap;
|
||||
use std::process;
|
||||
use inflector::Inflector;
|
||||
|
||||
fn main() {
|
||||
let args: Vec<String> = env::args().collect();
|
||||
@@ -23,16 +26,34 @@ fn main() {
|
||||
process::exit(1);
|
||||
}
|
||||
|
||||
let mut suffixes = HashMap::new();
|
||||
suffixes.insert("win".to_string(), "UI");
|
||||
suffixes.insert("mac".to_string(), "UI_UNIX");
|
||||
|
||||
if chapter == "tatarigoroshi" {
|
||||
suffixes.insert("win-mg".to_string(), "UI_MG");
|
||||
suffixes.insert("mac-mg".to_string(), "UI_UNIX-MG");
|
||||
}
|
||||
|
||||
if !suffixes.contains_key(platform) {
|
||||
println!("Unknown platform");
|
||||
process::exit(2);
|
||||
}
|
||||
|
||||
let arc_number = chapters.get(chapter).unwrap();
|
||||
let arc_type = if arc_number <= &4 { "question_arcs" } else { "answer_arcs" };
|
||||
let assets = format!("assets/vanilla/{}/{}/sharedassets0.assets", chapter, platform);
|
||||
let directory_assets = "output/assets";
|
||||
let directory_data = format!("output/HigurashiEp{:02}_Data", arc_number);
|
||||
let emip = format!("{}/{}-{}.emip", &directory_data, &chapter, &platform);
|
||||
let archive = format!("{}-{}.7z", &chapter.to_title_case(), suffixes.get(platform).unwrap());
|
||||
|
||||
if Path::new(&emip).exists() {
|
||||
fs::remove_file(&emip).expect("Failed to remove file");
|
||||
}
|
||||
if Path::new(&archive).exists() {
|
||||
fs::remove_file(&archive).expect("Failed to remove file");
|
||||
}
|
||||
if Path::new(&directory_assets).exists() {
|
||||
fs::remove_dir_all(&directory_assets).expect("Failed to remove directory");
|
||||
}
|
||||
@@ -108,17 +129,29 @@ fn main() {
|
||||
println!();
|
||||
|
||||
// 6. apply emip
|
||||
let status = Command::new("AssetBundleExtractor.exe")
|
||||
let status = Command::new("AssetBundleExtractor")
|
||||
.arg("applyemip")
|
||||
.arg(&emip)
|
||||
.arg("output")
|
||||
.status()
|
||||
.expect("failed to execute AssetBundleExtractor.exe");
|
||||
.expect("failed to execute AssetBundleExtractor");
|
||||
|
||||
println!("{}", status.to_string());
|
||||
assert!(status.success());
|
||||
|
||||
fs::remove_file(format!("{}/sharedassets0.assets.bak0000", &directory_data)).expect("Failed to remove file");
|
||||
fs::remove_file(&emip).expect("Failed to remove file");
|
||||
|
||||
// 7. pack with 7xip
|
||||
let status = Command::new("7za")
|
||||
.current_dir("output")
|
||||
.arg("a")
|
||||
.arg("-t7z")
|
||||
.arg(&archive)
|
||||
.arg(format!("../{}", &directory_data))
|
||||
.status()
|
||||
.expect("failed to execute 7ze");
|
||||
|
||||
assert!(status.success());
|
||||
}
|
||||
|
||||
fn copy_images(from: &str, to: &str) {
|
||||
|
||||
Reference in New Issue
Block a user