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>
This commit is contained in:
1 parent
eafedb13a3
commit
e285a40016
4 files changed
+13
-7
No files matched your search
@@ -86,7 +86,7 @@ read from the game's own trivial Lua getters, e.g. Entity 0x334 `_targetPosition
|
||||
are typed too (`npc->_sprite._animState._isPlaying`).
|
||||
**Prototypes** come from REPENTOGON's declarations only where this exe confirms them: a `__thiscall`/`__stdcall` callee
|
||||
pops its own stack arguments (`RET n`), so the declared parameters must add up to `n` (`scripts/ApplyProtos.java`, about
|
||||
600 functions; the comment says `prototype: REPENTOGON, confirmed by RET n`). Methods of a class get a typed `this`
|
||||
600 functions, plus `db/protos.zhl`; the comment says `prototype: REPENTOGON, confirmed by RET n` or names the db file). Methods of a class get a typed `this`
|
||||
even without a prototype, and every `NpcAI::` routine is
|
||||
`__fastcall (Entity_NPC *npc)`, so you read `npc->_state`, `npc->_variant`, `npc->_i1` rather than
|
||||
`param_1[0x2d9]`. Unknown offsets still show as `field_0xNNN` or `*(int *)(p + 0xNNN)`. Look them up with
|
||||
@@ -218,7 +218,7 @@ $ ./find.sh active 33 25
|
||||
automatically and splices them in (`scripts/splice.py`). For anything else use `--asm`.
|
||||
- Item, trinket and player lookups are grep heuristics. Struct fields not confirmed in this exe are `field_0x...`.
|
||||
A function with no confirmed prototype can still show `in_ECX + 0x13c0` or odd parameter types guessed by the
|
||||
decompiler; if you work out its signature, that is worth a db entry.
|
||||
decompiler; if you work out its signature, add it to `db/protos.zhl`.
|
||||
|
||||
## Adding findings back
|
||||
|
||||
@@ -237,6 +237,8 @@ finding only in your scratch files or your final message.
|
||||
**A local variable** in a function you have read closely: `function<TAB>local_2c0<TAB>newName[<TAB>C type]` in
|
||||
`db/locals.tsv`. Only when every use has the same role: MSVC reuses registers and stack slots (see the file header).
|
||||
Name-only rows reach the dump with `apply_db.py`; rows with a type (e.g. `Vector` for an x/y pair) need `--db`.
|
||||
**A function signature**: one REPENTOGON-style line in `db/protos.zhl`, e.g.
|
||||
`__thiscall int Entity_NPC::FooBar(int count, Vector* pos);`. It is applied only if the callee's `RET n` agrees.
|
||||
3. **Re-apply to Ghidra** after any of them: `./build.sh --db` (about 10 min: updates the project and re-decompiles every
|
||||
db function into the dump, typed). Field changes reach every function only with `./build.sh --db --full` (about 50 min).
|
||||
4. **Behaviour** (states, timings, speeds, odds, bugs): write it in `notes/<entities|items|characters|systems>/<name>.md`
|
||||
|
||||
Reference in new issue
Block a user