Commit Graph

107 Commits

Author SHA1 Message Date
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
chrg6
a8f34e48c8 Offer a 1080p game resolution.
The picture's height can now be 1080, below the game's own 1440, for slower GPUs: the scene, the DLSS and FSR 3.1
modes and frame generation follow it, and the ultrawide shapes become 2560x1080 and 3840x1080. "Native" keeps its
floor of 1440. The example settings file now documents game_aspect and game_res.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:51:47 -05:00
chrg6
22bbe674be Remove the read-back refresh of the VRAM mirror, which brought back the tree columns.
Copying the invalidated ranges from guest memory into the mirror at every submission put the guest's copy of those pages over GPU results that live only in the mirror. In adult Hyrule Field that wiped tree records, and the trees stretched into columns reaching the sky again. With NX2NAVI_READBACK_SYNC=0 the columns did not appear at the same spot. The memory check (NX2NAVI_MEMORY=verify) still finds mirror pages newer than guest memory there with or without the refresh, about 3 per 60 frames, which is left for later.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:51:47 -05:00
chrg6
9a8f74fe53 Refresh read-back ranges in the VRAM mirror, guard the boot pipeline prebuild against driver crashes and count out-of-order event waits.
Small ranges the game invalidates and reads back (the exposure meter) are copied from guest memory into the mirror at every submission that uses their pool, so a CPU write made between recording and the GPU's run is not lost; NX2NAVI_READBACK_SYNC=0 turns it off.

While the boot builds the recorded pipelines a marker file exists next to the pipeline cache. A start that finds it left over records the GPU and driver in pipeline-prewarm-skip.txt, and starts on them build those pipelines at their first draw instead.

CommandBufferWaitEvent is now recorded as OP_WAIT_EVENT. The replay waits for nothing but counts the waits it reaches before their signal, and how many submissions later that signal comes, in the NX2NAVI_TRACE=gfx frame line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:51:47 -05:00
chrg6
42ae87bca6 Runtime: power opt-out, faster fence wake-ups, feedback barrier, texture re-upload skip
- Opt the process out of Windows power throttling (execution speed and
  timer resolution) at startup; NX2NAVI_POWER_FULL=0 turns it off.
- Fence completion thread wakes waiters before collecting freed memory,
  so collection no longer delays them.
- Add a by-region barrier when a draw or clear writes an attachment that
  an earlier draw in the same pass sampled; count it and inline uniform
  updates in the per-frame stats.
- Hash small texture contents at upload and skip re-uploads whose bytes
  are unchanged (removes ~420 redundant uploads per frame in Kokiri
  Forest); NX2NAVI_TEX_SAME=0 turns it off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 06:04:57 -05:00
