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

+63
View File
@@ -0,0 +1,63 @@
#include "classes.h"
// 00a12d50
byte ImageBase::set_size(uint width, uint height, int unused)
{
uint uVar1;
uint uVar2;
uint textureWidth;
uint textureHeight;
uint clampTmp;
uint clampedHeight;
uint clampedWidth;
uVar1 = (**(code **)(*GHIDRA_CAST<int *>(this) + 0x4c))();
uVar2 = (**(code **)(*GHIDRA_CAST<int *>(this) + 0x50))();
if ((uVar2 < width) || (uVar2 < height)) {
KAGE_LogMessage(8,GHIDRA_CAST<byte *>("Attempted to create image larger than max supported size"));
return 0;
}
textureWidth = FUN_00a15590();
textureHeight = FUN_00a15590();
clampTmp = uVar1;
if (uVar1 < width) {
clampTmp = width;
}
clampedWidth = uVar2;
if (clampTmp < uVar2) {
clampedWidth = clampTmp;
}
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(this) + 0x10)) = clampedWidth;
clampTmp = uVar1;
if (uVar1 < height) {
clampTmp = height;
}
clampedHeight = uVar2;
if (clampTmp < uVar2) {
clampedHeight = clampTmp;
}
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(this) + 0x14)) = clampedHeight;
clampTmp = uVar1;
if (uVar1 < textureWidth) {
clampTmp = textureWidth;
}
textureWidth = uVar2;
if (clampTmp < uVar2) {
textureWidth = clampTmp;
}
if (uVar1 < textureHeight) {
uVar1 = textureHeight;
}
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(this) + 0x18)) = textureWidth;
if (uVar1 < uVar2) {
uVar2 = uVar1;
}
*GHIDRA_CAST<uint *>((GHIDRA_CAST<char *>(this) + 0x1c)) = uVar2;
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x20)) =
(float)((double)GHIDRA_INT(clampedWidth) + __uint_to_double_fixup[-(GHIDRA_INT(clampedWidth) >> 0x1f)]) /
(float)((double)GHIDRA_INT(textureWidth) + __uint_to_double_fixup[-(GHIDRA_INT(textureWidth) >> 0x1f)]);
*GHIDRA_CAST<float *>((GHIDRA_CAST<char *>(this) + 0x24)) =
(float)((double)GHIDRA_INT(clampedHeight) + __uint_to_double_fixup[-(GHIDRA_INT(clampedHeight) >> 0x1f)]) /
(float)((double)GHIDRA_INT(uVar2) + __uint_to_double_fixup[-(GHIDRA_INT(uVar2) >> 0x1f)]);
return 1;
}