AnimaEngine  1.0.0
Nintendo DS Pokemon Black, White, Black 2, and White 2 sprite extraction and preview toolchain
Typedefs | Enumerations | Functions
lz.h File Reference

Nintendo DS LZ10/LZ11 decompression implementation. More...

#include "common.h"

Go to the source code of this file.

Typedefs

typedef enum CompressionType CompressionType
 Categorization of compression headers found in NDS/Nitro file formats. More...
 

Enumerations

enum  CompressionType { COMPRESSION_NONE , COMPRESSION_LZ10 , COMPRESSION_LZ11 , COMPRESSION_UNKNOWN }
 Categorization of compression headers found in NDS/Nitro file formats. More...
 

Functions

CompressionType Lz_Detect (const u8 *data, size_t size)
 Auto-detects the compression format of a data buffer by inspecting its header byte. More...
 
const char * Lz_CompressionName (CompressionType type)
 Returns a human-readable name string for a CompressionType enum. More...
 
int Lz_Decompress (const u8 *in_data, size_t in_size, u8 **out_data, size_t *out_size, CompressionType *out_type)
 Decompresses an LZ10 or LZ11 compressed data stream. More...
 

Detailed Description

Nintendo DS LZ10/LZ11 decompression implementation.

Typedef Documentation

◆ CompressionType

Categorization of compression headers found in NDS/Nitro file formats.

Enumeration Type Documentation

◆ CompressionType

Categorization of compression headers found in NDS/Nitro file formats.

Enumerator
COMPRESSION_NONE 

Uncompressed raw data block.

COMPRESSION_LZ10 

Standard GBA/NDS LZSS compression format (0x10 magic).

COMPRESSION_LZ11 

Extended higher-ratio LZSS compression format (0x11 magic).

COMPRESSION_UNKNOWN 

Unsupported or invalid compression identifier.

Function Documentation

◆ Lz_CompressionName()

const char* Lz_CompressionName ( CompressionType  type)

Returns a human-readable name string for a CompressionType enum.

Parameters
typeThe compression type.
Returns
Read-only string description of compression algorithm.

◆ Lz_Decompress()

int Lz_Decompress ( const u8 in_data,
size_t  in_size,
u8 **  out_data,
size_t *  out_size,
CompressionType out_type 
)

Decompresses an LZ10 or LZ11 compressed data stream.

Parameters
in_dataPointer to the raw compressed source buffer.
in_sizeSize of the compressed data stream in bytes.
out_dataPointer to the destination buffer pointer, allocated inside this function.
out_sizePointer to store the size of the decompressed output buffer.
out_typeOptional output pointer to store the detected compression format.
Returns
0 on success; negative value on invalid headers or decompression buffer overflow.

◆ Lz_Detect()

CompressionType Lz_Detect ( const u8 data,
size_t  size 
)

Auto-detects the compression format of a data buffer by inspecting its header byte.

Parameters
dataPointer to raw data buffer.
sizeBuffer size in bytes.
Returns
Detected compression category.