ZL+ZR+L3 detaches the view from Link on 1.4.3 and flies it with the gamepad (freecam_pad)

The camera component update (main+0x628460) copies each component's eye, target and up into its sead camera. The site
freecam (main+0x6286d4, the load every path to that copy runs first) calls runtime/freecam.c freecam_hook, which
writes the component's one-shot eye and target overrides (+0x180, +0x198) while the free camera is on; the update
takes them in place of the pose and clears them, so the game camera's own state is never changed and resumes the
frame the free camera ends. The up vector is levelled through the component's up offset (+0x200), which is kept and
put back. Of the three components a frame updates, the hook drives the two that share the player camera's eye, leaves
the one at the default pose and picks again after a load; with the free camera off it does only the displaced load.

input.c freecam_gate latches TOTK_FREECAM_PAD (zl+zr+lstick when unset, none for no combo) like Minus+Plus and, while
the free camera is on, gives it the sticks, the trigger axes and L and R presses and the game nothing. The left stick
flies along the view and sideways, the triggers straight up and down, the right stick turns, each L or R press halves
or doubles the speed (0.25 to 512 m/s, 8 at the start); the flight follows the wall clock. TOTK_FREECAM_PATCH=0
removes the hook.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
lebomisandClaude Opus 5.5 committed 2026-11-19 13:32:22 +11:00
1 parent 94c33b1d85
commit 29eec07245
9 files changed
+353 -4

No files matched your search

+25
View File
@@ -129,6 +129,31 @@ bind_X = pad:west, key:space
bind_Y = pad:north, key:mouse_l
```
## Free camera
On game 1.4.3, ZL+ZR+L3 together (LT+RT+L3 on an Xbox pad; `freecam_pad` in `totk.ini` picks another combo, `none` none)
detach the view from Link; the same combo brings it back. The world goes on, but the game gets no gamepad input while the
free camera is on, so Link stands where he was.
| Input | Free camera |
|---|---|
| Left stick | forward and back along the view, and sideways |
| ZR / ZL (RT / LT) | straight up / down, by how far the trigger is pressed |
| Right stick | turn (yaw and pitch; pitch stops 5 degrees short of straight up or down) |
| R / L (RB / LB) | each press doubles / halves the speed, 0.25 to 512 m/s |
The keys that drive the sticks (W A S D and the arrow keys by default) move it too. Each switch starts at the game
camera's position and view at 8 m/s; the speed follows the clock, so it is the same at any frame rate and game speed.
The horizon stays level.
How it works (`runtime/freecam.c`): the camera component update (main+0x628460) copies each component's eye, target
and up into its sead camera. The site `freecam` (`recomp/patches-v143.txt`, main+0x6286d4) runs before that copy and
writes the component's one-shot eye and target overrides (+0x180, +0x198), which the update takes in place of the pose
and then clears, so the game camera's own state is never changed and resumes the frame the free camera ends. The up
vector is levelled through the component's up offset (+0x200), which is kept and put back. Of the three components a
frame updates, the free camera drives the two that share the player camera's eye and leaves the one at the default pose
(eye 0, 0, 10). After a load replaced the components it picks the new ones and keeps its position.
## Mouse camera
`mouse_mode = direct` (the default) turns the camera by the raw mouse motion on games 1.4.3 and 1.2.1, through hooks in the game's camera code (`runtime/mouse_direct.c`, the `mouse_direct` sites of `recomp/patches-v143.txt` and `recomp/patches-v121.txt`). None of them changes a step of the gamepad alone. The free-orbit camera receives raw-count
+1
View File
@@ -231,6 +231,7 @@ These names are code patch sets built into the generated game code (`recomp/patc
| `aspect_patch` (default `0`) | Patch set that feeds the camera the output's aspect ratio when it is not 16:9. | The resolution code switches this set on or off itself at start, so a value here is replaced; the code does not settle what a manual value does. | Unknown |
| `audio_drain_fix` (default `1`) | Patch set that sends the game's audio thread back to its command ring after each list (1.2.1 main+0x883780, 1.4.3 main+0x149244), so it takes every queued list per 5 ms audio frame instead of one (#337). Game 1.1.0 has no site and keeps the game's code. | `0` runs the game's code as shipped: above about 200 game updates a second the ring stays full and the game's guard (1.2.1 main+0x9bcdc4) switches the sound commands off until the game is restarted. The set acts only when more than one list is queued, so below that rate it seldom changes anything. Measured at `fps_limit = 240`, seconds with sound: on 1.2.1 5 of 118 with `0` and 108 of 118 with `1`; on 1.4.3 2 of 118 with `0` and 110 of 119 with `1`. | Safe |
| `fixed_res_patch` (default `0`) | Patch set that holds the game's dynamic resolution at 100 percent (the scene tier). | The resolution code switches this set from `dynamic_res` (on at `0`); a manual value is replaced. | Unknown |
| `freecam_patch` (default `1`) | Patch set of the hook in the camera component update behind the free camera (`freecam_pad`) on game 1.4.3. | `0` removes the hook: the free camera combo does nothing and the game gets the combo's buttons. | Safe |
| `fov_patch` (default `0`) | Patch set that scales the camera's vertical view angle by the field-of-view setting. | The resolution code switches this set itself whenever the field of view is not 100 percent; a manual value is replaced. | Unknown |
| `mouse_direct_patch` (default `1`) | Patch set of the hooks in the game's camera code behind `mouse_mode = direct` on game 1.4.3. | `0` stops `mouse_mode = direct` from taking effect; other mouse modes are unaffected. | Safe |
| `optref_guard` (default `1`) | Patch set that treats a negative value in the optional reference at object +0x6b0 (1.4.3 main+0x1bd01c0, 1.2.1 main+0x1622bec) as absent instead of loading through it (#1005). | `0` runs the game's code as shipped: the random crash reading `0xffffffffffffffff` after minutes to hours of play can return. | Risky |