LZ decompression. More...
Go to the source code of this file.
Functions | |
| u8 * | Resource_DecompressLz (const u8 *source, u8 *destination) |
| Decompresses an LZ stream from source into destination and returns destination. | |
LZ decompression.
Part of field.c, the field object, compiled only through it.
Definition in file decompress.c.
Decompresses an LZ stream from source into destination and returns destination.
The stream starts with a little-endian halfword: the offset of its command bytes, or 0 for an uncompressed block, whose data (source + 2) is returned as it is. The literal bytes follow that halfword. Each command byte gives eight flags, low bit first: 1 copies the next literal byte; 0 reads a big-endian halfword whose low 12 bits are a distance and high 4 bits a length - 2 (or, when 0, the next byte + 16 + 2), and copies that many bytes from the literals' start minus the distance. A zero halfword ends the stream. Called only by Sprite_ComposeAnimationFrame, for a codec 3 (LZ) layer that has a draw parameter, into a 0x400-byte scratch buffer.
Definition at line 17 of file decompress.c.
Referenced by Resource_DecompressLz(), and Sprite_ComposeAnimationFrame().