mirror of
https://github.com/OpenDriver2/REDRIVER2.git
synced 2024-11-26 04:12:34 +01:00
331 lines
8.6 KiB
Plaintext
331 lines
8.6 KiB
Plaintext
|
// WARNING: This file's extension ('.MIP') indicates that it may not have been a C or C++ file.
|
||
|
// It should contain Ghidra's best effort at decompiling the machine language to C,
|
||
|
// but TDR does not currently attempt to handle assembly language or other non-C/C++ code differently,
|
||
|
// so any decompiled code below may not reflect the original project source code for this file.
|
||
|
// If the source file is from a library, you should replace it with the original library version of the file.
|
||
|
// Otherwise, manual reconstruction of the code may be required,
|
||
|
// Especially if the original source code was assembly language which used hardware features inaccessible to C.
|
||
|
#include "THISDUST.H"
|
||
|
#include "RNC_2.H"
|
||
|
|
||
|
|
||
|
// decompiled code
|
||
|
// original method signature:
|
||
|
// void UnpackRNC() /* UnpackRNC method signature is not contained in the debug symbol data. This is likely either a library function or the game was compiled without debug symbols. Please refer to the TDR documentation for additional guidance. */
|
||
|
// line 40, offset 0x0001b434
|
||
|
/* begin block 1 */
|
||
|
// Start line: 81
|
||
|
/* end block 1 */
|
||
|
// End Line: 82
|
||
|
|
||
|
/* begin block 2 */
|
||
|
// Start line: 82
|
||
|
/* end block 2 */
|
||
|
// End Line: 83
|
||
|
|
||
|
/* begin block 3 */
|
||
|
// Start line: 83
|
||
|
/* end block 3 */
|
||
|
// End Line: 84
|
||
|
|
||
|
undefined4 UnpackRNC(int param_1)
|
||
|
|
||
|
{
|
||
|
DAT_0001b430 = *(undefined4 *)(param_1 + 4);
|
||
|
Unpack();
|
||
|
return DAT_0001b430;
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
// decompiled code
|
||
|
// original method signature:
|
||
|
// void Unpack() /* Unpack method signature is not contained in the debug symbol data. This is likely either a library function or the game was compiled without debug symbols. Please refer to the TDR documentation for additional guidance. */
|
||
|
// line 67, offset 0x0001b488
|
||
|
/* begin block 1 */
|
||
|
// Start line: 135
|
||
|
/* end block 1 */
|
||
|
// End Line: 136
|
||
|
|
||
|
/* begin block 2 */
|
||
|
// Start line: 136
|
||
|
/* end block 2 */
|
||
|
// End Line: 137
|
||
|
|
||
|
/* begin block 3 */
|
||
|
// Start line: 137
|
||
|
/* end block 3 */
|
||
|
// End Line: 138
|
||
|
|
||
|
void Unpack(int param_1,byte *param_2)
|
||
|
|
||
|
{
|
||
|
byte bVar1;
|
||
|
undefined2 uVar2;
|
||
|
byte *pbVar3;
|
||
|
byte *pbVar4;
|
||
|
int iVar5;
|
||
|
uint uVar6;
|
||
|
uint uVar7;
|
||
|
undefined4 *puVar8;
|
||
|
byte *pbVar9;
|
||
|
uint uVar10;
|
||
|
uint uVar11;
|
||
|
uint uVar12;
|
||
|
|
||
|
DAT_0001ba84 = *(undefined4 *)(param_1 + 4);
|
||
|
DAT_0001ba82 = 0;
|
||
|
pbVar4 = (byte *)(param_1 + 0x13);
|
||
|
uVar7 = ((uint)*(byte *)(param_1 + 0x12) * 2 + 1) * 2;
|
||
|
LAB_0001b830:
|
||
|
while( true ) {
|
||
|
uVar11 = uVar7 * 2 >> 8 & 1;
|
||
|
pbVar3 = pbVar4;
|
||
|
uVar6 = uVar7 * 2;
|
||
|
if (uVar11 != 0) break;
|
||
|
pbVar3 = pbVar4 + 1;
|
||
|
*param_2 = *pbVar4;
|
||
|
param_2 = param_2 + 1;
|
||
|
uVar7 = uVar7 * 4;
|
||
|
uVar11 = uVar7 >> 8 & 1;
|
||
|
uVar6 = uVar7;
|
||
|
if (uVar11 != 0) break;
|
||
|
LAB_0001b820:
|
||
|
pbVar4 = pbVar3 + 1;
|
||
|
*param_2 = *pbVar3;
|
||
|
param_2 = param_2 + 1;
|
||
|
}
|
||
|
uVar7 = uVar6 & 0xff;
|
||
|
if (uVar7 == 0) {
|
||
|
bVar1 = *pbVar3;
|
||
|
pbVar3 = pbVar3 + 1;
|
||
|
uVar7 = (uint)bVar1 * 2 + uVar11;
|
||
|
if ((uVar7 >> 8 & 1) == 0) goto LAB_0001b820;
|
||
|
}
|
||
|
uVar6 = 2;
|
||
|
uVar11 = 0;
|
||
|
uVar12 = uVar7 * 2 >> 8 & 1;
|
||
|
uVar7 = uVar7 * 2 & 0xff;
|
||
|
if (uVar7 == 0) {
|
||
|
bVar1 = *pbVar3;
|
||
|
pbVar3 = pbVar3 + 1;
|
||
|
uVar7 = (uint)bVar1 * 2 + uVar12;
|
||
|
uVar12 = uVar7 >> 8 & 1;
|
||
|
}
|
||
|
if (uVar12 == 0) {
|
||
|
uVar12 = uVar7 * 2 >> 8 & 1;
|
||
|
uVar7 = uVar7 * 2 & 0xff;
|
||
|
pbVar4 = pbVar3;
|
||
|
if (uVar7 == 0) {
|
||
|
pbVar4 = pbVar3 + 1;
|
||
|
uVar7 = (uint)*pbVar3 * 2 + uVar12;
|
||
|
uVar12 = uVar7 >> 8 & 1;
|
||
|
}
|
||
|
uVar6 = uVar12 + 4;
|
||
|
uVar10 = uVar7 * 2 >> 8 & 1;
|
||
|
uVar7 = uVar7 * 2 & 0xff;
|
||
|
if (uVar7 == 0) {
|
||
|
bVar1 = *pbVar4;
|
||
|
pbVar4 = pbVar4 + 1;
|
||
|
uVar7 = (uint)bVar1 * 2 + uVar10;
|
||
|
uVar10 = uVar7 >> 8 & 1;
|
||
|
}
|
||
|
if (uVar10 == 0) goto LAB_0001b6c0;
|
||
|
uVar6 = uVar7 * 2 >> 8 & 1;
|
||
|
uVar7 = uVar7 * 2 & 0xff;
|
||
|
if (uVar7 == 0) {
|
||
|
bVar1 = *pbVar4;
|
||
|
pbVar4 = pbVar4 + 1;
|
||
|
uVar7 = (uint)bVar1 * 2 + uVar6;
|
||
|
uVar6 = uVar7 >> 8 & 1;
|
||
|
}
|
||
|
uVar6 = (uVar12 + 3) * 2 + uVar6;
|
||
|
if (uVar6 == 9) {
|
||
|
iVar5 = 3;
|
||
|
do {
|
||
|
uVar6 = uVar7 * 2 >> 8 & 1;
|
||
|
uVar7 = uVar7 * 2 & 0xff;
|
||
|
if (uVar7 == 0) {
|
||
|
bVar1 = *pbVar4;
|
||
|
pbVar4 = pbVar4 + 1;
|
||
|
uVar7 = (uint)bVar1 * 2 + uVar6;
|
||
|
uVar6 = uVar7 >> 8 & 1;
|
||
|
}
|
||
|
uVar11 = uVar11 * 2 + uVar6;
|
||
|
iVar5 = iVar5 + -1;
|
||
|
} while (-1 < iVar5);
|
||
|
iVar5 = uVar11 + 2;
|
||
|
do {
|
||
|
bVar1 = pbVar4[1];
|
||
|
*param_2 = *pbVar4;
|
||
|
param_2[1] = bVar1;
|
||
|
bVar1 = pbVar4[3];
|
||
|
param_2[2] = pbVar4[2];
|
||
|
param_2[3] = bVar1;
|
||
|
pbVar4 = pbVar4 + 4;
|
||
|
iVar5 = iVar5 + -1;
|
||
|
param_2 = param_2 + 4;
|
||
|
} while (-1 < iVar5);
|
||
|
goto LAB_0001b830;
|
||
|
}
|
||
|
}
|
||
|
else {
|
||
|
uVar12 = uVar7 * 2 >> 8 & 1;
|
||
|
uVar7 = uVar7 * 2 & 0xff;
|
||
|
if (uVar7 == 0) {
|
||
|
bVar1 = *pbVar3;
|
||
|
pbVar3 = pbVar3 + 1;
|
||
|
uVar7 = (uint)bVar1 * 2 + uVar12;
|
||
|
uVar12 = uVar7 >> 8 & 1;
|
||
|
}
|
||
|
if (uVar12 == 0) {
|
||
|
LAB_0001b764:
|
||
|
bVar1 = *pbVar3;
|
||
|
pbVar4 = pbVar3 + 1;
|
||
|
pbVar9 = param_2 + -(bVar1 | uVar11);
|
||
|
pbVar3 = pbVar9 + -1;
|
||
|
if ((uVar6 & 1) != 0) {
|
||
|
*param_2 = pbVar9[-1];
|
||
|
param_2 = param_2 + 1;
|
||
|
pbVar3 = pbVar9;
|
||
|
}
|
||
|
iVar5 = (uVar6 >> 1) - 1;
|
||
|
if ((bVar1 | uVar11) == 0) {
|
||
|
bVar1 = *pbVar3;
|
||
|
do {
|
||
|
*param_2 = bVar1;
|
||
|
iVar5 = iVar5 + -1;
|
||
|
param_2[1] = bVar1;
|
||
|
param_2 = param_2 + 2;
|
||
|
} while (-1 < iVar5);
|
||
|
}
|
||
|
else {
|
||
|
do {
|
||
|
bVar1 = *pbVar3;
|
||
|
param_2[1] = pbVar3[1];
|
||
|
*param_2 = bVar1;
|
||
|
pbVar3 = pbVar3 + 2;
|
||
|
iVar5 = iVar5 + -1;
|
||
|
param_2 = param_2 + 2;
|
||
|
} while (-1 < iVar5);
|
||
|
}
|
||
|
goto LAB_0001b830;
|
||
|
}
|
||
|
uVar6 = 3;
|
||
|
uVar12 = uVar7 * 2 >> 8 & 1;
|
||
|
uVar7 = uVar7 * 2 & 0xff;
|
||
|
if (uVar7 == 0) {
|
||
|
bVar1 = *pbVar3;
|
||
|
pbVar3 = pbVar3 + 1;
|
||
|
uVar7 = (uint)bVar1 * 2 + uVar12;
|
||
|
uVar12 = uVar7 >> 8 & 1;
|
||
|
}
|
||
|
pbVar4 = pbVar3;
|
||
|
if (uVar12 != 0) {
|
||
|
pbVar4 = pbVar3 + 1;
|
||
|
uVar6 = (uint)*pbVar3 + 8;
|
||
|
if (*pbVar3 != 0) goto LAB_0001b6c0;
|
||
|
uVar6 = uVar7 * 2 >> 8 & 1;
|
||
|
uVar7 = uVar7 * 2 & 0xff;
|
||
|
if (uVar7 == 0) {
|
||
|
bVar1 = *pbVar4;
|
||
|
pbVar4 = pbVar3 + 2;
|
||
|
uVar7 = (uint)bVar1 * 2 + uVar6;
|
||
|
uVar6 = uVar7 >> 8 & 1;
|
||
|
}
|
||
|
if (uVar6 == 0) {
|
||
|
uVar7 = (uint)DAT_0001ba82;
|
||
|
puVar8 = &DAT_0001ba84;
|
||
|
if (DAT_0001ba82 != 0) {
|
||
|
do {
|
||
|
uVar2 = *(undefined2 *)puVar8;
|
||
|
puVar8 = (undefined4 *)((int)puVar8 + 2);
|
||
|
*param_2 = (byte)uVar2;
|
||
|
param_2 = param_2 + 1;
|
||
|
uVar7 = uVar7 - 1;
|
||
|
} while (uVar7 != 0);
|
||
|
}
|
||
|
return;
|
||
|
}
|
||
|
goto LAB_0001b830;
|
||
|
}
|
||
|
}
|
||
|
LAB_0001b6c0:
|
||
|
uVar12 = uVar7 * 2 >> 8 & 1;
|
||
|
uVar7 = uVar7 * 2 & 0xff;
|
||
|
pbVar3 = pbVar4;
|
||
|
if (uVar7 == 0) {
|
||
|
pbVar3 = pbVar4 + 1;
|
||
|
uVar7 = (uint)*pbVar4 * 2 + uVar12;
|
||
|
uVar12 = uVar7 >> 8 & 1;
|
||
|
}
|
||
|
if (uVar12 != 0) {
|
||
|
uVar11 = uVar7 * 2 >> 8 & 1;
|
||
|
uVar7 = uVar7 * 2 & 0xff;
|
||
|
if (uVar7 == 0) {
|
||
|
bVar1 = *pbVar3;
|
||
|
pbVar3 = pbVar3 + 1;
|
||
|
uVar7 = (uint)bVar1 * 2 + uVar11;
|
||
|
uVar11 = uVar7 >> 8 & 1;
|
||
|
}
|
||
|
uVar12 = uVar7 * 2 >> 8 & 1;
|
||
|
uVar7 = uVar7 * 2 & 0xff;
|
||
|
if (uVar7 == 0) {
|
||
|
bVar1 = *pbVar3;
|
||
|
pbVar3 = pbVar3 + 1;
|
||
|
uVar7 = (uint)bVar1 * 2 + uVar12;
|
||
|
uVar12 = uVar7 >> 8 & 1;
|
||
|
}
|
||
|
if (uVar12 == 0) {
|
||
|
if (uVar11 == 0) {
|
||
|
uVar11 = 1;
|
||
|
LAB_0001b72c:
|
||
|
uVar12 = uVar7 * 2 >> 8 & 1;
|
||
|
uVar7 = uVar7 * 2 & 0xff;
|
||
|
if (uVar7 == 0) {
|
||
|
bVar1 = *pbVar3;
|
||
|
pbVar3 = pbVar3 + 1;
|
||
|
uVar7 = (uint)bVar1 * 2 + uVar12;
|
||
|
uVar12 = uVar7 >> 8 & 1;
|
||
|
}
|
||
|
uVar11 = uVar11 * 2 + uVar12;
|
||
|
}
|
||
|
}
|
||
|
else {
|
||
|
uVar12 = uVar7 * 2 >> 8 & 1;
|
||
|
uVar7 = uVar7 * 2 & 0xff;
|
||
|
if (uVar7 == 0) {
|
||
|
bVar1 = *pbVar3;
|
||
|
pbVar3 = pbVar3 + 1;
|
||
|
uVar7 = (uint)bVar1 * 2 + uVar12;
|
||
|
uVar12 = uVar7 >> 8 & 1;
|
||
|
}
|
||
|
uVar11 = uVar11 * 2 + uVar12 | 4;
|
||
|
uVar12 = uVar7 * 2 >> 8 & 1;
|
||
|
uVar7 = uVar7 * 2 & 0xff;
|
||
|
if (uVar7 == 0) {
|
||
|
bVar1 = *pbVar3;
|
||
|
pbVar3 = pbVar3 + 1;
|
||
|
uVar7 = (uint)bVar1 * 2 + uVar12;
|
||
|
uVar12 = uVar7 >> 8 & 1;
|
||
|
}
|
||
|
if (uVar12 == 0) goto LAB_0001b72c;
|
||
|
}
|
||
|
uVar11 = uVar11 << 8;
|
||
|
}
|
||
|
goto LAB_0001b764;
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
// autogenerated function stub:
|
||
|
// void _mcard_text_size() /* _mcard_text_size method signature is not contained in the debug symbol data. This is likely either a library function or the game was compiled without debug symbols. Please refer to the TDR documentation for additional guidance. */
|
||
|
void _mcard_text_size()
|
||
|
{ // line 114, offset 0x0001b4fc
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|