msd: add option to print ouith tree instead of static, some improvements to pfl_upg, mtk_pkg: add option to not delete decompressed lzhs part

This commit is contained in:
theubusu
2026-02-18 22:54:03 +01:00
parent ab727411dc
commit f4a146a389
11 changed files with 128 additions and 112 deletions
+6 -3
View File
@@ -43,6 +43,7 @@ pub fn is_mtk_pkg_file(app_ctx: &AppContext) -> Result<Option<Box<dyn Any>>, Box
pub fn extract_mtk_pkg(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 ctx = ctx.downcast::<MtkPkgContext>().expect("Missing context");
let no_del_comp = app_ctx.options.iter().any(|e| e == "mtk_pkg:no_del_comp");
let file_size = file.metadata()?.len();
let header = ctx.decrypted_header;
@@ -148,9 +149,11 @@ pub fn extract_mtk_pkg(app_ctx: &AppContext, ctx: Box<dyn Any>) -> Result<(), Bo
let lzhs_out_path = Path::new(&app_ctx.output_dir).join(part_entry.name() + ".bin");
match decompress_lzhs_fs_file2file(&out_file, lzhs_out_path) {
Ok(()) => {
println!("- Decompressed Successfully!");
//after successfull decompression remove the temporary .lzhs file
fs::remove_file(&output_path)?;
println!("- Decompressed Successfully!");
if !no_del_comp {
//after successfull decompression remove the temporary .lzhs file
fs::remove_file(&output_path)?;
}
},
Err(e) => {
eprintln!("Failed to decompress partition!, Error: {}. Saving compressed data...", e);