Compare commits

..

1 Commits

Author SHA1 Message Date
coah
29e8c4ef22 cleanup(CXStreamingUncompression): rename unk_0x0C to length
RL/LZ run and match length field (countdown while writing).
2026-10-01 19:08:33 -05:00
6 changed files with 38 additions and 38 deletions

View File

@@ -53,9 +53,9 @@ Progress
<!-- progress:start -->
| Decompiled | Matched | Linked | Data |
|:---:|:---:|:---:|:---:|
| 99.38% | 88.04% | 62.37% | 92.07% |
| 99.38% | 88.00% | 62.37% | 92.07% |
units 920/1027 complete, functions 12228/12563 matched.
units 920/1027 complete, functions 12226/12563 matched.
decompiled = code with a C/C++ implementation (objdiff fuzzy), matched = byte-exact code, linked = code actually linked into the DOL, data = byte-exact data
<!-- progress:end -->

View File

@@ -258,7 +258,7 @@ struct __zi8_work_data_s {
ziU8 unk_0x330[8];
ziU32 unk_0x338;
ziU8 unk_0x33C[0x1FC];
ziU8 language; // 0x538
ziU8 unk_0x538;
ziU8 unk_0x539;
ziU8 unk_0x53A[0x40];
ziWChar unk_0x57A[0x641];

View File

@@ -164,7 +164,7 @@ static ziBool Zi8AlphaSignature(ziGetParam* parameters, ziBool countOnly ZI_NEED
if (parameters->maxCandidates < length) length = parameters->maxCandidates;
parameters->letters = length;
if ((parameters->getOptions & 0x80) == 0) {
ZI_WORK->language = parameters->language;
ZI_WORK->unk_0x538 = parameters->language;
parameters->candidates[0] = 0xfff0;
output = (ziWChar*)&ZI_WORK->unk_0x338;
}
@@ -582,7 +582,7 @@ ziU32 Zi8GetCandidatesOrCount(ziGetParam* parameters, ZiCandidateOptions* option
}
}
else {
ZI_WORK->language = parameters->language;
ZI_WORK->unk_0x538 = parameters->language;
if ((parameters->getOptions & 0x80) == 0) {
saved.restoreCandidates = 1;
saved.savedOptions = parameters->getOptions;

View File

@@ -42,7 +42,7 @@ ziU8 Zi8InitializeDynamic(ziLanguageEntry* langEntries ZI_NEED_WORK) {
return 0;
}
ZI_WORK->unk_0x1874 = 0x2D;
ZI_WORK->language = 0;
ZI_WORK->unk_0x538 = 0;
ZI_WORK->unk_0x1C[3] = 0;
ZI_WORK->unk_0x141A = 0x100;
Zi8SetLatinSearchOrder(0, 0, ZI_WORK);

View File

@@ -19,7 +19,7 @@ typedef struct CXUncompContextRL {
u8* outData; // 0x00
int outDataLen; // 0x04
u32 size; // 0x08
u16 unk_0x0C; // 0x0C
u16 length; // 0x0C
u8 unk_0x0e; // 0x0E
u8 unk_0x0f; // 0x0F
} CXUncompContextRL;
@@ -28,7 +28,7 @@ typedef struct CXUncompContextLZ {
u8* outData; // 0x00
int outDataLen; // 0x04
u32 size; // 0x08
int unk_0x0C; // 0x0C
int length; // 0x0C
u8 unk_0x10; // 0x10
u8 unk_0x11; // 0x11
u8 unk_0x12; // 0x12

View File

@@ -8,7 +8,7 @@ void CXInitUncompContextRL(CXUncompContextRL* context, u8* data) {
context->outData = data;
context->outDataLen = 0;
context->unk_0x0e = 0;
context->unk_0x0C = 0;
context->length = 0;
context->unk_0x0f = 8;
context->size = 0;
}
@@ -18,7 +18,7 @@ void CXInitUncompContextLZ(CXUncompContextLZ* context, u8* data) {
context->outDataLen = 0;
context->unk_0x11 = 0;
context->unk_0x12 = 0;
context->unk_0x0C = 0;
context->length = 0;
context->unk_0x10 = 3;
context->unk_0x13 = 8;
context->unk_0x14 = 0;
@@ -66,10 +66,10 @@ CXStreamingResult CXReadUncompRL(CXUncompContextRL* context, const void* src, u3
while (context->outDataLen > 0) {
if (!(context->unk_0x0e & 0x80)) {
while (context->unk_0x0C) {
while (context->length) {
*context->outData++ = *pSrc++;
context->unk_0x0C--;
context->length--;
context->outDataLen--;
size--;
@@ -77,14 +77,14 @@ CXStreamingResult CXReadUncompRL(CXUncompContextRL* context, const void* src, u3
return context->outDataLen;
}
}
} else if (context->unk_0x0C) {
} else if (context->length) {
u8 b = *pSrc++;
size--;
while (context->unk_0x0C) {
while (context->length) {
*context->outData++ = b;
context->unk_0x0C--;
context->length--;
context->outDataLen--;
}
@@ -95,20 +95,20 @@ CXStreamingResult CXReadUncompRL(CXUncompContextRL* context, const void* src, u3
context->unk_0x0e = *pSrc++;
size--;
context->unk_0x0C = context->unk_0x0e & 0x7f;
context->length = context->unk_0x0e & 0x7f;
if (context->unk_0x0e & 0x80) {
context->unk_0x0C += 3;
context->length += 3;
} else {
context->unk_0x0C += 1;
context->length += 1;
}
if (context->unk_0x0C > context->outDataLen) {
if (context->length > context->outDataLen) {
if (!context->size) {
return CX_STREAMING_ERR_BAD_FILE_SIZE;
}
context->unk_0x0C = context->outDataLen;
context->length = context->outDataLen;
}
if (size) {
@@ -205,34 +205,34 @@ CXStreamingResult CXReadUncompLZ(CXUncompContextLZ* context, const void* src, u3
context->unk_0x10--;
if (!context->unk_0x14) {
context->unk_0x0C = *pSrc++;
context->unk_0x0C += 0x30;
context->length = *pSrc++;
context->length += 0x30;
context->unk_0x10 = 0;
} else {
switch (context->unk_0x10) {
case 2: {
context->unk_0x0C = *pSrc++;
context->length = *pSrc++;
if (context->unk_0x0C >> 4 == 1) {
context->unk_0x0C = (context->unk_0x0C & 0x0F) << 16;
context->unk_0x0C += 0x1110;
} else if (context->unk_0x0C >> 4 == 0) {
context->unk_0x0C = (context->unk_0x0C & 0x0F) << 8;
context->unk_0x0C += 0x110;
if (context->length >> 4 == 1) {
context->length = (context->length & 0x0F) << 16;
context->length += 0x1110;
} else if (context->length >> 4 == 0) {
context->length = (context->length & 0x0F) << 8;
context->length += 0x110;
context->unk_0x10 = 1;
} else {
context->unk_0x0C += 0x10;
context->length += 0x10;
context->unk_0x10 = 0;
}
break;
}
case 1: {
context->unk_0x0C += *pSrc++ << 8;
context->length += *pSrc++ << 8;
break;
}
case 0: {
context->unk_0x0C += *pSrc++;
context->length += *pSrc++;
break;
}
}
@@ -244,26 +244,26 @@ CXStreamingResult CXReadUncompLZ(CXUncompContextLZ* context, const void* src, u3
}
}
a = (context->unk_0x0C & 0x0F) << 8;
context->unk_0x0C >>= 4;
a = (context->length & 0x0F) << 8;
context->length >>= 4;
a = (a | *pSrc++) + 1;
size--;
context->unk_0x10 = 3;
if (context->unk_0x0C > context->outDataLen) {
if (context->length > context->outDataLen) {
if (!context->size) {
return CX_STREAMING_ERR_BAD_FILE_SIZE;
}
context->unk_0x0C = context->outDataLen;
context->length = context->outDataLen;
}
while (context->unk_0x0C > 0) {
while (context->length > 0) {
*context->outData = context->outData[-a];
context->outData++;
context->outDataLen--;
context->unk_0x0C--;
context->length--;
}
there: