From 8060001eea4b431a687609d8f4eaab0e43683d7b Mon Sep 17 00:00:00 2001 From: Treeki Date: Mon, 8 Apr 2013 00:19:31 +0200 Subject: add decompression stuff to headers --- include/common.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'include') diff --git a/include/common.h b/include/common.h index 44c3652..82d3fca 100644 --- a/include/common.h +++ b/include/common.h @@ -124,5 +124,34 @@ float sqrtf(float x) { #define InfiniteLoop for (;;) { asm("nop"); } #endif +typedef struct +{ + u8 *destp; // Write-destination pointer: 4B + s32 destCount; // Remaining size to write: 4B + s32 forceDestCount; // Forcibly set the decompression size 4B + u16 huffTable9 [ 1 << (9 + 1) ]; // Huffman encoding table: 2048B + u16 huffTable12[ 1 << (5 + 1) ]; // Huffman encoding table: 128B + u16 *nodep; // Node during a Huffman table search: 4B + s32 tableSize9; // Table size during a load: 4B + s32 tableSize12; // Table size during a load: 4B + u32 tableIdx; // Index for the table load position: 4B + u32 stream; // Bit stream for loading: 4B + u32 stream_len; // Number of valid stream bits for loading: 4B + u16 length; // Read length for LZ compression: 2B + s8 offset_bits; // Bit length for offset information: 1B + u8 headerSize; // Size of header being read: 1B +} // Total is 2216B +CXUncompContextLH; + +extern "C" void CXInitUncompContextLH( CXUncompContextLH * context, void* dest ); +extern "C" s32 CXReadUncompLH( CXUncompContextLH *context, const void* data, u32 len ); +extern "C" u32 CXGetUncompressedSize( const void *srcp ); +extern "C" void CXUncompressLZ( const void *srcp, void *destp ); + +static inline BOOL CXIsFinishedUncompLH( const CXUncompContextLH *context ) +{ + return (context->destCount > 0 || context->headerSize > 0)? FALSE : TRUE; +} + #endif -- cgit v1.2.3