Commit Graph

139 Commits

Author SHA1 Message Date
Claude
5b37fb5986 Pin the launcher's default settings in a test: updates checked at start, hidden while playing, build cache kept, Stable.
These were already the defaults of a new install and of Default Settings; the test keeps a later change from turning one of them off unnoticed, and checks that a player's own choices still stay.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BSHQpLnScF9sNv4LNAaaS3
2026-11-09 07:28:57 +00:00
tangerineturtle1
08d216877c Update README.md 2026-11-09 00:57:34 -05:00
chrg6
a324608877 List NVIDIA DLSS frame generation in the menu on NVIDIA GPUs.
It was offered only while already set, because Streamline presented no generated frames yet. With Reflex now pacing it from the frame's start it generates frames, and the user played with it: it works well.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:51:48 -05:00
chrg6
0fab109a7f Add diagnostics used to find these fixes, all off by default.
NX2NAVI_TRACE=audio logs voices starting, stopping and sharing a wave buffer; NX2NAVI_DUMP_MOVIE dumps movie frames; NX2NAVI_LOG_CS_BINDS says why the stand-in for an untranslated compute program skipped a dispatch; and NX2NAVI_TRACE=perf adds heap and commit census lines on their own thread, with VMA maps when write-combined memory grows by 2 GiB. From a tester's fixes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:51:48 -05:00
chrg6
ac5c196f3a Pace DLSS Frame Generation with Reflex from the frame's start, so it no longer halves the game's frame rate.
Reflex's markers sat at the host present with frame numbers unlike the frame's tags, slReflexSleep was never called, and the low-latency mode was set before any swapchain existed, so it never applied. GfxBackend.frame_start, called from nvnWindowAcquireTexture, now sets the simulation and submit-start markers after Reflex's sleep (skipped once nothing was presented for 200 ms); submit end is set when the frame's submissions went out; the mode is set again after each swapchain (NX2NAVI_REFLEX: 1 on, 0 off, 2 boost); frames are numbered by the game's presents; and the fps counter counts what was shown. NX2SL_VERSION is 3, so nx2navi_dlssg.dll must be rebuilt. From a tester's fixes: 42-45 fps game, 84-90 on screen (was 24).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:51:48 -05:00
chrg6
8c4c2f809c Count the GPU time of copies into VRAM mirrors, so GPU-bound frames are no longer reported as CPU-bound.
A mirror prologue is closed after the part it was made for but runs first on the GPU; its timestamps were read in the wrong order, so its copies counted as idle time with work queued. ts_submitted now queues the reads in GPU order, and the perf line shows the copies on their own. From a tester's fixes: in Kokiri Forest at 4K on PCIe 3.0, 7.1 of 20.4 ms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:51:48 -05:00
chrg6
3731155efc Run DLAA with native HDR too.
With hdr = native the game's output pass writes a 10-bit PQ target (A2B10G10R10), not the 8-bit sRGB one vk_dlaa_pass looked for, so DLAA never ran and frame generation had no depth or motion vectors for most frames. The native HDR picture's format is now named once (vk_hdr_native_picture) and taken by both DLAA and the HDR present. From a tester's fixes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:51:48 -05:00
chrg6
95ab18fba2 Hold the game at 60 fps while a movie plays, so the intro's narration no longer doubles and the dream shows at high refresh rates.
The game's event script times the intro movie's narration and fades by counting updates as 60 Hz frames. At 144 fps everything ran 2.4 times early: each line started over the one before, and the closing fade hid the dream. frame_step_cap_ns caps the rate at the movie's 60 fps from the decoder's start to its end of stream (ov_movie_live); with fps_limit = unlimited the cap is the movie's rate. With RTSS limiting, the game's own limiter holds a new rate until RTSS has applied it. NX2NAVI_MOVIE_FPS sets the cap, 0 turns it off. From a tester's fixes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:51:48 -05:00
chrg6
29d8451dd2 Cap the memory released textures keep for reuse, and free old ones when the system commit runs low.
After an hour at 2160p the 2048 released entries held 5-7 GiB of render targets and decoded textures, charged to Windows' commit as well. NX2NAVI_TEX_RELEASED_MB caps them by size (default 1/16 of RAM, 1-4 GiB), and with less commit free than NX2NAVI_TEX_COMMIT_FREE_MB they are dropped to 256 MiB. Only entries released 120 frames ago or more go, at most 32 a check, oldest first. On Linux the commit check applies only with vm.overcommit_memory = 2 (plat_commit_enforced). From a tester's fixes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:51:48 -05:00
chrg6
2cd6f5290b Leave the boot prebuild's huge compute shaders to their first dispatch, so memory no longer climbs to 30 GB at the title screen.
Four play-recorded compute shaders of 0.87 to 4.4 million SPIR-V words (the game's tensor-core upscaler passes, which run through the stand-in here) are recorded and so prebuilt at boot. The driver spent minutes and gigabytes on each, four at once, none finished, and every start began again until RAM ran out and the screen went black. The boot prebuild now creates a compute shader over 512K words only from a pipeline cache (VK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT) and leaves it to its first dispatch otherwise. NX2NAVI_LIB_PREBUILD_BIG=<words> sets the limit, 0 the old behaviour. From a tester's fixes: memory flat at 13 GB on the title screen, prebuild done in 463 ms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:51:48 -05:00
chrg6
8bd2d6aa31 Run one game per profile at a time.
Nothing kept a second copy of the game off the same profile (a double start, or the restart going ahead after 30 s
while the old process still ran). Its start took the first copy's commit in progress for an interrupted one and
deleted it, removed the first copy's working copy under its open files, and then both wrote into one save-tx/work,
so saves were lost or mixed. The save storage now takes <profile>/instance.lock (plat_lock_file: a file no other
process can open on Windows, flock on Linux) and a second copy stops with "another copy of the game is running".
--probe-fs gives the lock back before deleting its temporary profile and passes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:51:48 -05:00
chrg6
dc1afcb54f Unpack the release's Tcl/Tk again when its pinned installer changed or the last unpack stopped.
make_launcher.py reused WORK/tcltk whenever DLLs/_tkinter.pyd was there: after a new Python or Tcl/Tk pin the old
files went into the release while its runtime id said new ones did, and an msiexec run cut short after that file
was written was trusted too. A stamp naming the msi, written once the unpack is complete, now decides.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:51:48 -05:00
chrg6
138b8c8c29 Link the differential tests with lld only when the toolchain has it.
tests/diff/common.py always passed -fuse-ld=lld, so on an MSYS2 install without the lld package simd.py, atomic.py
and the other Unicorn checks stopped at "invalid linker name" before testing anything. lld is used when it sits
beside the compiler, the default linker otherwise; atomic.py passes either way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:51:48 -05:00
chrg6
f753dd0e33 Check what is staged, not the working copy, in check_content.py --staged.
The pre-commit check took the staged file names from the index but read their content from disk, so a chunk with
the generated-code marker that was staged and then removed from the working copy alone passed the check and went
into the commit (CI's full check would still catch it). --staged now reads the staged blobs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:51:48 -05:00
chrg6
96b33aefd2 Report a malformed .nup table of contents as a damaged file instead of hanging or crashing.
The table's sha256 is checked, but a table whose counts and offsets do not fit it went on: a directory listed as its
own child made tree() go round for good (the build hung at "check"), and a name pool placed before the entries, an
entry index past the lists, a name that is not UTF-8 or damaged zstd data raised struct.error, IndexError,
UnicodeDecodeError or ZstdError, which make_game.py does not catch, so the player got a traceback. All of them are
NupError now, which make_game.py and the launcher report as a damaged dump.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:51:48 -05:00
chrg6
95903c361a Mark one cheat or ExeFS patch the lifter cannot take as unsupported instead of failing them all.
convert caught ValueError only, while the lifter raises its own Unsupported for an instruction it does not take (an
FP16 operation in a code cave): tools/cheats.py and tools/exefs_patches.py stopped, and the setup then built the game
without any of the mods' cheats or ExeFS patches. It is now that file's own "unsupported" with the reason. A code
cave with a trap or system instruction before its last one, which recomp/gen.py refuses and which failed the whole
lift, is refused here the same way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:51:48 -05:00
chrg6
215c423d84 Write make_game.py's reset state at once when the game files changed.
A new input reset the steps in memory only; the next save came after the first step finished, while the exefs step
rewrites <out>/exefs in place. A run stopped there left the old state.json saying the old game's steps were done,
and --rebuild then trusted the half-replaced files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:51:48 -05:00
chrg6
35ff999958 Rebuild from extracted game folders whose files changed, not only when their count did.
With --exefs and --romfs folders, the identity the exefs and romfs steps are keyed on was the two paths and the
number of RomFS files: a RomFS extracted again or edited with the same number of files, or a replaced sdk or
subsdk0, printed "done before" and the build kept the old unpacked files. Each file's size and modification time
is now part of it. A build from such folders unpacks once more after this change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:51:48 -05:00
chrg6
8647f19370 Check that a texture's packaged data fits its memory pool before copying it in.
nvnTextureInitialize copied the layout's size of packaged data to the pool's memory at the texture's offset without
checking either against the pool: a descriptor larger than its pool wrote past the pool's storage. It now stops
with the sizes instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:51:48 -05:00
chrg6
b8d7eede08 Keep presenting after a present submit fails, and ignore a crop outside the image.
- The present resets its slot's fence after the acquire. When the submit then failed (out of device or host
  memory), the fence stayed unsignalled and the acquire's semaphore signalled: the slot's next fence wait timed out
  after 5 s, the frame counter no longer moved on, and every later present waited on the same slot, so the picture
  stopped for good while each game submit waited behind it. An empty batch now takes the semaphore and signals the
  fence, and the swapchain is made again, which gives the acquired image back.
- A crop from the game's nvnWindowSetCrop that starts past the image gave a blit with an inverted source rectangle;
  the whole image is shown then.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:51:48 -05:00
chrg6
b69b613984 Fix small settings and overlay edge cases.
- An empty NX2NAVI_SPIN or NX2NAVI_VRAM_HEADROOM in the environment stopped the game: both read the key with
  cfg_bool, and an empty value falls back to the settings table, where these keys have no row. Empty now means unset.
- find_ini checked for 10 bytes after the exe folder's separator where "nx2navi.ini" and its NUL take 12, so an exe
  path just under 1024 bytes wrote two bytes past the buffer.
- The performance overlay read the clock before taking the lock, so a frame pushed in between was newer than "now",
  the unsigned age wrapped and the overlay showed 0 fps for that refresh.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:51:48 -05:00
chrg6
ffe13e1d52 Reconnect Discord's status only when its app id changes.
Every settings change (a slider step, F10, a cheat) closed the connection and made a new one, so the status
disappeared and came back each time, and a held slider reconnected twice a second, enough to hit Discord's rate
limit. A new app id reconnects; a new image is resent on the same connection; anything else changes nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:51:48 -05:00
chrg6
7dd41c4c5a Close down properly when Windows shuts down, and open the window inside the screen.
- At shutdown, restart or logoff Windows ends the process after WM_ENDSESSION without a WM_CLOSE, so the close path
  never ran: a settings change from the menu still waiting to be saved was lost, RivaTuner's profile kept the
  game's limit and a save Commit in flight was cut off. WM_ENDSESSION now runs the close path.
- The window opened at its setting (by default 1920x1080) whatever the screen, so on a 1080p laptop its bottom, the
  HUD with it, was under the taskbar. At start it is scaled down, in its own proportions, to fit the work area; the
  setting is left as it is.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:51:48 -05:00
chrg6
68462a31a3 Pace "display" at 30 on a monitor below 30 Hz instead of at 60.
A measured rate under the lowest limit (a 24, 25 or 29.97 Hz TV) was taken for an unknown one and paced at 60: twice
the screen's rate, so half the frames were thrown away. Only an unknown rate (no window yet) is 60 now; a real one
below 30 Hz is held at 30.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:51:48 -05:00
Wintego
1b48c658cf Go fullscreen at start again when the window is raised 2026-11-08 15:51:48 -05:00
chrg6
a1f71328c0 Tell the game its own title id, 0400486024DEC000, for GetInfo and its save data checks.
GetInfo's program id and the application id IsSaveDataExisting and MountSaveDataReadOnly answer for were another
game's. The game asking about its own save data by its own id was told there was none; asking with the other id
mounted its own save. Both are now this game's id, and --probe-fs passes with it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:51:48 -05:00
chrg6
7da472bbb1 Keep the profile working when it is linked elsewhere or account.uid is lost, and check save write sizes safely.
- A profile, save or account folder that is a junction or symbolic link (a profile moved to another drive and linked
  back) stopped the start at "cannot create directory"; it is now taken as the folder. A save folder linked to
  another drive than save-tx cannot take commits (a folder rename cannot cross drives); the log now says so instead
  of blaming a file in use.
- A missing account.uid made a new account, and the save under the old account's folder was no longer found (a
  profile copied without the file, or only its save folder put in place). When save/ holds exactly one account
  folder, its account is taken. A file that is there but cannot be read now stops the start instead of being
  replaced.
