1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-10 19:20:13 +00:00

Match yaz0.c (#1660)

This commit is contained in:
cadmic 2024-01-29 15:14:30 -08:00 committed by GitHub
parent 9f169a67cd
commit 5ba625b171
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 8 additions and 7 deletions

View file

@ -29,7 +29,7 @@ void ViConfig_UpdateVi(u32 black);
void ViConfig_UpdateBlack(void);
void* Yaz0_FirstDMA(void);
void* Yaz0_NextDMA(u8* curSrcPos);
void Yaz0_DecompressImpl(Yaz0Header* hdr, u8* dst);
void Yaz0_DecompressImpl(u8* src, u8* dst);
void Yaz0_Decompress(uintptr_t romStart, u8* dst, size_t size);
void Locale_Init(void);
void Locale_ResetRegion(void);
@ -45,7 +45,7 @@ void* is_proutSyncPrintf(void* arg, const char* str, size_t count);
NORETURN void func_80002384(const char* exp, const char* file, u32 line);
#endif
OSPiHandle* osDriveRomInit(void);
void Mio0_Decompress(Yaz0Header* hdr, u8* dst);
void Mio0_Decompress(u8* src, u8* dst);
void StackCheck_Init(StackEntry* entry, void* stackBottom, void* stackTop, u32 initValue, s32 minSpace,
const char* name);
void StackCheck_Cleanup(StackEntry* entry);

View file

@ -695,8 +695,7 @@ typedef struct {
/* 0x04 */ u32 decSize;
/* 0x08 */ u32 compInfoOffset; // only used in mio0
/* 0x0C */ u32 uncompDataOffset; // only used in mio0
/* 0x10 */ u8 data[1];
} Yaz0Header; // size = 0x10 ("data" is not part of the header)
} Yaz0Header; // size = 0x10
struct ArenaNode;

View file

@ -48,16 +48,18 @@ void* Yaz0_NextDMA(u8* curSrcPos) {
return dst;
}
void Yaz0_DecompressImpl(Yaz0Header* hdr, u8* dst) {
void Yaz0_DecompressImpl(u8* src, u8* dst) {
Yaz0Header* header = (Yaz0Header*)src;
u32 bitIdx = 0;
u8* src = hdr->data;
u8* dstEnd = dst + hdr->decSize;
u8* dstEnd = dst + header->decSize;
u32 chunkHeader;
u32 nibble;
u8* backPtr;
u32 chunkSize;
u32 off;
src += sizeof(Yaz0Header);
do {
if (bitIdx == 0) {
if ((sYaz0MaxPtr < src) && (sYaz0CurSize != 0)) {