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,79 @@
#include "classes.h"
// 00926020
PersistentGameData_Bestiary * PersistentGameData_Bestiary::constructor()
{
PersistentGameData_Bestiary mapHead;
void *local_10;
undefined1 *puStack_c;
undefined4 local_8;
local_8 = 0xffffffff;
puStack_c = &LAB_00b0a863;
local_10 = ExceptionList;
ExceptionList = &local_10;
*this = (PersistentGameData_Bestiary)0x0;
this[1] = (PersistentGameData_Bestiary)0x0;
mapHead = (PersistentGameData_Bestiary)operator_new(0x18);
*GHIDRA_CAST<PersistentGameData_Bestiary *>(mapHead) = mapHead;
*GHIDRA_CAST<PersistentGameData_Bestiary *>((GHIDRA_CAST<char *>(mapHead) + 4)) = mapHead;
*GHIDRA_CAST<PersistentGameData_Bestiary *>((GHIDRA_CAST<char *>(mapHead) + 8)) = mapHead;
*GHIDRA_CAST<undefined2 *>((GHIDRA_CAST<char *>(mapHead) + 0xc)) = 0x101;
*this = mapHead;
local_8 = 0;
this[2] = (PersistentGameData_Bestiary)0x0;
this[3] = (PersistentGameData_Bestiary)0x0;
mapHead = (PersistentGameData_Bestiary)operator_new(0x18);
*GHIDRA_CAST<PersistentGameData_Bestiary *>(mapHead) = mapHead;
*GHIDRA_CAST<PersistentGameData_Bestiary *>((GHIDRA_CAST<char *>(mapHead) + 4)) = mapHead;
*GHIDRA_CAST<PersistentGameData_Bestiary *>((GHIDRA_CAST<char *>(mapHead) + 8)) = mapHead;
*GHIDRA_CAST<undefined2 *>((GHIDRA_CAST<char *>(mapHead) + 0xc)) = 0x101;
this[2] = mapHead;
(*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x0))) = 1;
this[4] = (PersistentGameData_Bestiary)0x0;
this[5] = (PersistentGameData_Bestiary)0x0;
mapHead = (PersistentGameData_Bestiary)operator_new(0x18);
*GHIDRA_CAST<PersistentGameData_Bestiary *>(mapHead) = mapHead;
*GHIDRA_CAST<PersistentGameData_Bestiary *>((GHIDRA_CAST<char *>(mapHead) + 4)) = mapHead;
*GHIDRA_CAST<PersistentGameData_Bestiary *>((GHIDRA_CAST<char *>(mapHead) + 8)) = mapHead;
*GHIDRA_CAST<undefined2 *>((GHIDRA_CAST<char *>(mapHead) + 0xc)) = 0x101;
this[4] = mapHead;
local_8 = CONCAT31((*GHIDRA_CAST<undefined1 *>((GHIDRA_CAST<char *>(&(local_8)) + 0x1))),2);
this[6] = (PersistentGameData_Bestiary)0x0;
this[7] = (PersistentGameData_Bestiary)0x0;
mapHead = (PersistentGameData_Bestiary)operator_new(0x18);
*GHIDRA_CAST<PersistentGameData_Bestiary *>(mapHead) = mapHead;
*GHIDRA_CAST<PersistentGameData_Bestiary *>((GHIDRA_CAST<char *>(mapHead) + 4)) = mapHead;
*GHIDRA_CAST<PersistentGameData_Bestiary *>((GHIDRA_CAST<char *>(mapHead) + 8)) = mapHead;
*GHIDRA_CAST<undefined2 *>((GHIDRA_CAST<char *>(mapHead) + 0xc)) = 0x101;
this[6] = mapHead;
ExceptionList = local_10;
return this;
}
// 00926120
PersistentGameData_Bestiary::~PersistentGameData_Bestiary()
{
PersistentGameData_Bestiary *encounterMap;
encounterMap = this + 6;
FID_conflict__Erase_tree<fuzzer::fuzzer_allocator<std::_Tree_node<fuzzer::TracePC::PCTableEntry_const*,void*>_>_>
(encounterMap,(fuzzer_allocator<std::_Tree_node<unsigned_int,void*>_> *)encounterMap,
*(_Tree_node<unsigned_int,void*> **)(GHIDRA_INT(this[6]) + 4));
operator_delete((void *)*encounterMap,0x18);
encounterMap = this + 4;
FID_conflict__Erase_tree<fuzzer::fuzzer_allocator<std::_Tree_node<fuzzer::TracePC::PCTableEntry_const*,void*>_>_>
(encounterMap,(fuzzer_allocator<std::_Tree_node<unsigned_int,void*>_> *)encounterMap,
*(_Tree_node<unsigned_int,void*> **)(GHIDRA_INT(this[4]) + 4));
operator_delete((void *)*encounterMap,0x18);
encounterMap = this + 2;
FID_conflict__Erase_tree<fuzzer::fuzzer_allocator<std::_Tree_node<fuzzer::TracePC::PCTableEntry_const*,void*>_>_>
(encounterMap,(fuzzer_allocator<std::_Tree_node<unsigned_int,void*>_> *)encounterMap,
*(_Tree_node<unsigned_int,void*> **)(GHIDRA_INT(this[2]) + 4));
operator_delete((void *)*encounterMap,0x18);
FID_conflict__Erase_tree<fuzzer::fuzzer_allocator<std::_Tree_node<fuzzer::TracePC::PCTableEntry_const*,void*>_>_>
(this,(fuzzer_allocator<std::_Tree_node<unsigned_int,void*>_> *)this,
*(_Tree_node<unsigned_int,void*> **)(GHIDRA_INT(*this) + 4));
operator_delete((void *)*this,0x18);
return;
}