- WriteFile's check of offset plus size against the file size could wrap for a size near 2^64.
- The first save mount deletes the last session's working copy with the retries the start uses, so a scanner
  holding a file there no longer stops the game.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:51:48 -05:00
chrg6
e922b68866 Let --probe-fs wait for its commits without marking the process as exiting.
The probe waited for each Commit's background thread with fs_save_flush, which since Quit keeps saves safe also marks
the process as exiting: every later Commit was refused ("the game is closing") and 20 of the 160 checks failed. It
now waits with save_wait_commit; all checks pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:51:48 -05:00
chrg6
a99234604b Give the keyboard defaults in nx2navi.ini.example as the code has them.
B is Left Ctrl and Backspace, and Left Shift is A (held, dash), but the example said B was Left Shift, so copying
its sample bind lines moved dash to B. Its walk_key example collided with that dash key, and it named a G key for
SHAKE, which has no default key.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:51:48 -05:00
chrg6
ccbb02a04b Empty SDL's event queue after each gamepad update on Windows.
Nothing reads SDL's events there (the window is our own), yet every axis and button change of a gamepad was queued
until SDL's cap of about 65,000 events, several MB, after which each further event failed and set SDL's error text,
which later log lines report. The gamepad state the input code reads does not come from the queue.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:51:48 -05:00
chrg6
2986daf84e Follow Windows' switched mouse buttons for the mouse bindings.
GetAsyncKeyState reads the physical buttons, so with "switch primary and secondary buttons" on, a left-handed
player's primary button targeted and the secondary attacked, the other way round from the window's own clicks.
mouse_l and mouse_r now mean the primary and secondary buttons.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:51:48 -05:00
chrg6
c65f21d531 Fall back to stick_deadzone when a stick's own dead zone does not read as a number.
lstick_deadzone = 8% (or any typo) counted as set, and since that row has no default of its own it read as 0: no
dead zone at all, so a drifting stick moved Link. The documented fallback, stick_deadzone, is now used then.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:51:48 -05:00
chrg6
0531ad8a09 Do not mix a menu sound past its end when it restarts during the mix.
menu_sound_play restarts a voice in place for a repeated cursor tick. When that happened between the mixer's loads
of the voice's position and its sound, the old position was used with the new, shorter sound: the frame count
wrapped and the mixer read past the sound's samples. The mixer now checks that the position is still the voice's
and inside the sound.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:51:48 -05:00
chrg6
2f7e1806a2 Keep the audio renderer from going silent or hanging on edge values.
- An audio_prefill_ms of 180 or more asked for more queued audio than the renderer ever fills the ring to (half of
  it), so the output never started and stayed silent. The prefill is now held to that target; nx2navi.ini.example
  says so.
