Reconstruction layout: generated-src/ (generated) and src/ (curated), CMake, the first takeover: RNG
The decompiled C++ tree moves to generated-src/ (classes.h, C++20); src/ is for code written by hand. A curated function defines the generated declaration and starts its comment with its address, and source_tree.py stops emitting that body. src/rng.cpp takes over RNG (SetSeed, the constructor, Next, RandomInt, RandomFloat, Shuffle) with the shift table read from the exe as a constexpr array; src/log.h names KAGE_LogMessage's levels (1 INFO, 2 NET, 4 WARN, 8 ERROR, 16 ASSERT, from its prefix jump table). CMakeLists.txt builds src/*.cpp against generated-src/classes.h (clean with -Wall -Wextra). structs.hpp and headers.py are retired: scripts/merge_fields.py writes the merged field list, classes.h checks the layout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2ff2d5d87f
commit
3ce74c6e2d
331 files changed
+485
-7835
No files matched your search
@@ -0,0 +1,462 @@
|
||||
#include "classes.h"
|
||||
|
||||
// 00a68cf0
|
||||
void KAGE::Filesys::ArchivedFile::refill_buffer()
|
||||
{
|
||||
int bufferSize;
|
||||
undefined4 uVar1;
|
||||
undefined1 *cursor;
|
||||
byte *byteCursor;
|
||||
undefined1 swapByte;
|
||||
void *pvVar2;
|
||||
int iVar3;
|
||||
uint bufferSize;
|
||||
uint decrypted;
|
||||
uint uVar5;
|
||||
int iVar6;
|
||||
int iVar7;
|
||||
void *local_8c;
|
||||
byte xorKey [128];
|
||||
undefined4 local_8;
|
||||
char compression;
|
||||
byte *nextBlock;
|
||||
int *stream;
|
||||
|
||||
local_8 = __security_cookie ^ GHIDRA_UINT((xorKey + 0x84));
|
||||
uVar5 = *GHIDRA_CAST<uint *>((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0xc)) + 0x10));
|
||||
if (uVar5 <= *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(this) + 0x18))) {
|
||||
*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(this) + 0xc28)) = 1;
|
||||
return;
|
||||
}
|
||||
stream = *GHIDRA_CAST<int **>((GHIDRA_CAST<char *>(this) + 8));
|
||||
compression = *GHIDRA_CAST<char *>((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 4)) + 4));
|
||||
local_8c = this;
|
||||
if (compression == '\x01') {
|
||||
(**(code **)(*stream + 0x14))(&local_8c,4,1);
|
||||
if ((void *)0x7ff < local_8c) {
|
||||
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("ArchivedFile::refill_buffer LZW compressed buffer overflow.\n"));
|
||||
}
|
||||
(**(code **)(**GHIDRA_CAST<int **>((GHIDRA_CAST<char *>(this) + 8)) + 0x14))(GHIDRA_CAST<byte *>((GHIDRA_INT(this) + 0x1c)),1,local_8c);
|
||||
bufferSize = lzw_decompress(*(void **)(GHIDRA_CAST<char *>(this) + 0x10),GHIDRA_CAST<byte *>((GHIDRA_INT(this) + 0x81c)),
|
||||
GHIDRA_CAST<byte *>((GHIDRA_INT(this) + 0x1c)),GHIDRA_UINT(local_8c));
|
||||
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0xc20)) = bufferSize;
|
||||
}
|
||||
else if (compression == '\x02') {
|
||||
(**(code **)(*stream + 0x14))(&local_8c,4,1);
|
||||
pvVar2 = (void *)(GHIDRA_UINT(local_8c) & 0x7fffffff);
|
||||
uVar5 = GHIDRA_UINT(local_8c) >> 0x1f;
|
||||
local_8c = pvVar2;
|
||||
if ((void *)0x7ff < pvVar2) {
|
||||
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("ArchivedFile::refill_buffer MiniZ compressed buffer overflow.\n")
|
||||
);
|
||||
}
|
||||
(**(code **)(**GHIDRA_CAST<int **>((GHIDRA_CAST<char *>(this) + 8)) + 0x14))(GHIDRA_INT(this) + 0x1c,1,local_8c);
|
||||
uVar1 = FUN_00a89f80(GHIDRA_INT(this) + 0x81c,0x400,GHIDRA_INT(this) + 0x1c,local_8c,uVar5);
|
||||
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0xc20)) = uVar1;
|
||||
}
|
||||
else if (compression == '\x05') {
|
||||
uVar1 = (**(code **)(*stream + 0x14))(GHIDRA_INT(this) + 0x81c,1,0x400);
|
||||
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0xc20)) = uVar1;
|
||||
xorKey[0] = 0xb0;
|
||||
xorKey[1] = 0x22;
|
||||
xorKey[2] = 0x5d;
|
||||
xorKey[3] = 0x47;
|
||||
xorKey[4] = 0xd3;
|
||||
xorKey[5] = 0x1b;
|
||||
xorKey[6] = 0x59;
|
||||
xorKey[7] = 0xd1;
|
||||
xorKey[8] = 0x97;
|
||||
xorKey[9] = 0x37;
|
||||
xorKey[10] = 0xfb;
|
||||
xorKey[0xb] = 0xd2;
|
||||
iVar7 = -0x81c - GHIDRA_INT(this);
|
||||
xorKey[0xc] = 0xc0;
|
||||
xorKey[0xd] = 0x31;
|
||||
xorKey[0xe] = 0x86;
|
||||
xorKey[0xf] = 0xfd;
|
||||
iVar6 = -0x81b - GHIDRA_INT(this);
|
||||
xorKey[0x10] = 0xb5;
|
||||
xorKey[0x11] = 0xdd;
|
||||
xorKey[0x12] = 0xac;
|
||||
xorKey[0x13] = 0x4b;
|
||||
bufferSize = -0x81a - GHIDRA_INT(this);
|
||||
xorKey[0x14] = 0xb4;
|
||||
xorKey[0x15] = 1;
|
||||
xorKey[0x16] = 0x15;
|
||||
xorKey[0x17] = 0x52;
|
||||
xorKey[0x18] = 1;
|
||||
xorKey[0x19] = 10;
|
||||
xorKey[0x1a] = 0x75;
|
||||
xorKey[0x1b] = 8;
|
||||
iVar3 = -0x81d - GHIDRA_INT(this);
|
||||
xorKey[0x1c] = 0x5d;
|
||||
xorKey[0x1d] = 0x50;
|
||||
xorKey[0x1e] = 0xfe;
|
||||
xorKey[0x1f] = 0x8c;
|
||||
xorKey[0x20] = 0xa8;
|
||||
xorKey[0x21] = 0xaf;
|
||||
xorKey[0x22] = 0xd5;
|
||||
xorKey[0x23] = 0xcb;
|
||||
xorKey[0x24] = 9;
|
||||
xorKey[0x25] = 0xee;
|
||||
xorKey[0x26] = 0xdc;
|
||||
xorKey[0x27] = 0xca;
|
||||
xorKey[0x28] = 0x76;
|
||||
xorKey[0x29] = 0xc4;
|
||||
xorKey[0x2a] = 0x3f;
|
||||
xorKey[0x2b] = 0x67;
|
||||
xorKey[0x2c] = 0xed;
|
||||
xorKey[0x2d] = 9;
|
||||
xorKey[0x2e] = 0x8f;
|
||||
xorKey[0x2f] = 100;
|
||||
xorKey[0x30] = 0x43;
|
||||
xorKey[0x31] = 0x56;
|
||||
xorKey[0x32] = 0x30;
|
||||
xorKey[0x33] = 0x1a;
|
||||
xorKey[0x34] = 0x89;
|
||||
xorKey[0x35] = 0x2e;
|
||||
xorKey[0x36] = 0xdf;
|
||||
xorKey[0x37] = 0xf9;
|
||||
xorKey[0x38] = 0xe4;
|
||||
xorKey[0x39] = 0xb8;
|
||||
xorKey[0x3a] = 0x13;
|
||||
xorKey[0x3b] = 0x1a;
|
||||
xorKey[0x3c] = 0xbe;
|
||||
xorKey[0x3d] = 0xaf;
|
||||
xorKey[0x3e] = 0xa4;
|
||||
xorKey[0x3f] = 2;
|
||||
xorKey[0x40] = 0xff;
|
||||
xorKey[0x41] = 0x60;
|
||||
xorKey[0x42] = 0x22;
|
||||
xorKey[0x43] = 0xe0;
|
||||
xorKey[0x44] = 0xb;
|
||||
xorKey[0x45] = 0xff;
|
||||
xorKey[0x46] = 0xae;
|
||||
xorKey[0x47] = 0xc9;
|
||||
xorKey[0x48] = 0x7d;
|
||||
xorKey[0x49] = 0xa0;
|
||||
xorKey[0x4a] = 0x27;
|
||||
xorKey[0x4b] = 0xf9;
|
||||
xorKey[0x4c] = 0x11;
|
||||
xorKey[0x4d] = 99;
|
||||
xorKey[0x4e] = 0x2f;
|
||||
xorKey[0x4f] = 0xe1;
|
||||
xorKey[0x50] = 0x20;
|
||||
xorKey[0x51] = 0x7e;
|
||||
xorKey[0x52] = 0x51;
|
||||
xorKey[0x53] = 0xd7;
|
||||
xorKey[0x54] = 0xe;
|
||||
xorKey[0x55] = 0xcd;
|
||||
xorKey[0x56] = 0xc4;
|
||||
xorKey[0x57] = 0xd4;
|
||||
xorKey[0x58] = 0xcf;
|
||||
xorKey[0x59] = 0xcf;
|
||||
xorKey[0x5a] = 0xa1;
|
||||
xorKey[0x5b] = 0x88;
|
||||
xorKey[0x5c] = 0x99;
|
||||
xorKey[0x5d] = 0x42;
|
||||
xorKey[0x5e] = 0x96;
|
||||
xorKey[0x5f] = 0xcf;
|
||||
xorKey[0x60] = 0xf0;
|
||||
xorKey[0x61] = 0xc1;
|
||||
xorKey[0x62] = 0x54;
|
||||
xorKey[99] = 0xc3;
|
||||
xorKey[100] = 0x36;
|
||||
xorKey[0x65] = 0x94;
|
||||
xorKey[0x66] = 0xc2;
|
||||
xorKey[0x67] = 0x92;
|
||||
xorKey[0x68] = 0xdc;
|
||||
xorKey[0x69] = 0xb8;
|
||||
xorKey[0x6a] = 99;
|
||||
xorKey[0x6b] = 0xca;
|
||||
xorKey[0x6c] = 0xca;
|
||||
xorKey[0x6d] = 0x32;
|
||||
xorKey[0x6e] = 0x12;
|
||||
xorKey[0x6f] = 0x7a;
|
||||
xorKey[0x70] = 0x3c;
|
||||
xorKey[0x71] = 0x88;
|
||||
xorKey[0x72] = 0x5f;
|
||||
xorKey[0x73] = 0xd2;
|
||||
xorKey[0x74] = 0x4b;
|
||||
xorKey[0x75] = 0xc3;
|
||||
xorKey[0x76] = 0xe4;
|
||||
xorKey[0x77] = 0x69;
|
||||
xorKey[0x78] = 0x74;
|
||||
xorKey[0x79] = 0x32;
|
||||
xorKey[0x7a] = 0xbd;
|
||||
xorKey[0x7b] = 0x2c;
|
||||
xorKey[0x7c] = 0x42;
|
||||
xorKey[0x7d] = 0x28;
|
||||
xorKey[0x7e] = 0xb2;
|
||||
xorKey[0x7f] = 0x34;
|
||||
byteCursor = GHIDRA_CAST<byte *>((GHIDRA_INT(this) + 0x81d));
|
||||
do {
|
||||
byteCursor[-1] = byteCursor[-1] ^ xorKey[GHIDRA_UINT((byteCursor + iVar3)) & 0x7f];
|
||||
*byteCursor = *byteCursor ^ xorKey[GHIDRA_UINT((byteCursor + iVar7)) & 0x7f];
|
||||
byteCursor[1] = byteCursor[1] ^ xorKey[GHIDRA_UINT((byteCursor + iVar6)) & 0x7f];
|
||||
nextBlock = byteCursor + 4;
|
||||
byteCursor[2] = byteCursor[2] ^ xorKey[GHIDRA_UINT((byteCursor + bufferSize)) & 0x7f];
|
||||
byteCursor = nextBlock;
|
||||
this = local_8c;
|
||||
} while (GHIDRA_INT((nextBlock + iVar3)) < 0x400);
|
||||
}
|
||||
else {
|
||||
bufferSize = (uVar5 - *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(this) + 0x18))) + 3 & 0xfffffffc;
|
||||
uVar5 = 0x400;
|
||||
if (bufferSize < 0x400) {
|
||||
uVar5 = bufferSize;
|
||||
}
|
||||
uVar1 = (**(code **)(*stream + 0x14))(GHIDRA_INT(this) + 0x81c,1,uVar5);
|
||||
uVar5 = *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(this) + 0xc24));
|
||||
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0xc20)) = uVar1;
|
||||
cursor = GHIDRA_CAST<undefined1 *>((GHIDRA_INT(this) + 0x81d));
|
||||
bufferSize = 0x100;
|
||||
do {
|
||||
decrypted = *GHIDRA_CAST<uint *>((cursor + -1)) ^ uVar5;
|
||||
bufferSize = uVar5 & 0xf;
|
||||
*GHIDRA_CAST<uint *>((cursor + -1)) = decrypted;
|
||||
swapByte = (undefined1)decrypted;
|
||||
if (bufferSize == 2) {
|
||||
cursor[2] = swapByte;
|
||||
cursor[-1] = (char)(decrypted >> 0x18);
|
||||
swapByte = cursor[1];
|
||||
cursor[1] = *cursor;
|
||||
LAB_00a6904c:
|
||||
*cursor = swapByte;
|
||||
}
|
||||
else if (bufferSize == 9) {
|
||||
*cursor = swapByte;
|
||||
swapByte = cursor[1];
|
||||
cursor[-1] = (char)(decrypted >> 8);
|
||||
cursor[1] = cursor[2];
|
||||
cursor[2] = swapByte;
|
||||
}
|
||||
else if (bufferSize == 0xd) {
|
||||
cursor[1] = swapByte;
|
||||
cursor[-1] = (char)(decrypted >> 0x10);
|
||||
swapByte = cursor[2];
|
||||
cursor[2] = *cursor;
|
||||
goto LAB_00a6904c;
|
||||
}
|
||||
cursor = cursor + 4;
|
||||
uVar5 = uVar5 << 8 ^ uVar5;
|
||||
uVar5 = uVar5 ^ uVar5 >> 9;
|
||||
uVar5 = uVar5 << 0x17 ^ uVar5;
|
||||
bufferSize = bufferSize + -1;
|
||||
} while (bufferSize != 0);
|
||||
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(this) + 0xc24)) = uVar5;
|
||||
}
|
||||
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0xc1c)) = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
// 00a69090
|
||||
void KAGE::Filesys::ArchivedFile::refill_buffer(uint byteCount)
|
||||
{
|
||||
uint uVar1;
|
||||
int iVar2;
|
||||
undefined4 bufferSize;
|
||||
undefined1 *shuffleCursor;
|
||||
uint uVar3;
|
||||
byte *xorCursor;
|
||||
undefined1 swapByte;
|
||||
uint uVar4;
|
||||
uint bufferSize;
|
||||
uint lzwChunkSize;
|
||||
uint minizChunkSize;
|
||||
undefined4 xorKey;
|
||||
undefined4 local_84;
|
||||
undefined4 local_80;
|
||||
undefined4 local_7c;
|
||||
undefined4 local_78;
|
||||
undefined4 local_74;
|
||||
undefined4 local_70;
|
||||
undefined4 local_6c;
|
||||
undefined4 local_68;
|
||||
undefined4 local_64;
|
||||
undefined4 local_60;
|
||||
undefined4 local_5c;
|
||||
undefined4 local_58;
|
||||
undefined4 local_54;
|
||||
undefined4 local_50;
|
||||
undefined4 local_4c;
|
||||
undefined4 local_48;
|
||||
undefined4 local_44;
|
||||
undefined4 local_40;
|
||||
undefined4 local_3c;
|
||||
undefined4 local_38;
|
||||
undefined4 local_34;
|
||||
undefined4 local_30;
|
||||
undefined4 local_2c;
|
||||
undefined4 local_28;
|
||||
undefined4 local_24;
|
||||
undefined4 local_20;
|
||||
undefined4 local_1c;
|
||||
undefined4 local_18;
|
||||
undefined4 local_14;
|
||||
undefined4 local_10;
|
||||
undefined4 local_c;
|
||||
undefined4 local_8;
|
||||
char compressionType;
|
||||
int *innerStream;
|
||||
byte *nextXorCursor;
|
||||
|
||||
local_8 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U;
|
||||
bufferSize = *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(this) + 0xc1c));
|
||||
uVar3 = -GHIDRA_UINT((bufferSize < *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(this) + 0xc20)))) & *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(this) + 0xc20)) - bufferSize;
|
||||
uVar4 = byteCount;
|
||||
if (uVar3 < byteCount) {
|
||||
uVar4 = uVar3;
|
||||
}
|
||||
uVar1 = byteCount - uVar4;
|
||||
uVar3 = uVar4 + *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0x18));
|
||||
iVar2 = bufferSize + uVar4;
|
||||
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(this) + 0x18)) = uVar3;
|
||||
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0xc1c)) = iVar2;
|
||||
do {
|
||||
if ((uVar1 == 0) || (*GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(this) + 0xc28)) != '\0')) {
|
||||
return;
|
||||
}
|
||||
bufferSize = *GHIDRA_CAST<uint *>((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0xc)) + 0x10));
|
||||
if (uVar3 < bufferSize) {
|
||||
innerStream = *GHIDRA_CAST<int **>((GHIDRA_CAST<char *>(this) + 8));
|
||||
compressionType = *GHIDRA_CAST<char *>((*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 4)) + 4));
|
||||
if (compressionType == '\x01') {
|
||||
(**(code **)(*innerStream + 0x14))(&lzwChunkSize,4,1);
|
||||
if (0x7ff < lzwChunkSize) {
|
||||
KAGE_LogMessage(0x10,(byte *)
|
||||
"ArchivedFile::refill_buffer LZW compressed buffer overflow.\n");
|
||||
}
|
||||
(**(code **)(**GHIDRA_CAST<int **>((GHIDRA_CAST<char *>(this) + 8)) + 0x14))(GHIDRA_CAST<byte *>((GHIDRA_INT(this) + 0x1c)),1,lzwChunkSize);
|
||||
iVar2 = lzw_decompress(*(void **)(GHIDRA_CAST<char *>(this) + 0x10),GHIDRA_CAST<byte *>((GHIDRA_INT(this) + 0x81c)),
|
||||
GHIDRA_CAST<byte *>((GHIDRA_INT(this) + 0x1c)),lzwChunkSize);
|
||||
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0xc20)) = iVar2;
|
||||
}
|
||||
else if (compressionType == '\x02') {
|
||||
(**(code **)(*innerStream + 0x14))(&minizChunkSize,4,1);
|
||||
uVar4 = minizChunkSize & 0x7fffffff;
|
||||
bufferSize = minizChunkSize >> 0x1f;
|
||||
minizChunkSize = uVar4;
|
||||
if (0x7ff < uVar4) {
|
||||
KAGE_LogMessage(0x10,(byte *)
|
||||
"ArchivedFile::refill_buffer MiniZ compressed buffer overflow.\n");
|
||||
}
|
||||
(**(code **)(**GHIDRA_CAST<int **>((GHIDRA_CAST<char *>(this) + 8)) + 0x14))(GHIDRA_INT(this) + 0x1c,1,minizChunkSize);
|
||||
bufferSize = FUN_00a89f80(GHIDRA_INT(this) + 0x81c,0x400,GHIDRA_INT(this) + 0x1c,minizChunkSize,bufferSize);
|
||||
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0xc20)) = bufferSize;
|
||||
}
|
||||
else if (compressionType == '\x05') {
|
||||
bufferSize = (**(code **)(*innerStream + 0x14))(GHIDRA_INT(this) + 0x81c,1,0x400);
|
||||
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0xc20)) = bufferSize;
|
||||
xorKey = 0x475d22b0;
|
||||
local_84 = 0xd1591bd3;
|
||||
local_80 = 0xd2fb3797;
|
||||
local_7c = 0xfd8631c0;
|
||||
local_78 = 0x4bacddb5;
|
||||
local_74 = 0x521501b4;
|
||||
local_70 = 0x8750a01;
|
||||
local_6c = 0x8cfe505d;
|
||||
local_68 = 0xcbd5afa8;
|
||||
local_64 = 0xcadcee09;
|
||||
local_60 = 0x673fc476;
|
||||
local_5c = 0x648f09ed;
|
||||
local_58 = 0x1a305643;
|
||||
local_54 = 0xf9df2e89;
|
||||
local_50 = 0x1a13b8e4;
|
||||
local_4c = 0x2a4afbe;
|
||||
local_48 = 0xe02260ff;
|
||||
local_44 = 0xc9aeff0b;
|
||||
local_40 = 0xf927a07d;
|
||||
local_3c = 0xe12f6311;
|
||||
local_38 = 0xd7517e20;
|
||||
local_34 = 0xd4c4cd0e;
|
||||
local_30 = 0x88a1cfcf;
|
||||
local_2c = 0xcf964299;
|
||||
local_28 = 0xc354c1f0;
|
||||
local_24 = 0x92c29436;
|
||||
local_20 = 0xca63b8dc;
|
||||
local_1c = 0x7a1232ca;
|
||||
local_18 = 0xd25f883c;
|
||||
local_14 = 0x69e4c34b;
|
||||
local_10 = 0x2cbd3274;
|
||||
local_c = 0x34b22842;
|
||||
xorCursor = GHIDRA_CAST<byte *>((GHIDRA_INT(this) + 0x81d));
|
||||
do {
|
||||
xorCursor[-1] =
|
||||
xorCursor[-1] ^
|
||||
*GHIDRA_CAST<byte *>((GHIDRA_INT(&xorKey) + (GHIDRA_UINT((xorCursor + (-0x81d - GHIDRA_INT(this)))) & 0x7f)));
|
||||
*xorCursor = *xorCursor ^
|
||||
*GHIDRA_CAST<byte *>((GHIDRA_INT(&xorKey) + (GHIDRA_UINT((xorCursor + (-0x81c - GHIDRA_INT(this)))) & 0x7f)));
|
||||
xorCursor[1] = xorCursor[1] ^
|
||||
*GHIDRA_CAST<byte *>((GHIDRA_INT(&xorKey) + (GHIDRA_UINT((xorCursor + (-0x81b - GHIDRA_INT(this)))) & 0x7f)))
|
||||
;
|
||||
nextXorCursor = xorCursor + 4;
|
||||
xorCursor[2] = xorCursor[2] ^
|
||||
*GHIDRA_CAST<byte *>((GHIDRA_INT(&xorKey) + (GHIDRA_UINT((xorCursor + (-0x81a - GHIDRA_INT(this)))) & 0x7f)))
|
||||
;
|
||||
xorCursor = nextXorCursor;
|
||||
} while (GHIDRA_INT((nextXorCursor + (-0x81d - GHIDRA_INT(this)))) < 0x400);
|
||||
}
|
||||
else {
|
||||
uVar4 = (bufferSize - uVar3) + 3 & 0xfffffffc;
|
||||
bufferSize = 0x400;
|
||||
if (uVar4 < 0x400) {
|
||||
bufferSize = uVar4;
|
||||
}
|
||||
bufferSize = (**(code **)(*innerStream + 0x14))(GHIDRA_INT(this) + 0x81c,1,bufferSize);
|
||||
bufferSize = *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(this) + 0xc24));
|
||||
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0xc20)) = bufferSize;
|
||||
shuffleCursor = GHIDRA_CAST<undefined1 *>((GHIDRA_INT(this) + 0x81d));
|
||||
iVar2 = 0x100;
|
||||
do {
|
||||
uVar3 = *GHIDRA_CAST<uint *>((shuffleCursor + -1)) ^ bufferSize;
|
||||
uVar4 = bufferSize & 0xf;
|
||||
*GHIDRA_CAST<uint *>((shuffleCursor + -1)) = uVar3;
|
||||
swapByte = (undefined1)uVar3;
|
||||
if (uVar4 == 2) {
|
||||
shuffleCursor[2] = swapByte;
|
||||
shuffleCursor[-1] = (char)(uVar3 >> 0x18);
|
||||
swapByte = shuffleCursor[1];
|
||||
shuffleCursor[1] = *shuffleCursor;
|
||||
LAB_00a6942c:
|
||||
*shuffleCursor = swapByte;
|
||||
}
|
||||
else if (uVar4 == 9) {
|
||||
*shuffleCursor = swapByte;
|
||||
swapByte = shuffleCursor[1];
|
||||
shuffleCursor[-1] = (char)(uVar3 >> 8);
|
||||
shuffleCursor[1] = shuffleCursor[2];
|
||||
shuffleCursor[2] = swapByte;
|
||||
}
|
||||
else if (uVar4 == 0xd) {
|
||||
shuffleCursor[1] = swapByte;
|
||||
shuffleCursor[-1] = (char)(uVar3 >> 0x10);
|
||||
swapByte = shuffleCursor[2];
|
||||
shuffleCursor[2] = *shuffleCursor;
|
||||
goto LAB_00a6942c;
|
||||
}
|
||||
shuffleCursor = shuffleCursor + 4;
|
||||
bufferSize = bufferSize << 8 ^ bufferSize;
|
||||
bufferSize = bufferSize ^ bufferSize >> 9;
|
||||
bufferSize = bufferSize << 0x17 ^ bufferSize;
|
||||
iVar2 = iVar2 + -1;
|
||||
} while (iVar2 != 0);
|
||||
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(this) + 0xc24)) = bufferSize;
|
||||
}
|
||||
uVar3 = *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(this) + 0x18));
|
||||
iVar2 = 0;
|
||||
}
|
||||
else {
|
||||
*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(this) + 0xc28)) = 1;
|
||||
}
|
||||
bufferSize = *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(this) + 0xc20));
|
||||
if (uVar1 < *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(this) + 0xc20))) {
|
||||
bufferSize = uVar1;
|
||||
}
|
||||
uVar1 = uVar1 - bufferSize;
|
||||
uVar3 = uVar3 + bufferSize;
|
||||
iVar2 = iVar2 + bufferSize;
|
||||
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(this) + 0x18)) = uVar3;
|
||||
*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(this) + 0xc1c)) = iVar2;
|
||||
} while( true );
|
||||
}
|
||||
Reference in new issue
Block a user