mirror of
https://github.com/Ap0dexMe0/unixtract.git
synced 2026-07-16 05:04:22 +02:00
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:
+3
-12
@@ -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()?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user