From 2ad368a2391b9c8d1ed85b6f22f4d7c59745df2d Mon Sep 17 00:00:00 2001 From: Przemek <5338028+Rannytheory@users.noreply.github.com> Date: Fri, 30 May 2025 02:35:49 -0400 Subject: [PATCH] 2.4 Beta decryption with zlib fix (#2) * fix: Zlib decryption for wuwa For wuwa 2.4Beta+ * fix: updated per requests * fix: build errors --- repak/src/entry.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/repak/src/entry.rs b/repak/src/entry.rs index 88e6c6b..f117809 100644 --- a/repak/src/entry.rs +++ b/repak/src/entry.rs @@ -1,4 +1,4 @@ -use std::io; +use std::{io, process::exit}; use byteorder::{LE, ReadBytesExt, WriteBytesExt}; @@ -347,7 +347,14 @@ impl Entry { return Err(super::Error::Encrypted); }; use aes::cipher::BlockDecrypt; - for block in data.chunks_mut(16) { + + let mut data_len = data.len(); + #[cfg(all(feature = "wuthering-waves", feature = "compression"))] + if let Some(Compression::Zlib) = self.compression_slot.and_then(|c| compression[c as usize]) { + data_len = data_len.min(2048); + } + + for block in data[..data_len].chunks_mut(16) { key.decrypt_block(aes::Block::from_mut_slice(block)) } data.truncate(self.compressed as usize);