chrg6
7410e0d2d7 Frame dumps also keep each shader's translator request, which reproduces its SPIR-V and can write its GLSL.
Next to sh_<hash>.code the dump writes sh_<hash>.code.job: the request line the runtime sends nx2navi_xlate --serve for
that program. Run by hand with "glsl_out" or "lowered_out" added to its job (and "out" pointed elsewhere), it writes the
shader as GLSL or as the lowered Maxwell code; its SPIR-V is the same bytes the game ran.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 04:27:24 -05:00
chrg6
1cffc476e9 README: drop the note on how the code is written.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 04:18:46 -05:00
chrg6
ef896bbb02 README and LICENSE-ADDITIONS: drop the clause about machine learning and AI tools.
The additions stay all rights reserved: copying and publishing them still needs written permission.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 04:18:08 -05:00
chrg6
092379def8 Frame dumps keep each shader's guest program, and a test switch runs an edited SPIR-V in place of a compute shader.
NX2NAVI_DUMP writes sh_<hash>.code next to sh_<hash>.spv: the guest program the shader was translated from, as its
stored inputs hold it, for a disassembler (a compute program as it is, a graphics stage after its 128-byte header).
NX2NAVI_SPV_OVERRIDE=<dir> runs <dir>/<hash>.spv in place of the compute shader whose SPIR-V has that hash, an edited
copy with the same interface, to look at a shader's intermediate values in a frame dump.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 04:10:35 -05:00
chrg6
8f5e2fe76e Make Enhanced HDR's highlights brighter: above 0.67 of the game's white a boost that starts flat and grows to one white per unit of scene light replaces the old tangent, so bright light keeps climbing instead of ending near white, with mid-tones unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 04:10:35 -05:00
chrg6
d9fb0fe1ba Give characters in Ocarina's frame their own motion for DLSS and frame generation, so a running Link no longer trails.
Ocarina's frame has neither the per-object motion pass nor the class buffer the characters' mask reads, so DLSS and
FSR 3.1 frame generation moved every pixel with the camera: the character the camera follows dragged a faint copy of
itself through DLSS's history and doubled in generated frames. The motion pass (dlaa_mv.comp, vk_dlaa.c mv_pass) now
keeps each pixel's view distance for the next frame and checks the camera's vector against it. Where last frame's
depth at the place the camera's motion points to disagrees, the surface moved on its own; when last frame's depth at
the same pixel agrees, it kept its place on screen and its vector is zero. Such pixels also get the characters' bias
mask (dlss_char_mask), so DLSS takes this frame's colour where its history holds something else. The check takes the
best of 3x3 pixels, so silhouettes reprojected a pixel off are not taken for motion, and leaves the screen border to
DLSS. NX2NAVI_DLAA_ZFIT=0 turns it off; NX2NAVI_DLAA_MASKDEBUG=1 shows the mask.

Frame dumps list a border sampler's colour.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 04:10:35 -05:00
chrg6
5aa3bc4119 Render widescreen pictures at the DLSS mode's real share, and size frame generation for the scene it is given.
The game sizes its scene from the scale at the patch page against its own 1440-line picture, so on a 2160-line
picture native DLAA rendered a 1440-line scene and Quality 44 %. The page now gets the share times the picture's
height over 1440, and DLAA is native at any picture size. Switching dlaa off in the menu also gives the scene back
the game's own scale instead of leaving it small with nothing to enlarge it.

FSR 3.1 frame generation was created with the window as its largest render size, but it is given the scene's depth
and motion vectors, up to the picture's size. A 3414x1440 or 5120x2160 scene in a 1920x1080 window wrote past its
resources: a crash in amd_fidelityfx_vk.dll, device faults, striped frames. The context is now made for the picture's
size once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 04:10:35 -05:00
chrg6
432cbdffe8 Hold the frame limit on screen while FSR 3.1 frame generation runs.
Frame generation presents a generated frame between each two of the game's, so a limit of 60 showed 120. While
generation is on (not paused for the menu or for want of depth and motion), the game is paced at half the limit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 04:10:34 -05:00
chrg6
b62ffac721 Apply the DLSS mode's render scale every frame, so native DLAA and the other modes take effect when picked.
The res_fixed patch sends the game's dynamic-resolution controller down its fixed path, which returns its scale with
state 1 or 2. The caller makes a new scene scale only on state 0, so the menu's mode reached the scene only by chance:
a mode switch in play left the scene at its old size, and a scene reload put it back at full size. The fixed path now
returns state 0, and the page's scale applies every frame. Ocarina also no longer logs that DLSS needs
nvngx_dlss.dll and follows render_scale, which was true only of the builds with a scene patch set.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 04:10:34 -05:00
chrg6
f57a327a86 Keep saves safe in Import Saves and Quit, draw no traced game art, and recompile the game for a new processor.
Import Saves: the saves folder picked in the dialog imports what waits in it (it had made the folder's README the
save); the save backed up is the one the game would load, in runtime/fs_host.c save_recover's order, so an interrupted
commit's only copy is kept, and the rest of the commit journal moves into the backup instead of being deleted; the
imported save goes into place before the old one is deleted, which comes back if that fails; another NX2navi install's
finished commit counts as its save. Tests cover each.

