mirror of
https://github.com/Ap0dexMe0/unixtract.git
synced 2026-07-16 05:04:22 +02:00
Add new mtk pkg support and key, needed changes for LZHSfs , add LZ4 support.
This commit is contained in:
+15
-6
@@ -12,11 +12,12 @@ use crate::keys;
|
||||
struct Header {
|
||||
#[br(count = 4)] vendor_magic_bytes: Vec<u8>,
|
||||
#[br(count = 8)] _mtk_magic: Vec<u8>, //#DH@FiRm
|
||||
#[br(count = 60)] version_bytes: Vec<u8>,
|
||||
#[br(count = 56)] version_bytes: Vec<u8>,
|
||||
_unk: u32,
|
||||
file_size: u32,
|
||||
_platform: u32,
|
||||
_flags: u32,
|
||||
#[br(count = 32)] product_name_bytes: Vec<u8>,
|
||||
#[br(count = 32)] _unknown: Vec<u8>,
|
||||
#[br(count = 32)] _digest: Vec<u8>,
|
||||
}
|
||||
impl Header {
|
||||
fn vendor_magic(&self) -> String {
|
||||
@@ -165,9 +166,17 @@ pub fn extract_mtk_pkg(mut file: &File, output_folder: &str) -> Result<(), Box<d
|
||||
|
||||
if part_entry.is_compressed() {
|
||||
let lzhs_out_path = Path::new(&output_folder).join(part_entry.name() + ".bin");
|
||||
decompress_lzhs_fs_file2file(&out_file, lzhs_out_path)?;
|
||||
//after decompression remove the temporary .lzhs file
|
||||
fs::remove_file(&output_path)?;
|
||||
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)?;
|
||||
},
|
||||
Err(e) => {
|
||||
eprintln!("Failed to decompress partition!, Error: {}. Saving compressed data...", e);
|
||||
//if the decompression is not successfull leave out compressed data.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
println!("-- Saved file!");
|
||||
|
||||
Reference in New Issue
Block a user