Commit Graph

421 Commits

Author SHA1 Message Date
chrg6
871b06e2e7 Read a pipeline cache larger than 2 GB on Windows, and log every refused file with its size.
cache_load measured pipeline-cache.bin with ftell into a long, which is 32 bits on Windows: a file past 2 GB measured as -1, so the run started with an empty cache and the log said nothing, not even that the file was over pipeline_cache_max_mb. The read now lives in runtime/vk_cache_file.h: the length comes from the 64-bit tell, the read runs in 64 MB pieces, and a refusal returns its reason and the file's size, which cache_load logs. The Windows atomic write no longer cuts a block of 4 GB or more to a 32-bit count.

tests/pipeline_cache_file_check.py reads a sparse file just over 2 GB through the header. With --probe-prewarm and such a file carrying this GPU's header, the log reads "holds 2048 MB, over NX2NAVI_PIPELINE_CACHE_MAX_MB 512" under the default limit and "2048.0 MB read" with the limit off; the exe before this change logged nothing for the same file.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-11 04:29:31 -05:00
chrg6
84b0672ec2 Stop retiring textures no shader sampled for a while, by default: the ground they left flat did not come back.
With the retiring on, a player's session lost the ground of Hyrule Field and Lon Lon Ranch (6,663 retired, 928 back), and with the two holes of the way back closed it lost it again on arriving in a village (1,441 retired, 82 back; neither fix acted once). With the retiring off the same play kept its ground. What keeps the stand-in in place is not found; a draw that samples it once into a picture the game keeps would, and no mark undoes that. tex_disuse_evict = 1 turns the retiring back on; the shaders keep their marks, so no pipeline changes either way. Released textures and idle ones the game no longer names still give way when memory runs short, so a PC that is short of memory has less to give back than before.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-11 03:25:08 -05:00
chrg6
4fbaecb364 Keep a texture whose address another descriptor shares out of the disuse eviction, and let a sampled stand-in always drop its hold.
Under low commit the game retired 6,663 textures in one session and 928 came back: the ground of Hyrule Field and of Lon Lon Ranch stayed flat and see-through. A slot of a second descriptor that followed a retired texture gets an image of its own once the texture is gone, an empty one when the descriptor is not a CPU-written one, and that image then takes the marks of every slot at the address: the held key was never dropped, and the slots that named the texture showed the stand-in for good. A texture with another descriptor registered at its address now stays, and a mark on a slot whose own key is held drops the hold whatever else at the address took the mark. The perf trace counts both.

Built and the settings probe passes; not yet run in the game. With the eviction off (tex_disuse = 0) the user's ground stayed textured, which is what tied the fault to it; that this change removes it with the eviction on is still to be shown.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-11 03:18:21 -05:00
chrg6
861357b2a4 Make the direct mouse camera work on game 1.1.1.
mouse_mode = direct is the default, but on 1.1.1 it did nothing: only the 1.4.3 patch table had the sites, so the mouse always went through the stick emulation, which gives no turn at slow mouse speeds and tops out at about 107 degrees a second. The 1.1.1 table now has the set mouse_direct (on by default): at main+0x37c45c, where the camera's input update holds the processed stick in s1 and s0, a host call performs the displaced store and adds the raw mouse counts to both, so the mouse meets no dead zone and no curve; at main+0x37c4f0 a second call clears the idle bit for an update the mouse moved in. The counts are divided by the frames the game steps per update and by the stick camera speed, so the same hand movement turns the same angle at every frame rate. The Controls tab gets the mouse mode and mouse sensitivity rows, and mouse_mode = stick or NX2NAVI_MOUSE_DIRECT_PATCH=0 gives the old behaviour.