Quit waits while the game writes a save, as Restart does: the game runs on under the menu, and closing the window
finishes only a commit that has begun. The VSync row says "in use: Immediate" when VSync On falls back to tearing, and
its default follows the device profile (cfg_default). Without the game's textures the menu's divider is a plain line
and diamond of its own, not a tracing of the game's ornament.

make_game.py: the compile key holds the processor's features (cpu_tag), so a game folder moved to a PC without AVX2
compiles again instead of crashing; the main thread gets 16 MiB of stack with GNU ld too; any error waits for the
RomFS image, so its .part file is not cut short. The launcher tests use a neutral title id; tools/menu_preview.cpp
has cfg_default.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 03:57:02 -05:00
chrg6
8daedbd806 Redraw the in-game menu with the game's own interface textures, and bring in the launcher's save import and faster builds.
In-game menu: the settings window, its tabs, rows, buttons and cursor, the performance overlay and the Preparing
shaders box are drawn with the game's interface textures where the RomFS holds them (runtime/ui/menu_skin.cpp,
perf_panel.cpp; plain shapes until they are decoded). Restart joins Continue and Quit, each behind a confirmation;
VSync is an on/off switch; DLSS is listed only on NVIDIA GPUs; the menu sounds are quieter; Picture shape is gone and
the setting descriptions are shorter; edge cases of input, layout and fonts are fixed. tools/menu_preview.py draws the
menu without the game.

Launcher: Import Saves takes a save from the game folder's saves/ folder or one the player picks; downloads fall back
to Windows' own certificate check when Python's refuses a server; updates are faster; the title bar is drawn in the
window and Navi is every icon. tools/make_game.py builds with CLANG64's clang where the launcher installed it, packs
the RomFS beside the lift and the compile, takes a prebuilt runtime, and compiles the game's resources without cmd.exe,
so a user folder with a space in its name builds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 03:57:01 -05:00
chrg6
5b28da3a06 Make Enhanced HDR extend the game's tonemap again: its matchers take the NClamp the translator writes.
Translator patch 0031 (0.4.0) writes the tonemap's 0..1 clamp as GLSL NClamp, and vk_hdr.c looked for FClamp only, so
Enhanced HDR left the tonemap as it was and showed the SDR picture. The output clamp and the ACES clamp now match
either form, and the replacement keeps the NaN rule: NMax for an NClamp (NaN gives 0, as the clamp did).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 01:25:12 -05:00
chrg6
9bb3c6c55a Hand the frame limit to RivaTuner Statistics Server where it runs, and take it back when RTSS does not hold to it.
Where RTSS is installed and running, the frame limit from the menu goes into RTSS's profile for the game's executable
through RTSS's hooks library, loaded at run time, and the game's own pacer stands aside while RTSS has hooked the game.
Menu changes apply live, unlimited clears the limit, and closing the game (or any exit path) puts back what the profile
held, or removes a profile the game created. Each change is read back from the saved profile: without administrator
rights RTSS's profile folder cannot be written, and the game then keeps its own limiter. While RTSS limits, RTSS's own
frame counter for the game is checked against the limit; well past it for three seconds, the game takes the limiting
back for the run. The log says which limiter is in use and why, and a note under the frame-rate row says when RTSS
limits, when its profile is read-only, and when it does not hold the game to the limit. rtss = 0 and frame generation
keep RTSS out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 01:25:12 -05:00
chrg6
cfc3228cc4 Build in the NX2navi Discord application's id
The Rich Presence now speaks for the Discord application registered as NX2navi by default, so the status reads
"Playing NX2navi" without an nx2navi.ini entry. The ini example shows the id as discord_app_id's default.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 01:25:12 -05:00
chrg6
7cd1b6ee23 Leave the NDSR upscaler's slow, unused compute shaders out of the install's shader preparation.
The translator turns the larger programs of agl_ndsr.pck and agl_ndsr_vr.pck into 3-12.6 MB of SPIR-V, which the GPU driver took 34 s to 44 minutes each to build: 19,400 of the 21,750 s every compute variant took together, most of the install's hour of driver builds. Play met none of them that was slow to build, so the default variants of those programs above 16 KB of code are left out; agl_ndsr_vr_light.pck, whose programs play meets, stays whole. --all-shaders prepares them too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 01:25:12 -05:00
chrg6
8f559ac945 Show the Discord status under an NX2navi application instead of the old one
Discord takes the name above the presence from the application whose id the client sends, and the built-in id
belonged to the application the earlier framework registered for its own game, so the status read as that game.
The id and the art key now live in runtime/discord_app.h (NX2NAVI_DISCORD_APP_ID_DEFAULT and
NX2NAVI_DISCORD_IMAGE_DEFAULT), the one place to paste the NX2navi application's id. Until it is set there or in
nx2navi.ini, the presence stays off and logs once how to set it, and --probe-discord skips. The ini example and the
comments no longer claim the old id is registered as NX2navi, and the details-line example uses game 1.1.1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 01:25:12 -05:00
chrg6
8702ddb356 Default to the Switch's own button positions on every gamepad, and fix menu edge cases.
pad_layout defaults to nintendo: Switch A on the right face button, B bottom, X top, Y left, on an Xbox pad too, where
auto had picked the Xbox layout. The settings probe checks every button's position.

