#snes #game #format #lz5 #rle2 #lz19

bin+lib snes_compress

A library for decompressing and recompressing data in SNES games

5 releases

0.1.4 Oct 25, 2022
0.1.3 Oct 24, 2022
0.1.2 Oct 22, 2022
0.1.1 Oct 22, 2022
0.1.0 Oct 22, 2022

#313 in Compression

MIT license

47KB
1.5K SLoC

snes_compress

A compression library for old games.

Supported Formats

  • LZ1
  • LZ19
  • LZ2
  • LZ3
  • LZ5
  • RLE1
  • RLE2

Usage

Rust Library:

Add dependency https://crates.io/crates/snes_compress

use snes_compress::{CompressionType, errors::{DecompressionError, CompressionError}};

fn decompress_data(compressed_data: &[u8]) -> Result<Vec<u8>, DecompressionError> {
    snes_compress::decompress(compressed_data, CompressionType::LZ5)
}

fn compress_data(decompressed_data: &[u8]) -> Result<Vec<u8>, CompressionError> {
    snes_compress::compress(decompressed_data, CompressionType::LZ5)
}

Shared Library:

TODO: Add wrapper project to compile this to so (linux), dll (windows), and dylib (mac)

Binary:

cargo install snes_compress

Usage:
  snes_compress [option] [format] "<input_file>" "<output_file>"

Options:
  -d: Decompress
  -c: Compress

Formats:
  -LZ5: LZ5


lib.rs:

snes_compress provides functions for decompressing and recompressing snes data.

Supported Formats

  • LZ1
  • LZ19
  • LZ2
  • LZ3
  • LZ5
  • RLE1
  • RLE2

Example

use snes_compress::{CompressionType, errors::{DecompressionError, CompressionError}};

fn decompress_data(compressed_data: &[u8]) -> Result<Vec<u8>, DecompressionError> {
snes_compress::decompress(compressed_data, CompressionType::LZ5)
}

fn compress_data(decompressed_data: &[u8]) -> Result<Vec<u8>, CompressionError> {
snes_compress::compress(decompressed_data, CompressionType::LZ5)
}

Dependencies

~250–710KB
~17K SLoC