plat_font_path stats five absolute paths for NotoSansCJK-Regular.ttc and takes the first that exists. That covers
SteamOS and the usual distributions, but misses any system where the font lives elsewhere, and fails outright in a
sandbox: under Flatpak /usr is the runtime and ships no CJK font, the app may only write /app, and the host's fonts
appear at /run/host/fonts. All five paths miss, fonts_up merges 0 fonts, and every Chinese character in the settings
menu renders as '?' while English stays correct.
Asking fontconfig fixes all of these at once. It is the same database Tk/Xft and every other Linux toolkit reads; it
knows /app/share/fonts, the XDG data dirs, /run/host/fonts and the per-user directories, so installing the font where
the system looks is enough and no packaging can leave the menu stranded.
libfontconfig is dlopen'd, not linked: a host without it (headless, a bare container) still builds and runs and takes
the fallback, so this adds no build dependency, and the runtime already links -ldl for the NVIDIA libraries. The
result is checked against the character before it is used, because fontconfig returns the closest pattern even when
nothing covers a character -- without that a Latin-only system hands back DejaVu Sans and the menu believes it merged
glyphs when it did not. The pattern names zh-cn and zh-tw rather than zh-hans and zh-hant, which is how Noto CJK and
fontconfig tag the faces.
menu_font_fontconfig defaults to 1 and 0 goes back to the five fixed paths, for a player whose fontconfig resolves to
a font the menu's parser cannot read. TOTK_MENU_FONT names a file directly and wins over both. A system with the font
where the old paths expect it sees no change, and Windows, whose font names are fixed, is untouched.
Verified against the real fontconfig with the host having no CJK font, with fontconfig pointed at a directory holding
only NotoSansCJK-Regular.ttc (the Flatpak case, now resolved), with TOTK_MENU_FONT set and pointing at a missing file,
with menu_font_fontconfig=0, and with libfontconfig made unloadable (falls back quietly, no crash).
On 1.2.1 the light target is scaled to the output by an upscaler of the game's own (twelve texelFetch taps,
fragment shader e6f7ae35b8479ef3), not by the FXAA draw vk_dlaa_skip_draw knows. It addresses its source in the
scene's pixels, so DLSS's output-sized picture swapped in for the light target (tex_info) showed only its top-left
part, two thirds at DLSS quality, stretched over the screen: the "floating camera" of #1106. #660 (169d057) made the
swap reach that draw: before it, DLSS ran on another target and its picture never reached the screen on 1.2.1.
DLSS already writes its picture into the scaling pass's target, so on 1.2.1 a draw in a pass larger than the light
target, without depth, that samples the light target is now skipped (vk_exec_draw_samples). The HUD drawn later into
the same target samples other textures and stays. 1.4.3 keeps the swap, where a tonemap can be the scaling draw.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
In the camera (the ability wheel's camera) each notch of the wheel is a 100 ms press of the D-pad's up (in, for a
turn away from the player) or down, the zoom its button guide shows. The camera is found by its open screens: the
Purah Pad's frame and CameraPointer_00 without AppMap_00, which the Scope has (menu_cursor_camera). The Scope has no
zoom of its own, so the wheel stays unbound there.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
After the scroll wheel, the keys or the pad move the focus in a menu, the pointer takes it back only once it has
moved 6 layout units from where it was then (menu_cursor_poll), so a hand resting on the mouse no longer undoes a
scroll. While the cursor is not captured, the game window shows a gold arrowhead drawn at the window's DPI
(cursor_art.c) instead of the Windows arrow.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
By default the left button is Y, which opens the dialogue log in a dialogue box. While MessageDialog_00 is open the
left button now presses B, which advances the text and shows the rest of a scrolling line, and the right one A.
Dialogue choices keep the menu pointer, where a left click picks the choice under it, so clicking through a
conversation does not pick the choice the focus starts on. The setting is live and independent of menu_cursor.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The wheel did nothing outside the map. Now each notch is one step of the stick a gamepad player would move: in a menu
with the game's focus box (the inventory, shops, Options, the save list) the focus moves up or down, and while a D-pad
strip (weapons, shields, bows, materials) is held open the choice moves left or right. The strip has no focus box
while it is held, so it is found by its open screen, ShortCut_00, as the map is. The wheel now also counts while the
cursor is released over the window, where the menus have the pointer. Input scripts take WHEEL lines and a recording
writes them, and a script's one-shot MOUSE or WHEEL line goes in at the first poll at or after its tick instead of
being lost when a poll skips that tick.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
vk_reflex_present_frame took g_pl on every present although only flip_locked's VkPresentIdKHR (Reflex) and
latency_note (TOTK_TRACE=perf) read g_blit_pid. nvn_api_obj.c and ov_input.c declared vk_reflex_marker,
vk_reflex_frame_begin, vk_reflex_frame and vk_reflex_sleep locally; they now come from gfx.h, the graphics layer's
interface, which gfx_present.c also sees through vk.h, so a changed signature fails to compile. vk.h stays out of
those two files: it brings in Vulkan, VMA and vk_rec.h's vkCmd* macros.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
evaluate's preset_dirty loop stopped at slot 3 of the five D.sizes entries, so a preset change left the features in
slots 3 and 4 created with the old model: they kept running until the slot was evicted. The loop now covers the whole
array through DLSS_SIZES instead of a literal.
Taken from pull request #1057 (t04dJ14n9) alone; the PR's dlss_prewarm commits are not in this change.
(cherry picked from commit a76bdf5e08)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A mod file whose name carries Product.<n> and which the RomFS lacks was counted as made for another game version and
never served. The game does ask for such names: on 1.4.3 with mods on, the file trace (trace = fs) shows it opening
Sound/Resource/Pack_MasterSword.Product.110.bars.zs, while its RomFS holds only the Product.140 and the unversioned
file. A sound mod that ships its pack under all those names was silent here and works on a console, where LayeredFS
shows the game every file of a mod. Such files are now added overlays like any other new file. Another version's
resource size table is still not served and still lends its entries; the files are still counted, and the Mods tab
and docs/mods.md now say they are read only when asked for by name.
tests/mods_romfs_check.py gets a case for it. Not run here: the test and --probe-fs need a build and the game's files.
runtime/romfs.c compiles with llvm-mingw.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TgQM2zwuVagwScByEJhT8V
The game grows grass blades only inside its near grass map, a 62.5 m square around the camera drawn into 256x256 and
128x128 textures, so on open meadows the grass appears a short way in front of the player. grass_range (percent, 50
to 400, default 100) scales the map's extent, step and both textures together through a new grass patch set (1.2.1
and 1.4.3) that loads them from patch page +128..+144, and grows the HeapDef grass heap and the application pool for
the larger textures. At 100 the set stays off and nothing changes. A row in the Display menu, text in all four menu
languages, and totk.ini.example describe it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The latency markers and the present carried different present IDs: g_reflex_present_id went up only in flip_locked, so
frame k's simulation, input and submits had ID k and its present k+1 (and with frame_queue or replay_async frames could
share one). Each frame now gets its ID once, when the game acquires its window texture (SIMULATION_START,
vk_reflex_frame_begin), and carries it: INPUT_SAMPLE and SIMULATION_END take the game's current frame, a submission
the frame of the thread that submits it (the game thread's, or the one the replay thread got with its ReplayItem, or
the present thread's from its PresentJob), and the present the frame of its blit (PresentJob.pid -> g_flip_pid). A
present without a frame ID takes the next value, as present IDs must grow on a swapchain.
From the review: a new swapchain sets the sleep mode again (it starts with low latency off), Reflex is off without the
presentId feature, REFLEX sorted in known[], and the ru and pt-BR descriptions name the Boost option as the menu does.
TOTK_TRACE=perf logs every 600 presents the frame start to present time, and with Reflex on how many of the driver's
reports (vkGetLatencyTimingsNV) came back with every marker and their simulation start to GPU render end.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The swapchain must be externally synchronised, and the acquire and the present use it under g_pl on the present
thread while the game thread calls vk_reflex_sleep. With reflex = boost and TOTK_VK_VALIDATION=1 the validation layer
reported 20 threading errors in 30 s (vkLatencySleepNV against vkAcquireNextImageKHR and vkQueuePresentKHR). The
earlier head of #638 (318acd8) took the lock here; the rebase onto dev lost it. The semaphore wait stays outside.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
vk_sync_submit chains a VkLatencySubmissionPresentIdNV when the device has VK_NV_low_latency2, and on dev the
recorder thread (on by default except on AMD) makes that submission. rec_submit stopped the process on any pNext,
so every NVIDIA GPU with the extension would have failed at its first recorded submission. The recorder now copies
the present ID into its packet and chains it again in submit_run.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Enable VK_NV_low_latency2 and VK_KHR_present_id with present ID features
- Add VkSwapchainLatencyCreateInfoNV to swapchain creation
- Link present and submission IDs with standard Vulkan latency types
- Insert latency markers: simulation start/end, input sample, render submit, and present
- Gate all extensions and latency chains on reflex != off (RESTART setting)
- Log graceful notice when Reflex is requested on unsupported hardware
- Add UI menu setting and translations for en, ru, pt-BR, zh-Hans
- Document reflex setting in totk.ini.example and docs/settings.md
The climb velocity step (1.4.3 main+0x1f49754, 1.2.1 main+0x1918220) multiplies the requested velocity by Nintendo's
factor for a movement loss that grows with the frame rate. 1.4.3 fits it at 30 and 60 fps and caps it at 2 from about
77 fps (63% climb speed at 120, 34% at 240); 1.2.1 has no 60 fps branch (78% at 60). Below a 1/60 s step the set climb
continues the factor with a curve fitted to a replayed ladder climb, taking the patch page's frame ratio without the
time scale, so 30 and 60 fps keep the shipping factor bit for bit, slow motion included. Only the player's climb
modules reach this code. Its own setting, climb_fix under [frame rate], with a menu toggle; off without the real-time
step. Ladder replay, 1.4.3: 1.665 / 1.663 / 1.669 / 1.681 m/s at 30 / 60 / 120 / 240 (shipping 120 1.046, 240 0.563).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The heap bound in scene_for counts the output's own growth against the 2 GiB limit, so a 7680x4320 output at
render_scale game went from the 4096x2304 scene dev renders to 2712x1526, with no setting changed. The bound now
shrinks no scene below 4096 a side, the size dev gave; scenes the 4096 cap kept smaller still grow up to the bound.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With dynamic_res at 0 by default the fixres set held the scene at 100 % for every player, the reason #573 was turned
down. The default is now 1, so the set stays off unless a player turns dynamic resolution off in the menu or
totk.ini, and the Steam Deck profile no longer needs its own entry.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The setup wrote romfs-patches-xbox and romfs-patches-xbox-label for 16:9 only, so prompts = xbox on a 21:9, 32:9,
16:10 or 3:2 screen (the Steam Deck's 1280x800 among them) kept the game resolution at 1920x1080 (cfg.c) or, with
output_res set to the screen's shape, fell back to the Switch prompts. #979 fixed this for prompts = pc; this extends
the same mechanism to both Xbox folders, the shared-files option of #378 by way of #979's --reuse.
- The setup builds romfs-patches-xbox-<w>x<h> and romfs-patches-xbox-label-<w>x<h> for each of ASPECT_SIZES, from
their 16:9 folder with --reuse, as it does for romfs-patches-pc-<w>x<h>.
- romfs.c overlay_init: at a game resolution of another shape any prompts' folder loads from <folder>-<w>x<h> in place
of romfs-patches-<w>x<h>, not only the PC one; without it the Switch prompts stay, and the log names the missing
folder and the command that makes it. romfs_shaped_pc_ready becomes romfs_shaped_prompts_ready(folder, w, h).
- cfg.c: the display-shaped output_res default applies with prompts = xbox when the folder of the pad layout
(romfs-patches-xbox with the Nintendo layout, romfs-patches-xbox-label with any other) is there for that size.
- The menu's note for a missing shaped folder reads "off at this game resolution (no layout made for it)" in every
menu language, since 16:9 is no longer the only shape with prompts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
vk_mvobj_execute's draws (mo_emit) push set 0 and then bind set 1. Under the validation layer (SDK 1.4.363) a push for
a new INDEPENDENT_SETS layout keeps the push set the layer made for an earlier layout (the replay's last draw) and drops
the writes to bindings that layout lacks: every run with DLSS and validation reported the last-frame banks as missing
(VUID-vkCmdDrawIndexed-None-08114, variable vp_c20) and then faulted inside VkLayer_khronos_validation.dll. The
replay's own draws avoid this by binding set 1 first (set1_first in bind_descriptors); the motion draws now do the
same, only while the layer is active.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
vk_contact_exec ended the pass and recorded a memory barrier only. Once a G-buffer draw samples the linear depth or the
scene colour in its own pass, those images stay in ATTACHMENT_FEEDBACK_LOOP_OPTIMAL_EXT across passes
(vk_exec_draw.c, feedback loops), and the march then bound them in GENERAL as a sampled and a storage image. The Vulkan
validation layer reported it on every frame with contact shadows on (vkCmdDispatch imageLayout-00344, followed by
barrier, BeginRendering and QueueSubmit layout errors: 40 per run at Lookout Landing, 0 with contact_shadows = 0).
vk_exec_barrier ends the pass and moves those images back to GENERAL in the same full barrier, as every other
barrier does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tools/make_mvobj_fs.py assembled OpSelect of a vec4 with a scalar bool condition, which only SPIR-V 1.4 and later
allow. The module is 1.0, so spirv-val in the Vulkan validation layer rejected it (Expected vector sizes of Result Type
and the condition to be equal: Select). The condition is now splatted into a bvec4 first; runtime/vk_mvobj_fs.h is
regenerated and passes spirv-val.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On 1.2.1 the game asks a compound physics shape for its first child's material at main+0xe056d0 and reads the result
without a check. At the reported crash the shape had none of its 125 children left, although every child is filled
when the shape is built. The crash handler now prints that shape's live bits and each record's shape pointer and name,
which tells removed children from switched-off ones and names the object. It runs only after the crash.
--probe-kernel builds a fake shape in a crashing child and checks the listing.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
UHD Graphics (i3-1215U, i3-1305U) and Iris Xe drew coloured noise on foliage with dynamic alpha to coverage and black
patches over the scenery with dynamic vertex input; players confirmed that vk_dyn_a2c = 0 and vk_dyn_vertex = 0 clear
both. vk_caps.intel_igpu_win marks Intel's proprietary Windows driver on an integrated GPU, and both defaults follow it.
An explicit ini value still wins. Arc discrete GPUs and Mesa's ANV keep both on: no report there, and the ANV report
(#989) had both off with its glitch still present.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The VM refused C0 (register conditional), so cheats like C046B400 FFFFFFFF were greyed out as unsupported. C0 now
runs with dmnt's operand types 0-5, widths and conditions; C1 and C2 save, restore and clear registers, C3 moves
registers to and from the static registers. tools/cheats.py gives the same opcode lengths and accepts the same opcodes.
skip() took the end of a nested block at depth 1 for the else of the failed outer block; it now counts depth the way
dmnt does, and 2x000000 is an else only for x = 1.
tests/cheats_vm_check.py runs tools/cheats.py and runtime/cheats.c on cheats of its own, the two from the issue
included.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The table of the frames each target was last rendered into was direct-mapped with 1024 entries. In a 1.4.3 field run about 16 entries rendered the frame before were taken by another subresource each frame, the scene's colour target among them, so every draw there whose pipeline was still building waited for it as one-shot, 50 to 400 ms, instead of skipping a frame. Sets of 8 ways that evict the way rendered longest ago lost none in the same run.
1.4.3 scales the scene size it reads from the patch page by canvas width over the console mode's base width, which is
1280 in handheld, not 1920. A handheld 1280x720 output at render_scale 100 put 1920x1080 on the page, so the game
rendered a 1920x1080 scene while the DynamicTextureAllocator heap was sized for 1280x720, and heavy scenes ran it out
(crash at main+0x1c2590). scene_scale now uses the mode's base for res_init and res_dlss_mode. In handheld the game
composes a 1280x720 canvas unless the output patch is on, so the output patch is switched on with the scene patch there
and the canvas is the output the factor and the heap assume. Docked is unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Since the textures moved to a pool of their own, the default device-local
blocks hold mirrors and other buffers. With VMA's 256 MiB blocks one block
held 53 MiB of them after 10 minutes in the field, and the headroom thread
kept half a block of each device-local type ahead. TOTK_VMA_BLOCK_MIB
(default 64, 0 = VMA's 256) sets the size; the headroom spare follows it.
On the RX 9070, 10 minutes in the field: VMA blocks 3582 -> 3252 MiB,
process commit 8614 -> 8327 MB, slow frames 13 (2.8 s) -> 9 (1.1 s).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Conflicts: the image retry goes through vk_texture_image, sweep_pressure keeps the released-texture cap on the new
drop helpers, and vk_headroom_release also frees the texture pool's anchor.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Textures shared the default 256 MiB blocks with the mirrors and other buffers, and a block went back to the driver
only once everything in it was gone. On the RX 9070 after a few minutes of roaming the field, 3 of 9 device-local
blocks were 13-27% full, held by a hundred small textures and buffers each, and blocks held 0.8-1.4 GB more than their
allocations; where device memory takes process commit, that commit backs nothing.
Own-memory textures now go to a VMA pool with 64 MiB blocks (TOTK_TEX_BLOCK_MIB, 0 = the default pools). Images of a
quarter block or more, images the driver wants a dedicated allocation for, and images the pool's memory type does not
take get memory of their own; the requirements are read before the image is made, since VMA checks neither for a
custom pool. The headroom thread keeps the pool's next block ahead like the default pools'.
Same 10-minute route: 807 MiB of blocks beyond their allocations instead of 1037, most pool blocks 75-100% full, slow
frames not up. Probes pass on v143.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>