The free camera is off by default behind its own switch, Free camera on the Controls tab (freecam_patch, read at start), so the camera update runs the game's code as shipped for players who never use it; the combo and key rows stay greyed until the switch is on and the game restarted, and the freecam set sits at the end of the 1.4.3 table so the sets before it keep their numbers (#1199)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Valiantsin DzerakhandClaude Opus 5.5 committed 2026-11-20 08:16:57 +03:00
1 parent 53f9e9bb5f
commit 8c3831a1f3
8 files changed
+52 -21

No files matched your search

+3 -2
View File
@@ -132,8 +132,9 @@ bind_Y = pad:north, key:mouse_l
## Free camera
On game 1.4.3, a chosen gamepad combo or a key steps the free camera through three stages: move, lock, and off again.
Neither is set by default: pick them with `freecam_pad` and `freecam_key` in `totk.ini` or on the Controls tab (for
example ZL+ZR+L3, LT+RT+L3 on an Xbox pad, and F2; `none` turns one off). An input script can press the combo as a
It is off by default: turn on *Free camera* on the Controls tab (`freecam_patch = 1`) and restart. Then pick the
combo or the key, neither set by default, with `freecam_pad` and `freecam_key` in `totk.ini` or on the Controls tab
(for example ZL+ZR+L3, LT+RT+L3 on an Xbox pad, and F2; `none` turns one off). An input script can press the combo as a
gamepad would; the keys bound to its buttons do not. While the free camera moves, the world goes on but the game gets
no input, so Link stands where he was.
+1 -1
View File
@@ -232,7 +232,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 fills, and the game's guard (1.2.1 main+0x9bcdc4) switches the sound commands off until the game is restarted once 300 updates in a row find it full. The guard starts over whenever two audio frames fall between two updates, so by the code it fires only while the audio frames come evenly, 5 ms apart: with `audio = none`, or while the audio device takes nothing and the mixer keeps time by its own timer. The guard's count and the switch have not been read in a run. With a device playing the game kept its sound in every run on Linux with PipeWire and 1024-frame device periods, where the frames come in bursts after each period; on Windows the bursts are read from the code (`gap_ns = 0` in `runtime/audren.c`), not measured; a device with periods of 240 frames or less was not tried and may pace as evenly as the timer. The set acts only when more than one list is queued, so below that rate it seldom changes anything. Measured at `fps_limit = 240` (Linux, PipeWire), seconds with sound with `0` and with `1`. On 1.2.1: without a device 6 of 119 and 111 of 119; with a device 111 of 119 and 112 of 119; with the game's stream paused for 5 s from outside (`pw-cli`, not a real device stalling) 4 of 120 (silent from the pause on, also after the device resumed) and 113 of 119; a pause of 2 s silenced the game with `0`, a pause of 1 s did not. On 1.4.3: without a device 3 of 119 and 113 of 120; with a device 111 of 119 with `0`; with the stream paused for 5 s, in 60 s runs, 3 of 59 and 51 of 59; a pause of 2 s with `0`, 4 of 59. | 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 |
| `freecam_patch` (default `0`) | Patch set of the hook in the camera component update behind the free camera (`freecam_pad`, `freecam_key`) on game 1.4.3; the *Free camera* row of the Controls tab. Read at start. | `1` puts the hook in the camera update: while the free camera is off it runs the game's own load and one compare. `0` runs the game's code as shipped: the combo and the key do 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 |
+10 -8
View File
@@ -128,14 +128,6 @@ set fov TOTK_FOV_PATCH 0
site fov main 628c3c bd413e60 f81f0fea @page:x10 bd413e60 bd403d48 1e280800 f84107ea # ldr s0, [x19, #0x13c] (camera update)
site fov main b4342c bd4066c0 f81f0fea @page:x10 bd4066c0 bd403d48 1e280800 f84107ea # ldr s0, [x22, #0x64] (camera setup)
# Free camera (runtime/freecam.c freecam_hook, page +0xf50). The camera component update (main+0x628460, the routine of
# the first fov and aspect sites) copies the component's eye, target and up into its sead camera; every path to that
# copy runs this load of the component's link first. The hook performs the load and, while the free camera is on,
# writes the component's one-shot eye and target overrides (+0x180, +0x198). The function saves x30 in its prologue, so
# the bl's link write is harmless.
set freecam TOTK_FREECAM_PATCH 1
site freecam main 6286d4 f9400e68 94d2de1f # ldr x8, [x19, #0x18]
# The camera input update, after its stick dead zone, unit-radius clamp and StickExponent. The host callback
# performs the displaced store and adds raw mouse counts to s9/s10 (runtime/mouse_direct.c camera_input).
# Its address is page +0xfd0; the page is main+0x3adf000 on this verified build.
@@ -1249,3 +1241,13 @@ site shutter main 25e55d0 bc605900 bc605900 f9402ea9 927ef529 39400129 1e230123
# fmov s2, #1.0; fsub s1, s2, s1; movi d4, #0; fmaxnm s1, s1, s4; fminnm s1, s1, s2; fmul s1, s1, s1;
# mov w9, #0x1eb8; movk w9, #0x3d85, lsl #16; fmov s4, w9 (0.065); fmul s1, s1, s4; fmul s1, s1, s3;
# fmadd s0, s0, s1, s0
# Free camera (runtime/freecam.c freecam_hook, page +0xf50). The camera component update (main+0x628460, the routine of
# the first fov and aspect sites) copies the component's eye, target and up into its sead camera; every path to that
# copy runs this load of the component's link first. The hook performs the load and, while the free camera is on,
# writes the component's one-shot eye and target overrides (+0x180, +0x198). The function saves x30 in its prologue, so
# the bl's link write is harmless. Off by default (freecam_patch, the Free camera row of the Controls tab, read at start):
# with it off the site runs the game's load and nothing else. It sits at the end of the table, so the sets before it
# keep their numbers.
set freecam TOTK_FREECAM_PATCH 0
site freecam main 6286d4 f9400e68 94d2de1f # ldr x8, [x19, #0x18]
+3 -2
View File
@@ -99,7 +99,7 @@ static const struct { const char *key, *section; } sections[] = {
{"GYRO_BIAS_X", "input"}, {"GYRO_BIAS_Y", "input"}, {"GYRO_BIAS_Z", "input"}, {"GYRO_BIAS_PAD", "input"},
{"PAD_LAYOUT", "input"}, {"PROMPTS", "input"}, {"STICK_DEADZONE", "input"}, {"LSTICK_DEADZONE", "input"}, {"RSTICK_DEADZONE", "input"},
{"STICK_SENS", "input"},
{"MENU_CURSOR", "input"}, {"MAP_CLICK", "input"}, {"DIALOGUE_CLICK", "input"}, {"POINTER_IMAGE", "input"}, {"QUICKSAVE", "input"}, {"QUICKSAVE_KEY", "input"}, {"QUICKLOAD_KEY", "input"}, {"MOUSE_MODE", "input"}, {"MOUSE_SENS", "input"}, {"MOUSE_AIM_SCALE", "input"}, {"WALK_KEY", "input"}, {"WALK_SCALE", "input"}, {"FREECAM_PAD", "input"}, {"FREECAM_KEY", "input"}, {"INPUT_RECORD", "input"},
{"MENU_CURSOR", "input"}, {"MAP_CLICK", "input"}, {"DIALOGUE_CLICK", "input"}, {"POINTER_IMAGE", "input"}, {"QUICKSAVE", "input"}, {"QUICKSAVE_KEY", "input"}, {"QUICKLOAD_KEY", "input"}, {"MOUSE_MODE", "input"}, {"MOUSE_SENS", "input"}, {"MOUSE_AIM_SCALE", "input"}, {"WALK_KEY", "input"}, {"WALK_SCALE", "input"}, {"FREECAM_PATCH", "input"}, {"FREECAM_PAD", "input"}, {"FREECAM_KEY", "input"}, {"INPUT_RECORD", "input"},
{"BIND_A", "input"}, {"BIND_B", "input"}, {"BIND_X", "input"}, {"BIND_Y", "input"}, {"BIND_LCLICK", "input"},
{"BIND_RCLICK", "input"}, {"BIND_L", "input"}, {"BIND_R", "input"}, {"BIND_ZL", "input"}, {"BIND_ZR", "input"},
{"BIND_PLUS", "input"}, {"BIND_MINUS", "input"}, {"BIND_LEFT", "input"}, {"BIND_UP", "input"},
@@ -190,7 +190,8 @@ static const CfgMeta metas[] = {
{"QUICKSAVE", "0", "0|1", LIVE}, // quicksave.c: one key saves (an autosave), another loads it
{"QUICKSAVE_KEY", "f6", NULL, LIVE}, {"QUICKLOAD_KEY", "f7", NULL, LIVE}, // Half-Life's keys; a key name or none
{"WALK_KEY", "none", NULL, LIVE}, {"WALK_SCALE", "0.51", "0.2..0.9", LIVE},
{"FREECAM_PAD", "none", NULL, LIVE}, {"FREECAM_KEY", "none", NULL, LIVE},
// freecam.c: the patch set of its hook (off: the game's camera code as shipped), then the combo and key that step it
{"FREECAM_PATCH", "0", "0|1", RESTART}, {"FREECAM_PAD", "none", NULL, LIVE}, {"FREECAM_KEY", "none", NULL, LIVE},
// Gameplay Tweaks
{"GAMEPLAY_TWEAKS_ENABLED", "0", "0|1", LIVE},
{"GAMEPLAY_ULTRAHAND_ROTATE", "1", "0|1", LIVE}, {"GAMEPLAY_ULTRAHAND_C_AXIS", "1", "0|1", LIVE},
+11 -6
View File
@@ -944,12 +944,17 @@ static void row_quicksave_keys(void) {
key_taken("TOTK_QUICKLOAD_KEY", note[1], sizeof note[1]));
}
// The free camera combo and key (freecam.c): the trigger and shoulder pairs with a stick click, named as the open pad
// labels its buttons, or none. totk.ini takes any combo of button positions, shown as written. The key is any key or
// The free camera (freecam.c). Its switch is the patch set of the hook, read at start, so it is off by default and the
// row says "after restart". Then the combo: the trigger and shoulder pairs with a stick click, named as the open pad
// labels its buttons, or none; totk.ini takes any combo of button positions, shown as written. The key is any key or
// mouse button, taken by the bindings' capture window (binds_key_row) as quick save's are; Delete leaves it without
// one. A key the bindings also use says which action it presses. The combo is off on other game versions; the key
// row, which opt_disable_next does not grey, says so in its note.
// one. A key the bindings also use says which action it presses. On other game versions the switch and the combo are
// greyed, and while the hook does not run (the switch off, or on but not yet restarted) the combo is greyed; the key
// row, which opt_disable_next does not grey, says why in its note.
static void rows_freecam(void) {
UiTextId why = rt_game_version != 143 ? UI_MENU_FREECAM_PAD_V143 : UI_MENU_FREECAM_OFF_NOTE;
if (rt_game_version != 143) opt_disable_next(UI_MENU_FREECAM_PAD_V143);
opt_toggle("TOTK_FREECAM_PATCH", UI_MENU_FREECAM, UI_MENU_FREECAM_DESC);
static const char *const combos[] = {"zl+zr+lstick", "zl+zr+rstick", "l+r+lstick", "l+r+rstick", "none"};
static const int pads[][3] = {{PAD_ZL, PAD_ZR, PAD_LSTICK}, {PAD_ZL, PAD_ZR, PAD_RSTICK},
{PAD_L, PAD_R, PAD_LSTICK}, {PAD_L, PAD_R, PAD_RSTICK}};
@@ -962,12 +967,12 @@ static void rows_freecam(void) {
names[i] = shown[i];
}
names[N - 1] = menu_text(UI_MENU_OFF);
if (!freecam_available()) opt_disable_next(UI_MENU_FREECAM_PAD_V143);
if (!freecam_available()) opt_disable_next(why);
opt_choice_list("TOTK_FREECAM_PAD", UI_MENU_FREECAM_PAD, combos, names, N, UI_MENU_FREECAM_PAD_DESC);
static char note[64];
binds_key_row("TOTK_FREECAM_KEY", UI_MENU_FREECAM_KEY, UI_MENU_FREECAM_KEY_DESC,
freecam_available() ? key_taken("TOTK_FREECAM_KEY", note, sizeof note)
: menu_text(UI_MENU_FREECAM_PAD_V143));
: menu_text(why));
}
// The note under the prompts. The settings name a folder of prompts (input_prompts_folder: the prompts and the pad
+18
View File
@@ -358,6 +358,11 @@ static const char *const text_en[UI_TEXT_COUNT] = {
[UI_MENU_WALK_SCALE] = "Walk scale",
[UI_MENU_WALK_SCALE_DESC] = "The tilt the keyboard's sticks get while the walk key is held. Half is a walk, the "
"full tilt a run.",
[UI_MENU_FREECAM] = "Free camera",
[UI_MENU_FREECAM_DESC] = "Lets a combo or a key below detach the view from Link and fly it. Off by default: "
"with it off the game's camera code runs as shipped. Takes effect after a restart. "
"Game version 1.4.3.",
[UI_MENU_FREECAM_OFF_NOTE] = "Turn on Free camera above, then restart",
[UI_MENU_FREECAM_PAD] = "Free camera combo",
[UI_MENU_FREECAM_PAD_DESC] = "Gamepad buttons pressed together that step the view through three stages: it leaves "
"Link and flies, it stays where it was left while Link plays on, and it comes back. While it flies the game "
@@ -981,6 +986,11 @@ static const char *const text_ru[UI_TEXT_COUNT] = {
[UI_MENU_WALK_SCALE] = "Сила шага",
[UI_MENU_WALK_SCALE_DESC] = "Отклонение стиков клавиатуры при удержании клавиши шага. Половина — шаг, полное "
"отклонение — бег.",
[UI_MENU_FREECAM] = "Свободная камера",
[UI_MENU_FREECAM_DESC] = "Позволяет сочетанию или клавише ниже отделить камеру от Линка и летать ею. По "
"умолчанию выключена: тогда код камеры игры работает без изменений. Включается после "
"перезапуска. Версия игры 1.4.3.",
[UI_MENU_FREECAM_OFF_NOTE] = "Включите «Свободную камеру» выше и перезапустите игру",
[UI_MENU_FREECAM_PAD] = "Сочетание свободной камеры",
[UI_MENU_FREECAM_PAD_DESC] = "Кнопки геймпада, нажатые вместе, переключают камеру по трём режимам: она отделяется "
"от Линка и летает, остаётся на месте, пока Линком снова можно управлять, и возвращается. Пока камера летает, "
@@ -1795,6 +1805,11 @@ static const char *const text_pt_br[UI_TEXT_COUNT] = {
[UI_MENU_WALK_SCALE] = "Intensidade do andar",
[UI_MENU_WALK_SCALE_DESC] = "A inclinação dos analógicos do teclado enquanto a tecla de andar está segura. Metade "
"é andar, a inclinação total é correr.",
[UI_MENU_FREECAM] = "Câmera livre",
[UI_MENU_FREECAM_DESC] = "Permite que uma combinação ou uma tecla abaixo solte a câmera do Link e a faça voar."
" Desligada por padrão: assim o código de câmera do jogo roda como foi lançado. Vale "
"depois de reiniciar. Versão 1.4.3 do jogo.",
[UI_MENU_FREECAM_OFF_NOTE] = "Ligue a Câmera livre acima e reinicie",
[UI_MENU_FREECAM_PAD] = "Combinação da câmera livre",
[UI_MENU_FREECAM_PAD_DESC] = "Botões do controle pressionados juntos que passam a câmera por três etapas: ela se "
"solta do Link e voa, fica parada onde foi deixada enquanto o Link volta a ser controlado, e volta. Enquanto "
@@ -2556,6 +2571,9 @@ static const char *const text_zh_hans[UI_TEXT_COUNT] = {
[UI_MENU_WALK_KEY_TAKEN] = "同时为 %s",
[UI_MENU_WALK_SCALE] = "步行幅度",
[UI_MENU_WALK_SCALE_DESC] = "按住步行键时键盘摇杆的推动幅度。一半为走路,推满为奔跑。",
[UI_MENU_FREECAM] = "自由镜头",
[UI_MENU_FREECAM_DESC] = "允许用下方的组合键或按键让镜头脱离林克自由飞行。默认关闭:关闭时游戏的镜头代码保持原样运行。重启后生效。仅限游戏版本 1.4.3。",
[UI_MENU_FREECAM_OFF_NOTE] = "请先打开上方的“自由镜头”,然后重启",
[UI_MENU_FREECAM_PAD] = "自由镜头组合键",
[UI_MENU_FREECAM_PAD_DESC] = "同时按下的手柄按键,让镜头依次切换三个阶段:脱离林克自由飞行、停在原处而林克恢复操作、回到林克。飞行期间游戏不接收输入:左摇杆沿视线方向和左右移动,扳机键上升和下降,右摇杆转动视角,每按一次 L 或 R 速度减半或加倍。镜头固定时,林克朝左摇杆在屏幕上指向的方向移动。游戏版本 1.4.3。",
[UI_MENU_FREECAM_PAD_V143] = "仅限游戏版本 1.4.3",
+1
View File
@@ -154,6 +154,7 @@ typedef enum {
UI_QS_SAVED, UI_QS_LOADING, UI_QS_NOT_NOW, UI_QS_NONE, UI_QS_FAILED, UI_QS_LOAD_FAILED,
UI_MENU_MOUSE_SENS, UI_MENU_MOUSE_SENS_DESC,
UI_MENU_WALK_KEY, UI_MENU_WALK_KEY_DESC, UI_MENU_WALK_KEY_TAKEN, UI_MENU_WALK_SCALE, UI_MENU_WALK_SCALE_DESC,
UI_MENU_FREECAM, UI_MENU_FREECAM_DESC, UI_MENU_FREECAM_OFF_NOTE,
UI_MENU_FREECAM_PAD, UI_MENU_FREECAM_PAD_DESC, UI_MENU_FREECAM_PAD_V143,
UI_MENU_FREECAM_KEY, UI_MENU_FREECAM_KEY_DESC,
+5 -2
View File
@@ -486,8 +486,11 @@
# reads as a partial tilt only.
# walk_key = lshift
# walk_scale = 0.51
# Free camera (game 1.4.3): the gamepad combo that steps it through move, lock and off, buttons by position joined with
# +, the pad: names of the bind_ lines. While it moves the game gets no input and the view flies: the left stick along
# Free camera (game 1.4.3): 1 puts its hook in the game's camera update; 0, the default, runs the game's camera code
# as shipped and the combo and key below do nothing. Read at start.
# freecam_patch = 0
# The gamepad combo that steps it through move, lock and off, buttons by position joined with +, the pad: names of the
# bind_ lines. While it moves the game gets no input and the view flies: the left stick along
# the view and sideways, the triggers straight up and down, the right stick turns; each press of L halves the speed, of
# R doubles it. Locked, the view stays and Link walks where the left stick points on screen (docs/controls.md, "Free
# camera"). none turns the combo off. Default: none;