mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-11-04 18:45:05 +01:00
- added support for Yaz0 decompression on banners and system menu resources (This is needed by some Custom Wii System Menu Themes like the DarkWii Theme. Hopefully now all System Menu Themes are supported as layout.) (thx darkwii and atymick for the info about the used Yaz0 compression in those themes.)
This commit is contained in:
parent
d5baaa39e6
commit
2300f6d872
@ -23,6 +23,7 @@
|
||||
#include "lz77.h"
|
||||
#include "gecko.h"
|
||||
#include "U8Archive.h"
|
||||
#include "uncompress.h"
|
||||
|
||||
#define RU(N, S) ((((N) + (S) - 1) / (S)) * (S))
|
||||
|
||||
@ -160,6 +161,22 @@ u8 *U8Archive::DecompressCopy( const u8 * stuff, u32 len, u32 *size ) const
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else if( (len > 8) && *(u32*)( stuff ) == 0x59617a30 )// Yaz0
|
||||
{
|
||||
// Yaz0 with a magic word
|
||||
Yaz0_Header *header = (Yaz0_Header *) stuff;
|
||||
// set decompress length
|
||||
len = header->decompressed_size;
|
||||
// allocate memory
|
||||
ret = (u8*) memalign(32, ALIGN32(len));
|
||||
if(!ret)
|
||||
{
|
||||
gprintf("out of memory\n");
|
||||
return NULL;
|
||||
}
|
||||
// function can not fail at this point
|
||||
uncompressYaz0(stuff, ret, len);
|
||||
}
|
||||
else if( isLZ77compressed( stuff ) )
|
||||
{
|
||||
// LZ77 with no magic word
|
||||
@ -179,7 +196,7 @@ u8 *U8Archive::DecompressCopy( const u8 * stuff, u32 len, u32 *size ) const
|
||||
else
|
||||
{
|
||||
// just copy the data out of the archive
|
||||
ret = (u8*)memalign( 32, len );
|
||||
ret = (u8*)memalign( 32, ALIGN32( len ) );
|
||||
if( !ret )
|
||||
{
|
||||
gprintf( "out of memory\n" );
|
||||
|
@ -49,9 +49,12 @@ u8 * uncompressLZ77(const u8 *inBuf, u32 inLength, u32 * size)
|
||||
//the second 4 bytes in the Yaz0 header).
|
||||
void uncompressYaz0(const u8* srcBuf, u8* dst, int uncompressedSize)
|
||||
{
|
||||
if(!srcBuf || !dst)
|
||||
return;
|
||||
|
||||
const u8 * src = srcBuf;
|
||||
|
||||
if(memcmp(src, "Yaz0", 4) == 0)
|
||||
if(*((u32*)src) == 'Yaz0')
|
||||
{
|
||||
src += sizeof(Yaz0_Header);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user