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:
1 parent
f4eb24590e
commit
17fa5aa8e2
6 files changed
+452
-12
No files matched your search
@@ -49,7 +49,7 @@ so parallel live calls work too. Set `DECOMP_TIMEOUT=secs` for big functions (de
|
||||
|
||||
`find.sh` modes (run it without args to list them): `name REGEX`, `str REGEX` (strings and their users),
|
||||
`strs FUNC` (strings a function uses), `code REGEX` (functions whose C matches, with hit counts),
|
||||
`callers X`, `callees X`, `npc TYPE`, `item ID`, `active ID [N]`, `player ID`, `enum REGEX`, `lua REGEX`, `field REGEX`, `val ADDR`,
|
||||
`callers X`, `callees X`, `npc TYPE`, `item ID`, `active ID [N]`, `card ID [N]`, `pill ID [N]`, `player ID`, `enum REGEX`, `lua REGEX`, `field REGEX`, `val ADDR`,
|
||||
`vtable CLASS` (slots read from the exe's RTTI: the authoritative way to name Update/Render/Fire... of an Entity_* or Weapon_* class).
|
||||
|
||||
## Naming you will see
|
||||
@@ -118,10 +118,11 @@ at 0x6c41dc. Each case calls one AI routine with ECX = the NPC. `scripts/NpcTabl
|
||||
overlap, so read the callee name. The `this` (player) argument is implicit (ECX) and not printed.
|
||||
3. Stat items live in `Entity_Player::EvaluateItems` (00763570, about 53 KB). Tear and fire behaviour is in
|
||||
`Entity_Player::GetMultiShotParams`, `Entity_Tear::*` and `Entity_Player::Update`.
|
||||
4. **Actives:** `./find.sh active <id>` prints the `case <id>:` blocks of `Entity_Player::UseActiveItem`
|
||||
(005b39d0, about 10.7k lines; it took about 45 min to decompile and was spliced into the dump). Cards and
|
||||
pills have their own functions, `Entity_Player::UseCard` and `UsePill`; use `decompile.sh` and grep for
|
||||
`case 0x..`.
|
||||
4. **Actives, cards, pills:** `./find.sh active <id>` (also `card <id>`, `pill <effect>`) prints the case of
|
||||
`Entity_Player::UseActiveItem` (005b39d0, about 10.7k lines; it took about 45 min to decompile and was spliced into
|
||||
the dump), `UseCard` or `UsePill`. The id -> case table `use_dispatch.tsv` is read from the exe's jump tables
|
||||
(`scripts/use_dispatch.py`); UseActiveItem's second table (ids 283+) is labelled by table slot in the C, not by id,
|
||||
see `notes/systems/use_dispatch.md`. An active with no case only adds its TemporaryEffect: use `find.sh item`.
|
||||
|
||||
**Character.** `./find.sh enum PLAYER_` gives the id. `./find.sh player <id>` lists compares against the player
|
||||
type that sit within 4 lines of a `GetPlayerType()` or `_playerType` (0x13c0) read. For gimmicks, also grep
|
||||
@@ -192,8 +193,7 @@ $ ./find.sh active 33 25
|
||||
if ((Entity::Type() == 0x2d) || (Entity::Type() == 0x4e)) { /* Mom (45) / Mom's Heart (78) */
|
||||
(*(code **)(*piVar21 + 0x24))(); /* vtable slot 9 = Kill */
|
||||
```
|
||||
`active` prints every `case 0x21:` in `UseActiveItem`. The function has more than one switch, so check which
|
||||
switch a hit belongs to. Here the second hit, at line 5188, is a different switch.
|
||||
`active` prints the one case the jump table sends id 33 to (`use_dispatch.tsv`), with the other ids sharing it.
|
||||
|
||||
## What works / what doesn't
|
||||
|
||||
|
||||
Reference in new issue
Block a user