Compare commits
1 Commits
cleanup/ip
...
cleanup/cx
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
29e8c4ef22 |
@@ -19,7 +19,7 @@ typedef struct CXUncompContextRL {
|
|||||||
u8* outData; // 0x00
|
u8* outData; // 0x00
|
||||||
int outDataLen; // 0x04
|
int outDataLen; // 0x04
|
||||||
u32 size; // 0x08
|
u32 size; // 0x08
|
||||||
u16 unk_0x0C; // 0x0C
|
u16 length; // 0x0C
|
||||||
u8 unk_0x0e; // 0x0E
|
u8 unk_0x0e; // 0x0E
|
||||||
u8 unk_0x0f; // 0x0F
|
u8 unk_0x0f; // 0x0F
|
||||||
} CXUncompContextRL;
|
} CXUncompContextRL;
|
||||||
@@ -28,7 +28,7 @@ typedef struct CXUncompContextLZ {
|
|||||||
u8* outData; // 0x00
|
u8* outData; // 0x00
|
||||||
int outDataLen; // 0x04
|
int outDataLen; // 0x04
|
||||||
u32 size; // 0x08
|
u32 size; // 0x08
|
||||||
int unk_0x0C; // 0x0C
|
int length; // 0x0C
|
||||||
u8 unk_0x10; // 0x10
|
u8 unk_0x10; // 0x10
|
||||||
u8 unk_0x11; // 0x11
|
u8 unk_0x11; // 0x11
|
||||||
u8 unk_0x12; // 0x12
|
u8 unk_0x12; // 0x12
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ void CXInitUncompContextRL(CXUncompContextRL* context, u8* data) {
|
|||||||
context->outData = data;
|
context->outData = data;
|
||||||
context->outDataLen = 0;
|
context->outDataLen = 0;
|
||||||
context->unk_0x0e = 0;
|
context->unk_0x0e = 0;
|
||||||
context->unk_0x0C = 0;
|
context->length = 0;
|
||||||
context->unk_0x0f = 8;
|
context->unk_0x0f = 8;
|
||||||
context->size = 0;
|
context->size = 0;
|
||||||
}
|
}
|
||||||
@@ -18,7 +18,7 @@ void CXInitUncompContextLZ(CXUncompContextLZ* context, u8* data) {
|
|||||||
context->outDataLen = 0;
|
context->outDataLen = 0;
|
||||||
context->unk_0x11 = 0;
|
context->unk_0x11 = 0;
|
||||||
context->unk_0x12 = 0;
|
context->unk_0x12 = 0;
|
||||||
context->unk_0x0C = 0;
|
context->length = 0;
|
||||||
context->unk_0x10 = 3;
|
context->unk_0x10 = 3;
|
||||||
context->unk_0x13 = 8;
|
context->unk_0x13 = 8;
|
||||||
context->unk_0x14 = 0;
|
context->unk_0x14 = 0;
|
||||||
@@ -66,10 +66,10 @@ CXStreamingResult CXReadUncompRL(CXUncompContextRL* context, const void* src, u3
|
|||||||
|
|
||||||
while (context->outDataLen > 0) {
|
while (context->outDataLen > 0) {
|
||||||
if (!(context->unk_0x0e & 0x80)) {
|
if (!(context->unk_0x0e & 0x80)) {
|
||||||
while (context->unk_0x0C) {
|
while (context->length) {
|
||||||
*context->outData++ = *pSrc++;
|
*context->outData++ = *pSrc++;
|
||||||
|
|
||||||
context->unk_0x0C--;
|
context->length--;
|
||||||
context->outDataLen--;
|
context->outDataLen--;
|
||||||
size--;
|
size--;
|
||||||
|
|
||||||
@@ -77,14 +77,14 @@ CXStreamingResult CXReadUncompRL(CXUncompContextRL* context, const void* src, u3
|
|||||||
return context->outDataLen;
|
return context->outDataLen;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (context->unk_0x0C) {
|
} else if (context->length) {
|
||||||
u8 b = *pSrc++;
|
u8 b = *pSrc++;
|
||||||
size--;
|
size--;
|
||||||
|
|
||||||
while (context->unk_0x0C) {
|
while (context->length) {
|
||||||
*context->outData++ = b;
|
*context->outData++ = b;
|
||||||
|
|
||||||
context->unk_0x0C--;
|
context->length--;
|
||||||
context->outDataLen--;
|
context->outDataLen--;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,20 +95,20 @@ CXStreamingResult CXReadUncompRL(CXUncompContextRL* context, const void* src, u3
|
|||||||
|
|
||||||
context->unk_0x0e = *pSrc++;
|
context->unk_0x0e = *pSrc++;
|
||||||
size--;
|
size--;
|
||||||
context->unk_0x0C = context->unk_0x0e & 0x7f;
|
context->length = context->unk_0x0e & 0x7f;
|
||||||
|
|
||||||
if (context->unk_0x0e & 0x80) {
|
if (context->unk_0x0e & 0x80) {
|
||||||
context->unk_0x0C += 3;
|
context->length += 3;
|
||||||
} else {
|
} else {
|
||||||
context->unk_0x0C += 1;
|
context->length += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context->unk_0x0C > context->outDataLen) {
|
if (context->length > context->outDataLen) {
|
||||||
if (!context->size) {
|
if (!context->size) {
|
||||||
return CX_STREAMING_ERR_BAD_FILE_SIZE;
|
return CX_STREAMING_ERR_BAD_FILE_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
context->unk_0x0C = context->outDataLen;
|
context->length = context->outDataLen;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (size) {
|
if (size) {
|
||||||
@@ -205,34 +205,34 @@ CXStreamingResult CXReadUncompLZ(CXUncompContextLZ* context, const void* src, u3
|
|||||||
context->unk_0x10--;
|
context->unk_0x10--;
|
||||||
|
|
||||||
if (!context->unk_0x14) {
|
if (!context->unk_0x14) {
|
||||||
context->unk_0x0C = *pSrc++;
|
context->length = *pSrc++;
|
||||||
context->unk_0x0C += 0x30;
|
context->length += 0x30;
|
||||||
context->unk_0x10 = 0;
|
context->unk_0x10 = 0;
|
||||||
} else {
|
} else {
|
||||||
switch (context->unk_0x10) {
|
switch (context->unk_0x10) {
|
||||||
case 2: {
|
case 2: {
|
||||||
context->unk_0x0C = *pSrc++;
|
context->length = *pSrc++;
|
||||||
|
|
||||||
if (context->unk_0x0C >> 4 == 1) {
|
if (context->length >> 4 == 1) {
|
||||||
context->unk_0x0C = (context->unk_0x0C & 0x0F) << 16;
|
context->length = (context->length & 0x0F) << 16;
|
||||||
context->unk_0x0C += 0x1110;
|
context->length += 0x1110;
|
||||||
} else if (context->unk_0x0C >> 4 == 0) {
|
} else if (context->length >> 4 == 0) {
|
||||||
context->unk_0x0C = (context->unk_0x0C & 0x0F) << 8;
|
context->length = (context->length & 0x0F) << 8;
|
||||||
context->unk_0x0C += 0x110;
|
context->length += 0x110;
|
||||||
context->unk_0x10 = 1;
|
context->unk_0x10 = 1;
|
||||||
} else {
|
} else {
|
||||||
context->unk_0x0C += 0x10;
|
context->length += 0x10;
|
||||||
context->unk_0x10 = 0;
|
context->unk_0x10 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 1: {
|
case 1: {
|
||||||
context->unk_0x0C += *pSrc++ << 8;
|
context->length += *pSrc++ << 8;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0: {
|
case 0: {
|
||||||
context->unk_0x0C += *pSrc++;
|
context->length += *pSrc++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -244,26 +244,26 @@ CXStreamingResult CXReadUncompLZ(CXUncompContextLZ* context, const void* src, u3
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
a = (context->unk_0x0C & 0x0F) << 8;
|
a = (context->length & 0x0F) << 8;
|
||||||
context->unk_0x0C >>= 4;
|
context->length >>= 4;
|
||||||
|
|
||||||
a = (a | *pSrc++) + 1;
|
a = (a | *pSrc++) + 1;
|
||||||
size--;
|
size--;
|
||||||
context->unk_0x10 = 3;
|
context->unk_0x10 = 3;
|
||||||
|
|
||||||
if (context->unk_0x0C > context->outDataLen) {
|
if (context->length > context->outDataLen) {
|
||||||
if (!context->size) {
|
if (!context->size) {
|
||||||
return CX_STREAMING_ERR_BAD_FILE_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->outData[-a];
|
||||||
context->outData++;
|
context->outData++;
|
||||||
context->outDataLen--;
|
context->outDataLen--;
|
||||||
context->unk_0x0C--;
|
context->length--;
|
||||||
}
|
}
|
||||||
|
|
||||||
there:
|
there:
|
||||||
|
|||||||
Reference in New Issue
Block a user