diff --git a/db/names.tsv b/db/names.tsv index bbf9d61..e814a4b 100644 --- a/db/names.tsv +++ b/db/names.tsv @@ -1300,7 +1300,7 @@ # # Corrections found by the tier-3 pass (checked: strings/callers). Short REPENTOGON sigs and ICF put these names on the wrong function. 00782af0 Entity_Player::Update 34 KB vtable slot 3; "Controller %d has disconnected", status-effect anims; ZHL had put the name on 006d97e0 -006d97e0 Entity_NPC::zhl_misfit_006d97e0 ? tests boss types (0x47..0x4c, 0xdf), Morph/BloodExplode; ZHL prefix20/55 called it Entity_Player::Update +006d97e0 Entity_NPC::split splits an NPC into two 0.66-scale halves (40% max HP / HP each, score x0.5; unsplittable types/bosses excluded; arg 3 = play sound 0x4d); Meat Cleaver's 1000.176 slash calls it (Entity_Effect::Update case 176 @0x5df80d) with its spawner as source, no sound (notes/items/effect_update.md); ZHL prefix20/55 called it Entity_Player::Update 00779b40 Entity_Player::update_body_animations ? Head*/Walk*/Blink/Shimmer anims, only caller Entity_Player::Update; ZHL called it RoomTransition::Update 00830950 RoomTransition::ChangeRoom uses _roomIndex/_direction, Game::ChangeRoom, boss intro; ZHL had put the name on 006414c0 006414c0 Entity_Familiar::zhl_misfit_006414c0 ? only caller Entity_Familiar::Update; +0x184=5, Random()%3; ZHL called it RoomTransition::ChangeRoom @@ -3481,3 +3481,12 @@ 007515c0 Level::enter_dark_closet Death Certificate use (UseActiveItem case 0x5c3433): outside dimension 2 lays it once, keeps the current room/dimension/leave door, StartRoomTransition(0x50, -1, 0x14, 0, 2) 009b1910 LevelGenerator::block_cell sets the generator +0x2b8 byte for (x, y) (13x13); generate_dark_closet blocks (1,6), (2,5), (2,7) 009b1a90 LevelGenerator::queue_push_front deque push_front on generate_rooms local queue +0041d510 Math::abs ANDPS xmm0 with 0x7fffffff mask (0xbacb40); Trinity Shield's |rotation| in Entity_Effect::Update case 47 +00429550 DeathmatchManager::is_active returns *this > 1, called on &g_game->_deathmatchManager (Game::GetField26614); Mega Blast/Larynx/brown cloud deathmatch branches +00435da0 Entity::is_slot returns type == 6 (ENTITY_SLOT); shockwave case 127/202 pushes and damages slots +005cd660 Room::is_deaths_list_done returns room+0x1bbc (Death's List done flag, Room::update_deaths_list 0x8020d0); Death Skull 1000.109 dies when set +005cd670 Room::has_exorcist returns room+0x7768, set each tick by Entity_NPC::PreUpdate 0x6c4ac0 while an 832.0 Exorcist lives; enemy ghost 1000.144 stays in a cleared room while set +005cd950 Entity_Effect::rift_attract_filter returns a != b: Ocular Rift's Game::AttractEntities filter excluding its owner player (case 180 @0x5e1b91) +006073f0 Entity_Effect::moonlight_timer_callback Luna moonlight 1000.39.1 touch: 30-tick CreateTimer callback (case 39 @0x5f2433): sound 0x84, colour flash, null item 74 (luna secondary), AnimateCollectible(0x24d), AddSoulHearts(1) +007cbcb0 Entity_Player::resolve_tainted_soul returns +0x1e68 (the Forgotten body) when the player type is 0x28 (Tainted Soul) and it is set, else the player itself +007d4340 Entity_Player::get_salvation_scale clamp(GetCollectibleEffect(0x2b8).count * 0.1 + 1, 1, 2) (asm; returns in XMM0); x1.2 is the halo's _scale (Entity_Player::Update, update_effects 0x799548) diff --git a/decompile.sh b/decompile.sh index 9e7c053..0e0a2fa 100755 --- a/decompile.sh +++ b/decompile.sh @@ -1,13 +1,22 @@ #!/bin/bash -# Usage: decompile.sh [--live|--asm] QUERY [MAX] +# Usage: decompile.sh [--live|--asm] QUERY [MAX] | decompile.sh --case CASEADDR... # QUERY = entry/inner address (0x6c0f30 / 006c0f30) or a regex on the qualified name (grep -E). # Default reads the pre-dumped corpus dump/all.c (instant, concurrency-safe). # --asm ADDR [N] prints N (default 20) instructions from ADDR (for functions the decompiler times out on). +# --case decompiles single switch cases of a function the decompiler times out on (Entity_Effect::Update): each +# CASEADDR is a jump-table target; the switch is patched to jump straight there in a throwaway copy (DecompileCase.java). # --live runs the Ghidra decompiler on a copy of the saved project (~25s; env DECOMP_TIMEOUT=secs, default 180). D="$(cd "$(dirname "$0")" && pwd)" LIVE=0; SCRIPT=Decompile.java [ "$1" = --live ] && { LIVE=1; shift; } [ "$1" = --asm ] && { LIVE=1; SCRIPT=Disasm.java; shift; } +if [ "$1" = --case ]; then + shift; TMP=$(mktemp -d); export JAVA_HOME="$D/jdk" + cp -r "$D/project" "$TMP/project"; rm -f "$TMP"/project/*.lock* + "$D/ghidra_12.2_PUBLIC/support/analyzeHeadless" "$TMP/project" isaac -process isaac-ng.exe -noanalysis -readOnly \ + -scriptPath "$D/scripts" -postScript DecompileCase.java "$TMP/out.c" "$@" >/dev/null 2>&1 + cat "$TMP/out.c"; rm -rf "$TMP"; exit +fi Q="$1"; MAX="${2:-20}" [ -z "$Q" ] && { sed -n '2,7p' "$0"; exit 1; } if [[ "$Q" =~ ^(0x)?[0-9a-fA-F]{6,8}$ ]]; then diff --git a/notes/items/effect_update.md b/notes/items/effect_update.md new file mode 100644 index 0000000..4bbc55d --- /dev/null +++ b/notes/items/effect_update.md @@ -0,0 +1,262 @@ +# Entity_Effect::Update per-variant cases (items) + +`Entity_Effect::Update` 0x5d4380 (~200 KB, a 0x7500-byte frame) never decompiles whole. Its switch is +`JMP [EDX*4 + 0x606f8c]` at 0x5d47cc on `variant - 1` (0..0xcb; anything else -> 0x606e88, the shared tail). +Read here: the item-related cases, transcribed from per-case decompiles checked against the asm. + +## How to read a case (decompile.sh --case, scripts/DecompileCase.java) + +- `./decompile.sh --case 0x6064cc [0x5f2add ...]` decompiles single cases (~4 s each after a ~5 s Ghidra start; all + 139 distinct targets take ~90 s in one call). It copies project/ to a temp dir, opens it `-readOnly`, finds the + computed JMP whose flows (or jump table, read from memory) contain the case address, patches that JMP into a direct + `JMP case` (E9 rel32 + NOPs), re-flows the function body with `CreateFunctionCmd.fixupFunctionBody` (prologue + + that case + whatever it jumps into, e.g. the shared tail) and decompiles that. Changes are discarded; the shared + project is never written. Arguments may be labelled `label=addr`; the header then reads + `//@@ 005d4380 Entity_Effect::Update/case_