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>
This commit is contained in:
shweetandClaude Opus 5.5 committed 2026-10-24 21:14:38 -04:00
1 parent f4eb24590e
commit 17fa5aa8e2
6 files changed
+452 -12

No files matched your search

+1
View File
@@ -8,6 +8,7 @@ stored here: `./decompile.sh 0xADDR` prints it from the dump, with the current n
| `entities/` | per-entity findings from the monster-fidelity passes (state machines, timings, speeds, what the port changed or skipped) |
| `systems/greed_mode.md` | Greed waves' coins and music, Ultra Greed/coins/doors states, donation machine spawn, Greed doors/button, Mega Satan door |
| `systems/alt_path.md` | Repentance's path: secret exit kinds and doors, Level::SetNextStage's routing, the mirror world and mineshaft dimensions, quest doors, the white fire's Lost Curse, minecarts |
| `systems/use_dispatch.md` | id -> case of UseActiveItem / UseCard / UsePill from the exe's jump tables (`use_dispatch.tsv`, `find.sh active/card/pill`), the slot-labelled second active switch, the common tail (TemporaryEffect), actives without a case |
| `systems/room_features.md` | Room spawns (grid index wrap, trigger outputs 969 / Room::TriggerOutput, held Spawners), pressure plates and the mineshaft rail plate, white and giga poops, Mom's bed, Fissure and its spawner, Mother's Shadow, secret Isaac; why Rotgut's maggot, the Beast, Ultra Horsemen and Dogma wait |
| `items/items_sweep_10.md` | Smelter/Guppy's Tail room drop variant, Daemon's Tail pickup picker, I'm Drowsy slowdown, Guillotine orbit layer + orbit distance table, Converter |
| `items/items_sweep_11.md` | Nancy Bombs flag roll (GetBombFlags) |
+40
View File
@@ -0,0 +1,40 @@
# Active item / card / pill dispatch (rif/items-verify)
`use_dispatch.tsv` (repo root, from `scripts/use_dispatch.py bin/isaac-ng.exe repentogon/libzhl/functions/Global.zhl`)
maps every id to its case: `kind id enum target label anchor shares`. `find.sh active|card|pill ID [N]` prints the case.
The table is read from the exe's jump tables, so it is exact; only the label (the regex finding the case in the C)
depends on how Ghidra printed the switch.
## Entity_Player::UseActiveItem (0x5b39d0) dispatch at 0x5b3c77
- Prologue: id 0x3b (Book of Belial passive, Judas' birthright) is used as 0x22 (Book of Belial). Negative ids
(TMTRAINER glitched items) go to 0x9e01b0 instead of the switch. The use is passed through Lua first (0x863760:
a callback returning true skips everything).
- `id > 0x11a`: table B, `id - 0x11b` in 0..0x1be, byte index 0x5c7760, jump table 0x5c7598 (114 slots, slot 0x71
= default). Ghidra could not normalise it ("Could not find normalized switch variable to match jumptable") and
labels its cases with the SLOT (`case 0:` .. `case 0x71:`, sometimes decimal: Abyss is `case 99:`, Suplex
`case 100:`). This is why the old `find.sh active` missed every id from 283 (D100) up.
- `id == 0x11a` (How to Jump): an `if (pEVar47 == 0x11a)` before switch A.
- `id - 0x21` in 0..0xe6: table A, byte index 0x5c746c, jump table 0x5c73a0 (51 slots); Ghidra labels these with the
real id (`case (Entity_Player *)0x21:`).
- Default 0x5c71f1: log if the id is out of range, then the common tail.
- Common tail LAB_005b54d1: Lua MC_USE_ITEM, AnimateCollectible when the case asked for it, RemoveCollectible for
single-use (flag 0x40), cache flags from the item config (+0x54) then EvaluateItems, **TemporaryEffects::AddEffect
of the item unless the case cleared the flag** (local_60a, default 1), AddCostume; 0x246 (Glowing Hourglass) and
0x2c0 (R Key) extra calls.
- Shared cases: Pony 130 / White Pony 181, Candle 164 / Red Candle 289, D6 105 / Eternal D6 609, We Need To Go Deeper 84 / Mom's Shovel 552, Gamekid 93 / Esau Jr 703, Crack the Sky 160 / Book of Virtues
584 (a shared case tests the id where they differ).
- Actives with no case at all (only the room TemporaryEffect, read through `HasCollectibleEffect(id)` elsewhere;
use `find.sh item ID`): 77 My Little Unicorn, 137 Remote Detonator, 298 Unicorn Stump, 474 Broken Glass Cannon,
516 Sprinkler, 655 Spin to Win (and the unused 43).
- D Infinity (0x1e9) uses one of 10 dice from table 0xb1f450 through a recursive UseActiveItem, then a small second
switch at 0x5bfbd8 (id - 0x11b, byte index 0x5c79c4, table 0x5c79b0) for the dice's after-effects; that is not a
dispatcher.
## Entity_Player::UseCard (0x7b2230) and UsePill (0x7c4180)
- UseCard: `card - 1` in 0..0x60, jump table 0x7b8a00, default 0x7b8949; cases labelled with the card id. Ace of
Clubs/Diamonds/Spades/Hearts (27-30) share one case. A nested switch inside the Reverse Hermit (0x41) case has its
own `case 0x45:`, so the first match of `case 0x45` is not Reverse Death: find.sh matches only indent 2..4.
- UsePill: the pill EFFECT (already resolved from the colour by the caller), 0..0x31, jump table 0x7c77e4, default
0x7c7528; horse pill = local_204 (bit 0x800 of the use flags), labelled with the effect id.