From 82be46fbd6909f3ea89748f29032873dc3050d0c Mon Sep 17 00:00:00 2001 From: theubusu <80545678+theubusu@users.noreply.github.com> Date: Sun, 23 Nov 2025 23:43:02 +0100 Subject: [PATCH] tpv_timg - now rename to nvt_timg, fix false gzip extraction --- src/formats.rs | 2 +- src/formats/{tpv_timg.rs => nvt_timg.rs} | 6 +++--- src/main.rs | 6 +++--- unixtract.md | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) rename src/formats/{tpv_timg.rs => nvt_timg.rs} (90%) diff --git a/src/formats.rs b/src/formats.rs index 6d3394e..0400b6e 100644 --- a/src/formats.rs +++ b/src/formats.rs @@ -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; diff --git a/src/formats/tpv_timg.rs b/src/formats/nvt_timg.rs similarity index 90% rename from src/formats/tpv_timg.rs rename to src/formats/nvt_timg.rs index 04b8e06..70a4cd8 100644 --- a/src/formats/tpv_timg.rs +++ b/src/formats/nvt_timg.rs @@ -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, Box Result<(), Box> { +pub fn extract_nvt_timg(mut file: &File, output_folder: &str) -> Result<(), Box> { 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" { diff --git a/src/main.rs b/src/main.rs index b292c4e..f38e572 100644 --- a/src/main.rs +++ b/src/main.rs @@ -65,9 +65,9 @@ fn main() -> Result<(), Box> { 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!"); diff --git a/unixtract.md b/unixtract.md index 88ec226..870cfe1 100644 --- a/unixtract.md +++ b/unixtract.md @@ -12,6 +12,7 @@ | Mediatek PKG | Many Mediatek-based TVs (Hisense, Sony, Panasonic, Philips...) | Only files with 144 byte header and using 4xVendor magic as enc key are supported | https://github.com/openlgtv/epk2extract | | Mediatek upgrade_loader | Older Mediatek-based TVs | All files should be supported providing they are not encrypted | - | | Novatek pkg | Some Novatek-based TVs (Philips, LG..) | All files should be supported | https://github.com/openlgtv/epk2extract | +| Novatek TIMG | Later Novatek Based TVs (Philips TitanOS/Hisense) | All files should be supported | - | | Panasonic Blu-Ray (PANA_DVD) | Panasonic Blu-Ray Players/Recorders | Only some files are supported (**depends on keys**) | - | | Philips UPG | Philips pre-TPVision TVS 2008-2013 | Only some files are supported (**depends on keys**) | https://github.com/frederic/pflupg-tool | | PUP | Sony PlayStation 4/ PlayStation 5 | File has to be decrypted | https://github.com/Zer0xFF/ps4-pup-unpacker | @@ -21,4 +22,3 @@ | SDDL.SEC | Panasonic TVs 2011+ | All files 2011+ are supported | https://github.com/theubusu/sddl_dec | | SLP | Samsung Tizen-based NX series cameras | All files should be supported | - | | Sony BDP | Sony Blu-Ray players | Only platforms up to MSB18 are supported | http://malcolmstagg.com/bdp/s390-firmware.html | -| Philips/TPVision TIMG | Philips/TPV Non-Android (TitanOS/ 2023) TVs | All files should be supported | - | \ No newline at end of file