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

+65
View File
@@ -0,0 +1,65 @@
#include "classes.h"
// 00417510
void EntityList_EL::constructor(EntityList_EL *source)
{
*GHIDRA_CAST<undefined1 *>(this) = 1;
this->_data = source->_data;
this->_capacity = source->_capacity;
this->_size = source->_size;
return;
}
// 00417630
void EntityList_EL::push_back(Entity *entity)
{
int count;
count = this->_size;
if (GHIDRA_UINT(this->_capacity) < count + 1U) {
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("EL: not enough space for push_back\n"));
count = this->_size;
}
*GHIDRA_CAST<Entity **>((GHIDRA_CAST<char *>(this->_data) + count * 4)) = entity;
this->_size = this->_size + 1;
return;
}
// 00417670
void EntityList_EL::remove(Entity *entity)
{
uint shiftIndex;
uint size;
uint uVar1;
undefined4 *slotPtr;
uVar1 = 0;
size = this->_size;
if (size != 0) {
do {
if (*GHIDRA_CAST<Entity **>((GHIDRA_CAST<char *>(this->_data) + uVar1 * 4)) == entity) {
while ((uVar1 < size && (*GHIDRA_CAST<Entity **>((GHIDRA_CAST<char *>(this->_data) + uVar1 * 4)) == entity))) {
if (size <= uVar1) {
KAGE_LogMessage(0x10,GHIDRA_CAST<byte *>("EL: invalid index for remove\n"));
size = this->_size;
}
shiftIndex = uVar1;
if (uVar1 < size - 1) {
do {
slotPtr = GHIDRA_CAST<undefined4 *>((GHIDRA_INT(this->_data) + shiftIndex * 4));
shiftIndex = shiftIndex + 1;
*slotPtr = slotPtr[1];
size = this->_size;
} while (shiftIndex < size - 1);
}
size = size - 1;
this->_size = size;
}
}
else {
uVar1 = uVar1 + 1;
}
} while (uVar1 < size);
}
return;
}