mirror of
https://github.com/Ap0dexMe0/unixtract.git
synced 2026-07-15 21:00:03 +02:00
pana_dvd: show gzip file name fix readme
This commit is contained in:
@@ -106,7 +106,7 @@ Options:
|
|||||||
|
|
||||||
## Panasonic Blu-Ray (PANA_DVD.FRM, PANA_ESD.FRM, PANAEUSB.FRM)
|
## Panasonic Blu-Ray (PANA_DVD.FRM, PANA_ESD.FRM, PANAEUSB.FRM)
|
||||||
**Used in:** Panasonic Blu-Ray Players and Recorders
|
**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:**
|
**Options:**
|
||||||
`pana_dvd:split_main` - Automatically split the MAIN module into seperate partitions.
|
`pana_dvd:split_main` - Automatically split the MAIN module into seperate partitions.
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ use binrw::BinReaderExt;
|
|||||||
use crate::keys;
|
use crate::keys;
|
||||||
use crate::utils::common;
|
use crate::utils::common;
|
||||||
use crate::utils::aes::{decrypt_aes128_cbc_nopad};
|
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 pana_dvd_crypto::{decrypt_data};
|
||||||
use lzss::{decompress_lzss};
|
use lzss::{decompress_lzss};
|
||||||
use include::*;
|
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
|
if header.compression_type == 1 { //gzip + optionally lzss
|
||||||
println!("- Decompressing GZIP...");
|
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
|
// the decompressed data can have another header
|
||||||
if decompressed_gzip.starts_with(COMPRESSED_FILE_MAGIC) {
|
if decompressed_gzip.starts_with(COMPRESSED_FILE_MAGIC) {
|
||||||
decompressed_data = decompress_data(&decompressed_gzip)?;
|
decompressed_data = decompress_data(&decompressed_gzip)?;
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ use lz4::block::decompress;
|
|||||||
use bzip2::read::BzDecoder;
|
use bzip2::read::BzDecoder;
|
||||||
use liblzma::read::XzDecoder;
|
use liblzma::read::XzDecoder;
|
||||||
|
|
||||||
|
use crate::utils::common;
|
||||||
|
|
||||||
pub fn decompress_zlib(data: &[u8]) -> io::Result<Vec<u8>> {
|
pub fn decompress_zlib(data: &[u8]) -> io::Result<Vec<u8>> {
|
||||||
let mut decoder = ZlibDecoder::new(data);
|
let mut decoder = ZlibDecoder::new(data);
|
||||||
let mut decompressed = Vec::new();
|
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)
|
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>> {
|
pub fn decompress_lzma(compressed_data: &[u8]) -> Result<Vec<u8>, Box<dyn std::error::Error>> {
|
||||||
let mut input = Cursor::new(compressed_data);
|
let mut input = Cursor::new(compressed_data);
|
||||||
let mut output = Vec::new();
|
let mut output = Vec::new();
|
||||||
|
|||||||
Reference in New Issue
Block a user