general: move common to utils, move common compression function to utils, clean up inconsitencies + add missing header to sony_bdp

This commit is contained in:
theubusu
2025-11-26 17:29:25 +01:00
parent 82be46fbd6
commit b608888538
32 changed files with 92 additions and 111 deletions
+3 -12
View File
@@ -1,11 +1,10 @@
use std::path::{Path};
use std::fs::{self, File, OpenOptions};
use std::io;
use binrw::{BinRead, BinReaderExt};
use flate2::read::ZlibDecoder;
use std::io::{Write, Read, Seek, SeekFrom};
use std::io::{Write, Seek, SeekFrom};
use crate::common;
use crate::utils::common;
use crate::utils::compression::{decompress_zlib};
#[derive(BinRead)]
struct Header {
@@ -60,14 +59,6 @@ pub fn is_pup_file(file: &File) -> bool {
}
}
fn decompress_zlib(data: &[u8]) -> io::Result<Vec<u8>> {
let mut decoder = ZlibDecoder::new(data);
let mut decompressed = Vec::new();
decoder.read_to_end(&mut decompressed)?;
Ok(decompressed)
}
pub fn extract_pup(mut file: &File, output_folder: &str) -> Result<(), Box<dyn std::error::Error>> {
let header: Header = file.read_le()?;