- An infinite or huge pitch or sample rate from the game kept the per-sample loops going for good under the
  renderer's lock, which then blocked the game's RequestUpdate. The step is held to 64 source samples per output
  sample.
- An endless loop buffer with no samples (start equal to end), which the voice keeps as the DSP does, made
  advance_voice go round for good; it now starves the voice as intended.
- A NaN sample or effect state reached the device, where it plays as full scale; it now plays as silence.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:51:48 -05:00
chrg6
1795b186a4 Say in nx2navi.ini.example how mods_dir and mods_order are read now.
A relative mods_dir is under the game's folder, the setup builds only the default folder's ExeFS patches and code
cheats, and the order is set in the file: the in-game menu it named has no Mods tab.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:51:48 -05:00
chrg6
771c4f4fb1 Log a mod folder that cannot be listed, and let the game take long paths where Windows allows them.
A folder in a mod's RomFS that could not be listed (no permission, or a path longer than 260 characters, as a mod
deep in a long game folder makes) lost its files without a word in the log; the walk now names it. The manifest
asks for long path support, so where Windows has it switched on (LongPathsEnabled) those files are served.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:51:48 -05:00
chrg6
d0e9ba6b30 Propose a game folder only on a fixed drive.
When the launcher's drive has less than 40 GB free, the proposed game folder goes to the drive with the most free
space, and a mapped network share or a USB drive was counted: the 26 GB RomFS image and the build would go there.
Only fixed drives are counted now, as the docs say.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:51:48 -05:00
chrg6
7b467f6686 Let the setup repair a launcher that updated itself and can no longer start.
The setup left the folder alone whenever app/current.txt named a newer version than its own, so after an update
"Run NX2navi-Setup.exe again to repair the installation" did nothing when python\ or that version's launcher was
gone (deleted, quarantined). A newer install is now kept only when its launcher and Python are there; otherwise the
setup unpacks its own release.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:51:48 -05:00
chrg6
7033d63af1 After a rollback, show why the version went back instead of finishing the failed update.
When a new version did not start, the stub started the previous one with --rolled-back and the same arguments,
--continue-update among them: the previous version then ran the update's rebuild as if it were the new one, and the
"Version X did not start" notice on home never showed. A rolled-back start now goes to home with the notice.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:51:48 -05:00
chrg6
a24a21bff5 Write make_game.py's state.json whole or not at all.
A write cut by a full disk or by Cancel ending the build left a state.json that loads as {}: the launcher then took
the built game for none, showed the first run and needed the dump again for a rebuild. It is now written to a
temporary file and moved into place.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:51:48 -05:00
chrg6
1196448719 Stop a build that Cancel was pressed for before it started.
Cancel while the tools were checked (before make_game.py started) set the flag but found no process to stop, and
the 10 to 25 minute build then ran anyway until Cancel was pressed again. The job now stops before starting the
build, and stops one Cancel caught as it started.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:51:48 -05:00
chrg6
4ab121d67e Do not take a read-only ocarina.exe for a running game.
The launcher tells a running game by ocarina.exe refusing to open for writing, and a read-only exe (restored from a
backup or copied from read-only media) refuses too: Rebuild, Update, Import Saves and uninstalling with the game were
refused with "close the game" for good. The check now clears the read-only attribute of the build's own exe, which
the next link replaces anyway, and tries again. Import Saves uses the same check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:51:48 -05:00
chrg6
9865542bb9 Put a finished save commit back when Import Saves cannot swap the account folder.
The import moved save-tx's journal into the backup before it moved the account folder aside. When that move failed
(a file in the folder held open by a virus scanner or a sync client), the player was told nothing was imported, yet
the newest finished commit was gone from save-tx and the game loaded the older account folder. The journal now goes
back into save-tx when the swap fails, and the staged copy is removed.

