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

+4 -6
View File
@@ -18,10 +18,8 @@ GAME="${GAME:-$HOME/.steam/steam/steamapps/common/The Binding of Isaac Rebirth}"
apply_db() { # db names -> struct types (zhl + db fields)
G -process isaac-ng.exe -noanalysis -postScript ApplyDb.java "$D/db/names.tsv"
P vtable.py "$D/bin/isaac-ng.exe" "$D/dump/functions.tsv" "$D/zhl_vtables.tsv" --classes "$D/dump/all.c" > "$D/classes.tsv" # RTTI: size, bases, slots
P headers.py --merged "$D/build_fields.tsv" "$D/src/structs.hpp" "$D/zhl_fields.tsv" "$D/lua_fields.tsv" "$D/db/fields.tsv" \
P merge_fields.py "$D/build_fields.tsv" "$D/zhl_fields.tsv" "$D/lua_fields.tsv" "$D/db/fields.tsv" \
<(awk -F'\t' '!/^#/ && $4 != "-" {print $1 "\tsize\t" $4}' "$D/classes.tsv") # later rows win, "-" deletes
echo '#include "structs.hpp"' | g++ -std=c++17 -fsyntax-only -I"$D/src" -x c++ - \
|| echo "src/structs.hpp does not compile: a db/fields.tsv offset contradicts another" >&2
P this_types.py "$D/dump/all.c" "$D/build_fields.tsv" "$D/build_this.tsv"
G -process isaac-ng.exe -noanalysis -postScript ApplyTypes.java "$D/build_fields.tsv" "$D/build_this.tsv"
G -process isaac-ng.exe -noanalysis -postScript ApplyGlobals.java "$D/db/globals.tsv"
@@ -48,9 +46,9 @@ types_dump() { # final dump, built in dump.new and swapped in at the end so re
command mv "$D/dump" "$D/dump.old" && command mv "$O" "$D/dump" && command rm -rf "$D/dump.old"
source_tree
}
source_tree() { # the reconstructed C++ tree (classes.hpp + one .cpp per class), checked against the game's ABI (i686 MSVC)
command rm -rf "$D/src/game" && mkdir -p "$D/src/game"
P source_tree.py "$D/src/game" "$D/classes.tsv" "$D/dump" "$D/zhl_vtables.tsv" --check
source_tree() { # generated-src/: the decompiled C++ tree (classes.h + one .cpp per class) for 64-bit Linux, minus what src/ took over
command rm -rf "$D/generated-src" && mkdir -p "$D/generated-src"
P source_tree.py "$D/generated-src" "$D/classes.tsv" "$D/dump" "$D/zhl_vtables.tsv" --check
}
if [ "$1" = --db ]; then
apply_db