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 +++++++++++++++++++++++++++++ kamek_pal.x | 5 +++++ 2 files changed, 34 insertions(+) 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 diff --git a/kamek_pal.x b/kamek_pal.x index 92e4b50..e371fb7 100644 --- a/kamek_pal.x +++ b/kamek_pal.x @@ -1396,6 +1396,11 @@ SECTIONS { TPLBind = 0x80228310; TPLGet = 0x80228430; + CXInitUncompContextLH = 0x801D7060; + CXReadUncompLH = 0x801D70A0; + CXGetUncompressedSize = 0x801D8290; + CXUncompressLZ = 0x801D82D0; + /* Gakenoko stuff */ mHeapAllocatorSubclass_Link = 0x800690C0; mHeapAllocatorSubclass_UnLink = 0x800690E0; -- cgit v1.2.3