A save copied from read-only media also kept the read-only attribute in the game's folder, and the replaced save's
read-only files stayed behind in save-tx/replaced: imported files are made writable and the old ones are deleted
with the attribute cleared.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:51:48 -05:00
chrg6
c9f75ad0b2 Read launcher.json saved with a BOM, and keep a copy of one that is not valid JSON.
The docs ask players to edit the file by hand (github_token, feed_repo). A BOM, which an editor may add, made the
file unreadable and every setting, the game folder included, fell back to its default, so the launcher showed the
first run again; a typo did the same and the next save overwrote what the player wrote. The file is now read with
utf-8-sig, and a file that is still no JSON is copied to launcher.json.bad and named in the log.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:51:48 -05:00
chrg6
aaea991191 Uninstall only what the launcher put in its folder, so a kept game folder inside it stays.
Uninstall ran rmdir /s on the whole launcher folder, which holds the default game folder (<launcher>\game) and, with
the setup's --dest, whatever else the player keeps there: "Remove the Built Game" Off would have deleted the game and
its saves. It now deletes NX2navi.exe, python, app, pydeps, data, toolchain and python.old-*, then the folder only
when that left it empty, and for a toolchain in C:\NX2navi that toolchain, then C:\NX2navi only when empty.

The command also never ran: it went to cmd.exe as a list, whose quotes Python escapes as \", which cmd.exe does not
understand, so every rmdir failed and nothing was removed. It is now one command line. tests/launcher_test.py runs it
on a folder with spaces and a character outside ASCII.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:51:48 -05:00
chrg6
b142b7a71a Quote a settings value on save when reading it back would change it.
cfg_load trims blanks around a value and takes one pair of quotes off it, so a mods_order list whose first mod's
folder name starts with a space, or a value that is itself quoted, came back different at the next start and the mod
lost its place and switch. Such values are now written in quotes; others are written as before. --probe-cfg checks it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:51:48 -05:00
chrg6
7f9ace35fb Read the mods folder the way the setup's tools do, and keep each mod's start state with it.
- A pchtxt file's build id is read as tools/exefs_patches.py reads it: after a UTF-8 BOM and blanks, the last
  @nsobid line before @stop, a // comment after it left out. A file saved with a BOM or an indented line was taken for
  another game version although the setup had built it into the game.