Menu: the "default" mark follows the Steam Deck profile's values (cfg_default); Left on a value the list does not hold
goes to the last entry; the HDR row says "in use: off" when the swapchain is not HDR10; the open state is read again
after taking the reset, so a menu opened by F1 while the overlay alone was drawn starts with its focus row; the font
atlas is rebuilt only for a scale more than 12% off or one that held for half a second, so dragging the window's edge
no longer rebuilds it every frame.

A shader that fails to translate keeps its request and code in the shader cache. NX2NAVI_GPA_TWIN=0 turns the guest
copy of device address table stores off (diagnosis). The memcpy override no longer prints its first 500 calls.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 00:34:29 -05:00
chrg6
936dd8094a Translate 40 more shaders, and build the upscaler's compute shaders five times faster in the driver.
The SM86 lowering now takes MEMBAR (as Maxwell MEMBAR.GL), drops ERRBAR, takes F2I of an immediate and MATCH.ALL.U64,
and finds a switch's jump table bound past the BSSY the compiler puts between the IMNMX and the shift: three vertex
shaders, one of them drawn in Kokiri Forest, were skipped for it. A task program and the mesh programs it feeds whose
payload size field reads 0 (it counts 256-byte units) get one unit. Of the 42,177 programs, 31 still fail, all modes
whose meaning is not certain.

Translator patch 0035 inlines SHFL.IDX over the whole warp (mask 0x1f) on a 32-lane host as the subgroup shuffle,
instead of a call to the general shuffle helper. The tensor lowering shuffles thousands of times per program and the
driver inlined the helper at each call: a mid-size upscaler shader built in 185 s before and in 34 s now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 00:34:29 -05:00
chrg6
96b6e04937 Compile the resources with windres when the install folder's path holds a space.
GNU windres runs its preprocessor through cmd.exe and, left to find it, puts the full path of the gcc beside it on that
command line. When that path and the .rc's both hold a space (a Windows user name such as "Joe Budson"), cmd.exe drops
the outer quotes and splits the command at the first space, so 0.5.0's Compile step failed with "'C:\Users\Joe' is not
recognized". make_game.py, build_game.py and make_launcher.py now name gcc by bare name (the toolchain's bin is first
on PATH) with windres's own preprocessor arguments, and make_game.py and make_launcher.py run windres in the .rc's
folder with relative names. The objects are byte-identical to before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 00:34:29 -05:00
chrg6
fc8a9523a4 Prepare shaders under the code hashes play asks for, from every shader package, with better guessed bind states.
The install step seeded only 63% of the programs a play session met under their run-time code hash. A Switch 2 program with an empty c1 range past its code was hashed with that range, the Switch 2 agl and NDSR packages had no reader, and Layout2Shader/ was not walked. It now seeds 99.3% of the programs play asks for.

