Skip to content

refactor(names): the level hook the weapon quick select's paused mode calls - #472

Open
Promises wants to merge 1 commit into
OpenRAC:masterfrom
Promises:names/level-hook-hold-timers
Open

Promises wants to merge 1 commit into
OpenRAC:masterfrom
Promises:names/level-hook-hold-timers

Conversation

@Promises

Copy link
Copy Markdown

What

func_0026F7B0 (was stub_empty_20) becomes level_hook_hero_button_hold_timers. Only the name changes, plus comments at its definition (src/game/0026EA00.c) and at mode 7 in the three UpdateModalState sources (src/game/00286738-g8.c, src/pal/game/00287018-g8.c, src/us2/game/00287140-g8.c).

Why

In the boot the function is an empty 8-byte stub, but it is a level hook: each level's program puts its own function at that symbol. In every one of USA v2.00's 27 level programs, its resolved value is that level's place of hero_update_button_hold_timers (func_L00_002CB218, the hero's double-tap timers):

  • 0x2CB4C0 in level 0;
  • 0x2C3978 in level 1;
  • 0x2EDD80 in level 4;
  • …
  • 0x2D21C0 in level 30.

These values come from the build's resolved symbols per program (build/us2/<program>/config/undefined_symbols.ld), compared with the places column of config/us2/levels/functions.tsv.

UpdateModalState's mode 7 is the weapon quick select's paused mode. It calls this hook in each of its four phases, so the hero's double-tap timers keep running while the world is held. Read as stub_empty_20, that call looked like it did nothing. I found this while porting the quick select to a Ratchet & Clank 1 mod (https://github.com/Promises/rac1-gc-weapon-wheel), where the double tap depends on it.

Checked

  • The four changed C files are token-identical to master once tools/srcnames.py turns names back into address names (comments aside).
  • python3 tools/build.py boot --version us2 --strict: OK.
  • python3 tools/build.py level 0 --version us2 --strict and level 4: OK.
  • python3 tools/build.py boot --version pal --strict: OK.
  • tests/check_repository.py: passed. tools/names.py check: current. tools/progress.py --check: passes.
  • Not run: the USA v1.01 builds and the PAL levels; I have no disc for them. I only checked the hook's value per level on USA v2.00. v1.01 and PAL use the same C and the same symbol.

… calls

func_0026F7B0 (was stub_empty_20) is empty in the boot, but it is a level
hook: in each of USA v2.00's 27 level programs its value is that level's
hero_update_button_hold_timers (func_L00_002CB218; 0x2CB4C0 in level 0's
program, 0x2EDD80 in level 4's), read from each program's resolved
symbols. UpdateModalState's mode 7 (the weapon quick select's paused
mode) calls it in each of its four phases, so the hero's double-tap
timers run while the world is held; read as an empty stub, that call
looked like nothing. It is level_hook_hero_button_hold_timers now, with a
comment at its definition and at mode 7 in the three UpdateModalState
sources.

Checked: names and comments only. The four changed C files are
token-identical to master once tools/srcnames.py turns names back into
address names (comments aside), so every object is the same; see the
pull request for the builds.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant