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`.
This commit is contained in:
2026-02-10 08:38:58 +00:00
parent ce6e30f727
commit 842f4a8569
9 changed files with 700 additions and 681 deletions

View File

@@ -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)]