pana_dvd: show gzip file name fix readme

This commit is contained in:
theubusu
2026-02-19 21:29:34 +01:00
parent 998b66ffd9
commit 04215b98d8
3 changed files with 22 additions and 4 deletions
+1 -1
View File
@@ -106,7 +106,7 @@ Options:
## Panasonic Blu-Ray (PANA_DVD.FRM, PANA_ESD.FRM, PANAEUSB.FRM)
**Used in:** Panasonic Blu-Ray Players and Recorders
**Notes:** **Depends on keys** - see keys.rs (Included keys should work for 99% of players released in and before 2014, and some released in 2018), Note that there is currently an issue with MAIN in some very ancient files not extracting correctly.
**Notes:** **Depends on keys** - see keys.rs (Included keys should work for 99% of players released in and before 2014, and some released in 2018), Note that there is currently an issue with MAIN in some very ancient files not extracting correctly.
**Options:**
`pana_dvd:split_main` - Automatically split the MAIN module into seperate partitions.
+5 -3
View File
@@ -13,7 +13,7 @@ use binrw::BinReaderExt;
use crate::keys;
use crate::utils::common;
use crate::utils::aes::{decrypt_aes128_cbc_nopad};
use crate::utils::compression::{decompress_gzip};
use crate::utils::compression::{decompress_gzip_get_filename};
use pana_dvd_crypto::{decrypt_data};
use lzss::{decompress_lzss};
use include::*;
@@ -233,8 +233,10 @@ fn decompress_data(data: &[u8]) -> Result<Vec<u8>, Box<dyn std::error::Error>> {
if header.compression_type == 1 { //gzip + optionally lzss
println!("- Decompressing GZIP...");
let decompressed_gzip = decompress_gzip(&compressed_data)?;
let (decompressed_gzip, gzip_filename) = decompress_gzip_get_filename(&compressed_data)?;
if let Some(gzip_filename) = gzip_filename {
println!("- GZIP filename: {}", gzip_filename);
}
// the decompressed data can have another header
if decompressed_gzip.starts_with(COMPRESSED_FILE_MAGIC) {
decompressed_data = decompress_data(&decompressed_gzip)?;
+16
View File
@@ -7,6 +7,8 @@ use lz4::block::decompress;
use bzip2::read::BzDecoder;
use liblzma::read::XzDecoder;
use crate::utils::common;
pub fn decompress_zlib(data: &[u8]) -> io::Result<Vec<u8>> {
let mut decoder = ZlibDecoder::new(data);
let mut decompressed = Vec::new();
@@ -22,6 +24,20 @@ pub fn decompress_gzip(compressed_data: &[u8]) -> Result<Vec<u8>, Box<dyn std::e
Ok(decompressed)
}
pub fn decompress_gzip_get_filename(compressed_data: &[u8]) -> Result<(Vec<u8>, Option<String>), Box<dyn std::error::Error>> {
let mut decoder = GzDecoder::new(compressed_data);
let mut filename: Option<String> = None;
if let Some(filename_bytes) = decoder.header().unwrap().filename() {
filename = Some(common::string_from_bytes(filename_bytes));
}
let mut decompressed = Vec::new();
decoder.read_to_end(&mut decompressed)?;
Ok((decompressed, filename))
}
pub fn decompress_lzma(compressed_data: &[u8]) -> Result<Vec<u8>, Box<dyn std::error::Error>> {
let mut input = Cursor::new(compressed_data);
let mut output = Vec::new();