mirror of
https://github.com/Ap0dexMe0/unixtract.git
synced 2026-07-15 21:00:03 +02:00
newreg: mostly var name changes
This commit is contained in:
+23
-22
@@ -1,10 +1,10 @@
|
|||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
use crate::ProgramContext;
|
use crate::AppContext;
|
||||||
|
|
||||||
pub struct Format {
|
pub struct Format {
|
||||||
pub name: &'static str,
|
pub name: &'static str,
|
||||||
pub detect_func: fn(&ProgramContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>>,
|
pub detector_func: fn(&AppContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>>,
|
||||||
pub run_func: fn(&ProgramContext, Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>>,
|
pub extractor_func: fn(&AppContext, Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub mod mstar;
|
pub mod mstar;
|
||||||
@@ -44,32 +44,33 @@ pub mod mtk_bdp;
|
|||||||
|
|
||||||
pub fn get_registry() -> Vec<Format> {
|
pub fn get_registry() -> Vec<Format> {
|
||||||
return vec![
|
return vec![
|
||||||
crate::formats::amlogic::format(),
|
|
||||||
crate::formats::epk1::format(),
|
|
||||||
crate::formats::android_ota_payload::format(),
|
|
||||||
crate::formats::bdl::format(),
|
|
||||||
crate::formats::epk2::format(),
|
|
||||||
crate::formats::epk::format(),
|
|
||||||
crate::formats::epk2b::format(),
|
|
||||||
crate::formats::funai_upg::format(),
|
|
||||||
crate::formats::invincible_image::format(),
|
|
||||||
crate::formats::msd10::format(),
|
|
||||||
crate::formats::msd11::format(),
|
|
||||||
crate::formats::mstar::format(),
|
crate::formats::mstar::format(),
|
||||||
crate::formats::novatek::format(),
|
|
||||||
crate::formats::nvt_timg::format(),
|
crate::formats::nvt_timg::format(),
|
||||||
crate::formats::pfl_upg::format(),
|
crate::formats::pfl_upg::format(),
|
||||||
crate::formats::pup::format(),
|
|
||||||
crate::formats::roku::format(),
|
|
||||||
crate::formats::ruf::format(),
|
|
||||||
crate::formats::rvp::format(),
|
|
||||||
crate::formats::sddl_sec::format(),
|
crate::formats::sddl_sec::format(),
|
||||||
|
crate::formats::novatek::format(),
|
||||||
|
crate::formats::ruf::format(),
|
||||||
|
crate::formats::invincible_image::format(),
|
||||||
crate::formats::slp::format(),
|
crate::formats::slp::format(),
|
||||||
crate::formats::mtk_pkg_old::format(),
|
crate::formats::roku::format(),
|
||||||
crate::formats::mtk_pkg::format(),
|
|
||||||
crate::formats::sony_bdp::format(),
|
crate::formats::sony_bdp::format(),
|
||||||
crate::formats::mtk_pkg_new::format(),
|
crate::formats::rvp::format(),
|
||||||
|
crate::formats::funai_upg::format(),
|
||||||
crate::formats::pana_dvd::format(),
|
crate::formats::pana_dvd::format(),
|
||||||
|
crate::formats::android_ota_payload::format(),
|
||||||
|
crate::formats::bdl::format(),
|
||||||
|
crate::formats::amlogic::format(),
|
||||||
|
crate::formats::pup::format(),
|
||||||
|
crate::formats::msd10::format(),
|
||||||
|
crate::formats::msd11::format(),
|
||||||
|
crate::formats::epk::format(),
|
||||||
|
crate::formats::epk1::format(),
|
||||||
|
crate::formats::epk2::format(),
|
||||||
|
crate::formats::epk2b::format(),
|
||||||
|
crate::formats::epk3::format(),
|
||||||
|
crate::formats::mtk_pkg::format(),
|
||||||
|
crate::formats::mtk_pkg_old::format(),
|
||||||
|
crate::formats::mtk_pkg_new::format(),
|
||||||
crate::formats::mtk_bdp::format(),
|
crate::formats::mtk_bdp::format(),
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
use crate::{ProgramContext, formats::Format};
|
use crate::{AppContext, formats::Format};
|
||||||
pub fn format() -> Format {
|
pub fn format() -> Format {
|
||||||
Format { name: "amlogic", detect_func: is_amlogic_file, run_func: extract_amlogic }
|
Format { name: "amlogic", detector_func: is_amlogic_file, extractor_func: extract_amlogic }
|
||||||
}
|
}
|
||||||
|
|
||||||
use std::path::{Path};
|
use std::path::{Path};
|
||||||
@@ -49,7 +49,7 @@ impl ItemEntry {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_amlogic_file(app_ctx: &ProgramContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
pub fn is_amlogic_file(app_ctx: &AppContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
||||||
let header = common::read_file(app_ctx.file, 8, 4)?;
|
let header = common::read_file(app_ctx.file, 8, 4)?;
|
||||||
if header == b"\x56\x19\xB5\x27" {
|
if header == b"\x56\x19\xB5\x27" {
|
||||||
Ok(Some(Box::new(())))
|
Ok(Some(Box::new(())))
|
||||||
@@ -58,7 +58,7 @@ pub fn is_amlogic_file(app_ctx: &ProgramContext) -> Result<Option<Box<dyn Any>>,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn extract_amlogic(app_ctx: &ProgramContext, _ctx: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
pub fn extract_amlogic(app_ctx: &AppContext, _ctx: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let mut file = app_ctx.file;
|
let mut file = app_ctx.file;
|
||||||
file.seek(SeekFrom::Start(0))?;
|
file.seek(SeekFrom::Start(0))?;
|
||||||
let header: ImageHeader = file.read_le()?;
|
let header: ImageHeader = file.read_le()?;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
use crate::{ProgramContext, formats::Format};
|
use crate::{AppContext, formats::Format};
|
||||||
pub fn format() -> Format {
|
pub fn format() -> Format {
|
||||||
Format { name: "android_ota_payload", detect_func: is_android_ota_payload_file, run_func: extract_android_ota_payload }
|
Format { name: "android_ota_payload", detector_func: is_android_ota_payload_file, extractor_func: extract_android_ota_payload }
|
||||||
}
|
}
|
||||||
|
|
||||||
use std::fs::{self, OpenOptions};
|
use std::fs::{self, OpenOptions};
|
||||||
@@ -22,7 +22,7 @@ struct Header {
|
|||||||
metadata_signature_size: u32,
|
metadata_signature_size: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_android_ota_payload_file(app_ctx: &ProgramContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
pub fn is_android_ota_payload_file(app_ctx: &AppContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
||||||
let header = common::read_file(app_ctx.file, 0, 4)?;
|
let header = common::read_file(app_ctx.file, 0, 4)?;
|
||||||
if header == b"CrAU" {
|
if header == b"CrAU" {
|
||||||
Ok(Some(Box::new(())))
|
Ok(Some(Box::new(())))
|
||||||
@@ -31,7 +31,7 @@ pub fn is_android_ota_payload_file(app_ctx: &ProgramContext) -> Result<Option<Bo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn extract_android_ota_payload(app_ctx: &ProgramContext, _ctx: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
pub fn extract_android_ota_payload(app_ctx: &AppContext, _ctx: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let mut file = app_ctx.file;
|
let mut file = app_ctx.file;
|
||||||
let header: Header = file.read_be()?;
|
let header: Header = file.read_be()?;
|
||||||
println!("File info:\nFormat version: {}\nManifest size: {}", header.file_format_version, header.manifest_size);
|
println!("File info:\nFormat version: {}\nManifest size: {}", header.file_format_version, header.manifest_size);
|
||||||
|
|||||||
+4
-4
@@ -1,7 +1,7 @@
|
|||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
use crate::{ProgramContext, formats::Format};
|
use crate::{AppContext, formats::Format};
|
||||||
pub fn format() -> Format {
|
pub fn format() -> Format {
|
||||||
Format { name: "bdl", detect_func: is_bdl_file, run_func: extract_bdl }
|
Format { name: "bdl", detector_func: is_bdl_file, extractor_func: extract_bdl }
|
||||||
}
|
}
|
||||||
|
|
||||||
use std::path::{Path};
|
use std::path::{Path};
|
||||||
@@ -85,7 +85,7 @@ impl PkgEntry {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_bdl_file(app_ctx: &ProgramContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
pub fn is_bdl_file(app_ctx: &AppContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
||||||
let header = common::read_file(app_ctx.file, 0, 4)?;
|
let header = common::read_file(app_ctx.file, 0, 4)?;
|
||||||
if header == b"ibdl" {
|
if header == b"ibdl" {
|
||||||
Ok(Some(Box::new(())))
|
Ok(Some(Box::new(())))
|
||||||
@@ -94,7 +94,7 @@ pub fn is_bdl_file(app_ctx: &ProgramContext) -> Result<Option<Box<dyn Any>>, Box
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn extract_bdl(app_ctx: &ProgramContext, _ctx: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
pub fn extract_bdl(app_ctx: &AppContext, _ctx: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let mut file = app_ctx.file;
|
let mut file = app_ctx.file;
|
||||||
let header: BdlHeader = file.read_le()?;
|
let header: BdlHeader = file.read_le()?;
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -1,7 +1,7 @@
|
|||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
use crate::{ProgramContext, formats::Format};
|
use crate::{AppContext, formats::Format};
|
||||||
pub fn format() -> Format {
|
pub fn format() -> Format {
|
||||||
Format { name: "epk", detect_func: is_epk_file, run_func: extract_epk }
|
Format { name: "epk", detector_func: is_epk_file, extractor_func: extract_epk }
|
||||||
}
|
}
|
||||||
|
|
||||||
use crate::utils::common;
|
use crate::utils::common;
|
||||||
@@ -11,7 +11,7 @@ pub struct EpkContext {
|
|||||||
epk_version: u8,
|
epk_version: u8,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_epk_file(app_ctx: &ProgramContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
pub fn is_epk_file(app_ctx: &AppContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
||||||
let versions = common::read_file(app_ctx.file, 1712, 36)?;
|
let versions = common::read_file(app_ctx.file, 1712, 36)?;
|
||||||
|
|
||||||
if let Some(epk_version) = check_epk_version(&versions) {
|
if let Some(epk_version) = check_epk_version(&versions) {
|
||||||
@@ -50,7 +50,7 @@ fn match_with_pattern(data: &[u8], pattern: &str) -> bool {
|
|||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn extract_epk(app_ctx: &ProgramContext, ctx: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
pub fn extract_epk(app_ctx: &AppContext, ctx: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let ctx = ctx.and_then(|c| c.downcast::<EpkContext>().ok()).ok_or("Context is invalid or missing!")?;
|
let ctx = ctx.and_then(|c| c.downcast::<EpkContext>().ok()).ok_or("Context is invalid or missing!")?;
|
||||||
|
|
||||||
let versions = common::read_file(app_ctx.file, 1712, 36)?;
|
let versions = common::read_file(app_ctx.file, 1712, 36)?;
|
||||||
|
|||||||
+4
-4
@@ -1,7 +1,7 @@
|
|||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
use crate::{ProgramContext, formats::Format};
|
use crate::{AppContext, formats::Format};
|
||||||
pub fn format() -> Format {
|
pub fn format() -> Format {
|
||||||
Format { name: "epk1", detect_func: is_epk1_file, run_func: extract_epk1 }
|
Format { name: "epk1", detector_func: is_epk1_file, extractor_func: extract_epk1 }
|
||||||
}
|
}
|
||||||
|
|
||||||
use std::path::{Path};
|
use std::path::{Path};
|
||||||
@@ -40,7 +40,7 @@ struct Pak {
|
|||||||
size : u32,
|
size : u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_epk1_file(app_ctx: &ProgramContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
pub fn is_epk1_file(app_ctx: &AppContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
||||||
let epk2_magic = common::read_file(app_ctx.file, 12, 4)?; //for epk2b
|
let epk2_magic = common::read_file(app_ctx.file, 12, 4)?; //for epk2b
|
||||||
let epak_magic = common::read_file(app_ctx.file, 0, 4)?;
|
let epak_magic = common::read_file(app_ctx.file, 0, 4)?;
|
||||||
if epak_magic == b"epak" && epk2_magic != b"EPK2" {
|
if epak_magic == b"epak" && epk2_magic != b"EPK2" {
|
||||||
@@ -50,7 +50,7 @@ pub fn is_epk1_file(app_ctx: &ProgramContext) -> Result<Option<Box<dyn Any>>, Bo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn extract_epk1(app_ctx: &ProgramContext, _ctx: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
pub fn extract_epk1(app_ctx: &AppContext, _ctx: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let mut file = app_ctx.file;
|
let mut file = app_ctx.file;
|
||||||
//check type of epk1
|
//check type of epk1
|
||||||
let epk1_type;
|
let epk1_type;
|
||||||
|
|||||||
+4
-4
@@ -1,7 +1,7 @@
|
|||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
use crate::{ProgramContext, formats::Format};
|
use crate::{AppContext, formats::Format};
|
||||||
pub fn format() -> Format {
|
pub fn format() -> Format {
|
||||||
Format { name: "epk2", detect_func: is_epk2_file, run_func: extract_epk2 }
|
Format { name: "epk2", detector_func: is_epk2_file, extractor_func: extract_epk2 }
|
||||||
}
|
}
|
||||||
|
|
||||||
use std::fs::{self, OpenOptions};
|
use std::fs::{self, OpenOptions};
|
||||||
@@ -71,7 +71,7 @@ struct Pak {
|
|||||||
name: String,
|
name: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_epk2_file(app_ctx: &ProgramContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
pub fn is_epk2_file(app_ctx: &AppContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
||||||
let header = common::read_file(app_ctx.file, 128, 4)?;
|
let header = common::read_file(app_ctx.file, 128, 4)?;
|
||||||
if header == b"epak" {
|
if header == b"epak" {
|
||||||
Ok(Some(Box::new(())))
|
Ok(Some(Box::new(())))
|
||||||
@@ -80,7 +80,7 @@ pub fn is_epk2_file(app_ctx: &ProgramContext) -> Result<Option<Box<dyn Any>>, Bo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn extract_epk2(app_ctx: &ProgramContext, _: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
pub fn extract_epk2(app_ctx: &AppContext, _: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let mut file = app_ctx.file;
|
let mut file = app_ctx.file;
|
||||||
let _header_signature = common::read_exact(&mut file, SIGNATURE_SIZE as usize)?;
|
let _header_signature = common::read_exact(&mut file, SIGNATURE_SIZE as usize)?;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
use crate::{ProgramContext, formats::Format};
|
use crate::{AppContext, formats::Format};
|
||||||
pub fn format() -> Format {
|
pub fn format() -> Format {
|
||||||
Format { name: "epk2b", detect_func: is_epk2b_file, run_func: extract_epk2b }
|
Format { name: "epk2b", detector_func: is_epk2b_file, extractor_func: extract_epk2b }
|
||||||
}
|
}
|
||||||
|
|
||||||
use std::path::{Path};
|
use std::path::{Path};
|
||||||
@@ -56,7 +56,7 @@ struct Pak {
|
|||||||
size : u32,
|
size : u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_epk2b_file(app_ctx: &ProgramContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
pub fn is_epk2b_file(app_ctx: &AppContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
||||||
let epk2_magic = common::read_file(app_ctx.file, 12, 4)?;
|
let epk2_magic = common::read_file(app_ctx.file, 12, 4)?;
|
||||||
let epak_magic = common::read_file(app_ctx.file, 0, 4)?;
|
let epak_magic = common::read_file(app_ctx.file, 0, 4)?;
|
||||||
if epak_magic == b"epak" && epk2_magic == b"EPK2" {
|
if epak_magic == b"epak" && epk2_magic == b"EPK2" {
|
||||||
@@ -66,7 +66,7 @@ pub fn is_epk2b_file(app_ctx: &ProgramContext) -> Result<Option<Box<dyn Any>>, B
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn extract_epk2b(app_ctx: &ProgramContext, _ctx: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
pub fn extract_epk2b(app_ctx: &AppContext, _ctx: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let mut file = app_ctx.file;
|
let mut file = app_ctx.file;
|
||||||
let header: EpkHeader = file.read_le()?;
|
let header: EpkHeader = file.read_le()?;
|
||||||
|
|
||||||
|
|||||||
+9
-2
@@ -1,5 +1,8 @@
|
|||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
use crate::{ProgramContext};
|
use crate::{AppContext, formats::Format};
|
||||||
|
pub fn format() -> Format {
|
||||||
|
Format { name: "epk3", detector_func: is_epk3_file, extractor_func: extract_epk3 }
|
||||||
|
}
|
||||||
|
|
||||||
use std::fs::{self, OpenOptions};
|
use std::fs::{self, OpenOptions};
|
||||||
use std::path::{Path};
|
use std::path::{Path};
|
||||||
@@ -73,7 +76,11 @@ impl PkgInfoEntry {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn extract_epk3(app_ctx: &ProgramContext, _ctx: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
pub fn is_epk3_file(_app_ctx: &AppContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
||||||
|
Ok(None)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn extract_epk3(app_ctx: &AppContext, _ctx: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let mut file = app_ctx.file;
|
let mut file = app_ctx.file;
|
||||||
file.seek(SeekFrom::Start(0))?;
|
file.seek(SeekFrom::Start(0))?;
|
||||||
let stored_header = common::read_exact(&mut file, 1712)?;
|
let stored_header = common::read_exact(&mut file, 1712)?;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
use crate::{ProgramContext, formats::Format};
|
use crate::{AppContext, formats::Format};
|
||||||
pub fn format() -> Format {
|
pub fn format() -> Format {
|
||||||
Format { name: "funai_upg", detect_func: is_funai_upg_file, run_func: extract_funai_upg }
|
Format { name: "funai_upg", detector_func: is_funai_upg_file, extractor_func: extract_funai_upg }
|
||||||
}
|
}
|
||||||
|
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
@@ -25,7 +25,7 @@ struct Entry {
|
|||||||
_unk: u16,
|
_unk: u16,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_funai_upg_file(app_ctx: &ProgramContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
pub fn is_funai_upg_file(app_ctx: &AppContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
||||||
let header = common::read_file(app_ctx.file, 0, 6)?;
|
let header = common::read_file(app_ctx.file, 0, 6)?;
|
||||||
if header == b"UPG\x00\x00\x00" {
|
if header == b"UPG\x00\x00\x00" {
|
||||||
Ok(Some(Box::new(())))
|
Ok(Some(Box::new(())))
|
||||||
@@ -34,7 +34,7 @@ pub fn is_funai_upg_file(app_ctx: &ProgramContext) -> Result<Option<Box<dyn Any>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn extract_funai_upg(app_ctx: &ProgramContext, _ctx: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
pub fn extract_funai_upg(app_ctx: &AppContext, _ctx: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let mut file = app_ctx.file;
|
let mut file = app_ctx.file;
|
||||||
let header: Header = file.read_le()?;
|
let header: Header = file.read_le()?;
|
||||||
println!("File info:\nFile size: {}\nEntry count: {}", header.file_size, header.entry_count);
|
println!("File info:\nFile size: {}\nEntry count: {}", header.file_size, header.entry_count);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
use crate::{ProgramContext, formats::Format};
|
use crate::{AppContext, formats::Format};
|
||||||
pub fn format() -> Format {
|
pub fn format() -> Format {
|
||||||
Format { name: "invincible_image", detect_func: is_invincible_image_file, run_func: extract_invincible_image }
|
Format { name: "invincible_image", detector_func: is_invincible_image_file, extractor_func: extract_invincible_image }
|
||||||
}
|
}
|
||||||
|
|
||||||
use std::path::{Path};
|
use std::path::{Path};
|
||||||
@@ -62,7 +62,7 @@ impl Entry {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_invincible_image_file(app_ctx: &ProgramContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
pub fn is_invincible_image_file(app_ctx: &AppContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
||||||
let header = common::read_file(app_ctx.file, 0, 16)?;
|
let header = common::read_file(app_ctx.file, 0, 16)?;
|
||||||
if header == b"INVINCIBLE_IMAGE" {
|
if header == b"INVINCIBLE_IMAGE" {
|
||||||
Ok(Some(Box::new(())))
|
Ok(Some(Box::new(())))
|
||||||
@@ -71,7 +71,7 @@ pub fn is_invincible_image_file(app_ctx: &ProgramContext) -> Result<Option<Box<d
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn extract_invincible_image(app_ctx: &ProgramContext, _ctx: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
pub fn extract_invincible_image(app_ctx: &AppContext, _ctx: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let mut file = app_ctx.file;
|
let mut file = app_ctx.file;
|
||||||
let header: Header = file.read_le()?;
|
let header: Header = file.read_le()?;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
use crate::{ProgramContext, formats::Format};
|
use crate::{AppContext, formats::Format};
|
||||||
pub fn format() -> Format {
|
pub fn format() -> Format {
|
||||||
Format { name: "msd10", detect_func: is_msd10_file, run_func: extract_msd10 }
|
Format { name: "msd10", detector_func: is_msd10_file, extractor_func: extract_msd10 }
|
||||||
}
|
}
|
||||||
|
|
||||||
use std::fs::{self, OpenOptions};
|
use std::fs::{self, OpenOptions};
|
||||||
@@ -47,7 +47,7 @@ struct Section {
|
|||||||
size: u32,
|
size: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_msd10_file(app_ctx: &ProgramContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
pub fn is_msd10_file(app_ctx: &AppContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
||||||
let header = common::read_file(app_ctx.file, 0, 6)?;
|
let header = common::read_file(app_ctx.file, 0, 6)?;
|
||||||
if header == b"MSDU10" {
|
if header == b"MSDU10" {
|
||||||
Ok(Some(Box::new(())))
|
Ok(Some(Box::new(())))
|
||||||
@@ -56,7 +56,7 @@ pub fn is_msd10_file(app_ctx: &ProgramContext) -> Result<Option<Box<dyn Any>>, B
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn extract_msd10(app_ctx: &ProgramContext, _ctx: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
pub fn extract_msd10(app_ctx: &AppContext, _ctx: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let mut file = app_ctx.file;
|
let mut file = app_ctx.file;
|
||||||
let header: FileHeader = file.read_le()?;
|
let header: FileHeader = file.read_le()?;
|
||||||
println!("\nNumber of sections: {}", header.section_count);
|
println!("\nNumber of sections: {}", header.section_count);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
use crate::{ProgramContext, formats::Format};
|
use crate::{AppContext, formats::Format};
|
||||||
pub fn format() -> Format {
|
pub fn format() -> Format {
|
||||||
Format { name: "msd11", detect_func: is_msd11_file, run_func: extract_msd11 }
|
Format { name: "msd11", detector_func: is_msd11_file, extractor_func: extract_msd11 }
|
||||||
}
|
}
|
||||||
|
|
||||||
use std::fs::{self, OpenOptions};
|
use std::fs::{self, OpenOptions};
|
||||||
@@ -48,7 +48,7 @@ struct Section {
|
|||||||
size: u64,
|
size: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_msd11_file(app_ctx: &ProgramContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
pub fn is_msd11_file(app_ctx: &AppContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
||||||
let header = common::read_file(app_ctx.file, 0, 6)?;
|
let header = common::read_file(app_ctx.file, 0, 6)?;
|
||||||
if header == b"MSDU11" {
|
if header == b"MSDU11" {
|
||||||
Ok(Some(Box::new(())))
|
Ok(Some(Box::new(())))
|
||||||
@@ -57,7 +57,7 @@ pub fn is_msd11_file(app_ctx: &ProgramContext) -> Result<Option<Box<dyn Any>>, B
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn extract_msd11(app_ctx: &ProgramContext, _ctx: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
pub fn extract_msd11(app_ctx: &AppContext, _ctx: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let mut file = app_ctx.file;
|
let mut file = app_ctx.file;
|
||||||
let header: FileHeader = file.read_le()?;
|
let header: FileHeader = file.read_le()?;
|
||||||
println!("\nNumber of sections: {}", header.section_count);
|
println!("\nNumber of sections: {}", header.section_count);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
use crate::{ProgramContext, formats::Format};
|
use crate::{AppContext, formats::Format};
|
||||||
pub fn format() -> Format {
|
pub fn format() -> Format {
|
||||||
Format { name: "mstar", detect_func: is_mstar_file, run_func: extract_mstar }
|
Format { name: "mstar", detector_func: is_mstar_file, extractor_func: extract_mstar }
|
||||||
}
|
}
|
||||||
|
|
||||||
use std::fs::{self, OpenOptions};
|
use std::fs::{self, OpenOptions};
|
||||||
@@ -13,7 +13,7 @@ use crate::utils::compression::{decompress_lzma, decompress_lz4};
|
|||||||
use crate::utils::lzop::{unlzop_to_file};
|
use crate::utils::lzop::{unlzop_to_file};
|
||||||
use crate::utils::sparse::{unsparse_to_file};
|
use crate::utils::sparse::{unsparse_to_file};
|
||||||
|
|
||||||
pub fn is_mstar_file(app_ctx: &ProgramContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
pub fn is_mstar_file(app_ctx: &AppContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
||||||
let header = common::read_file(app_ctx.file, 0, 32768)?;
|
let header = common::read_file(app_ctx.file, 0, 32768)?;
|
||||||
let header_string = String::from_utf8_lossy(&header);
|
let header_string = String::from_utf8_lossy(&header);
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ fn parse_number(s: &str) -> Option<u64> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn extract_mstar(app_ctx: &ProgramContext, _ctx: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
pub fn extract_mstar(app_ctx: &AppContext, _ctx: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let file = app_ctx.file;
|
let file = app_ctx.file;
|
||||||
|
|
||||||
let mut script = common::read_file(&file, 0, 32768)?;
|
let mut script = common::read_file(&file, 0, 32768)?;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
use crate::{ProgramContext, formats::Format};
|
use crate::{AppContext, formats::Format};
|
||||||
pub fn format() -> Format {
|
pub fn format() -> Format {
|
||||||
Format { name: "mtk_bdp", detect_func: is_mtk_bdp_file, run_func: extract_mtk_bdp }
|
Format { name: "mtk_bdp", detector_func: is_mtk_bdp_file, extractor_func: extract_mtk_bdp }
|
||||||
}
|
}
|
||||||
|
|
||||||
use std::path::{Path};
|
use std::path::{Path};
|
||||||
@@ -77,7 +77,7 @@ fn find_bytes(data: &[u8], pattern: &[u8]) -> Option<usize> {
|
|||||||
data.windows(pattern.len()).position(|window| window == pattern)
|
data.windows(pattern.len()).position(|window| window == pattern)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_mtk_bdp_file(app_ctx: &ProgramContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
pub fn is_mtk_bdp_file(app_ctx: &AppContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
||||||
let mut file = app_ctx.file;
|
let mut file = app_ctx.file;
|
||||||
let file_size = file.metadata()?.len();
|
let file_size = file.metadata()?.len();
|
||||||
let mut data = Vec::new();
|
let mut data = Vec::new();
|
||||||
@@ -95,7 +95,7 @@ pub fn is_mtk_bdp_file(app_ctx: &ProgramContext) -> Result<Option<Box<dyn Any>>,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn extract_mtk_bdp(app_ctx: &ProgramContext, ctx: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
pub fn extract_mtk_bdp(app_ctx: &AppContext, ctx: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let mut file = app_ctx.file;
|
let mut file = app_ctx.file;
|
||||||
let ctx = ctx.and_then(|c: Box<dyn Any>| c.downcast::<MtkBdpContext>().ok()).ok_or("Context is invalid or missing!")?;
|
let ctx = ctx.and_then(|c: Box<dyn Any>| c.downcast::<MtkBdpContext>().ok()).ok_or("Context is invalid or missing!")?;
|
||||||
let offset = ctx.pitit_offset;
|
let offset = ctx.pitit_offset;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
use crate::{ProgramContext, formats::Format};
|
use crate::{AppContext, formats::Format};
|
||||||
pub fn format() -> Format {
|
pub fn format() -> Format {
|
||||||
Format { name: "mtk_pkg", detect_func: is_mtk_pkg_file, run_func: extract_mtk_pkg }
|
Format { name: "mtk_pkg", detector_func: is_mtk_pkg_file, extractor_func: extract_mtk_pkg }
|
||||||
}
|
}
|
||||||
|
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
@@ -81,7 +81,7 @@ static HEADER_KEY: [u8; 16] = [
|
|||||||
|
|
||||||
static HEADER_IV: [u8; 16] = [0x00; 16];
|
static HEADER_IV: [u8; 16] = [0x00; 16];
|
||||||
|
|
||||||
pub fn is_mtk_pkg_file(app_ctx: &ProgramContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
pub fn is_mtk_pkg_file(app_ctx: &AppContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
||||||
let mut encrypted_header = common::read_file(app_ctx.file, 0, HEADER_SIZE)?;
|
let mut encrypted_header = common::read_file(app_ctx.file, 0, HEADER_SIZE)?;
|
||||||
let mut header = decrypt_aes128_cbc_nopad(&encrypted_header, &HEADER_KEY, &HEADER_IV)?;
|
let mut header = decrypt_aes128_cbc_nopad(&encrypted_header, &HEADER_KEY, &HEADER_IV)?;
|
||||||
if &header[4..12] == MTK_HEADER_MAGIC {
|
if &header[4..12] == MTK_HEADER_MAGIC {
|
||||||
@@ -99,7 +99,7 @@ pub fn is_mtk_pkg_file(app_ctx: &ProgramContext) -> Result<Option<Box<dyn Any>>,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn extract_mtk_pkg(app_ctx: &ProgramContext, ctx: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
pub fn extract_mtk_pkg(app_ctx: &AppContext, ctx: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let mut file = app_ctx.file;
|
let mut file = app_ctx.file;
|
||||||
let ctx = ctx.and_then(|c: Box<dyn Any>| c.downcast::<MtkPkgContext>().ok()).ok_or("Context is invalid or missing!")?;
|
let ctx = ctx.and_then(|c: Box<dyn Any>| c.downcast::<MtkPkgContext>().ok()).ok_or("Context is invalid or missing!")?;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
use crate::{ProgramContext, formats::Format};
|
use crate::{AppContext, formats::Format};
|
||||||
pub fn format() -> Format {
|
pub fn format() -> Format {
|
||||||
Format { name: "mtk_pkg_new", detect_func: is_mtk_pkg_new_file, run_func: extract_mtk_pkg_new }
|
Format { name: "mtk_pkg_new", detector_func: is_mtk_pkg_new_file, extractor_func: extract_mtk_pkg_new }
|
||||||
}
|
}
|
||||||
|
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
@@ -70,7 +70,7 @@ impl PartEntry {
|
|||||||
|
|
||||||
static HEADER_SIZE: usize = 0x170;
|
static HEADER_SIZE: usize = 0x170;
|
||||||
|
|
||||||
pub fn is_mtk_pkg_new_file(app_ctx: &ProgramContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
pub fn is_mtk_pkg_new_file(app_ctx: &AppContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
||||||
let encrypted_header = common::read_file(app_ctx.file, 0, HEADER_SIZE)?;
|
let encrypted_header = common::read_file(app_ctx.file, 0, HEADER_SIZE)?;
|
||||||
for (key_hex, iv_hex, name) in keys::MTK_PKG_CUST {
|
for (key_hex, iv_hex, name) in keys::MTK_PKG_CUST {
|
||||||
let key_array: [u8; 16] = hex::decode(key_hex)?.as_slice().try_into()?;
|
let key_array: [u8; 16] = hex::decode(key_hex)?.as_slice().try_into()?;
|
||||||
@@ -90,7 +90,7 @@ pub fn is_mtk_pkg_new_file(app_ctx: &ProgramContext) -> Result<Option<Box<dyn An
|
|||||||
Ok(None)
|
Ok(None)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn extract_mtk_pkg_new(app_ctx: &ProgramContext, ctx: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
pub fn extract_mtk_pkg_new(app_ctx: &AppContext, ctx: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let mut file = app_ctx.file;
|
let mut file = app_ctx.file;
|
||||||
let ctx = ctx.and_then(|c: Box<dyn Any>| c.downcast::<MtkPkgNewContext>().ok()).ok_or("Context is invalid or missing!")?;
|
let ctx = ctx.and_then(|c: Box<dyn Any>| c.downcast::<MtkPkgNewContext>().ok()).ok_or("Context is invalid or missing!")?;
|
||||||
let file_size = file.metadata()?.len();
|
let file_size = file.metadata()?.len();
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
use crate::{ProgramContext, formats::Format};
|
use crate::{AppContext, formats::Format};
|
||||||
pub fn format() -> Format {
|
pub fn format() -> Format {
|
||||||
Format { name: "mtk_pkg_old", detect_func: is_mtk_pkg_old_file, run_func: extract_mtk_pkg_old }
|
Format { name: "mtk_pkg_old", detector_func: is_mtk_pkg_old_file, extractor_func: extract_mtk_pkg_old }
|
||||||
}
|
}
|
||||||
|
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
@@ -63,7 +63,7 @@ impl PartEntry {
|
|||||||
|
|
||||||
static HEADER_SIZE: usize = 0x98;
|
static HEADER_SIZE: usize = 0x98;
|
||||||
|
|
||||||
pub fn is_mtk_pkg_old_file(app_ctx: &ProgramContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
pub fn is_mtk_pkg_old_file(app_ctx: &AppContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
||||||
let mut file = app_ctx.file;
|
let mut file = app_ctx.file;
|
||||||
let encrypted_header = common::read_file(&file, 0, HEADER_SIZE)?;
|
let encrypted_header = common::read_file(&file, 0, HEADER_SIZE)?;
|
||||||
let header = decrypt(&encrypted_header, KEY, Some(HEADER_XOR_MASK));
|
let header = decrypt(&encrypted_header, KEY, Some(HEADER_XOR_MASK));
|
||||||
@@ -82,7 +82,7 @@ pub fn is_mtk_pkg_old_file(app_ctx: &ProgramContext) -> Result<Option<Box<dyn An
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn extract_mtk_pkg_old(app_ctx: &ProgramContext, _ctx: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
pub fn extract_mtk_pkg_old(app_ctx: &AppContext, _ctx: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let mut file = app_ctx.file;
|
let mut file = app_ctx.file;
|
||||||
let file_size = file.metadata()?.len();
|
let file_size = file.metadata()?.len();
|
||||||
let encrypted_header = common::read_exact(&mut file, HEADER_SIZE)?;
|
let encrypted_header = common::read_exact(&mut file, HEADER_SIZE)?;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
use crate::{ProgramContext, formats::Format};
|
use crate::{AppContext, formats::Format};
|
||||||
pub fn format() -> Format {
|
pub fn format() -> Format {
|
||||||
Format { name: "novatek", detect_func: is_novatek_file, run_func: extract_novatek }
|
Format { name: "novatek", detector_func: is_novatek_file, extractor_func: extract_novatek }
|
||||||
}
|
}
|
||||||
|
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
@@ -40,7 +40,7 @@ struct PartEntry {
|
|||||||
#[br(count = 16)] _md5_checksum: Vec<u8>,
|
#[br(count = 16)] _md5_checksum: Vec<u8>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_novatek_file(app_ctx: &ProgramContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
pub fn is_novatek_file(app_ctx: &AppContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
||||||
let header = common::read_file(app_ctx.file, 0, 4)?;
|
let header = common::read_file(app_ctx.file, 0, 4)?;
|
||||||
if header == b"NFWB" {
|
if header == b"NFWB" {
|
||||||
Ok(Some(Box::new(())))
|
Ok(Some(Box::new(())))
|
||||||
@@ -49,7 +49,7 @@ pub fn is_novatek_file(app_ctx: &ProgramContext) -> Result<Option<Box<dyn Any>>,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn extract_novatek(app_ctx: &ProgramContext, _ctx: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
pub fn extract_novatek(app_ctx: &AppContext, _ctx: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let mut file = app_ctx.file;
|
let mut file = app_ctx.file;
|
||||||
let header: Header = file.read_le()?;
|
let header: Header = file.read_le()?;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
use crate::{ProgramContext, formats::Format};
|
use crate::{AppContext, formats::Format};
|
||||||
pub fn format() -> Format {
|
pub fn format() -> Format {
|
||||||
Format { name: "nvt_timg", detect_func: is_nvt_timg_file, run_func: extract_nvt_timg }
|
Format { name: "nvt_timg", detector_func: is_nvt_timg_file, extractor_func: extract_nvt_timg }
|
||||||
}
|
}
|
||||||
|
|
||||||
use std::path::{Path};
|
use std::path::{Path};
|
||||||
@@ -49,7 +49,7 @@ impl PIMG {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_nvt_timg_file(app_ctx: &ProgramContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
pub fn is_nvt_timg_file(app_ctx: &AppContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
||||||
let header = common::read_file(app_ctx.file, 0, 4)?;
|
let header = common::read_file(app_ctx.file, 0, 4)?;
|
||||||
if header == b"TIMG" {
|
if header == b"TIMG" {
|
||||||
Ok(Some(Box::new(())))
|
Ok(Some(Box::new(())))
|
||||||
@@ -58,7 +58,7 @@ pub fn is_nvt_timg_file(app_ctx: &ProgramContext) -> Result<Option<Box<dyn Any>>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn extract_nvt_timg(app_ctx: &ProgramContext, _ctx: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
pub fn extract_nvt_timg(app_ctx: &AppContext, _ctx: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let mut file = app_ctx.file;
|
let mut file = app_ctx.file;
|
||||||
let file_size = file.metadata()?.len();
|
let file_size = file.metadata()?.len();
|
||||||
let timg: TIMG = file.read_le()?;
|
let timg: TIMG = file.read_le()?;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
use crate::{ProgramContext, formats::Format};
|
use crate::{AppContext, formats::Format};
|
||||||
pub fn format() -> Format {
|
pub fn format() -> Format {
|
||||||
Format { name: "pana_dvd", detect_func: is_pana_dvd_file, run_func: extract_pana_dvd }
|
Format { name: "pana_dvd", detector_func: is_pana_dvd_file, extractor_func: extract_pana_dvd }
|
||||||
}
|
}
|
||||||
|
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
@@ -149,7 +149,7 @@ pub fn find_aes_key_pair<'a>(key_array: &'a [(&'a str, &'a str, &'a str)], data:
|
|||||||
Ok(None)
|
Ok(None)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_pana_dvd_file(app_ctx: &ProgramContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
pub fn is_pana_dvd_file(app_ctx: &AppContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
||||||
let header = common::read_file(app_ctx.file, 0, 64)?;
|
let header = common::read_file(app_ctx.file, 0, 64)?;
|
||||||
if let Some(matching_key) = find_key(&keys::PANA_DVD_KEYONLY, &header, b"PROG", 0)? {
|
if let Some(matching_key) = find_key(&keys::PANA_DVD_KEYONLY, &header, b"PROG", 0)? {
|
||||||
Ok(Some(Box::new(PanaDvdContext {
|
Ok(Some(Box::new(PanaDvdContext {
|
||||||
@@ -180,7 +180,7 @@ pub fn is_pana_dvd_file(app_ctx: &ProgramContext) -> Result<Option<Box<dyn Any>>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn extract_pana_dvd(app_ctx: &ProgramContext, ctx: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
pub fn extract_pana_dvd(app_ctx: &AppContext, ctx: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let mut file = app_ctx.file;
|
let mut file = app_ctx.file;
|
||||||
let context = ctx.and_then(|c: Box<dyn Any>| c.downcast::<PanaDvdContext>().ok()).ok_or("Context is invalid or missing!")?;
|
let context = ctx.and_then(|c: Box<dyn Any>| c.downcast::<PanaDvdContext>().ok()).ok_or("Context is invalid or missing!")?;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
use crate::{ProgramContext, formats::Format};
|
use crate::{AppContext, formats::Format};
|
||||||
pub fn format() -> Format {
|
pub fn format() -> Format {
|
||||||
Format { name: "pfl_upg", detect_func: is_pfl_upg_file, run_func: extract_pfl_upg }
|
Format { name: "pfl_upg", detector_func: is_pfl_upg_file, extractor_func: extract_pfl_upg }
|
||||||
}
|
}
|
||||||
|
|
||||||
use rsa::{RsaPublicKey, BigUint};
|
use rsa::{RsaPublicKey, BigUint};
|
||||||
@@ -48,7 +48,7 @@ impl FileHeader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_pfl_upg_file(app_ctx: &ProgramContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
pub fn is_pfl_upg_file(app_ctx: &AppContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
||||||
let header = common::read_file(app_ctx.file, 0, 8)?;
|
let header = common::read_file(app_ctx.file, 0, 8)?;
|
||||||
if header == b"2SWU3TXV" {
|
if header == b"2SWU3TXV" {
|
||||||
Ok(Some(Box::new(())))
|
Ok(Some(Box::new(())))
|
||||||
@@ -89,7 +89,7 @@ fn decrypt_aes256_ecb(key: &[u8], ciphertext: &[u8]) -> Result<Vec<u8>, Box<dyn
|
|||||||
Ok(buffer)
|
Ok(buffer)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn extract_pfl_upg(app_ctx: &ProgramContext, _ctx: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
pub fn extract_pfl_upg(app_ctx: &AppContext, _ctx: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let mut file = app_ctx.file;
|
let mut file = app_ctx.file;
|
||||||
let header: Header = file.read_le()?;
|
let header: Header = file.read_le()?;
|
||||||
let signature = common::read_exact(&mut file, 128)?;
|
let signature = common::read_exact(&mut file, 128)?;
|
||||||
|
|||||||
+4
-4
@@ -1,7 +1,7 @@
|
|||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
use crate::{ProgramContext, formats::Format};
|
use crate::{AppContext, formats::Format};
|
||||||
pub fn format() -> Format {
|
pub fn format() -> Format {
|
||||||
Format { name: "pup", detect_func: is_pup_file, run_func: extract_pup }
|
Format { name: "pup", detector_func: is_pup_file, extractor_func: extract_pup }
|
||||||
}
|
}
|
||||||
|
|
||||||
use std::path::{Path};
|
use std::path::{Path};
|
||||||
@@ -56,7 +56,7 @@ struct BlockEntry {
|
|||||||
size: u32,
|
size: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_pup_file(app_ctx: &ProgramContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
pub fn is_pup_file(app_ctx: &AppContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
||||||
let header = common::read_file(app_ctx.file, 0, 4)?;
|
let header = common::read_file(app_ctx.file, 0, 4)?;
|
||||||
if header == b"\x4F\x15\x3D\x1D" || header == b"\x54\x14\xF5\xEE" { //ps4, ps5
|
if header == b"\x4F\x15\x3D\x1D" || header == b"\x54\x14\xF5\xEE" { //ps4, ps5
|
||||||
Ok(Some(Box::new(())))
|
Ok(Some(Box::new(())))
|
||||||
@@ -65,7 +65,7 @@ pub fn is_pup_file(app_ctx: &ProgramContext) -> Result<Option<Box<dyn Any>>, Box
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn extract_pup(app_ctx: &ProgramContext, _ctx: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
pub fn extract_pup(app_ctx: &AppContext, _ctx: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let mut file = app_ctx.file;
|
let mut file = app_ctx.file;
|
||||||
let header: Header = file.read_le()?;
|
let header: Header = file.read_le()?;
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -1,7 +1,7 @@
|
|||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
use crate::{ProgramContext, formats::Format};
|
use crate::{AppContext, formats::Format};
|
||||||
pub fn format() -> Format {
|
pub fn format() -> Format {
|
||||||
Format { name: "roku", detect_func: is_roku_file, run_func: extract_roku }
|
Format { name: "roku", detector_func: is_roku_file, extractor_func: extract_roku }
|
||||||
}
|
}
|
||||||
|
|
||||||
use std::fs::{self, OpenOptions};
|
use std::fs::{self, OpenOptions};
|
||||||
@@ -61,7 +61,7 @@ impl ImageHeader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_roku_file(app_ctx: &ProgramContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
pub fn is_roku_file(app_ctx: &AppContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
||||||
let header = common::read_file(app_ctx.file, 0, 32)?;
|
let header = common::read_file(app_ctx.file, 0, 32)?;
|
||||||
let try_decrypt_header = decrypt_aes128_cbc_nopad(&header, &FILE_KEY, &FILE_IV)?;
|
let try_decrypt_header = decrypt_aes128_cbc_nopad(&header, &FILE_KEY, &FILE_IV)?;
|
||||||
|
|
||||||
@@ -72,7 +72,7 @@ pub fn is_roku_file(app_ctx: &ProgramContext) -> Result<Option<Box<dyn Any>>, Bo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn extract_roku(app_ctx: &ProgramContext, _ctx: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
pub fn extract_roku(app_ctx: &AppContext, _ctx: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let mut file = app_ctx.file;
|
let mut file = app_ctx.file;
|
||||||
let mut encrypted_data = Vec::new();
|
let mut encrypted_data = Vec::new();
|
||||||
file.read_to_end(&mut encrypted_data)?;
|
file.read_to_end(&mut encrypted_data)?;
|
||||||
|
|||||||
+4
-4
@@ -1,7 +1,7 @@
|
|||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
use crate::{ProgramContext, formats::Format};
|
use crate::{AppContext, formats::Format};
|
||||||
pub fn format() -> Format {
|
pub fn format() -> Format {
|
||||||
Format { name: "ruf", detect_func: is_ruf_file, run_func: extract_ruf }
|
Format { name: "ruf", detector_func: is_ruf_file, extractor_func: extract_ruf }
|
||||||
}
|
}
|
||||||
|
|
||||||
use std::path::{Path};
|
use std::path::{Path};
|
||||||
@@ -75,7 +75,7 @@ impl RufEntry {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_ruf_file(app_ctx: &ProgramContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
pub fn is_ruf_file(app_ctx: &AppContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
||||||
let header = common::read_file(app_ctx.file, 0, 6)?;
|
let header = common::read_file(app_ctx.file, 0, 6)?;
|
||||||
if header == b"RUF\x00\x00\x00" {
|
if header == b"RUF\x00\x00\x00" {
|
||||||
Ok(Some(Box::new(())))
|
Ok(Some(Box::new(())))
|
||||||
@@ -84,7 +84,7 @@ pub fn is_ruf_file(app_ctx: &ProgramContext) -> Result<Option<Box<dyn Any>>, Box
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn extract_ruf(app_ctx: &ProgramContext, _ctx: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
pub fn extract_ruf(app_ctx: &AppContext, _ctx: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let mut file = app_ctx.file;
|
let mut file = app_ctx.file;
|
||||||
let header: RufHeader = file.read_be()?;
|
let header: RufHeader = file.read_be()?;
|
||||||
if header.is_dual_ruf() {
|
if header.is_dual_ruf() {
|
||||||
|
|||||||
+4
-4
@@ -1,7 +1,7 @@
|
|||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
use crate::{ProgramContext, formats::Format};
|
use crate::{AppContext, formats::Format};
|
||||||
pub fn format() -> Format {
|
pub fn format() -> Format {
|
||||||
Format { name: "rvp", detect_func: is_rvp_file, run_func: extract_rvp }
|
Format { name: "rvp", detector_func: is_rvp_file, extractor_func: extract_rvp }
|
||||||
}
|
}
|
||||||
|
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
@@ -18,7 +18,7 @@ fn decrypt_xor(data: &[u8]) -> Vec<u8> {
|
|||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_rvp_file(app_ctx: &ProgramContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
pub fn is_rvp_file(app_ctx: &AppContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
||||||
let mut file = app_ctx.file;
|
let mut file = app_ctx.file;
|
||||||
//MVP
|
//MVP
|
||||||
let header = common::read_file(file, 0, 4)?;
|
let header = common::read_file(file, 0, 4)?;
|
||||||
@@ -39,7 +39,7 @@ pub fn is_rvp_file(app_ctx: &ProgramContext) -> Result<Option<Box<dyn Any>>, Box
|
|||||||
Ok(Some(Box::new(())))
|
Ok(Some(Box::new(())))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn extract_rvp(app_ctx: &ProgramContext, _ctx: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
pub fn extract_rvp(app_ctx: &AppContext, _ctx: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let mut file = app_ctx.file;
|
let mut file = app_ctx.file;
|
||||||
let mut obf_data = Vec::new(); //we sadly cannot deXOR on the fly because of its 32 byte pattern
|
let mut obf_data = Vec::new(); //we sadly cannot deXOR on the fly because of its 32 byte pattern
|
||||||
file.read_to_end(&mut obf_data)?;
|
file.read_to_end(&mut obf_data)?;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
//sddl_dec 5.0
|
//sddl_dec 5.0
|
||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
use crate::{ProgramContext, formats::Format};
|
use crate::{AppContext, formats::Format};
|
||||||
pub fn format() -> Format {
|
pub fn format() -> Format {
|
||||||
Format { name: "sddl_sec", detect_func: is_sddl_sec_file, run_func: extract_sddl_sec }
|
Format { name: "sddl_sec", detector_func: is_sddl_sec_file, extractor_func: extract_sddl_sec }
|
||||||
}
|
}
|
||||||
|
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
@@ -103,7 +103,7 @@ static DEC_IV: [u8; 16] = [
|
|||||||
0xCD, 0x88, 0x38, 0xC4, 0xB9, 0x0C, 0x76, 0x66,
|
0xCD, 0x88, 0x38, 0xC4, 0xB9, 0x0C, 0x76, 0x66,
|
||||||
];
|
];
|
||||||
|
|
||||||
pub fn is_sddl_sec_file(app_ctx: &ProgramContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
pub fn is_sddl_sec_file(app_ctx: &AppContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
||||||
let header = common::read_file(app_ctx.file, 0, 32)?;
|
let header = common::read_file(app_ctx.file, 0, 32)?;
|
||||||
let deciph_header = decipher(&header);
|
let deciph_header = decipher(&header);
|
||||||
if deciph_header.starts_with(b"\x11\x22\x33\x44") {
|
if deciph_header.starts_with(b"\x11\x22\x33\x44") {
|
||||||
@@ -155,7 +155,7 @@ fn decipher(s: &[u8]) -> Vec<u8> {
|
|||||||
out
|
out
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn extract_sddl_sec(app_ctx: &ProgramContext, _ctx: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
pub fn extract_sddl_sec(app_ctx: &AppContext, _ctx: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let mut file = app_ctx.file;
|
let mut file = app_ctx.file;
|
||||||
let mut hdr_reader = Cursor::new(decipher(&common::read_exact(&mut file, 32)?));
|
let mut hdr_reader = Cursor::new(decipher(&common::read_exact(&mut file, 32)?));
|
||||||
let hdr: SddlSecHeader = hdr_reader.read_be()?;
|
let hdr: SddlSecHeader = hdr_reader.read_be()?;
|
||||||
|
|||||||
+4
-4
@@ -1,7 +1,7 @@
|
|||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
use crate::{ProgramContext, formats::Format};
|
use crate::{AppContext, formats::Format};
|
||||||
pub fn format() -> Format {
|
pub fn format() -> Format {
|
||||||
Format { name: "slp", detect_func: is_slp_file, run_func: extract_slp }
|
Format { name: "slp", detector_func: is_slp_file, extractor_func: extract_slp }
|
||||||
}
|
}
|
||||||
|
|
||||||
use std::path::{Path};
|
use std::path::{Path};
|
||||||
@@ -52,7 +52,7 @@ struct EntryNew {
|
|||||||
#[br(count = 12)] _unk2: Vec<u8>,
|
#[br(count = 12)] _unk2: Vec<u8>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_slp_file(app_ctx: &ProgramContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
pub fn is_slp_file(app_ctx: &AppContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
||||||
let header = common::read_file(app_ctx.file, 0, 4)?;
|
let header = common::read_file(app_ctx.file, 0, 4)?;
|
||||||
if header == b"SLP\x00" {
|
if header == b"SLP\x00" {
|
||||||
Ok(Some(Box::new(())))
|
Ok(Some(Box::new(())))
|
||||||
@@ -61,7 +61,7 @@ pub fn is_slp_file(app_ctx: &ProgramContext) -> Result<Option<Box<dyn Any>>, Box
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn extract_slp(app_ctx: &ProgramContext, _ctx: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
pub fn extract_slp(app_ctx: &AppContext, _ctx: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let mut file = app_ctx.file;
|
let mut file = app_ctx.file;
|
||||||
let header: Header = file.read_le()?;
|
let header: Header = file.read_le()?;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
use crate::{ProgramContext, formats::Format};
|
use crate::{AppContext, formats::Format};
|
||||||
pub fn format() -> Format {
|
pub fn format() -> Format {
|
||||||
Format { name: "sony_bdp", detect_func: is_sony_bdp_file, run_func: extract_sony_bdp }
|
Format { name: "sony_bdp", detector_func: is_sony_bdp_file, extractor_func: extract_sony_bdp }
|
||||||
}
|
}
|
||||||
|
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
@@ -63,7 +63,7 @@ struct Entry {
|
|||||||
size: u32,
|
size: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_sony_bdp_file(app_ctx: &ProgramContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
pub fn is_sony_bdp_file(app_ctx: &AppContext) -> Result<Option<Box<dyn Any>>, Box<dyn std::error::Error>> {
|
||||||
let header = common::read_file(app_ctx.file, 0, 4)?;
|
let header = common::read_file(app_ctx.file, 0, 4)?;
|
||||||
if header == b"\x01\x73\xEC\xC9" || header == b"\x01\x73\xEC\x1F" || header == b"\xEC\x7D\xB0\xB0" { //MSB1x, MSB0x, BDPPxx
|
if header == b"\x01\x73\xEC\xC9" || header == b"\x01\x73\xEC\x1F" || header == b"\xEC\x7D\xB0\xB0" { //MSB1x, MSB0x, BDPPxx
|
||||||
Ok(Some(Box::new(())))
|
Ok(Some(Box::new(())))
|
||||||
@@ -72,7 +72,7 @@ pub fn is_sony_bdp_file(app_ctx: &ProgramContext) -> Result<Option<Box<dyn Any>>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn extract_sony_bdp(app_ctx: &ProgramContext, _ctx: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
pub fn extract_sony_bdp(app_ctx: &AppContext, _ctx: Option<Box<dyn Any>>) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let mut file = app_ctx.file;
|
let mut file = app_ctx.file;
|
||||||
let obf_header = common::read_exact(&mut file, 300)?;
|
let obf_header = common::read_exact(&mut file, 300)?;
|
||||||
let header = hex_substitute(&obf_header);
|
let header = hex_substitute(&obf_header);
|
||||||
@@ -120,7 +120,7 @@ pub fn extract_sony_bdp(app_ctx: &ProgramContext, _ctx: Option<Box<dyn Any>>) ->
|
|||||||
|
|
||||||
let last_file = File::open(last_file_path.unwrap())?;
|
let last_file = File::open(last_file_path.unwrap())?;
|
||||||
let mtk_extraction_path = format!("{}/{}", app_ctx.output_dir, i - 1);
|
let mtk_extraction_path = format!("{}/{}", app_ctx.output_dir, i - 1);
|
||||||
let ctx: ProgramContext = ProgramContext { file: &last_file, output_dir: &mtk_extraction_path };
|
let ctx: AppContext = AppContext { file: &last_file, output_dir: &mtk_extraction_path };
|
||||||
|
|
||||||
if let Some(result) = formats::mtk_bdp::is_mtk_bdp_file(&ctx)? {
|
if let Some(result) = formats::mtk_bdp::is_mtk_bdp_file(&ctx)? {
|
||||||
println!("- MTK BDP file detected!\n");
|
println!("- MTK BDP file detected!\n");
|
||||||
|
|||||||
+10
-10
@@ -2,16 +2,16 @@
|
|||||||
|
|
||||||
//samsung old keys
|
//samsung old keys
|
||||||
//github.com/george-hopkins/samygo-patcher
|
//github.com/george-hopkins/samygo-patcher
|
||||||
pub static SAMSUNG: &[(&str, &str)] = &[
|
//pub static SAMSUNG: &[(&str, &str)] = &[
|
||||||
("T-GA", "SHWJUH:85a045ae-2296-484c-b457-ede832fcfbe1-646390a3-105e-40aa-85f6-da3086c70111"),
|
// ("T-GA", "SHWJUH:85a045ae-2296-484c-b457-ede832fcfbe1-646390a3-105e-40aa-85f6-da3086c70111"),
|
||||||
("T-MST5", "SHWJUH:eceb2c14-db11-425e-9ebf-5f9607f0eb4b-3c38193e-751e-4719-8884-9e76322c0cec"),
|
// ("T-MST5", "SHWJUH:eceb2c14-db11-425e-9ebf-5f9607f0eb4b-3c38193e-751e-4719-8884-9e76322c0cec"),
|
||||||
("T-MST10P","b4c136-fbc93576-b3e8-4035-bf4e-ba4cb4ada1ac-f0d81cc4-8301-4832-bd60-f331295743ba"),
|
// ("T-MST10P","b4c136-fbc93576-b3e8-4035-bf4e-ba4cb4ada1ac-f0d81cc4-8301-4832-bd60-f331295743ba"),
|
||||||
("T-VAL", "A435HX:d3e90afc-0f09-4054-9bac-350cc8dfc901-7cee72ea-15ae-45ce-b0f5-00001abc2010"),
|
// ("T-VAL", "A435HX:d3e90afc-0f09-4054-9bac-350cc8dfc901-7cee72ea-15ae-45ce-b0f5-00001abc2010"),
|
||||||
("T-TDT", "A435HX:d3e90afc-0f09-4054-9bac-350cc8dfc901-7cee72ea-15ae-45ce-b0f5-00002abc2010"),
|
// ("T-TDT", "A435HX:d3e90afc-0f09-4054-9bac-350cc8dfc901-7cee72ea-15ae-45ce-b0f5-00002abc2010"),
|
||||||
("T-MSX", "A435HX:d3e90afc-0f09-4054-9bac-350cc8dfc901-7cee72ea-15ae-45ce-b0f5-00004abc2010"),
|
// ("T-MSX", "A435HX:d3e90afc-0f09-4054-9bac-350cc8dfc901-7cee72ea-15ae-45ce-b0f5-00004abc2010"),
|
||||||
("T-CH", "A435HX:d3e90afc-0f09-4054-9bac-350cc8dfc901-7cee72ea-15ae-45ce-b0f5-611c4f8d4a71"),
|
// ("T-CH", "A435HX:d3e90afc-0f09-4054-9bac-350cc8dfc901-7cee72ea-15ae-45ce-b0f5-611c4f8d4a71"),
|
||||||
("T-ECP", "3EF6067262CF0C678598BFF22169D1F1EA57C284"),
|
// ("T-ECP", "3EF6067262CF0C678598BFF22169D1F1EA57C284"),
|
||||||
];
|
//];
|
||||||
|
|
||||||
//MSD10 keys
|
//MSD10 keys
|
||||||
//fw prefix, type, key
|
//fw prefix, type, key
|
||||||
|
|||||||
+4
-4
@@ -14,7 +14,7 @@ struct Args {
|
|||||||
output_folder: Option<String>,
|
output_folder: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct ProgramContext<'a> {
|
pub struct AppContext<'a> {
|
||||||
pub file: &'a std::fs::File,
|
pub file: &'a std::fs::File,
|
||||||
pub output_dir: &'a str,
|
pub output_dir: &'a str,
|
||||||
}
|
}
|
||||||
@@ -47,13 +47,13 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let file = File::open(path)?;
|
let file = File::open(path)?;
|
||||||
let program_context: ProgramContext = ProgramContext { file: &file, output_dir: &output_path };
|
let app_ctx: AppContext = AppContext { file: &file, output_dir: &output_path };
|
||||||
let formats: Vec<Format> = get_registry();
|
let formats: Vec<Format> = get_registry();
|
||||||
|
|
||||||
for format in formats {
|
for format in formats {
|
||||||
if let Some(ctx) = (format.detect_func)(&program_context)? {
|
if let Some(ctx) = (format.detector_func)(&app_ctx)? {
|
||||||
println!("{} detected!", format.name);
|
println!("{} detected!", format.name);
|
||||||
(format.run_func)(&program_context, Some(ctx))?;
|
(format.extractor_func)(&app_ctx, Some(ctx))?;
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user