Checked here: the generator lifts the 1.1.1 game with the two sites (it compares each site's original word), the lifted game compiles and links with the runtime, and tests/mouse_direct_check.py passes its 1.1.1 harness (register contract, displaced store and load, equal turn at every frame rate and stick speed, the reset pause, capture and mode). Not checked here: the game was not run, so aiming with the mouse was not tried, and the differential tests against Unicorn were not run because no Python on this PC has Unicorn. The contributor measured 0.0800 degrees per count on both axes in the game.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
(cherry picked from commit bb8fecfbe43517006eafd7be9c22e8dbe9601de7)
2026-11-11 02:36:54 -05:00
chrg6
1e01f90db5 Destroy at shutdown every finalized pool record that waits for a submission that never came.
pool_fini (vk_pool_fini) queues the record of a pool that is in the device address table and was not used, and of an unused
physical pool, for destruction at the next submission. When none follows, nothing destroyed it. Under shadow storage
that record holds an allocator buffer, and the allocator's check for allocations left over stopped the process in
vk_shutdown: --probe-vkmem with NX2NAVI_SHADOW=1 and NX2NAVI_MEMORY=import ended there before its last line. Such
records now wait on the retiring list, as mirrored pools already did, and vk_mem_shutdown destroys what is left on it.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-11 00:49:47 -05:00
chrg6
acc1ae25bf Merge co-op, off by default: rooms through a relay, progress sync between the players' own saves, and a Co-op tab.
Without the other players drawn in the world, which are unfinished. No relay address is built in, and with co-op off nothing opens a socket. Built on Windows and tested against a relay on this PC only; two games in one room and any real network have not been tried.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-11 00:40:20 -05:00
chrg6
1b89c0227b Let --probe-movie test this title's AV1 movies, which it rejected before testing anything.
The probe checked for VP9 first and stopped on anything else, and every movie of this game is AV1, so the decoder the game actually uses had no test short of a game run. For an AV1 movie the probe now drives the host's movie::VideoDecoder as the game does: it feeds the samples, takes the pictures at 30 and at 60 updates a second, and checks that every picture is delivered once, in time-stamp order, with the end of the stream after the last one, and how far behind real time the pictures are. It starts no window and no device. A run that never reaches the end of the stream fails after a bounded number of updates instead of hanging.

On the game's files here: before, "FAILED: WebM: codec V_AV1"; now 240 of 240 pictures at 30 updates a second and 180 of 180 at 60, none late, the last 1 ms behind real time at 60, "probe-movie: passed". It does not look at the pictures' content.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
(cherry picked from commit 2543b07117c638e4e3bf7df01e16f6801f9cbcfb)
2026-11-11 00:39:58 -05:00
chrg6
8e19b653f5 Show the walk key's rows on the Controls tab again.
The walk key (walk_key, walk_scale) works and the settings example says the Controls tab sets both, but the tab had no row for either: the row's function was left without a caller, and a player asked for a walk key because he could not find one. Walk key and Walk scale are back under the analog stick rows, with the texts that were already there, and the guide names the setting. The second half of the contributor's change, a toggle mode, is not taken: it is a new feature that nobody has pressed a key against on Windows.

Built; the rows were not looked at in the menu, since no game could be started.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
(cherry picked from commit 02fab940a1bb79d8867f5e764ee597ea8eb662e8)
2026-11-11 00:39:50 -05:00
chrg6
411dd5fc01 Answer the game's csrng requests with random bytes from the host.
The game imports the SDK's cryptographic random call, which the SDK serves through the csrng service, and the service manager ended the game on any service it does not know ("sm: service csrng is not implemented"). csrng now exists: GenerateRandomBytes, its one command, fills the request's buffer from the host's generator, and any other command stops with its name. No start or session logged on our own PCs opens the service, so nothing changes there; a contributor's traced start did.

The IPC probe opens csrng and asks twice: both 32-byte buffers come back filled, each differently, and no session is left over.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
(cherry picked from commit 7591a7b65627f74d53d8276c403524b71d11acbe)
2026-11-11 00:39:50 -05:00
chrg6
420aef041a Correct what a review of this intake's commits found.
A second reading of the commits taken in from pull requests found these, each traced in the code:

- heap_lazy: the camera speed's search read the whole heap, which with the setting on committed every page and undid what it saves; a scan now steps over the pages the lazy heap never committed (mem_untouched_run). tests/frame_step_check.py and tests/save_share_check.py no longer linked (frame_rate.c and fs_host.c call the new memory functions; the second also missed mem_probing before); both pass again. The settings text says that with the setting on a PC out of commit ends the game in play, not at start, and the census comment is back over its own function.
- Pipeline libraries on AMD's older Windows driver: the condition is the driver for RDNA 2 and older (RX 400 to RX 6000), not RX 5000 and RX 6000 only, and the texts named a price the code does not have. With libraries off a new pipeline is built by a worker while its draw is left out, and the start waits for every recorded pipeline instead of 20 s at most. The texts say so, and that the finding is one player's on one card. The menu strings nothing shows are as they were.
- Page file hint: it comes only when Windows sizes every page file, and it names the initial size and the automatic management that must be unticked first.
- Frame generation note: it keeps "needs an RTX 40 or newer" for the players it is right for and points the others to the log; the bridge's line says it is Streamline's general support check.
- Comments and settings texts that still described the old behaviour: the process commit bound, the wait with shadow storage, the scratch's least size, the action prompt under auto.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
(cherry picked from commit 19f03aa01b26d6e17fb5fc70ad987aa8c68e8225)
2026-11-11 00:39:50 -05:00
chrg6
fc1a50f0db Merge the audit: its map and ledger, the perf-trace markers and size lines, and the fixes of its Phase 4.
Verified by runs in the audit: the Market's periodic stall (a pool slot was listed once per refresh pass instead of once; the list fell from 160,385 entries to at most 3,192 and no frame over 20 ms remained while standing), orderly exits delete the pipeline prebuild's running marker (left behind, the next start wrote a skip file and every later start skipped the prebuild), the log and crash report name an area a save asks for that the game does not have, and the menu atlas hash no longer overflows a signed multiply. The other fixes compile and pass the regression route but their faults were never reproduced: see AUDIT.md section 13 for each.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-11 00:39:08 -05:00
chrg6
ba9d6bac06 Keep co-op's private settings out of the log and out of bug reports.
This line logs every setting nx2navi.ini sets, and a bug report takes a copy of nx2navi.ini along: with co-op both would have carried a room's secret, the relay's address and the player's name to whoever reads the report, and the secret lets anyone into the room. One list (runtime/cfg_private.h: the room's secret, the offer number, the relay, the name, the key a maker removes, the menu's test hook) now serves the log's line, "Copy system info" and the report's copy of the file, in the game and in the launcher: such a key reads "(set, not shown)", every other byte of the file stays.

Also: the last leftovers of the restorations that were left out with the puppets (their settings prefix and section), main.c's byte order mark as it was, and two comments that cited files this tree does not have.

Checked: with a room, a relay and a name in nx2navi.ini the log's line shows all three as set and none of their values; the same text gives the same bytes through the game's scrub and the launcher's (a launcher test, and the C function built alone); the launcher tests, the co-op probe, the relay tests and the tab check pass.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-11 00:20:22 -05:00
chrg6
7e07e13bac Add co-op, off by default: rooms through a relay, progress sync between the players' own saves, and a Co-op tab.
Each player keeps their own game and save. One player makes a room, the others join it with its secret, and story flags and, by the room's rules, items, songs, quest items, small keys (a shared pool), rupees and ammunition reach every save. The layer is a host thread with one UDP socket to a relay the players run themselves (tools/coop_relay.py, Python's standard library only); the messages between the players are sealed with a key from the room's secret (XChaCha20-Poly1305, Monocypher 4.0.2 vendored with its licence and a row in THIRD_PARTY_NOTICES.md), every change is signed by the player who made it, a player accepts a room by its members' keys and the key of its rules, the save is copied to coop-backup before anything is applied, and values are set through the game's own routines between frames. The Co-op tab makes, joins, accepts, removes and leaves, and the menu takes typed text for the name, the relay and the secret. This is the contributor's pull request #518 on this line.

