Commit Graph
1535 Commits
Author SHA1 Message Date
Ruan Shannon 7ddb883992 Merge remote-tracking branch 'fork/perf/heap-lazy-commit' into perf/heap-lazy-commit 2026-11-23 13:39:47 -08:00
Ruan ShannonandClaude Opus 5.5 ab356192d7 heap_lazy: the docs say 1 MiB chunks, and with the setting off ipc, svc and save writes are as before
Review of #1369: the settings row still said 64 KiB though LAZY_CHUNK is 1 MiB, and two changes ran for every player.
ipc.c and svc.c readable() ask the OS again unless TOTK_HEAP_LAZY is on (mem_heap_lazy), and fs_host.c write_file calls
mem_heap_commit, which commits the buffer's reserved heap chunks in lazy mode and does nothing otherwise, instead of
mem_thaw.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 13:38:10 -08:00
Ruan Shannon 54b2975d98 Merge remote-tracking branch 'origin/dev' into perf/heap-lazy-commit
# Conflicts:
#	runtime/cfg.c
2026-11-23 13:37:39 -08:00
Valiantsin DzerakhandClaude Opus 5.5 3c5ae12830 Merge pull request #1393: build_game.py quotes command arguments with shlex on non-Windows hosts and passes the linker map path through cmd_arg and -Xlinker on both platforms (ICUMADETHIS)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
v0.5.1-rc1
2026-11-23 19:18:38 +03:00
Valiantsin DzerakhandClaude Opus 5.5 da27398c5f Merge pull request #1405: ab_summary.py prints n/a for the replay change when side A averages 0.00 ms instead of dividing by zero (ICUMADETHIS)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 19:18:18 +03:00
Valiantsin DzerakhandClaude Opus 5.5 4cfb2e82c4 Merge pull request #1403: perf_summary.py reports FPS as total frames over total window time instead of the mean of per-window FPS (ICUMADETHIS)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 19:18:12 +03:00
Valiantsin DzerakhandClaude Opus 5.5 480ccec4b1 Merge pull request #1398: run_game.py rejects a profile copy that overlaps the original and a --tag with path separators, and stops a still-running child before deleting its profile (ICUMADETHIS)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 19:17:37 +03:00
Valiantsin DzerakhandClaude Opus 5.5 1fcb7b967f Merge pull request #1412: null_attach = 1 gives empty colour slots below a pass's last target a shared dummy attachment, for the Intel legacy driver crash in vkCmdBeginRendering; off by default (ShannoonRuaaa) (#1343)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 19:07:36 +03:00
Valiantsin DzerakhandClaude Opus 5.5 b5b9cc2be8 null_attach reads its switch once at device creation and gives a pass one dummy that covers it, freed with the device (#1343)
With the switch off, the draw path now pays one load of vk_caps.null_attach per gkey_fill and per empty slot in
target_wmask instead of a call into vk_exec.c, and vk_exec_pass_begin one flag test per pass. The switch is read in
vk_caps_init, before the pipeline prewarm makes the first key.

With it on, only empty slots below the pass's last target get a dummy, which is where the pipelines'
colorAttachmentCount ends (vk_pipeline.c target_count); a pass without colour targets keeps none, so a depth-only or
attachment-free pass never gets a 16384-wide image. All empty slots of a pass share one view, and an image serves
every pass it covers with its sample count: 1.4.3 at 1600x896 makes one image of 1.75 MiB instead of three. The
images are destroyed in destroy_all before the allocator goes, and the log line gives each one's size.

The settings row no longer states that empty slots caused #1343: the dumps do not show it. totk.ini.example gets
the player entry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 19:02:38 +03:00
Valiantsin Dzerakh 83e4037f9c Merge commit 'f278e91a' into task/pr1412
# Conflicts:
#	runtime/cfg.c
2026-11-23 19:02:11 +03:00
Valiantsin DzerakhandClaude Opus 5.5 1dad1ef60b Merge pull request #1385: restbl_cache = 1 serves the mods' merged resource size table from the last start when totk.exe, the RomFS image and every mod file are the same (about 0.9 s off a start with The Second Quest); off by default (itaskaev2)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 18:51:57 +03:00
Valiantsin DzerakhandClaude Opus 5.5 0deeb914cf mods_romfs_check tests the kept resource size table across starts
With restbl_cache = 1 on the restbl mods: built on the first start, served on the second with the same bytes, built
again after a rewritten mod file, an added or removed mod, another order and a new totk.exe, and after a torn or
random key file and a damaged or missing table. With the default 0 the key is neither read nor written.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 18:51:02 +03:00
Valiantsin DzerakhandClaude Opus 5.5 3b97936ed3 The kept resource size table is off by default, and its key covers the running totk.exe, the RomFS image and every overlay
restbl_cache now defaults to 0. Its key adds the path and identity of the running exe (a dev or source build that
changes the merge code keeps the VERSION string, so the port version alone served the old table), the RomFS image's
identity, the number of shipped tables and the overlays of the port's own folders, which the old filter left out.
The table's SHA-256 is taken from the bytes the build wrote instead of a read back from disk. A miss logs why the
table is built again. totk.ini.example and docs/settings.md describe the setting, its default and what the key does
not see (a rewrite that keeps size and write time).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 18:51:01 +03:00
Valiantsin DzerakhandClaude Opus 5.5 d810c7d271 Up version 0.5.1-rc1
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 18:47:24 +03:00
Valiantsin DzerakhandClaude Opus 5.5 96b5e96c80 Merge pull request #1384: the in-game menu in German, French, Spanish, Italian, Dutch, Japanese, Korean and Vietnamese, and the setup in Vietnamese (itaskaev2)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 18:40:16 +03:00
Valiantsin DzerakhandClaude Opus 5.5 8db7f2889f The new menu languages get the Low Latency Auto choice and the description of the Anti-Lag 2 merge
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 18:39:22 +03:00
Valiantsin Dzerakh 2149915fa6 Merge branch 'dev' into task/pr1384 2026-11-23 18:38:32 +03:00
Valiantsin DzerakhandClaude Opus 5.5 c465183dcc The new menu languages follow the FSR 4 and FSR sharpness catalog ids, and the Vietnamese setup text has the FSR download entries
The eight new menu tables still used UI_MENU_FSR3_SHARPNESS and lacked the four FSR 4 upscaler strings, which dev renamed or added, so the PR did not compile on dev. installer/text/vi.json lacked the six fsr step, phase, warning and checkbox ids. CONTRIBUTING.md lists all twelve menu languages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 18:38:32 +03:00
Valiantsin DzerakhandClaude Opus 5.5 05d46f3538 Merge pull request #1385 head: serve the mods' merged resource size table from the last start (itaskaev2)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 18:37:21 +03:00
Valiantsin DzerakhandClaude Opus 5.5 25832fd459 Merge pull request #1416: reflex = auto picks NVIDIA Reflex or AMD Anti-Lag 2 for the GPU; off stays the default, on and boost stay NVIDIA Reflex only (ripps818)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 18:35:55 +03:00
Valiantsin DzerakhandClaude Opus 5.5 e15aae0606 Anti-Lag 2 runs only with reflex = auto, so on and boost keep their old Reflex-only meaning
A player who had reflex = on on an AMD GPU got nothing from it before #1416 and would have got Anti-Lag after an
update without asking for it. on and boost now enable NVIDIA Reflex alone and log the same line as before when it is
missing; auto picks Reflex or Anti-Lag. The Anti-Lag entry point loads with atomics, since the game thread and the
present thread both make the first call, and the TOTK_TRACE=perf latency line keeps its old text unless Anti-Lag is
on. The menu description, docs/settings.md and totk.ini.example say which value turns on what.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 18:34:39 +03:00
Valiantsin Dzerakh 719cff3a4c Merge commit 'refs/pull/1384/head' of https://github.com/valentderah/totk-pc-recomp into task/pr1384 2026-11-23 18:25:26 +03:00
Valiantsin DzerakhandClaude Opus 5.5 1b303282a3 Merge pull request #1372: the shader-cache packer reads the loose files on up to 8 threads (half the logical CPUs, 1 below 512 MiB free memory, 32 MiB read ahead, serial reads on any failure), with a byte-identical pack (ShannoonRuaaa)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 18:24:38 +03:00
Valiantsin Dzerakh 8619d1bb3f Merge pull request #1416 head: AMD Anti-Lag 2 in the low latency setting (ripps818)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

# Conflicts:
#	runtime/vk_device.c
2026-11-23 18:24:19 +03:00
Valiantsin DzerakhandClaude Opus 5.5 fe8573916e Merge pull request #1368: FSR 3.1 and frame generation skip protected and AMD device-coherent memory types, which gave full-screen noise on RADV; the pick on Windows AMD is unchanged (gurrgur)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 14:43:36 +03:00
Valiantsin DzerakhandClaude Opus 5.5 96f9f868ba THIRD_PARTY_NOTICES.md counts the FidelityFX backend's memory type choice among our own changes to the SDK
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 14:43:07 +03:00
Valiantsin DzerakhandClaude Opus 5.5 f1ec56b592 Merge pull request #1245: AMD FSR 4 upscales the 3D scene on Windows through AMD's signed FSR SDK 2.4 libraries (scene_upscaler = fsr4, off by default), and the setup can download them (codexx-dev) (#1409)
FSR 4 is a fourth engine of the scene upscaler beside DLSS and FSR 3.1 and takes their frame point, jitter, per-object
motion vectors, mip bias, fsr_sharpness, FXAA skip and dynamic resolution hold. The PR's dlaa_backend setting, its
FSR 3 through the DLL and its separate Upscalers row are left out: dev builds FSR 3.1 from the SDK 1.1.4 sources.
Checked on an RX 9070: FSR 4.1.2 at quality, 1280x720 -> 1920x1080, picture clean; without the DLLs the upscaler stays
off with a log line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 14:39:08 +03:00
Valiantsin DzerakhandClaude Opus 5.5 e3befaebcc Merge pull request #1368: FSR 3.1 and frame generation skip protected and AMD device-coherent memory types (gurrgur)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 14:29:21 +03:00
Valiantsin DzerakhandClaude Opus 5.5 9978eb2948 Merge pull request #1371: GPUs without VK_EXT_external_memory_host run on shadow storage instead of being skipped; GPUs with it see no change (ShannoonRuaaa)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 14:27:33 +03:00
Valiantsin DzerakhandClaude Opus 5.5 c581b779fa Size the shader cache readers for the machine and fall back to serial reads on any failure
pack_shader_cache.py picked 8 readers on every machine. It now takes half the logical CPUs, 1 to 8, so a 1- or
2-CPU PC reads one file at a time, and reads serially with less than 512 MiB free RAM (tools/hostmem.py, as the
compile and lift workers use). --read-workers still overrides; the log names the choice.

The read-ahead is also capped at 32 MiB of file data by the listed sizes, beside the two files per reader; a file
larger than the cap is read alone.

Any failure of the parallel path (a thread that does not start, a MemoryError in a reader, an executor error) prints
a line and reads the remaining files serially, so the pack still completes with the same bytes.

Tests cover the worker choice, the byte cap and the three fallbacks, each giving the same pack as a serial run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 14:27:09 +03:00
Valiantsin DzerakhandClaude Opus 5.5 d9ecad571d The architecture notes and the vk_pool_init comment say that CPU-visible pools get shadow storage where VK_EXT_external_memory_host is missing, and RenderDoc no longer stops device creation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 14:27:06 +03:00
Valiantsin DzerakhandClaude Opus 5.5 9469ad0675 Merge pull request #1371: a GPU without VK_EXT_external_memory_host runs on shadow storage (ShannoonRuaaa)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 14:21:21 +03:00
Valiantsin Dzerakh a80cb1e35d Merge PR #1372 head into task/pr1372 2026-11-23 14:20:17 +03:00
Valiantsin DzerakhandClaude Opus 5.5 c6794dfe97 Merge pull request #1418: extract.py --skip-base-romfs leaves out the 17 GB base RomFS image that no build of 1.1.0, 1.2.1 or 1.4.3 reads (kaiyao7)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 14:19:33 +03:00
Valiantsin DzerakhandClaude Opus 5.5 802cb39fe0 Document extract.py --skip-base-romfs in the build guide
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 14:19:05 +03:00
Valiantsin Dzerakh 768dc30b36 Merge PR #1418: extract.py --skip-base-romfs leaves out the base RomFS nothing reads 2026-11-23 14:18:55 +03:00
Valiantsin DzerakhandClaude Opus 5.5 f9585d984b Merge pull request #1382: on Intel with Mesa ANV a by-region barrier before draws whose vertex shader reads a storage buffer stops the white and dark smoke and sky flashes; off by default, anv_vs_barrier = 1 turns it on (mattheuspaivadini) (#927)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 14:17:49 +03:00
Valiantsin DzerakhandClaude Opus 5.5 d98996b6e2 Turn the ANV vertex-shader storage barrier off by default on every GPU; players opt in with anv_vs_barrier = 1 (#927)
The barrier costs about 5% of the frame rate on an Iris Xe and was only tested there. TOTK_ANV_VS_BARRIER and anv_vs_barrier still force it on with 1 and off with 0. docs/settings.md says what it fixes, what it costs and that only Intel GPUs with Mesa ANV on Linux are affected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 14:17:26 +03:00
Valiantsin DzerakhandClaude Opus 5.5 3026d91e31 Merge PR #1382: ANV vertex-shader storage buffer barrier (#927)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 14:16:31 +03:00
Valiantsin DzerakhandClaude Opus 5.5 be98dbc336 Merge pull request #1245: AMD FSR 4 as a fourth scene upscaler, scene_upscaler = fsr4 (codexx-dev)
The PR's FSR 4 path (runtime/vk_ffx.c over AMD's FSR SDK 2.4 signed libraries, ffx_api_min.h, the cooperative
matrix and float8 device extensions in vk_device.c), its setup step that downloads amd_fidelityfx_loader_vk.dll and
amd_fidelityfx_upscaler_vk.dll, its notices and the FXAA copy shader hash 0x9d065204aac9766b now serve dev's own
scene upscaler as UPSCALER_FSR4. FSR 4 goes through vk_dlaa.c fsr_evaluate beside FSR 3.1: the same frame point,
jitter, motion vectors with the per-object pass, camera from vk_fg_camera, mip bias, fsr_sharpness, FXAA skip and
dynamic resolution hold.

Dropped from the PR: the dlaa_backend setting, FSR 3 through the DLL and the separate Upscalers row. vk_ffx.c pins
FSR 4 only; a device the libraries offer no FSR 4 for runs with the upscaler off and the menu says so. It keeps one
context per output size with dynamic resolution, like vk_fsr3.cpp, waits on the SDK's ring depth and is released
before the device goes. The menu's scene upscaler row gets "AMD FSR 4" (Windows; marked when the libraries or the
GPU are missing). The setup's FSR box and its strings are in all eleven installer catalogs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 14:13:20 +03:00
kaiyao7 7e54200454 extract.py: --skip-base-romfs leaves out the 17 GB base RomFS that nothing reads
The extraction writes build/extracted/v0/romfs/romfs.bin (17 GB) and no other
tool in the repository reads it: build_game.py, gen.py, prepare_shaders.py and
package_build.py all take the version's own directory, and merge_update_romfs
takes the base Program NCA from the base game file itself and verifies all six
IVFC levels of what it merges.

