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,96 @@
|
||||
#include "classes.h"
|
||||
|
||||
// 0042f850
|
||||
Shape::Shape(void *other)
|
||||
{
|
||||
void *nameDst = this;
|
||||
uint uVar1;
|
||||
size_t indexBytes;
|
||||
uint allocBytes;
|
||||
void *pvVar2;
|
||||
void *pvVar3;
|
||||
undefined4 pointsEnd;
|
||||
void *namesAlloc;
|
||||
undefined4 extraout_ECX;
|
||||
char *nameDst;
|
||||
void *local_10;
|
||||
undefined1 *puStack_c;
|
||||
undefined4 local_8;
|
||||
undefined4 *namesBegin;
|
||||
|
||||
local_8 = 0xffffffff;
|
||||
puStack_c = &LAB_00af1ee6;
|
||||
local_10 = ExceptionList;
|
||||
uVar1 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U;
|
||||
ExceptionList = &local_10;
|
||||
*GHIDRA_CAST<undefined4 *>(nameDst) = *GHIDRA_CAST<undefined4 *>(other);
|
||||
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(nameDst) + 4)) = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(other) + 4));
|
||||
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(nameDst) + 8)) = 0;
|
||||
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(nameDst) + 0xc)) = 0;
|
||||
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(nameDst) + 0x10)) = 0;
|
||||
pvVar3 = *(void **)(GHIDRA_CAST<char *>(other) + 8);
|
||||
if (pvVar3 != *(void **)(GHIDRA_CAST<char *>(other) + 0xc)) {
|
||||
indexBytes = GHIDRA_INT(*(void **)(GHIDRA_CAST<char *>(other) + 0xc)) - GHIDRA_INT(pvVar3);
|
||||
allocBytes = GHIDRA_INT(indexBytes) >> 1;
|
||||
if (0x7fffffff < allocBytes) {
|
||||
/* WARNING: Subroutine does not return */
|
||||
FUN_0040cee0(uVar1);
|
||||
}
|
||||
allocBytes = allocBytes * 2;
|
||||
pvVar2 = std::_Allocate(allocBytes);
|
||||
*(void **)(GHIDRA_CAST<char *>(nameDst) + 8) = pvVar2;
|
||||
*(void **)(GHIDRA_CAST<char *>(nameDst) + 0xc) = pvVar2;
|
||||
*(void **)(GHIDRA_CAST<char *>(nameDst) + 0x10) = (void *)(GHIDRA_INT(pvVar2) + allocBytes);
|
||||
pvVar2 = *(void **)(GHIDRA_CAST<char *>(nameDst) + 8);
|
||||
memmove(pvVar2,pvVar3,indexBytes);
|
||||
*(void **)(GHIDRA_CAST<char *>(nameDst) + 0xc) = (void *)(allocBytes + GHIDRA_INT(pvVar2));
|
||||
}
|
||||
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 0;
|
||||
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x1))) = 0;
|
||||
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(nameDst) + 0x14)) = 0;
|
||||
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(nameDst) + 0x18)) = 0;
|
||||
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(nameDst) + 0x1c)) = 0;
|
||||
if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(other) + 0x14)) != *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(other) + 0x18))) {
|
||||
allocBytes = (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(other) + 0x18)) - *GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(other) + 0x14))) / 0x14;
|
||||
if (0xccccccc < allocBytes) goto LAB_0042fa29;
|
||||
allocBytes = allocBytes * 0x14;
|
||||
pvVar3 = std::_Allocate(allocBytes);
|
||||
*(void **)(GHIDRA_CAST<char *>(nameDst) + 0x14) = pvVar3;
|
||||
*(void **)(GHIDRA_CAST<char *>(nameDst) + 0x18) = pvVar3;
|
||||
*(void **)(GHIDRA_CAST<char *>(nameDst) + 0x1c) = (void *)(GHIDRA_INT(pvVar3) + allocBytes);
|
||||
pointsEnd = FUN_0042f800(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(nameDst) + 0x14)),extraout_ECX);
|
||||
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(nameDst) + 0x18)) = pointsEnd;
|
||||
}
|
||||
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 1;
|
||||
FUN_0042f1a0(GHIDRA_INT(other) + 0x20);
|
||||
namesBegin = GHIDRA_CAST<undefined4 *>((GHIDRA_INT(nameDst) + 0x2c));
|
||||
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 2;
|
||||
*namesBegin = 0;
|
||||
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(nameDst) + 0x30)) = 0;
|
||||
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(nameDst) + 0x34)) = 0;
|
||||
pvVar3 = *(void **)(GHIDRA_CAST<char *>(other) + 0x2c);
|
||||
pvVar2 = *(void **)(GHIDRA_CAST<char *>(other) + 0x30);
|
||||
if (pvVar3 != pvVar2) {
|
||||
allocBytes = (GHIDRA_INT(pvVar2) - GHIDRA_INT(pvVar3)) / 0x18;
|
||||
if (0xaaaaaaa < allocBytes) {
|
||||
LAB_0042fa29:
|
||||
/* WARNING: Subroutine does not return */
|
||||
FUN_0040cee0(uVar1);
|
||||
}
|
||||
allocBytes = allocBytes * 0x18;
|
||||
namesAlloc = std::_Allocate(allocBytes);
|
||||
*namesBegin = namesAlloc;
|
||||
*(void **)(GHIDRA_CAST<char *>(nameDst) + 0x30) = namesAlloc;
|
||||
*(void **)(GHIDRA_CAST<char *>(nameDst) + 0x34) = (void *)(GHIDRA_INT(namesAlloc) + allocBytes);
|
||||
nameDst = GHIDRA_CAST<char *>(*namesBegin);
|
||||
local_8 = CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x1))),4);
|
||||
do {
|
||||
(GHIDRA_CAST<std::string *>((nameDst)))->std::string::string(pvVar3);
|
||||
nameDst = nameDst + 0x18;
|
||||
pvVar3 = (void *)(GHIDRA_INT(pvVar3) + 0x18);
|
||||
} while (pvVar3 != pvVar2);
|
||||
*GHIDRA_CAST<char **>((GHIDRA_CAST<char *>(nameDst) + 0x30)) = nameDst;
|
||||
}
|
||||
ExceptionList = local_10;
|
||||
return nameDst;
|
||||
}
|
||||
Reference in new issue
Block a user