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:
shweetandClaude Opus 5.5 committed 2026-11-19 21:10:23 -05:00
1 parent 2ff2d5d87f
commit 3ce74c6e2d
331 files changed
+485 -7835

No files matched your search

+181
View File
@@ -0,0 +1,181 @@
#include "classes.h"
// 0084dad0
InfoDisplayEntry::InfoDisplayEntry()
{
uint uVar1;
void *local_10;
undefined1 *puStack_c;
undefined4 local_8;
puStack_c = &LAB_00b02f81;
local_10 = ExceptionList;
uVar1 = __security_cookie ^ GHIDRA_INT(register0x00000010) - 4U;
ExceptionList = &local_10;
*GHIDRA_CAST<undefined4 *>(this) = 0;
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 4)) = 0;
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 8)) = 0;
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x18)) = 0;
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x1c)) = 0xf;
*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(this) + 8)) = 0;
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x20)) = 0;
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x24)) = 0;
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x28)) = 0;
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x2c)) = 0;
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x30)) = 0;
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x34)) = 0;
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x38)) = 0;
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x3c)) = 0;
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x40)) = 0;
local_8 = 3;
*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(this) + 0x44)) = 0;
FUN_006efa40(uVar1);
ExceptionList = local_10;
return this;
}
// 0084e820
int InfoDisplayEntry::count_lines(Entity_Player *param_1, uint param_2)
{
int iVar1;
void *pvVar2;
void *pvVar3;
int *piVar4;
char cVar5;
byte bVar6;
int *in_ECX;
int iVar7;
uint uVar8;
int local_c;
iVar1 = in_ECX[1];
if (iVar1 == 0) {
return (in_ECX[0xc] - in_ECX[0xb]) / 0x68;
}
iVar7 = 0;
uVar8 = 0;
local_c = 0;
pvVar2 = (g_manager->_itemConfig)._playerForms._end;
pvVar3 = (g_manager->_itemConfig)._playerForms._begin;
if (GHIDRA_INT(pvVar2) - GHIDRA_INT(pvVar3) >> 2 != 0) {
do {
if (((-1 < GHIDRA_INT(uVar8)) && (GHIDRA_INT(uVar8) < GHIDRA_INT(pvVar2) - GHIDRA_INT(pvVar3) >> 2)) &&
(piVar4 = *GHIDRA_CAST<int **>((GHIDRA_CAST<char *>(pvVar3) + uVar8 * 4)), piVar4 != GHIDRA_CAST<int *>(0x0))) {
if (piVar4[2] == 0 && piVar4[3] == 0) {
if (*piVar4 == 0xf) {
if (*in_ECX == 0) {
if ((iVar1 == 0x23) || (iVar1 == 0x106)) {
LAB_0084e8f3:
local_c = iVar7 + 1;
iVar7 = local_c;
}
}
else if ((*in_ECX == 1) && (iVar1 == 0x30)) goto LAB_0084e8f3;
}
}
else {
if (*in_ECX == 0) {
cVar5 = ItemConfig::collectible_has_tags(piVar4[2],piVar4[3]);
}
else {
if (*in_ECX != 1) goto LAB_0084e8fa;
cVar5 = ItemConfig::trinket_has_tags(piVar4[2],piVar4[3]);
}
iVar7 = local_c;
if (cVar5 != '\0') {
goto LAB_0084e8f3;
}
}
}
LAB_0084e8fa:
uVar8 = uVar8 + 1;
} while (uVar8 < GHIDRA_UINT((GHIDRA_INT(pvVar2) - GHIDRA_INT(pvVar3) >> 2)));
}
iVar1 = (in_ECX[9] - in_ECX[8]) / 0x68;
iVar7 = iVar1 + local_c;
if (iVar1 == 0) {
iVar7 = local_c;
}
uVar8 = 0;
iVar1 = in_ECX[0xc] - in_ECX[0xb] >> 0x1f;
if ((in_ECX[0xc] - in_ECX[0xb]) / 0x68 + iVar1 != iVar1) {
do {
bVar6 = (GHIDRA_CAST<InfoDisplayItem *>((in_ECX)))->InfoDisplayItem::is_line_visible(uVar8,param_1,param_2);
if (bVar6 != 0) {
iVar7 = iVar7 + 1;
}
uVar8 = uVar8 + 1;
} while (uVar8 < GHIDRA_UINT(((in_ECX[0xc] - in_ECX[0xb]) / 0x68)));
}
return iVar7;
}
// 0084f2e0
void * InfoDisplayEntry::operator_assign(void *other)
{
byte *text;
int dwordsLeft;
undefined4 *src;
undefined4 *dst;
*GHIDRA_CAST<undefined4 *>(this) = *GHIDRA_CAST<undefined4 *>(other);
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 4)) = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(other) + 4));
text = GHIDRA_CAST<byte *>((GHIDRA_INT(other) + 8));
if (GHIDRA_CAST<byte *>((GHIDRA_INT(this) + 8)) != text) {
if (0xf < *GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(other) + 0x1c))) {
text = *GHIDRA_CAST<byte **>(text);
}
(GHIDRA_CAST<std::string *>((GHIDRA_CAST<char *>((GHIDRA_INT(this) + 8)))))->std::string::assign(text,*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(other) + 0x18)));
}
if (GHIDRA_CAST<undefined4 *>((GHIDRA_INT(this) + 0x20)) != GHIDRA_CAST<undefined4 *>((GHIDRA_INT(other) + 0x20))) {
std::vector<104byte>::assign
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(other) + 0x20)),*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(other) + 0x24)),other);
}
if (GHIDRA_CAST<undefined4 *>((GHIDRA_INT(this) + 0x2c)) != GHIDRA_CAST<undefined4 *>((GHIDRA_INT(other) + 0x2c))) {
std::vector<104byte>::assign
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(other) + 0x2c)),*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(other) + 0x30)),other);
}
if (GHIDRA_CAST<undefined4 *>((GHIDRA_INT(this) + 0x38)) != GHIDRA_CAST<undefined4 *>((GHIDRA_INT(other) + 0x38))) {
std::vector<104byte>::assign
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(other) + 0x38)),*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(other) + 0x3c)),other);
}
*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(this) + 0x44)) = *GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(other) + 0x44));
src = GHIDRA_CAST<undefined4 *>((GHIDRA_INT(other) + 0x48));
dst = GHIDRA_CAST<undefined4 *>((GHIDRA_INT(this) + 0x48));
for (dwordsLeft = 0x33; dwordsLeft != 0; dwordsLeft = dwordsLeft + -1) {
*dst = *src;
src = src + 1;
dst = dst + 1;
}
return this;
}
// 008568a0
void InfoDisplayEntry::copy_constructor(void *other)
{
void *local_10;
undefined1 *puStack_c;
undefined4 local_8;
local_8 = 0xffffffff;
puStack_c = &LAB_00b034e4;
local_10 = ExceptionList;
ExceptionList = &local_10;
this->std::string::string(other);
local_8 = 0;
std::vector<int>::copy_constructor(GHIDRA_INT(other) + 0x18);
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 1;
std::vector<int>::copy_constructor(GHIDRA_INT(other) + 0x24);
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 2;
std::vector<int>::copy_constructor(GHIDRA_INT(other) + 0x30);
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 3;
std::vector<int>::copy_constructor(GHIDRA_INT(other) + 0x3c);
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 4;
std::vector<int>::copy_constructor(GHIDRA_INT(other) + 0x48);
local_8 = CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x1))),5);
std::vector<int>::copy_constructor(GHIDRA_INT(other) + 0x54);
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 0x60)) = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(other) + 0x60));
*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(this) + 100)) = *GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(other) + 100));
ExceptionList = local_10;
return;
}