#pokemon #gameboy #compression #graphics #gamedev #encoding

pokemon-sprite-compression

A library for dealing with compressed Pokemon sprites

3 releases

0.1.2 May 8, 2023
0.1.1 May 3, 2023
0.1.0 May 2, 2023

#986 in Game dev

37 downloads per month

MIT/Apache

18KB
358 lines

Pokemon Sprite Compression

A library for dealing with compressed Pokemon sprites.

Implementation status:

  • Gen 1
    • Decompression
    • Compression
  • Gen 2
    • Decompression
    • Compression
  • Future generations

Installation

cargo add pokemon-sprite-compression

Usage

const rom = std::fs::read("pokeyellow.gbc").unwrap();

// Aerodactyl fossil sprite
let sprite = pokemon_sprite_compression::gen1::decompress(&rom[0x0367a1..]);
const rom = std::fs::read("pokecrystal.gbc").unwrap();

// Pikachu back sprite
let sprite = pokemon_sprite_compression::gen2::decompress(&rom[0x156ea1..]);

Acknowledgements

Huge thanks to the pret team and Andrew Ekstedt for their work on gen I decompression.

Huge thanks to wgjordan on Hacker News for reverse engineering and documenting the gen II compression algorithm. I've included a copy of the documentation in this repository for convenience, as the file doc/gen2.txt.

No runtime deps