The base game's ExeFS still decides the file is TotK 1.0.0, so damage is still
found, only later, with a message that names the damaged file.

The flag is off by default: a run without it extracts and checks as before.
2026-11-23 16:23:55 +08:00
Valiantsin DzerakhandClaude Opus 5.5 5e5f34cd40 Merge task/plugfix: mod plugins with branch hooks, pointer swaps, SD card files and hooks switched during play build in, and may call what the game calls; Zonai Fieldworks starts (#1388)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 10:36:07 +03:00
Valiantsin DzerakhandClaude Opus 5.5 3fe8d7a1d9 Mod plugins that hook the middle of game functions, swap pointers in the game's data, use the SD card or switch their hooks during play build in, and may call what the game itself calls; Zonai Fieldworks starts (#1388)
Zonai Fieldworks was refused at several steps; each is now handled:
1. The start-up asked GetInfo 6, 7, 16 and 17 and SetHeapSize; runtime/plugin_init.c serves them.
2. Its start-up calls main where the lift has no function start. The tool names those addresses (--entries-out) and
   the installer lifts again with them as `entry` lines, up to four rounds (installer/steps.py PLUGIN_ENTRY_ROUNDS).
3. Branch hooks into the middle of game functions (far-jump veneers) and pointer swaps in main's data are accepted
   hook kinds; the veneer targets seed the plugin's lift, and an Orig trampoline counts as a seed.
4. Code the start-up writes into the plugin's own .text (hook pads it switches to during play) is found by comparing
   the image before and after the init, and seeds the lift (init_code). Without it the game stopped with "no function
   at guest pc" when a feature switched on.
5. recomp/gen.py: a branch-out alternative on a flag-writing site leaves with the flags from before the site; an inline
   hook may sit on a blr.
6. nn::fs::MountSdCard mounts <profile>/sdcard (runtime/fs_host.c), and nn::settings language codes are answered
   (runtime/ov_system.c).

The import check now also allows what the game's main imports (--exefs, game_imports): the game runs on those paths,
so the runtime serves them. Left out: nn::ro, the C runtime start, the thread-local allocator hook and the shader
compiler. Break in code the hooks reach is allowed (an abort ends the game with the reason, as on the Switch), and
RenameFile, DeleteDirectoryRecursively, Commit and Unmount join the SD card calls. Checked: Zonai Fieldworks, The Second
Quest, Challenge Mode and Material Columns on 1.4.3, Full Inventory Expansion, Quick Weapon Durability and Magic of the
Kingdom on 1.2.1 accepted; UltraCam's init still crashes its service run. Plain lift unchanged; probes 4/4 on both
versions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 10:35:59 +03:00
Valiantsin DzerakhandClaude Opus 5.5 942b6b7b2b Merge task/plugfix: mod plugins whose hooks use exlaunch's exl_inline_hook_with_fp_impl build; Magic of the Kingdom starts (#1388)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 08:41:34 +03:00
Valiantsin DzerakhandClaude Opus 5.5 c603112fca The plugin check accepts exlaunch's exl_inline_hook_with_fp_impl, the inline-hook entry that saves d0..d15 next to x0..x29. Magic of the Kingdom's hook stub calls it and was refused for it (#1388)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 08:40:59 +03:00
ripps818andClaude Sonnet 5.5 84e44f3aed Add AMD Anti-Lag 2 to the low latency setting, with an auto value that picks Reflex or Anti-Lag for the GPU
The reflex setting gains an auto value. With auto, on or boost the device uses NVIDIA Reflex when the driver has VK_NV_low_latency2, otherwise AMD Anti-Lag 2 when it has VK_AMD_anti_lag (Mesa RADV, AMD's Windows driver); with neither it does nothing. Anti-Lag marks the INPUT stage where the window texture is acquired and the PRESENT stage just before vkQueuePresentKHR, with the pacer's frame limit as maxFPS. The default stays off. The menu row is renamed Low Latency in all four languages.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-22 23:24:48 -06:00
Ruan Shannon f278e91a7c null_attach = 1 gives empty colour slots a dummy attachment instead of a null view (Intel legacy driver crash, #1343)
On an HD 520 with Intel's legacy Windows driver (101.2125, Vulkan 1.3.215) the game faults inside vkCmdBeginRendering
(igvk64.dll+0x5cfab2/+0x5cfab9, frames +0x5c42dd and +0x548235) right after the logo, with the recorder on or off and
with import or mirror memory. The driver reads an attachment entry of the pass that is null. vk_exec_pass_begin leaves
imageView VK_NULL_HANDLE in every colour slot without a target, which Vulkan allows, and the first pass of a boot that
has one is the 1600x896 scene G-buffer pass (slots 2 and 4 empty), the render area of the reported crash.

With TOTK_NULL_ATTACH=1 such a slot gets a view of a dummy R8_UNORM image of the pass's size, layer and sample count
(one per shape, made once, GENERAL, DONT_CARE load and store), and the pipelines name that format for it with the writes
masked off (vk_pipeline.c gkey_fill, target_wmask), so views and pipelines agree. Off by default: nothing changes, and
pipeline keys stay as they were. Untested on the affected driver; Iris Xe (101.7092) plays the same with it on.
2026-11-22 16:49:02 -08:00
mattheuspaivadiniandClaude Sonnet 5.5 5b15fc0df6 Keep fb_dirty across the ANV vertex-storage barrier, so feedback_prepare still learns the feedback targets (#927)
feedback_barrier clears fb_dirty, and feedback_prepare learns which targets go into the feedback layout from m & fb_dirty. A barrier recorded only for a vertex shader's storage read could hide a later attachment read from it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-22 21:05:13 -03:00
ShannoonRuaaa fe45b876e0 Merge current dev while preserving heap and lightning settings 2026-11-22 15:23:19 -08:00
ICUMADETHIS 1b573e00bf Handle zero replay baselines in A/B reports 2026-11-22 20:58:26 +00:00