Nothing reaches the network while co-op is off: the socket is opened, and the relay's name looked up, only after co-op is on, a relay is set and a room is made or joined. There is no default relay.

Left out of the pull request: the other players drawn in the world (the "puppets") with the copied engine they need. They were unfinished, added two patch sites to the game's per-frame update that could not be put through the differential tests here, and their file helpers clashed with the ones this line already has. So no position is sent: the POS message's codec stays, nothing sends it.

Changed against the pull request:
- The menu's test hook drives the Co-op tab only when it comes from the environment. From nx2navi.ini it could turn co-op on, join a room and accept its offer.
- The log's label for a room is hashed from the secret instead of being its first three characters.
- A game that has not saved yet has no save to copy, and takes nothing from the room until it has saved once; that used to count as a copy made.
- A PING's token no longer carries the PC's uptime.
- On Windows the maker's key file and its folder get an access list with the player's account alone.
- The tests that link the platform layer get the socket library, and the save test a stand-in for the title screen's hook.

Checked on Windows, where the pull request had never been compiled: the runtime builds and links; --probe-coop passes (sockets on 127.0.0.1, the codec against its byte vectors, a fuzz of every parser, two sessions through a hostile mock relay, a relay restart, the sync engine); tests/coop_relay_test.py passes its 61 tests, with the probe through the real relay on 127.0.0.1 at 0 and 30 % loss; tests/coop_page_check.py passes and its deliberate fault fails 48 checks. Not checked: two games in one room (one game runs at a time here), any real network, the tab in the game.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-11 00:11:41 -05:00
chrg6
47f6aef2f6 Turn the piece release of the lazy write-back off by default: with it on the graphics device was lost after some save loads.
Loading a save in Hyrule Field at night lost the device about 2 s after the load in 7 of about 22 loads on an RTX 5090 (a GPU read fault at the start of a large buffer, in or right after one of the game's compute dispatches). With the lazy write-back off it loaded 10 times of 10, and with only the piece release off 15 times of 15. How the piece release leads to the fault is not known; until it is, a CPU touch releases its whole range again, as before the town performance pass. wb_lazy_chunk = 1 turns it back on.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 23:56:29 -05:00
chrg6
fb8483cb4c Find the game's exposure in every tonemap shape the splice takes.
The first run of the new tone mapper showed shaders whose exposure the splice did not find, which then took a gain of 1: a current cache holds 54 shaders the splice takes, in more shapes than the three it was written against. The gain is now the factor the three channels have in common: a uniform, or a value the vertex shader passes; under a computed local exposure, the uniform of the inner product; and in a multiply-add, with a colour added per channel after the exposure. The tonemap function gets the exposed values without local exposure and the gain, and divides by the gain itself. All 54 shaders of that cache splice with their exposure found and validate; the picture on an HDR display has not been judged.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 23:42:26 -05:00
chrg6
097b5e75b4 Merge the pull request intake: fewer than six cores, a comma in the game folder's path, the pipeline cache's size check, video memory and commit handling, and smaller fixes.
The two sides both made the wait after a frame's first submission cover the write-backs under shadow storage; the rule is kept in one place, vk_sync_wb_split.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 23:35:05 -05:00
chrg6
8ce64407f0 Hold the save file system's lock while a directory listing is read or counted, so a CloseDirectory on another guest thread cannot free it underneath.
File handles keep their window: a read still uses its host file after the lock is dropped.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 23:28:26 -05:00
chrg6
493c877d59 Read NX2NAVI_ACQUIRE_WAIT as the number its comment describes, so the value 2 selects the wait for the newest present of any image.
It was read as an on/off switch, which took 2 for 1.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 23:28:15 -05:00
chrg6
a96328e967 Prune the list of the GPU's uniform writes with uniform snapshots switched off too: there it was appended on every write and never shortened.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 23:27:51 -05:00
chrg6
7966181115 Load the menu's zstd dictionaries once behind a once-guard, so a second thread asking during the load waits instead of finding none.
The loader set the count to 0 before it read the file; the menu-art thread and the present path both ask in the first frames, and the one that lost took 0 for "no dictionaries" and kept the fallback fonts for the whole run.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 23:27:51 -05:00
chrg6
3e67a74cfc Ask again for a VRAM mirror whose device-local allocation failed, as for one refused for the budget, and log refusals four times per reason.
A pool refused for a failed allocation was never asked again and was read over the bus until the game finalized it. The shared quota of twelve log lines could be used up by budget refusals before the first allocation failure.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 23:27:15 -05:00
chrg6
ccc31ad562 Forget a texture's content hash when what reached its image is not its storage: zeros for storage released mid-upload, or nothing after a failed GPU ASTC decode.
With the hash kept, the same bytes written there again were skipped as unchanged and the image stayed wrong. A texture whose decode failed is still not uploaded again until its storage is written; that part stays open.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 23:26:45 -05:00
chrg6
4ffaf6ea96 Hash a texture's storage only while it is held mapped, at the upload and at the unchanged-bytes check.
Both hashes read guest memory the game may unmap on its own thread; the unchanged-bytes check had no readability test at all.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 23:26:33 -05:00
chrg6
7ccb958c47 Let a save Commit that is under way finish before the crash report or a fatal error ends the process, for at most two seconds.
The game's Commit returns once the commit is queued, so the game may already have reported the save as done while its thread still copied; ending then left an unfinished copy that the next start rolled back.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 23:26:01 -05:00
chrg6
5ddff078c3 Count the save Commits under way instead of flagging one, so a second Commit entered beside the first keeps save writes out of its copy.
With a flag the first commit thread's end cleared it while the second still waited for the transaction lock; a write to the save then passed the wait and landed in the working copy the second thread was copying.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 23:25:39 -05:00
chrg6
5b1413d817 Count what the shadow copy-ins overwrite and cost, and keep stores through the device address table behind a switch.
NX2NAVI_SHADOW_CHECK=1 logs with the shadow line, every 60 frames: the whole copy-ins that overwrote a store a
shader made through the device address table, and the pools they fell on; the write-backs that moved bytes into
a page the CPU had written since its copy-in; the bytes both sides changed since their base copy; what the
copy-ins cost by kind, and which pools and flag sets took them. The stores are found by content: a whole
copy-in leaves a hash of the page, and the next one compares the shadow page with it first.

NX2NAVI_SHADOW_TABLE_STORES=1 keeps such stores: a page found stored into gets a base copy, so copy-ins take
only the CPU's bytes, and the fence of every submission that uses the table writes the stores back to guest
memory. --probe-vkmem checks it with a GPU write that nothing notes. It is off by default. The overwrite it
removes was the suspected cause of the flicker on Linux and is not: standing outdoors (RTX 5090 with
NX2NAVI_SHADOW=1) it happens exactly four times a frame, on ten pages in pools of 20 and 44 KiB, with the copy
that precedes the frame's stores, and no frame came out wrong with it or without it in 1,800 frames each; the
hashes cost 1.8 ms a frame of the replay (67 against 75 fps); and a count the CPU resets before the write-back
has landed would keep counting, where the whole copy-in resets it every time.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 23:24:50 -05:00
chrg6
175c1947de Pass over the pools with nothing written when a part that uses the device address table syncs the shadows.
Under shadow storage the prologue of every part whose shaders use the table brings the shadow of every pool up
to date. It ran the full per-pool sync for each of them, 10,700 times a frame outdoors (3,772 pools, about
three such parts), though the write-watch snapshots of all pools are taken at once just before. A pool whose
regions hold no stamp newer than its shadow is now passed over with a compare per region: 1,500 pool syncs a
frame are left, and the copy-ins went from 1.32 to 1.01 ms a frame of the replay (RTX 5090 with
NX2NAVI_SHADOW=1, one standing run each way).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 23:24:50 -05:00
chrg6
2f6ff17651 Give each part of the import check in --probe-vkmem its own write-watch epoch.
Under shadow storage the copy-in reads each region's write-watch snapshot once per submission. The check ran
its two parts in one epoch, so the second part's copy-in did not see the CPU writes made after the first, and
the probe failed with NX2NAVI_SHADOW=1 ("GPU read of CPU-written heap differs"). Each part now starts a new
epoch, as a submission does.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 23:24:50 -05:00
chrg6
7b009ffc64 Let the wait after a frame's first submission cover the write-backs under shadow storage.
With shadow storage (the Linux default) what the GPU wrote reaches guest memory in the fence's completion
callback, later than an import's store on the GPU. The wait after a frame's first submission returned at the
executed timeline, before that, so the game rewrote what those passes had written and the write-back then put
the GPU's older bytes back over the rewrite. The whole 3D scene came out brighter for single frames, each of
them a frame whose main work was held at its CPU event wait and replayed late.

Standing outdoors with NX2NAVI_SHADOW=1 on an RTX 5090: 695, 624, 443, 323 and 2 flashed frames of 1,800 in
five runs with the split, none in eight runs without it. The frame rate did not drop (74.6 fps median with the
fix; runs of the build before it gave 71 to 72). NX2NAVI_WB_SPLIT=2 keeps the split with shadow storage, to
measure the fault. That this is the flicker a player reported on Linux (RX 7800 XT, RADV) is not confirmed on
their machine; NX2NAVI_WB_SPLIT=0 gives 0.7.1 the same wait there.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 23:24:50 -05:00
chrg6
d15b4c95aa Count a frame's submissions atomically: several guest threads submit at once from the pause menu's first frame on.
With a lost count the frame's first submission could go without its wait for the GPU, which is there against frames drawn with the next frame's data.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 23:24:49 -05:00
chrg6
61e1ca8bad Drop a zstd stream's slot by its stream state under one hold of the lock, not by a pointer found earlier.
Between the lookup and the drop another thread could take the spent slot for its own stream; the drop then cleared that thread's slot, and a third thread could take it as free and reset the decoder context still in use.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 23:24:34 -05:00
chrg6
9be72ae9c0 When the system-event table is full, reuse the slot of an event the guest has destroyed instead of ending the process.
Entries were never removed, and every reload of a save binds two events at new addresses.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 23:24:12 -05:00
chrg6
4a69a38b48 When the jmp_buf table is full, give the new buffer the slot of the one filled longest ago instead of ending the process.
The table never removes entries and a session keeps meeting new buffer addresses: 12 to 15 more with every reload of a save. A longjmp to a replaced buffer ends the process as one to an unknown buffer always did.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 23:24:12 -05:00
chrg6
abd2e2c392 Compute the menu grain's lattice hash in unsigned arithmetic: the signed products overflowed, which is undefined.
The bits are the same; the undefined-behaviour sanitizer stopped the start at this line.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 23:23:24 -05:00
chrg6
fb44809074 Name an area the game asks for and this game version lacks, in the log and in the crash report.
A save that names such an area (a child save with HyruleCastle_Child on 1.1.1) makes the game read through a null area object right after the missing files; the report now says which area it was and that the save cannot be loaded.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 23:23:12 -05:00
chrg6
e887a1d18b Delete the boot prebuild's running marker at every orderly exit, so closing the game during boot is not taken for a driver crash.
The marker was deleted only when the boot's builds ended. A window closed before that left it, the next start read it as a start that died in the driver's compiler, and every later start on that GPU and driver skipped the prebuild and built each pipeline at its first draw.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 23:22:27 -05:00
chrg6
b933e3d996 List a texture pool slot without an entry once, so the walk over those slots no longer stalls every 8th frame in the Market.
A slot that resolved kept its place in the list until the next walk, and when it stopped resolving before that walk it was listed again. The list reached 160,000 entries for the 32,768 slots after a minute in the adult Market, and each walk over it held the texture lock for 15 to 30 ms.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 23:21:39 -05:00
chrg6
f29e34e7a0 Make the observer-response scene mapper the default HDR tone mapper, anchored to the game's mid grey and tone slope.
The HDR tonemap gains a mapper built on a finite cone response in LMS: scene grey 0.18 lands where the game's curve puts it and rises through it with the slope of the game's curve, and the hue bend of the game's clamp is given back to bright colours. It takes the scene before the game's exposure gain and the gain itself, which the splice now finds in the game's shader. The luminance mapper stays selectable and the game's own curve stays the third choice. The mapper fits the Rec. 709 gamut here, as the game's scene target holds no negative component. New settings: the tone mapper's mid grey, tone slope match, tone slope and hue clip emulation. The gamma correction on the present applies with the luminance mapper only.

Not part of this: eye adaptation, the anti-aliasing and reconstruction shaders, bloom and local exposure sliders, the output colour space choice and a 16-bit float scene target. Checked by build and numerically against the source of the port; the picture on an HDR display has not been judged. THIRD_PARTY_NOTICES.md names the source.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 23:20:31 -05:00
chrg6
7411d31803 Give a thread on a folded virtual core the number of its own core, so that fewer than six cores no longer crash the game.
With fewer than six virtual cores a thread pinned to a core at or above the count runs on core (c mod count), and GetCurrentProcessorNumber told it that virtual core's number. The game keys per-core data by the number without locks, so with four cores a thread pinned to core 5 used core 1's data in turn with core 1's own threads, and the game died within seconds of the first frame in play. The Steam Deck profile sets four cores, so this was every start under that profile (issue #445). The call now answers with one of the thread's own cores that fold onto the virtual core it holds, its ideal core first; with all six cores the answer is as before.

The kernel probe gets a test with two threads pinned to each of the six cores: with 6, 4, 3 and 1 virtual cores no thread sees another core's number and no two see the same at once.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 23:16:17 -05:00
chrg6
b1d08b06a8 Lay out the action prompt's face buttons as the pad layout has them.
The action prompt at the top right of the HUD draws the four face buttons as a diamond in the console's places: A right, B bottom, X top, Y left. Under pad_layout = xbox, playstation or auto the A action is the bottom button, yet the diamond kept A on the right, so the prompt pointed at the wrong button. At start the runtime now edits the prompt's layout in the shared interface archive for such a layout (the buttons, the dots and the lit crosses move, and the bubbles of X and Y flip) and serves the result from the profile folder; with nintendo, the default, nothing is changed. Every field is found and checked before anything is written, so a layout a mod changed is left as it is, and the archive is packed again with the game's own dictionary at the same unpacked size. One SARC reader and dictionary lookup now serve this, the camera pack and the menu's assets. When the layout changes, the menu's Restart counts the diamond.

tests/action_prompt_check.py passes without game files and on the game's own archive (4 copies, 208 fields, 13 ms at start).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 23:16:17 -05:00
chrg6
4eea3d1c2f Wait for the write-backs before returning to the game where pools are shadow copies.
With shadow storage (the default on Linux and under Wine) what the GPU wrote reaches the game's memory in the completion thread's fence callback, after the executed timeline that the split wait returns at. The game could then rewrite a pool, and an older write-back overwrote what it wrote: in Kokiri Forest a sky coefficient the game had reset came back, and the world flickered and looked washed out. The wait now covers the write-backs whenever shadow storage is in use; with imported or mirrored pools, the Windows default, nothing changes. The contributor's RX 9070 XT under RADV no longer showed the flicker.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 23:14:00 -05:00
chrg6
9dc5fa8b36 Check the size of pipeline-cache.bin before reading it.
A file over pipeline_cache_max_mb starts the run empty, but it was read into memory whole before its size was compared, which is the memory the limit is there to spare on a 16 GB machine. The size is now compared first and a file that is dropped is never read. The limit itself stays at 512 MB: sizing it from the machine's memory, as the contributor proposed, was not run by them or here.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 23:14:00 -05:00
chrg6
10cfbd9ea1 Stop telling an RTX 50 player that frame generation needs an RTX 40 card, and log why it is unavailable.
When Streamline loaded but DLSS Frame Generation was not available, the menu's row read "in use: off, needs an RTX 40 GPU or newer", also on an RTX 5080: the same check fails when the plugin did not load or a function it needs is missing. The row now points to the dlssg lines of the log, where the bridge says whether the plugin loaded and which of its functions it found, and then asks Streamline for its support result on the selected Vulkan device and logs it by name. The query is an optional export, so a bridge DLL of an earlier build keeps working.

The runtime and the bridge (tools/build_dlssg.py, MSVC, Streamline's headers) both build here. The failing case itself was not reproduced: on this RTX 5090 frame generation is available.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 23:14:00 -05:00
chrg6
dda12051f5 Add heap_lazy (off by default): on Windows the game's heap is committed where it is first used.
Windows charges every committed page to the commit limit whether it is used or not, and the game sizes its whole heap up front: in Castle Town after Hyrule Field the heap held 6.8 GiB of commit of which 3.4 GiB had ever been used. With heap_lazy = 1 a change of the heap's size only moves its end, an access to a reserved heap page commits the reserved runs of the 64 KiB around it in the access-fault hook and runs again, and the paths that do not fault commit their range first: mem_thaw (file reads, the host-pointer import), mem_kernel_access (file writes, the frame-rate fix's read) and mem_host_readable (the host's pointer checks). A page another path committed is left as it is, so a frozen, probed or armed page keeps its protection. With trace = perf a line per window gives the faults, the bytes committed and the time they took.

The contributor's runs on a 16 GB PC: 4.67 instead of 6.77 GiB of heap committed and 29.3 instead of 32.9 GiB of process commit in Castle Town, no "system commit low", 12,858 faults in 440 ms over four minutes, the longest 41 ms. With the setting off nothing is hooked and the heap is committed as before.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 23:14:00 -05:00
chrg6
73abd6577f Try a smaller allocation before giving up on a texture upload when the video memory is used up.
On an integrated Radeon 890M the ASTC scratch buffer failed to allocate and then a staging buffer ended the run. The scratch asks for 32 MiB whatever the upload needs, and the staging pool grows only in 64 MiB blocks of one memory type. When the device reports it is out of memory, the scratch is now tried again at the size the upload needs, and a staging buffer that does not fit the pool is tried again outside it with the same mapping, where a smaller block or another host-visible type may still have room. The menu's own upload flushes what it wrote, since such a buffer may lie in memory that is not coherent.

Built and run through the memory probe (96 GPU checks pass); the out-of-memory paths themselves were not reached here.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 23:14:00 -05:00
chrg6
7145c3f208 Say in the log when the system's commit runs low under a page file that Windows sizes itself.
With the page file left to Windows the commit limit stays near the installed memory plus what the file held at the start, and on a 16 GB PC with a 16 GB card it ran low in Hyrule Field at 32 GB, where a fixed page file of 32 GB or more gave 49 GB and no low commit. The first "system commit low" line of a run is now followed, once, by a line that names the cause and the Windows setting, and the build kit's guide gives the same advice for 16 GB PCs. plat_page_file_managed reads the PagingFiles value once; on this PC (page file sized by Windows) it returns 1.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 23:14:00 -05:00
chrg6
3ea3f5baa8 Leave the video memory in use out of this process's commit bound on Windows with a discrete card.
Windows charges a card's memory to the process's commit, and the bound on that commit defaults to the installed memory, at least 24576 MB. On a 16 GB PC with a 16 GB card (RTX 5060 Ti) the process stood at 29 to 31 GB in Hyrule Field, 9 to 10 GB of it video memory, so the bound held for the whole area while the system had commit to spare: textures gave way and the ground flickered white. The bound now compares the commit less the device-local memory in use, which is on the card and not in RAM or the page file and is bounded by the video memory rules already; the contributor's runs then never reached the bound and dropped no texture. The log line gives both figures.

A PC whose process commit is large mostly through video memory is no longer caught by this bound; the system's own figure still is. Not reproduced here: this PC has more memory than the bound.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 23:14:00 -05:00
chrg6
8bc23ea06e Clear a new depth image where the game makes it, not ahead of the part being recorded, and drop the depth copy switch.
A new depth or stencil image was cleared in the upload batch, which runs before the whole part being recorded. Bound into pool memory, the image shares its bytes with the live texture at its address, so the clear could wipe depth that earlier draws of the same part still read: the sun's shadowing went fully dark for one frame a few times a minute where the game resizes its shadow maps. The clear now goes in at the replay's position, as it already did for reused images (depth_init_inline, default 1; 0 is the old order). The switch that copied the live image's depth into the new one is removed: every such image was cleared by the game before anything read it, and the copies cost smoothness.

From a contributor's diff and measurements at a town gate: 0 dark frames in 5,423 with the change, 12 in 2,728 without. Checked here on the combined build in Hyrule Field before the Market's gate: every new depth image is started at the replay's position, none in the upload batch, and none had to end an open pass. The dark frames themselves were not counted here.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 23:10:34 -05:00
chrg6
093cf949df Open the recording device only when the game starts microphone capture.
The game opens two input streams while it starts and leaves both stopped through ordinary play, and each open took the system's default recording device and held it, paused, until the game ended: Windows shows the microphone as in use for the whole session, and a Bluetooth headset can drop to its call profile. An open now checks that a default input exists and prepares the stream and its bounded buffer; the device is opened at StartInputStream and released at stop or close, after which the game can still read or purge what was buffered. A start that is refused returns an input error and can be tried again.

tests/audio_input_check.py did not compile on this line (it had no stand-in for the microphone setting); with the change it builds and passes: idle streams hold no device, a refused start can be retried, a stop releases the device and keeps the unread frames, two streams are independent. Not checked with a real microphone in the game.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 22:59:02 -05:00
chrg6
6750e0bee1 Turn graphics pipeline libraries off by default on AMD's Windows driver for RX 5000 and RX 6000 cards.
That driver faults inside vkCreateGraphicsPipelines when it links the stage libraries of a burst of new pipelines. The game asks for one when an enemy dies and its effects are drawn for the first time, so the game ended with code 71 at every kill on an RX 6700 XT and an RX 5700 XT (issue #418), and the player who reported it found that gpl = 0 stops it. Unset, the setting is now off with that driver (vk_caps.amd_sc) and on everywhere else; gpl = 1 turns it on there, gpl = 0 off anywhere, and the caps line of the log says why it is off.

The price on those cards is that a new pipeline is built whole on the draw's path. Not run here: there is no AMD card. On an RTX 5090 the device probe reads "gpl yes" as before and "off by NX2NAVI_GPL=0" with the setting.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 22:57:58 -05:00