Commit Graph
44 Commits
Author SHA1 Message Date
shweetandClaude Opus 5.5 4badd39376 source_tree --check: report boot-path curation (what Manager::Init reaches, the first milestone)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 21:12:06 -05:00
shweetandClaude Opus 5.5 3ce74c6e2d 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>
2026-11-19 21:10:23 -05:00
shweetandClaude Opus 5.5 2ff2d5d87f source_tree: pointer casts through GHIDRA_CAST (a float holds the pointer's bits); ApplyTypes: zero-length placeholders
MSVC copies pointers through XMM registers, so Ghidra types some as float: those casts now reinterpret the bits
(float-to-pointer errors 2415 -> 171). Classes with no known field get a zero-length struct, so the decompiler stops
typing 4-byte values with them (applies next build). The hazard count now covers every raw (char *)x + n access: 32689.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 21:01:50 -05:00
shweetandClaude Opus 5.5 bafef76746 source_tree: STL member layouts, (int) casts that keep pointer width, EntityPtr as a pointer, Ghidra partial fields
Container fields use the MSVC layouts ApplyTypes gives Ghidra (vector_X -> std_vector ...); (int)/(uint) casts become
GHIDRA_INT/GHIDRA_UINT (32-bit numbers, full-width pointers); EntityPtr behaves as the raw pointer the code treats it
as; EXPR._0_4_ partial accesses become explicit offsets; field-less Ghidra placeholders no longer claim 4 bytes.
--check: 878/3262 method bodies compile for x86_64 (26.9%).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 20:58:28 -05:00
shweetandClaude Opus 5.5 fdfdb10137 Build 28: DumpAll exports types, globals and imports; the generated tree targets 64-bit Linux
DumpAll writes dump/types.tsv (Ghidra structs/unions with components, typedefs, enums with values), data.tsv (global
data labels with types) and externals.tsv (imported functions). source_tree.py lays the Ghidra types out with the
classes (591 types, 347 sized), declares every global, import and code label, drops Windows calling conventions,
leaves third-party classes (std, rapidxml, theoraplayer, luabridge, stb_vorbis) declared but not reconstructed, turns
raw vtable calls on typed objects into named virtual calls and (int)p + n byte arithmetic into (char *)p + n.
The tree now targets x86_64 Linux; the original 32-bit layout stays as LAYOUT32 asserts, checked with -m32 (they hold).
--check: 775/3262 method bodies compile for x86_64 (23.8%), 23010 raw offset accesses left (64-bit hazards).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 20:54:04 -05:00
shweetandClaude Opus 5.5 177020866b Build 27: real class sizes in Ghidra's structs; src/game: generated C++ tree with method bodies
ApplyTypes grows each struct to its RTTI size: this[1] misreads 1363 -> 941, prototypes applied 3266.
scripts/source_tree.py now writes src/game/classes.hpp (477 classes, every free and namespace function declared,
Ghidra p-code intrinsics as macros) and one .cpp per class with its decompiled method bodies; member calls become
direct calls ((Class *)(obj))->Class::method(args) and field_0xN bytes explicit offsets. --check compiles the tree:
652/3315 method bodies compile against the header (19.7%), the rest mostly need the data globals and Ghidra types
DumpAll exports from the next build. CLAUDE.md is untracked (gitignored).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 20:18:39 -05:00
shweetandClaude Opus 5.5 c426b91486 Full redump with round 26 (689 locals in 127 functions); src/game/classes.hpp: reconstructed class declarations
classes.tsv (vtable.py --classes): 194 RTTI classes with vftable, direct bases (offsets from the PMD), vtable slots and,
for 176, the exact size from the deleting destructor's sized delete. Sizes flow into structs.hpp (static_assert sizeof)
and, next build, into Ghidra's structs (ApplyTypes 'size' rows) so this[1]._x stops standing in for the tail.
scripts/source_tree.py generates src/game/classes.hpp: 293 classes with real bases, vtables in slot order (overrides,
REPENTOGON slot names, vfunc_N placeholders), fields at their offsets, 2400 method declarations; it compiles with
clang --target=i686-pc-windows-msvc and all 174 sizeof / 1899 offsetof asserts hold. Round 26's prototypes are held.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 19:43:13 -05:00
shweetandClaude Opus 5.5 d4033485ba Full redump with round 25: 778 locals in 97 functions; ApplyProtos renames a local that blocks a parameter name
Prototypes applied 3163 -> 3241, rejected 113 -> 35 (a locals row had named the stand-in local like the parameter).
Round 25 agents may fix wrong names and retype in place (39 same-name rows). Dropped the row naming Level::load_room's
this 'pit'; locals_round.py no longer merges renames of this. Round 25's prototypes are held in db/protos.zhl.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 18:59:02 -05:00
shweetandClaude Opus 5.5 24098479e7 ApplyProtos: read the purge from the RETs when Ghidra has none, trust db/ prototypes past that; log what it skips
Purge unknown 139 -> 11, prototypes applied 3032 -> 3163 (round 24's 12 included), param_N lines 33145 -> 31116,
in_ECX 35059 -> 32432; Room::Update/Render get a typed this. ApplyLocals: a same-name row with a type retypes in place,
and an unparseable type fails only its row. notes/decomp_issues.md collects what the round 23-24 agents found wrong.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 18:16:18 -05:00
shweetandClaude Opus 5.5 264c401368 Full redumps with rounds 23-24: second-pass locals in the largest named functions, 270 prototypes from round 22
Round 23: 2490 locals in 50 functions (default names there 5761 -> 2946). Round 24: 1116 locals in 79 more.
3032 prototypes applied. db/protos.zhl also holds round 24's 12 prototypes for the next build.
scripts/locals_round.py: pick / locals / protos steps of a locals round (the /tmp copies were lost in a reboot).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 17:42:50 -05:00
shweetandClaude Opus 5.5 9c1cc9c741 decompile.sh --case: decompile single switch cases of functions Ghidra times out on (Entity_Effect::Update 0x5d4380): DecompileCase.java patches the switch JMP at 0x5d47cc to jump straight to the case in a -readOnly copy and re-flows the body; all 139 cases decompile in ~90 s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 17:09:29 -04:00
shweetandClaude Opus 5.5 1da26aa0e7 Full redump with round 12: 1511 more locals in the next 80 game functions; ApplyLocals skips a clashing name instead of aborting
3899 of 3920 db/locals.tsv names now show in the dump (UseCard's 56 still wait). Delirium, Heretic, Reap Creep,
Entity_Effect::Render, Game::BombTearflagEffects, Menu_Stats, ... plus 18 prototypes from round 11.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 05:19:48 -04:00
shweetandClaude Opus 5.5 b1b64761d0 Full redump with round 11: 1335 more locals named in the next 64 largest game functions (all applied)
UsePill, Game::Render, Entity_Laser::update_laser, Room::render_water, the Beast, CreateGlitchedCollectible, the NPC
dispatcher, ... Entity_Player::UseCard still fails in ApplyLocals ('Bad instruction count exceeded', not the instruction
limit: raising it did not help), so its 56 rows wait.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 04:14:02 -04:00
shweetandClaude Opus 5.5 8e6b947042 Full redump with 15 prototypes from the locals round; ApplyLocals raises the decompiler's instruction limit for UseCard
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 03:26:24 -04:00
shweetandClaude Opus 5.5 79259ccf8f Full redump with round 10: 1017 local variables named in the 37 largest game functions
Entity_Player::UseActiveItem/update_effects/EvaluateItems/Update/TakeDamage, Entity_Tear::Update, Entity_Familiar::Update,
EntityConfig::LoadEntities, Room::Init, Level::place_special_rooms, Hush, Mega Satan, ... (only single-role variables:
damageSource, isPenalized, genRng, secretRoomIdx, daemonsTailRng). Entity_Player::UseCard's 56 rows did not apply
(ApplyLocals could not decompile it this run; it now prints the decompiler's error).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 22:57:49 -04:00
shweetandClaude Opus 5.5 40e518bc76 Full redump with round 9 prototypes (1716 applied) and KAGE_LogMessage returning again
Ghidra had KAGE_LogMessage marked non-returning, so ~1,200 functions were cut off at their first log call. ApplyProtos
clears the flag on any function with a RET, re-disassembles after its calls and regrows the callers: 'does not return'
5337 -> 2355 (all genuine: _invalid_parameter_noinfo_noreturn, _Xlen, _CxxThrowException), dump 1.235M -> 1.299M lines.
596 more prototypes, ~20% with REPENTOGON register notation: param_N lines 44610 -> 42588, in_XMM 1237 -> 734.
12 renames from the agents (HUD::LoadGraphics at 008ed350 = Menu_OnlineLobby::load_member_sprite, Room::MamaMegaExplosion
= Weapon::fire_bomb, vector_iterate_noop = PlayerManager::get_total_luck, log_room_transition = RoomTransition::start, ...).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 21:41:31 -04:00
shweetandClaude Opus 5.5 36ae4cbfb8 ApplyProtos: REPENTOGON register notation (float r<xmm3>, int x<edx>, float<xmm0> returns, static cleanup) via custom storage
Whole-program optimisation passes many floats in XMM registers and some arguments in ECX/EDX with the caller popping the
stack; those declarations were skipped. Every prototype is now applied with explicit storage (this in ECX for __thiscall).
Tested on a project copy: 1103 -> 1158 applied from the existing files (REPENTOGON's register declarations now fit),
e.g. void __thiscall Game::SetBloom(Game *this,int Time,float Strength).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 20:25:00 -04:00
shweetandClaude Opus 5.5 df5db46f62 Full redump with round 8: 471 confirmed prototypes (1103 applied, was 622); ApplyProtos takes free functions
Every db/protos.zhl line is checked against the callee's RET n. Typed parameters make more pointers typed: named
->members 104k -> 115k (field_0x 3946 -> 4576 as newly typed pointers show their unknown members), param_N lines
47349 -> 44610. 83 targets skipped: XMM float args/returns or ECX/EDX + caller-cleaned stack (whole-program optimisation).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 20:21:16 -04:00
shweetandClaude Opus 5.5 57cb93d778 Full redump with round 7: 465 names + ~40 corrections, 208 fields; stale REPENTOGON structs verified
field_0x 5868 -> 3946, named ->members 99k -> 104k, unnamed code 19% -> 13.5% of bytes, 9132 FUN_ left.
LayerState/ChallengeParam/DailyChallenge/Menu_Online/GameStateItemPool/ItemPool_Item/BackwardsStageDesc, left in Ghidra by
an early unfiltered import, now come from 86 verified rows (all offsets held; GlowingHourglassState's tail is +0x188 here).
Corrections: libpng/libjpeg/libvorbis misnames, wrong ZHL matches (Manager::ResizeWindow = Cutscene::ANM2Part::Update,
NPCAI_Pathfinder::EvadeTarget = netplay), GameOver::Show, Level::load_room. std::vector<bool> is 0x10 (bit count).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 19:32:02 -04:00
shweetandClaude Opus 5.5 f7a1e00362 Full redump with round 6 and STL/small-struct typing: field_0x 14227 -> 5868, named ->members 90k -> 99k
ApplyTypes: std_vector/string/deque/map/set/list members get MSVC layouts (_begin/_end/_capacity ...), structs used as a
member type are built even when small (BitSet128 _tearFlags._l, KColor, RNG were dropped), structs padded to a multiple
of 4 (PlayerCostumeMap stride 0x10). headers.py prints STL members at their real size and pads to the alignment.
Round 6: 99 fields (Manager ItemConfig lists/InfoDisplay/lobby settings, Game transitions/PreloadManager, PersistentGameData
arrays, HomingLaser, EntityList), 500 names, 6 corrections (Menu_Challenge::Render, Level::compute_room_distances, ...).
9622 FUN_ left, in_ECX + 0x 17363 -> 16720.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 18:31:00 -04:00
shweetandClaude Opus 5.5 3f1e276667 ApplyTypes: a field of unknown type (std_map, DeathmatchManager) names its first dword instead of being dropped
Shows &g_game->_deathmatchManager (462 uses of field_0x26614) and lets ItemConfig grow past a 4-byte stub, so Manager
accesses read (g_manager->_itemConfig).field_0xc. Takes effect on the next build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 17:52:42 -04:00
shweetandClaude Opus 5.5 55ff607849 Full redump with round 5: 600 function names, 11 corrections, 27 fields, 66 globals; drop ECX-offset class placement of FUN_
The FUN_ placement (1d43433) fit any small-offset function to a dense class: 29 library functions went to OptionsConfig,
ScoreSheet/Popup/NightmareScene/Room code to Entity_Player or Entity. Reverted, and the 72 placed functions moved back to
global. Corrections include wrong ZHL signature matches (Entity_Familiar::RestoreState is a libpng writer,
Entity_Pickup::TriggerShopPurchase a netplay message reader, LoadArchiveFile is Gamepad_processEvents) and
theora/vorbis/miniz misnames. 10134 FUN_ left; raw in_ECX + 0x 17363 (+1.1k from the un-placing).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 17:51:30 -04:00
shweetandClaude Opus 5.5 a928f6204f Full redump with 65 typed globals, 53 fields, 346 function names; apply_db.py writes atomically
g_game/g_manager typed: 1483 g_manager-> and 834 g_game-> member accesses now visible (field_0x 10636 -> 14385 counts them);
named members 81k -> 91k, raw in_ECX + 0x 18425 -> 16225. ApplyGlobals takes array types (char[5]).
apply_db.py used to truncate all.c before computing the new text, so a killed build left it empty.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 17:25:09 -04:00
shweetandClaude Opus 5.5 2e4322b8a5 db/globals.tsv + ApplyGlobals.java: label and type global data; apply_db.py 1000x faster (token match + dict lookup)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 16:36:51 -04:00
shweetandClaude Opus 5.5 1d43433e1b this_types: also place unnamed FUN_ functions in a class when their ECX offsets match one class's field starts unambiguously
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 16:30:21 -04:00
shweetandClaude Opus 5.5 5dbb3e398d ApplyTypes: FamiliarAI routines typed __fastcall(Entity_Familiar *familiar) like NpcAI (ECX reads all fit)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 16:08:58 -04:00
shweetandClaude Opus 5.5 cbb2f465ec Typed this for ~780 more methods whose ECX reads fit their class's confirmed fields; Sprite/Color = ANM2/ColorMod
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 16:08:01 -04:00
shweetandClaude Opus 5.5 134ab40589 Fields: 325 identified from the most-used unnamed offsets; bracketing is no longer evidence; '-' rows delete wrong fields
Entity _mass (0x2d4) and _depthOffset (0x2b0) were REPENTOGON fields kept by bracketing and both wrong
(Lua getters read 0x37c / 0x358). Bracketed fields now need direct confirmation; 155 are being re-verified.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 23:40:33 -04:00
shweetandClaude Opus 5.5 d806b3b969 ColorMod layout from the Lua Color getters; Entity._splatColor; embed small/placeholder structs (EntityPtr)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 23:08:54 -04:00
shweetandClaude Opus 5.5 e285a40016 db/protos.zhl: own function signatures, applied like REPENTOGON's only where RET n agrees
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 22:50:46 -04:00
shweetandClaude Opus 5.5 540cc49d34 ApplyTypes: place fields in offset order and keep an embedded struct over views into it
Entity._sprite (ANM2, now its full 0x114) was being overwritten by _spriteOffset/_spriteScale/_isFlipX,
which are sprite members; every sprite access had fallen back to field_0x48/0x78/0x7c/0x8c.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 22:46:55 -04:00
shweetandClaude Opus 5.5 288ea53ab4 ApplyProtos: REPENTOGON prototypes applied only where the callee's RET n agrees (~600 functions)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 22:22:39 -04:00
shweetandClaude Opus 5.5 3f88849636 ApplyTypes: classes with __thiscall methods keep a typed this even with no confirmed field
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 21:59:11 -04:00
shweetandClaude Opus 5.5 5d1b595294 Struct fields only where this exe confirms them; 600 verified fields; generated src/structs.hpp
REPENTOGON targets 1.9.7.12 and its offsets drift, so they are no longer trusted by themselves:
scripts/zhl_fields.py (replaces fix_offsets.py) keeps a REPENTOGON field only when a getter or the
game's Lua field table confirms it, or it sits between two confirmed fields with the same shift.
8 agents verified the rest against code (Game/Manager/Entity_Player shift in steps; Room, ANM2,
EntityConfig unshifted). src/structs.hpp is generated from the confirmed fields with static_asserts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 21:37:10 -04:00
shweet d2b8a9229a names: CAH fill, NPC hold 2026-10-24 21:24:59 -04:00
shweetandClaude Opus 5.5 17fa5aa8e2 use_dispatch: id -> case table for UseActiveItem/UseCard/UsePill from the jump tables; find.sh active/card/pill
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 21:14:38 -04:00
shweetandClaude Opus 5.5 e22000166d vtable.py: bases from RTTI; 35 slot names inherited from REPENTOGON's base layouts
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 20:30:12 -04:00
shweetandClaude Opus 5.5 3e43a4ced2 find.sh vtable CLASS: vtable slots from the exe's RTTI
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 20:29:01 -04:00
shweetandClaude Opus 5.5 0a615743fc db: 575 tier-3 names (largest unnamed functions) and 50 corrections of wrong ZHL/ICF names
Entity_Player::Update, RoomTransition::ChangeRoom, PlayerHUD::RenderHearts, ReviveFromTrinket,
Menu_Game::Update, MenuManager::Render were on the wrong functions; real Beast and Scourge bodies
found; the Lua Font table was attributed to KColor; Weapon vtable slots from the exe's RTTI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 20:28:28 -04:00
shweetandClaude Opus 5.5 ba6ef6dcb0 db/locals.tsv + ApplyLocals.java: per-function local variable renames/retypes; apply_db renames name-only locals in the dump
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 17:40:37 -04:00
shweetandClaude Opus 5.5 60942dc32c Split zhl multi-field declarations (22 lines: player hearts, BitSet128, BlendMode...) in zhl_match.py and zhl_fields.tsv
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 16:28:00 -04:00
shweetandClaude Opus 5.5 13fb3d891e db: 85 more names (Lua-vs-sig fixes, top gameplay helpers); apply_db by address; atomic redump
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 13:23:19 -04:00
shweetandClaude Opus 5.5 03a56f217f Import anm2/rooms labels into db, embed struct fields, mine Lua getters for fields
- db/names.tsv: 163 names from src/anm2 and src/rooms labels (2 fix wrong ZHL names)
- ApplyTypes: embed known structs (Entity._sprite is an ANM2) instead of skipping them
- scripts/lua_fields.py -> lua_fields.tsv: 96 fields from the game's own Lua getters

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 13:19:48 -04:00
shweetandClaude Opus 5.5 ad8f933086 Salvage Repentance+ 1.9.7.17 decompilation toolkit, notes and name database
Ghidra 12.2 project and full dump of isaac-ng.exe v1.9.7.17, query scripts, notes
indexed by entity, anm2/rooms reimplementations, and db/ (names + fields) that
build.sh re-applies. Fixes awk numeric address comparison in find.sh/decompile.sh.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 13:08:19 -04:00