diff --git a/repak/src/pak.rs b/repak/src/pak.rs index 6d35780..29e7bfa 100644 --- a/repak/src/pak.rs +++ b/repak/src/pak.rs @@ -16,12 +16,14 @@ impl PakBuilder { } } #[cfg(feature = "encryption")] - pub fn key(&mut self, key: aes::Aes256) { - self.key = super::Key::Some(key) + pub fn key(&mut self, key: aes::Aes256) -> &mut Self { + self.key = super::Key::Some(key); + self } #[cfg(feature = "oodle")] - pub fn oodle(&mut self, oodle: fn() -> super::Decompress) { + pub fn oodle(&mut self, oodle: fn() -> super::Decompress) -> &mut Self { unsafe { super::OODLE = Some(once_cell::sync::Lazy::new(oodle)) } + self } pub fn reader(self, reader: &mut R) -> Result { PakReader::new_any_inner(reader, self.key) diff --git a/repak_cli/src/main.rs b/repak_cli/src/main.rs index 6d876dc..c7e5dfc 100644 --- a/repak_cli/src/main.rs +++ b/repak_cli/src/main.rs @@ -177,7 +177,7 @@ fn main() -> Result<(), repak::Error> { fn info(aes_key: Option, action: ActionInfo) -> Result<(), repak::Error> { let mut builder = repak::PakBuilder::new(); if let Some(aes_key) = aes_key { - builder.key(aes_key) + builder.key(aes_key); } let pak = builder.reader(&mut BufReader::new(File::open(action.input)?))?; println!("mount point: {}", pak.mount_point()); @@ -192,7 +192,7 @@ fn info(aes_key: Option, action: ActionInfo) -> Result<(), repak::E fn list(aes_key: Option, action: ActionList) -> Result<(), repak::Error> { let mut builder = repak::PakBuilder::new(); if let Some(aes_key) = aes_key { - builder.key(aes_key) + builder.key(aes_key); } let pak = builder.reader(&mut BufReader::new(File::open(action.input)?))?; @@ -225,7 +225,7 @@ fn list(aes_key: Option, action: ActionList) -> Result<(), repak::E fn hash_list(aes_key: Option, action: ActionHashList) -> Result<(), repak::Error> { let mut builder = repak::PakBuilder::new(); if let Some(aes_key) = aes_key { - builder.key(aes_key) + builder.key(aes_key); } let pak = builder.reader(&mut BufReader::new(File::open(&action.input)?))?; @@ -286,7 +286,7 @@ fn unpack(aes_key: Option, action: ActionUnpack) -> Result<(), repa #[cfg(windows)] builder.oodle(get_oodle::decompress); if let Some(aes_key) = aes_key.clone() { - builder.key(aes_key) + builder.key(aes_key); } let pak = builder.reader(&mut BufReader::new(File::open(input)?))?; let output = action @@ -459,7 +459,7 @@ fn get(aes_key: Option, args: ActionGet) -> Result<(), repak::Error #[cfg(windows)] builder.oodle(get_oodle::decompress); if let Some(aes_key) = aes_key { - builder.key(aes_key) + builder.key(aes_key); } let pak = builder.reader(&mut reader)?; let mount_point = PathBuf::from(pak.mount_point());