mirror of
https://github.com/Ap0dexMe0/unixtract.git
synced 2026-07-15 21:00:03 +02:00
tpv_timg - now rename to nvt_timg, fix false gzip extraction
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
pub mod mstar;
|
||||
pub mod samsung_old;
|
||||
pub mod tpv_timg;
|
||||
pub mod nvt_timg;
|
||||
pub mod pfl_upg;
|
||||
pub mod sddl_sec;
|
||||
pub mod novatek;
|
||||
|
||||
@@ -32,7 +32,7 @@ impl PIMG {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_tpv_timg_file(file: &File) -> bool {
|
||||
pub fn is_nvt_timg_file(file: &File) -> bool {
|
||||
let header = common::read_file(&file, 0, 4).expect("Failed to read from file.");
|
||||
if header == b"TIMG" {
|
||||
true
|
||||
@@ -48,7 +48,7 @@ fn decompress_gzip(compressed_data: &[u8]) -> Result<Vec<u8>, Box<dyn std::error
|
||||
Ok(decompressed)
|
||||
}
|
||||
|
||||
pub fn extract_tpv_timg(mut file: &File, output_folder: &str) -> Result<(), Box<dyn std::error::Error>> {
|
||||
pub fn extract_nvt_timg(mut file: &File, output_folder: &str) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let _timg = common::read_exact(&mut file, 288)?; //TIMG magic + header
|
||||
|
||||
loop {
|
||||
@@ -62,7 +62,7 @@ pub fn extract_tpv_timg(mut file: &File, output_folder: &str) -> Result<(), Box<
|
||||
|
||||
let out_data;
|
||||
|
||||
if pimg.comp_type() == "gzip" {
|
||||
if pimg.comp_type() == "gzip" && data.starts_with(b"\x1F\x8B") { //additionally check for gzip header, because sometimes its deceptive
|
||||
println!("- Decompressing gzip...");
|
||||
out_data = decompress_gzip(&data)?;
|
||||
} else if pimg.comp_type() == "none" {
|
||||
+3
-3
@@ -65,9 +65,9 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
println!("MSD11 file detected!");
|
||||
formats::msd11::extract_msd11(&file, &output_path)?;
|
||||
}
|
||||
else if formats::tpv_timg::is_tpv_timg_file(&file) {
|
||||
println!("TPV TIMG file detected!");
|
||||
formats::tpv_timg::extract_tpv_timg(&file, &output_path)?;
|
||||
else if formats::nvt_timg::is_nvt_timg_file(&file) {
|
||||
println!("Novatek TIMG file detected!");
|
||||
formats::nvt_timg::extract_nvt_timg(&file, &output_path)?;
|
||||
}
|
||||
else if formats::novatek::is_novatek_file(&file) {
|
||||
println!("Novatek file detected!");
|
||||
|
||||
Reference in New Issue
Block a user