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

@@ -0,0 +1,163 @@
#include "classes.h"
// 00a6c650
void KAGE::Input::InputDeviceKeyboard::vfunc_30()
{
char cVar1;
byte bVar2;
void *pvVar3;
int *windowSize;
int *in_ECX;
int iVar4;
int extraout_ECX;
int extraout_ECX_00;
int extraout_ECX_01;
int extraout_ECX_02;
int unused;
int unaff_ESI;
undefined4 *puVar5;
undefined4 *dst;
double dVar6;
int iStack_98;
float local_8c [2];
int *self;
undefined8 local_80;
undefined8 uStack_78;
int iStack_70;
int iStack_6c;
int iStack_68;
int iStack_64;
int iStack_60;
undefined8 uStack_5c;
int iStack_48;
int iStack_44;
int local_40;
int local_3c;
undefined4 local_38;
undefined4 local_34;
undefined4 local_30;
uint local_2c;
undefined4 local_28;
bVar2 = (byte)DAT_00c57b1c & 4;
puVar5 = GHIDRA_CAST<undefined4 *>(&DAT_00c78c10);
dst = GHIDRA_CAST<undefined4 *>(&DAT_00c78950);
for (iVar4 = 0x57; iVar4 != 0; iVar4 = iVar4 + -1) {
*dst = *puVar5;
puVar5 = puVar5 + 1;
dst = dst + 1;
}
*GHIDRA_CAST<undefined1 *>(dst) = *GHIDRA_CAST<undefined1 *>(puVar5);
puVar5 = &DAT_00c78ab0;
dst = GHIDRA_CAST<undefined4 *>(&DAT_00c78c10);
for (iVar4 = 0x57; iVar4 != 0; iVar4 = iVar4 + -1) {
*dst = *puVar5;
puVar5 = puVar5 + 1;
dst = dst + 1;
}
*GHIDRA_CAST<undefined1 *>(dst) = *GHIDRA_CAST<undefined1 *>(puVar5);
pvVar3 = g_glfwWindow;
self = in_ECX;
if (bVar2 != 0) {
iVar4 = 0;
if (g_glfwWindow == (void *)0x0) {
_wassert(L"window != NULL",
L"C:\\nicalis\\builderbob\\projects\\KAGE\\Source\\Platforms\\PC\\Shared\\Source\\External\\gl\\GLFW_3.4\\src\\input.c"
,0x2f9);
iVar4 = extraout_ECX;
}
if (_glfw != 0) {
cVar1 = *GHIDRA_CAST<char *>((GHIDRA_CAST<char *>(pvVar3) + 0x74));
if (cVar1 == '\x03') {
*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(pvVar3) + 0x74)) = 0;
}
else if (cVar1 != '\x01') goto LAB_00a6c6cb;
pvVar3 = g_glfwWindow;
if (g_glfwWindow == (void *)0x0) {
_wassert(L"window != NULL",
L"C:\\nicalis\\builderbob\\projects\\KAGE\\Source\\Platforms\\PC\\Shared\\Source\\External\\gl\\GLFW_3.4\\src\\input.c"
,0x310);
iVar4 = extraout_ECX_00;
}
local_80 = 0.0;
uStack_78 = 0.0;
if (_glfw == 0) {
_glfwInputError(0x10001,0);
iVar4 = extraout_ECX_01;
}
else if (*GHIDRA_CAST<int *>((GHIDRA_CAST<char *>(pvVar3) + 0x70)) == 0x34003) {
local_80 = *GHIDRA_CAST<double *>((GHIDRA_CAST<char *>(pvVar3) + 0x1e0));
uStack_78 = *GHIDRA_CAST<double *>((GHIDRA_CAST<char *>(pvVar3) + 0x1e8));
}
else {
(*DAT_00c736a0)(pvVar3,&local_80,&uStack_78);
iVar4 = extraout_ECX_02;
}
windowSize = glfw_get_window_size(GHIDRA_CAST<int *>(local_8c),iVar4);
if (local_80 <= 0.0) {
local_80 = 0.0;
}
dVar6 = (double)*windowSize + __uint_to_double_fixup[-(*windowSize >> 0x1f)];
if (dVar6 <= local_80) {
local_80 = dVar6;
}
windowSize = glfw_get_window_size(GHIDRA_CAST<int *>(local_8c),unused);
if (uStack_78 <= 0.0) {
uStack_78 = 0.0;
}
local_38 = 0;
local_3c = 0;
local_30 = 0;
local_34 = 0;
local_28 = 0;
dVar6 = (double)windowSize[1] + __uint_to_double_fixup[-(windowSize[1] >> 0x1f)];
local_2c = 0;
if (dVar6 <= uStack_78) {
uStack_78 = dVar6;
}
local_8c[0] = (float)uStack_78;
(**(code **)(*self + 0x68))(&local_40,1,0xcdcd);
iStack_68 = local_38;
iStack_64 = local_34;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(uStack_5c)) + 0x0))) = local_2c;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(uStack_5c)) + 0x4))) = local_28;
iStack_6c = iStack_98;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_80)) + 0x4))) = 1;
iStack_60 = 0xcdcd;
iStack_70 = unaff_ESI;
memset(self + 0x3a,0,0x284);
if ((local_2c & 3) == 0) {
iStack_64 = iStack_98;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(uStack_78)) + 0x4))) = iStack_98;
uStack_5c = CONCAT44((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(uStack_5c)) + 0x4))),3);
iStack_68 = unaff_ESI;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(uStack_78)) + 0x0))) = unaff_ESI;
}
else {
iStack_68 = local_40;
iStack_64 = local_3c;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(uStack_78)) + 0x0))) = iStack_48;
(*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(uStack_78)) + 0x4))) = iStack_44;
uStack_5c = CONCAT44((*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(uStack_5c)) + 0x4))),2);
}
if ((char)uStack_5c == '\0') {
return 1;
}
self[0x3a] = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(local_80)) + 0x4)));
self[0x3b] = GHIDRA_INT(uStack_78);
self[0x3c] = (*GHIDRA_CAST<undefined4 *>((GHIDRA_CAST<char *>(&(uStack_78)) + 0x4)));
self[0x3d] = iStack_70;
self[0x3e] = iStack_6c;
self[0x3f] = iStack_68;
self[0x40] = iStack_64;
self[0x41] = iStack_60;
*GHIDRA_CAST<undefined8 *>((self + 0x42)) = uStack_5c;
self[0xda] = self[0xda] + 1;
return 1;
}
_glfwInputError(0x10001,0);
}
LAB_00a6c6cb:
memset(self + 0x3a,0,0x284);
return 1;
}