Skip to content

refactor: name the vibration code, a camera shake and hero fields and states after Going Commando - #248

Open
Promises wants to merge 5 commits into
OpenRAC:mainfrom
Promises:name-actuator
Open

Promises wants to merge 5 commits into
OpenRAC:mainfrom
Promises:name-actuator

Conversation

@Promises

@Promises Promises commented Nov 23, 2026 •

Copy link
Copy Markdown

The controller vibration code now has names. actuator_CalcPower is the same mixer as Going Commando's LevelActuatorCalcPower in OpenRAC's rac2-decomp, so its record and locals use that function's names. I found this while building a rumble mod.

  • L00Entry is now ActuatorWave, with the fields kind, output, multiply, delay, duration, frame, rise, fall, amplitude and bias. I checked each one by its offset and by how the function uses it. The six wave shapes are now enum ActuatorWaveKind constants, which replace the case 0..case 5 numbers. The struct name follows the global actuator_wave and the NTSC decomp's newer header.
  • One difference from Going Commando: kind stays a halfword. Retail loads and clears offset 0 with lh/sh. Going Commando reads byte 1 as its own permanent flag, but here the duration always counts down. A comment at the countdown says so.
  • In PadState, the bytes at 0x188 and 0x189 are now small_motor and large_motor. That is how Going Commando's poll sends them through sceVibSetActParam (small motor on/off, large motor 0..255). Here the poll only clears them, because sceVibSetActParam was dead-stripped. The comments in pad.h, pad.c and docs/game/data-structures.md say so.
  • The debug menu's Actuator flag is now actuator_enabled, the NTSC decomp's name for it. That covers debug_menu_and_text.c and the run_level_main_loop store that turns it on.
  • config/data_types.tsv and config/data_in_c.tsv follow the type rename.

This changes names, types, comments and one enum only. The compiled output is unchanged.

Further commits found while scanning Going Commando's rumble code. I checked each name against RAC1's own code.

Camera shake, not rumble (refactor(l07))

func_L07_003134B8 had the NTSC decomp's name rumble_by_distance, but it never touches the pad. debris_far_point is the camera's position (CameraSystem.pos, +0x140), and the function writes shake[0].amplitude (+0x160) and shake[0].frames (+0x168) from 0x140 before it. The amplitude is up to 0.1 at the camera and none from 80 units away, for 20 frames. It is now camera_shake_by_distance. I added it as a clash row in config/names_local.tsv and carried it through with tools/names.py local and rename. names.py also put the address name back in include/overlays/l07_umbris/taxi_platform.h, because declarations keep the address name.

Wrench hit latch (refactor(hero), 0xA64)

unkA64 is now wrench_hit_latch. emit_filtered_entry_sparkles sets it the first time a swing's hit spheres find a moby, so the hit sound plays once per swing. HeroEnterMoveState and each level's copy of it clear it as each melee state starts: wrench combo, slam, crouch swing, held-item attack, grind attack and the attack-record states. The rename touches 44 files, version copies included.

Hero states (refactor(hero))

  • 0x08, LAND → HERO_STATE_PACK_GLIDE. The hero enters it from a fall with Cross held, more than 0.6 above the ground, once the Heli-Pack is owned and while the Hydro-Pack is not equipped. In this state he falls slowly (0.72 of the step) at 3 units a second, or 5 with the Thruster-Pack, and the pack's sound plays.
  • 0x81, DELAYED_JUMP_OR_R1_REPEAT_EXIT_WAIT → HERO_STATE_THRUSTER_HOVER. A double tap of R1 with the Thruster-Pack equipped enters it. A spring holds him 0.17 above the ground; when he is higher, he sinks slowly. OpenRAC's SDK already calls this state the Thruster-Pack's hover.
  • New HERO_STATE_WALL_JUMP = 0x11. Cross while wall_jump_window is open, from a jump, a run jump, another wall jump or a glide begun from one.
  • New HERO_STATE_HYDRO_PACK_DASH = 0x35. R1 or R2 held while swimming, once the Hydro-Pack is owned.

A comment in the header lists the NTSC decomp's names for these four values. The two new members are not yet used at their call sites. tools/tidy/hero_states.py would do that, but it also has 96 unrelated conversions pending on main, so I kept it out of this PR. The two rename commits (0xA64 and the states) are listed in .git-blame-ignore-revs.

Validation

