diff --git a/generated/json_data/qol.jsonc b/generated/json_data/qol.jsonc index cbc8c5b0..ac16d8c8 100644 --- a/generated/json_data/qol.jsonc +++ b/generated/json_data/qol.jsonc @@ -3848,7 +3848,7 @@ }, { "senderId": 600482, // [Relay] Relay - "targetId": 77591, // [SpecialFunction] [DEC] Ruins Entrance + "targetId": 77591, // [SpecialFunction] [DEC] Ruins Entrance "state": "ZERO", "message": "DECREMENT" }, @@ -3997,7 +3997,7 @@ "type": "PlayerInAreaRelay" }, { - "id": 77591, // [SpecialFunction] [DEC] Ruins Entrance + "id": 77591, // [SpecialFunction] [DEC] Ruins Entrance "type": "ScriptLayerController", "layerChangeRoomId": 944775450, "layerChangeLayerId": 3 diff --git a/src/bin/randomprime_patcher.rs b/src/bin/randomprime_patcher.rs index 35ff3231..e15c4b8c 100644 --- a/src/bin/randomprime_patcher.rs +++ b/src/bin/randomprime_patcher.rs @@ -10,6 +10,7 @@ use clap::Format; use std::{ panic, process::Command, + time::Instant, }; struct ProgressNotifier @@ -101,9 +102,10 @@ fn maybe_pause_at_exit() fn main_inner() -> Result<(), String> { + let start_time = Instant::now(); let patch_config = PatchConfig::from_cli_options()?; let pn = ProgressNotifier::new(patch_config.quiet); - patches::patch_iso(patch_config, pn)?; + patches::patch_iso(patch_config, pn, start_time)?; println!("Done"); Ok(()) } diff --git a/src/c_interface.rs b/src/c_interface.rs index 85f00eaa..f7878e5f 100644 --- a/src/c_interface.rs +++ b/src/c_interface.rs @@ -13,6 +13,7 @@ use std::{ panic, path::Path, os::raw::c_char, + time::Instant, }; use serde::{Serialize}; @@ -119,13 +120,16 @@ impl structs::ProgressNotifier for ProgressNotifier fn inner(config_json: *const c_char, cb_data: *const (), cb: extern fn(*const (), *const c_char)) -> Result<(), String> { + let start_time = Instant::now(); + let config_json = unsafe { CStr::from_ptr(config_json) }.to_str() .map_err(|e| format!("JSON parse failed: {}", e))?; let patch_config = PatchConfig::from_json(config_json)?; let pn = ProgressNotifier::new(cb_data, cb); - patches::patch_iso(patch_config, pn)?; + patches::patch_iso(patch_config, pn, start_time)?; + Ok(()) } diff --git a/src/patches.rs b/src/patches.rs index b98edf1e..397fe757 100644 --- a/src/patches.rs +++ b/src/patches.rs @@ -14421,7 +14421,7 @@ fn patch_arboretum_sandstone<'a>(patcher: &mut PrimePatcher<'_, 'a>) }); } -pub fn patch_iso(config: PatchConfig, mut pn: T) -> Result<(), String> +pub fn patch_iso(config: PatchConfig, mut pn: T, start_time: Instant) -> Result<(), String> where T: structs::ProgressNotifier { let mut audio_override_patches: Vec = Vec::new(); @@ -14473,7 +14473,7 @@ pub fn patch_iso(config: PatchConfig, mut pn: T) -> Result<(), String> let mut reader = Reader::new(&config.input_iso[..]); let mut gc_disc: structs::GcDisc = reader.read(()); - if gc_disc.find_file("randomprime.txt").is_some() { + if gc_disc.find_file("randomprime.json").is_some() { Err(concat!("The input ISO has already been randomized once before. ", "You must start from an unmodified ISO every time." ))? @@ -14489,6 +14489,8 @@ pub fn patch_iso(config: PatchConfig, mut pn: T) -> Result<(), String> build_and_run_patches(&mut gc_disc, &config, audio_override_patches)?; + println!("Created patches in {:?}", start_time.elapsed()); + { let json_string = serde_json::to_string(&config) .map_err(|e| format!("Failed to serialize patch config: {}", e))?; @@ -17572,9 +17574,7 @@ fn build_and_run_patches<'r>(gc_disc: &mut structs::GcDisc<'r>, config: &PatchCo ); } - let time = Instant::now(); patcher.run(gc_disc)?; - println!("Created patches in {:?}", time.elapsed()); Ok(()) }