A default variant's answers are read again from its first translation (runtime/gfx_shader_guess.c): vertex inputs the shader reads as integers become uint, and a compute shader takes the texture and image types its translation declares. Task and mesh defaults carry the workgroup words play answers with. Against a play session's recorded variants, --prepare-shaders now matches 98.3%; the plain default guess matched 89.5%.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 00:34:29 -05:00
chrg6
d0da862c87 Release 0.5.0: fix the white haze in fog and the flickering foliage.
The float atomic add's compare-and-swap loop (patch 0033) carried its expected value round the loop in a local, but the
pass runs on SSA form and the optimizer's copy propagation takes every value as assigned once, so the loop compared
against a stale value and the froxel fog added up wrong: Kokiri Forest was washed out white. Each attempt now reads the
word with an atomic OR of 0, which also cannot return a stale cached copy.

Writes through the device address table go to the guest copy for stores only (patch 0034). An atomic on the guest copy
started from its stale value, so a counter the GPU reset with a buffer fill kept counting there, and the page's next
sync copied the wrong count into the mirror: culled foliage drew garbage for a frame.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
v0.5.0
2026-11-07 22:05:43 -05:00
chrg6
cd7cce89cb README and AGENTS.md: the source is public to read, its additions still all rights reserved.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 20:41:11 -05:00
chrg6
7f50cc5e29 Third-party notices list only the code the repository copies.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 20:36:29 -05:00
chrg6
65ad25faaf Release notes and README: the tree columns are fixed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
v0.4.0
2026-11-07 20:27:34 -05:00
chrg6
4cb8188491 Write through the device address table into guest memory too, so the GPU's writes there are no longer lost.
The table's records gain a twin: a pool with a VRAM mirror names the mirror first and its imported buffer, guest
memory, second; any other record names one buffer twice. Shaders read through the first address and store and run
atomics through both (translator patch 0034); a page without a twin sends the second write to a 4 KiB scratch buffer.
The GPU's writes through the table were not recorded as GPU writes, so they stayed in the mirror: the CPU never saw
them, and a sync of a page the CPU wrote copied the stale guest page over them. Trees drawn from records lost that
way stretched into columns reaching the sky. With NX2NAVI_MEMORY=verify the Hyrule Field walk found 16 such mirror
pages before and none or one after; GPU time per frame 5.92 ms before, 6.17 ms after.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 20:27:34 -05:00
chrg6
8102b6a222 Release 0.4.0: the first public release, with its notes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 19:26:28 -05:00
chrg6
1f016a774e Menu and start-up edge cases: a chosen GPU that is gone, held Esc, the boot screen, and upscaler-dependent rows.
- A GPU index or name that is not usable, or no longer there, falls back to the best usable GPU with a log line instead
  of stopping the game before the menu can change it (vk_device.c pick_device).
- A held Esc no longer opens the menu and closes it again on its first key repeat (menu_win.cpp, menu_sdl.cpp).
- The menu does not open on the boot screen, where it was not drawn while its keys queued up and changed settings once
  the game ran.
- The DLSS render scale follows the upscaler that runs: a DLSS or FSR 3.1 mode picked in the menu, which applies after
  a restart, or DLSS where NGX is not available, no longer shrinks the scene with nothing to scale it back up.
- Upscaling without DLSS or FSR 3.1 also turns frame generation off, which needs their motion vectors.
- The HDR peak brightness slider reaches the setting's 10000 nits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 18:44:56 -05:00
chrg6
9dcfc5723b Profiler: unwind through vendor DLLs only while they are pinned, so slow-frame captures no longer crash at start.
NX2NAVI_PROFILE_SLOW unwound threads in any module, and one being unloaded while the game started (a driver or vendor
DLL) had its unwind tables freed under the sampler. The exe and the system DLLs are walked freely; any other module is
held with GetModuleHandleEx for the step, and one that is unloading ends the chain. The block-linear copy probe gains
two cases of 256 KiB and more.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 18:44:56 -05:00