I don't have the PAL v2.00, PAL v1.00 or NTSC-J discs, so tools/check_all.sh could not run (it needs baserom/). In its place:

  • Compiler output, before and after, for the whole tree. I compiled the game's C with its compiler (ee-gcc2953 v1.14 under Wine in the rac1-build container, -O2 -G2 -Iinclude -Wa,-I,. plus each file's config/file_cflags.txt flags, -S) on upstream 84bd565f and on this branch:

    • every file of src/, except src/libgcc and the data files other than the actuator's block, which got a placeholder .inc;
    • every PAL v1.00, NTSC-U and NTSC-J spliced unit, built with tools/version_src.py's spliced() with all of that version's definitions.

    675 of 678 units compiled, and all 675 .s files are identical apart from the .file path line. The 3 that did not compile fail the same way on both trees: kprintf.c, printf_rand.c and sprintf.c are 2.9-ee units that need its stdarg.h, and this branch does not touch them. Everything after the compiler is a text pass over that .s, so the objects are identical too.

  • Checks that run without a disc: gen_progress_report.py --check and version_sync.py check (reports current, versions in step, nothing to commit), move_src.py --check, check_docs.py, data_in_c.py check, fakematch_scan.py --check, check_no_retail.py, names.py check, overlay_rename.py --check, ratchets.py --check (no count went up), format.py --check (clang-format 22.1.8), check_syntax.py (13 known errors, as on main) and all 402 tool tests. All of these passed.

  • Not run: the full build, link and image comparison against retail for any version, overlay_remnants.py --check (needs the level dumps) and version_sync.py run.

Promises and others added 5 commits November 23, 2026 19:13
actuator_CalcPower is the same mixer as Going Commando's
LevelActuatorCalcPower (OpenRAC's rac2-decomp), so its slot record and
locals take that function's names:

- L00Entry becomes ActuatorWave, with kind, output, multiply, delay,
  duration, frame, rise, fall, amplitude and bias, and an enum for the
  six wave shapes. kind stays a halfword: Going Commando reads byte 1
  as a separate `permanent` flag, here the duration always counts down.
- PadState's two bytes at 0x188 and 0x189 are small_motor and
  large_motor. The poll clears them and never sends them, as
  sceVibSetActParam was dead-stripped.
- The debug menu's Actuator flag is actuator_enabled, as the NTSC
  decomp names it.

Names, types and comments only: the compiler's output for every
touched file, and for its PAL v1.00 and NTSC-U spliced units, is the
same as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…istance

func_L07_003134B8 took the NTSC decomp's name rumble_by_distance, but it
never touches the pad. It writes the camera block: debris_far_point is
the camera's position (CameraSystem.pos, +0x140), and the two stores
from that base minus 0x140 are shake[0].amplitude (+0x160, up to 0.1,
none from 80 units away) and shake[0].frames (+0x168, 20).

The name is a clash row in config/names_local.tsv, carried into
names.tsv, names.h and the sources with tools/names.py local and rename.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The hero's word at 0xA64 is set by emit_filtered_entry_sparkles the
first time a wrench swing's hit spheres find a moby, which plays the hit
sound once per swing. HeroEnterMoveState (and each level's copy of it)
clears it as each melee state starts: the wrench combo, slam and crouch
swing, the held-item attack, the grind attack and the attack-record
states.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hruster-Pack hover states

Four hero states take names from the code that enters them:

- 0x08 was LAND. The hero enters it from a fall with Cross held, more
  than 0.6 above the ground, once the Heli-Pack is owned and while the
  Hydro-Pack is not on his back; it falls slowly (gravity 0.72 of the
  step), at 3 a second, or 5 with the Thruster-Pack, and plays the
  pack's sound. It is the pack glide: HERO_STATE_PACK_GLIDE.
- 0x81 was DELAYED_JUMP_OR_R1_REPEAT_EXIT_WAIT. A double tap of R1 with
  the Thruster-Pack on his back enters it; it holds him 0.17 above the
  ground on a spring (higher, he sinks slowly) at up to 5.75 a second:
  HERO_STATE_THRUSTER_HOVER, as OpenRAC's SDK calls it.
- 0x11, new: Cross while wall_jump_window is open, from a jump, a run
  jump, a wall jump or a glide begun from one: HERO_STATE_WALL_JUMP.
- 0x35, new: R1 or R2 held while swimming once the Hydro-Pack is owned:
  HERO_STATE_HYDRO_PACK_DASH.

The two new members are not written into their use sites yet: the
hero_states tidy has other conversions pending on main, kept out of
this change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…it blame

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Promises Promises changed the title refactor(actuator): name the vibration code after Going Commando's refactor: name the vibration code, a camera shake and hero fields and states after Going Commando Nov 23, 2026
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