fix: compression does not matter for decrypt

For versions 2.4+
This commit is contained in:
Ranny 2025-05-31 03:54:32 -04:00
parent 2ad368a239
commit 7f0a88a6fe
2 changed files with 4 additions and 5 deletions

View file

@ -13,6 +13,7 @@ compression = ["dep:flate2", "dep:zstd", "dep:lz4_flex"]
oodle = ["dep:oodle_loader", "compression"] oodle = ["dep:oodle_loader", "compression"]
encryption = ["dep:aes"] encryption = ["dep:aes"]
wuthering-waves = [] wuthering-waves = []
wuthering-waves-2_4 = []
[dependencies] [dependencies]
byteorder = "1.5" byteorder = "1.5"

View file

@ -1,4 +1,4 @@
use std::{io, process::exit}; use std::io;
use byteorder::{LE, ReadBytesExt, WriteBytesExt}; use byteorder::{LE, ReadBytesExt, WriteBytesExt};
@ -349,10 +349,8 @@ impl Entry {
use aes::cipher::BlockDecrypt; use aes::cipher::BlockDecrypt;
let mut data_len = data.len(); let mut data_len = data.len();
#[cfg(all(feature = "wuthering-waves", feature = "compression"))] #[cfg(feature = "wuthering-waves-2_4")]
if let Some(Compression::Zlib) = self.compression_slot.and_then(|c| compression[c as usize]) { { data_len = data_len.min(2048); }
data_len = data_len.min(2048);
}
for block in data[..data_len].chunks_mut(16) { for block in data[..data_len].chunks_mut(16) {
key.decrypt_block(aes::Block::from_mut_slice(block)) key.decrypt_block(aes::Block::from_mut_slice(block))