From 998b66ffd9e0ad0983533ec4b88a19289d9e6bbb Mon Sep 17 00:00:00 2001 From: theubusu <80545678+theubusu@users.noreply.github.com> Date: Thu, 19 Feb 2026 18:17:21 +0100 Subject: [PATCH] funai_upg: minor changes and detect encrypted flag --- src/formats/funai_upg/include.rs | 3 ++- src/formats/funai_upg/mod.rs | 12 +++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/formats/funai_upg/include.rs b/src/formats/funai_upg/include.rs index 08331ae..b449e8e 100644 --- a/src/formats/funai_upg/include.rs +++ b/src/formats/funai_upg/include.rs @@ -11,5 +11,6 @@ pub struct Header { pub struct Entry { pub entry_type: u16, pub entry_size: u32, - _unk: u16, + _unk_flag: u8, + pub encryption_flag: u8, } \ No newline at end of file diff --git a/src/formats/funai_upg/mod.rs b/src/formats/funai_upg/mod.rs index 198f563..a3df579 100644 --- a/src/formats/funai_upg/mod.rs +++ b/src/formats/funai_upg/mod.rs @@ -30,10 +30,16 @@ pub fn extract_funai_upg(app_ctx: &AppContext, _ctx: Box) -> Result<(), let entry: Entry = file.read_le()?; println!("\n({}/{}) - Type: {}, Size: {}", i + 1, header.entry_count, entry.entry_type, entry.entry_size); - let data = common::read_exact(&mut file, entry.entry_size as usize - 2 - 4)?; //size has the unk field + crc32 at the end - let _crc32 = common::read_exact(&mut file, 4)?; //btw the CRC32 includes the entry header + let data = common::read_exact(&mut file, entry.entry_size as usize - 0x46)?; //size has the flags + crc32 + hash + let _crc32 = common::read_exact(&mut file, 4)?; //crc32 includes the entry header and hash + let _hash = common::read_exact(&mut file, 64)?; //hash is only used on encrypted entries - if entry.entry_type == 0 { + if entry.encryption_flag == 1 { + //not supported yet + println!("- Warning: Cannot decrypt entry, saving encrypted data!"); + } + + if entry.encryption_flag == 0 && entry.entry_type == 0 { let entry_string = common::string_from_bytes(&data); println!("Descriptor entry info:\n{}", entry_string); }