diff options
| author | Valentin Popov <valentin@popov.link> | 2026-02-10 11:38:58 +0300 |
|---|---|---|
| committer | Valentin Popov <valentin@popov.link> | 2026-02-10 11:38:58 +0300 |
| commit | 842f4a85693b418af81560738aa3136ac500d9b1 (patch) | |
| tree | d18cf54120294a312bf90d2a5282e3d640c43c57 /crates/nres | |
| parent | ce6e30f7272fd0c064ef52ac85cad1c0f05fd323 (diff) | |
| download | fparkan-842f4a85693b418af81560738aa3136ac500d9b1.tar.xz fparkan-842f4a85693b418af81560738aa3136ac500d9b1.zip | |
Implement LZSS decompression with optional XOR decryption
- Added `lzss_decompress_simple` function for LZSS decompression in `lzss.rs`.
- Introduced `XorState` struct and `xor_stream` function for XOR decryption in `xor.rs`.
- Updated `mod.rs` to include new LZSS and XOR modules.
- Refactored `parse_library` function in `parse.rs` to utilize the new XOR decryption functionality.
- Cleaned up and organized code in `lib.rs` by removing redundant functions and structures.
- Added tests for new functionality in `tests.rs`.
Diffstat (limited to 'crates/nres')
| -rw-r--r-- | crates/nres/src/lib.rs | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/crates/nres/src/lib.rs b/crates/nres/src/lib.rs index 300dce1..0cd9e22 100644 --- a/crates/nres/src/lib.rs +++ b/crates/nres/src/lib.rs @@ -232,23 +232,6 @@ impl EditableEntry { EntryData::Modified(vec) => vec.as_slice(), } } - - fn data_mut(&mut self, source: &Arc<[u8]>) -> &mut Vec<u8> { - // Check if we need to copy-on-write - if matches!(&self.data, EntryData::Borrowed(_)) { - let range = match &self.data { - EntryData::Borrowed(r) => r.clone(), - _ => unreachable!(), - }; - let copied = source[range].to_vec(); - self.data = EntryData::Modified(copied); - } - // Now we have Modified variant, return mutable reference - match &mut self.data { - EntryData::Modified(vec) => vec, - _ => unreachable!(), - } - } } #[derive(Clone, Debug)] |
