libnds
|
Wraps the bios decompress functionality into something a bit easier to use. More...
Enumerations | |
enum | DecompressType { LZ77 , LZ77Vram , HUFF , RLE , RLEVram } |
The types of decompression available. More... | |
Functions | |
void | decompress (const void *data, void *dst, DecompressType type) |
Decompresses data using the suported type. | |
void | decompressStream (const void *data, void *dst, DecompressType type, getByteCallback readCB, getHeaderCallback getHeaderCB) |
Decompresses data using the suported type. | |
void | decompressStreamStruct (const void *data, void *dst, DecompressType type, void *param, TDecompressionStream *ds) |
Decompresses data using the suported type. | |
Wraps the bios decompress functionality into something a bit easier to use.
enum DecompressType |
The types of decompression available.
VRAM only accepts 16-bit and 32-bit writes. If the CPU tries to write in 8-bit units, the write is ignored. Due to how the BIOS decompresses data, some of the options of this enum are safe to be used in VRAM, and others aren't.
void decompress | ( | const void * | data, |
void * | dst, | ||
DecompressType | type | ||
) |
Decompresses data using the suported type.
When 'type' is HUFF, this function will allocate 512 bytes in the stack as a temporary buffer.
dst | Destination to decompress to. |
data | Data to decompress. |
type | Type of data to decompress. |
void decompressStream | ( | const void * | data, |
void * | dst, | ||
DecompressType | type, | ||
getByteCallback | readCB, | ||
getHeaderCallback | getHeaderCB | ||
) |
Decompresses data using the suported type.
Only LZ77Vram, HUFF and RLEVram support streaming, but HUFF isn't supported by this function at all, use decompressStreamStruct() instead.
dst | Destination to decompress to. |
data | Data to decompress. |
type | Type of data to decompress. |
readCB | A callback to read the next byte of data. |
getHeaderCB | A callback to read the 32 byte header. |
void decompressStreamStruct | ( | const void * | data, |
void * | dst, | ||
DecompressType | type, | ||
void * | param, | ||
TDecompressionStream * | ds | ||
) |
Decompresses data using the suported type.
Only LZ77Vram, HUFF and RLEVram support streaming.
For HUFF, make sure to pass a 512 byte buffer in 'param' to be used as a temporary buffer by the decompression code.
dst | Destination to decompress to. |
data | Data to decompress. |
type | Type of data to decompress. |
param | A value to be passed to getHeaderCallback(), or a temporary buffer for HUFF. |
ds | A struct with callbacks to be used by the decompression routine. |