Finish emip compilation
This commit is contained in:
52
src/main.rs
52
src/main.rs
@@ -11,7 +11,11 @@ fn main() {
|
|||||||
let arc_type = if chapter == "onikakushi" || chapter == "watanagashi" || chapter == "tatarigoroshi" || chapter == "himatsubushi" { "question_arcs" } else { "answer_arcs" };
|
let arc_type = if chapter == "onikakushi" || chapter == "watanagashi" || chapter == "tatarigoroshi" || chapter == "himatsubushi" { "question_arcs" } else { "answer_arcs" };
|
||||||
let assets = format!("assets/vanilla/{}/{}/sharedassets0.assets", chapter, platform);
|
let assets = format!("assets/vanilla/{}/{}/sharedassets0.assets", chapter, platform);
|
||||||
let directory = "output/assets";
|
let directory = "output/assets";
|
||||||
|
let emip = format!("output/{}-{}.emip", &chapter, &platform);
|
||||||
|
|
||||||
|
if Path::new(&emip).exists() {
|
||||||
|
fs::remove_file(&emip).expect("Failed to remove file");
|
||||||
|
}
|
||||||
if Path::new(&directory).exists() {
|
if Path::new(&directory).exists() {
|
||||||
fs::remove_dir_all("output/assets").expect("Failed to remove directory");
|
fs::remove_dir_all("output/assets").expect("Failed to remove directory");
|
||||||
}
|
}
|
||||||
@@ -21,9 +25,9 @@ fn main() {
|
|||||||
let output = Command::new("python")
|
let output = Command::new("python")
|
||||||
.env("PYTHONIOENCODING", "utf-8")
|
.env("PYTHONIOENCODING", "utf-8")
|
||||||
.arg("../ui-editing-scripts/UnityTextModifier.py")
|
.arg("../ui-editing-scripts/UnityTextModifier.py")
|
||||||
.arg(format!("{}", &assets))
|
.arg(&assets)
|
||||||
.arg(format!("assets/text-edits.json"))
|
.arg("assets/text-edits.json")
|
||||||
.arg(format!("{}", &directory))
|
.arg(&directory)
|
||||||
.output()
|
.output()
|
||||||
.expect("failed to execute UnityTextModifier.py");
|
.expect("failed to execute UnityTextModifier.py");
|
||||||
|
|
||||||
@@ -34,12 +38,46 @@ fn main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 2. images
|
// 2. images
|
||||||
copy_files("assets/images/shared", directory);
|
copy_files("assets/images/shared", &directory);
|
||||||
copy_files(format!("assets/images/{}", &arc_type).as_ref(), directory);
|
copy_files(format!("assets/images/{}", &arc_type).as_ref(), &directory);
|
||||||
copy_files(format!("assets/images/specific/{}", &chapter).as_ref(), directory);
|
copy_files(format!("assets/images/specific/{}", &chapter).as_ref(), &directory);
|
||||||
fs::rename("output/assets/configbg_Texture2D.png", "output/assets/47configbg_Texture2D.png").expect("Unable to rename");
|
fs::rename("output/assets/configbg_Texture2D.png", "output/assets/47configbg_Texture2D.png").expect("Unable to rename");
|
||||||
|
println!();
|
||||||
|
|
||||||
// 3. fonts
|
// 3. fonts
|
||||||
|
let output = Command::new("python")
|
||||||
|
.env("PYTHONIOENCODING", "utf-8")
|
||||||
|
.arg("../ui-editing-scripts/TMPAssetConverter.py")
|
||||||
|
.arg("assets/fonts/msgothic_0 SDF Atlas_Texture2D.dat")
|
||||||
|
.arg("assets/fonts/msgothic_0 SDF_TextMeshProFont.dat")
|
||||||
|
.arg(format!("assets/vanilla/{}/msgothic_0.dat", &chapter))
|
||||||
|
.arg(&directory)
|
||||||
|
.output()
|
||||||
|
.expect("failed to execute TMPAssetConverter.py");
|
||||||
|
|
||||||
|
if output.status.success() {
|
||||||
|
println!("{}", String::from_utf8_lossy(&output.stdout));
|
||||||
|
} else {
|
||||||
|
println!("{}", String::from_utf8_lossy(&output.stderr));
|
||||||
|
}
|
||||||
|
|
||||||
|
println!();
|
||||||
|
|
||||||
|
// 4. emip
|
||||||
|
let output = Command::new("python")
|
||||||
|
.env("PYTHONIOENCODING", "utf-8")
|
||||||
|
.arg("../ui-editing-scripts/EMIPGenerator.py")
|
||||||
|
.arg(&assets)
|
||||||
|
.arg(&directory)
|
||||||
|
.arg(&emip)
|
||||||
|
.output()
|
||||||
|
.expect("failed to execute EMIPGenerator.py");
|
||||||
|
|
||||||
|
if output.status.success() {
|
||||||
|
println!("{}", String::from_utf8_lossy(&output.stdout));
|
||||||
|
} else {
|
||||||
|
println!("{}", String::from_utf8_lossy(&output.stderr));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn copy_files(from: &str, to: &str) {
|
fn copy_files(from: &str, to: &str) {
|
||||||
@@ -48,4 +86,4 @@ fn copy_files(from: &str, to: &str) {
|
|||||||
let path = entry.unwrap().path();
|
let path = entry.unwrap().path();
|
||||||
fs::copy(&path, format!("{}/{}_Texture2D.png", to, path.file_stem().unwrap().to_str().unwrap())).expect("Unable to copy");
|
fs::copy(&path, format!("{}/{}_Texture2D.png", to, path.file_stem().unwrap().to_str().unwrap())).expect("Unable to copy");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user