Expand description
Compression and decompression of SEGA’s LZ77 encoding, PRS, named after the file extension typically used for data encoded with it.
There are two supported variants of PRS: Legacy and Modern. The compression and decompression routines are split between these two variants. Which variant to use depends on what game you are targeting the data for. For example, Phantasy Star Online (2000) uses Legacy variant, and Phantasy Star Online 2 (2012) uses Modern variant. Not using the correct variant will likely result in undefined behavior in the targeted game, but this library will try to produce an Error if there would result in memory-unsafe copies in the command stream. That said, there is no way to detect what kind of PRS variant a given buffer is in.
§Examples
Compress and decompress a buffer:
use std::io::{Cursor, Read, Write};
use ages_prs::{ModernPrsDecoder, ModernPrsEncoder};
let input = b"Hello Hello Hello ";
let mut encoder = ModernPrsEncoder::new(Vec::new());
encoder.write_all(input).unwrap();
let compressed = encoder.into_inner().unwrap();
let mut decoder = ModernPrsDecoder::new(Cursor::new(&compressed[..]));
let mut decomp = Vec::new();
decoder.read_to_end(&mut decomp).unwrap();
assert_eq!(&decomp[..], &input[..]);Structs§
- Into
Inner Error - Error returned when
PrsEncoder::into_innerfails. - PrsDecoder
- An IO source for decoding a PRS stream.
- PrsEncoder
- An IO sink for compressing and encoding a stream to PRS.
Enums§
- Legacy
- PRS Variant used in games in the Dreamcast and Saturn era.
- Modern
- PRS Variant used in games made after the Dreamcast.
Traits§
- Variant
- Variant of PRS compression used. Varies with target game.