diff --git a/Cargo.lock b/Cargo.lock index ec3ef4c..60dbdee 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -107,7 +107,7 @@ dependencies = [ "once_cell", "serde", "version_check", - "zerocopy 0.7.11", + "zerocopy 0.7.12", ] [[package]] @@ -499,7 +499,7 @@ dependencies = [ "indexmap", "itertools", "lz4", - "minilzo-rs", + "minilzo3", "num-traits", "once_cell", "rayon", @@ -830,9 +830,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.6" +version = "4.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d04704f56c2cde07f43e8e2c154b43f216dc5c92fc98ada720177362f953b956" +checksum = "ac495e00dcec98c83465d5ad66c5c4fabd652fd6686e7c6269b117e729a6f17b" dependencies = [ "clap_builder", "clap_derive", @@ -840,9 +840,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.6" +version = "4.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e231faeaca65ebd1ea3c737966bf858971cd38c3849107aa3ea7de90a804e45" +checksum = "c77ed9a32a62e6ca27175d00d29d05ca32e396ea1eb5fb01d8256b669cec7663" dependencies = [ "anstream", "anstyle", @@ -852,9 +852,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.4.2" +version = "4.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0862016ff20d69b84ef8247369fabf5c008a7417002411897d40ee1f4532b873" +checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" dependencies = [ "heck", "proc-macro2 1.0.69", @@ -864,9 +864,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.5.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd7cc57abe963c6d3b9d8be5b06ba7c8957a930305ca90304f24ef040aa6f961" +checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" [[package]] name = "claxon" @@ -1543,7 +1543,7 @@ dependencies = [ "futures-sink", "nanorand", "pin-project", - "spin 0.9.8", + "spin", ] [[package]] @@ -2339,12 +2339,13 @@ dependencies = [ ] [[package]] -name = "minilzo-rs" -version = "0.6.0" +name = "minilzo3" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1cfa527cd97516abf0737d3589a196fd990b67f55f5bbf260af9039191171fc" +checksum = "dacf7fc31b86145c42d4e5105c7a3347a93a2f89c4e43307bf072302137086f0" dependencies = [ - "cc", + "libc", + "thiserror", ] [[package]] @@ -3082,17 +3083,16 @@ dependencies = [ [[package]] name = "ring" -version = "0.16.20" +version = "0.17.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +checksum = "fb0205304757e5d899b9c2e448b867ffd03ae7f988002e47cd24954391394d0b" dependencies = [ "cc", + "getrandom", "libc", - "once_cell", - "spin 0.5.2", + "spin", "untrusted", - "web-sys", - "winapi", + "windows-sys 0.48.0", ] [[package]] @@ -3161,9 +3161,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.21.7" +version = "0.21.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd8d6c9f025a446bc4d18ad9632e69aec8f287aa84499ee335599fabd20c3fd8" +checksum = "446e14c5cda4f3f30fe71863c34ec70f5ac79d6087097ad0bb433e1be5edf04c" dependencies = [ "log", "ring", @@ -3173,9 +3173,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.101.6" +version = "0.101.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c7d5dece342910d9ba34d259310cae3e0154b873b35408b787b59bce53d34fe" +checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" dependencies = [ "ring", "untrusted", @@ -3219,9 +3219,9 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "sct" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" +checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" dependencies = [ "ring", "untrusted", @@ -3440,12 +3440,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "spin" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" - [[package]] name = "spin" version = "0.9.8" @@ -3913,9 +3907,9 @@ checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" [[package]] name = "untrusted" -version = "0.7.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "ureq" @@ -4631,11 +4625,11 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.7.11" +version = "0.7.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c19fae0c8a9efc6a8281f2e623db8af1db9e57852e04cde3e754dd2dc29340f" +checksum = "8db0ac2df3d060f81ec0380ccc5b71c2a7c092cfced671feeee1320e95559c87" dependencies = [ - "zerocopy-derive 0.7.11", + "zerocopy-derive 0.7.12", ] [[package]] @@ -4651,9 +4645,9 @@ dependencies = [ [[package]] name = "zerocopy-derive" -version = "0.7.11" +version = "0.7.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc56589e9ddd1f1c28d4b4b5c773ce232910a6bb67a70133d61c9e347585efe9" +checksum = "6b6093bc6d5265ff40b479c834cdd25d8e20784781a2a29a8106327393d0a9ff" dependencies = [ "proc-macro2 1.0.69", "quote 1.0.33", diff --git a/README.md b/README.md index 4f42666..4768bfe 100644 --- a/README.md +++ b/README.md @@ -6,13 +6,15 @@ BigFile Friend [![Release Nightly](https://img.shields.io/badge/release-nightly-5e025f?labelColor=301934)](https://nightly.link/widberg/bff/workflows/build/master) [![Join the chat at https://discord.gg/CQgMNbYeUR](https://img.shields.io/badge/chat-on_discord-7389D8.svg?logo=discord&logoColor=ffffff&labelColor=6A7EC2)](https://discord.gg/CQgMNbYeUR) -A GUI/CLI utility to work with Zouna BigFiles. +The Zouna Swiss Army knife. Originally names BigFile Friend for Zouna's resource archives, now it supports far more than just BigFiles. This repository is a relative of the main [FMTK repository](https://github.com/widberg/fmtk). ## Support -A ✔ indicates that the game has been tested and is working. An ❌ indicates that the game has not been tested or is not working. +A ✔ indicates that the format has been tested and is working. An ❌ indicates that the format has not been tested or is not working. + +### BigFile | Year | Game | Platform | Version | Format | Status | |------|---------------------------------------------------------------------------------|----------|---------|---------|--------| @@ -51,6 +53,28 @@ A ✔ indicates that the game has been tested and is working. An ❌ indicates t | 2020 | Microsoft Flight Simulator - Asobo | | | Asobo5 | ❌ | | 2022 | A Plague Tale: Requiem - Asobo | | | Asobo5 | ❌ | +### TSC + +| Format | Status | +|--------|--------| +| csc | ✔ | +| psc | ✔ | + +### Audio + +| Format | Status | +|---------|--------| +| SoundBF | ❌ | +| AIF | ❌ | +| JOE | ❌ | +| VAI | ❌ | + +### Archive + +| Format | Status | +|---------|--------| +| FAT+LIN | ✔ | + ## Patterns The [ImZouna](https://github.com/widberg/ImZouna) and [zouna-templates-docs](https://github.com/SabeMP/zouna-templates-docs) repositories have binary patterns for Zouna data structures. diff --git a/bff/Cargo.toml b/bff/Cargo.toml index 2541667..bbea057 100644 --- a/bff/Cargo.toml +++ b/bff/Cargo.toml @@ -14,7 +14,7 @@ impl-trait-for-tuples = "0.2.2" indexmap = { version = "2.0.0", features = ["serde"] } itertools = { version = "0.11.0", features = [] } lz4 = "1.24.0" -minilzo-rs = "0.6.0" +minilzo3 = "0.1.0" num-traits = "0.2.15" once_cell = { version = "1.18.0", features = [] } rayon = { version = "1.8.0", features = [] } diff --git a/bff/src/error.rs b/bff/src/error.rs index 4c5134c..9690c7c 100644 --- a/bff/src/error.rs +++ b/bff/src/error.rs @@ -55,5 +55,5 @@ pub enum Error { UnimplementedClass(UnimplementedClassError), UnimplementedVersionPlatform(UnimplementedVersionPlatformError), Utf8(std::string::FromUtf8Error), - MiniLzo(minilzo_rs::Error), + MiniLzo3(minilzo3::Error), } diff --git a/bff/src/lz/lzo.rs b/bff/src/lz/lzo.rs index 4c92e71..90332e2 100644 --- a/bff/src/lz/lzo.rs +++ b/bff/src/lz/lzo.rs @@ -1,21 +1,21 @@ use std::io::{Read, Write}; use binrw::Endian; -use minilzo_rs::LZO; +use minilzo3::{compress, decompress}; use crate::BffResult; pub fn lzo_compress(data: &[u8], writer: &mut W, _endian: Endian) -> BffResult<()> { - let mut lzo = LZO::init()?; - let compressed = lzo.compress(data)?; + let mut compressed = vec![0; 0x00105800]; + compress(&data, &mut compressed, false)?; writer.write_all(&compressed)?; Ok(()) } pub fn lzo_decompress(reader: &mut R, _endian: Endian) -> BffResult> { - let lzo = LZO::init()?; - let mut compressed: Vec = Vec::new(); + let mut compressed = Vec::new(); reader.read_to_end(&mut compressed)?; - let decompressed = lzo.decompress_safe(&compressed, 0x1000000)?; + let mut decompressed = vec![0; 0x00105800]; + let _decompressed_length = decompress(&compressed, &mut decompressed)?; Ok(decompressed) }