diff --git a/README.md b/README.md index 9353554..624fa1e 100644 --- a/README.md +++ b/README.md @@ -75,9 +75,10 @@ functions by their body, not their name. **Struct fields are only shown where this exe confirms the offset.** REPENTOGON's definitions target 1.9.7.12 and members drift (Game +0x58 .. +0xd98 in steps, Entity_Player +4 .. +0x2c, Entity_Familiar +0x14, GridEntity_Door +0x114), so a -REPENTOGON offset is never evidence by itself. `scripts/zhl_fields.py` keeps a REPENTOGON field only when a trivial getter -or the game's Lua field table confirms it, or when it sits between two confirmed fields with the same shift; -`db/fields.tsv` holds the rest, each with the function that proves it (about 600 were verified that way). Anything else is +REPENTOGON offset is never evidence by itself, not even between two confirmed neighbours with the same shift (that put +Entity `_mass` at 0x2d4; the Lua getter reads 0x37c). `scripts/zhl_fields.py` keeps a REPENTOGON field only when a trivial +getter or the game's Lua field table confirms it; `db/fields.tsv` holds the rest, each with the function that proves it +(about 1,000 so far), and a row with type `-` deletes a wrong one. Anything else is `field_0xNNN`: unknown, not guessed. `src/structs.hpp` is generated from the same data and only compiles if every offset is consistent. diff --git a/build.sh b/build.sh index ed6f5e0..42a8efa 100755 --- a/build.sh +++ b/build.sh @@ -16,13 +16,12 @@ NPC_DISPATCH=006c2990 # Entity_NPC_UpdateAI_dispatch (callee of Entity_NPC::Up 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" - grep -hv '^#' "$D/zhl_fields.tsv" "$D/lua_fields.tsv" "$D/db/fields.tsv" > "$D/build_fields.tsv" # later lines win + P headers.py --merged "$D/build_fields.tsv" "$D/src/structs.hpp" "$D/zhl_fields.tsv" "$D/lua_fields.tsv" "$D/db/fields.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 G -process isaac-ng.exe -noanalysis -postScript ApplyTypes.java "$D/build_fields.tsv" G -process isaac-ng.exe -noanalysis -postScript ApplyProtos.java "$D/db" "$D/repentogon/libzhl/functions" # only where RET n agrees G -process isaac-ng.exe -noanalysis -postScript ApplyLocals.java "$D/db/locals.tsv" # after types: names refer to that decompile - P headers.py "$D/src/structs.hpp" "$D/zhl_fields.tsv" "$D/lua_fields.tsv" "$D/db/fields.tsv" - 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 } types_dump() { # final dump, built in dump.new and swapped in at the end so readers never see a half-written dump O="$D/dump.new"; command rm -rf "$O" diff --git a/db/fields.tsv b/db/fields.tsv index 7776bbf..1e01932 100644 --- a/db/fields.tsv +++ b/db/fields.tsv @@ -715,3 +715,333 @@ RoomSpawn 0x2 short _y Lua Spawn.Y via binder 0088e450: getter 008c1e80 pushinte RoomSpawn 0x8 uint8_t _entryCount Lua Spawn.EntryCount via binder 0088e6c0: getter 008c1f40 pushinteger(byte, high 0), setter stores byte RoomSpawn 0xc float _sumWeights Lua Spawn.SumWeights via binder 0088e840: getter 008c2000 pushnumber, setter checknumber -> float Game 0x264fc int _timeCounter Lua Game.TimeCounter via binder 008952b0: getter 008c2850 FUN_0085bfd0 signed dword, setter dword +# +# Identified from the most-used unnamed offsets in the code (6 subagents, 2026-10-24). "?" = plausible, not certain +Entity 0x37c float _mass Lua Entity.Mass getter 00431520 returns float this+0x37c (REPENTOGON/zhl_fields put _mass at 0x2d4: wrong in this exe); ai_umbilical_baby 00431be0 uses 900/(mass+50); Entity::LoadEntityConfig 006a98b0 initialises it from config+0x44 +Entity_Player 0x122c PlayerCostumeMap _playerCostumeMap[15] Update 00782af0 walks this+0x1238 (+0xc _isBodyLayer) stride 0x10 for 15 layers; entry 4 index 0x126c: Update/trigger_collectible_effect_removed 00793970 (Mega Mush 625) index*0x130 + _costumeSpriteDescs, -1 = none +Entity_Player 0x1398 bool _isPlayingExtraAnimation PlayExtraAnimation 007abe20 (Lua) sets 1; IsExtraAnimationFinished 007ab110 returns !0x1398 && !0x139a; Update 00782af0 clears it when the animation finishes +Entity_Player 0x1399 bool _isHurtPending TakeDamage 007729d0 sets 1 at the end; Update 00782af0 clears it once no item anim (0x1398) and rolls Intruder (575) spider burst +Entity_Player 0x139a bool _isPlayingItemAnimation PlayExtraAnimation 007abe90 (the anm2-swap variant used by AnimatePickup/Collectible) sets 1 and 0x1398=0; IsExtraAnimationFinished 007ab110 tests it +Entity_Player 0x13c4 std_string _name Lua EntityPlayer:GetName 007e9280 returns this+0x13c4 (SSO, cap 0x13d8); RestoreGameState 007ae4b0 assigns EntityConfig_Player::GetDisplayName; AddCollectible logs it +Entity_Player 0x14f0 Vector _playerSpriteScale Lua EntityPlayer.SpriteScale getter 0060d0a0 returns this+0x14f0/0x14f4; Update 00782af0 Sprite::SetScale(&this+0x14f0); Store/RestoreGameState save it +Entity_Player 0x14f8 Vector _bodyScale ? Render 0078b640 scales layers whose _playerCostumeMap[i]._isBodyLayer is set by this vector (0x1500 for the others); Update 00782af0 assigns it as body layer scale; saved in GameStatePlayer +Entity_Player 0x1500 Vector _headScale ? Render 0078b640 scales non-body layers' pos/size by it; Update 00782af0 offsets head layers by (0x1504-0x14fc)*2.5; saved in GameStatePlayer next to 0x14f8 +Entity_Player 0x1580 ActiveItemDesc _activeDesc[4] ctor 00753da0 zeroes 4 x 0x20 bytes at 0x1580; GetCollectibleNum 00770ca0 counts ids at 0x1580/0x15a0/0x15c0/0x15e0 (stride 0x20, REPENTOGON 0x1574 x 0x1c) +Entity_Player 0x1770 vector_RNG _collectibleRNGs GetCollectibleRNG 005b17c0: id<0 -> begin, bounds (end 0x1774 - begin)>>4, returns begin + id*0x10; UseActiveItem/IncrementPlayerFormCounter use RNG at begin+id*0x10 +Entity_Player 0x17dc int _playerForms[16] IncrementPlayerFormCounter 0075e320 writes this+0x17dc+form*4 (as _pocketSlots[form+0xf]); form 15 at 0x1818 recounts Necronomicon/Missing Page 2/trinket Missing Page; level_start 007a4ba0 recharges Necronomicon when it is >2 +Entity_Player 0x181c uint32_t _playerFormsRewarded IncrementPlayerFormCounter 0075e320 tests bit (1<