add helper method to AppContext to simplify getting options

This commit is contained in:
theubusu
2026-02-22 20:14:04 +01:00
parent 3989710c70
commit a6567ae532
9 changed files with 16 additions and 21 deletions
+3 -5
View File
@@ -68,9 +68,7 @@ fn parse_tdi_to_modules(tdi_data: Vec<u8>) -> Result<Vec<TdiTgtInf>, Box<dyn std
pub fn extract_sddl_sec(app_ctx: &AppContext, _ctx: Box<dyn Any>) -> Result<(), Box<dyn std::error::Error>> {
let mut file = app_ctx.file().ok_or("Extractor expected file")?;
let save_extra = app_ctx.options.iter().any(|e| e == "sddl_sec:save_extra");
let split_peaks = app_ctx.options.iter().any(|e| e == "sddl_sec:split_peaks");
let decomp_peaks = !app_ctx.options.iter().any(|e| e == "sddl_sec:no_decomp_peaks");
let save_extra = app_ctx.has_option("sddl_sec:save_extra");
let mut secfile_hdr_reader = Cursor::new(decipher(&common::read_exact(&mut file, 32)?));
let secfile_header: SecHeader = secfile_hdr_reader.read_be()?;
@@ -162,10 +160,10 @@ pub fn extract_sddl_sec(app_ctx: &AppContext, _ctx: Box<dyn Any>) -> Result<(),
}
if split_peaks && module.module_name() == "PEAKS" {
if app_ctx.has_option("sddl_sec:split_peaks") && module.module_name() == "PEAKS" {
println!("\n- Splitting PEAKS");
if let Some(ref path) = final_out_path {
split_peaks_file(path, &app_ctx.output_dir, decomp_peaks)?;
split_peaks_file(path, &app_ctx.output_dir, !app_ctx.has_option("sddl_sec:no_decomp_peaks"))?;
}
}
}