input.c freecam_gate also switches the free camera on a press of TOTK_FREECAM_KEY (f6 by default, none for no key).
While it is on, ZL, ZR, L and R come from the merged Switch buttons, so the keys bound to them (Z, X, Q and R by
default) go down, up and change the speed like the gamepad's; the keys' sticks already flew and turned it. The mouse's
counts are taken in the poll and turn it at the game camera's rate (0.08 degrees a count times mouse_sens, through
freecam_mouse), and input_direct_mouse_sample gives the game's mouse camera none meanwhile; in the stick emulation mode
the mouse arrives in the right stick as before. The Controls tab gets a Free camera key row (off, F2 to F7, F9), with
text in all four menu languages; docs/controls.md lists the keyboard column.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A row under the walk rows offers the trigger pair or the shoulder pair with either stick click, or off, named as the
open pad labels its buttons (binds_page.cpp binds_pad_label, the Controls tab's labels). TOTK_FREECAM_PAD gets a live
row in the cfg table with its default zl+zr+lstick; totk.ini still takes any combo of button positions, shown as
written. On other game versions than 1.4.3 the row is off and says so. Text in all four menu languages.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
pad_read stores what pad_physical saw (pad_seen, by PAD_* position, with the Home / Guide button after the Switch
buttons as PAD_GUIDE) and the two trigger axes (trigger_seen), under the input lock, for gamepad combos that are no
Switch buttons and for analog trigger readers. input_pad_combo parses a setting of button positions joined with +
(the bind_ lines' pad: names plus guide or home) into a mask, logging a name that is no button. input_map.c exports
input_key_id and input_pad_id, and ui/binds_page.cpp binds_pad_label gives the label the open pad has on a button,
so menu rows can name buttons as the Controls tab does. No behaviour changes on its own.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The default output_res keeps the display's shape only while that shape has the
prompts' folder (cfg.c shape_keeps_prompts). After a switch to PlayStation
prompts on a 21:9 display the default was 1920x1080, so the start and the menu
asked only for the 16:9 folder and the game stayed 16:9. cfg_screen_size gives
the display's size while the player set no output_res.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When the game resolution, the HUD width, the button prompts or the pad layout need a folder the install lacks (an
older setup, a failed setup step, a new display), totk.exe starts the setup's generator for it in the background
with the tools build-cache/rebuild.txt names, once per folder and process: at start for the settings in effect
(the resolution output_res asks for, also when the missing layout made this start 16:9), and from the settings
menu once a changed choice has stayed for 1.5 seconds or the menu closes. A missing 16:9 prompts folder is made too,
the PC prompts from totk.ini's bindings. The notes under Game resolution and Button prompts say the files are being
made and are used at the next start; when the tools did not start they say so and Try again starts them again.
The Prepare button is gone. Source builds without rebuild.txt and TOTK_ROMFS_PATCHES keep the old behaviour.
romfs_shape_missing and romfs_shape_prepare become romfs_folders_missing (a mask of the missing folders) and
romfs_folders_prepare; --probe-cfg and tests/romfs_shapes_check.py check the new decisions.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tools/make_romfs_patches.py writes into <out>.part-<pid> and renames it to <out> once every file and the manifest
are there. With --background (for runs the game starts) it runs at below-normal priority, does nothing when <out>
already has a manifest, and drops its own result when another run finished <out> first, so two runs for one folder
do not mix their files and a folder a running game loaded is never written into. Without the flag <out> is replaced
whole, as the setup and source builds expect. A .part folder left by a stopped run goes once it is an hour old: the
next run for that folder or the setup's clean-up removes it. build_game.py copy_romfs_patches skips .part folders.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
prepare_draw sets ex->volume_bias where the draw's dynamic state changes, so record_fixed reads a flag instead of
checking the pipeline state on every draw. A census of the matching draws in the field, the town and rain found two more
states with the same blend and depth signature, both tested GREATER: the volume's back faces into the same channel and
another shader's front faces into red. GREATER's equal case fails, and the bias toward passing turned the game's tie
the other way for them; they are now left as the game sets them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
prompts = playstation shows the face buttons as circle, cross, triangle and square, L1 R1 L2 R2, Options and Share.
The setup writes romfs-patches-playstation (pad_layout = nintendo) and romfs-patches-playstation-xbox (xbox, auto) on
every install, next to the Xbox folders, and the Shapes step and the settings menu make their shaped folders like the
other styles. playstation-xbox lays the action prompt's diamond out as xbox-label does, cross at the bottom.
Rebased onto dev from pull request #741 by fabiomode2: the shaped folders, hud_width, the Xbox diamond and the
keyboard prompts' text glyphs of dev are kept, and cfg.c's shape default uses input_prompts_folder.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1. scan_pads took a controller Steam hid when the virtual pad was not up yet and kept it for the session, so Steam's
remapping was lost. While the open pad is a hidden one, pad_physical looks again every RESCAN_MS and scan_pads
moves the buttons to the virtual pad; the hidden controller stays open as motion_extra, so motion goes on with
the same bias and orientation.
2. pad_identity marked " (under Steam)" only on motion_extra; a hidden controller that became the pad lost the mark
and could take the bias calibrated with Steam closed. The mark now follows steam_hidden_id.
3. After pull request #1024: sensors_ready logs SDL_GetError when the pad has both sensors but enabling them failed,
instead of "has no gyro and accelerometer".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A game Steam starts gets SDL_GAMECONTROLLER_IGNORE_DEVICES with the controllers Steam reads itself and sees Steam's
virtual gamepad, which has no motion sensors. input.c steam_reveal keeps that list and clears the hint before
SDL_Init (only with motion on); scan_pads still takes the virtual pad for buttons and sticks, so Steam's remapping
holds, and motion_source opens the hidden controller for its gyro and accelerometer only. A bias belongs to the pad
as Steam presents it: " (Steam Input)" or " (under Steam)" in gyro_bias_pad. docs/controls.md, "Steam Input and
motion", says the Steam layout must bind the gyro to something or Steam zeroes it on the Steam Controller.
The patch as posted against 6151ac4, with sensors_ready merged with #1274's restart. Tested by the author on Linux
(Steam Controller) and the Steam Deck; not on Windows.
Co-authored-by: St5sz2Jk <St5sz2Jk@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The calibration removes the bias measured once; a bias that moves as the controller warms up, or a controller never
calibrated, still turns the aim slowly. motion_fusion.c drift_track learns it from 256 ms windows in which the gyro
stays within 0.04 rad/s and the acceleration within 0.03 G peak to peak, after half a second of rest, with a time
constant of 0.25 s until the estimate settles and 30 s after. The estimate sits on top of the calibrated bias and is
cleared with a new controller, a new or loaded calibration and a change of gyro_calibration. New setting
gyro_auto_bias (live, default 1).
Taken from #380: the rest window by peak to peak, the two time constants, the per-axis limit. Left out: the
0.006 rad/s dead zone, which ate slow aiming; the one global state shared by every fusion instance; the reset at
every StartSixAxisSensor; the 0.5 G acceleration gate, which let a controller in motion count as still. The first
estimate is limited to 0.1 rad/s from zero instead of 0.15; a larger bias is the calibration's job.
Also: a sample without a reading at a restart (#1274) no longer returns before the calibration's log and save.
--probe-services checks the drift with the switch off and on, after a calibration whose bias then moved, a slow
aim in the hand, and the levelling of #1274 with a bias on every axis.
Co-authored-by: airquark <97342227+airquark@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>