- A symbolic link or junction to a folder in mods/ is a mod, as the setup's tools see it; it was left out, so the
  patch sets built for it were never switched on.
- A relative mods_dir is under the game's folder, not the folder the game was started from.
- A mods folder that cannot be listed is logged instead of showing no mods without a word.
- The start state of a mod's switch moves with the mod when the list is reordered, so the ExeFS patches waiting for
  the rebuild are counted for the right mods.

--probe-mods checks each of these.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:51:48 -05:00
chrg6
1f4839d4a5 Look for a mod's Atmosphere folders under this game's title id, 0400486024DEC000.
The runtime, the setup's cheat and ExeFS patch tools and the old installer named them after another game's title id, so
a mod laid out as atmosphere/contents/<title id>/romfs (or contents/<title id>, <title id>) was listed as empty.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:51:48 -05:00
chrg6
3aa8ff56a2 Replay the game's queues in the order their events allow, so Link and the other characters are no longer drawn too dark.
Ocarina runs compute work on a second queue that trades results with the main one through events: the worker's command buffers wait (WaitEvent) for signals the main queue gives in its submission a few submits later, and the main queue waits for the worker's signals in turn. Replayed one submission after the other, the worker's steps ran before the work they wait for and read the previous frame's results, and the characters came out much too dark at any time of day (Kokiri Forest: about 13 waits a frame, 7 of them reached before their signal).

