summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2013-04-08 00:19:31 +0200
committerTreeki <treeki@gmail.com>2013-04-08 00:34:35 +0200
commit8060001eea4b431a687609d8f4eaab0e43683d7b (patch)
tree0c5306dab66d395139324f66c261429c27e0b2b2 /include
parentec10cf4cfc0cac0d4b2eb04e28f0334782d0d5b2 (diff)
downloadkamek-8060001eea4b431a687609d8f4eaab0e43683d7b.tar.gz
kamek-8060001eea4b431a687609d8f4eaab0e43683d7b.zip
add decompression stuff to headers
Diffstat (limited to 'include')
-rw-r--r--include/common.h29
1 files changed, 29 insertions, 0 deletions
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