LzssCodec

object LzssCodec

LZ10 / LZSS codec for Nintendo DS files.

This is the "Type 0x10" variant used in many DS ROMs and NARC archives. The format is a standard LZSS stream with a 4-byte header:

Byte 0      : 0x10  (magic / compression type)
Bytes 1–3 : uncompressed size as a 24-bit little-endian integer
Bytes 4+ : compressed data

Each group of up to 8 symbols is preceded by a flag byte whose bits are read MSB-first. A 0-bit means a literal byte follows; a 1-bit means a 2-byte back-reference follows:

[LLLL DDDD] [DDDDDDDD]
L = (match length - 3) stored in the high 4 bits → lengths 3–18
D = (match distance - 1) stored in the low 12 bits → distance 1–4096

Functions

Link copied to clipboard

Compresses input using the LZ10 / LZSS format.

Link copied to clipboard

Decompresses an LZ10-encoded buffer.