A top-level wait whose condition does not hold in replay order now stops its submission: the rest is held, with private copies of its recordings and the queue's state, and the queue's later submissions line up behind it. After each replayed signal the held work whose wait now holds goes on inside the command buffer being recorded, between full barriers, with its own state swapped in. Work still held after 36 submissions goes on regardless, as before (counted in the NX2NAVI_TRACE=perf line). The queue reaches the back end as gfx_submit_queue. Only with the replay on the submitting thread; NX2NAVI_EVENT_ORDER=0 turns it off.

Tested by play in adult Hyrule Field with the tree fix of the previous commit: Link lit normally at dusk and at noon, trees steady, lighting otherwise unchanged. The white specks in the grass remain (they predate both changes).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:51:47 -05:00
chrg6
82257eec3d Send atomics through the device address table to guest memory too, so the trees no longer flicker or stretch into columns.
The culling passes count each frame's visible foliage with atomics through the device address table into small records (an indirect draw's count, then 1, 1). Stores through the table already reached both the VRAM mirror and its guest copy, but atomics reached the mirror only, so guest memory held the CPU's template of zeros. The CPU writes other words of the same pages every frame, and the sync of such a page copied those zeros over the counts: in Hyrule Field the trees flickered, went missing or stretched into columns reaching the sky. NX2NAVI_MEMORY=verify found 5 to 10 such pages a minute, all in ten pools of 20 and 44 KiB.

Translator patch 0036 repeats every table atomic on the twin (a compare-exchange with the same operands), leaving its result unused so the driver need not wait on guest memory. A buffer fill into a mirror now fills its guest copy at once (vk_mem_guest_twin), so a counter the GPU resets that way counts on from the same value in both; that mismatch is why table atomics stayed out of the twin before. The memory check's mismatch lines now also give the pool's last written binding, its last use, the CPU's write stamp for the page and the first bytes of both copies.

With the change the trees stayed steady at the spot where they flickered, all 37,848 shaders translated without a failure, and the GPU time per frame stayed at about 9 ms (75 fps uncapped).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:51:47 -05:00