From 928ece073fd9e713507fa96bcd91880a4b3b2112 Mon Sep 17 00:00:00 2001 From: Ryan Myers Date: Sun, 12 Sep 2021 11:59:27 -0400 Subject: [PATCH] create gzip.h --- src/asset_loading.h | 1 + src/gzip.c | 19 +------------------ src/gzip.h | 30 ++++++++++++++++++++++++++++++ src/textures_sprites.c | 1 + src/unknown_06B2B0.c | 1 + 5 files changed, 34 insertions(+), 18 deletions(-) create mode 100644 src/gzip.h diff --git a/src/asset_loading.h b/src/asset_loading.h index 140bb0bc..d0ec4648 100644 --- a/src/asset_loading.h +++ b/src/asset_loading.h @@ -2,6 +2,7 @@ #define _UNKNOWN_0777A0_H_ #include "types.h" +#include "gzip.h" void func_80076BA0(void); s32 *load_asset_section_from_rom(u32 assetIndex); diff --git a/src/gzip.c b/src/gzip.c index eb172417..74b4a7a7 100644 --- a/src/gzip.c +++ b/src/gzip.c @@ -1,22 +1,7 @@ /* The comment below is needed for this file to be picked up by generate_ld */ /* RAM_POS: 0x800C6170 */ -#include "memory.h" -#include "types.h" -#include "macros.h" - -typedef struct huft { - u8 e; /* number of extra bits or operation */ - u8 b; /* number of bits in this code or subcode */ - union { - u16 n; /* literal, length base, or distance base */ - struct huft *t; /* pointer to next level of table */ - } v; -} huft; - -/* If BMAX needs to be larger than 16, then h and x[] should be ulg. */ -#define BMAX 16 /* maximum bit length of any code (16 for explode) */ -#define N_MAX 288 /* maximum number of codes in any set */ +#include "gzip.h" /************ .data ************/ @@ -60,8 +45,6 @@ s32 get_asset_uncompressed_size(s32 assetIndex, s32 assetOffset) { return byteswap32(D_800E3764); } -s32 gzip_inflate_block(void); - /** * Decompresses gzip data. * Returns the pointer to the decompressed data. diff --git a/src/gzip.h b/src/gzip.h new file mode 100644 index 00000000..b64b9006 --- /dev/null +++ b/src/gzip.h @@ -0,0 +1,30 @@ +#ifndef _GZIP_H_ +#define _GZIP_H_ + +#include "memory.h" +#include "types.h" +#include "macros.h" + +typedef struct huft { + u8 e; /* number of extra bits or operation */ + u8 b; /* number of bits in this code or subcode */ + union { + u16 n; /* literal, length base, or distance base */ + struct huft *t; /* pointer to next level of table */ + } v; +} huft; + +/* If BMAX needs to be larger than 16, then h and x[] should be ulg. */ +#define BMAX 16 /* maximum bit length of any code (16 for explode) */ +#define N_MAX 288 /* maximum number of codes in any set */ + +void func_800C6170(void); +s32 byteswap32(u8 *arg0); +s32 get_asset_uncompressed_size(s32 assetIndex, s32 assetOffset); +u8 *gzip_inflate(u8 *compressedInput, u8 *decompressedOutput); + + +s32 gzip_inflate_block(void); // Non Matching +void gzip_huft_build(u32 *b, u32 n, u32 s, u16 *d, u16 *e, huft **t, s32 *m); // Non Matching + +#endif diff --git a/src/textures_sprites.c b/src/textures_sprites.c index f8116524..c8824f49 100644 --- a/src/textures_sprites.c +++ b/src/textures_sprites.c @@ -2,6 +2,7 @@ /* RAM_POS: 0x8007AC70 */ #include "textures_sprites.h" +#include "gzip.h" /************ .data ************/ diff --git a/src/unknown_06B2B0.c b/src/unknown_06B2B0.c index b2f7f69f..807c5208 100644 --- a/src/unknown_06B2B0.c +++ b/src/unknown_06B2B0.c @@ -14,6 +14,7 @@ #include "menu.h" #include "video.h" #include "lib/src/mips1/sc/sched.h" +#include "gzip.h" /************ .rodata ************/