SAGA/Datafiles/SAGA RLE2

From ScummVM :: Wiki
Jump to navigation Jump to search

SAGA_RLE2 Compression Format

The SAGA_RLE2 compression format is used in Sprite List Resources.
The SAGA_RLE2 compression format uses a two-byte RLE marker:

Type Order Name Description
INT16 . bg_runcount Background runcount
INT16 . fg_runcount Foreground runcount

The "background" of Sprite List data is the value 0x00, and is transparent.

To decode an SAGA_RLE2 resource:

  1. Read in RLE marker
  2. Write 0x00 to output [bg_runcount] times. ( Skip for transparency )
  3. Write [fg_runcount] bytes from encoded stream to output. ( Skip bytes of 0x00 for transparency )
  4. Read in the next RLE marker
  5. Repeat until end of input stream

The end of the encoded stream appears to be a single 0x00 byte.