funai_upg: minor changes and detect encrypted flag

This commit is contained in:
theubusu
2026-02-19 18:17:21 +01:00
parent 070a4f37c9
commit 998b66ffd9
2 changed files with 11 additions and 4 deletions
+2 -1
View File
@@ -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,
}
+9 -3
View File
@@ -30,10 +30,16 @@ pub fn extract_funai_upg(app_ctx: &AppContext, _ctx: Box<dyn Any>) -> 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);
}