diff --git a/.gitignore b/.gitignore
index e365e074..92532f2c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,4 @@
-# Reference checkouts of upstream projects (cloned locally, never committed)
+# Pinned read-only checkouts (tools/fetch_refs.sh; cloned locally, never committed)
/refs/
# Downloaded toolchain binaries and Python environments
diff --git a/AGENTS.md b/AGENTS.md
index 99981cc9..b0eeaf77 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -13,11 +13,11 @@ This repository is public. Game data lives outside it and every derived file sta
## Reusing code
-`refs/` holds the upstream checkouts (`tools/fetch_refs.sh` recreates it). Read-only.
+`refs/` holds the pinned checkout the build reads (`tools/fetch_refs.sh` recreates it). Read-only.
- Copy only MIT, BSD, ISC, zlib or Apache-2.0 code, keep its header, and add a row to `THIRD_PARTY_NOTICES.md`.
-- the hardware, suyu, OpenSmash-Ultimate and other GPL code: read for behaviour, write our own.
-- `tools/vendor/` stays byte-identical to upstream; Windows changes go in `tools/extract.py`.
+- GPL code is never copied: write our own.
+- `tools/vendor/` stays byte-identical to its source; Windows changes go in `tools/extract.py`.
## Code
@@ -26,8 +26,8 @@ This repository is public. Game data lives outside it and every derived file sta
- Generated C is never edited by hand: change the generator (`recomp/`).
- Every lifter change passes the differential tests against Unicorn ([docs/building.md](docs/building.md), "Checks"). After changing `recomp/jumptables.py`, `tests\jumptables_check.py` reports 0 disagreements on 1.2.1 and 1.4.3.
- `recomp/layout.py` alone decides module bases.
-- Graphics bugs: [docs/maxwell.md](docs/maxwell.md) lists the Maxwell behaviour the Vulkan path must match and the NX2navi bugs other ports fixed.
-- Comments say what the code does and why, in words that stand on their own. Cite our code by file plus function (a line number may follow as a hint) and upstream code by project, file and function: `refs/` moves, so its line numbers rot. Commit hashes belong to the attribution of copied code.
+- Graphics bugs: [docs/maxwell.md](docs/maxwell.md) lists the Maxwell behaviour the Vulkan path must match, what goes wrong when it does not, and what our runtime does.
+- Comments say what the code does and why, in words that stand on their own. Cite our code by file plus function (a line number may follow as a hint). Comments and docs do not name other projects or say where code came from: the license header of copied code and its `THIRD_PARTY_NOTICES.md` row carry that.
## Writing
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index bc1857ac..d102be8d 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -21,7 +21,7 @@ Links to game files, keys or firmware in issues or pull requests get the issue c
Code may be copied only from projects under MIT, BSD, ISC, zlib or Apache-2.0. Each copy keeps its original header and gets a row in [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md) with the source commit.
-GPL projects (the hardware, suyu, OpenSmash-Ultimate, Unicorn inside the game binary) can be read to understand behaviour, but their code is not copied. Unicorn is fine as a separate test tool.
+GPL code is never copied, and none goes into the game binary. Unicorn (GPL) is fine as a separate test tool.
## Reporting bugs
diff --git a/docs/architecture.md b/docs/architecture.md
index d2b952fd..4c3eeba5 100644
--- a/docs/architecture.md
+++ b/docs/architecture.md
@@ -83,7 +83,7 @@ keeps per-core data without locks and relies on that, so the host models it (`ru
- Bindless textures: the texture and sampler pools are descriptor arrays kept in step with the game's pool writes
(`vk_exec_draw.c pool_sync`); slots that resolve alike share one lookup.
- Shaders: Ampere (SM86) code is lowered to Maxwell (`tools/xlate/AmpereLowering.cs`) and translated to SPIR-V by the
- Ryujinx shader translator 1.3.2 with our patches (`tools/xlate/patches/`), built with .NET 10 NativeAOT as
+ pinned shader translator (`tools/vendor/ryujinx`, 1.3.2) with our patches (`tools/xlate/patches/`), built with .NET 10 NativeAOT as
`nx2navi_xlate.exe` and run as separate processes. Translations are cached on disk; shaders and pipelines seen in
play are prepared at the next boot, which waits for them at most `NX2NAVI_PREWARM_WAIT_MS` and then lets them finish
in the background.
diff --git a/docs/building.md b/docs/building.md
index 704eb064..e51a423f 100644
--- a/docs/building.md
+++ b/docs/building.md
@@ -39,10 +39,10 @@ PATH:
### hactool
-`tools/build_hactool.py` fetches SciresM/hactool at `1d64a83` into `toolchain\src\hactool`, applies the three patches in
+`tools/build_hactool.py` fetches hactool at `1d64a83` into `toolchain\src\hactool`, applies the three patches in
`tools/hactool/` and builds a static `toolchain\hactool\hactool.exe` with MSYS2 UCRT64 gcc (a few seconds):
-- `portable.patch`: the parts of MacNativeGames' `build_hactool()` that run on Windows, the `MNG_TITLE_KEYS` variable and
+- `portable.patch`: the changes a portable Windows build needs, the `MNG_TITLE_KEYS` variable and
the two BKTR fixes in `nca.c` for the subsection table padding and the subsection layout of newer cumulative updates;
- `unicode.patch`: a manifest with `UTF-8`, so paths under a non-ASCII user profile
reach it intact;
@@ -167,7 +167,7 @@ $llvm = "toolchain\llvm-mingw-\llvm-mingw--ucrt-x86_64"
.venv\Scripts\python tools\build_game.py --version v143 --out build\v143-pgogen --toolchain $llvm --pgo gen
```
-Play `build\v143-pgogen\nx2navi.exe` through varied scenes (fights, towns, riding, building, the Depths, menus) for 20-30
+Play `build\v143-pgogen\nx2navi.exe` through varied scenes (fights, towns, riding, building, underground, menus) for 20-30
minutes; it is slower than a normal build. It writes `build\v143-pgogen\pgo\*.profraw` every minute and at exit.
Scripted runs from saves (`tools/run_game.py`) add to the same file. Then:
@@ -259,10 +259,9 @@ to `build\\shaders\` and runs it through the translator and `spirv-val`; fa
A change to the SM86 tensor lowering (`tools/xlate/AmpereLowering.cs` Hmma, Ldsm, Movm, Half) passes
`python tests\tensor_lowering_check.py`: it lowers GPU-captured vectors with `nx2navi_xlate --lower` and runs them on
-`tests\maxwell_warp_emu.py`, a model of what the Ryujinx translator makes of Maxwell code (the docstring names the
+`tests\maxwell_warp_emu.py`, a model of what the shader translator makes of Maxwell code (the docstring names the
vector file and what is checked). `tests\maxwell_warp_emu_selftest.py` checks the emulator itself. No game files.
## Reverse engineering (optional)
-- Ghidra 12.1.2 with Adubbz's Ghidra-Switch-Loader in `toolchain\ghidra\` (JDK 21) opens the game modules (NSO).
-- `tools\fetch_refs.sh` clones the upstream projects this port builds on into `refs\`, read-only.
+- Ghidra 12.1.2 with the Ghidra-Switch-Loader extension in `toolchain\ghidra\` (JDK 21) opens the game modules (NSO).
diff --git a/docs/installer.md b/docs/installer.md
index ab086eca..f8634574 100644
--- a/docs/installer.md
+++ b/docs/installer.md
@@ -51,7 +51,7 @@ loads the saves 1.4.3 wrote.
first install, 20 GiB after it), the CPU is at least x86-64-v2 (SSE4.2; with AVX2/FMA the faster `v3` build is used,
otherwise the `v2` one), a Vulkan 1.3 GPU exists. Each failure is one clear message.
2. **Fonts** with Chinese, Korean or Traditional Chinese text and a firmware folder: extract the Switch system fonts
- from the firmware into `shared-fonts/` (MacNativeGames' `extract_shared_fonts.py`, which verifies every NCA layer
+ from the firmware into `shared-fonts/` (`tools/vendor/macnativegames/extract_shared_fonts.py`, which verifies every NCA layer
and BFTTF header). Without a firmware folder the setup warns and goes on; the game then lacks those glyphs.
3. **Extract** ExeFS and RomFS into the install folder and verify the hashes.
4. **Lift** the ExeFS to C (`recomp/gen.py`, `recomp/patches-v121.txt` or `patches-v143.txt`) into a temp folder next
@@ -148,7 +148,7 @@ llvm/ llvm-mingw, x86_64-only subset (Apache-2.0 with LLVM excep
runtime/ libnx2navirt.a, libnx2navirt-v2.a and the headers the generated code and modules.c/romfs.c/patches.c
include
bin/ nx2navi_xlate.exe, hactool.exe, SDL3.dll, libopus-0.dll, ninja.exe
-data/ shader_list.tsv (MacNativeGames, MIT); pgo-.profdata + .json, the execution profile an
+data/ shader_list.tsv (MIT, THIRD_PARTY_NOTICES.md); pgo-.profdata + .json, the execution profile an
update's code and the runtime libraries compile with (building.md, "Profile-guided build")
THIRD_PARTY_NOTICES.md
nx2navi.ini.example, VERSION the default ini; the release string (the repository's VERSION plus the commit)
diff --git a/docs/maxwell.md b/docs/maxwell.md
index 7f3648be..a607d605 100644
--- a/docs/maxwell.md
+++ b/docs/maxwell.md
@@ -1,158 +1,112 @@
# Maxwell / NVN behaviour a port must reproduce
Reference for diagnosing graphics bugs. Each item: what Maxwell (GM20B, 3D class `B197`, compute `B1C0`) and NVN do,
-what Vulkan / AMD (RDNA4, our GPU0) do instead, how emulators and ports handle it, and the source. Items are ordered by
-how likely they are to cause visible artifacts. "Ours:" marks what our runtime does (grep-level look, see section 7;
-our code is cited by file and function). Licensing: the hardware/suyu are GPL, cited for behaviour only.
+what Vulkan / AMD (RDNA4, our GPU0) do instead, what goes wrong when the difference is ignored and what our runtime
+does, and the source. Items are ordered by how likely they are to cause visible artifacts. "Ours:" marks what our
+runtime does (grep-level look, see section 6; our code is cited by file and function).
Source shorthands:
- **OGD**: NVIDIA open-gpu-doc `classes/3d/clb197.h`, `classes/compute/clb1c0.h` (MIT-style),
- . Offsets below are method offsets in `clb197.h`.
-- **G80TEX**: Mesa nouveau `src/gallium/drivers/nouveau/nv50/g80_texture.xml.h` (MIT),
- .
-- **RYU-SU**: Ryujinx `Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs` (MIT), mirror at 1.1.1137:
- .
-- **RYU-SH**: Ryujinx shader translator vendored at `refs/MacNativeGames/vendor/ryujinx/src/Ryujinx.Graphics.Shader/`
- (Ryujinx 1.3.2, MIT). Paths below are relative to it.
-- **NXN**: nxnative's graphics notes, `refs/nxnative/docs/agents/` (MIT). nxnative has rewritten them since; each
- row states the behaviour and fix it took from them.
-- **MNG**: `refs/MacNativeGames` @ `b75be8cfa704df3701e86130c8ced268e79d6b11` (MIT); line numbers below are at that
- commit.
-- **DK3D**: `refs/deko3d` @ `373bfd43d8b2d805fa2eb7d406dbb823032df958` (zlib, fincs), the homebrew Maxwell driver for Switch. Written
- against the hardware, not the NVN API: what it programs is what the GPU needs. Paths relative to `source/`. `.def` files give
- methods as word indices (`engine_3d.def`); byte offset = index x 4, so `0x5A1` = OGD `0x1684`. No conditional rendering, no
- provoking-vertex conversion, no 8-bit indices in it.
-- **YZ-2305 / YZ-2306**: the hardware progress reports May / June 2023,
- ,
- (behaviour only).
+ . Offsets below are method offsets in `clb197.h`. Where a
+ method is given as a word index (`0x5A1`), the byte offset is index x 4, so `0x5A1` = OGD `0x1684`.
+- **XL**: the shader translator's source as `tools/build_xlate.py` patches it,
+ `build/xlate/ryujinx/src/Ryujinx.Graphics.Shader/`. Paths below are relative to it.
- **VKSPEC**: Vulkan 1.4 specification, ;
**GLSL450**: SPIR-V GLSL.std.450 extended instructions, .
## 1. Render targets
-| # | Maxwell / NVN | Vulkan / AMD | Emulators / ports | Source |
+| # | Maxwell / NVN | Vulkan / AMD | Effect / ours | Source |
|---|---|---|---|---|
-| 1.1 | **Colour target the fragment shader does not write keeps its old texel**, even with blending enabled. | Undefined value written/blended. | NXN: zero write mask and no blend for unwritten outputs (`reflection colors`). Already fixed here. | NXN; MNG `games//tests/metal_semantics/probe.m:5` |
-| 1.2 | **Unwritten vertex outputs read as (0, 0, 0, 1)** in the next stage, including the unwritten components of a partly written output (VS writes xyz, FS divides by w). | FS input with no VS output: interface mismatch, value undefined; an unwritten component of a written output is undefined (AMD: whatever the register holds, often 0). | Ryujinx initialises exactly the components the next stage reads, but only when stages are linked (`Translation/Translator.cs:212-227`, `NextInputAttributesComponents`); position starts (0,0,0,1) (`:259`). NXN Link's Awakening: sun shadow lookups divided by w = 0, scene dim, no shadows. Ours: missing outputs padded with (0, 0, 0, 1), unlinked outputs initialised by translator patch 0006 (section 7, check 2). | NXN |
-| 1.3 | **Clears honour the scissor and the clear's own channel / stencil write mask**, and may come between draws inside a pass. `SET_CLEAR_SURFACE_CONTROL` (0x10f8) has `RESPECT_STENCIL_MASK`, `USE_CLEAR_RECT`, `USE_SCISSOR0`, `USE_VIEWPORT_CLIP0`. | `vkCmdClearAttachments` takes a rect but **ignores the colour write mask**; load-op clears are whole-attachment. | NXN/MNG draw a triangle with the clear's mask (`clear_color_tri`, `clear_ds_tri`); NX2navi uses mid-pass, partial-mask and partial-scissor clears (NXN). the hardware: "red dot" was clears hitting the wrong RT index (YZ-2305, PR 10243). Hardware recipe (DK3D): `CLEAR_BUFFERS` (`0x674` = 0x19d0) carries the colour channel mask (bits 2-5), depth (0), stencil (1), target id (6-9) and layer (10-20) in one word; `ClearBufferFlags` (`0x43E` = 0x10f8) is set once to `StencilMask | Scissor` (`maxwell/gpu_3d_base.cpp:69`), so every clear is cut by scissor 0 and its stencil bits by the stencil front write mask register, and DK3D's colour clear does not program `ColorWriteMask` (`0x680`). A stencil clear writes `StencilFrontMask` (`0x4E7`) and `ClearStencil` (`0x368`) just before the clear and restores the shadowed state after (`gpu_3d_base.cpp:497-510`). Multisample raster is switched off around a colour clear (`:459, :465`). Arrays: an MME macro repeats the clear for every layer (`maxwell/clear_buffers.mme:5-22`). No pass concept: clears sit between draws. Ours: masked colour and stencil clears are **skipped** (check 3). | OGD 0x10f8; NXN; DK3D `maxwell/gpu_3d_base.cpp:444-512`, `engine_3d.def:305, 644` |
-| 1.4 | **Conditional rendering** (`SET_RENDER_ENABLE_A..C` 0x1550-0x1558, NVN `SetRenderEnableConditional`) compares two 64-bit counters at `addr` and `addr+16` on the GPU, in command order. NX2navi wraps nearly every clear in it. A `TIMESTAMP` report writes 0 to the counter field. | `VK_EXT_conditional_rendering` tests one 32-bit word against zero. | NXN: honouring it fixed the black 3D scene (light-volume depth never cleared). deko3d has no conditional rendering at all (no `SET_RENDER_ENABLE` in `engine_3d.def`), so it cannot settle the compare rule. Ours: evaluated on the CPU at record time; a report from an unfinished submission counts as 0 (check 5). | OGD; NXN |
-| 1.5 | **Depth mode** is runtime state: `nvnDeviceSetDepthMode` near = -w (GL, NVN default) or 0. Register `SET_VIEWPORT_Z_CLIP` (0x0d7c) `NEGATIVE_W_TO_POSITIVE_W` / `ZERO_TO_POSITIVE_W`. | Vulkan clips z < 0 unless `VK_EXT_depth_clip_control` `negativeOneToOne`. | Ryujinx infers the mode from the viewport transform, falling back to the register (`GetDepthMode`, RYU-SU). NXN: wrong mode either clips everything (black window) or puts all depth in 0.5..1 (DOF blurs the screen). Ours: `negativeOneToOne` from NVN state. DK3D programs both halves: `SetDepthMode` (`0x35F` = 0xd7c) selects the pre-transform clip range, and the viewport transform maps z to [near, far] itself: scale z = `0.5 * (far - near)` and offset z = `0.5 * (near + far)` for -1..1, scale `far - near` and offset `near` for 0..1 (`maxwell/gpu_3d_base.cpp:143-147, 336-343`). Same maths as Vulkan `negativeOneToOne`. | OGD 0x0d7c; NXN-64, NXN; DK3D `maxwell/gpu_3d_base.cpp:136-147, 321-362` |
-| 1.6 | **Depth clamp / clip**: `SET_VIEWPORT_CLIP_CONTROL` (0x193c) has separate `PIXEL_MIN_Z`/`PIXEL_MAX_Z` CLIP or CLAMP and geometry-clip modes. | `depthClampEnable` also disables z clipping (unless `VK_EXT_depth_clip_enable`). RADV had a dynamic depth clamp driver bug causing NX2navi vertex explosions. | Ryujinx: clamp = `!(clip & DepthClampDisabled)` (RYU-SU `UpdateDepthClampState`). the hardware disabled dynamic depth clamp on affected RADV (YZ-2305, PR 10262). DK3D has one switch, `depthClampEnable`, and writes `VIEW_VOLUME_CLIP_CONTROL` (`0x64F` = 0x193c) with `0x101A` when on and `0x181D` when off (default at setup is `0x181D`); it labels the bits "todo: figure out what this actually does". Bits 3-4 (`DepthClampNear/Far`) are set in both values, bits 0-2 and 11 differ. There is no separate depth-clip toggle. The viewport near/far registers (`Viewport` array words 2-3) carry the clamp range and are swapped when far < near (`:349-350`). Vulkan clamp to [min, max] of the viewport depth matches. | OGD 0x193c; DK3D `maxwell/gpu_3d_state.cpp:42`, `gpu_3d_base.cpp:135-139, 349-350`, `engine_3d.def:621` |
-| 1.7 | **Depth formats**: D24S8 is native; D24 quantises to 2^-24 everywhere in 0..1. Polygon offset units are in D24 steps for D24 targets; `SET_DEPTH_BIAS_CONTROL` (0x1110) `DEPTH_FORMAT_DEPENDENT`. | RX 9070 has no D24S8 attachment; D32F has finer steps near 0 and a per-primitive exponent-based r. EQUAL / LEQUAL tests between a pre-pass and a later pass, and decal biases, behave differently. | the hardware rescales depth-bias units when D24 is emulated as D32F; Ryujinx passes `units / 2` (register is twice the API value) (RYU-SU `UpdateDepthBiasState`). MNG: D16 load-clear 0.5 → 32767 vs fragment 0.5 → 32768 made object/Recall classification tiles visible. Ours: D24S8 → D32_SFLOAT_S8, bias not rescaled (check 4). DK3D writes `PolygonOffsetUnits` (`0x56F` = 0x15bc) as `constantFactor * 2.0f`, clamp to `0x61F`, factor to `0x55B` (`maxwell/gpu_3d_state.cpp:148-157`), confirming the x2 register. | OGD 0x1110, 0x15bc, 0x156c; MNG `docs/how-it-works.md:57-61`; DK3D `maxwell/gpu_3d_state.cpp:154` |
-| 1.8 | **Position invariance**: identical position math gives identical depth across programs (pre-pass then EQUAL / LEQUAL). | Only for outputs declared `Invariant`. | Ryujinx decorates position `Invariant` (`CodeGen/Spirv/Declarations.cs:571`) and marks float ops `NoContraction` unless `QueryHostReducedPrecision` (`CodeGen/Spirv/Instructions.cs:2047`). NXN: Odyssey ground z-fought without it; LA's foliage drawn with depth EQUAL vanished when the pre-pass failed. Ours: translator default (all NoContraction). | NXN |
-| 1.9 | **Sampling a texture that is also a bound render target**: Maxwell's texture cache is not coherent with ROP writes; NVN requires `nvnCommandBufferBarrier(INVALIDATE_TEXTURE)` between writing and sampling (methods `INVALIDATE_TEXTURE_DATA_CACHE` 0x1338, `..._NO_WFI` 0x1288). Reading a different level/layer, or read-only depth while testing, is fine. | Same image as attachment and sampled in one pass is a feedback loop: undefined unless `VK_EXT_attachment_feedback_loop_layout`; on AMD DCC/HTILE-compressed data is not readable by the sampler without decompression. | the hardware: pixelated object glow fixed with barriers on attachment feedback loops (YZ-2305, PR 10402). BotW black textures on GCN worked around with `AMD_DEBUG=nohyperz` (HTILE off) (). Ours: an NVN barrier ends the pass and inserts a full memory barrier; no detection of a sampled texture that is a current attachment (check 10). DK3D barrier recipe (`maxwell/gpu_base.cpp:49-115`): the ordering part and the cache part are separate. Ordering: Tiles = `TiledCacheBarrier` (`0x3DF`), Fragments = `FragmentBarrier` (`0x378`), Primitives = `WaitForIdle` (`0x44`), Full = gpfifo `SetReference` + new gpfifo entry with `NoPrefetch`, so later command and indirect-parameter fetch happens after everything finished. Tiles and Fragments need an implicit WFI before a cache invalidate. Caches (each opt-in): texture data `InvalidateTextureDataCache` (`0x3DD`, WFI) or `..NoWfi` (`0x4A2`); shader `InvalidateShaderCaches` (`0x369`: instruction, global data, constant); descriptors `InvalidateTextureHeaderCacheNoWfi` (`0x50A`) + `InvalidateSamplerCacheNoWfi` (`0x509`); zcull `0x4B2`; L2 gpfifo `MemOpB` `L2FlushDirty` + `L2SysmemInvalidate`. The texture-cache invalidate is its own flag; ordering alone does not refresh it. Every queue flush ends with image + shader + descriptor + L2 invalidation "to ensure the visibility of CPU updates between flushes" (`:28-47`): CPU writes into textures and descriptors reach the GPU at the next submit boundary, not mid-submit (2.2). | OGD; DK3D `maxwell/gpu_base.cpp:28-115` |
-| 1.10 | **Duplicate attachments**: the same texture bound at two colour slots with write mask 0 on one does not interfere (ROP writes only enabled channels). | Tile-based or compressed attachments may store the unwritten copy over the written one. | NXN BotW G-buffer (c1 = c2, c3 = c4): leaves the duplicate slot unattached (`rt_dup_slot`). | NXN |
-| 1.11 | **Per-target write masks**: `RtColorMask[i]`, or entry 0 for all when `RtColorMaskShared`. `SET_SINGLE_CT_WRITE_CONTROL` (0x0f90). A colour target with format 0 is disabled. | Per-attachment `colorWriteMask`. | RYU-SU `UpdateRtColorMask`, `IsRtEnabled` ("Colors are disabled by writing 0 to the format"). | OGD 0x0f90 |
-| 1.12 | **sRGB render target views**: NVN encodes on write when the view format is sRGB over a linear texture. Maxwell also has a global `SET_SRGB_WRITE` (0x15b8). | Format of the attachment view decides; needs `MUTABLE_FORMAT`. | NXN Mario: attaching the base texture stored linear values, picture darker. Ours: RT views take the view format (`view_format`). | OGD 0x15b8; NXN |
-| 1.13 | **Compressed and 3D targets**: agl's GPU BC4 encoder renders blocks through an `RGBA16UI` view, one plane of a 32×32×32 BC4 3D texture per pass. NVN renders a 3D texture slice by slice. | Needs `BLOCK_TEXEL_VIEW_COMPATIBLE` + `EXTENDED_USAGE`, `2D_ARRAY_COMPATIBLE`. | NXN shadow textures (`bcrt_attach`). the hardware: wrong block depth on 3D slices gave Gloom textures on terrain (YZ-2305, PR 10433). Already fixed here. | NXN |
-| 1.14 | **Draw with no render target** (fragment shader only writes an SSBO, 1×1 viewport) runs normally. | Needs an attachment-less pass with explicit render area. | NXN `bare_dims`: cave ambient light came back. Ours: area of viewport 0 (`vk_exec.c` `resolve_rt`). | NXN |
-| 1.15 | **Window origin**: NVN default lower-left (GL); NX2navi switches to upper-left. Y flip and scissor flip follow. | Vulkan upper-left; negative viewport height to flip. | Ryujinx flips scissor against screen height when Y-negate is on (RYU-SU `UpdateScissorState`). | NXN |
+| 1.1 | **Colour target the fragment shader does not write keeps its old texel**, even with blending enabled. | Undefined value written/blended. | Zero write mask and no blend for unwritten outputs. Already fixed here. | — |
+| 1.2 | **Unwritten vertex outputs read as (0, 0, 0, 1)** in the next stage, including the unwritten components of a partly written output (VS writes xyz, FS divides by w). | FS input with no VS output: interface mismatch, value undefined; an unwritten component of a written output is undefined (AMD: whatever the register holds, often 0). | The translator initialises exactly the components the next stage reads, but only when stages are linked (XL `Translation/Translator.cs:212-227`, `NextInputAttributesComponents`); position starts (0,0,0,1) (`:259`). Symptom: sun shadow lookups divided by w = 0, scene dim, no shadows. Ours: missing outputs padded with (0, 0, 0, 1), unlinked outputs initialised by translator patch 0006 (section 6, check 2). | XL |
+| 1.3 | **Clears honour the scissor and the clear's own channel / stencil write mask**, and may come between draws inside a pass. `SET_CLEAR_SURFACE_CONTROL` (0x10f8) has `RESPECT_STENCIL_MASK`, `USE_CLEAR_RECT`, `USE_SCISSOR0`, `USE_VIEWPORT_CLIP0`. | `vkCmdClearAttachments` takes a rect but **ignores the colour write mask**; load-op clears are whole-attachment. | A triangle drawn with the clear's mask reproduces it. NX2navi uses mid-pass, partial-mask and partial-scissor clears. Hardware recipe: `CLEAR_BUFFERS` (`0x674` = 0x19d0) carries the colour channel mask (bits 2-5), depth (0), stencil (1), target id (6-9) and layer (10-20) in one word; with `ClearBufferFlags` (`0x43E` = 0x10f8) set once to `StencilMask \| Scissor`, every clear is cut by scissor 0 and its stencil bits by the stencil front write mask register, and a colour clear does not program `ColorWriteMask` (`0x680`). A stencil clear writes `StencilFrontMask` (`0x4E7`) and `ClearStencil` (`0x368`) just before the clear and restores the shadowed state after. Multisample raster is switched off around a colour clear. Arrays: a macro repeats the clear for every layer. No pass concept: clears sit between draws. Ours: masked colour and stencil clears are **skipped** (check 3). | OGD 0x10f8, 0x19d0 |
+| 1.4 | **Conditional rendering** (`SET_RENDER_ENABLE_A..C` 0x1550-0x1558, NVN `SetRenderEnableConditional`) compares two 64-bit counters at `addr` and `addr+16` on the GPU, in command order. NX2navi wraps nearly every clear in it. A `TIMESTAMP` report writes 0 to the counter field. | `VK_EXT_conditional_rendering` tests one 32-bit word against zero. | Ignoring it leaves light-volume depth uncleared: black 3D scene. Ours: evaluated on the CPU at record time; a report from an unfinished submission counts as 0 (check 5). | OGD |
+| 1.5 | **Depth mode** is runtime state: `nvnDeviceSetDepthMode` near = -w (GL, NVN default) or 0. Register `SET_VIEWPORT_Z_CLIP` (0x0d7c) `NEGATIVE_W_TO_POSITIVE_W` / `ZERO_TO_POSITIVE_W`. | Vulkan clips z < 0 unless `VK_EXT_depth_clip_control` `negativeOneToOne`. | The wrong mode either clips everything (black window) or puts all depth in 0.5..1 (depth of field blurs the screen). Ours: `negativeOneToOne` from NVN state. The hardware is programmed in two halves: `SetDepthMode` (`0x35F` = 0xd7c) selects the pre-transform clip range, and the viewport transform maps z to [near, far] itself: scale z = `0.5 * (far - near)` and offset z = `0.5 * (near + far)` for -1..1, scale `far - near` and offset `near` for 0..1. Same maths as Vulkan `negativeOneToOne`. | OGD 0x0d7c |
+| 1.6 | **Depth clamp / clip**: `SET_VIEWPORT_CLIP_CONTROL` (0x193c) has separate `PIXEL_MIN_Z`/`PIXEL_MAX_Z` CLIP or CLAMP and geometry-clip modes. | `depthClampEnable` also disables z clipping (unless `VK_EXT_depth_clip_enable`). RADV had a dynamic depth clamp driver bug causing vertex explosions. | One depth-clamp switch is enough: `VIEW_VOLUME_CLIP_CONTROL` (`0x64F` = 0x193c) is written as `0x101A` with clamp on and `0x181D` with clamp off (`0x181D` is the default at setup). Bits 3-4 (`DepthClampNear/Far`) are set in both values, bits 0-2 and 11 differ. There is no separate depth-clip toggle. The viewport near/far registers (`Viewport` array words 2-3) carry the clamp range and are swapped when far < near. Vulkan clamp to [min, max] of the viewport depth matches. | OGD 0x193c |
+| 1.7 | **Depth formats**: D24S8 is native; D24 quantises to 2^-24 everywhere in 0..1. Polygon offset units are in D24 steps for D24 targets; `SET_DEPTH_BIAS_CONTROL` (0x1110) `DEPTH_FORMAT_DEPENDENT`. | RX 9070 has no D24S8 attachment; D32F has finer steps near 0 and a per-primitive exponent-based r. EQUAL / LEQUAL tests between a pre-pass and a later pass, and decal biases, behave differently. | Depth-bias units need rescaling when D24 is emulated as D32F; the register holds twice the API value. A D16 load-clear of 0.5 stores 32767 while a fragment depth of 0.5 stores 32768, so depth EQUAL against cleared depth shows tiles. Ours: D24S8 → D32_SFLOAT_S8, bias not rescaled (check 4). `PolygonOffsetUnits` (`0x56F` = 0x15bc) is written as `constantFactor * 2.0f`, the clamp to `0x61F`, the factor to `0x55B`. | OGD 0x1110, 0x15bc, 0x156c |
+| 1.8 | **Position invariance**: identical position math gives identical depth across programs (pre-pass then EQUAL / LEQUAL). | Only for outputs declared `Invariant`. | The translator decorates position `Invariant` (XL `CodeGen/Spirv/Declarations.cs:571`) and marks float ops `NoContraction` unless `QueryHostReducedPrecision` (XL `CodeGen/Spirv/Instructions.cs:2047`). Without it ground z-fights, and foliage drawn with depth EQUAL vanishes when the pre-pass differs. Ours: translator default (all NoContraction). | XL |
+| 1.9 | **Sampling a texture that is also a bound render target**: Maxwell's texture cache is not coherent with ROP writes; NVN requires `nvnCommandBufferBarrier(INVALIDATE_TEXTURE)` between writing and sampling (methods `INVALIDATE_TEXTURE_DATA_CACHE` 0x1338, `..._NO_WFI` 0x1288). Reading a different level/layer, or read-only depth while testing, is fine. | Same image as attachment and sampled in one pass is a feedback loop: undefined unless `VK_EXT_attachment_feedback_loop_layout`; on AMD DCC/HTILE-compressed data is not readable by the sampler without decompression. | Without barriers on attachment feedback loops, glow effects come out pixelated. On GCN, HTILE-compressed depth samples as black textures; `AMD_DEBUG=nohyperz` (HTILE off) avoids it. Ours: an NVN barrier ends the pass and inserts a full memory barrier; no detection of a sampled texture that is a current attachment (check 10). Barrier recipe: the ordering part and the cache part are separate. Ordering: Tiles = `TiledCacheBarrier` (`0x3DF`), Fragments = `FragmentBarrier` (`0x378`), Primitives = `WaitForIdle` (`0x44`), Full = gpfifo `SetReference` + new gpfifo entry with `NoPrefetch`, so later command and indirect-parameter fetch happens after everything finished. Tiles and Fragments need an implicit WFI before a cache invalidate. Caches (each opt-in): texture data `InvalidateTextureDataCache` (`0x3DD`, WFI) or `..NoWfi` (`0x4A2`); shader `InvalidateShaderCaches` (`0x369`: instruction, global data, constant); descriptors `InvalidateTextureHeaderCacheNoWfi` (`0x50A`) + `InvalidateSamplerCacheNoWfi` (`0x509`); zcull `0x4B2`; L2 gpfifo `MemOpB` `L2FlushDirty` + `L2SysmemInvalidate`. The texture-cache invalidate is its own flag; ordering alone does not refresh it. A queue flush that ends with image + shader + descriptor + L2 invalidation makes CPU updates visible between flushes: CPU writes into textures and descriptors reach the GPU at the next submit boundary, not mid-submit (2.2). | OGD |
+| 1.10 | **Duplicate attachments**: the same texture bound at two colour slots with write mask 0 on one does not interfere (ROP writes only enabled channels). | Tile-based or compressed attachments may store the unwritten copy over the written one. | A G-buffer with c1 = c2, c3 = c4 shows scattered squares in albedo; leaving the duplicate slot unattached fixes it. | — |
+| 1.11 | **Per-target write masks**: `RtColorMask[i]`, or entry 0 for all when `RtColorMaskShared`. `SET_SINGLE_CT_WRITE_CONTROL` (0x0f90). A colour target with format 0 is disabled. | Per-attachment `colorWriteMask`. | Writing 0 to a target's format disables it. | OGD 0x0f90 |
+| 1.12 | **sRGB render target views**: NVN encodes on write when the view format is sRGB over a linear texture. Maxwell also has a global `SET_SRGB_WRITE` (0x15b8). | Format of the attachment view decides; needs `MUTABLE_FORMAT`. | Attaching the base texture stores linear values: picture darker. Ours: RT views take the view format (`view_format`). | OGD 0x15b8 |
+| 1.13 | **Compressed and 3D targets**: agl's GPU BC4 encoder renders blocks through an `RGBA16UI` view, one plane of a 32×32×32 BC4 3D texture per pass. NVN renders a 3D texture slice by slice. | Needs `BLOCK_TEXEL_VIEW_COMPATIBLE` + `EXTENDED_USAGE`, `2D_ARRAY_COMPATIBLE`. | Shadow textures are drawn this way. A wrong block depth on 3D slices gives wrong textures on terrain. Already fixed here. | — |
+| 1.14 | **Draw with no render target** (fragment shader only writes an SSBO, 1×1 viewport) runs normally. | Needs an attachment-less pass with explicit render area. | Skipping such draws loses cave ambient light and leaves a bloom halo. Ours: area of viewport 0 (`vk_exec.c` `resolve_rt`). | — |
+| 1.15 | **Window origin**: NVN default lower-left (GL); NX2navi switches to upper-left. Y flip and scissor flip follow. | Vulkan upper-left; negative viewport height to flip. | The scissor flips against the screen height when Y-negate is on. | — |
| 1.16 | **Multiple viewports / scissors** (16), selected by `ViewportIndex` output. | Needs `multiViewport` and `shaderOutputViewportIndex`. | Ours: one viewport, one scissor; differing scissors logged (`nvn_api_cmd.c`). | OGD 0x192c |
-| 1.17 | **Fragment output saturation** per target: `SET_PS_SATURATE` (0x13a8) clamps output n to 0..1 or -1..1 in fixed function. NVN does not expose it (GLSLC emits `.SAT` in code). | None. | Not emulated by Ryujinx; listed so a clamp difference is not chased in the wrong place. | OGD 0x13a8 |
-| 1.18 | **New memory reads as zero** (fresh pool pages); feedback effects never clear their state texture. | New image content undefined. | NXN `tex_zero_fill`. | NXN |
-| 1.19 | **MSAA**: `nvnCommandBufferDownsample` resolves; depth-stencil downsamples are copies the game does itself. | `vkCmdResolveImage` colour only; integer formats pick one sample. | NXN LA: stencil lost in the half-size depth copy, no AO. | NXN |
+| 1.17 | **Fragment output saturation** per target: `SET_PS_SATURATE` (0x13a8) clamps output n to 0..1 or -1..1 in fixed function. NVN does not expose it (GLSLC emits `.SAT` in code). | None. | Not emulated; listed so a clamp difference is not chased in the wrong place. | OGD 0x13a8 |
+| 1.18 | **New memory reads as zero** (fresh pool pages); feedback effects never clear their state texture. | New image content undefined. | New textures need a zero fill. | — |
+| 1.19 | **MSAA**: `nvnCommandBufferDownsample` resolves; depth-stencil downsamples are copies the game does itself. | `vkCmdResolveImage` colour only; integer formats pick one sample. | Losing the stencil in a half-size depth copy removes ambient occlusion. | — |
## 2. Textures and samplers
-| # | Maxwell / NVN | Vulkan / AMD | Emulators / ports | Source |
+| # | Maxwell / NVN | Vulkan / AMD | Effect / ours | Source |
|---|---|---|---|---|
-| 2.1 | **Automatic block height**: NVN truncates `height_in_blocks * 1.5 / 8` before picking the GOB power of two (deko3d rounds up). Wrong H reads padding: 160×160 BC3 warp pad half black. Allocation size is the same, so size checks do not catch it. Mip levels shrink the block height while the level fits in half of it. | Opaque optimal tiling. | MNG fixed (40 SDK-measured cases, `games//tests/texture_auto_layout/probe.c`). Ours: truncating form already (`runtime/nvn_tex.c`, the block-height pick). DK3D reads: height in block rows (rounded up), x 1.5, then `(h + 7) / 8` rounded up, then the largest power of two <= that, capped at 16 GOBs (`dk_image.cpp:444-447`, `pickTileSize` `:13-20`); 3D uses `depth + depth / 2` directly as the GOB count (`:451-454`); video images are fixed at 2 GOBs (`:438`). Per level, the shift drops while `unit << (shift - 1) >= level dimension` with unit 8 rows / 1 slice (`adjustTileSize` `:23-37`, used at `:89-91`), width tile is always 0. Array layers are padded to the block shrunk to the full height / depth (`alignLayerSize` `:57-72`). Every one of these matches `nvn_tex.c` except the rounding. | MNG `docs/how-it-works.md:47-53`; DK3D `dk_image.cpp:13-37, 57-72, 80-103, 436-455` |
-| 2.2 | **Textures filled by the CPU with no NVN flush** (NX2navi terrain: two 121-layer ASTC 8×8 arrays, 42 MB each; BC4 material textures read back with `ReadTexels` and copied into a 5120×5120 roughness atlas). The CPU and GPU share memory, so no flush is needed on the Switch. | Host images are copies; must detect CPU writes. | NXN write-protects texture pages (`tex_dirty_upload`); zero ASTC decodes magenta, zero BC black. the hardware: small CPU writes into GPU-used pages not invalidated gave slow rain/snow particles and teleport particle corruption (YZ-2306, PR 10942). Ours: `GetWriteWatch` generations (`vk_memory.c`, `mem_written_pages`). | NXN-175 |
-| 2.3 | **Same storage, new texture object every frame** (transient targets, deferred handles). Same storage with a different descriptor reinterprets the same block-linear bytes. | Two `VkImage`s over one allocation with optimal tiling do not share a defined layout (AMD tiling and DCC metadata are per image); a new image starts `UNDEFINED`. | NXN shares host textures by `(pool, offset, description)`; MNG keeps a "live texture at address" redirect. the hardware: whole areas black for a frame on camera changes from texture-cache alias/overlap ordering (YZ-2305, PR 10418). Ours: GPU-only pool textures are `VkImage`s bound onto pool memory (check 7). | NXN; MNG `docs/how-it-works.md:67-71` |
-| 2.4 | **Deferred texture handles** (`BindTexturesDeferred`): the GPU reads the handle from memory when the command runs; BotW records command blocks once and writes handles later. | n/a | NXN BotW: handles copied at record time were zero, 3D scene black. | NXN |
-| 2.5 | **Border colours**: any RGBA (TSC words 4-7, plus sRGB border fields). NX2navi/BotW grass interaction map clamps to (0.5, 0.5, 0.5, 0.5), its "untouched" value. | Three fixed colours unless `VK_EXT_custom_border_color` (+ `customBorderColorWithoutFormat`); integer formats need `INT_CUSTOM`. | MNG emulates in the shader; with transparent black, grass away from the player lay flat and showed no cut (MNG issue #49). Ours: custom border when supported, else transparent black (check 11). | G80TEX; MNG `games//third_party/d2r_gfx/gfx/nvn/nvn_mtl.m:5041-5045` |
-| 2.6 | **sRGB decode** is a TIC bit (`G80_TIC_2_SRGB_CONVERSION`) separate from the format; TSC has its own `SRGB_CONVERSION` (word 0 bit 13). NVN exposes sRGB as formats. | Format decides. | NVN-level translation by format is enough. | G80TEX:197, :377 |
-| 2.7 | **Swizzles** per texture and per view (`TextureBuilderSetSwizzle`, `TextureViewSetSwizzle`); BotW layout captures rebuild a texture on the same storage with (1, 1, 1, R) or alpha 1. Default per-format mapping R8 → (R, 0, 0, 1). | `VkComponentMapping` on the view. | NXN: font atlas white boxes, HUD dark boxes without it. Ours: mapped (`vk_exec_draw.c` `get_view`). | NXN |
-| 2.8 | **Sample dimension comes from the instruction**: a non-array sample of an array texture reads layer 0; 1,512 BotW shaders sample a cube as a cube array. | View type must match the declared type. | NXN: 2D array bound as 2D gave one pale colour (washed-out scene); cubes created as 6-layer arrays with cube / cube-array views. Ours: views per resource type (`get_view`). | NXN |
-| 2.9 | **LOD**: TSC min/max LOD clamp, LOD bias, `TWO_D_NO_MIPMAP` texture type, a min filter without mips stays on the base level; TIC carries its own max anisotropy and aniso quality fields. | `minLod`/`maxLod`, `mipLodBias` limited by `maxSamplerLodBias`. | the hardware: anisotropy heuristics for mods forcing trilinear (YZ-2306, PR 10744). Ours: non-mip filter → `maxLod = minLod + 0.25`, bias clamped (`vk_texture.c` `make_sampler`). | G80TEX |
-| 2.10 | **Texture gather rounding**: Maxwell sub-texel precision differs from AMD/Intel; edge texels picked by TLD4 differ by one. | Implementation-defined `subTexelPrecisionBits`. | the hardware adds a sub-pixel offset to gathers on non-NVIDIA hosts: fixed BotW shadow artifacts at object edges ("shader_recompiler: Add subpixel offset for correct rounding at ImageGather", , title only). Ours: the translator biases gather coordinates by the host's `subTexelPrecisionBits` on every non-NVIDIA GPU (`vk_caps.c` → job `gather_bias` → Ryujinx `TexturePass.InsertCoordGatherBias`); NX2navi on RADV drew dashed dark lines along wall and floor edges in the prologue caves without it. `NX2NAVI_GATHER_BIAS=0` turns it off. | — |
-| 2.11 | **Gather offsets**: `TLD4.PTP` takes four per-texel offsets, possibly from registers. | `ConstOffsets` must be constant. | Ours: `QueryHostSupportsNonConstantTextureOffset() => false` makes Ryujinx emulate register offsets (`tools/xlate/Program.cs`). | RYU-SH `Translation/Optimizations` (TexturePass) |
-| 2.13 | **TXD gradient register order**: NX2navi's terrain shaders fill the gradient registers of a `TXD` per coordinate (du/dx, du/dy, dv/dx, dv/dy). | Vulkan's `Grad` takes dPdx (du/dx, dv/dx) and dPdy (du/dy, dv/dy). | Ryujinx's `EmitTxd` takes the first two registers as dPdx and the last two as dPdy, so the mip level came from the wrong derivatives and was too sharp on terrain faces turned across the screen: patches that followed the faces crawled when the camera moved (1.4.3, the Depths; found by the user from their F9 frame, a gradient sample's coordinate and gradients traced back to `DPdx` and `DPdy` of the interpolants). Ours: `gfx_shader.c` `patch_txd_transpose` swaps the two inner components of every two-component gradient pair in the loaded SPIR-V (the shader cache is untouched). `NX2NAVI_TXD_TRANSPOSE=0` turns it off. Only 2D gradients are handled; 3D and cube ones are left as translated. | — |
-| 2.12 | **Depth compare** (`TSC` depth compare + `TIC_4_DEPTH_TEXTURE`), min/max reduction filtering. | `compareEnable`; reduction mode needs `samplerFilterMinmax` and is not allowed with compare. | Ours: reduction dropped when compare is on (`vk_texture.c` `make_sampler`). | G80TEX |
-| 2.13 | **ASTC / BC**: native ASTC; zero ASTC block = error colour on hosts. | AMD and NVIDIA desktop GPUs lack ASTC: decode to RGBA8. the hardware offered ASTC recompression to BC1/BC3 for low VRAM (YZ-2305, PR 10398). | Ours: native upload where the device samples ASTC, else a compute-shader decode (`vk_astc.c`, `NX2NAVI_ASTC`), CPU decode (`tex_astc.c`) as the fallback. | `runtime/vk_astc.c` |
-| 2.14 | **Linear CPU-written textures** (`FLAGS_LINEAR`, small ramps, glyph caches): CPU writes visible to the GPU directly. | Must re-upload or use linear images over host memory. | NXN Mario: sky black without its 64×1 RGBA16F ramps. | NXN |
+| 2.1 | **Automatic block height**: NVN truncates `height_in_blocks * 1.5 / 8` before picking the GOB power of two; rounding up instead is wrong. Wrong H reads padding: a 160×160 BC3 texture draws half black. Allocation size is the same, so size checks do not catch it. Mip levels shrink the block height while the level fits in half of it. | Opaque optimal tiling. | Checked against 40 SDK-measured cases. Ours: truncating form already (`runtime/nvn_tex.c`, the block-height pick). The rest of the layout: height in block rows (rounded up), x 1.5, then `/ 8`, then the largest power of two <= that, capped at 16 GOBs; 3D uses `depth + depth / 2` directly as the GOB count; video images are fixed at 2 GOBs. Per level, the shift drops while `unit << (shift - 1) >= level dimension` with unit 8 rows / 1 slice; width tile is always 0. Array layers are padded to the block shrunk to the full height / depth. `nvn_tex.c` matches every one of these. | — |
+| 2.2 | **Textures filled by the CPU with no NVN flush** (NX2navi terrain: two 121-layer ASTC 8×8 arrays, 42 MB each; BC4 material textures read back with `ReadTexels` and copied into a 5120×5120 roughness atlas). The CPU and GPU share memory, so no flush is needed on the Switch. | Host images are copies; must detect CPU writes. | Write-protecting texture pages catches the writes; without an upload, zero ASTC decodes magenta, zero BC black, and a roughness atlas built from never-uploaded BC4 leaves stone unlit by torches. Small CPU writes into GPU-used pages that are not invalidated give slow rain/snow particles and particle corruption after a teleport. Ours: `GetWriteWatch` generations (`vk_memory.c`, `mem_written_pages`). | — |
+| 2.3 | **Same storage, new texture object every frame** (transient targets, deferred handles). Same storage with a different descriptor reinterprets the same block-linear bytes. | Two `VkImage`s over one allocation with optimal tiling do not share a defined layout (AMD tiling and DCC metadata are per image); a new image starts `UNDEFINED`. | Sharing host textures by `(pool, offset, description)`, or redirecting to the live texture at an address, keeps the bytes together. Wrong alias/overlap ordering in a texture cache blacks out whole areas for a frame on camera changes. Ours: GPU-only pool textures are `VkImage`s bound onto pool memory (check 7). | — |
+| 2.4 | **Deferred texture handles** (`BindTexturesDeferred`): the GPU reads the handle from memory when the command runs; a game may record command blocks once and write handles later. | n/a | Handles copied at record time are zero: 3D scene black. | — |
+| 2.5 | **Border colours**: any RGBA (TSC words 4-7, plus sRGB border fields). The grass interaction map clamps to (0.5, 0.5, 0.5, 0.5), its "untouched" value. | Three fixed colours unless `VK_EXT_custom_border_color` (+ `customBorderColorWithoutFormat`); integer formats need `INT_CUSTOM`. | Emulating it in the shader works; with transparent black, grass away from the player lies flat and shows no cut. Ours: custom border when supported, else transparent black (check 11). | — |
+| 2.6 | **sRGB decode** is a TIC bit (`G80_TIC_2_SRGB_CONVERSION`) separate from the format; TSC has its own `SRGB_CONVERSION` (word 0 bit 13). NVN exposes sRGB as formats. | Format decides. | NVN-level translation by format is enough. | — |
+| 2.7 | **Swizzles** per texture and per view (`TextureBuilderSetSwizzle`, `TextureViewSetSwizzle`); layout captures may rebuild a texture on the same storage with (1, 1, 1, R) or alpha 1. Default per-format mapping R8 → (R, 0, 0, 1). | `VkComponentMapping` on the view. | Without it: font atlas white boxes, HUD dark boxes, a black stamina wheel. Ours: mapped (`vk_exec_draw.c` `get_view`). | — |
+| 2.8 | **Sample dimension comes from the instruction**: a non-array sample of an array texture reads layer 0; shaders may sample a cube as a cube array. | View type must match the declared type. | A 2D array bound as 2D gives one pale colour (washed-out scene); cubes created as 6-layer arrays with cube / cube-array views work. Ours: views per resource type (`get_view`). | — |
+| 2.9 | **LOD**: TSC min/max LOD clamp, LOD bias, `TWO_D_NO_MIPMAP` texture type, a min filter without mips stays on the base level; TIC carries its own max anisotropy and aniso quality fields. | `minLod`/`maxLod`, `mipLodBias` limited by `maxSamplerLodBias`. | Ours: non-mip filter → `maxLod = minLod + 0.25`, bias clamped (`vk_texture.c` `make_sampler`). | — |
+| 2.10 | **Texture gather rounding**: Maxwell sub-texel precision differs from AMD/Intel; edge texels picked by TLD4 differ by one. | Implementation-defined `subTexelPrecisionBits`. | A sub-pixel offset on gathers on non-NVIDIA hosts fixes shadow artifacts at object edges. Ours: the translator biases gather coordinates by the host's `subTexelPrecisionBits` on every non-NVIDIA GPU (`vk_caps.c` → job `gather_bias` → XL `TexturePass.InsertCoordGatherBias`); without it RADV drew dashed dark lines along wall and floor edges that changed with the camera angle. `NX2NAVI_GATHER_BIAS=0` turns it off. | — |
+| 2.11 | **Gather offsets**: `TLD4.PTP` takes four per-texel offsets, possibly from registers. | `ConstOffsets` must be constant. | Ours: `QueryHostSupportsNonConstantTextureOffset() => false` makes the translator emulate register offsets (`tools/xlate/Program.cs`). | XL `Translation/Optimizations` (TexturePass) |
+| 2.13 | **TXD gradient register order**: NX2navi's terrain shaders fill the gradient registers of a `TXD` per coordinate (du/dx, du/dy, dv/dx, dv/dy). | Vulkan's `Grad` takes dPdx (du/dx, dv/dx) and dPdy (du/dy, dv/dy). | The translator's `EmitTxd` takes the first two registers as dPdx and the last two as dPdy, so the mip level came from the wrong derivatives and was too sharp on terrain faces turned across the screen: patches that followed the faces crawled when the camera moved (found from an F9 frame: a gradient sample's coordinate and gradients traced back to `DPdx` and `DPdy` of the interpolants). Ours: `gfx_shader.c` `patch_txd_transpose` swaps the two inner components of every two-component gradient pair in the loaded SPIR-V (the shader cache is untouched). `NX2NAVI_TXD_TRANSPOSE=0` turns it off. Only 2D gradients are handled; 3D and cube ones are left as translated. | — |
+| 2.12 | **Depth compare** (`TSC` depth compare + `TIC_4_DEPTH_TEXTURE`), min/max reduction filtering. | `compareEnable`; reduction mode needs `samplerFilterMinmax` and is not allowed with compare. | Ours: reduction dropped when compare is on (`vk_texture.c` `make_sampler`). | — |
+| 2.13 | **ASTC / BC**: native ASTC; zero ASTC block = error colour on hosts. | AMD and NVIDIA desktop GPUs lack ASTC: decode to RGBA8. | Ours: native upload where the device samples ASTC, else a compute-shader decode (`vk_astc.c`, `NX2NAVI_ASTC`), CPU decode (`tex_astc.c`) as the fallback. | `runtime/vk_astc.c` |
+| 2.14 | **Linear CPU-written textures** (`FLAGS_LINEAR`, small ramps, glyph caches): CPU writes visible to the GPU directly. | Must re-upload or use linear images over host memory. | Without them a sky drawn from 64×1 RGBA16F ramps is black. | — |
## 3. Shader math
-| # | Maxwell | Vulkan / AMD | Emulators / ports | Source |
+| # | Maxwell | Vulkan / AMD | Effect / ours | Source |
|---|---|---|---|---|
-| 3.1 | **FMNMX and `.SAT` with NaN return the other operand / 0** (IEEE minNum). Games rely on this to stop NaN spreading (one NaN pixel blown up by bloom or temporal passes flickers or fills the screen). | `GLSL.std.450 FMin/FMax/FClamp`: result undefined when an operand is NaN (NMin/NMax are the NaN-dropping forms). AMD hardware min/max usually drops NaN; the compiler may still assume no NaN. | Ryujinx emits FMin/FMax/FClamp (`CodeGen/Spirv/Instructions.cs:336, 956, 972`; saturate = FClamp 0..1, `Instructions/InstEmitAluHelper.cs:419-423`). NXN translated shaders use `isnan` selects; MNG measured Metal min/max/saturate drop NaN (`probe.m:1-4`). | GLSL450; NXN |
-| 3.2 | **FMZ multiply mode** (`FMUL/FFMA/...` field `Fmz`, `.FMZ`): 0 × anything = 0, including Inf/NaN (DX9 rule). | IEEE: 0 × Inf = NaN. | Ryujinx decodes `Fmz` (`Decoders/InstDecoders.cs:306-309, 1901`) but no emitter reads it. Ours: same. Census needed (check 13). | RYU-SH |
-| 3.3 | **Denormals**: per-instruction `.FTZ`. | AMD flushes fp32 denormals by default; `VK_KHR_shader_float_controls` sets it per shader. | Ryujinx ignores `.FTZ`. Low risk. | RYU-SH (no `Ftz` use in `Instructions/`) |
-| 3.4 | **Warp size 32**: `SHFL`, `VOTE`, `S2R LANEID`, ballots are 32-bit. | AMD RDNA runs wave32 or wave64 per shader (the driver chooses; RADV fragment default wave64); `VK_EXT_subgroup_size_control` `requiredSubgroupSize = 32` fixes it. | Ryujinx adapts lane masks to `QueryHostSubgroupSize()` (default 32, `IGpuAccessor.cs:218`; `Instructions/InstEmitWarp.cs:72, 106`, `InstEmitMove.cs:175-185`). Ours: not overridden, no required size (check 6). | (`RADV_PERFTEST=pswave32`) |
-| 3.5 | **Discard (`KIL`)** keeps the quad's derivatives valid (demote semantics). | `OpKill` terminates; later derivatives in the quad undefined. | Ryujinx emits `OpKill` (`CodeGen/Spirv/Instructions.cs:508`). | — |
+| 3.1 | **FMNMX and `.SAT` with NaN return the other operand / 0** (IEEE minNum). Games rely on this to stop NaN spreading (one NaN pixel blown up by bloom or temporal passes flickers or fills the screen). | `GLSL.std.450 FMin/FMax/FClamp`: result undefined when an operand is NaN (NMin/NMax are the NaN-dropping forms). AMD hardware min/max usually drops NaN; the compiler may still assume no NaN. | The translator emits FMin/FMax/FClamp (XL `CodeGen/Spirv/Instructions.cs:336, 956, 972`; saturate = FClamp 0..1, `Instructions/InstEmitAluHelper.cs:419-423`). `isnan` selects give the Maxwell result. | GLSL450 |
+| 3.2 | **FMZ multiply mode** (`FMUL/FFMA/...` field `Fmz`, `.FMZ`): 0 × anything = 0, including Inf/NaN (DX9 rule). | IEEE: 0 × Inf = NaN. | The translator decodes `Fmz` (XL `Decoders/InstDecoders.cs:306-309, 1901`) but no emitter reads it. Ours: same. Census needed (check 13). | XL |
+| 3.3 | **Denormals**: per-instruction `.FTZ`. | AMD flushes fp32 denormals by default; `VK_KHR_shader_float_controls` sets it per shader. | The translator ignores `.FTZ`. Low risk. | XL (no `Ftz` use in `Instructions/`) |
+| 3.4 | **Warp size 32**: `SHFL`, `VOTE`, `S2R LANEID`, ballots are 32-bit. | AMD RDNA runs wave32 or wave64 per shader (the driver chooses; RADV fragment default wave64); `VK_EXT_subgroup_size_control` `requiredSubgroupSize = 32` fixes it. | The translator adapts lane masks to `QueryHostSubgroupSize()` (default 32, XL `IGpuAccessor.cs:218`; `Instructions/InstEmitWarp.cs:72, 106`, `InstEmitMove.cs:175-185`). Ours: not overridden, no required size (check 6). | (`RADV_PERFTEST=pswave32`) |
+| 3.5 | **Discard (`KIL`)** keeps the quad's derivatives valid (demote semantics). | `OpKill` terminates; later derivatives in the quad undefined. | The translator emits `OpKill` (XL `CodeGen/Spirv/Instructions.cs:508`). | — |
| 3.6 | **Implicit-LOD sampling in divergent control flow** works on Maxwell (TEX unit uses quad neighbours). | Undefined in non-uniform control flow; AMD whole-quad mode usually works. | — | VKSPEC (derivatives) |
| 3.7 | **Integer division** does not exist (compiled to `XMAD`/`IMAD` sequences); MUFU.RCP(0) = +Inf, LG2(0) = -Inf. | Same IEEE edge cases through `1/x`, `Log2`. | Low risk. | — |
-| 3.8 | **FP64** in some NX2navi cutscene shaders. | No FP64 on some hosts. | the hardware FP64 → FP32 (YZ-2306, PR 10693); ours: `softfloat64` job flag (`tools/xlate/Program.cs` `QueryHostSupportsShaderFloat64`). | — |
-| 3.9 | **Integer vertex inputs read as raw bits** (bone indices `R8UI`). | Float-declared inputs convert integers. | NXN Mario: stretched characters; re-translated with `uint` inputs. Ours: attribute types passed to `QueryGraphicsState` (`Program.cs`). | NXN |
-| 3.10 | **BFE / BFI fields past bit 31** (as PTX `bfe` / `bfi`): a field that runs past bit 31 is cut there; one that starts past it extracts 0 (signed: bit 31 repeated) and inserts nothing. NX2navi 1.4.3's Depths terrain vertex shaders (42 variants) take the position from a register, `((2y + x) * 8) & 0xff` with 5-bit x and y, so up to 248. | `OpBitField*Extract` / `OpBitFieldInsert` undefined when offset or offset + count exceeds 32; AMD's bitfield instructions take offset and width modulo 32. | Ryujinx passes the fields through. UltraTears saw the Depths walls and ground missing on the Steam Deck and a Linux RX 570 (RADV). Ours: clamped where the field is not a constant inside the word (translator patch 0012). RX 9070 on Windows drew the Depths the same before and after. | PTX ISA `bfe`, `bfi` |
-| 3.11 | **SHF by 0** gives the unshifted word (C for `SHF.L`, A for `SHF.R`). | Ryujinx's funnel shifts the other word by 32: undefined in SPIR-V; AMD shifts take the low 5 bits and give A \| C. | the hardware fixed Depths terrain gaps in its funnel shift (PR 10459). Ours: a select on a zero amount (translator patch 0013). In 1.4.3 every register SHF pairs its word with 0, so the result was right already. | — |
-| 3.12 | **Registers read before any write** on a path (paths the structurizer adds included) have no defined value in the game's code; UltraTears reports 0 from the NVIDIA driver. | An `OpVariable` without an initializer loads an undefined value; Mesa folds undefined values freely. | Ours: every function-local variable starts at 0 (`OpConstantNull`, job flag `zero_locals`, translator patch 0016; `NX2NAVI_ZERO_LOCALS` overrides) on Mesa drivers (RADV, ANV, NVK; `vk_caps_driver`) and, with DLAA off, on every other driver too: on NVIDIA an undefined read takes another warp lane's value, and Ocarina's clustered-light loop lit its floors in 4x8-pixel tiles (one warp each) and darkened Link (runtime/vk_caps.c). With DLAA on, off Mesa, the load stays undefined: a zero start on every driver (the old patch 0014) made the whole picture shake by about 0.9 output pixels a frame with DLSS or DLAA on an RTX 4080 SUPER (#612). It also moved the SPIR-V hash of the game's FXAA shader out of `FXAA_FS` (`vk_dlaa.c` `vk_dlaa_skip_draw`), the likely cause of the shake; that path is not traced. | — |
+| 3.8 | **FP64** in some NX2navi cutscene shaders. | No FP64 on some hosts. | Ours: `softfloat64` job flag lowers FP64 to FP32 (`tools/xlate/Program.cs` `QueryHostSupportsShaderFloat64`). | — |
+| 3.9 | **Integer vertex inputs read as raw bits** (bone indices `R8UI`). | Float-declared inputs convert integers. | Without it characters stretch; re-translating with `uint` inputs fixes it. Ours: attribute types passed to `QueryGraphicsState` (`Program.cs`). | — |
+| 3.10 | **BFE / BFI fields past bit 31** (as PTX `bfe` / `bfi`): a field that runs past bit 31 is cut there; one that starts past it extracts 0 (signed: bit 31 repeated) and inserts nothing. Terrain vertex shaders (42 variants) have taken the position from a register, `((2y + x) * 8) & 0xff` with 5-bit x and y, so up to 248. | `OpBitField*Extract` / `OpBitFieldInsert` undefined when offset or offset + count exceeds 32; AMD's bitfield instructions take offset and width modulo 32. | The translator passes the fields through. Terrain walls and ground went missing on the Steam Deck and a Linux RX 570 (RADV). Ours: clamped where the field is not a constant inside the word (translator patch 0012). RX 9070 on Windows drew the terrain the same before and after. | PTX ISA `bfe`, `bfi` |
+| 3.11 | **SHF by 0** gives the unshifted word (C for `SHF.L`, A for `SHF.R`). | The translator's funnel shifts the other word by 32: undefined in SPIR-V; AMD shifts take the low 5 bits and give A \| C. | Gives terrain gaps at a distance. Ours: a select on a zero amount (translator patch 0013). In the shaders checked, every register SHF pairs its word with 0, so the result was right already. | — |
+| 3.12 | **Registers read before any write** on a path (paths the structurizer adds included) have no defined value in the game's code; the NVIDIA driver has been reported to give 0. | An `OpVariable` without an initializer loads an undefined value; Mesa folds undefined values freely. | Ours: every function-local variable starts at 0 (`OpConstantNull`, job flag `zero_locals`, translator patch 0016; `NX2NAVI_ZERO_LOCALS` overrides) on Mesa drivers (RADV, ANV, NVK; `vk_caps_driver`) and, with DLAA off, on every other driver too: on NVIDIA an undefined read takes another warp lane's value, and Ocarina's clustered-light loop lit its floors in 4x8-pixel tiles (one warp each) and darkened Link (runtime/vk_caps.c). With DLAA on, off Mesa, the load stays undefined: a zero start on every driver (the old patch 0014) made the whole picture shake by about 0.9 output pixels a frame with DLSS or DLAA on an RTX 4080 SUPER (#612). It also moved the SPIR-V hash of the game's FXAA shader out of `FXAA_FS` (`vk_dlaa.c` `vk_dlaa_skip_draw`), the likely cause of the shake; that path is not traced. | — |
## 4. Memory model
-| # | Maxwell / Tegra | Vulkan / AMD discrete | Emulators / ports | Source |
+| # | Maxwell / Tegra | Vulkan / AMD discrete | Effect / ours | Source |
|---|---|---|---|---|
-| 4.1 | **One memory**: the CPU reads GPU-written buffers and textures after a fence; the GPU sees CPU writes after `FlushMappedRange` or, in practice, immediately (NX2navi skips flushes). Block-linear layout is defined, so a buffer copy into texture storage is a texture upload. | Images live in VRAM with private tiling; buffer bytes copied into image memory are not texels. | the hardware PR 10942 (small CPU writes); MNG alias visibility barriers for copies through two buffers over one allocation. Ours: GPU-written ranges of CPU-visible pools marked at fence completion; GPU-only pools nothing (check 8). | MNG `docs/how-it-works.md:67-71` |
-| 4.2 | **Counter reports** (`ReportCounter`, `SET_REPORT_SEMAPHORE_A..D` 0x1b00): `{counter, timestamp}`; TIMESTAMP puts 0 in the counter; SAMPLES_PASSED counts visible samples; ZCULL stats. | Occlusion queries are separate objects; results copied to a buffer. | NXN NX2navi: timestamp counter 0 matters for conditional clears. Ours: every report writes `{0, time}`; occlusion counts are always 0 (check 5). DK3D writes `SET_REPORT_SEMAPHORE_OFFSET` (`0x6C0` = 0x1b00) with payload `0` and `OPERATION=Counter`, `STRUCTURE_SIZE=FourWords` (`dk_variable.cpp:193-240`): TIMESTAMP = unit `Crop`, counter `Payload`, written when the ROP has retired every earlier draw; SAMPLES_PASSED = unit `Crop`, counter `0x15`; ZCULL stats = four one-word reports at +0, +4, +8, +12. TIMESTAMP_TOP is not a 3D report: a gpfifo `Semaphore` release of 16 bytes with `ReleaseWfiDisable`, written when the command processor reaches it, without waiting for earlier work (`:246-253`). So `TIMESTAMP - TIMESTAMP_TOP` around a span is its GPU duration. Layout: two 64-bit words, counter then timestamp (`Primer.md:578`). Each report is followed by a tiled-cache flush (`:256`). `ResetCounter` (`0x54C` = 0x1530) zeroes SAMPLES_PASSED; it is the reset for the timestamp types too (`:282-300`). Unit: `dkTimestampToNs(ts) = ts * 625 / 384`, i.e. **614.4 MHz** GPU ticks (1.63 ns), not the 19.2 MHz system tick (`include/deko3d.h:1367-1373`) (check 21). | OGD 0x1b00; NXN; DK3D `dk_variable.cpp:183-300`, `include/deko3d.h:1367` |
+| 4.1 | **One memory**: the CPU reads GPU-written buffers and textures after a fence; the GPU sees CPU writes after `FlushMappedRange` or, in practice, immediately (NX2navi skips flushes). Block-linear layout is defined, so a buffer copy into texture storage is a texture upload. | Images live in VRAM with private tiling; buffer bytes copied into image memory are not texels. | Small CPU writes (2.2); copies through two buffers over one allocation need alias visibility barriers. Ours: GPU-written ranges of CPU-visible pools marked at fence completion; GPU-only pools nothing (check 8). | — |
+| 4.2 | **Counter reports** (`ReportCounter`, `SET_REPORT_SEMAPHORE_A..D` 0x1b00): `{counter, timestamp}`; TIMESTAMP puts 0 in the counter; SAMPLES_PASSED counts visible samples; ZCULL stats. | Occlusion queries are separate objects; results copied to a buffer. | The timestamp's counter of 0 matters for conditional clears. Ours: every report writes `{0, time}`; occlusion counts are always 0 (check 5). Hardware recipe: `SET_REPORT_SEMAPHORE_OFFSET` (`0x6C0` = 0x1b00) with payload `0` and `OPERATION=Counter`, `STRUCTURE_SIZE=FourWords`: TIMESTAMP = unit `Crop`, counter `Payload`, written when the ROP has retired every earlier draw; SAMPLES_PASSED = unit `Crop`, counter `0x15`; ZCULL stats = four one-word reports at +0, +4, +8, +12. TIMESTAMP_TOP is not a 3D report: a gpfifo `Semaphore` release of 16 bytes with `ReleaseWfiDisable`, written when the command processor reaches it, without waiting for earlier work. So `TIMESTAMP - TIMESTAMP_TOP` around a span is its GPU duration. Layout: two 64-bit words, counter then timestamp. Each report is followed by a tiled-cache flush. `ResetCounter` (`0x54C` = 0x1530) zeroes SAMPLES_PASSED; it is the reset for the timestamp types too. Unit: ns = ticks * 625 / 384, i.e. **614.4 MHz** GPU ticks (1.63 ns), not the 19.2 MHz system tick (check 21). | OGD 0x1b00 |
| 4.3 | **Semaphores / events** written by the GPU in order; CPU polls them. | Writes on a completion thread after the fence. | Ours: `vk_completion_add`, submit order. | — |
-| 4.4 | **Inline uniform updates** (`UpdateUniformBuffer`) happen in command order between draws; reading the buffer at record time gives the last value. | Must snapshot. | NXN: snapshotted at encode time; Mario's wave sim diverged when two writes reordered. | NXN |
-| 4.5 | **GPU-written index buffers** (8-bit indices written earlier in the same submission). | No `uint8` index type without `VK_EXT_index_type_uint8`; CPU widening reads stale bytes. | NXN widens on the GPU (`wide_run`). Ours: CPU widening at record time; device-local byte indices skipped (check 9). | NXN |
+| 4.4 | **Inline uniform updates** (`UpdateUniformBuffer`) happen in command order between draws; reading the buffer at record time gives the last value. | Must snapshot. | Snapshot at encode time; a wave simulation diverged when two writes reordered. | — |
+| 4.5 | **GPU-written index buffers** (8-bit indices written earlier in the same submission). | No `uint8` index type without `VK_EXT_index_type_uint8`; CPU widening reads stale bytes. | Widening on the GPU avoids it. Ours: CPU widening at record time; device-local byte indices skipped (check 9). | — |
| 4.6 | **Compute shared memory**: 48 KiB per block on GM20B. | AMD 64 KiB. | Ours: `QueryComputeSharedMemorySize` from job (`Program.cs`). | OGD `clb1c0.h` |
-| 4.7 | **Virtual memory pools** map physical pool pages; the same bytes reachable at two GPU addresses. | Two `VkBuffer`s over one allocation need alias-aware barriers. | MNG `MTL4VisibilityOptionResourceAlias`. | MNG `docs/how-it-works.md:67-71` |
-| 4.8 | **Command list calls**: a `CallCommands` / `CallList` is not a GPU subroutine. DK3D `dkCmdBufCallList` stores a `Call` control entry (`dk_cmdbuf.cpp:327-338`); `dkQueueSubmitCommands` walks the entries on the CPU and recurses into the called list at submit (`dk_queue.cpp:287-296`), emitting gpfifo entries that point at the command words, which the GPU fetches later (prefetch can be switched off per entry, `:176`). So list structure is fixed at submit, command words are read when fetched. | n/a | Ours: `OP_CALL` is walked at replay, `CallCommands` inlines the recording at record time (`vk_exec.c` `walk`, `nvn_api_cmd.c` `inline_recording`). Equivalent for control flow; deferred bind handles are the data read late (2.4). | DK3D `dk_cmdbuf.cpp:327`, `dk_queue.cpp:280-298` |
+| 4.7 | **Virtual memory pools** map physical pool pages; the same bytes reachable at two GPU addresses. | Two `VkBuffer`s over one allocation need alias-aware barriers. | — | — |
+| 4.8 | **Command list calls**: a `CallCommands` / `CallList` is not a GPU subroutine. A call is stored as a control entry; at submit the CPU walks the entries and recurses into the called list, emitting gpfifo entries that point at the command words, which the GPU fetches later (prefetch can be switched off per entry). So list structure is fixed at submit, command words are read when fetched. | n/a | Ours: `OP_CALL` is walked at replay, `CallCommands` inlines the recording at record time (`vk_exec.c` `walk`, `nvn_api_cmd.c` `inline_recording`). Equivalent for control flow; deferred bind handles are the data read late (2.4). | — |
## 5. Fixed function
-| # | Maxwell / NVN | Vulkan / AMD | Emulators / ports | Source |
+| # | Maxwell / NVN | Vulkan / AMD | Effect / ours | Source |
|---|---|---|---|---|
-| 5.1 | **Provoking vertex: last** (GL convention, NVN default; `SET_PROVOKING_VERTEX` 0x1684, NVN 55 `SetProvokingVertexMode`). Flat-interpolated outputs (instance/particle ids, material indices, flat normals) come from the last vertex. | **First vertex** unless `VK_EXT_provoking_vertex` with `provokingVertexMode = LAST_VERTEX`. | Ours: last-vertex mode where `provokingVertexLast` is available (`vk_pipeline.c` `create_graphics`; check 1). DK3D: `ProvokingVertexLast` (`0x5A1`) is set to 1 at queue setup and per rasterizer state from `DkProvokingVertex` (`maxwell/gpu_3d_base.cpp:76`, `gpu_3d_state.cpp:67`); `DkRasterizerState` defaults to Last (`include/deko3d.h:823`). Confirms last as the hardware-side default. | OGD 0x1684; `runtime/nvn_ext.c`; DK3D `include/deko3d.h:794-823` |
-| 5.2 | **Primitive restart**: any index value, compared against the raw index for any index size; can apply to lists (`SET_DA_PRIMITIVE_RESTART_TOPOLOGY_CHANGE`) and to non-indexed draws (`..._VERTEX_ARRAY` 0x0de8). | Restart only at all-ones of the index type; lists need `primitiveTopologyListRestart`. | Ryujinx enables it for draw-arrays only on GL (RYU-SU comment). NXN: NX2navi terrain strips use 0xffff. Ours: non-all-ones restart not replayed, logged. DK3D: `PrimitiveRestartEnable` (`0x591` = 0x1644) + `PrimitiveRestartIndex` (`0x592` = 0x1648), index written only when enabled; any value; `PrimitiveRestartWithDrawArrays` (`0x37A` = 0x0de8) is forced 0 at setup (`maxwell/gpu_3d_ibo.cpp:21-30`, `gpu_3d_base.cpp:73`). Nothing on lists vs strips beyond that. | OGD 0x1644, 0x1648; DK3D `maxwell/gpu_3d_ibo.cpp:21-30` |
-| 5.3 | **Point size**: `SET_POINT_SIZE` (0x1518) when the shader does not write it; GLSLC clamps a written size to a driver constant. | Point size must be written by the shader. | Ryujinx writes the `PointSize` from graphics state at VS start (`Translation/EmitterContext.cs:84-88`); ours reads the `SetPointSize` state from the support buffer (translator patch 0008). | NXN |
+| 5.1 | **Provoking vertex: last** (GL convention, NVN default; `SET_PROVOKING_VERTEX` 0x1684, NVN 55 `SetProvokingVertexMode`). Flat-interpolated outputs (instance/particle ids, material indices, flat normals) come from the last vertex. | **First vertex** unless `VK_EXT_provoking_vertex` with `provokingVertexMode = LAST_VERTEX`. | Ours: last-vertex mode where `provokingVertexLast` is available (`vk_pipeline.c` `create_graphics`; check 1). `ProvokingVertexLast` (`0x5A1`) is set to 1 at queue setup and per rasterizer state, with last as the default: last is the hardware-side default. | OGD 0x1684; `runtime/nvn_ext.c` |
+| 5.2 | **Primitive restart**: any index value, compared against the raw index for any index size; can apply to lists (`SET_DA_PRIMITIVE_RESTART_TOPOLOGY_CHANGE`) and to non-indexed draws (`..._VERTEX_ARRAY` 0x0de8). | Restart only at all-ones of the index type; lists need `primitiveTopologyListRestart`. | NX2navi terrain strips use 0xffff. Ours: non-all-ones restart not replayed, logged. `PrimitiveRestartEnable` (`0x591` = 0x1644) + `PrimitiveRestartIndex` (`0x592` = 0x1648), index written only when enabled; any value; `PrimitiveRestartWithDrawArrays` (`0x37A` = 0x0de8) is set to 0 at setup. | OGD 0x1644, 0x1648 |
+| 5.3 | **Point size**: `SET_POINT_SIZE` (0x1518) when the shader does not write it; GLSLC clamps a written size to a driver constant. | Point size must be written by the shader. | The translator writes the `PointSize` from graphics state at VS start (XL `Translation/EmitterContext.cs:84-88`); ours reads the `SetPointSize` state from the support buffer (translator patch 0008). | — |
| 5.4 | **Line width**, smooth lines (`SET_LINE_WIDTH_FLOAT` 0x13b0, `SET_ANTI_ALIASED_LINE`). | `wideLines`, `VK_EXT_line_rasterization`. | Ours: 1 px, logged. | OGD |
-| 5.5 | **Polygon offset units** are twice the API value in the register; NVN API takes GL units. | `depthBiasConstantFactor` in format-dependent r. | Ryujinx `units / 2f` from the register (RYU-SU). Ours takes NVN API units (right) but D32F instead of D24 (1.7). DK3D `constantFactor * 2.0f` (1.7). | OGD 0x15bc, 0x187c; DK3D `maxwell/gpu_3d_state.cpp:154` |
-| 5.6 | **Dual-source blending**: SRC1 factors read the shader's second output. | Needs fragment output `Location 0, Index 1`. | Ryujinx declares `Index` only when `DualSourceBlendEnable` (`Translation/Translator.cs:196`, `CodeGen/Spirv/Declarations.cs:608-617`). Ours: SRC1 factors mapped (`vk_pipeline.c` `blend_factor`) but the translator is always given `false` (`Program.cs` `QueryGraphicsState`) (check 12). | — |
-| 5.7 | **Alpha-to-coverage** with dither (`SET_ALPHA_TO_COVERAGE_DITHER_CONTROL` 0x12e0), alpha test (fixed function on Maxwell). | A2C without dither; no alpha test. | Ryujinx emulates alpha test and A2C dither in the shader from graphics state; ours passes `AlphaTestOp.Always`, A2C false to the translator (`Program.cs` `QueryGraphicsState`). | OGD 0x12e0, 0x16b4 |
+| 5.5 | **Polygon offset units** are twice the API value in the register; NVN API takes GL units. | `depthBiasConstantFactor` in format-dependent r. | The register value is `constantFactor * 2.0f` (1.7). Ours takes NVN API units (right) but D32F instead of D24 (1.7). | OGD 0x15bc, 0x187c |
+| 5.6 | **Dual-source blending**: SRC1 factors read the shader's second output. | Needs fragment output `Location 0, Index 1`. | The translator declares `Index` only when `DualSourceBlendEnable` (XL `Translation/Translator.cs:196`, `CodeGen/Spirv/Declarations.cs:608-617`). Ours: SRC1 factors mapped (`vk_pipeline.c` `blend_factor`) but the translator is always given `false` (`Program.cs` `QueryGraphicsState`) (check 12). | — |
+| 5.7 | **Alpha-to-coverage** with dither (`SET_ALPHA_TO_COVERAGE_DITHER_CONTROL` 0x12e0), alpha test (fixed function on Maxwell). | A2C without dither; no alpha test. | The translator can emulate alpha test and A2C dither in the shader from graphics state; ours passes `AlphaTestOp.Always`, A2C false to the translator (`Program.cs` `QueryGraphicsState`). | OGD 0x12e0, 0x16b4 |
| 5.8 | **Logic ops** on colour targets. | `logicOp` feature; ignored on float targets. | Ours: in the pipeline key. | OGD 0x19c4 |
| 5.9 | **Vertex formats**: `*SCALED` 8/16-bit, RGB10A2 SNORM/SCALED, 3-component formats, 32-bit scaled. | No 32-bit SCALED; 3-component formats often unsupported. | Ours: 32-bit scaled read as integers (logged), 3-component widened (`vk_pipeline.c` vertex format table). | — |
| 5.10 | **Transform feedback**, rasterizer discard. | `VK_EXT_transform_feedback`. | Ours: rasterizer discard without XFB = no draw (`nvn_api_cmd.c`). | OGD 0x0744 |
| 5.11 | **Depth bounds, sample mask, conservative raster**. | Optional features. | Ours: ignored, logged (`nvn_ext.c`). | OGD 0x0fa4 |
-| 5.12 | **Blend factors on targets without alpha** (RGBX emulated as RGBA). | Destination alpha reads the stored value. | Ryujinx replaces DST_ALPHA factors on no-alpha targets (`FilterBlendFactor`, RYU-SU). | RYU-SU |
+| 5.12 | **Blend factors on targets without alpha** (RGBX emulated as RGBA). | Destination alpha reads the stored value. | DST_ALPHA factors need replacing on no-alpha targets. | — |
-## 6. Known BotW / NX2navi issues in other projects
-
-| Game | Symptom | Cause | Fix / link |
-|---|---|---|---|
-| NX2navi | 3D scene black | conditional clears ignored | NXN |
-| NX2navi | cave magenta / black | CPU-filled ASTC/BC with no flush never uploaded | NXN |
-| NX2navi | stone blocks unlit by torches | roughness atlas built from `ReadTexels` of never-uploaded BC4 | NXN |
-| NX2navi | BC4 3D texture draws lost | compressed render target | NXN |
-| NX2navi | missing ambient light, bloom halo | draw with no render target skipped | NXN |
-| NX2navi | warp pad half black | block height rounding | MNG `docs/how-it-works.md:49-53` |
-| NX2navi | coloured squares with object / Recall | D16 clear vs fragment rounding with depth EQUAL | MNG `docs/how-it-works.md:57-61` |
-| NX2navi/BotW | grass flat away from Link, no cut | custom border colour (0.5) | MNG `nvn_mtl.m:5041-5045` |
-| NX2navi | cloud flicker, missing geometry in the Depths | shader recompiler bugs | YZ-2305 PR 10234 |
-| NX2navi | red dot on screen | clear targeted the wrong RT index | YZ-2305 PR 10243 |
-| NX2navi | scrambled Link/terrain at 2× | buffer-cache clears during sync | YZ-2305 PR 10249 |
-| NX2navi | vertex explosions (RADV) | driver dynamic depth clamp bug | YZ-2305 PR 10262 |
-| NX2navi | pixelated object glow | attachment feedback loop without barriers | YZ-2305 PR 10402 |
-| NX2navi | areas black for a frame on camera changes | texture-cache alias/overlap order | YZ-2305 PR 10418 |
-| NX2navi | Gloom textures on terrain | block-depth adjustment on 3D slices | YZ-2305 PR 10433 |
-| NX2navi | terrain gaps at distance (Depths) | one-character shader recompiler error | YZ-2305 PR 10459 |
-| NX2navi | mangled textures on RDNA3 | not found (AMD test case) | YZ-2305 |
-| BotW/NX2navi | slow rain/snow, particle corruption on teleport | small CPU writes into GPU-used pages not invalidated | YZ-2306 PR 10942 |
-| NX2navi | AO broken above 1008p mods | rescale thresholds | YZ-2306 PR 10675 |
-| NX2navi | "detective mode" Link on AMD | AMD EDS3 colour-blend driver regression | YZ-2306 PR 10946 |
-| BotW | shadow artifacts at object edges (AMD) | gather rounding | the hardware commit 780240e (2.10) |
-| NX2navi | dashed dark lines along wall and floor edges, changing with the camera angle (AMD, RADV) | gather rounding | gather bias (2.10) |
-| NX2navi | blocky foliage shadows that jump instead of sliding | not a GPU difference: the engine sizes its sun shadow map to the area it covers, down to about 400 near the ground, and each change of size moves the shadow texels | fixed size, `shadow_res` (the shadow set of `recomp/patches-v121.txt`; the community mods force 1024 the same way) |
-| BotW | black textures on GCN | HTILE (depth compression) | `AMD_DEBUG=nohyperz` wiki (1.9) |
-| BotW | 3D scene black | deferred texture handles | NXN |
-| BotW | albedo scattered squares | duplicate colour attachments | NXN |
-| BotW | HUD dark boxes, black stamina wheel | capture texture swizzle rebuild | NXN |
-
-## 7. Checks for our runtime
+## 6. Checks for our runtime
Grep-level look on 2026-10-22, statuses updated 2026-10-26; "saw" is what the grep and short reads showed, not a test result.
@@ -160,11 +114,11 @@ Grep-level look on 2026-10-22, statuses updated 2026-10-26; "saw" is what the gr
`provokingVertexLast` and chains `VkPipelineRasterizationProvokingVertexStateCreateInfoEXT{LAST_VERTEX}` in
`create_graphics`; without the feature it logs that flat outputs come from the first vertex. **Fixed.**
2. **Unwritten vertex outputs.** `spirv_add_outputs` (`vk_pipeline.c`) adds outputs initialised to (0, 0, 0, 1) for
- FS inputs the VS lacks. Our translator never links stages, so Ryujinx's `InitializeVertexOutputs` would initialise
+ FS inputs the VS lacks. Our translator never links stages, so its `InitializeVertexOutputs` would initialise
no user output; translator patch 0006 initialises the unlinked outputs. **Fixed.**
3. **Masked clears.** `vk_exec.c` skips colour clears with a partial channel mask (`W_CLEAR_MASK`); `clear_ds` skips stencil
- clears with a partial mask (`W_STENCIL_MASK`). NX2navi issues such clears (NXN). Check the log for
- `colour clear with channel mask` and `stencil clear with mask`. DK3D (1.3) confirms what the replay must do: colour clear = scissor 0 + channel mask, stencil clear = `value & mask` merged under the front write mask; so a draw with `colorWriteMask` / `stencilWriteMask` set to the clear mask is the exact equivalent. **Missing.**
+ clears with a partial mask (`W_STENCIL_MASK`). NX2navi issues such clears. Check the log for
+ `colour clear with channel mask` and `stencil clear with mask`. The hardware recipe (1.3) shows what the replay must do: colour clear = scissor 0 + channel mask, stencil clear = `value & mask` merged under the front write mask; so a draw with `colorWriteMask` / `stencilWriteMask` set to the clear mask is the exact equivalent. **Missing.**
4. **D24 → D32F.** `vk_formats.c` maps D24S8 to `D32_SFLOAT_S8_UINT`; `vk_exec_draw.c` `record_fixed` passes NVN units
unscaled. Depth EQUAL passes and decal offsets can z-fight. Look at: per-pass depth-test op histogram, EQUAL passes
against D24 targets. **N/A for NX2navi**: a census of the field and fight saves (2026-10-22) saw depth targets
@@ -181,17 +135,17 @@ Grep-level look on 2026-10-22, statuses updated 2026-10-26; "saw" is what the gr
7. **Images aliased onto GPU-only pool memory.** `vk_texture.c` `bind_pool_memory` binds each `VkImage` into its pool
allocation; textures are keyed by address plus descriptor, and each new image starts `UNDEFINED` (`init_image`). Two descriptors over the
same storage, or bytes written through a buffer, do not see each other's data on AMD. Check: count distinct keys per
- address per frame. **Risk** (the hardware PR 10418 class).
+ address per frame. **Risk** (the alias/overlap ordering class of 2.3).
8. **GPU writes into CPU-visible pools.** `note_gpu_write` (`vk_exec_xfer.c`) stamps pages when the fence
completes, so a texture sampled later in the same submission keeps its old upload; GPU-only pools are skipped.
- MNG saw at most one buffer copy per frame in NX2navi, so low priority. **Risk.**
+ At most one buffer copy per frame has been seen in NX2navi, so low priority. **Risk.**
9. **Index buffers.** `vk_exec_draw.c` `op_draw_idx`: byte indices widened on the CPU at record time, skipped in
device-local memory; `restart_for`: a non-all-ones restart index logged and dropped. Census (2026-10-22): 130-170 byte-index draws/frame widened on the
CPU, 0 device-local, 0 non-all-ones restarts. **OK**; `VK_KHR_index_type_uint8` (supported) would drop the CPU cost.
10. **Feedback loops.** Census (2026-10-22): 425/frame (field) to 667 (fight), G-buffer material/decal shaders
sampling the 1600x900 targets of the open pass. The terrain G-buffer pass reads its own albedo, normal and R32F
targets at the fragment's pixel; on the RX 9070 the reads returned stale data as ~16x14 px dark rectangles on the
- ground, and the sage spirit next to Link was not drawn. `vk_exec_draw.c` (feedback loops) now detects such a draw:
+ ground, and a character next to Link was not drawn. `vk_exec_draw.c` (feedback loops) now detects such a draw:
with `VK_EXT_attachment_feedback_loop_layout` and `dynamicRenderingLocalRead` the target moves to the feedback
layout and a by-region barrier precedes the draw; without them the pass restarts behind a full barrier
(`NX2NAVI_FEEDBACK`). **Fixed.**
@@ -203,14 +157,14 @@ Grep-level look on 2026-10-22, statuses updated 2026-10-26; "saw" is what the gr
13. **FMZ / NaN.** Count `FMUL/FFMA/FMUL32I/FFMA32I` words with the `Fmz` field set (`Decoders/InstDecoders.cs:1901`
bit positions) in `build/v121/shaders/`; FMin/FMax/FClamp NaN results are undefined (3.1). Census (2026-10-22):
FMZ in 1 instruction of 12397 shaders, FTZ in 12241 shaders, FMNMX in 7457. The translator emits GLSL.std.450
- FMin/FMax (Ryujinx `GenerateMinimum`), not NMin/NMax. **FMZ: no fix needed. FMNMX: OK** (RX 9070 test: FMin/FMax(NaN, 1) = 1 both orders, FClamp(NaN, 0, 1) = 0).
+ FMin/FMax (`GenerateMinimum`), not NMin/NMax. **FMZ: no fix needed. FMNMX: OK** (RX 9070 test: FMin/FMax(NaN, 1) = 1 both orders, FClamp(NaN, 0, 1) = 0).
14. **Point size / line width.** Census: `SetLineWidth 4.5` ~1/frame (2 line draws into a 144x144 R8 target),
`SetPointSize 5` ~14/frame; 4 point VS rely on it. Point size: translator patch 0008 reads it from the support
buffer, **fixed**. Line width: 1 px, non-default values logged (`nvn_ext.c`), **mismatch, minor**.
-15. **Block height.** `nvn_tex.c` truncates like NVN (2.1). DK3D rounds up (`dk_image.cpp:446`); every other step matches. **OK.**
+15. **Block height.** `nvn_tex.c` truncates like NVN (2.1); every other step of the layout matches. **OK.**
16. **Depth mode and clamp.** `vk_pipeline.c` `create_graphics` (`negativeOneToOne` from `nvn_depth_minus_w`, `depthClampEnable`
- from NVN state). DK3D agrees on the z maths (1.5) and the clamp switch (1.6). **OK.**
-17. **Depth bias argument order.** `vk_exec_draw.c` `record_fixed` (units, clamp, factor); DK3D takes the same three and doubles units for the register (1.7). **OK.**
+ from NVN state). Matches the hardware z maths (1.5) and clamp switch (1.6). **OK.**
+17. **Depth bias argument order.** `vk_exec_draw.c` `record_fixed` (units, clamp, factor); the register takes the same three, units doubled (1.7). **OK.**
18. **Sampler LOD.** `vk_texture.c` `make_sampler`. **OK.**
19. **Viewport / scissor arrays.** Single viewport (`vk_exec_draw.c` `record_fixed`), extra scissors logged. Census: 0 differing. **OK.**
@@ -218,18 +172,9 @@ Grep-level look on 2026-10-22, statuses updated 2026-10-26; "saw" is what the gr
CPU-written placeholder through an R32_SFLOAT view with compare on, ~1/frame. Needs a D32 copy. **Minor.**
21. **Report timestamps: unit and instant.** `write_counter` (`vk_exec_xfer.c`) writes host `ns * 12 / 625` (19.2 MHz
ticks) at fence completion for every report; `nvnDeviceGetTimestampInNanoseconds` converts back with the same factor
- (`nvn_ext.c`). DK3D: GPU ticks convert at 625/384 ns (614.4 MHz), TIMESTAMP is written when the ROP has retired
+ (`nvn_ext.c`). On the hardware, GPU ticks convert at 625/384 ns (614.4 MHz), TIMESTAMP is written when the ROP has retired
the earlier work, TIMESTAMP_TOP when the command processor reaches it (4.2). Two consequences for the engine's GPU time (dynamic resolution and speed follow it):
- (a) if the 1.2.1 consumer scales raw report ticks with its own constant rather than the NVN conversion call, our
+ (a) if the game's consumer scales raw report ticks with its own constant rather than the NVN conversion call, our
19.2 MHz unit is 32x off from the hardware's; find that consumer before fixing the unit; (b) the delta needs
`vkCmdWriteTimestamp2` with `TOP_OF_PIPE` for TIMESTAMP_TOP and `BOTTOM_OF_PIPE` for TIMESTAMP, per submission
segment, converted to whichever unit (a) shows. **Mismatch (instant); unit unverified.**
-
-## 8. Sources not read yet
-
-- Mesa NVK (`src/nouveau/vulkan`, MIT): how it maps Vulkan provoking vertex, depth clip, restart, feedback loops onto B197.
-- envytools rnndb `graph/gf100_3d.xml`, `tsc.xml`, `tic.xml` (MIT): field-level TIC/TSC meanings (LOD snap, trilinear opt).
-- Ryujinx `Ryujinx.Graphics.Gpu/Image/TextureCache.cs`, `Texture.cs` (MIT): alias/overlap rules, depth texture swizzle.
-- Ryujinx NX2navi/BotW PRs and issues (GitHub repo gone; mirrors blocked or 404 on 2026-10-22).
-- the hardware progress reports 2023-08 to 2024-02 and suyu/sudachi trackers (behaviour only).
-- switchbrew wiki NVN and GPU pages.
diff --git a/installer/layout.py b/installer/layout.py
index 41aeaa80..f035be63 100644
--- a/installer/layout.py
+++ b/installer/layout.py
@@ -11,7 +11,7 @@ Release (docs/installer.md "Release layout"), root = the unpacked folder:
patches.c, ov_zstd.c) and nx2navi.ico; runtime/deps/ holds
include/ + lib/ of Vulkan, SDL3, Opus, libvpx and VMA (build_game.py --deps)
bin/ nx2navi_xlate.exe (+ nx2navi_xlate.id), hactool.exe, ninja.exe, SDL3.dll, libopus-0.dll
- data/shader_list.tsv the MacNativeGames shader list
+ data/shader_list.tsv the shared shader list
data/pgo-.profdata the execution profile the update's code is compiled with (tools/pgo.py; Windows only);
without one the game is built at -O1
nx2navi.ini.example
diff --git a/installer/text/en.json b/installer/text/en.json
index 062917fb..39b0b67b 100644
--- a/installer/text/en.json
+++ b/installer/text/en.json
@@ -128,7 +128,7 @@
"ui.pick_keys": "Choose prod.keys",
"ui.pick_firmware": "Choose the Switch firmware folder (Contents/registered)",
"ui.pick_dest": "Choose the install folder",
- "ui.firmware_help": "For Chinese, Korean and Traditional Chinese text: the firmware's Contents/registered folder, for example from Ryujinx or The hardware. The setup copies the Switch system fonts from it into the install folder.",
+ "ui.firmware_help": "For Chinese, Korean and Traditional Chinese text: the firmware's Contents/registered folder. The setup copies the Switch system fonts from it into the install folder.",
"ui.dlss": "Download NVIDIA DLSS (nvngx_dlss.dll) for NVIDIA RTX graphics cards",
"ui.dlss_help": "From NVIDIA's DLSS SDK on GitHub, under NVIDIA's RTX SDK license (github.com/NVIDIA/DLSS). It makes the dlaa and DLSS settings work; without it they do nothing.",
"ui.compressed_help": "Compressed NSZ and XCZ files work as they are: the setup unpacks them by itself (until the game data is extracted, that needs as much free space as the unpacked files take).",
diff --git a/installer/text/pt-BR.json b/installer/text/pt-BR.json
index a6decac6..2c1c2657 100644
--- a/installer/text/pt-BR.json
+++ b/installer/text/pt-BR.json
@@ -128,7 +128,7 @@
"ui.pick_keys": "Escolha o prod.keys",
"ui.pick_firmware": "Escolha a pasta de firmware do Switch (Contents/registered)",
"ui.pick_dest": "Escolha a pasta de instalação",
- "ui.firmware_help": "Para textos em chinês, coreano e chinês tradicional: a pasta Contents/registered do firmware, por exemplo do Ryujinx ou do The hardware. A instalação copia dela as fontes do sistema do Switch para a pasta de instalação.",
+ "ui.firmware_help": "Para textos em chinês, coreano e chinês tradicional: a pasta Contents/registered do firmware. A instalação copia dela as fontes do sistema do Switch para a pasta de instalação.",
"ui.dlss": "Baixar o NVIDIA DLSS (nvngx_dlss.dll) para placas de vídeo NVIDIA RTX",
"ui.dlss_help": "Do DLSS SDK da NVIDIA no GitHub, sob a licença NVIDIA RTX SDK (github.com/NVIDIA/DLSS). Sem ele as opções dlaa e DLSS não fazem nada.",
"ui.compressed_help": "Arquivos compactados NSZ e XCZ funcionam do jeito que estão: a instalação os descompacta sozinha (para isso, até os dados do jogo serem extraídos, ela precisa de tanto espaço livre quanto ocupam os arquivos descompactados).",
diff --git a/installer/text/ru.json b/installer/text/ru.json
index ed319942..054368db 100644
--- a/installer/text/ru.json
+++ b/installer/text/ru.json
@@ -128,7 +128,7 @@
"ui.pick_keys": "Выберите prod.keys",
"ui.pick_firmware": "Выберите папку прошивки Switch (Contents/registered)",
"ui.pick_dest": "Выберите папку установки",
- "ui.firmware_help": "Для текста на китайском и корейском: папка Contents/registered прошивки, например из Ryujinx или The hardware. Установка скопирует из неё системные шрифты Switch в папку установки.",
+ "ui.firmware_help": "Для текста на китайском и корейском: папка Contents/registered прошивки. Установка скопирует из неё системные шрифты Switch в папку установки.",
"ui.dlss": "Загрузить NVIDIA DLSS (nvngx_dlss.dll) для видеокарт NVIDIA RTX",
"ui.dlss_help": "Из DLSS SDK от NVIDIA на GitHub, по лицензии NVIDIA RTX SDK (github.com/NVIDIA/DLSS). Без него настройки dlaa и DLSS ничего не делают.",
"ui.compressed_help": "Сжатые файлы NSZ и XCZ подходят как есть: установка сама их распакует (для этого, пока извлекаются данные игры, нужно столько свободного места, сколько занимают распакованные файлы).",
diff --git a/installer/text/zh-Hans.json b/installer/text/zh-Hans.json
index f0fc5b90..fc5b66fc 100644
--- a/installer/text/zh-Hans.json
+++ b/installer/text/zh-Hans.json
@@ -128,7 +128,7 @@
"ui.pick_keys": "选择 prod.keys",
"ui.pick_firmware": "选择 Switch 固件文件夹(Contents/registered)",
"ui.pick_dest": "选择安装文件夹",
- "ui.firmware_help": "用于中文、韩文和繁体中文文本:固件的 Contents/registered 文件夹,例如来自 Ryujinx 或 The hardware。安装程序会从中把 Switch 系统字体复制到安装文件夹。",
+ "ui.firmware_help": "用于中文、韩文和繁体中文文本:固件的 Contents/registered 文件夹。安装程序会从中把 Switch 系统字体复制到安装文件夹。",
"ui.dlss": "为 NVIDIA RTX 显卡下载 NVIDIA DLSS(nvngx_dlss.dll)",
"ui.dlss_help": "来自 GitHub 上 NVIDIA 的 DLSS SDK,遵循 NVIDIA RTX SDK 许可(github.com/NVIDIA/DLSS)。没有它,dlaa 和 DLSS 设置不起作用。",
"ui.compressed_help": "压缩的 NSZ 和 XCZ 文件可以直接使用:安装程序会自行解压(在游戏数据提取完成之前,需要与解压后文件大小相同的可用空间)。",
diff --git a/nx2navi.ini.example b/nx2navi.ini.example
index cd14419e..d087ae02 100644
--- a/nx2navi.ini.example
+++ b/nx2navi.ini.example
@@ -306,7 +306,7 @@
# input_record = input.txt
# Remap buttons: the Controls tab of the settings menu (F1) writes these lines. One line per Switch button or stick
# direction: bind_ or bind__, or bind_SHAKE (G: shakes the right stick, which detaches a fused part from what object holds) = comma
+# DOWN>, or bind_SHAKE (G: shakes the right stick, which detaches a fused part from what the player holds) = comma
# separated pad: and key: entries, key:default / pad:default for that part's defaults, or none.
# A line replaces that button's defaults (pad and keyboard); buttons without a line keep them. Stick directions and
# SHAKE take keys only. Invalid entries are logged and skipped. Changes while the game runs take effect at once.
diff --git a/recomp/gen.py b/recomp/gen.py
index dc60192c..8d51787d 100644
--- a/recomp/gen.py
+++ b/recomp/gen.py
@@ -1,4 +1,4 @@
-# Adapted from LAS Recomp tools/gen.py @ da35b83 (MIT, Copyright (c) 2026 Peiikai).
+# Copyright (c) 2026 Peiikai (MIT; see THIRD_PARTY_NOTICES.md).
"""Generate C for the ExeFS modules: function discovery, then parallel emission into chunked C files.
Usage: gen.py --exefs build/extracted/v121/exefs --out generated/v121 [--modules main,subsdk0,sdk] [--jobs N]
diff --git a/recomp/lifter.py b/recomp/lifter.py
index e33e9871..03ea84b1 100644
--- a/recomp/lifter.py
+++ b/recomp/lifter.py
@@ -1,4 +1,4 @@
-# Adapted from LAS Recomp tools/lifter.py @ da35b83 (MIT, Copyright (c) 2026 Peiikai).
+# Copyright (c) 2026 Peiikai (MIT; see THIRD_PARTY_NOTICES.md).
"""AArch64 -> C static recompiler.
Integer, memory, and control flow are translated to C. FP/SIMD instructions (and CRC32) are
diff --git a/recomp/module.py b/recomp/module.py
index c3e4f355..d5ba07e8 100644
--- a/recomp/module.py
+++ b/recomp/module.py
@@ -1,8 +1,7 @@
"""One loaded NSO module as the generator and its analyses see it: image at a guest base, .text as words,
function seeds, and bounded-cache instruction lifting.
-The function seeds and the .eh_frame_hdr reader are adapted from LAS Recomp tools/analyze.py and tools/gen.py
-@ da35b83 (MIT, Copyright (c) 2026 Peiikai).
+The function seeds and the .eh_frame_hdr reader: Copyright (c) 2026 Peiikai (MIT; see THIRD_PARTY_NOTICES.md).
"""
import struct
from collections import OrderedDict
diff --git a/recomp/nso.py b/recomp/nso.py
index 1222230e..d5913b98 100644
--- a/recomp/nso.py
+++ b/recomp/nso.py
@@ -1,4 +1,4 @@
-# Adapted from LAS Recomp tools/nso.py @ da35b83 (MIT, Copyright (c) 2026 Peiikai).
+# Copyright (c) 2026 Peiikai (MIT; see THIRD_PARTY_NOTICES.md).
"""NSO loader: decompress segments, build the memory image, parse MOD0/dynamic info."""
import struct
import sys
diff --git a/recomp/patches-v110.txt b/recomp/patches-v110.txt
index f8b34af7..f21f16fd 100644
--- a/recomp/patches-v110.txt
+++ b/recomp/patches-v110.txt
@@ -1,7 +1,6 @@
-# Code patches for NX2navi 1.1.0 main (recomp/patches.py). The sites come from MacNativeGames
-# games//runtime/game_patches.c (MIT, Copyright (c) 2026 MacNativeGames contributors) at upstream ebe621d, through
-# its 1.2.1 addresses in game_version.h (2db612b); each one was located again in 1.1.0 by instruction-window matching
-# and its original words checked against this build's main. The patch page holds two floats the runtime writes at every
+# Code patches for NX2navi 1.1.0 main (recomp/patches.py). Copyright (c) 2026 MacNativeGames contributors (MIT; see
+# THIRD_PARTY_NOTICES.md). Each site was located in 1.1.0 from its 1.2.1 address by instruction-window matching and
+# its original words checked against this build's main. The patch page holds two floats the runtime writes at every
# present (frame_rate.c): +0 the 30 Hz ratio (seconds * 30), +4 the frame step in seconds.
set fps60 NX2NAVI_FPS60 1
@@ -11,7 +10,7 @@ set bounce NX2NAVI_HIGHFPS_FIX 1
set output NX2NAVI_PATCH_OUTPUT 0
set scene NX2NAVI_PATCH_SCENE 0
-# 60 fps: the adaptive present-interval controller (main+0x8f26c8, 1.0.0 0x8f6bec) gets the minimum interval 1.
+# 60 fps: the adaptive present-interval controller (main+0x8f26c8) gets the minimum interval 1.
site fps60 main 90e978 6b08015f 7100055f # clamp: cmp w10, #1 (was cmp w10, w8 = minimum)
site fps60 main 90e97c 1a89b10a 1a9fa52a # clamp: csinc w10, w9, wzr, ge (desired = max(desired, 1))
site fps60 main 90e9a0 b9401a8a d503201f # lower trigger: nop the stored-candidate load
@@ -20,8 +19,8 @@ site fps60 main 90ea40 1a88c1ac 1a9fc5ac # raise path: csinc w12, w13, wzr, gt
site fps60 main 90ea94 b9400288 52800028 # lower path: mov w8, #1 (minimum interval 1)
site fps60 main 90eab0 2a0a03f5 1a9fa555 # lower path: csinc w21, w10, wzr, ge (result never below 1)
-# Real-time step: the VFR step (main+0x7ede6c, 1.0.0 0x7a83e4) and the global ratio after the controller call
-# (main+0x8f2394, 1.0.0 0x8f68b8) read ratio and seconds from the patch page instead of interval * 0.5 and interval / 60.
+# Real-time step: the VFR step (main+0x7ede6c) and the global ratio after the controller call
+# (main+0x8f2394) read ratio and seconds from the patch page instead of interval * 0.5 and interval / 60.
site realtime main 833e4c 1e220020 @page:x9 # scvtf s0, w1 -> adrp x9, page
site realtime main 833e50 52a84e08 bd400120 # mov w8, #60.0 -> ldr s0, [x9] (ratio)
site realtime main 833e54 1e270101 bd400521 # fmov s1, w8 -> ldr s1, [x9, #4] (seconds)
@@ -33,11 +32,11 @@ site realtime main 90e5d4 1e2c1001 bd400120 # fmov s1, #0.5 -> ldr s0, [x9] (gl
site realtime main 90e5e4 5e21d800 d503201f # scvtf s0, s0 -> nop
site realtime main 90e5e8 1e210800 d503201f # fmul s0, s0, s1 -> nop
-# Hair and cloth (upstream 290ec9f, 8f8022f): the actor animation update builds a second clock {seconds = factor / 30,
+# Hair and cloth: the actor animation update builds a second clock {seconds = factor / 30,
# ratio = factor} per rendered frame. Three inlined places: at the fmul, seconds = measured seconds * factor; at the
# store of the factor into the ratio slot, measured ratio * factor. The call of the shared update (1.1.0
-# main+0x8ecb40, 1.2.1 main+0x89822c) scales s2 (seconds) and s3 (ratio) by the measured ratio. Upstream's
-# veneer bodies, inlined at the site.
+# main+0x8ecb40, 1.2.1 main+0x89822c) scales s2 (seconds) and s3 (ratio) by the measured ratio. The
+# replacement bodies are inlined at the site.
site cloth main 9efc20 1e200900 f81f0fe9 @page:x9 bd400520 1e200900 f84107e9 # fmul s0, s8, s0
site cloth main 9efc1c bd0117e8 d10083ff f90003e9 3d8007ff @page:x9 bd40013f 1e3f091f bd0137ff 3dc007ff f94003e9 910083ff # str s8, [sp, #0x114]
site cloth main 9f0bcc 1e200900 f81f0fe9 @page:x9 bd400520 1e200900 f84107e9 # fmul s0, s8, s0
@@ -46,11 +45,11 @@ site cloth main a05a04 1e210801 f81f0fe9 @page:x9 bd400521 1e210801 f84107e9 #
site cloth main a05a08 bd0137e0 d10083ff f90003e9 3d8007ff @page:x9 bd40013f 1e3f081f bd0157ff 3dc007ff f94003e9 910083ff # str s0, [sp, #0x134]
site cloth main 9f044c 97fbf1bd @page:x8 bd400104 1e240842 1e240863 97fbf1bd # bl 0x8ecb40
-# Trampolines (upstream 27c3b43): the slow-motion check compares time object +0x28 (30 / (ratio * time scale)) with
+# Trampolines: the slow-motion check compares time object +0x28 (30 / (ratio * time scale)) with
# 100; compare +0x28 * +0x38 (30 / time scale) instead, the same value at 30 Hz and independent of the frame rate.
site bounce main bee7e0 bd402900 bd402900 bd403901 1e210800 # ldr s0, [x8, #0x28]; ldr s1, [x8, #0x38]; fmul s0, s0, s1
-# Output size (upstream games//runtime/game_patches.c patch_output_res; runtime/resolution.c switches the set on).
+# Output size (runtime/resolution.c switches the set on).
# The swapchain size nnMain writes before NvInitializeGraphics comes from page +48 ({w, h} as one 64-bit value), and
# the output size the renderer lays out its canvas, crop and UI in (main+0xcc3f00, read from the graphics parameters
# through main+0xcc4160) from page +32; the renderer itself goes to page +40.
@@ -60,7 +59,7 @@ site output main cea5c8 aa1403e0 @page:x21 # mov x0, x20 -> adrp x21, page
site output main cea5cc 94000081 f90016b3 # bl 0xcc4160 -> str x19, [x21, #40]
site output main cea5d0 f9400015 f94012b5 # ldr x21, [x0] -> ldr x21, [x21, #32]
-# Scene render size (upstream patch_render_res): the renderer's +0xcc4 / +0xcc8, which size every scene render target,
+# Scene render size: the renderer's +0xcc4 / +0xcc8, which size every scene render target,
# take two floats from page +16 instead of the graphics parameters' docked 1600x900.
site scene main cea5e0 5e21d900 @page:x9 # scvtf s0, s8 -> adrp x9, page
site scene main cea5e8 bd0cc660 2d420520 # str s0, [x19, #0xcc4] -> ldp s0, s1, [x9, #16]
diff --git a/recomp/patches-v111.txt b/recomp/patches-v111.txt
index 755c53d2..87017665 100644
--- a/recomp/patches-v111.txt
+++ b/recomp/patches-v111.txt
@@ -6,11 +6,9 @@
# the four screen vtables that keep it, +176 the UI's horizontal squeeze (16:9 over the picture's ratio) in four lanes, +192 the
# movie's margin on each side as a share of the width.
#
-# The matrix-update, UI and movie sites and what each does there come from oot-mod by Ivan0xFF
-# (https://github.com/craftycorvid/oot-mod @ c5ccd1cd57e8219aea3be1e758221795fa5b7ec8, build.py hooks; MIT,
-# Copyright (c) 2026 Ivan0xFF). Its hooks branch to code caves; here each is rewritten without branches or flags, as
-# the generator's patch sites need. The set names differ from NX2navi's (output, scene, aspect), whose page layout
-# runtime/resolution.c owns.
+# The matrix-update, UI and movie sites: Copyright (c) 2026 Ivan0xFF (MIT; see THIRD_PARTY_NOTICES.md). Each is
+# written without branches or flags, as the generator's patch sites need. The set names differ from the other patch
+# files' (output, scene, aspect), whose page layout runtime/resolution.c owns.
set wide_out NX2NAVI_PATCH_WIDE_OUT 0
set wide_scene NX2NAVI_PATCH_WIDE_SCENE 0
@@ -31,12 +29,12 @@ site wide_out main 31f39f8 f2c0b408 f9403108 # movk x8, #0x5a0, lsl #32 -> ldr
site wide_scene main 31f3a00 d280f008 @page:x8 # mov x8, #0x780 -> adrp x8, page
site wide_scene main 31f3a04 f2c08708 f9403508 # movk x8, #0x438, lsl #32 -> ldr x8, [x8, #104]
-# Camera aspect ratio: the camera update (main+0x4c48c0, the same code as NX2navi's camera update site in
+# Camera aspect ratio: the camera update (main+0x4c48c0, the same code as the camera update site in
# recomp/patches-v143.txt) copies the camera's near, far, vertical angle and ratio (camera +0x134..+0x140) into the
# sead perspective projection the renderer reads (+0x98..+0xb0; the projection's own matrix update, main+0x3485cc0, does
# not run in play: the renderer builds its matrices from these fields). The replacement loads the ratio as before and
# puts the page's ratio in its place when it is within the page's tolerance of 16:9 (the camera's value is not the bit
-# pattern of the 16/9 constant, and the tolerance is oot-mod's 0.01); other ratios stay the camera's. fabd + fcmge + bit
+# pattern of the 16/9 constant, and the tolerance is 0.01); other ratios stay the camera's. fabd + fcmge + bit
# write no flags, so the alternatives agree. s1..s4 and x9 are free there: nothing reads them before the call at
# main+0x4c534c.
site wide_aspect main 4c5334 bd414260 bd414260 @page:x9 2d4e0921 bd407923 7ea1d404 7e24e464 2ea41c40 # ldr s0, [x19, #0x140]; ldp s1, s2, [x9, #112]; ldr s3, [x9, #120]; fabd s4, s0, s1; fcmge s4, s3, s4; bit v0, v2, v4
@@ -55,7 +53,7 @@ site wide_aspect main 33b82c 2d558440 2d558440 @page:x9 2d4e1123 bd407922 7ea3d4
# ratio, so the UI keeps its shape in the middle 16:9 of the picture, its edge elements at that area's edges, and the
# markers that follow the 3D world stay on their targets. Screens whose canvas (+0x1b8 into the screen object) belongs
# to the item-wheel background (vtable main+0x4bed098) or the pause and system menu backgrounds (main+0x4be4fb0) keep
-# it, as in oot-mod: they redraw a capture of the whole picture. So do the event and loading fades (UIEventFadeScreen
+# it: they redraw a capture of the whole picture. So do the event and loading fades (UIEventFadeScreen
# main+0x4be61c8, UILoadingFadeScreen main+0x4be7b30; the vtables that hold those names at +0x378): a fade is one colour,
# and in the middle 16:9 alone it would leave the picture showing at the sides. Without branches: the two projection
# words are compared in vector lanes, the screen's vtable is read from the canvas' screen only when they match (else from
diff --git a/recomp/patches-v121.txt b/recomp/patches-v121.txt
index a327cb87..46000657 100644
--- a/recomp/patches-v121.txt
+++ b/recomp/patches-v121.txt
@@ -1,6 +1,5 @@
-# Code patches for NX2navi 1.2.1 main (recomp/patches.py). Ported from MacNativeGames games//runtime/game_patches.c
-# (MIT, Copyright (c) 2026 MacNativeGames contributors) at upstream ebe621d; 1.2.1 sites from its game_version.h
-# (2db612b), each original word checked against the 1.2.1 main. The patch page holds two floats the runtime writes at
+# Code patches for NX2navi 1.2.1 main (recomp/patches.py). Copyright (c) 2026 MacNativeGames contributors (MIT; see
+# THIRD_PARTY_NOTICES.md). Each original word is checked against the 1.2.1 main. The patch page holds two floats the runtime writes at
# every present (frame_rate.c): +0 the 30 Hz ratio (seconds * 30), +4 the frame step in seconds.
set fps60 NX2NAVI_FPS60 1
@@ -11,7 +10,7 @@ set output NX2NAVI_PATCH_OUTPUT 0
set scene NX2NAVI_PATCH_SCENE 0
set shadow NX2NAVI_PATCH_SHADOW 0
-# 60 fps: the adaptive present-interval controller (main+0x8f26c8, 1.0.0 0x8f6bec) gets the minimum interval 1.
+# 60 fps: the adaptive present-interval controller (main+0x8f26c8) gets the minimum interval 1.
site fps60 main 8f273c 6b08015f 7100055f # clamp: cmp w10, #1 (was cmp w10, w8 = minimum)
site fps60 main 8f2740 1a89b10a 1a9fa52a # clamp: csinc w10, w9, wzr, ge (desired = max(desired, 1))
site fps60 main 8f2764 b9401a8a d503201f # lower trigger: nop the stored-candidate load
@@ -20,8 +19,8 @@ site fps60 main 8f2804 1a88c1ac 1a9fc5ac # raise path: csinc w12, w13, wzr, gt
site fps60 main 8f2858 b9400288 52800028 # lower path: mov w8, #1 (minimum interval 1)
site fps60 main 8f2874 2a0a03f5 1a9fa555 # lower path: csinc w21, w10, wzr, ge (result never below 1)
-# Real-time step: the VFR step (main+0x7ede6c, 1.0.0 0x7a83e4) and the global ratio after the controller call
-# (main+0x8f2394, 1.0.0 0x8f68b8) read ratio and seconds from the patch page instead of interval * 0.5 and interval / 60.
+# Real-time step: the VFR step (main+0x7ede6c) and the global ratio after the controller call
+# (main+0x8f2394) read ratio and seconds from the patch page instead of interval * 0.5 and interval / 60.
site realtime main 7ede7c 1e220020 @page:x9 # scvtf s0, w1 -> adrp x9, page
site realtime main 7ede80 52a84e08 bd400120 # mov w8, #60.0 -> ldr s0, [x9] (ratio)
site realtime main 7ede84 1e270101 bd400521 # fmov s1, w8 -> ldr s1, [x9, #4] (seconds)
@@ -33,16 +32,16 @@ site realtime main 8f2398 1e2c1001 bd400120 # fmov s1, #0.5 -> ldr s0, [x9] (g
site realtime main 8f23a8 5e21d800 d503201f # scvtf s0, s0 -> nop
site realtime main 8f23ac 1e210800 d503201f # fmul s0, s0, s1 -> nop
-# Equipment-switch cooldown (issue #18, found by JieML1100 on 1.4.3): the player update (main+0x852d24) steps the
+# Equipment-switch cooldown (issue #18): the player update (main+0x852d24) steps the
# countdown at player state +0x109c through the timer step (main+0xec98cc) only while it is above FLT_EPSILON, but the
# equipment gate (main+0xcae6f8) blocks weapon, shield and bow changes while it is above 0. A measured ratio can leave
# a remainder in (0, FLT_EPSILON] that is never stepped again; stepping while above 0 takes it below 0.
site realtime main 852d28 1e270101 1e2703e1 # fmov s1, w8 (FLT_EPSILON) -> fmov s1, wzr
-# Hair and cloth (upstream 290ec9f, 8f8022f): the actor animation update builds a second clock {seconds = factor / 30,
+# Hair and cloth: the actor animation update builds a second clock {seconds = factor / 30,
# ratio = factor} per rendered frame. Three inlined places: at the fmul, seconds = measured seconds * factor; at the
# store of the factor into the ratio slot, measured ratio * factor. The call of the shared update (main+0x89822c)
-# scales s2 (seconds) and s3 (ratio) by the measured ratio. Upstream's veneer bodies, inlined at the site.
+# scales s2 (seconds) and s3 (ratio) by the measured ratio. The replacement bodies are inlined at the site.
site cloth main 82192c 1e200900 f81f0fe9 @page:x9 bd400520 1e200900 f84107e9 # fmul s0, s8, s0
site cloth main 821928 bd0127e8 d10083ff f90003e9 3d8007ff @page:x9 bd40013f 1e3f091f bd0147ff 3dc007ff f94003e9 910083ff # str s8, [sp, #0x124]
site cloth main 822a64 1e200900 f81f0fe9 @page:x9 bd400520 1e200900 f84107e9 # fmul s0, s8, s0
@@ -51,21 +50,21 @@ site cloth main 83182c 1e210801 f81f0fe9 @page:x9 bd400521 1e210801 f84107e9 #
site cloth main 831830 bd0137e0 d10083ff f90003e9 3d8007ff @page:x9 bd40013f 1e3f081f bd0157ff 3dc007ff f94003e9 910083ff # str s0, [sp, #0x134]
site cloth main 8222f0 9401d7cf @page:x8 bd400104 1e240842 1e240863 9401d7cf # bl 0x89822c
-# Trampolines (upstream 27c3b43): the slow-motion check compares time object +0x28 (30 / (ratio * time scale)) with
+# Trampolines: the slow-motion check compares time object +0x28 (30 / (ratio * time scale)) with
# 100; compare +0x28 * +0x38 (30 / time scale) instead, the same value at 30 Hz and independent of the frame rate.
site bounce main bda798 bd402900 bd402900 bd403901 1e210800 # ldr s0, [x8, #0x28]; ldr s1, [x8, #0x38]; fmul s0, s0, s1
-# Cursor and aim steps (upstream game_patches.c patch_cursor_speed, 363a6eb). These updates read the game's 30 Hz frame
-# ratio for their smoothing but leave it out of the step itself, so the map cursor and the vertical object aim moved
+# Cursor and aim steps. These updates read the game's 30 Hz frame
+# ratio for their smoothing but leave it out of the step itself, so the map cursor and the vertical aim moved
# 2x as fast at 60 fps and 4x at 120 as at the shipping 30 fps (issue #44). Each site multiplies the step by that ratio,
# so the speed is the shipping one at any frame rate. x9 and s16 are free: the next read of x9 follows a write, the
# function does not touch s16, and x20 keeps the update's frame object for the whole function.
set cursor NX2NAVI_HIGHFPS_FIX 1
site cursor main ec3d9c bd400361 f94002e9 bd400930 1e300800 bd400361 # map pan speed s0 *= [[x23] + 8], then ldr s1, [x27]
-site cursor main 1d48d64 1e2a198c 1e2a198c bd400a90 1e30098c # fdiv s12, s12, s10, then s12 *= [x20 + 8]: vertical object aim
-site cursor main 1d484e4 1e200923 1e200923 bd400a90 1e300863 # fmul s3, s9, s0, then s3 *= [x20 + 8]: vertical gyro aim (Recall)
+site cursor main 1d48d64 1e2a198c 1e2a198c bd400a90 1e30098c # fdiv s12, s12, s10, then s12 *= [x20 + 8]: vertical aim
+site cursor main 1d484e4 1e200923 1e200923 bd400a90 1e300863 # fmul s3, s9, s0, then s3 *= [x20 + 8]: vertical gyro aim
-# Output size (upstream games//runtime/game_patches.c patch_output_res; runtime/resolution.c switches the set on).
+# Output size (runtime/resolution.c switches the set on).
# The swapchain size nnMain writes before NvInitializeGraphics comes from page +48 ({w, h} as one 64-bit value), and
# the output size the renderer lays out its canvas, crop and UI in (main+0xcc3f00, read from the graphics parameters
# through main+0xcc4160) from page +32; the renderer itself goes to page +40.
@@ -75,14 +74,14 @@ site output main cc3f50 aa1403e0 @page:x21 # mov x0, x20 -> adrp x21, page
site output main cc3f54 94000083 f90016b3 # bl 0xcc4160 -> str x19, [x21, #40]
site output main cc3f58 f9400015 f94012b5 # ldr x21, [x0] -> ldr x21, [x21, #32]
-# Scene render size (upstream patch_render_res): the renderer's +0xcc4 / +0xcc8, which size every scene render target,
+# Scene render size: the renderer's +0xcc4 / +0xcc8, which size every scene render target,
# take two floats from page +16 instead of the graphics parameters' docked 1600x900.
site scene main cc3f68 5e21d900 @page:x9 # scvtf s0, s8 -> adrp x9, page
site scene main cc3f70 bd0cc660 2d420520 # str s0, [x19, #0xcc4] -> ldp s0, s1, [x9, #16]
site scene main cc3f74 5e21d921 bd0cc660 # scvtf s1, s9 -> str s0, [x19, #0xcc4]
-# Camera aspect ratio for a game resolution that is not 16:9 (upstream game_patches.c, the 1.2.1 sites of aspect_install;
-# runtime/resolution.c res_init writes the output's width / height to page +56 and switches the set on). The same four
+# Camera aspect ratio for a game resolution that is not 16:9
+# (runtime/resolution.c res_init writes the output's width / height to page +56 and switches the set on). The same four
# sites as patches-v143.txt, with the same original words: two camera sites (update and setup) load the camera's copy of
# DefaultAspect 1.777778, two viewport routines divide width by height. The replacement loads the ratio from the page
# instead (Hor+). x10 is kept on the stack, so no register liveness is assumed.
@@ -92,11 +91,11 @@ site aspect main 12521cc bd414260 f81f0fea @page:x10 bd403940 f84107ea # ldr s0
site aspect main 19b36f0 1e211800 f81f0fea @page:x10 bd403940 f84107ea # fdiv s0, s0, s1 (viewport)
site aspect main 1ecdf68 1e211800 f81f0fea @page:x10 bd403940 f84107ea # fdiv s0, s0, s1 (viewport)
-# Texture pool offsets past 2 GiB (MacNativeGames ca311e2d). The texture loader keeps a texture's place in its pool as a
+# Texture pool offsets past 2 GiB. The texture loader keeps a texture's place in its pool as a
# 32-bit offset (main+0xad4294: sub x25, x9, x10, stored as the word w25) and widens it as a signed number for
# nvnTextureBuilderSetStorage's offset and for SetPackagedTextureData's source (the pool's CPU address + offset). The
# shipped heap table keeps every pool far below 2 GiB; a texture pack's heap table with NX2NAVI_APP_POOL raised can make
-# one larger (MacNativeGames saw a 3.58 GiB pool), and every texture past 2 GiB then got storage 4 GiB below its pool.
+# one larger (a 3.58 GiB pool has been seen), and every texture past 2 GiB then got storage 4 GiB below its pool.
# The offset is widened unsigned instead, the same value below 2 GiB, right up to 4 GiB. 1.4.3 needs no patch: its
# loaders (main+0x583c34, main+0x27ed214) keep the offset in 64 bits.
set pooloff NX2NAVI_POOL_OFFSET_PATCH 1
@@ -975,6 +974,5 @@ spin sdk 3d3250 3d3270 # 9 instructions; loads
# cover is, rounded up to 8 at main+0xcec22c and stored as the width (+0x3d8 of the cascade set) and, through the packed
# store at +0xe4, the height (+0x3f8). Near the ground it falls to about 400, which draws foliage shadows blocky, and
# every change of size moves the shadow texels, so leaf shadows jump instead of sliding. The page's fixed size (+92)
-# goes in just before the rounding, as the community's shadow resolution mods do (1.1.0: mov w11, #1024 over the
-# computation). Found by a write watch on the size field (the writer was this function, and no other).
+# goes in just before the rounding. Found by a write watch on the size field (the writer was this function, and no other).
site shadow main cec22c 11001d6b @page:x11 b9405d6b 11001d6b # add w11, w11, #7 -> adrp x11, page; ldr w11, [x11, #92]; add w11, w11, #7
diff --git a/recomp/patches-v143.txt b/recomp/patches-v143.txt
index 7b3ae9d0..72033008 100644
--- a/recomp/patches-v143.txt
+++ b/recomp/patches-v143.txt
@@ -1,7 +1,6 @@
-# Code patches for NX2navi 1.4.3 main (recomp/patches.py). Ported from MacNativeGames
-# games//runtime/game_patches_v143.c (MIT, Copyright (c) 2026 MacNativeGames contributors) at upstream 73c4821,
-# each original word checked against the 1.4.3 main. MacNativeGames branches to veneers after the text; here a
-# veneer's body is the site's replacement. The patch page holds three floats the runtime writes at every present
+# Code patches for NX2navi 1.4.3 main (recomp/patches.py). Copyright (c) 2026 MacNativeGames contributors (MIT; see
+# THIRD_PARTY_NOTICES.md). Each original word is checked against the 1.4.3 main, and each replacement sits in place
+# at its site rather than behind a branch to a veneer. The patch page holds three floats the runtime writes at every present
# (frame_rate.c): +0 the 30 Hz ratio (seconds * 30), +4 the frame step in seconds, +8 the step in 60 Hz ticks.
set fps60 NX2NAVI_FPS60 1
@@ -34,7 +33,7 @@ site realtime main 2daa70 1e201820 d503201f # fdiv s0, s1, s0 -> nop
site realtime main 2daa74 1e2c1001 d503201f # fmov s1, #0.5 -> nop
site realtime main 2daa78 1e210800 d503201f # fmul s0, s0, s1 -> nop
-# Equipment-switch cooldown (issue #18, found by JieML1100): the player update (main+0x2b0368) steps the countdown at
+# Equipment-switch cooldown (issue #18): the player update (main+0x2b0368) steps the countdown at
# player state +0x109c through the timer step (main+0x1b0834, value += ratio * rate) only while it is above FLT_EPSILON,
# but the equipment gate (main+0x31cc7c) blocks weapon, shield and bow changes while it is above 0. Whole 30 Hz steps
# reach exactly 0; a measured ratio leaves a rounding remainder, and one in (0, FLT_EPSILON] is never stepped again and
@@ -56,7 +55,7 @@ site cloth main 28bc98 9400546a @page:x8 bd400104 1e240842 1e240863 9400546a #
# s1 is set again by the fmov two instructions on.
site bounce main 562a64 bd402920 bd402920 bd403921 1e210800 # ldr s0, [x9, #0x28]; ldr s1, [x9, #0x38]; fmul s0, s0, s1
-# Fades (MacNativeGames game_patches_v143.c patch_fade_increment, upstream 3e9e7f67): the distance/LOD mesh fades and
+# Fades: the distance/LOD mesh fades and
# the pre-actor fades add trunc(2.1 * ratio) to a counter each frame: 2 at 30 fps, 1 at 60, 0 above about 63.5 fps
# (ratio below 1 / 2.1), where a fade stops and its object stays translucent or invisible until a slower frame moves
# it on. Each site floors the increment at 1 without the flags: clz is 32 only for 0, so increment += clz >> 5. The
@@ -68,22 +67,22 @@ site fade main 95dd24 1e380008 1e380008 5ac0110a 53057d4a 0b0a0108 # the same,
site fade main 6155e4 1e38000a 1e38000a 5ac0114b 53057d6b 0b0b014a # fcvtzs w10, s0; clz w11, w10; lsr w11, w11, #5; add w10, w10, w11
site fade main 615660 1e38000a 1e38000a 5ac0114b 53057d6b 0b0b014a # the same, second pre-actor fade path
-# Output size (upstream game_patches_v143.c patch_output_res; runtime/resolution.c switches the set on). The swapchain
+# Output size (runtime/resolution.c switches the set on). The swapchain
# size nnMain writes comes from page +48; the display configuration's canvas (+0x10) and active output (+0x508) from
# page +32, and the configuration goes to page +40. x9 is dead at the publication point.
site output main bdb578 d280f008 @page:x8 # mov x8, #0x780 -> adrp x8, page (x9 is built in between)
site output main bdb584 f2c08708 f9401908 # movk x8, #0x438, lsl #32 -> ldr x8, [x8, #48]
site output main 3dcb28 d360fc64 @page:x9 f9001533 f9401123 f9000a63 d360fc64 # lsr x4, x3, #32: x3 = [page+32] first
-# Scene render size (upstream patch_render_res): every path that picks the size meets at main+0x585e48; the renderer's
+# Scene render size: every path that picks the size meets at main+0x585e48; the renderer's
# +0xcc4 / +0xcc8 take two floats from page +16. x3 is scratch in this function; w9 still holds the output size.
site scene main 585e48 1e220160 @page:x3 # scvtf s0, w11 -> adrp x3, page
site scene main 585e50 bd0cc660 2d420460 # str s0, [x19, #0xcc4] -> ldp s0, s1, [x3, #16]
site scene main 585e54 1e220140 bd0cc660 # scvtf s0, w10 -> str s0, [x19, #0xcc4]
site scene main 585e60 bd0cca60 bd0cca61 # str s0, [x19, #0xcc8] -> str s1, [x19, #0xcc8]
-# Camera aspect ratio for a game resolution that is not 16:9 (upstream game_patches_v143.c and aspect_patch.h
-# aspect_install / aspect_stub; runtime/resolution.c res_init writes the output's width / height to page +56 and
+# Camera aspect ratio for a game resolution that is not 16:9
+# (runtime/resolution.c res_init writes the output's width / height to page +56 and
# switches the set on). Each site leaves the ratio sead's perspective projection (+0xb0) takes in s0: two camera sites
# (update and setup) load the camera's copy of DefaultAspect 1.777778, two viewport routines divide width by height.
# The replacement loads the ratio from the page instead, so a 21:9 output shows more of the world at the sides with
diff --git a/recomp/simd_c.py b/recomp/simd_c.py
index b2469984..7787a544 100644
--- a/recomp/simd_c.py
+++ b/recomp/simd_c.py
@@ -1,4 +1,4 @@
-# Adapted from LAS Recomp tools/simd_c.py @ da35b83 (MIT, Copyright (c) 2026 Peiikai).
+# Copyright (c) 2026 Peiikai (MIT; see THIRD_PARTY_NOTICES.md).
"""Portable C lowering of AArch64 FP / AdvSIMD / crypto / CRC32 instructions (lifter --simd=c).
Every encoding is decoded here at lift time and turned into C over the Cpu struct, calling the static
diff --git a/runtime/audio_effects.c b/runtime/audio_effects.c
index 61d28560..56411303 100644
--- a/runtime/audio_effects.c
+++ b/runtime/audio_effects.c
@@ -47,8 +47,8 @@ static float line_tap(const DelayLine *d,unsigned sample,int offset) {
static float gain10(float x) { return x>=0?1:x<=-5.3f?0:powf(10,x); }
static const float fdn_time[4][4]={{53.953247f,79.192566f,116.238770f,130.615295f},{53.953247f,79.192566f,116.238770f,170.615295f},{5,10,5,10},{47.03f,71,103,170}};
static const float decay_time[4][4]={{7,9,13,17},{7,9,13,17},{1,1,1,1},{7,7,13,9}};
-/* Early reflections are indexed by EarlyMode. These are Ryujinx.Audio's five
- tables; its own version reads the first row for every mode. */
+/* Early reflections are indexed by EarlyMode: five tables, one per mode, rather
+ than the first row for every mode. */
static const float early_time[5][10]={
{0,3.5f,2.8f,3.9f,2.7f,13.4f,7.9f,8.4f,9.9f,12},
{0,11.8f,5.5f,11.2f,10.4f,38.1f,22.2f,29.6f,21.2f,24.8f},
diff --git a/runtime/audio_mixer.c b/runtime/audio_mixer.c
index 62b51bb5..66f33070 100644
--- a/runtime/audio_mixer.c
+++ b/runtime/audio_mixer.c
@@ -12,11 +12,11 @@
// device; NX2NAVI_AUDIO_PREFILL_MS (0..500, default 20, 60 on Linux) is the queued audio the output waits for after start or underrun.
// The device's clock paces the render thread, as the audio hardware paces the Switch's DSP (audio_mixer_pace_ns): a
// frame is rendered when the ring holds less than the output target, max(prefill, two device periods), so the queue and
-// the delay from the game to the speakers stay there and the host and device clocks cannot drift apart. LASRecomp and
-// SavageWindRecomp pace their renderers by the SDL stream the same way. Without a device, while the renderer is
+// the delay from the game to the speakers stay there and the host and device clocks cannot drift apart.
+// Without a device, while the renderer is
// stopped and while the device takes nothing (a stall), the render thread keeps real time on its own timer; what piled
// up meanwhile is skipped on the SDL thread once the device resumes (more than QUEUE_SLACK_MS above the target plus the
-// device's request), as MacNativeGames' audio_mixer.c trims its ring after a device stall.
+// device's request), which trims the ring after a device stall.
#include
#include
#include
diff --git a/runtime/audren.c b/runtime/audren.c
index 9dd23e45..65feb3eb 100644
--- a/runtime/audren.c
+++ b/runtime/audren.c
@@ -96,7 +96,7 @@ static void update_voice(AudioRenderer *r, const AudrenVoiceIn *in) {
v->use_float_biquads = 0;
if (!in->in_use) return;
need(in->wave_buffer_index < 4, "wave buffer index");
- // The play state as the DSP keeps it (Ryujinx VoiceInfo.UpdatePlayState): Stop on a voice that is not stopped
+ // The play state as the DSP keeps it: Stop on a voice that is not stopped
// becomes Stopping, which the next render frame turns into Stopped after giving back every queued buffer.
if (in->play_state == PLAY_STARTED) v->state = SV_STARTED;
else if (in->play_state == PLAY_PAUSED) v->state = SV_PAUSED;
@@ -134,7 +134,7 @@ static void skip_empty(AudioRenderer *r, ServerVoice *v) {
}
}
-// Each render frame, before mixing (Ryujinx VoiceInfo.UpdateParametersForCommandGeneration): flush, stop, start.
+// Each render frame, before mixing: flush, stop, start.
static void voices_prepare(AudioRenderer *r) {
for (int k = 0; k < r->param.voice_count; k++) {
ServerVoice *v = &r->voices[k];
diff --git a/runtime/audren.h b/runtime/audren.h
index 030c18ba..ac7130a4 100644
--- a/runtime/audren.h
+++ b/runtime/audren.h
@@ -1,5 +1,5 @@
// Adapted from MacNativeGames games//runtime/audio_renderer.h and audio_mixer.h @ b75be8c (MIT, Copyright (c)
-// 2026 MacNativeGames contributors). Wire layouts follow the public libnx audren.h description.
+// 2026 MacNativeGames contributors). Wire layouts follow the public audren:u wire format.
// audren:u, the audio renderer service: RequestUpdate wire formats, the server-side
// renderer state, and the mixer interface (audio_mixer.c: the real mixer with SDL3 output).
#pragma once
@@ -127,7 +127,7 @@ _Static_assert(__builtin_offsetof(AudrenAuxParam, send_info) == 64, "auxiliary e
#define AUDREN_BEHAVIOR_OUT 0xb0u
#define AUDREN_RENDER_INFO_OUT 0x10u
-// Server-side voice: the DSP's view of one client voice (Ryujinx.Audio VoiceInfo, as ported in MacNativeGames).
+// Server-side voice: the DSP's view of one client voice.
typedef struct {
AudrenVoiceIn in;
AudrenBiquadFloat float_biquads[2];
diff --git a/runtime/boot.c b/runtime/boot.c
index bf64b0a8..b08f0507 100644
--- a/runtime/boot.c
+++ b/runtime/boot.c
@@ -27,14 +27,14 @@
#include "platform/platform.h"
#define SYM_INIT_START "_ZN2nn4init5StartEmmPFvvES2_S2_"
-// main: return addresses of nnMain's SetFocusHandlingMode call (1.1.0 and 1.2.1 from this port's analysis of main;
-// 1.4.3 from MacNativeGames' scripts/verify_boot.py) and of the first nvnBootstrapLoader call, per game version.
+// main: return addresses of nnMain's SetFocusHandlingMode call (from the analysis of each build's main)
+// and of the first nvnBootstrapLoader call, per game version.
#define CHECKPOINT_RET (RT_V143 ? 0xbdb48cull : RT_V110 ? 0xeb8c14ull : 0xe7a954ull)
#define NVN_RET (RT_V143 ? 0xbe0360ull : RT_V110 ? 0xebcdecull : 0xe7eb2cull)
#define CTOR_DONE 2 // a module's constructor flag after its DT_INIT ran the init_array
-// The init_array sizes (1.1.0 and 1.2.1: counted in the modules; 1.4.3: DT_INIT_ARRAYSZ); MacNativeGames' boot check
-// expects the same. The three tables carry the same rows, so cb_module_inits walks them by the size of one.
+// The init_array sizes (1.1.0 and 1.2.1: counted in the modules; 1.4.3: DT_INIT_ARRAYSZ).
+// The three tables carry the same rows, so cb_module_inits walks them by the size of one.
typedef struct { const char *name; uint64_t entries; } InitCount;
static const InitCount inits_110[] = {{"main", 10668}, {"subsdk0", 45}, {"sdk", 116}};
static const InitCount inits_121[] = {{"main", 10673}, {"subsdk0", 45}, {"sdk", 116}};
@@ -78,7 +78,7 @@ static void cb_loader_ready(Cpu *c) {
}
// DT_INIT registers the module with musl (__nnmusl_init_dso) and runs its init_array; the constructor flag reads 2
-// afterwards (MacNativeGames loader.c:458-462).
+// afterwards.
static void cb_module_inits(Cpu *c) {
kern_seed_tls(); // the SDK clears the thread-local region during init; put the TLS back where it reads it
{ // where the sdk's lock thunks actually land once the loader has resolved them
diff --git a/runtime/frame_rate.c b/runtime/frame_rate.c
index e4087946..a4363f08 100644
--- a/runtime/frame_rate.c
+++ b/runtime/frame_rate.c
@@ -16,12 +16,12 @@
//
// The floor: with a shorter step (ratio below 0.125) 1.4.3 aborts within seconds of some save loads (issue #241, a
// 280 Hz monitor): Havok's hkDefaultMemoryImpl reports "Out of memory" for the buffer the physics pre-solve (profiler
-// scope "TtPreSolve") resizes in main+0x1261630. Forced steps on the Depths save: 1/240 s plays, 1/244 s and shorter
+// scope "TtPreSolve") resizes in main+0x1261630. Forced steps on one save: 1/240 s plays, 1/244 s and shorter
// abort; the field, sky island and fight saves play at 1/280 s, the town save aborts after about 800 frames. The
// same short steps also crash a physics worker reading that buffer's contacts: an access violation in main+0x1292560
// or its caller main+0x1286870 (narrowphase contact setup, reached from the grid task main+0x12f1ea0), reading a
// Havok body's shape at body+0x78 as null or garbage (issues #29 and #92, 240 Hz monitors with fps_limit = display).
-// Steps drawn from 1/252..1/230 s crash the Depths load there in seconds; 1/240..1/230 s plays. The frame limit
+// Steps drawn from 1/252..1/230 s crash that save's load in seconds; 1/240..1/230 s plays. The frame limit
// stops at 240 too (LIMIT_MAX_HZ), so the floor only catches the average dipping under 1/240 s at that limit: a
// present late by less than a period keeps the pacer's phase (nvn_api_obj.c, pace), so the next display interval is
// shorter than the period. No limit makes the game run slower than the clock.
@@ -118,7 +118,7 @@ static int game_interval = 1; // the present interval of the newest frame (fra
// A build without the fps60 and realtime patch sets (Ocarina) steps its game by the clock itself: walked by the same
// frame-numbered input script, Link covered half the distance at 120 fps that he covers at 60. There the pacer holds
// frames to the limit alone (nvn_api_obj.c present_period), the game's own 60 Hz interval aside, and the limit may be
-// any rate or none (LIMIT_FREE_MAX_HZ, "unlimited"); NX2navi's physics fails past LIMIT_MAX_HZ, Ocarina has no such floor.
+// any rate or none (LIMIT_FREE_MAX_HZ, "unlimited"); LIMIT_MAX_HZ is for builds whose physics fail past it, Ocarina has no such floor.
#define LIMIT_FREE_MAX_HZ 1000
int frame_free_running(void) { return rt_patch_set("fps60") < 0 && rt_patch_set("realtime") < 0; }
int frame_limit_adjustable(void) { return 1; }
@@ -212,8 +212,8 @@ static uint64_t read_ptr(uint64_t a) {
return read_guest(a, &p, 8) ? p : 0;
}
// 1.2.1: [main+0x4728538] (1.1.0: [main+0x4630a68], 1.4.3: [main+0x3add238]) +0x1e8 scene, its component 13 lists the
-// resident actors; the one named "Player" has its position at +0x2b4 (MacNativeGames world_survey.c, game_version.h
-// NX2NAVI_GAME_V121/V143). The 1.1.0 slot was measured from its own dereference chain: 181 scene accesses in that build
+// resident actors; the one named "Player" has its position at +0x2b4.
+// The 1.1.0 slot was measured from its own dereference chain: 181 scene accesses in that build
// read it, and one of them reproduces this walk (the 14-component check, component 13, the 0x70 stride and the name
// compare) instruction for instruction.
static int player_pos(float xyz[3]) {
diff --git a/runtime/fs_host.c b/runtime/fs_host.c
index d585e695..60475bb6 100644
--- a/runtime/fs_host.c
+++ b/runtime/fs_host.c
@@ -1,5 +1,5 @@
// Adapted from MacNativeGames games//runtime/fs_host.c @ b75be8cf (MIT, Copyright (c) 2026 MacNativeGames
-// contributors); the probe follows MacNativeGames' romfs.c runtime_fs_probe and fs_host.c runtime_save_probe.
+// contributors).
// nn::fs host implementation of the functions main imports. RomFS paths and
// handles go to the read-only backend (romfs.c); save, temporary and cache storage are host directories under the
// profile directory (rt_config()->profile, default build/profile):
diff --git a/runtime/gfx.h b/runtime/gfx.h
index dc0c714a..f9e498c9 100644
--- a/runtime/gfx.h
+++ b/runtime/gfx.h
@@ -33,7 +33,7 @@ enum { GFX_TEX_1D = 1, GFX_TEX_1D_ARRAY, GFX_TEX_BUFFER, GFX_TEX_2D, GFX_TEX_2D_
enum { GFX_TYPE_FLOAT, GFX_TYPE_SINT, GFX_TYPE_UINT };
typedef struct { // the translator's answers (Program.cs Accessor)
uint8_t tex_type[32], img_type[32], img_format[32]; // per c2 slot; 0 = not asked; types are GFX_TEX_*,
- // img_format is Ryujinx TextureFormat
+ // img_format is the translator's TextureFormat
uint8_t attr_type[32], frag_out_type[8]; // GFX_TYPE_*
uint16_t local[3]; uint32_t shared_bytes;
uint8_t depth_minus_w;
@@ -90,10 +90,10 @@ typedef struct {
uint16_t set, binding; // as the SPIR-V decorates them: set 0, bindings from 1 per shader (0: support buffer)
int16_t slot; // UBO: c[slot]; SSBO: storage buffer index; TEX: c2 combined slot (handle at 0x20 + 8 slot)
// or, separate, texture slot (0x168 + 8 slot); IMG: image slot (0x120 + 8 slot); -1: other
- uint16_t type; // TEX/IMG: Ryujinx SamplerType: 1 1D, 2 buffer, 3 2D, 4 3D, 5 cube | 0x100 array,
+ uint16_t type; // TEX/IMG: the translator's SamplerType: 1 1D, 2 buffer, 3 2D, 4 3D, 5 cube | 0x100 array,
// 0x200 multisample, 0x400 shadow
uint8_t format; // IMG: declared format as a GfxShaderAnswers.img_format code, 0 unknown
- uint8_t flags; // SSBO: 1 written; TEX/IMG: Ryujinx TextureUsageFlags (4 image store, 8 coherent)
+ uint8_t flags; // SSBO: 1 written; TEX/IMG: the translator's TextureUsageFlags (4 image store, 8 coherent)
int8_t cbuf_slot; // TEX/IMG: constant buffer of the handle (-1: bound texture buffer); SSBO: of its address
uint16_t handle; // TEX/IMG: raw handle (word offset; separate: texture | sampler << 14); SSBO: address offset
uint16_t count; // descriptors (array length)
diff --git a/runtime/gfx_null.c b/runtime/gfx_null.c
index d1d1ff05..dd01f281 100644
--- a/runtime/gfx_null.c
+++ b/runtime/gfx_null.c
@@ -45,8 +45,8 @@ static void null_sampler_register(int id, const samp_par *s) { (void)id, (void)s
static void null_texture_release(const tex_t *t) { (void)t; }
static void null_program_release(const prog_t *p) { (void)p; }
-// The CPU-visible side effects of one op stream, in stream order (MNG nvn_mtl.m mtl_exec and the commit handler:
-// 10618-10642, 1677-1678, 1960-1985). Everything else (draws, dispatches, clears, texture copies) has no effect here.
+// The CPU-visible side effects of one op stream, in stream order.
+// Everything else (draws, dispatches, clears, texture copies) has no effect here.
// Addresses of CPU-invisible pools (the GPU window) hold no host memory, so those writes are dropped.
static void *null_cpu_addr(uint64_t addr, uint64_t size, const char *what) {
if (nvn_gpu_only(addr)) return NULL;
diff --git a/runtime/gfx_present.c b/runtime/gfx_present.c
index 4dcf5bfe..a132f1f1 100644
--- a/runtime/gfx_present.c
+++ b/runtime/gfx_present.c
@@ -63,7 +63,7 @@ void gfx_window_focus_changed(int in) {
t.tm_year + 1900, t.tm_mon + 1, t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec);
}
-// The window was closed: the process ends with it, as in MNG, once a save Commit still running in the background is
+// The window was closed: the process ends with it, once a save Commit still running in the background is
// done. After gfx_window_request_restart the executable then starts again with the same command line and environment
// (plat_restart), and the new process waits until this one is gone (main.c) before it moves the log and opens the
// RomFS and the saves.
diff --git a/runtime/gfx_shader.c b/runtime/gfx_shader.c
index 1bdc4f2f..3628ce27 100644
--- a/runtime/gfx_shader.c
+++ b/runtime/gfx_shader.c
@@ -31,9 +31,9 @@
// Reflection: every shader that enters the cache has its .res.json parsed into GfxShaderRes arrays and its SPIR-V
// scanned for interface Locations and the workgroup size (gfx.h accessors at the end of the file).
//
-// Provenance: the c2 handle ranges of handle_slot are those of MacNativeGames' nx2navi_xlate Service.cs (MIT).
+// The c2 handle ranges of handle_slot are the translator's handle layout.
// The code layout the translator sees (graphics: code[0x30..], compute: code[0..]; c1 = code[c1..length]
-// with c1 and length at control+0x700) follows tools/shader_census.py, itself MacNativeGames' nx2navi shader tooling (MIT).
+// with c1 and length at control+0x700) follows tools/shader_census.py.
#include
#include
#include
@@ -632,7 +632,7 @@ static GfxShader *disk_load(const uint8_t key[32], const uint8_t *iid) {
static const char *const tex_names[] = {NULL, "1d", "1darray", "buffer", "2d", "2darray", "2dms", "2dmsarray", "3d",
"cube", "cubearray"}; // GfxShaderAnswers tex_type / img_type codes
-static const char *const fmt_names[] = { // img_format codes: Ryujinx TextureFormat enum order
+static const char *const fmt_names[] = { // img_format codes: the translator's TextureFormat enum order
NULL, "R8Unorm", "R8Snorm", "R8Uint", "R8Sint", "R16Float", "R16Unorm", "R16Snorm", "R16Uint", "R16Sint", "R32Float",
"R32Uint", "R32Sint", "R8G8Unorm", "R8G8Snorm", "R8G8Uint", "R8G8Sint", "R16G16Float", "R16G16Unorm", "R16G16Snorm",
"R16G16Uint", "R16G16Sint", "R32G32Float", "R32G32Uint", "R32G32Sint", "R8G8B8A8Unorm", "R8G8B8A8Snorm",
@@ -695,7 +695,7 @@ static int fmt_code(const char *name) {
return 0;
}
-// c2 slot of a texture or image handle (Service.cs of MNG's nx2navi_xlate: combined handles at 0x20, 32 slots; images at
+// c2 slot of a texture or image handle (the translator's layout: combined handles at 0x20, 32 slots; images at
// 0x120; separate textures at 0x168), -1 outside those ranges or for a handle in another constant buffer.
static int handle_slot(int kind, int cbuf_slot, int handle, int separate) {
if (cbuf_slot >= 0 && cbuf_slot != 2) return -1;
@@ -740,7 +740,7 @@ enum { OP_ENTRY_POINT = 15, OP_EXECUTION_MODE = 16, OP_TYPE_INT = 21, OP_TYPE_FL
OP_TYPE_ARRAY = 28, OP_TYPE_POINTER = 32, OP_VARIABLE = 59, OP_DECORATE = 71,
DEC_BUILTIN = 11, DEC_LOCATION = 30, DEC_COMPONENT = 31, SC_INPUT = 1, SC_OUTPUT = 3, EM_LOCAL_SIZE = 17 };
-// Interface Locations and the compute workgroup size from the module. Ids beyond 2^20 are ignored (Ryujinx modules stay
+// Interface Locations and the compute workgroup size from the module. Ids beyond 2^20 are ignored (translated modules stay
// far below).
static void reflect_spirv(GfxShader *s) {
const uint32_t *w = s->spirv;
@@ -792,9 +792,9 @@ out:
// Every gradient sample (OpImageSampleExplicitLod with Grad) whose two gradients are each built from two components gets
// them transposed, dx = (a, c) and dy = (b, d) from dx = (a, b) and dy = (c, d), by two new OpCompositeConstruct before
// it. NX2navi's shaders fill a TXD's gradient registers per coordinate (du/dx, du/dy, dv/dx, dv/dy), and the translator
-// (Ryujinx, InstEmitTexture EmitTxd) builds dx = (first two registers), dy = (last two) = (du/dx, du/dy) and
+// builds dx = (first two registers), dy = (last two) = (du/dx, du/dy) and
// (dv/dx, dv/dy): a mip level chosen from the wrong derivatives, too sharp on terrain faces turned across the screen,
-// which crawled in patches that followed the faces (1.4.3, the Depths). NX2NAVI_TXD_TRANSPOSE=0 turns it off.
+// which crawled in patches that followed the faces. NX2NAVI_TXD_TRANSPOSE=0 turns it off.
// Applied to the SPIR-V after it is loaded, so the shader cache is untouched.
enum { OP_COMPOSITE_CONSTRUCT = 80, OP_SAMPLE_EXPLICIT = 88, IO_GRAD = 4 };
@@ -1183,8 +1183,8 @@ static size_t build_request(char *o0, const char *hex, const char *stage, const
if (!(l[0] | l[1] | l[2])) l[0] = l[1] = l[2] = 1; // NVN2 controls carry no workgroup size there
o += sprintf(o, ",\"local\":[%u,%u,%u]", l[0], l[1], l[2]);
}
- /* Control byte +0x718 of a fragment shader: early fragment tests (the NVN driver's early-Z-force, MacNativeGames
- ae8f4f4). Without it a shader that stores to memory is depth-tested late, and the G-buffer draws' EQUAL test
+ /* Control byte +0x718 of a fragment shader: early fragment tests (the NVN driver's early-Z-force).
+ Without it a shader that stores to memory is depth-tested late, and the G-buffer draws' EQUAL test
after the depth prepass fails along contour lines. Already part of the code hash (the whole control section). */
if (!strcmp(stage, "ps") && (control[0x718] & 1)) o += sprintf(o, ",\"early_fragment_tests\":true");
int si = !strcmp(stage, "vs") ? 0 : !strcmp(stage, "cs") || !strcmp(stage, "ts") || !strcmp(stage, "ms") ? 2 : 1; // gfx_shader_set_host answers
@@ -2079,7 +2079,7 @@ void gfx_shader_record_flush(int force) {
}
// ---- preparation from record files: the answers met in play (NX2NAVI_TEST_PREPARE_SHADERS=1) or the seed that
-// tools/prepare_shaders.py writes from the MacNativeGames shader list (nx2navi.exe --prepare-shaders). Both use the record
+// tools/prepare_shaders.py writes from its shader list (nx2navi.exe --prepare-shaders). Both use the record
// layouts above; a seed record has a zero input id (the use mask, hence the id, is the translator's to find) and its
// pad byte holds the list priority (0 title, 1 warm-up, 2 rest).
typedef struct { const uint8_t *rec; } PrgIdx;
diff --git a/runtime/host.h b/runtime/host.h
index 7f772a61..b96ae30e 100644
--- a/runtime/host.h
+++ b/runtime/host.h
@@ -274,7 +274,7 @@ void res_fn_hit(uint64_t addr, uint64_t x0); // main.c fnprof_hit:
void res_present(Cpu *c); // nvnQueuePresentTexture: applies a pending scene size
void res_sizes(unsigned out[2], unsigned scene[2]); // the output and scene sizes in effect (the game's own
// until res_init switched the sets on)
-int res_adjustable(void); // the build has the output and scene patch sets (NX2navi)
+int res_adjustable(void); // the build has the output and scene patch sets
int res_is_16x9(unsigned w, unsigned h); // within 1% of 16:9 (the test res_init and romfs.c share)
int res_wants_wide_overlay(const unsigned out[2]); // not 16:9 on a game version with the camera aspect patch
void res_wanted(unsigned out[2]); // the output size NX2NAVI_OUTPUT_RES asks for
diff --git a/runtime/input.c b/runtime/input.c
index 071ac258..1305ee64 100644
--- a/runtime/input.c
+++ b/runtime/input.c
@@ -1,5 +1,5 @@
// Host input for nn::hid (runtime/ov_input.c): an SDL3 gamepad (no SDL window needed), the keyboard and the mouse,
-// merged into Switch npad button bits and stick axes. Button order follows libnx HidNpadButton (ISC). The key and pad
+// merged into Switch npad button bits and stick axes. Button order follows HidNpadButton. The key and pad
// bindings are the tables in input_map.c (nx2navi.ini overrides them). The keyboard and the mouse come from the window
// system's back end (input_wsys.h: input_win.c with Win32, input_sdl.c with SDL), which also owns the cursor capture.
// Keys and their map: docs/controls.md.
@@ -277,7 +277,7 @@ static float mouse_sens_get(void) {
// ---- walk key: the keyboard's stick samples scaled down while a key is held (NX2NAVI_WALK_KEY, NX2NAVI_WALK_SCALE)
// A keyboard key is all or nothing, so every keyboard-driven stick sample is +/-32767 and the game only ever sees a
// full tilt. Holding this key scales those two samples, which gives the half tilt a gamepad gets from its analog range,
-// so the keyboard can walk as well as run. the hardware and eden do the same with their modifier and modifier_scale settings.
+// so the keyboard can walk as well as run.
// Only the keyboard is scaled: the gamepad's axes and the mouse camera sample their own values.
static int walk_key = KEY_NONE; // NX2NAVI_WALK_KEY as a KEY_*, KEY_NONE = off; live (cfg_version)
static float walk_scale = 0.51f; // NX2NAVI_WALK_SCALE, 0.2 to 0.9; live (cfg_version)
@@ -599,7 +599,7 @@ static void pick(int32_t *x, int32_t *y, int32_t kx, int32_t ky) {
if (b > a) { *x = kx; *y = ky; }
}
-// The shake key (B_SHAKE): the game detaches a part fused to what object holds when the right stick swings left and
+// The shake key (B_SHAKE): the game detaches a part fused to the held object when the right stick swings left and
// right a few times. A press swings it for SHAKE_NS, holding keeps it swinging; each side lasts SHAKE_SIDE_NS, two
// frames at the game's 30 fps, so every side is read even at 20 fps. Returns the stick x, 0 while not shaking.
// Under lock.
@@ -933,7 +933,7 @@ int input_rumble(uint16_t low, uint16_t high, uint32_t ms) {
// SDL gamepad sensor axes (SDL_sensor.h, a gamepad held in front of you): x to the right, y up out of the face (lying
// flat face up, +y points at the ceiling), z toward the player (out of the bottom edge). The accelerometer reads the
// push against gravity in m/s^2 (lying flat: y = +9.81); the gyro reads rad/s, counter-clockwise positive (right hand).
-// Switch six-axis axes (nn::hid, as MacNativeGames' GCMotion feed and its Pro Controller HID path use them): x to the
+// Switch six-axis axes (nn::hid): x to the
// right, y toward the top edge (away from the player), z out of the face; acceleration as gravity reads (lying flat:
// z = -1 G). So Switch x = SDL x, Switch y = -SDL z, Switch z = SDL y: a rotation (right-handed to right-handed), so the
// gyro keeps its sense, while the acceleration is also negated (push -> gravity) and scaled to G.
diff --git a/runtime/input.h b/runtime/input.h
index 9bf2a147..b1a596ca 100644
--- a/runtime/input.h
+++ b/runtime/input.h
@@ -2,7 +2,7 @@
#pragma once
#include
-// Bits of libnx HidNpadButton (A=0 B=1 X=2 Y=3 StickL=4 StickR=5 L=6 R=7 ZL=8 ZR=9 Plus=10 Minus=11 Left=12 Up=13 Right=14
+// Bits of HidNpadButton (A=0 B=1 X=2 Y=3 StickL=4 StickR=5 L=6 R=7 ZL=8 ZR=9 Plus=10 Minus=11 Left=12 Up=13 Right=14
// Down=15) and the stick directions (StickLLeft..Down 16-19, StickRLeft..Down 20-23, derived from the sticks).
// Sticks are -32767..32767, up is +y. NX2NAVI_INPUT=none reports no input. Callable from any thread.
void input_poll(uint64_t *buttons, int32_t *lx, int32_t *ly, int32_t *rx, int32_t *ry);
diff --git a/runtime/input_map.c b/runtime/input_map.c
index 26291b7b..db7f8850 100644
--- a/runtime/input_map.c
+++ b/runtime/input_map.c
@@ -18,7 +18,7 @@
// the ocarina (left), puts the accessory on (up), calls Navi (right) and changes boots (down); the right stick's press
// resets the camera. So E acts and Left Shift, held, dashes (both A); Space jumps; Left Ctrl and Backspace put away; the
// mouse buttons attack (left), target (right) and reset the camera (middle); O and N are the ocarina and Navi besides 1
-// to 4. SHAKE (NX2navi's object shake) has no key: Ocarina has no use for it, and bind_shake still sets one.
+// to 4. SHAKE (the right-stick shake) has no key: Ocarina has no use for it, and bind_shake still sets one.
#define DEFAULT_KEYS \
{KEY_W, B_SL_UP}, {KEY_A, B_SL_LEFT}, {KEY_S, B_SL_DOWN}, {KEY_D, B_SL_RIGHT}, /* move */ \
{KEY_UP, B_SR_UP}, {KEY_LEFT, B_SR_LEFT}, {KEY_DOWN, B_SR_DOWN}, {KEY_RIGHT, B_SR_RIGHT}, /* camera, second source */ \
diff --git a/runtime/input_map.h b/runtime/input_map.h
index 039935f8..2b297e4f 100644
--- a/runtime/input_map.h
+++ b/runtime/input_map.h
@@ -6,9 +6,9 @@
#include
#include
-// Actions are the bit numbers of libnx HidNpadButton (input.h); 16..23 are the stick directions, which keys drive as
+// Actions are the bit numbers of HidNpadButton (input.h); 16..23 are the stick directions, which keys drive as
// stick deflection. B_SHAKE is a key of its own, never a button bit: a press shakes the right stick left and right for
-// the game (input.c shake_stick), which detaches a fused part held with object. A pad shakes its own stick.
+// the game (input.c shake_stick), which detaches a fused part from the held object. A pad shakes its own stick.
enum {
B_A = 0, B_B, B_X, B_Y, B_STICK_L, B_STICK_R, B_L, B_R, B_ZL, B_ZR, B_PLUS, B_MINUS, B_LEFT, B_UP, B_RIGHT, B_DOWN,
B_SL_LEFT = 16, B_SL_UP, B_SL_RIGHT, B_SL_DOWN, B_SR_LEFT, B_SR_UP, B_SR_RIGHT, B_SR_DOWN,
diff --git a/runtime/ipc.c b/runtime/ipc.c
index dd7eaba3..70b19141 100644
--- a/runtime/ipc.c
+++ b/runtime/ipc.c
@@ -1,5 +1,5 @@
// Adapted from MacNativeGames games//runtime/ipc.c @ b75be8c (MIT, Copyright (c) 2026 MacNativeGames
-// contributors). Message framing per libnx sf/hipc.h, cmif.h, tipc.h (ISC), read for the layout only.
+// contributors). Message framing per the HIPC, CMIF and TIPC wire layouts.
// In-process Horizon IPC: SVCs 0x15, 0x1F, 0x21, 0x22, the sm: service manager
// and the service table. The SDK client code runs unchanged: requests are read from the calling thread's message
// buffer (TLR, or the user buffer of 0x22) and answered in place. Unknown ports, services and commands stop with their
@@ -361,7 +361,7 @@ static void respond(uint32_t *m, int tipc, const IpcResponse *rs) {
payload += 16;
}
unsigned used = (unsigned)(payload - words) + header + rs->data_size;
- unsigned nwords = tipc ? (used + 3) / 4 : (used + 16 + 3) / 4; // CMIF keeps alignment slack like libnx
+ unsigned nwords = tipc ? (used + 3) / 4 : (used + 16 + 3) / 4; // CMIF keeps alignment slack
if ((size_t)(words - (uint8_t *)out) + nwords * 4 > IPC_MSG_BYTES) rt_fatal("ipc: response exceeds the message buffer");
if (tipc) memcpy(payload, &rs->result, 4);
else {
@@ -602,7 +602,7 @@ static void msg_build(uint32_t *m, const Msg *q) {
uint32_t h[4] = {CMIF_IN_MAGIC, 0, q->cmd, 0};
memcpy(payload, h, 16);
if (q->size) memcpy(payload + 16, q->data, q->size);
- ndata = (16 + 16 + q->size + 3) / 4; // libnx reserves the 16-byte alignment pad in the data size
+ ndata = (16 + 16 + q->size + 3) / 4; // the 16-byte alignment pad is reserved in the data size
}
m[1] = ndata | (special ? 1u << 31 : 0);
}
diff --git a/runtime/ipc.h b/runtime/ipc.h
index 9b218476..c96878f3 100644
--- a/runtime/ipc.h
+++ b/runtime/ipc.h
@@ -1,5 +1,5 @@
// Adapted from MacNativeGames games//runtime/ipc.h @ b75be8c (MIT, Copyright (c) 2026 MacNativeGames
-// contributors). Message framing per libnx sf/hipc.h, cmif.h, tipc.h (ISC), read for the layout only.
+// contributors). Message framing per the HIPC, CMIF and TIPC wire layouts.
// In-process Horizon IPC: HIPC messages with CMIF or TIPC payloads, answered in
// place in the caller's message buffer. Services are host implementations looked up by name through sm:.
#pragma once
diff --git a/runtime/kernel.c b/runtime/kernel.c
index 0fd5cff2..3eaabfdd 100644
--- a/runtime/kernel.c
+++ b/runtime/kernel.c
@@ -34,7 +34,7 @@
#define CORE_MASK_ALL ((1ull << NCORE) - 1)
#define HOST_STACK (256ull << 20) // reserved, committed on demand
#define TLR_SIZE 0x200
-#define THREAD_OBJ_SIZE 0x400 // "current thread object" at TLR+0x1F8 (d2r-mobile thread.c)
+#define THREAD_OBJ_SIZE 0x400 // "current thread object" at TLR+0x1F8
#define TLS_SIZE 0x2000
#define MAIN_STACK (1ull << 20) // main.npdm META+0x1C
#define MAIN_PRIO 44 // META+0xE
@@ -354,19 +354,19 @@ static int core_allowed(const RtThread *t, int c) {
// MacNativeGames contributors): Horizon gives a core to a strictly better thread the moment that thread is ready.
// Here a better waiter only marks the owner, which gives the core up at its next SVC or indirect call; an owner in a
// stretch of game code with neither keeps it (NX2NAVI_CORE_DIAG: 0.5-1.1 ms of thread-time per frame, waits to 16 ms and
-// more). With it on, three parts, all of which MacNativeGames found necessary:
+// more). With it on, three parts, all of them necessary:
// - The waiter interrupts the owner (plat_intr_stop) when it has waited AP_FIRST_NS, then every
// millisecond: if the owner's host rip is in the lifted modules' code (g_gen_lo..g_gen_hi) and its host depth is 0
// (not in a host call or SVC, nor in game code a host call made), it holds no host lock, so its rip is moved to
// kern_ap_stub, which saves every volatile register, gives the core up like a checkpoint (kern_ap_yield) and jumps
// back. Otherwise it is only marked, as before.
// - Priority inheritance (eff_prio): a thread owning a guest mutex counts at the priority of the best thread blocked on
-// it, for granting, kicking, preempting and yielding. Without it MacNativeGames' game stopped at its first
+// it, for granting, kicking, preempting and yielding. Without it the game stopped at its first
// "Continue" (a better thread took the core of the low-priority owner of a mutex it then waited for).
// - Horizon's preemption disable: the SDK's spin locks (1.2.1 sdk f_70051242a8, f_7005124360 and siblings) count
// TLR+0x100 (disable_count) while they try or hold the lock, and after clearing it call SVC 0x36 when TLR+0x102
// (interrupt_flag) is set. Such an owner is not preempted, at a checkpoint either: interrupt_flag is set and the
-// switch happens at that SVC. Preempting it anyway hung MacNativeGames' game at "Continue" (the lock holder lost its
+// switch happens at that SVC. Preempting it anyway hung the game at "Continue" (the lock holder lost its
// core to a thread that then spun on that lock).
// NX2NAVI_ASYNC_PREEMPT=0 keeps the old scheduling exactly: raw priorities, no interruption, no disable_count; =2 keeps
// inheritance and the preemption disable without interrupting owners.
@@ -1078,11 +1078,11 @@ void kern_core_back(int *away) {
// A pass of a guest loop that polls memory until another thread changes it. On the Switch it fills only its own core,
// where a better thread pinned there preempts it; here it holds a virtual core and a host core, and pollers that take a
// lock on every pass hand its cache line between their host cores so the thread whose item it is rarely gets it
-// (nxnative found this in Breath of the Wild's job queue). Every pass pauses the host core once. A wait is a run of
+// (a job queue's pollers do this). Every pass pauses the host core once. A wait is a run of
// passes through the same loop at most SPIN_GAP_NS apart; once one has lasted NX2NAVI_SPIN_HANDOFF_US (default 50) and a
// thread waits for a virtual core, each pass gives the core to the waiter, whatever its priority, yields the host CPU
// and takes a core again. Shorter waits keep the core: a lock held for a moment would otherwise make the next pass wait
-// for another thread's next SVC (MacNativeGames). NX2NAVI_SPIN=0 keeps the core always (the gate's own cost only).
+// for another thread's next SVC. NX2NAVI_SPIN=0 keeps the core always (the gate's own cost only).
#define SPIN_GAP_NS 20000ull
static int g_spin_on = -1;
static uint64_t g_spin_handoff_ns;
@@ -1863,8 +1863,8 @@ int kern_svc(Cpu *c, uint32_t imm) {
case 0x1C: { // WaitProcessWideKeyAtomic(x0 lock, x1 key, w2 tag, x3 timeout)
// The key is set before the lock is released. The SDK's Signal reads the key in user mode and skips svc 0x1D
// when it is 0, and user mode takes the lock without G: releasing first lets another thread take the lock,
- // change the condition, read key 0 and wake nobody, after which this thread waits forever (MNG threads.c
- // 439-446). Linking into the wait list happens in block, still holding G, so svc 0x1D cannot come between.
+ // change the condition, read key 0 and wake nobody, after which this thread waits forever.
+ // Linking into the wait list happens in block, still holding G, so svc 0x1D cannot come between.
RtThread *t = cur(imm);
uint64_t addr = x[0], key = x[1];
lock();
@@ -1875,7 +1875,7 @@ int kern_svc(Cpu *c, uint32_t imm) {
t->wtag = (uint32_t)x[2];
lock_handoff(addr);
cv_hook();
- } else { // the probe's negative control: MNG's pre-fix order
+ } else { // the probe's negative control: the old order (release, then set the key)
lock_handoff(addr);
cv_hook();
st32(key, 1);
@@ -1949,8 +1949,8 @@ int kern_svc(Cpu *c, uint32_t imm) {
if (type != 0) {
int32_t nv = val + 1;
if (type == 2) {
- // Waking all (count <= 0) with waiters subtracts 2, not 1 (mesosphere
- // KAddressArbiter::SignalAndModifyByWaitingCountIfEqual; the hardware, LAS Recomp and nxnative agree).
+ // Waking all (count <= 0) with waiters subtracts 2, not 1 (Horizon's
+ // KAddressArbiter::SignalAndModifyByWaitingCountIfEqual).
if (cnt <= 0) nv = nw > 0 ? val - 2 : val + 1;
else nv = nw == 0 ? val + 1 : nw <= cnt ? val - 1 : val;
}
@@ -2015,7 +2015,7 @@ int kern_svc(Cpu *c, uint32_t imm) {
int idx = -1;
lock();
g_sync_calls++;
- // Horizon's order (mesosphere KSynchronizationObject::Wait): a signalled object, then timeout 0, then a pending
+ // Horizon's order (KSynchronizationObject::Wait): a signalled object, then timeout 0, then a pending
// CancelSynchronization. The cancel is for the next wait that would block: a poll or a wait on a signalled
// object leaves it pending. A cancel that wakes this wait (CancelSynchronization wakes it with R_CANCELLED; a
// signal wakes it with -1 to look again) ends it cancelled, signalled objects or not.
diff --git a/runtime/kernel.h b/runtime/kernel.h
index 70978a01..1cf1de62 100644
--- a/runtime/kernel.h
+++ b/runtime/kernel.h
@@ -36,6 +36,6 @@ int kern_thread_state(uint32_t handle); // KERN_WAIT_*, KERN_THREA
void kern_core_stats(int *held_now, int *held_max); // virtual-core holders now and the most ever at once
void kern_core_stats_reset(void);
extern volatile int kern_test_cv_old_order; // WaitProcessWideKeyAtomic: release the lock before setting
- // the key (MNG's pre-fix order, the negative control)
+ // the key (the old order, the negative control)
extern void (*volatile kern_test_cv_hook)(void); // called right after the lock release, holding the kernel lock
extern void (*volatile svc_test_exit_hook)(unsigned code); // svc 0x07 calls it instead of ExitProcess (probes)
diff --git a/runtime/kernel_probe.c b/runtime/kernel_probe.c
index 1e3bfe21..9be2a9a8 100644
--- a/runtime/kernel_probe.c
+++ b/runtime/kernel_probe.c
@@ -305,7 +305,7 @@ static void test_arbiter(Cpu *c) {
CHECK(sig(c, 2, 5, 0) == 0 && g_arb == 6, "signal type 2, no waiter, count 0: value %d (want 6)", (int32_t)g_arb);
ArbJob jc = {.type = 2, .value = 6, .timeout = -1};
h = arb_spawn(c, &jc);
- // Waking all (count <= 0) with waiters subtracts 2 (mesosphere KAddressArbiter::SignalAndModifyByWaitingCountIfEqual).
+ // Waking all (count <= 0) with waiters subtracts 2 (Horizon's KAddressArbiter::SignalAndModifyByWaitingCountIfEqual).
CHECK(sig(c, 2, 6, -1) == 0 && g_arb == 4, "signal type 2, 1 waiter, count -1: value %d (want 4)", (int32_t)g_arb);
join(c, h);
g_arb = 6;
@@ -390,7 +390,7 @@ static void test_events(Cpu *c) {
join(c, h);
CHECK(g.r == KERN_R_CANCELLED, "wait after a cancel: %#x", g.r);
- // A pending cancel is for the next WaitSynchronization that would block (mesosphere KSynchronizationObject::Wait:
+ // A pending cancel is for the next WaitSynchronization that would block (Horizon's KSynchronizationObject::Wait:
// signalled objects first, then timeout 0, then the cancel): a poll times out and a wait on a signalled object
// succeeds, both leaving it pending; the next blocking wait ends cancelled. The blocking waits have a 500 ms
// timeout, so a cancel used up too early shows as a timeout instead of a hang.
diff --git a/runtime/loader.c b/runtime/loader.c
index d512cbab..406d78be 100644
--- a/runtime/loader.c
+++ b/runtime/loader.c
@@ -253,8 +253,7 @@ static void parse_dynamic(Mod *m) {
m->njmprel = pltsz / sizeof(Elf64Rela);
}
-// The constructor state flag DT_INIT checks: ADRP xN at DT_INIT+16, LDR wM, [xN, #imm] at +20 or +24
-// (MNG scripts/prepare_runtime.py).
+// The constructor state flag DT_INIT checks: ADRP xN at DT_INIT+16, LDR wM, [xN, #imm] at +20 or +24.
static uint64_t decode_ctor_flag(const Mod *m) {
uint64_t init = m->pub.init;
if (!init) return 0;
@@ -319,7 +318,7 @@ static void mark_used(int observers, const char *name) {
if (!strcmp(hostfn_table_name(observers, i), name)) (observers ? obs_used : ovr_used)[i] = 1;
}
-// Order (MNG loader.c:216-224): observer (JUMP_SLOT only), override by name, own definition, other modules in load
+// Order: observer (JUMP_SLOT only), override by name, own definition, other modules in load
// order, weak -> 0, strong -> named fatal stub. Overrides also replace a module's own symbols.
static Res resolve(Mod *m, uint32_t si, int jump) {
Res *cache = jump ? &m->res_jump[si] : &m->res_plain[si];
@@ -412,7 +411,7 @@ static void count_imports(Mod *m) {
}
}
-// Every non-JUMP_SLOT reference to nnMain holds the real address (MNG loader.c:229-239).
+// Every non-JUMP_SLOT reference to nnMain holds the real address.
static void verify_identity(void) {
uint64_t real = ldr_symbol("nnMain");
if (!real) rt_fatal("loader: nnMain is not defined");
@@ -552,8 +551,8 @@ uint64_t ldr_plt_stub(const char *module, const char *name) {
}
// ---- --probe-loader
-// Expected values, measured on the 1.1.0, 1.2.1 and 1.4.3 modules; the 1.4.3 relocation totals match the ones
-// MacNativeGames' port notes give for that version. 1.1.0 shares subsdk0 and sdk with 1.2.1 down to every count.
+// Expected values, measured on the 1.1.0, 1.2.1 and 1.4.3 modules.
+// 1.1.0 shares subsdk0 and sdk with 1.2.1 down to every count.
typedef struct {
const char *name;
uint64_t kinds[K_COUNT], total, sym_import, sym_own;
diff --git a/runtime/memory.c b/runtime/memory.c
index 375525e6..8980de94 100644
--- a/runtime/memory.c
+++ b/runtime/memory.c
@@ -570,7 +570,7 @@ uint32_t mem_query(uint64_t a, RtMemoryInfo *out) {
r.perm = PERM_RX;
}
// Moved stacks: the destination is Stack, the source Normal without access; free and normal regions around them
- // are clipped (MNG services.c).
+ // are clipped.
for (unsigned i = 0; i < nstack_maps; i++) {
const StackMap *m = &stack_maps[i];
uint64_t end = m->dst + m->size, send = m->src + m->size;
diff --git a/runtime/mods.c b/runtime/mods.c
index 5dc6fddc..459855f9 100644
--- a/runtime/mods.c
+++ b/runtime/mods.c
@@ -1,7 +1,7 @@
// Player mods: the scan of the mods folder, its order and switches (mods.h).
//
-// One subfolder per mod, as emulators take them. The RomFS root is the first of /romfs, /romfslite (a mod manager's
-// name for it when it bypasses Atmosphere's RomFS build), /atmosphere/contents//romfs,
+// One subfolder per mod, as emulators take them. The RomFS root is the first of /romfs, /romfslite (a mod
+// manager's name for it when it bypasses Atmosphere's RomFS build), /atmosphere/contents//romfs,
// /contents//romfs and //romfs that exists; the ExeFS and cheats folders likewise. A mod is
// listed whatever it holds; what the port cannot use is its problem, shown in the menu and logged, and never stops the
// start. romfs.c serves the RomFS files of the enabled mods, the top one winning a path.
diff --git a/runtime/mouse_direct.c b/runtime/mouse_direct.c
index 8974923e..632176d3 100644
--- a/runtime/mouse_direct.c
+++ b/runtime/mouse_direct.c
@@ -2,7 +2,7 @@
// into a radial dead zone, clamps the radius to one and applies StickExponent. The mouse enters after all three,
// at main+0x874cb4, before the game's X/Y inversion and input-activity flags. It never becomes a HID stick value.
// Free orbit removes that sample again before the camera's additional vertical square/velocity filters and adds
-// raw-count angular deltas at its spherical-angle output instead. object has a separate post-curve hook.
+// raw-count angular deltas at its spherical-angle output instead. Object manipulation has a separate post-curve hook.
// The ordinary stick's result stays, so a controller still uses the game's own response.
//
// This is deliberately not a render-camera override: the game remains responsible for aiming, camera collision,
@@ -284,7 +284,7 @@ static void orbit_angles(Cpu *c) {
c->v[12] = bits; // displaced ldr s12, [sp, #0x44]
}
-// object reads the player's manipulation input rather than the camera's processed stick. Insert the mouse
+// Object manipulation reads the player's manipulation input rather than the camera's processed stick. Insert the mouse
// after that controller's per-axis power curves (main+0x1d59460), preserving the keyboard/controller contribution.
static void hand_input(Cpu *c) {
__atomic_store_n(&hand_update, plat_now_ns(), __ATOMIC_RELEASE);
diff --git a/runtime/nvn_api.h b/runtime/nvn_api.h
index 06182937..a7094955 100644
--- a/runtime/nvn_api.h
+++ b/runtime/nvn_api.h
@@ -102,7 +102,7 @@ int nvn_handle_live(uint64_t handle); // 1 while the handle
uint64_t nvn_handle_bytes(uint64_t handle); // bytes of the copy, OP_BEGIN to OP_END; 0 if not live
uint64_t nvn_submit_count(void); // QueueSubmitCommands calls so far
// Submits a texture pin outlives its last tex_pin and the release of the last recording copy naming it: about 20 s at
-// one submit a frame (MacNativeGames frees after two 600-submit windows).
+// one submit a frame.
#define NVN_PIN_AGE 1200
// Frees the texture pins no recording copy has named for NVN_PIN_AGE submits (nvn_api_cmd.c, "texture pins"), except keep[0..nkeep):
// the replay's current render targets, which carry over to the next submission. Called between submissions by the
diff --git a/runtime/nvn_api_cmd.c b/runtime/nvn_api_cmd.c
index d168d23d..f53000c0 100644
--- a/runtime/nvn_api_cmd.c
+++ b/runtime/nvn_api_cmd.c
@@ -246,9 +246,8 @@ static void copy_view(view_t *dst, uint8_t *has, const NVNtextureView *v) {
// - the replay's current render targets carry over to later submissions and are compared by pointer (vk_exec.c set_rt),
// so a freed address reused by a new pin would read as the same target: nvn_pins_sweep runs between submissions on
// the thread that replays them and keeps the pins it is given.
-// MacNativeGames hit the same growth (3.16 million copies, 405 MB after 27 minutes) and marks pins by walking every live
-// recording each window (hle_nvn.c pin_scan); counting at copy and release walks each copy's ops once more, when it is
-// freed. NX2NAVI_PIN_SWEEP=0 keeps every copy.
+// Instead of marking pins by walking every live recording each window, counting at copy and release walks each
+// copy's ops once more, when it is freed. NX2NAVI_PIN_SWEEP=0 keeps every copy.
typedef struct {
tex_t t; // first: ops hold pins as tex_t pointers
uint64_t last_use; // nsubmits at the last tex_pin or the last drop of refs
@@ -1036,7 +1035,7 @@ NVN_API(nvnCommandBufferDrawElementsInstanced) {
}
// void nvnCommandBufferDrawElementsIndirect(NVNcommandBuffer *cmd, NVNdrawPrimitive prim, NVNindexType type,
// NVNbufferAddress indices, NVNbufferAddress indirect): the arguments at indirect are often GPU-written, so the replay
-// draws with vkCmdDrawIndexedIndirect from the pool buffer (nxnative hle_nvn.c, SavageWindRecomp cmdbuf.c)
+// draws with vkCmdDrawIndexedIndirect from the pool buffer
NVN_API(nvnCommandBufferDrawElementsIndirect) {
*REC(cmd_of(c), OP_DRAW_IDX_IND, p_draw_idx_ind) = (p_draw_idx_ind){(int)arg_x(c, 1), (int)arg_x(c, 2), arg_x(c, 3), arg_x(c, 4)};
}
@@ -1133,8 +1132,8 @@ NVN_API(nvnCommandBufferCopyTextureToTexture) {
}
// void nvnCommandBufferDownsample(NVNcommandBuffer *cmd, const NVNtexture *src, const NVNtexture *dst): level 0 of src
// into level 0 of dst, whole extents, filtered. Recorded as a linear-filter texture copy: copy_t2t resolves a
-// multisample source into an equal-size target and blits (2x2 average at half size) between sizes. As nxnative
-// hle_nvn.c and SavageWindRecomp cmdbuf.c record it; docs/maxwell.md 1.19.
+// multisample source into an equal-size target and blits (2x2 average at half size) between sizes
+// (docs/maxwell.md 1.19).
NVN_API(nvnCommandBufferDownsample) {
p_copy_t2t *o = REC(cmd_of(c), OP_COPY_T2T, p_copy_t2t);
o->src = tex_pin(arg_p(c, 1));
diff --git a/runtime/nvn_api_core.c b/runtime/nvn_api_core.c
index d7fdb2ad..8382e673 100644
--- a/runtime/nvn_api_core.c
+++ b/runtime/nvn_api_core.c
@@ -139,7 +139,7 @@ const pool_t *nvn_pool_find(uint64_t addr, uint64_t len) {
return p;
}
-// Physical and virtual pools (MacNativeGames nx2navi_vpool.c checks). A CPU-invisible one gets a GPU window range.
+// Physical and virtual pools. A CPU-invisible one gets a GPU window range.
// A CPU-visible physical pool (1.4.3: flags 0x18c, GPU_NO_ACCESS) keeps the game's storage for the CPU; the back end
// gives it device memory as any physical pool (vk_memory.c vk_pool_init), which the GPU reaches through virtual pools.
static int pool_place(pool_t *o) {
@@ -372,7 +372,7 @@ NVN_API(nvnMemoryPoolMap) {
if (o->magic != NVN_POOL_MAGIC || (o->flags & NVN_MEMORY_POOL_FLAGS_CPU_NO_ACCESS)) { ret_x(c, 0); return; }
ret_x(c, (uintptr_t)o->mem);
}
-// MacNativeGames nx2navi_vpool.c: every request is checked before any mapping changes.
+// Every request is checked before any mapping changes.
static int check_request(const pool_t *v, const nvn_mapping_t *r, int i) {
uint64_t end = (uint64_t)r->virtual_offset + r->size;
if (r->virtual_offset < 0 || r->physical_offset < 0 || !r->size) {
diff --git a/runtime/nvn_api_obj.c b/runtime/nvn_api_obj.c
index 5dcb9386..a75fc085 100644
--- a/runtime/nvn_api_obj.c
+++ b/runtime/nvn_api_obj.c
@@ -720,7 +720,7 @@ NVN_API(nvnWindowInitialize) {
t0 ? t0->d.width : 0, t0 ? t0->d.height : 0, t0 ? t0->d.format : 0);
ret_x(c, 1);
}
-// void nvnWindowFinalize(NVNwindow *w): nothing to release (MNG lists it in g_nops)
+// void nvnWindowFinalize(NVNwindow *w): nothing to release
NVN_API(nvnWindowFinalize) { (void)c; }
NVN_API(nvnWindowSetPresentInterval) {
win_t *o = WN(c);
@@ -750,7 +750,7 @@ static uint64_t present_period(const win_t *o) {
return (o->interval > 0 ? (uint64_t)o->interval : 1ull) * 1000000000ull / VSYNC_HZ;
}
-// MacNativeGames nvn_pace.h: the present slot is the previous slot plus one period. Early: wait for the slot. Late by
+// The present slot is the previous slot plus one period. Early: wait for the slot. Late by
// less than a period: present at once and keep the phase. Behind by a period or more: restart from now, no catch-up
// burst. Returns the ns to wait.
static uint64_t pace(uint64_t *target, uint64_t now, uint64_t period) {
diff --git a/runtime/nvn_ext.c b/runtime/nvn_ext.c
index 7fcaa7a7..d5b35705 100644
--- a/runtime/nvn_ext.c
+++ b/runtime/nvn_ext.c
@@ -164,7 +164,7 @@ NVN_API(nvnTextureViewSetSwizzle) {
v->set_swizzle = 1;
}
// void nvnTextureViewSetDepthStencilMode(NVNtextureView *v, NVNtextureDepthStencilMode mode): STENCIL makes the replay
-// sample a depth-stencil texture through a stencil-aspect view (vk_exec_draw.c get_view; nxnative hle_nvn.c)
+// sample a depth-stencil texture through a stencil-aspect view (vk_exec_draw.c get_view)
NVN_API(nvnTextureViewSetDepthStencilMode) {
uint32_t m = (uint32_t)arg_x(c, 1);
if (m > NVN_TEXTURE_DEPTH_STENCIL_MODE_STENCIL) rt_fatal("nvn: invalid texture view depth-stencil mode %u", m);
diff --git a/runtime/nvn_obj.h b/runtime/nvn_obj.h
index 4f447822..4221e564 100644
--- a/runtime/nvn_obj.h
+++ b/runtime/nvn_obj.h
@@ -56,7 +56,7 @@ typedef struct {
} tex_t; FITS(tex_t, NVNtexture);
// NX2NAVI: the game reserves 16 bytes for NVNtextureView on its stack (main+0x823398 SetDefaults at sp+0x30, its own
// data at sp+0x40), so the view is packed into 16 bytes. swz = NVN view swizzle selectors. dsmode:
-// NVNtextureDepthStencilMode (nxnative nvn_obj.h:42 packs it the same way).
+// NVNtextureDepthStencilMode.
typedef struct {
uint8_t set_levels : 1, set_layers : 1, set_format : 1, set_target : 1, set_swizzle : 1, set_dsmode : 1, dsmode : 2;
uint8_t base_level, nlevels, target; uint16_t min_layer, nlayers; uint16_t format; uint8_t swz[4]; uint8_t pad1[2];
diff --git a/runtime/nvn_probe.c b/runtime/nvn_probe.c
index 30f3a452..a6bfad45 100644
--- a/runtime/nvn_probe.c
+++ b/runtime/nvn_probe.c
@@ -1,8 +1,8 @@
// nx2navi.exe --probe-nvn: the NVN front end and the null back end, called the way the
// game calls them: through the real nvnp_* procs with a synthetic Cpu (AAPCS64 arguments in x0..x7 and v0..v7), on the
// guest main thread, on the null back end whatever NX2NAVI_GPU says. Checks, in order:
-// - pool, buffer, texture, sampler, sync and event objects against MacNativeGames' semantics (hle_nvn.c), the
-// texture storage sizes against the original-SDK goldens of MNG tests/texture_auto_layout/probe.c;
+// - pool, buffer, texture, sampler, sync and event objects against the expected NVN semantics, the
+// texture storage sizes against original-SDK goldens;
// - every op kind recorded through the CommandBuffer procs and parsed back with nvn_op_first/next/payload, and
// CallCommands inlining a recording;
// - the null back end's CPU-visible side effects (event write and add, counter report, buffer copy, uniform update,
@@ -107,7 +107,7 @@ static void probe_device_and_pools(void) {
CHECK(nvn_pool_find(U(pmem) + 0x100, 0x200) == P() && !nvn_pool_find(U(pmem) + PROBE_POOL_SIZE - 8, 16), "pool index");
n_objects += 6;
- // refused: no storage, PHYSICAL | VIRTUAL, a size that is not a 64 KiB multiple (MNG nx2navi_vpool.c)
+ // refused: no storage, PHYSICAL | VIRTUAL, a size that is not a 64 KiB multiple
static NVNmemoryPool bad;
CHECK(make_pool(&bad, NULL, 0x10000, NVN_MEMORY_POOL_FLAGS_CPU_CACHED) == 0, "a pool without storage is refused");
CHECK(make_pool(&bad, gmem, PROBE_GPOOL_SIZE, NVN_MEMORY_POOL_FLAGS_PHYSICAL | NVN_MEMORY_POOL_FLAGS_VIRTUAL) == 0,
@@ -193,7 +193,7 @@ static void set_tex(int fmt, int w, int h, int levels, uint64_t off) {
CALL(nvnTextureBuilderSetStorage, U(&texb), U(&pool), off);
}
-// Four of the 40 original-SDK goldens of MNG texture_auto_layout/probe.c: {format, width, height, levels, size}
+// Four of the 40 original-SDK layout goldens: {format, width, height, levels, size}
static const struct { int format, width, height, levels; uint64_t size; } layout_goldens[] = {
{0x25, 40, 9, 6, 6144}, {0x25, 40, 128, 8, 37888}, {0x48, 160, 160, 8, 57344}, {0x48, 160, 516, 10, 222208}};
diff --git a/runtime/nvn_tex.c b/runtime/nvn_tex.c
index 9d895984..63d62a82 100644
--- a/runtime/nvn_tex.c
+++ b/runtime/nvn_tex.c
@@ -1,5 +1,4 @@
// NVN texture storage size / alignment / per-level offsets (Tegra X1 block-linear layout).
-// Ported from MacNativeGames games//third_party/d2r_gfx/gfx/nvn/nvn_tex.c @ b75be8cf; Apple parts dropped, layout math unchanged.
// Based on deko3d source/dk_image.cpp (zlib license, Copyright (C) 2018-2020 fincs), reproduced below as in MNG's LICENSE.deko3d.
//
// Copyright (C) 2018-2020 fincs
diff --git a/runtime/nvn_tex_probe.c b/runtime/nvn_tex_probe.c
index 7530ee80..ab80dfcb 100644
--- a/runtime/nvn_tex_probe.c
+++ b/runtime/nvn_tex_probe.c
@@ -1,7 +1,7 @@
// nx2navi.exe --probe-nvn-tex: texture storage size, block height, alignment and mip offsets of nvn_tex.c.
// Ported from MacNativeGames games//tests/texture_auto_layout/probe.c @ b75be8cf (MIT, Copyright (c) 2026 jhaizhou).
// The 40 size and block-height goldens are original-SDK CPU queries for uncompressed and BC3-sRGB boundary cases; no game bytes.
-// The old rounded-up heuristic mismatches 16 of them, including the 160x160 shrine pad. MNG's nvn_bl_offset address checks
+// The old rounded-up heuristic mismatches 16 of them, including the 160x160 case. Block-linear address checks
// belong to the deswizzler and are not part of this probe.
#include
#include
diff --git a/runtime/ov_gfx.c b/runtime/ov_gfx.c
index 32b62496..7fe6f6b1 100644
--- a/runtime/ov_gfx.c
+++ b/runtime/ov_gfx.c
@@ -1,6 +1,6 @@
// Adapted from MacNativeGames games//runtime/frontend.m (nn::vi, lines 345-359) and gfx_bridge.c (nv, lines
-// 74-86) @ b75be8cf (MIT, Copyright (c) 2026 MacNativeGames contributors). The nvnBootstrapLoader stop takes the place
-// of MacNativeGames' NVN entry (third_party/d2r_gfx/gfx/nvn/hle_nvn.c:115-118); no code of it is copied.
+// 74-86) @ b75be8cf (MIT, Copyright (c) 2026 MacNativeGames contributors). The nvnBootstrapLoader stop is the entry
+// to the NVN layer.
// Graphics bring-up:
// nv::* record the game's allocator callbacks and graphics work memory (guest addresses) for the NVN layer
// nn::vi::* display, layer and native window identities; the vsync event is bound here
@@ -12,7 +12,7 @@
#include "ov.h"
#include "platform/platform.h"
-#define VI_R_INVALID 0xf601u // MacNativeGames' result for a call on an unknown display or layer
+#define VI_R_INVALID 0xf601u // the result for a call on an unknown display or layer
static OvNvState nv;
static PlatMutex lock = PLAT_MUTEX_INIT;
diff --git a/runtime/ov_input.c b/runtime/ov_input.c
index f26d9a07..07e37d1d 100644
--- a/runtime/ov_input.c
+++ b/runtime/ov_input.c
@@ -5,7 +5,7 @@
// NX2NAVI_OPERATION_MODE=handheld it is the handheld controller (id 0x20, style bit 1) and player 1 is not connected,
// which is the controller the game reads in that mode. Mouse and keyboard report no input. The controller has two
// vibration devices (left, right) played on the gamepad's motors (NX2NAVI_RUMBLE=0: none) and a six-axis sensor fed by
-// the gamepad's gyro and accelerometer (NX2NAVI_MOTION=0, live: reads at rest). State layouts follow libnx HID.
+// the gamepad's gyro and accelerometer (NX2NAVI_MOTION=0, live: reads at rest). State layouts follow the HID shared-memory format.
#include
#include
#include
@@ -161,7 +161,7 @@ static void ov_keyboard_state(Cpu *c) {
plat_mutex_unlock(&lock);
}
-// ---- vibration and six-axis sensor (MacNativeGames hid_feedback.c)
+// ---- vibration and six-axis sensor
// Handles are the SDK's (nn::hid::utility, sdk+0x4a6e00 and sdk+0x4a6ab0): byte 0 the style index (3 full-key,
// 4 handheld), byte 1 the controller id, byte 2 the device (vibration 0 left / 1 right, six-axis 2). Every call under
// the public functions goes through nn::hid::detail (sdk's PLT), answered here instead of by the hid service, including
diff --git a/runtime/ov_media.c b/runtime/ov_media.c
index cc91d265..cf9a7e33 100644
--- a/runtime/ov_media.c
+++ b/runtime/ov_media.c
@@ -11,7 +11,7 @@
#include "host.h"
#include "platform/platform.h"
-#define CODEC_R_INVALID 0x1fcd1u // MacNativeGames' "invalid argument" result for nn::codec
+#define CODEC_R_INVALID 0x1fcd1u // the "invalid argument" result for nn::codec
#define OPUS_WORK_SIZE 0x9000u // what the game is told to reserve: libopus stereo decoder state (about 26 KiB) plus 4 KiB
// One record per initialised decoder object (the guest's HardwareOpusDecoderType). The registry lock only guards the
diff --git a/runtime/ov_system.c b/runtime/ov_system.c
index d1b3a3d5..f27573cb 100644
--- a/runtime/ov_system.c
+++ b/runtime/ov_system.c
@@ -27,7 +27,7 @@
#include "platform/platform.h"
#define NFP_R_DEVICE_NOT_FOUND 0x8073u // nfp: no NFC reader on the host
-#define ACCOUNT_R_INVALID 0x7c67u // MacNativeGames' result for an unknown user handle or uid
+#define ACCOUNT_R_INVALID 0x7c67u // the result for an unknown user handle or uid
#define TIME_R_INVALID 0x74u
#define TIME_R_SOURCE_MISMATCH 0x18074u
@@ -180,7 +180,7 @@ static void ov_focus_mode(Cpu *c) {
// mode 2: on a Switch the system then suspends the whole process while it is out of focus and sends Resume when it
// returns. Here only the game's main thread stops (it waits in PopNotificationMessage for the next message) while its
// loader threads, audio and clocks run on, and a load interrupted that way was seen to never finish (Linux, 1.4.3).
-// So NX2NAVI_ASSUME_FOCUS=1, the default, keeps it at 1, as MacNativeGames does; with 0 it follows the window through
+// So NX2NAVI_ASSUME_FOCUS=1, the default, keeps it at 1; with 0 it follows the window through
// oe_set_focus. The caller of oe_set_focus also pushes OE_MSG_FOCUS_STATE_CHANGED.
//
// The setting is read on every focus change rather than once at start: a focus change is rare, the lookup is a short
@@ -439,7 +439,7 @@ static void ov_show_error(Cpu *c) {
// ==== SDK-internal initialisation (services.c)
static void ov_diag_startup(Cpu *c) { (void)c; rt_log("diag: host diagnostics"); }
static void ov_aoc_initialize(Cpu *c) { (void)c; rt_log("aoc: no add-on content"); }
-// 1.4.3's main lists add-on content (MNG services.c host_aoc_list): there is none.
+// 1.4.3's main lists add-on content: there is none.
// int ListAddOnContent(AddOnContentIndex *out, int offset, int count)
static void ov_aoc_list(Cpu *c) {
int offset = (int)arg_x(c, 1), count = (int)arg_x(c, 2);
@@ -853,8 +853,8 @@ static void ov_user_difference(Cpu *c) {
// ==== nn::pl shared fonts (shared_font.c). NX2navi asks for them only from its font loader, only with Simplified Chinese,
// Korean or Traditional Chinese text, and only for type 0; tools/extract_fonts.py writes
// them from the user's firmware. Each type is read on first use into guest-visible memory as the BFTTF file the pl
-// shared memory holds; Address is 8 bytes past the file start (after the BFTTF header) and Size the decoded font size,
-// as in MNG. The load state is always Loaded: the game spins until it is, so missing files stop with a named fatal at
+// shared memory holds; Address is 8 bytes past the file start (after the BFTTF header) and Size the decoded font size.
+// The load state is always Loaded: the game spins until it is, so missing files stop with a named fatal at
// Address/Size instead of a hang. NX2NAVI_SHARED_FONTS= overrides /../../firmware/shared-fonts.
#define SHARED_FONT_TYPES 6
#define BFTTF_MAGIC 0x7f9a0218u
@@ -881,7 +881,7 @@ const char *ov_shared_font_dir(char *buf, size_t n) {
static uint32_t be32(const uint8_t *p) { return (uint32_t)p[0] << 24 | (uint32_t)p[1] << 16 | (uint32_t)p[2] << 8 | p[3]; }
// The decoded font size of a BFTTF image, 0 if it is not one: big-endian words XORed with key = word0 ^ BFTTF_MAGIC,
-// word1 = font size, then an sfnt (TrueType or OpenType) font (MNG extract_shared_fonts.py bfttf_size).
+// word1 = font size, then an sfnt (TrueType or OpenType) font.
uint64_t ov_bfttf_size(const uint8_t *p, uint64_t len) {
if (len < 12) return 0;
uint32_t key = be32(p) ^ BFTTF_MAGIC, size = be32(p + 4) ^ key, first = be32(p + 8) ^ key;
diff --git a/runtime/patches.c b/runtime/patches.c
index faba7839..47d99740 100644
--- a/runtime/patches.c
+++ b/runtime/patches.c
@@ -5,7 +5,7 @@
// generated without --patches) there are no sets and every site runs the original.
//
// The patch page is the first 4 KiB page after main's image, inside the module window memory.c reserved: replacement
-// code reaches it with one adrp, as MacNativeGames' data page after main (games//runtime/game_patches.c). Its
+// code reaches it with one adrp. Its
// layout belongs to the sets that use it (frame_rate.c: +0 the 30 Hz ratio, +4 the frame step in seconds, +8 the
// step in 60 Hz ticks).
// Probe modes never call rt_patches_init: every set stays off.
diff --git a/runtime/perf.c b/runtime/perf.c
index 42977456..fe1ebf3b 100644
--- a/runtime/perf.c
+++ b/runtime/perf.c
@@ -237,8 +237,8 @@ int rt_knob(const char *name, const char *def) {
// NX2NAVI_ONE_PER_CORE=1: the process keeps the first logical processor of each physical core, so busy threads (the
// render thread, the guest cores, the job workers) never share a core's execution units with another; "ab" switches
-// it with the A/B blocks. Off by default until measured here; Savage Wind Recomp
-// reported +4-10% from the same rule on an 8-core SMT CPU.
+// it with the A/B blocks. Off by default until measured here; the same rule
+// is reported to give +4-10% on an 8-core SMT CPU.
static void cpu_placement(void) {
static int mode = -1, applied = -1;
static uint64_t all, one;
diff --git a/runtime/resolution.c b/runtime/resolution.c
index 7a4a236b..23542f27 100644
--- a/runtime/resolution.c
+++ b/runtime/resolution.c
@@ -1,6 +1,6 @@
// Game resolution: the size the game composes its frame in (its output: canvas, UI and swapchain) and the size of its
// 3D scene, above the shipped 1920x1080 and 1600x900. The game does the rendering itself, as with the community
-// resolution mods (UltraCam, Visual Fixes): the patch sets output and scene (recomp/patches-v121.txt,
+// resolution mods: the patch sets output and scene (recomp/patches-v121.txt,
// patches-v143.txt; MacNativeGames games//runtime/game_patches.c and game_patches_v143.c, MIT, Copyright (c) 2026
// MacNativeGames contributors) make the game read both sizes from the patch page, and the texture heap that holds the
// output- and scene-sized render targets grows with them.
@@ -14,15 +14,15 @@
// 64-bit word, +40 the renderer (1.2.1) or display configuration (1.4.3) the patched code stores there.
// +56 the camera's aspect ratio as a float when the output is not 16:9 (set aspect), +60 the field-of-view factor
// (set fov, res_fov_live).
-// 1.4.3 scales the scene it reads by output width / 1920 (a 2560x1440 output renders its 1600x900 scene at 2128x1200;
-// MacNativeGames measured the same), so its page holds the wanted size divided by that factor and the game's 5/6 needs
+// 1.4.3 scales the scene it reads by output width / 1920 (a 2560x1440 output renders its 1600x900 scene at 2128x1200),
+// so its page holds the wanted size divided by that factor and the game's 5/6 needs
// no scene patch. 1.2.1 renders the size it reads (1600x900 on a 2560x1440 output): its page holds the wanted size, and
// the scene set is on whenever the output differs from 1920x1080.
//
// Heap: agl's DynamicTextureAllocator is one fixed heap, "DynamicTextureAllocatorMem" in
// System/HeapSize/Product.Nin_NX_NVN.HeapDef.byml.zs (113664 KiB, carved from "Graphics", 201728 KiB). At 2560x1440
// the shipped size runs out at the title screen. Both heaps grow by the same amount: the shipped size times the output's
-// pixel ratio above 1920x1080 plus the scene's above 1600x900 (MacNativeGames' measurement: a 3440x1440 canvas with a
+// pixel ratio above 1920x1080 plus the scene's above 1600x900 (measured: a 3440x1440 canvas with a
// 4620x1935 scene crashed at +258 MiB and loaded at +400 MiB; this formula gives +750 MiB there). romfs.c serves the
// rewritten table (res_heapdef_build) in place of the original; memory.c adds the amount to the application pool, so
// no other heap shrinks. Without the rewritten table (a RomFS that lacks it, a format this code does not know) the
@@ -46,7 +46,7 @@
#define SCENE_W 1600
#define SCENE_H 900
#define DTA_KIB 113664u // DynamicTextureAllocatorMem, shipped
-#define SCENE_MAX 4096 // per side, as MacNativeGames' NX2NAVI_RENDER_RES
+#define SCENE_MAX 4096 // per side
#define SHADOW_BASE 960 // the sun shadow map's base size (its cascades: a D16 array of 4 layers)
static struct {
@@ -174,7 +174,7 @@ static uint64_t shadow_kib(void) {
return R.shadow > SHADOW_BASE ? ((uint64_t)R.shadow * R.shadow - SHADOW_BASE * SHADOW_BASE) * 8 * 3 / 1024 : 0;
}
-// The generated C carries the output and scene patch sets (NX2navi's builds). Without them (Ocarina) the game draws at its
+// The generated C carries the output and scene patch sets for the builds that have them. Without them (Ocarina) the game draws at its
// own sizes whatever the settings say, so nothing grows for them: no larger pool or HeapDef, no grown sizes reported.
int res_adjustable(void) { return rt_patch_set("output") >= 0 && rt_patch_set("scene") >= 0; }
diff --git a/runtime/shaders/bc3_encode.comp b/runtime/shaders/bc3_encode.comp
index 01bd8b85..327122d0 100644
--- a/runtime/shaders/bc3_encode.comp
+++ b/runtime/shaders/bc3_encode.comp
@@ -3,7 +3,7 @@
// Texels past the right or bottom edge repeat the last column or row.
//
// Colour: the BC1 four-colour block of the box around the block's colours, its diagonal turned to the sign of the
-// colours' covariance and inset by 1/16 of the range (the bounding-box method of stb_dxt and of the hardware's BC1 recompression),
+// colours' covariance and inset by 1/16 of the range (the bounding-box method),
// then each texel takes the nearest of the four palette entries along that axis. Alpha: the eight-value BC3 alpha
// block between the block's smallest and largest alpha. The bytes are what the texels hold, so an sRGB image keeps
// sRGB-encoded values, as BC3_SRGB expects.
diff --git a/runtime/shaders/color_grade.comp b/runtime/shaders/color_grade.comp
index 580c517c..a9f26ede 100644
--- a/runtime/shaders/color_grade.comp
+++ b/runtime/shaders/color_grade.comp
@@ -1,7 +1,7 @@
#version 450
// Colour adjustment on the present (runtime/vk_color.c): the game's picture, crop rectangle at offset, into an RGBA16F
// image the FSR 1 pass or the blit then scales to the window. Brightness, contrast around mid-grey, saturation against
-// Rec. 709 luma, then a power curve: the order and ranges of STS78721's colour profiles (issue #136).
+// Rec. 709 luma, then a power curve: the order and ranges of the colour profiles of issue #136.
layout(local_size_x = 8, local_size_y = 8) in;
layout(binding = 0) uniform sampler2D src;
layout(binding = 1, rgba16f) uniform writeonly image2D dst;
diff --git a/runtime/shaders/hdr_tonemap.frag b/runtime/shaders/hdr_tonemap.frag
index 1a12f436..78b6ee06 100644
--- a/runtime/shaders/hdr_tonemap.frag
+++ b/runtime/shaders/hdr_tonemap.frag
@@ -9,9 +9,8 @@
// Hue correction (hdr.z, NX2NAVI_HDR_HUE): the game's SDR clamp turns bright saturated colours towards white (a torch flame
// clips red, then green, and reads yellow-white, the colour its emitted light was tuned to); the extended curve keeps
// their ratios, so they stay saturated. From the picture's white upwards the colour moves towards the game's own SDR
-// result at the HDR luminance, by up to hdr.z (RenoDX's NX2navi mod has the same control).
-// Approach after RenoDX's NX2navi mod by souperman9 and Musa (github.com/clshortfuse/renodx, src/games/nx2navi, MIT): its
-// "extended vanilla" curve.
+// result at the HDR luminance, by up to hdr.z.
+// The approach: an "extended vanilla" curve.
// Bindings are those of the game's translated shader: vk_hdr.c rewrites them from the original's names.
layout(location = 0) in vec4 uv;
layout(location = 0) out vec4 color;
diff --git a/runtime/svc.c b/runtime/svc.c
index 3940bd62..f7d72584 100644
--- a/runtime/svc.c
+++ b/runtime/svc.c
@@ -2,7 +2,7 @@
// contributors), lines 304-382.
// The SVC entry of the lifted code: preemption checkpoint, trace, then the thread and
// synchronization SVCs (kernel.c), IPC (ipc.c), memory (memory.c), Break, OutputDebugString, GetInfo and ExitProcess. The 21 SVCs
-// NX2navi has but never reaches on MNG's boot path stop with a named fatal, the caller and the guest backtrace.
+// NX2navi has but never reaches on its boot path stop with a named fatal, the caller and the guest backtrace.
#include
#include
diff --git a/runtime/swkbd.c b/runtime/swkbd.c
index 4e3fbe39..9ca874b7 100644
--- a/runtime/swkbd.c
+++ b/runtime/swkbd.c
@@ -30,7 +30,7 @@
#include "swkbd.h"
#include "platform/platform.h"
-// KeyboardConfig then the work buffer {pointer, size}: offsets read from the SDK setters (MNG) and checked against
+// KeyboardConfig then the work buffer {pointer, size}: offsets read from the SDK setters and checked against
// the SDK by --probe-services. SDK 20.5 (1.4.3) put a text-check callback at +0x4c8 and grew KeyboardConfig from
// 0x4d0 to 0x518 bytes (SetInitialText, SetUserWordList read the work buffer there); the fields below +0x3d8 stay.
#define ARG_WORK (RT_V143 ? 0x518 : 0x4d0)
diff --git a/runtime/tex.h b/runtime/tex.h
index fd79b8be..a3b695ab 100644
--- a/runtime/tex.h
+++ b/runtime/tex.h
@@ -8,7 +8,7 @@
#include "nvn_tex.h"
#include "vk.h"
-// ---- tex_deswizzle.c (MacNativeGames nvn_deswizzle.c, MIT) ----
+// ---- tex_deswizzle.c ----
// Block-linear <-> linear for one level and layer of a texture. The linear side is laid out by block rows: dst_pitch
// bytes per row (>= row bytes of the level), compressed formats one block row per row, 3D textures slice k at
// dst + k * dst_pitch * block rows. LINEAR / LINEAR_RENDER_TARGET storage is copied by pitch. Multisampled and BUFFER
@@ -31,7 +31,7 @@ int nvn_deswizzle_geom(const nvn_texdesc *d, unsigned level, unsigned layer, uin
void tex_bl_copy(uint8_t *bl, uint8_t *lin, size_t pitch, uint32_t row_bytes, uint32_t rows, uint32_t slices,
unsigned th, unsigned td, int to_linear);
-// ---- tex_astc.c (LAS Recomp runtime/nvn/astc.c, MIT) ----
+// ---- tex_astc.c ----
// ASTC LDR 2D to RGBA8, bit-exact with astcenc's 8-bit decode. blocks: row-major 16-byte blocks covering
// ceil(width/bw) x ceil(height/bh); rgba_out: width*height*4 bytes. srgb only selects the sRGB endpoint expansion.
// Error blocks and HDR content decode to magenta.
@@ -42,7 +42,7 @@ bool astc_decode_block(const uint8_t block[16], uint32_t bw, uint32_t bh, bool s
void astc_decode_ldr_mt(const uint8_t *blocks, uint32_t width, uint32_t height, uint32_t bw, uint32_t bh, bool srgb,
uint8_t *rgba_out);
-// ---- vk_formats.c (LAS Recomp runtime/nvn/vulkan/textures.c format table, MIT) ----
+// ---- vk_formats.c ----
typedef struct TexVkFormat {
VkFormat vk; // format of the image created on this GPU
VkFormat ideal; // format the NVN format maps to by itself; differs from vk after a fallback
diff --git a/runtime/tex_deswizzle.c b/runtime/tex_deswizzle.c
index 3ba700d9..eefcdbb8 100644
--- a/runtime/tex_deswizzle.c
+++ b/runtime/tex_deswizzle.c
@@ -1,7 +1,7 @@
// Tegra X1 block-linear <-> linear copies.
// Ported from MacNativeGames games//third_party/d2r_gfx/gfx/tex/nvn_deswizzle.c @ b75be8cf (MIT, Copyright (c) 2026 jhaizhou); comments translated, the copy loop split out as tex_bl_copy.
//
-// Layout (public descriptions: deko3d, Ryujinx BlockLinearLayout):
+// Layout (from public descriptions):
// GOB = 64 bytes x 8 rows = 512 bytes; offset of (x byte, y row) within a GOB =
// (x%64/32)*256 + (y%8/2)*64 + (x%32/16)*32 + (y%2)*16 + x%16
// block = 1 GOB wide x 2^th GOBs high x 2^td GOBs deep, ordered y first then z inside a block; blocks fill the level
diff --git a/runtime/tex_probe.c b/runtime/tex_probe.c
index a56970e0..fc0445bf 100644
--- a/runtime/tex_probe.c
+++ b/runtime/tex_probe.c
@@ -533,7 +533,7 @@ static int test_textures(pool_t *tpool, pool_t *phys) {
vk_write_texels(&g, NULL, &all, gl[0], 256, 256 * 64);
if (read_back(&g, 0, gl, 0, "physical-pool RGBA8 WriteTexels")) return 1;
- // a slot of a finalized texture follows the live texture at the same storage (MNG hle_nvn.c)
+ // a slot of a finalized texture follows the live texture at the same storage
vk_texture_register(5, &b, NULL);
vk_texture_release(&b);
tex_t b2 = make_tex(tpool, 0x40000, 0x25, 16, 12, 1, 4);
diff --git a/runtime/ui/binds_page.cpp b/runtime/ui/binds_page.cpp
index 9f3f9b1b..3b13eb39 100644
--- a/runtime/ui/binds_page.cpp
+++ b/runtime/ui/binds_page.cpp
@@ -236,7 +236,7 @@ void binds_rows(float scale) {
for (int a : kMove) row_action(a, m, layout);
opt_group(UI_BINDS_GROUP_CAMERA);
for (int a : kCamera) row_action(a, m, layout);
- // No row for B_SHAKE: it shook NX2navi's object loose and Ocarina has no use for it (bind_shake still sets a key)
+ // No row for B_SHAKE: Ocarina has no use for it (bind_shake still sets a key)
ImGui::Dummy(ImVec2(0, 6 * scale));
g_reset_asked = opt_button("##binds_reset", UI_BINDS_RESET, UI_BINDS_RESET_DESC);
}
diff --git a/runtime/ui/menu.cpp b/runtime/ui/menu.cpp
index e61ed8c3..1bb02514 100644
--- a/runtime/ui/menu.cpp
+++ b/runtime/ui/menu.cpp
@@ -953,8 +953,8 @@ static void layout_menu(uint32_t w, uint32_t h, float scale) {
static int g_save_pending; // a changed setting still waits for its write to nx2navi.ini (opt_save_tick)
// ---- the performance overlay (NX2NAVI_PERF_OVERLAY), in the top right corner. "fps": the frame rate over the presents of
-// the last half second. "full": a panel of perfmon.c's numbers, in the style of SavageWindRecomp's perf_overlay_draw
-// (menu.mm): the machine's load and temperatures, the frame rate and frame times with a graph, the render thread's waits.
+// the last half second. "full": a panel of perfmon.c's numbers:
+// the machine's load and temperatures, the frame rate and frame times with a graph, the render thread's waits.
// Off, it costs a cfg_version load per present.
static unsigned g_perf_ver = ~0u;
static int g_perf_mode; // 0 off, 1 fps, 2 full
@@ -1097,8 +1097,8 @@ static void perf_picture(const MenuTarget *t, const ImVec4 &c) {
snprintf(v[5], sizeof v[5], "%s", pm ? pm : menu_text(UI_MENU_OV_NONE));
static const UiTextId labels[6] = {UI_MENU_OV_WINDOW, UI_MENU_OV_OUTPUT, UI_MENU_OV_SCENE,
UI_MENU_OV_SCALING, UI_MENU_OV_LIMIT, UI_MENU_OV_PRESENT};
- // The 3D scene's size is known only where resolution.c sets it (NX2navi's patch sets); Ocarina sizes its own scene
- // dynamically and res_sizes would report NX2navi's fixed 1600x900, so the line is left out
+ // The 3D scene's size is known only where resolution.c sets it (the builds with its patch sets); Ocarina sizes its own scene
+ // dynamically and res_sizes would report a fixed 1600x900, so the line is left out
bool scene_known = res_adjustable() != 0;
if (!ImGui::BeginTable("##perfp", 2, ImGuiTableFlags_SizingFixedFit)) return;
float vw = 0;
diff --git a/runtime/ui_text.c b/runtime/ui_text.c
index 5fbf4d1b..7e5a7108 100644
--- a/runtime/ui_text.c
+++ b/runtime/ui_text.c
@@ -2117,7 +2117,7 @@ const char *ui_text_lang(const char *code) {
return code;
}
-// Every game language with the Mals file it reads: EUen/USen, USfr/EUfr, USes/EUes ship in both NX2navi builds; USpt only
+// Every game language with the Mals file it reads: EUen/USen, USfr/EUfr, USes/EUes ship in every version; USpt only
// from 1.4.3; EUpl only in Ocarina (since 999: never by version, ui_text_game_langs_in finds it by its file).
static const struct { const char *code; UiTextId name; int since; const char *mals; } all_langs[] = {
{"en-US", UI_MENU_LANGNAME_EN, 0, "USen"}, {"en-GB", UI_MENU_LANGNAME_EN_GB, 0, "EUen"},
diff --git a/runtime/vk.h b/runtime/vk.h
index 0f0a37e0..fff42311 100644
--- a/runtime/vk.h
+++ b/runtime/vk.h
@@ -364,7 +364,7 @@ void vk_mem_stats(VkMemStats *s);
void vk_mem_shutdown(void); // before vk_shutdown: waits idle, frees every memory and texture object
// Textures. Images are keyed by storage GPU address plus descriptor and stay in VK_IMAGE_LAYOUT_GENERAL. A mirrored
-// texture (CPU-written pool storage, MNG tex_mirrored) is uploaded on first use and again when its storage pages were
+// texture (CPU-written pool storage) is uploaded on first use and again when its storage pages were
// written; once the GPU wrote it (vk_texture_gpu_written) the image is its content. A returned pointer stays valid
// until the next call that may drop textures (release, pool fini); copy what outlives that.
typedef struct {
@@ -404,7 +404,7 @@ void vk_texture_unlock(void);
const VkTexImage *vk_texture_by_id_locked(int id, view_t *view, int *has_view);
VkSampler vk_sampler_by_id_locked(int id);
// The slot's sampler with nearest filtering and no anisotropy: a depth texture read without a compare lands on one texel
-// on the Switch although the game binds a linear sampler, and MacNativeGames samples it the same way. VK_NULL_HANDLE
+// on the Switch although the game binds a linear sampler. VK_NULL_HANDLE
// for an empty slot.
VkSampler vk_sampler_point_by_id_locked(int id);
uint32_t vk_texture_slots_gen(void);
@@ -503,7 +503,7 @@ void vk_backend_shutdown(void); // presents, vk_sync_shutdown, vk_mem
// ---- pipelines (vk_pipeline.c)
// Binding model (comment block at the top of vk_pipeline.c): one descriptor set, set 0, per pipeline. Binding 0 is
-// Ryujinx's support buffer (a uniform buffer every stage shares); the vertex stage keeps its own bindings, the fragment
+// the translator's support buffer (a uniform buffer every stage shares); the vertex stage keeps its own bindings, the fragment
// stage's follow them (its SPIR-V is renumbered). Set 0 is a push-descriptor set unless the pipeline needs more than
// maxPushDescriptors (32 here) descriptors; VkPipeInfo.bindings says what goes where. No push constants.
// Everything a graphics pipeline depends on, as the op stream carries it. Fields covered by dynamic state are read by
diff --git a/runtime/vk_backend.c b/runtime/vk_backend.c
index 247894fb..b8f22acd 100644
--- a/runtime/vk_backend.c
+++ b/runtime/vk_backend.c
@@ -169,7 +169,7 @@ int vk_replay_async(void) {
static int on = -1;
if (on < 0) {
// Off by default. Where the game waits for the GPU it overlaps the replay with the game threads (a GTX 1650 in
- // the Depths went from 450-686 frames over 50 ms a minute to 10-13, issue #88), the only place a gain was
+ // one scene went from 450-686 frames over 50 ms a minute to 10-13, issue #88), the only place a gain was
// measured. While it was the default, a GTX 1660 Ti at the 60 fps cap with the GPU at 26 % reported uneven
// motion that 0.3.4 did not have (#659). It adds up to a frame of latency.
on = cfg_bool("NX2NAVI_REPLAY_ASYNC");
diff --git a/runtime/vk_caps.c b/runtime/vk_caps.c
index 89b148a7..499329e9 100644
--- a/runtime/vk_caps.c
+++ b/runtime/vk_caps.c
@@ -4,7 +4,7 @@
// - no shaderFloat64 (NX2NAVI_VK_NO_FLOAT64=1 clears the feature before vkCreateDevice): the translator lowers FP64 to
// FP32 ("softfloat64"), so no shader declares Float64.
// - minStorageBufferOffsetAlignment above 4 (NX2NAVI_VK_SSBO_ALIGN= raises it): the translator computes
-// storage offsets from the guest address rounded down to that alignment (Ryujinx's unaligned storage path), and
+// storage offsets from the guest address rounded down to that alignment (the translator's unaligned storage path), and
// vk_exec_draw.c ssbo_info binds the rounded-down address, so shader writes reach guest memory instead of a copy.
// - no graphics pipeline library with fast linking (NX2NAVI_GPL=0 forces it): vk_caps.gpl = 0, the extension stays disabled, and pipelines are built whole.
// - no 32-lane pin (no subgroupSizeControl, 32 outside min..max, or NX2NAVI_VK_SUBGROUP_PIN=0): stages run at the
@@ -51,8 +51,8 @@ void vk_caps_driver(VkPhysicalDevice p) {
// driver branch had them off for a while: its device losses at boot (issue #5) came with a cold pipeline cache, but
// their cause was GPU writes past 3D BC images (vk_exec.c, "3D BC render targets"). With that fixed, the RDNA 1/2
// driver boots with GPL from a cold cache and fast-links without a failure, while with GPL off every new pipeline is
-// built whole on the draw's path (frames of 0.5-1.2 s on an RX 6600, issue #381). Savage Wind Recomp turns GPL off on
-// RDNA 4 under RADV for a GPU hang at the title screen.
+// built whole on the draw's path (frames of 0.5-1.2 s on an RX 6600, issue #381). RDNA 4 under RADV is reported to
+// hang the GPU at the title screen with GPL.
int vk_caps_gpl(const VkPhysicalDeviceGraphicsPipelineLibraryFeaturesEXT *f,
const VkPhysicalDeviceGraphicsPipelineLibraryPropertiesEXT *p) {
gpl_lib = f->graphicsPipelineLibrary;
@@ -113,7 +113,7 @@ void vk_caps_init(VkCtx *c) {
for (int i = 0; i < 3; i++) told[i] = vk_caps.sg_pin_stages & stage[i] ? want : sg.subgroupSize;
// Gathers (TLD4) pick their four texels with Maxwell's rounding; AMD and Intel round a coordinate that sits between
// two texels the other way, which draws dark lines along object edges in shadow-map filtering (docs/maxwell.md 2.10;
- // BotW and NX2navi on AMD). The translator biases gather coordinates by the host's sub-texel precision; NVIDIA rounds
+ // seen on AMD). The translator biases gather coordinates by the host's sub-texel precision; NVIDIA rounds
// as Maxwell does. NX2NAVI_GATHER_BIAS= forces it (0: off).
uint32_t gather = env_u32("NX2NAVI_GATHER_BIAS", c->props.vendorID == 0x10de ? 0 : l->subTexelPrecisionBits);
// A register read before any write is an undefined load in SPIR-V, so function-local variables start at 0
diff --git a/runtime/vk_color.c b/runtime/vk_color.c
index c151bdf5..a3fee20f 100644
--- a/runtime/vk_color.c
+++ b/runtime/vk_color.c
@@ -3,8 +3,8 @@
// added), NX2NAVI_COLOR_CONTRAST and NX2NAVI_COLOR_SATURATION (%, 100 = unchanged) and NX2NAVI_COLOR_GAMMA (exponent, 1 =
// unchanged), read when the settings change. NX2NAVI_COLOR_PRESET names a profile (vk_color_preset) whose values win
// over the four, so a profile set in nx2navi.ini or by NX2NAVI_MENU_TEST_SET applies without the menu; custom uses the
-// four. At the default values nothing is recorded and the present is what it was. Design and preset values: STS78721's
-// colour profiles (issue #136).
+// four. At the default values nothing is recorded and the present is what it was. Design and preset values: the
+// colour profiles of issue #136.
//
// One compute pass (shaders/color_grade.comp) reads the crop rectangle of the game's image and writes an RGBA16F image
// of its size, which present_image then hands to FSR or the blit in place of the game's image. The HUD is part of that
diff --git a/runtime/vk_crumbs.c b/runtime/vk_crumbs.c
index f3dcfe58..1450e6ae 100644
--- a/runtime/vk_crumbs.c
+++ b/runtime/vk_crumbs.c
@@ -6,9 +6,8 @@
// writes per crumb, and crumbs mark submissions, upload batches, ASTC chunks and presents, not draws.
//
// Pass marks (vk.h vk_pass_mark_begin) use words 2 and 3 of the same buffer: the replay marks the start and the end of
-// every render pass and dispatch, and a ring of records says what each mark was. The design follows Savage Wind
-// Recomp's GPU checkpoints (refs/SavageWindRecomp runtime/nvn/vulkan/exec.c ck_mark and vk_checkpoints_report: a mark
-// per pass and dispatch, numbers in a ring of 4096, text only at the device loss); the code is ours.
+// every render pass and dispatch, and a ring of records says what each mark was. The design: a mark
+// per pass and dispatch, numbers in a ring of 4096, text only at the device loss.
#include
#include
#include
diff --git a/runtime/vk_device.c b/runtime/vk_device.c
index 332d586d..21fe2204 100644
--- a/runtime/vk_device.c
+++ b/runtime/vk_device.c
@@ -249,7 +249,7 @@ static int create_device(void) {
OPTIONAL_EXT(has_provoking_vertex, VK_EXT_PROVOKING_VERTEX_EXTENSION_NAME, pv, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROVOKING_VERTEX_FEATURES_EXT);
OPTIONAL_EXT(has_robustness2, VK_EXT_ROBUSTNESS_2_EXTENSION_NAME, rob2, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ROBUSTNESS_2_FEATURES_EXT);
OPTIONAL_EXT(has_device_fault, VK_EXT_DEVICE_FAULT_EXTENSION_NAME, fault, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FAULT_FEATURES_EXT);
- // Ryujinx's SPIR-V declares fragment shader interlock whenever the host reports it (vk_pipeline.c spirv_fixup).
+ // The translator's SPIR-V declares fragment shader interlock whenever the host reports it (vk_pipeline.c spirv_fixup).
OPTIONAL_EXT(has_fragment_shader_interlock, VK_EXT_FRAGMENT_SHADER_INTERLOCK_EXTENSION_NAME, fsi,
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_INTERLOCK_FEATURES_EXT);
// NVN2 task and mesh programs (gameplay geometry) draw through VK_EXT_mesh_shader (vk_exec_draw.c op_draw_mesh)
diff --git a/runtime/vk_dlaa.c b/runtime/vk_dlaa.c
index 55afe9e9..095da40d 100644
--- a/runtime/vk_dlaa.c
+++ b/runtime/vk_dlaa.c
@@ -2,8 +2,7 @@
// NGX core: on Windows _nvngx.dll, found through HKLM\SOFTWARE\NVIDIA Corporation\Global\NGXCore; on Linux
// libnvidia-ngx.so.1, which the NVIDIA driver installs on the library path. NGX loads the DLSS model from the folder of
// the executable: nvngx_dlss.dll on Windows, libnvidia-ngx-dlss.so. on Linux. No NVIDIA SDK code or header is
-// compiled in: the few NGX types used are declared here from the SDK's documented ABI, the way the Metroid Dread
-// recomp's dlss.c reaches the core (read for behaviour only).
+// compiled in: the few NGX types used are declared here from the SDK's documented ABI.
//
// The core's parameter object is a C++ class whose virtual functions are called through its vtable: the Set overloads
// in slots 0-7 and the Get overloads in 8-15. MSVC (the Windows core) lays out each group of overloads in reverse
diff --git a/runtime/vk_exec.c b/runtime/vk_exec.c
index ecaaf947..b84a4bd8 100644
--- a/runtime/vk_exec.c
+++ b/runtime/vk_exec.c
@@ -362,8 +362,8 @@ static void resolve_target(const tex_t *t, const view_t *v, int has_v, int depth
if (!o->aspect) o->image = VK_NULL_HANDLE;
}
-/* The size of a pass without attachments: the far corner of viewport 0, else of the scissor, 1..16384, as
- MacNativeGames and nxnative size it. NX2navi draws a fragment shader that only writes a storage buffer into a 1x1
+/* The size of a pass without attachments: the far corner of viewport 0, else of the scissor, 1..16384.
+ NX2navi draws a fragment shader that only writes a storage buffer into a 1x1
viewport; a pass sized by the viewport's width alone puts an offset viewport outside the scissor, and the cave rock
loses its ambient light. */
void vk_exec_noatt_dims(const VkExec *ex, uint32_t *w, uint32_t *h) {
@@ -499,7 +499,7 @@ static int tfr_first(const VkExecTarget *t, uint64_t stamp) {
}
// With any, a recent depth target alone does not make the pass per-frame when a colour target is rendered for the
-// first time: the game's item icon capture (an inventory or Fuse icon) draws into a new colour target with the
+// first time: the game's item icon capture (an inventory icon) draws into a new colour target with the
// per-frame depth buffer, once. Its draws skipped there stay missing from the icon until the item is captured again.
int vk_exec_targets_recent(VkExec *ex, int any) {
resolve_rt(ex);
@@ -838,7 +838,7 @@ static void set_rt(VkExec *ex, const p_set_rt *r) {
// command-buffer state is lost there (bindings and dynamic state: vk_exec_draw_new_cb, ex->dirty); barriers, layouts and
// queries are not: a barrier's first scope is everything earlier in submission order, image layouts belong to the image,
// and occlusion queries end with their pass. Fences, completion callbacks and reports stay per submission: only the last
-// part signals the value. nxnative commits every 64 draws between passes; MacNativeGames after 30, then every 40.
+// part signals the value.
// A part also spans at least NX2NAVI_SPLIT_US (1000) of replay time: a split costs about 40 us of the render thread
// (vkQueueSubmit2, a command buffer, the mirror prologue), and a fight frame of 2,000 draws made 15 parts on the 7900X;
// a millisecond of recording is a fraction of a millisecond of GPU work, so the GPU still starts early.
diff --git a/runtime/vk_exec.h b/runtime/vk_exec.h
index e694760c..c371a801 100644
--- a/runtime/vk_exec.h
+++ b/runtime/vk_exec.h
@@ -43,7 +43,7 @@ extern unsigned vk_cond_clears_run, vk_cond_clears_skip, vk_cond_draws_skip, vk_
void vk_exec_cond_why(const p_render_cond *c, char *buf, size_t cap); // NX2NAVI_LOG_RCOND=ab
// The replay state. One instance lives for the run: NVN state is queue state and carries over from one submission to
-// the next, as in MacNativeGames' and LAS Recomp's replays. The "per command buffer" fields are reset by vk_exec_record.
+// the next. The "per command buffer" fields are reset by vk_exec_record.
typedef struct VkExec {
// ---- per command buffer
VkCommandBuffer cb; // being recorded
diff --git a/runtime/vk_exec_draw.c b/runtime/vk_exec_draw.c
index d83f91e0..71dd88e9 100644
--- a/runtime/vk_exec_draw.c
+++ b/runtime/vk_exec_draw.c
@@ -14,7 +14,7 @@
// zeroed buffer for unbound ones) follow MacNativeGames games//third_party/d2r_gfx/gfx/nvn/nvn_mtl.m:7409-7460,
// 9365-9488, 9489-9921, 10013-10079 @ b75be8cf (MIT, Copyright (c) 2026 jhaizhou); the uniform-buffer spans, texture and
// sampler descriptor lookups and the dispatch flow follow LAS Recomp runtime/nvn/vulkan/exec.c:1851-1908, 2300-2516
-// @ da35b83a (MIT, Copyright (c) 2026 Peiikai). The support buffer layout is Ryujinx's SupportBuffer.cs (MIT).
+// @ da35b83a (MIT, Copyright (c) 2026 Peiikai). The support buffer layout is the translator's SupportBuffer.
#include
#include
#include
@@ -38,7 +38,7 @@
#define MAX_DESC 1024
#define CHUNK_BYTES (4u << 20)
#define ZERO_BYTES 65536u
-#define SUPPORT_BYTES 1456u // Ryujinx SupportBuffer (std140): alpha_test, is_bgra[8], viewport_inverse, viewport_size, ...;
+#define SUPPORT_BYTES 1456u // the translator's SupportBuffer (std140): alpha_test, is_bgra[8], viewport_inverse, viewport_size, ...;
// 1408 pcss and 1424 shadow_spread (translator patches 0010, 0011), 1440 HDR (support_fill)
#define NVN_STAGE_VS 0
#define NVN_STAGE_FS 1
@@ -343,7 +343,7 @@ static void make_dummy(int i, VkFormat fmt, VkImage *image, VmaAllocation *alloc
vk_upload_end();
}
-// Storage image stand-ins in the format a shader declares (GfxShaderRes.format: Ryujinx TextureFormat order); Vulkan wants
+// Storage image stand-ins in the format a shader declares (GfxShaderRes.format: the translator's TextureFormat order); Vulkan wants
// the view format to match the declaration. Created on first use.
static const VkFormat tex_format[40] = {
VK_FORMAT_R8G8B8A8_UNORM, VK_FORMAT_R8_UNORM, VK_FORMAT_R8_SNORM, VK_FORMAT_R8_UINT, VK_FORMAT_R8_SINT,
@@ -485,8 +485,7 @@ static VkComponentSwizzle swz_of(uint8_t s) {
}
// A view in STENCIL mode samples the stencil plane (TextureViewSetDepthStencilMode); otherwise depth wins. The
-// translator declares every sampled image float and the shader takes the raw bits, as for integer formats (nxnative
-// nvn_mtl.m).
+// translator declares every sampled image float and the shader takes the raw bits, as for integer formats.
VkImageAspectFlags vk_exec_view_aspect(const VkTexImage *img, const view_t *v, int hv) {
if (hv && v->set_dsmode && v->dsmode == NVN_TEXTURE_DEPTH_STENCIL_MODE_STENCIL && (img->aspect & VK_IMAGE_ASPECT_STENCIL_BIT))
return VK_IMAGE_ASPECT_STENCIL_BIT;
@@ -502,7 +501,7 @@ typedef struct ViewNode { struct ViewNode *next; ViewKey k; VkImageView view; }
static nvn_hmap view_of; // ViewKey -> VkImageView
static nvn_hmap views_by_image; // VkImage -> its first ViewNode
-// Integer formats a texture view may give an image (nvnTextureViewSetFormat): the Vulkan format and the Ryujinx
+// Integer formats a texture view may give an image (nvnTextureViewSetFormat): the Vulkan format and the translator's
// TextureFormat code (gfx_shader.c fmt_names) the translator declares a storage image with. A shader that packs texels
// itself writes raw words through such a view (Ocarina's last post-process pass stores R11G11B10 bits through an R32UI
// view of an R11G11B10F target); through a view of the texture's own format the store converted them (a black picture
@@ -623,7 +622,7 @@ static VkImageView get_view(VkExec *ex, const VkTexImage *img, const view_t *v,
if (storage && cube) vt = VK_IMAGE_VIEW_TYPE_2D_ARRAY;
uint32_t aspect = vk_exec_view_aspect(img, v, hv);
uint8_t sw[4] = {NVN_TEXTURE_SWIZZLE_R, NVN_TEXTURE_SWIZZLE_G, NVN_TEXTURE_SWIZZLE_B, NVN_TEXTURE_SWIZZLE_A};
- if (!storage) { // MNG nvn_mtl.m tex_swizzle_sel: view selectors replace the texture's, then the format remap
+ if (!storage) { // view selectors replace the texture's, then the format remap
memcpy(sw, hv && v->set_swizzle ? v->swz : img->swz, 4);
if (img->alpha_one || img->chan[0])
for (int i = 0; i < 4; i++) {
@@ -980,13 +979,12 @@ static void c0_table(uint8_t *at, const p_bind_buf b[16]) {
}
// The driver constant bank c0 as GLSLC-compiled shaders read it. Storage-buffer tables {u64 address, u32 size} every
-// 16 bytes at 0x110 (vertex), 0x510 (fragment), 0x310 (compute): Ryujinx's GlobalToStorage fallback loads each
+// 16 bytes at 0x110 (vertex), 0x510 (fragment), 0x310 (compute): the translator's GlobalToStorage fallback loads each
// candidate base from here and compares the global pointer against it. Compute: dispatch size at 0x200, the uniform
// buffer table at 0x210 + 16 r. Graphics: the largest point size (Maxwell's limit, GLSLC clamps gl_PointSize to it) at
// 0x610, the base instance at 0x644. NVN2 task and mesh stages: storage tables at 0x670 and 0x770 (the game binds
// slots 0-2 there, and their programs read 0x670.. and 0x770..). Other stages: zeros. Unbound slots read zero, since the
// replay keeps them zero.
-// Layout: nxnative dm/gfx/nvn/nvn_mtl.m (MIT).
// Byte offset of a stage's storage buffer table in c0, -1 for none.
static int c0_ssbo_base(int stage) {
return stage == NVN_STAGE_VS ? 0x110 : stage == NVN_STAGE_FS ? 0x510 : stage == NVN_STAGE_CS ? 0x310
@@ -1110,7 +1108,7 @@ static VkDescriptorBufferInfo ubo_info(VkExec *ex, int st, int slot) {
return zero_info(max);
}
-// The NVN slot of a storage binding. Ryujinx numbers a shader's storage buffers in the order it meets them
+// The NVN slot of a storage binding. The translator numbers a shader's storage buffers in the order it meets them
// (GfxShaderRes.slot); the NVN slot is the entry of the driver constant buffer c0 that holds the buffer's address
// (cbuf_slot 0, handle = word offset): 16-byte entries at byte 0x110 (vertex), 0x510 (fragment) and 0x310 (compute).
// A compute address at c0 0x210..0x30f is uniform block (offset - 0x210) / 16 read as storage: *ubo is set. -1: the
@@ -1128,9 +1126,8 @@ static int ssbo_slot(const GfxShaderRes *r, int st, int *ubo) {
}
// 1 when the shader loads the storage buffer's address from a user uniform block (cbuf_slot 3.., NVN uniform slot
-// cbuf_slot - 3, byte offset handle * 4). The Depths terrain reads its vertices through one, about 500 draws a frame;
-// with a zero buffer they collapse and the ground is missing. MacNativeGames resolves these the same way (NVN_RB_SBUFU,
-// games//third_party/d2r_gfx/gfx/nvn/nvn_mtl.m @ b75be8cf).
+// cbuf_slot - 3, byte offset handle * 4). Some terrain reads its vertices through one, about 500 draws a frame;
+// with a zero buffer they collapse and the ground is missing.
static int ubo_ptr_res(const GfxShaderRes *r) {
return r->cbuf_slot >= 3 && r->cbuf_slot - 3 < 18;
}
@@ -1574,7 +1571,7 @@ static void tex_info_full(VkExec *ex, const GfxShaderRes *r, uint64_t h, int sto
// ---- texture and sampler pools (bindless)
// Shaders that take texture handles from memory (TEX.B and kin) index the whole texture pool: the translator declares
-// arrays of VK_POOL_TEX images and VK_POOL_SAMP samplers (Ryujinx BindlessElimination GenerateBindlessAccess, index =
+// arrays of VK_POOL_TEX images and VK_POOL_SAMP samplers (index =
// handle & 0xfffff and handle >> 20), which vk_pipeline.c spirv_pool_rebind moves to set 2, one image binding per view
// kind (vk.h). One set serves every such pipeline: entry id of binding k holds texture slot id viewed as kind k (a
// stand-in when the slot is empty or cannot be viewed so), entry id of binding VK_POOL_KINDS sampler slot id. pool_sync
@@ -1692,7 +1689,7 @@ VkDescriptorSetLayout vk_empty_set_layout(void) {
return PL.empty;
}
-// Ryujinx sampler type (GfxShaderRes.type) of pool kind k.
+// The translator's sampler type (GfxShaderRes.type) of pool kind k.
static uint16_t pool_kind_type(int k) {
static const uint16_t dim[4] = {1, 3, 4, 5}; // 1D, 2D, 3D, CUBE
return (uint16_t)(dim[k >> 1 & 3] | (k & 1 ? 0x100 : 0) | (k & 8 ? 0x400 : 0));
@@ -1975,8 +1972,8 @@ static void pool_sync_entries(VkExec *ex) {
// AMD's drivers do not give R32_SFLOAT, so the result there is undefined. Such an image gets a depth twin of the same
// size and bits (R32_SFLOAT -> D32_SFLOAT, R16_UNORM -> D16_UNORM), copied through a buffer right before each dispatch
// that samples it (a dispatch is outside any render pass), and the dispatch samples the twin. Draws keep the colour
-// image: a copy cannot go inside their pass. Design: Savage Wind Recomp runtime/nvn/vulkan/exec.c depth_twin_update
-// (https://github.com/Revivedx/SavageWindRecomp, MIT); the code is ours. NX2NAVI_DEPTH_TWIN=0: off.
+// image: a copy cannot go inside their pass.
+// NX2NAVI_DEPTH_TWIN=0: off.
#define TWINS 8
typedef struct { VkImage src, img; VmaAllocation mem; VkImageView view[2]; uint32_t w, h, layers; VkFormat fmt; } Twin;
static Twin twins[TWINS];
@@ -3962,7 +3959,7 @@ static void op_draw_idx(VkExec *ex, const p_draw_idx *d) {
}
// DrawElementsIndirect: the arguments are read by the GPU from the pool buffer (they are often written by an earlier
-// dispatch), as nxnative nvn_mtl.m does. The base instance stays out of c0 (0x644): c0 cannot be patched by a transfer
+// dispatch). The base instance stays out of c0 (0x644): c0 cannot be patched by a transfer
// inside a pass; gl_BaseInstance of the Vulkan draw is the argument's. Byte indices need the count to be widened: skipped.
static void op_draw_idx_ind(VkExec *ex, const p_draw_idx_ind *d) {
c0_binst = 0;
@@ -4131,7 +4128,7 @@ static void untranslated_dispatch_fallback(VkExec *ex) {
dst->format == VK_FORMAT_B10G11R11_UFLOAT_PACK32 && knob_tm_dispatch() != 2) {
view_t nv;
memset(&nv, 0, sizeof nv);
- dst_view = get_view(ex, dst, &nv, 0, 3, 1); // 3: Ryujinx Texture2D
+ dst_view = get_view(ex, dst, &nv, 0, 3, 1); // 3: the translator's Texture2D
}
uint32_t sw = src ? src->width : 0, sh = src ? src->height : 0, dw = dst ? dst->width : 0, dh = dst ? dst->height : 0;
VkFormat sf = src ? src->format : VK_FORMAT_UNDEFINED, df = dst ? dst->format : VK_FORMAT_UNDEFINED;
@@ -4368,7 +4365,7 @@ void vk_exec_op_draw(VkExec *ex, uint32_t op, const void *payload) {
case OP_BIND_VATTR: {
const p_bind_vattr *b = payload;
if (b->first < 0 || b->n < 0 || b->first + b->n > 16) break;
- memset(ex->pipe.vattr, 0, sizeof ex->pipe.vattr); // MNG: the new list replaces the old one
+ memset(ex->pipe.vattr, 0, sizeof ex->pipe.vattr); // the new list replaces the old one
memcpy(&ex->pipe.vattr[b->first], b->st, sizeof(uint32_t) * (size_t)b->n);
break;
}
diff --git a/runtime/vk_exec_probe.c b/runtime/vk_exec_probe.c
index 4425e8cd..158ce0a2 100644
--- a/runtime/vk_exec_probe.c
+++ b/runtime/vk_exec_probe.c
@@ -936,7 +936,7 @@ static int test_mirror(const GfxBackend *b, uint8_t *guest, int *bytes) {
return 0;
}
-// A pool of zero bytes (NX2navi makes some now and then; MacNativeGames hit one on 1.2.1) initialises as an empty pool: no
+// A pool of zero bytes (NX2navi makes some now and then) initialises as an empty pool: no
// Vulkan buffer or memory (a buffer or import of 0 bytes is invalid usage) and no pool index entry, so a lookup at its
// address still finds the pool that starts there, before and after the empty pool's Finalize.
static int test_empty_pool(const GfxBackend *b, uint8_t *guest) {
diff --git a/runtime/vk_exec_xfer.c b/runtime/vk_exec_xfer.c
index f5437d8a..ca85f672 100644
--- a/runtime/vk_exec_xfer.c
+++ b/runtime/vk_exec_xfer.c
@@ -22,11 +22,11 @@
// from guest memory; a counter reported by an earlier submission that is not done yet counts as 0 if it is a timestamp,
// as unknown if it is samples passed. An unknown count renders: the report usually sits in the command buffer being
// recorded, so its value cannot be waited for, and the word in memory still holds an older query's count. Rendering
-// costs at most the work the condition would have saved (MacNativeGames nvn_mtl.m decides the same); in the field
+// costs at most the work the condition would have saved; in the field
// NX2NAVI conditions only on timestamp reports. The condition sets VkExec.render_disabled, which vk_exec.c honours for
// clears and vk_exec_draw.c for draws and dispatches. A condition that cannot be read (address outside every pool)
// renders.
-// Copies and CLEAR_TEX are not conditional (as in MacNativeGames, nvn_mtl.m).
+// Copies and CLEAR_TEX are not conditional.
//
// The copy semantics (region and layer arithmetic, row and image strides, whole-level clears, copy / blit / resolve
// choice) follow MacNativeGames games//third_party/d2r_gfx/gfx/nvn/nvn_mtl.m:10080-10368, 10618-10642, 1700-1725
@@ -670,7 +670,7 @@ static int int_format(VkFormat f) {
}
// Whole levels only (vkCmdClear*Image has no rectangle); partial regions, channel masks and a view that reinterprets
-// the format are skipped (MacNativeGames does not replay them either, nvn_mtl.m).
+// the format are skipped.
static void clear_tex(VkExec *ex, const p_clear_tex *p) {
const tex_t *t = p->tex;
if (!t) return;
diff --git a/runtime/vk_formats.c b/runtime/vk_formats.c
index 3ab494a8..561eab6b 100644
--- a/runtime/vk_formats.c
+++ b/runtime/vk_formats.c
@@ -1,6 +1,6 @@
// NVN format -> VkFormat for the textures of the graphics layer.
// Ported from the format table of LAS Recomp runtime/nvn/vulkan/textures.c @ da35b83a (MIT, Copyright (c) 2026 Peiikai).
-// Differences from LAS: the table is indexed by the NVNformat values of nvn.h and covers all of them, ASTC decodes to
+// Differences from the original table: the table is indexed by the NVNformat values of nvn.h and covers all of them, ASTC decodes to
// RGBA8 unless the device samples it (vk_astc.c, NX2NAVI_ASTC), D24S8 is always D32S8 (no probing: the RX 9070 lacks
// it), 3-component formats expand to 4 components, and formats with no Vulkan equivalent are reported with a reason.
#include
diff --git a/runtime/vk_hdr.c b/runtime/vk_hdr.c
index 1703f03b..275a8ea3 100644
--- a/runtime/vk_hdr.c
+++ b/runtime/vk_hdr.c
@@ -18,8 +18,7 @@
// 3. vk_hdr_encode: on the present, the crop rectangle goes to PQ code values in an RGBA16F image (shaders/hdr_encode.comp)
// that FSR 1 or the blit scale into the swapchain. vk_hdr_ui_*: the in-game menu draws into an RGBA8 image and
// shaders/hdr_ui.frag blends it onto the swapchain at the HUD's white.
-// The tonemap's approach is RenoDX's NX2navi mod by souperman9 and Musa on ShortFuse's RenoDX (github.com/clshortfuse/renodx,
-// src/games/nx2navi, MIT); the code is ours.
+// The tonemap's approach: an "extended vanilla" curve (shaders/hdr_tonemap.frag).
#include "vk.h"
#include
diff --git a/runtime/vk_memory.c b/runtime/vk_memory.c
index 78208156..75b39165 100644
--- a/runtime/vk_memory.c
+++ b/runtime/vk_memory.c
@@ -7,9 +7,9 @@
// generation newer than its upload), @ b75be8cf (MIT, Copyright (c) 2026 jhaizhou; origin d2r-mobile); and from LAS
// Recomp runtime/nvn/vulkan/exec.c:2094-2131 (vk_pages_changed: every write-watch query resets the OS bits, so each
// query stamps the pages it saw with a new generation shared by all users) and textures.c:240-270 (deferred
-// destruction) @ da35b83a (MIT, Copyright (c) 2026 Peiikai). MNG aliases host VM (mach_vm_remap) and protects pages
-// (fault handler); here virtual pools are a GPU-side page table over device-local memory and dirty pages come from
-// GetWriteWatch (mem_written_pages), so neither is needed.
+// destruction) @ da35b83a (MIT, Copyright (c) 2026 Peiikai). Virtual pools are a GPU-side page table
+// over device-local memory and dirty pages come from GetWriteWatch (mem_written_pages), so neither host VM aliasing
+// nor page protection (a fault handler) is needed.
#include
#include
#include
@@ -339,7 +339,7 @@ void vk_pool_fini(pool_t *p) {
else destroy_rec(c, r);
}
-// Requests were checked by the front end (nvn_api_core.c, MNG nx2navi_vpool.c); apply them in order.
+// Requests were checked by the front end (nvn_api_core.c); apply them in order.
int vk_pool_map_virtual(pool_t *v, int n, const void *requests) {
const nvn_mapping_t *rq = requests;
plat_mutex_lock(&pool_lock);
@@ -2300,8 +2300,8 @@ static void defer(int kind, uint64_t handle, VmaAllocation alloc) {
// slot_resolve hands a draw a released entry, and entry_of destroys released entries at that address later in
// the same submission. Stamped with the last submitted value, the object went as soon as the GPU reached it,
// before the submission that names it ran, and with the recorder thread (vk_rec.c) behind, before the recorder
- // made the call that names it. LAS Recomp and Savage Wind Recomp stamp every deferral with the submission being
- // recorded (runtime/nvn/vulkan/textures.c defer: vk_pending_seq). NX2NAVI_DEFER_STAMP=0 brings back the old stamp.
+ // made the call that names it. So every deferral is stamped with the submission being
+ // recorded. NX2NAVI_DEFER_STAMP=0 brings back the old stamp.
static int stamp = -1;
if (stamp < 0) stamp = rt_knob("DEFER_STAMP", "1") != 0;
uint64_t tl = tl_noted, rf = stamp ? vk_exec_recording_fence() : 0;
diff --git a/runtime/vk_pipeline.c b/runtime/vk_pipeline.c
index 5655b48e..1299fad7 100644
--- a/runtime/vk_pipeline.c
+++ b/runtime/vk_pipeline.c
@@ -2,12 +2,12 @@
// collects NVN state into a VkPipeState and asks for the pipeline of each draw; this file maps that state to Vulkan,
// numbers the descriptor bindings and keeps the caches.
//
-// Binding model. The translator (tools/xlate/Program.cs, Ryujinx 1.3.2's SPIR-V back end) decorates every resource of a
+// Binding model. The translator (tools/xlate/Program.cs, a SPIR-V back end) decorates every resource of a
// shader with DescriptorSet 0 and numbers the bindings of each shader from 1 in the order it meets them (Accessor
-// Create*Binding); binding 0 is Ryujinx's support buffer (ResourceManager: SupportBuffer.Binding, a std140 uniform
+// Create*Binding); binding 0 is its support buffer (ResourceManager: SupportBuffer.Binding, a std140 uniform
// buffer every shader declares). The numbering is per shader, so the vertex and fragment stages of one program collide.
// The scheme here:
-// - one descriptor set, set 0, per pipeline; no push constants (Ryujinx's SPIR-V uses none);
+// - one descriptor set, set 0, per pipeline; no push constants (the translator's SPIR-V uses none);
// - binding 0: the support buffer, one uniform buffer shared by all stages of the pipeline;
// - vertex stage: its own bindings 1..n unchanged; fragment stage: its bindings b >= 1 move to b + n (the SPIR-V
// Binding decorations are rewritten when the module is created); compute: its own bindings;
@@ -17,12 +17,12 @@
// - set 0 is a push-descriptor set (VK_KHR_push_descriptor) when its descriptors fit maxPushDescriptors (32 on the RX
// 9070; a pipeline layout may hold one push set only, which rules out a set per stage); larger ones (a vertex and a
// fragment stage near the census maxima of 15 and 27) are ordinary sets the replay allocates (VkPipeInfo.push 0).
-// A fixed layout per stage combination (Ryujinx's own back end: a binding per constant buffer, storage buffer, texture
+// A fixed layout per stage combination (a binding per constant buffer, storage buffer, texture
// and image slot per stage) would hold about 150 descriptors and could never be pushed, so layouts are made per distinct
// binding list and shared by every pipeline with that list; VkPipeInfo.bindings tells the replay which NVN slot feeds
// each binding.
//
-// Fragment inputs the vertex stage does not write (stages are translated separately; MNG nvn_mtl.m msl_varyings) get
+// Fragment inputs the vertex stage does not write (stages are translated separately) get
// outputs added to the vertex module, as Vulkan rejects such pairs, initialised to (0, 0, 0, 1) as Maxwell reads an
// unwritten output (docs/maxwell.md 1.2). The unwritten components of an output the vertex stage does write
// start at (0, 0, 0, 1) in the translator (tools/xlate/patches/0006).
@@ -40,8 +40,7 @@
// runtime/nvn/vulkan/exec.c and device.c @ da35b83a (MIT, Copyright (c) 2026 Peiikai); the pipeline state the key holds
// (program, target formats, blend and write masks, vertex layout, sample count) and the varying fix-up follow
// MacNativeGames games//third_party/d2r_gfx/gfx/nvn/nvn_mtl.m pso_key_fill / pso_desc / msl_varyings and its vfmt
-// table @ b75be8cf (MIT, Copyright (c) 2026 jhaizhou); the binding conventions are those of Ryujinx's shader translator
-// (MIT, tools/vendor/ryujinx).
+// table @ b75be8cf (MIT, Copyright (c) 2026 jhaizhou); the binding conventions are those of the shader translator.
#include
#include
#include
@@ -247,8 +246,8 @@ static int ensure_init(void) {
#define PROC(field, name) (P.field = (void *)vkGetDeviceProcAddr(c->device, name))
PROC(push, "vkCmdPushDescriptorSetKHR");
// Descriptor update templates (core 1.1; the push variant comes with VK_KHR_push_descriptor on 1.1): the driver
- // walks a layout prepared when the layout is made instead of parsing write structs every draw (DXVK does so for the
- // same reason). NX2NAVI_DESC_TEMPLATE=0 keeps the write structs.
+ // walks a layout prepared when the layout is made instead of parsing write structs every draw.
+ // NX2NAVI_DESC_TEMPLATE=0 keeps the write structs.
if (!cfg_bool("NX2NAVI_DESC_TEMPLATE")) {
rt_log("vk_pipeline: descriptor update templates off (NX2NAVI_DESC_TEMPLATE=0)");
} else if (c->props.apiVersion >= VK_API_VERSION_1_1 && PROC(tpl_create, "vkCreateDescriptorUpdateTemplate") &&
@@ -260,8 +259,7 @@ static int ensure_init(void) {
rt_log("vk_pipeline: descriptor update templates unavailable: sets are written with write structs");
}
// NX2NAVI_VK_DYN_VERTEX=0/1 forces dynamic vertex input off or on. Default off on Intel's frozen Windows driver for its
- // older integrated GPUs (UHD 630, Ice Lake: Vulkan 1.3.215 and older), which draws nothing with it; LAS Recomp
- // turns it off there for the same reason.
+ // older integrated GPUs (UHD 630, Ice Lake: Vulkan 1.3.215 and older), which draws nothing with it.
const char *dv = cfg_get("NX2NAVI_VK_DYN_VERTEX"); // no fixed default: it depends on the GPU, see above
int intel_legacy = c->props.vendorID == 0x8086 && c->props.apiVersion <= VK_MAKE_API_VERSION(0, 1, 3, 215);
int dv_on = dv && *dv ? strcmp(dv, "0") != 0 : !intel_legacy;
@@ -317,7 +315,7 @@ static int ensure_init(void) {
return 1;
}
-// ---- NVN -> Vulkan mappings (LAS Recomp exec.c blend_factor, blend_op, compare_fn, stencil_op)
+// ---- NVN -> Vulkan mappings
static VkBlendFactor blend_factor(unsigned f) {
switch (f) {
@@ -442,7 +440,7 @@ static VkFormatFeatureFlags format_features(VkFormat f, int optimal) {
return r;
}
-// Vertex attribute formats by NVNformat (LAS Recomp exec.c vertex_format; MNG nvn_mtl.m vfmt for the NX2navi additions).
+// Vertex attribute formats by NVNformat.
typedef struct { VkFormat vk; uint8_t type; } VtxFmt;
#define F(v) {VK_FORMAT_##v, GFX_TYPE_FLOAT}
#define U(v) {VK_FORMAT_##v, GFX_TYPE_UINT}
@@ -569,8 +567,8 @@ typedef struct {
VkVertexInputBindingDescription2EXT b[17];
} VtxInput;
-// An attribute the game left without a format is a fixed one on Maxwell, a single 32-bit component of 0 (deko3d
-// gpu_3d_vbo.cpp binds unused attributes as IsFixed 1x32 float): it reads (0, 0, 0, 1), as Vulkan expands a
+// An attribute the game left without a format is a fixed one on Maxwell, a single 32-bit component of 0 (an unused
+// attribute is bound as IsFixed 1x32 float): it reads (0, 0, 0, 1), as Vulkan expands a
// one-component format. NX2NAVI's foliage shaders scale wind sway by 1 - colour.w; shapes without a vertex colour
// (Brightbloom stem and leaves) must not sway, or they bend away from the parts that have one (the bulb).
static VkFormat zero_format(int type) {
@@ -659,7 +657,7 @@ static uint32_t *spirv_set(const uint32_t *w, uint64_t n, uint32_t set) {
}
// Dual-source blending (docs/maxwell.md 5.6): SRC1 blend factors read the fragment shader's colour output 1,
-// which Vulkan takes from Location 0, Index 1. The Output variable at Location 1 moves there, as Ryujinx declares it
+// which Vulkan takes from Location 0, Index 1. The Output variable at Location 1 moves there, as the translator declares it
// with DualSourceBlendEnable (CodeGen/Spirv/Declarations.cs); the pipeline is keyed by GKey.dsb, so only pipelines
// that blend with SRC1 get this module. NULL when the module has no Output at Location 1.
static uint32_t *spirv_dual_source(const uint32_t *w, uint64_t n, uint64_t *out_n) {
@@ -781,10 +779,10 @@ static uint32_t *spirv_add_outputs(const uint32_t *w, uint64_t n, uint32_t missi
}
// Two fixes for what the translator declares but a shader does not use (NULL: nothing to change):
-// - the fragment shader interlock capability and extension, which Ryujinx adds to every fragment shader when the host
+// - the fragment shader interlock capability and extension, which the translator adds to every fragment shader when the host
// reports interlock support (SpirvGenerator.cs) and vk_device.c does not enable; kept when the shader interlocks;
// - the CullDistance[1] member of gl_PerVertex next to ClipDistance[8] (Declarations.cs CreatePerVertexStructType):
-// 9 distances exceed maxCombinedClipAndCullDistances (8 on the RX 9070). Ryujinx never accesses CullDistance; the
+// 9 distances exceed maxCombinedClipAndCullDistances (8 on the RX 9070). The translator never accesses CullDistance; the
// member goes when it is the struct's last and no access chain selects it.
static uint32_t *spirv_fixup(const uint32_t *w, uint64_t n, uint64_t *out_n) {
enum { OP_EXTENSION = 10, OP_CAPABILITY = 17, OP_MEMBER_NAME = 6, OP_EXECUTION_MODE = 16, OP_TYPE_ARRAY = 28,
@@ -1347,8 +1345,8 @@ static int uses_src1(const VkPipeState *s) {
}
// Colour write mask of target i: NVN's channel mask, zero for a target outside the fragment shader's output map (SPH
-// omap). Maxwell leaves such a target untouched (nxnative 04-graphics.md, "Targets the fragment shader does not
-// write"); Vulkan writes undefined values, and on AMD they lit grass in front of Link as flat lime. Zeros are wrong
+// omap). Maxwell leaves such a target untouched;
+// Vulkan writes undefined values, and on AMD they lit grass in front of Link as flat lime. Zeros are wrong
// too: NX2NAVI's half-res transparency pass binds its linear depth (R32F) as target 7, samples it in the same draws and
// writes only targets 0-2, 4 and 5; zeroed, the depth that later passes rebuild from it was 0 in tiles, and the fog
// over distant geometry showed rectangles of clear sky.
@@ -3346,8 +3344,8 @@ void vk_pipeline_set_dynamic(VkCommandBuffer cb, const VkPipeState *s) {
const poly_st *pl = &s->poly;
const ds_st *d = &s->ds;
// The front face maps unchanged: NX2NAVI sets the upper-left window origin, and the y-flipped viewport (y_flip) puts
- // NDC +y at row 0 as NVN does, so the framebuffer winding Vulkan tests is the one NVN tests (MacNativeGames passes
- // it to Metal unchanged; LAS Recomp exec.c mirrors it only for the lower-left origin).
+ // NDC +y at row 0 as NVN does, so the framebuffer winding Vulkan tests is the one NVN tests
+ // (a lower-left origin would need it mirrored).
int front_cw = pl->front == NVN_FRONT_FACE_CW;
vkCmdSetCullMode(cb, (VkCullModeFlags)(pl->cull & 3)); // NVN_FACE_* has VkCullModeFlagBits' values
vkCmdSetFrontFace(cb, front_cw ? VK_FRONT_FACE_CLOCKWISE : VK_FRONT_FACE_COUNTER_CLOCKWISE);
diff --git a/runtime/vk_rec.c b/runtime/vk_rec.c
index 096eaafd..446764de 100644
--- a/runtime/vk_rec.c
+++ b/runtime/vk_rec.c
@@ -4,8 +4,6 @@
// it is. A packet never wraps: one that does not fit before the end is preceded by a pad. The producer publishes head
// after each packet; the recorder makes the calls and advances tail, which the producer waits on when the ring is
// full and in rec_drain. While a part is recorded the recorder spins on head; idle, it sleeps on an event.
-// Design: Savage Wind Recomp #189 and LAS Recomp runtime/nvn/vulkan/record.c (https://github.com/peiikai/LASRecomp
-// @ a4b53a3, MIT, Copyright (c) 2026 Peiikai); the code is ours.
#define VK_REC_IMPL
#include
#include
diff --git a/runtime/vk_rec.h b/runtime/vk_rec.h
index f8758c5e..ec73909b 100644
--- a/runtime/vk_rec.h
+++ b/runtime/vk_rec.h
@@ -11,8 +11,7 @@
// extension commands called through function pointers have rec_* wrappers of their own. NX2NAVI_VK_RECORDER=0 makes every
// call at once (the same calls in the same order), =ab switches it with the A/B blocks (rt_ab), per submission part.
//
-// The design follows Savage Wind Recomp's and LAS Recomp's recorder threads (LAS Recomp runtime/nvn/vulkan/record.c,
-// MIT, Copyright (c) 2026 Peiikai): the driver's work behind the commands depends on nothing the replay decides next.
+// A recorder thread makes the Vulkan calls: the driver's work behind the commands depends on nothing the replay decides next.
#pragma once
void rec_begin(VkCommandBuffer cb, uint64_t fence); // the submitting thread, sub_lock held; fence: the part's value
diff --git a/runtime/vk_texture.c b/runtime/vk_texture.c
index 567eb003..679e3881 100644
--- a/runtime/vk_texture.c
+++ b/runtime/vk_texture.c
@@ -223,7 +223,7 @@ static int same_but_swizzle(const TexKey *a, const TexKey *b) {
return !memcmp(&x, &y, sizeof x);
}
-// MNG nvn_mtl.m tex_mirrored: textures whose content the CPU provides in pool memory. Display, compressible, zcull,
+// Textures whose content the CPU provides in pool memory. Display, compressible, zcull,
// depth, multisample and GPU-only storage stays GPU-owned.
static int tex_mirrored(const tex_t *t) {
if (!t->mem || nvn_gpu_only((uintptr_t)t->mem)) return 0;
@@ -298,8 +298,8 @@ static int bind_pool_memory(VkCtx *c, Tex *e, VkImage img, uint64_t guest_size)
return 1;
}
-// agl's BC4 encoder draws a BC texture's blocks through an RGBA16UI view, one texel per 8-byte block (refs/nxnative
-// docs/agents/04-graphics.md, Breath of the Wild and Ocarina of Time sections). Vulkan does it with an uncompressed
+// agl's BC4 encoder draws a BC texture's blocks through an RGBA16UI view, one texel per 8-byte block.
+// Vulkan does it with an uncompressed
// view of a BLOCK_TEXEL_VIEW_COMPATIBLE image; EXTENDED_USAGE lets the BC image carry the COLOR_ATTACHMENT usage that
// only such views support. Whether the device takes that combination for this format and shape:
static int block_views_ok(const VkImageCreateInfo *ci) {
@@ -434,7 +434,7 @@ static Tex *create_tex(const tex_t *t, const TexKey *k, int defer_init) {
// Cube compatible only for cube targets: the replay makes cube views of nothing else (vk_exec_draw.c get_view checks
// the image's own view type). The flag on every square array of 6+ layers changed how AMD's Windows driver lays such
// an image out, and terrain material arrays sampled through it came out in rainbow blocks that moved with the mip
- // level (Savage Wind Recomp issue #59, BotW on an RX 580 and a 7800 XT).
+ // level (seen on an RX 580 and a 7800 XT).
if (type == VK_IMAGE_TYPE_2D && layers >= 6 && w == h && samples == 1 &&
(d->target == NVN_TEXTURE_TARGET_CUBEMAP || d->target == NVN_TEXTURE_TARGET_CUBEMAP_ARRAY))
flags |= VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT;
@@ -1267,7 +1267,7 @@ static Tex *slot_resolve(TexSlot *s, view_t *view, int *has_view) {
make_key(&s->t, &k);
Tex *e = nvn_hm_get(&by_key, &k);
int stale = 0;
- if (!e || e->released) { // MNG hle_nvn.c: a finalized slot follows the live texture at its storage
+ if (!e || e->released) { // a finalized slot follows the live texture at its storage
// Prefer the live entry that differs from the slot descriptor only in its swizzle: transient render targets
// share storage, and the newest one at the address is usually another size. The map screen samples its
// 2250x1080 map target through an (R,G,B,1) descriptor and followed a 960x60 target at the same address.
@@ -1466,8 +1466,8 @@ static int region_of(const tex_t *t, const view_t *v, const NVNcopyRegion *r, ui
return 1;
}
-// Pool bytes <-> caller rows of the region alone (nvn_texels_box). MacNativeGames' nvn_mtl.m goes through a
-// linear copy of the whole level; for a small region of a large texture that cost tens of milliseconds while the guest
+// Pool bytes <-> caller rows of the region alone (nvn_texels_box), not through a
+// linear copy of the whole level: for a small region of a large texture that cost tens of milliseconds while the guest
// thread held its virtual core and the caller the texture lock (monsters2 replay, frames 765-790).
static int storage_texels(const tex_t *t, const Region *g, const NVNcopyRegion *r, uint8_t *mem, int write) {
for (int z = 0; z < g->nz; z++) {
diff --git a/runtime/vk_usnap.c b/runtime/vk_usnap.c
index fd940661..28bc001c 100644
--- a/runtime/vk_usnap.c
+++ b/runtime/vk_usnap.c
@@ -12,8 +12,6 @@
// - A GPU write within the submission (UpdateUniformBuffer, a storage buffer a shader writes, a buffer copy or fill,
// an image-to-buffer copy: vk_usnap_drop) drops the copies it touches from then on, so later draws read the result.
// - The arena goes back to a free list once the submission's fence is done (completion thread).
-// The design follows MacNativeGames' NX2NAVI_UBO_SNAPSHOT (games//third_party/d2r_gfx/gfx/nvn/nvn_mtl.m usnap_take,
-// usnap_drop; MIT, Copyright (c) 2026 jhaizhou); the code is ours.
// The copy is taken where vk_exec_record starts: at the submit call when the replay runs on the submitting thread, later
// with NX2NAVI_REPLAY_ASYNC. NX2NAVI_UBO_SNAPSHOT=0 binds live memory as before; =ab alternates (NX2NAVI_AB).
#include
diff --git a/tests/diff/common.py b/tests/diff/common.py
index c2f796df..50211c4d 100644
--- a/tests/diff/common.py
+++ b/tests/diff/common.py
@@ -1,6 +1,6 @@
"""Shared parts of the differential tests: Unicorn reference, operand generators, build and run of harness.c.
-Adapted from LAS Recomp tools/test_lift.py and tools/test_simd.py @ da35b83 (MIT, Copyright (c) 2026 Peiikai).
+Copyright (c) 2026 Peiikai (MIT; see THIRD_PARTY_NOTICES.md).
"""
import os
import shutil
diff --git a/tests/diff/lift.py b/tests/diff/lift.py
index 779dd664..f25b6e4e 100644
--- a/tests/diff/lift.py
+++ b/tests/diff/lift.py
@@ -8,7 +8,7 @@ Skipped: system instructions and exceptions, whose single step cannot be compare
atomics, which atomic.py covers. Encodings the lifter rejects are counted per module and mnemonic; --coverage lifts
every distinct word instead of testing.
-Adapted from LAS Recomp tools/test_lift.py @ da35b83 (MIT, Copyright (c) 2026 Peiikai).
+Copyright (c) 2026 Peiikai (MIT; see THIRD_PARTY_NOTICES.md).
Usage: lift.py [--exefs DIR] [--modules main,sdk,subsdk0] [--encodings N] [--cases K] [--seed S] [--jobs J]
lift.py --coverage
diff --git a/tests/diff/simd.py b/tests/diff/simd.py
index 556c54bd..aa41cefb 100644
--- a/tests/diff/simd.py
+++ b/tests/diff/simd.py
@@ -7,7 +7,7 @@ operands (NaNs, infinities, denormals, +-0, saturation edges, random FPCR.DN/FZ/
and, for stores, memory must match. FPSR is not compared; the lowering does not model the cumulative exception bits
or QC.
-Adapted from LAS Recomp tools/test_simd.py @ da35b83 (MIT, Copyright (c) 2026 Peiikai).
+Copyright (c) 2026 Peiikai (MIT; see THIRD_PARTY_NOTICES.md).
Usage: simd.py [--encodings N] [--cases K] [--seed S] [--jobs J] [--no-validity] [--filter HEX/MASK]
"""
diff --git a/tests/installer_test.py b/tests/installer_test.py
index a577143f..afb26738 100644
--- a/tests/installer_test.py
+++ b/tests/installer_test.py
@@ -421,7 +421,7 @@ class CleanupTest(unittest.TestCase):
class BaseGameCheckTest(unittest.TestCase):
- """Issue #261: an update NSP chosen as the base game was reported as "not Ocarina of Time"."""
+ """Issue #261: an update NSP chosen as the base game was reported as not being the game."""
BASE, UPDATE = '0100F2C0115B6000', '0100F2C0115B6800'
@staticmethod
diff --git a/tests/jumptables_check.py b/tests/jumptables_check.py
index 5c71aac1..571473b5 100644
--- a/tests/jumptables_check.py
+++ b/tests/jumptables_check.py
@@ -1,6 +1,6 @@
"""Check of recomp/jumptables.py on every `br` in the game's modules against an emulation oracle.
-The oracle is LAS Recomp's jump-table method: find `cmp #N; b.hi/b.hs` before the br (or a `b.ls/b.lo` to the
+The oracle is an emulated jump-table resolver: find `cmp #N; b.hi/b.hs` before the br (or a `b.ls/b.lo` to the
dispatch block), replay ADRP/ADR/ADD-imm from the function entry, then single-step Unicorn from the bounds check to
the br once per index. Functions are [seed, next seed) over the module's seeds plus BL targets.
@@ -11,7 +11,7 @@ as 'oracle wrong' only with independent evidence (oracle_wrong). Samples of ever
unresolved computed site are printed with disassembly. Output also goes to build/logs/jumptables-check.log, and one
row per table-like br to build/logs/jumptables-.tsv.
-The oracle is adapted from LAS Recomp tools/gen.py @ da35b83 (MIT, Copyright (c) 2026 Peiikai).
+The oracle: Copyright (c) 2026 Peiikai (MIT; see THIRD_PARTY_NOTICES.md).
Exits with 1 if any disagreement is unexplained, a hoisted base is not verified, or a PLT stub counts as computed.
@@ -44,7 +44,7 @@ _md = capstone.Cs(capstone.CS_ARCH_ARM64, capstone.CS_MODE_ARM)
class Oracle:
- """LAS Recomp's Unicorn jump-table resolver (`Module.jump_table` and helpers in tools/gen.py)."""
+ """The Unicorn jump-table resolver: bounds check, table base replay and one single-step run per index."""
def __init__(self, mod):
self.m = mod
diff --git a/tests/maxwell_warp_emu.py b/tests/maxwell_warp_emu.py
index 52fb98e2..0d9602d0 100644
--- a/tests/maxwell_warp_emu.py
+++ b/tests/maxwell_warp_emu.py
@@ -1,10 +1,10 @@
"""A 32-lane Maxwell warp emulator for checking the SM86 tensor lowering on the CPU.
-tools/xlate/AmpereLowering.cs rewrites SM86 instructions as Maxwell (64-bit) instructions, and the patched Ryujinx shader
+tools/xlate/AmpereLowering.cs rewrites SM86 instructions as Maxwell (64-bit) instructions, and the patched shader
translator (build/xlate/ryujinx/src/Ryujinx.Graphics.Shader) turns those into SPIR-V. This file executes the Maxwell
-words the way that translator does: fields are decoded exactly as Ryujinx's Decoders/InstDecoders.cs, opcodes are
-matched with the bit patterns of Decoders/InstTable.cs, and each instruction does what Ryujinx's Instructions/*.cs
-emit for it (not what a real Maxwell GPU does where the two differ; see "Ryujinx semantics" below). With it, the result
+words the way that translator does: fields are decoded exactly as its Decoders/InstDecoders.cs, opcodes are
+matched with the bit patterns of Decoders/InstTable.cs, and each instruction does what its Instructions/*.cs
+emit for it (not what a real Maxwell GPU does where the two differ; see "Translator semantics" below). With it, the result
of one lowered SM86 instruction (HMMA, LDSM, MOVM, HFMA2.RELU, ...) can be compared with vectors captured on real
hardware without running the game.
@@ -12,21 +12,21 @@ State per lane: R0-R254 (RZ = R255 reads 0, writes are dropped), P0-P6 (PT = P7
local memory; per warp: shared memory. Every lane is active at the start; a guard (bits 16-19: predicate 16-18, inverted
19) masks the writes of one instruction, EXIT retires lanes. Branches must be uniform across the active lanes.
-Ryujinx semantics this follows (and real hardware may not):
+Translator semantics this follows (and real hardware may not):
* Half-precision arithmetic (HADD2, HMUL2, HFMA2) works in F32 on the unpacked halves and rounds to F16 once at the
- end (Ryujinx InstEmitFloatArithmetic EmitHadd2Hmul2 / EmitHfma2, InstEmitHelper GetHalfPacked: PackHalf2x16).
+ end (InstEmitFloatArithmetic EmitHadd2Hmul2 / EmitHfma2, InstEmitHelper GetHalfPacked: PackHalf2x16).
HFMA2 is therefore an F32 fused multiply-add rounded to F32, then to F16.
- * That rounding is skipped when the packed value goes straight into another unpack: Ryujinx Optimizer.PropagatePack
+ * That rounding is skipped when the packed value goes straight into another unpack: Optimizer.PropagatePack
turns UnpackHalf2x16(PackHalf2x16(a, b)) into a (or b). So F2F.F16.F32 then F2F.F32.F16 of the same register, or
HFMA2 feeding HFMA2, passes the F32 value on unrounded; an integer instruction (SHFL, LOP, ISCADD, ...) in between
keeps the rounding, a MOV does not. Modelled per register (Warp.halves); a guarded write and a branch end it.
- * FTZ, FMZ and rounding-mode fields of FFMA / FMUL / FADD / HFMA2 / HMUL2 are ignored, as Ryujinx ignores them.
+ * FTZ, FMZ and rounding-mode fields of FFMA / FMUL / FADD / HFMA2 / HMUL2 are ignored, as the translator ignores them.
Denormals are kept (IEEE), saturation is clamp(x, 0, 1) with NaN giving 0 (GLSL FClamp as min(max(x, 0), 1) on
a GPU whose min/max return the non-NaN operand).
- * PRMT is not implemented in Ryujinx 1.3.2: InstEmit.PrmtR/PrmtI/PrmtC/PrmtRc only log "not implemented", so the
+ * PRMT is not implemented in the translator (1.3.2): InstEmit.PrmtR/PrmtI/PrmtC/PrmtRc only log "not implemented", so the
destination keeps its old value. That is the default here (prmt="ryujinx"); prmt="maxwell" gives the hardware
byte permute instead, to see what the lowering intended.
- * SHFL follows Ryujinx's HelperFunctionManager GenerateShuffle* helpers (clamp and segment mask from operand C, the
+ * SHFL follows the translator's HelperFunctionManager GenerateShuffle* helpers (clamp and segment mask from operand C, the
lane's own value where the source lane is out of range).
* LDS / LDL read the 32-bit word at (address >> 2) and extract a sub-word at (address & 3) * 8 (InstEmitMemory
EmitLoad); STS of 8 and 16 bits stores those bytes at the address.
@@ -218,10 +218,10 @@ class Warp:
self.prmt = prmt
self.trace = trace
self.warnings: list[str] = []
- # Ryujinx Optimizer.PropagatePack turns an UnpackHalf2x16 of a PackHalf2x16 result into the pack's F32
+ # The translator's Optimizer.PropagatePack turns an UnpackHalf2x16 of a PackHalf2x16 result into the pack's F32
# operand, so that half is never rounded to F16. Per lane and register: the F32 halves of the pack that wrote
# the register (sh_ok), kept until the register is written otherwise. A write under a guard ends it in every
- # lane: Ryujinx puts the instruction in an if-block and merges old and new value in a phi, which is no pack.
+ # lane: the translator puts the instruction in an if-block and merges old and new value in a phi, which is no pack.
self.sh_lo = np.zeros((LANES, 256), dtype=F32)
self.sh_hi = np.zeros((LANES, 256), dtype=F32)
self.sh_ok = np.zeros((LANES, 256), dtype=bool)
@@ -479,7 +479,7 @@ def op_lop3_i(w, i, m):
def _prmt(w, i, m, a, sel, c):
if w.prmt == "ryujinx":
- # Ryujinx InstEmit.PrmtR / PrmtI: "not implemented", nothing is emitted, the destination keeps its value.
+ # The translator's InstEmit.PrmtR / PrmtI: "not implemented", nothing is emitted, the destination keeps its value.
w.warnings.append(f"PRMT at {i} is a no-op in Ryujinx 1.3.2 (destination R{i.rd} unchanged)")
return
if i.bits(48, 4):
@@ -882,7 +882,7 @@ def op_exit(w, i, m):
OP_BRA = "bra"
-# The decoder: patterns as Ryujinx Decoders/InstTable.cs writes them (bit 63 first, x = any). The most specific
+# The decoder: patterns as the translator's Decoders/InstTable.cs writes them (bit 63 first, x = any). The most specific
# matching pattern wins, as InstTable's XBits ordering does.
TABLE = [
("0101000010110xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "NOP", op_nop),
@@ -993,7 +993,7 @@ def run_warp(words, regs_in=None, smem=None, max_steps: int = 200000, **opts) ->
elif kind == "P" and n != PT:
w.p[lane, n] = bool(val)
addr_to_index = {slot_address(k): k for k in range(len(words) + 1)}
- # Where control flow joins (branch targets) Ryujinx merges registers in phis, and an UnpackHalf2x16 of a phi is
+ # Where control flow joins (branch targets) the translator merges registers in phis, and an UnpackHalf2x16 of a phi is
# not folded: the PropagatePack state (Warp.sh_ok) is dropped there and at every BRA (conservative: a register no
# path writes needs no phi).
joins = set()
diff --git a/tests/maxwell_warp_emu_selftest.py b/tests/maxwell_warp_emu_selftest.py
index 042f5463..c027c3e7 100644
--- a/tests/maxwell_warp_emu_selftest.py
+++ b/tests/maxwell_warp_emu_selftest.py
@@ -1,11 +1,11 @@
"""Self-test of tests/maxwell_warp_emu.py: hand-encoded Maxwell sequences against hand-computed results.
-Part 1 runs Maxwell words encoded here from the field layouts of Ryujinx Decoders/InstDecoders.cs (integer and logic
+Part 1 runs Maxwell words encoded here from the field layouts of the translator's Decoders/InstDecoders.cs (integer and logic
ops, SHFL.IDX with clamp and segment masks, LDS/STS sizes, F2F, HFMA2, FFMA rounding, PRMT, predicates, EXIT, BRA).
Part 2, when build/xlate/nx2navi_xlate.exe exists, lowers SM86 HMMA.1688 / HMMA.16816, LDSM and MOVM with
nx2navi_xlate --lower and checks the emulated result against exactly representable reference values (small
integers, so every F16 rounding is exact and only the fragment layout can be wrong), and HFMA2.RELU as the translator
-runs it (Ryujinx 1.3.2 drops PRMT, so AmpereLowering.cs Half must not use it). tests/tensor_lowering_check.py checks
+runs it (the translator drops PRMT, so AmpereLowering.cs Half must not use it). tests/tensor_lowering_check.py checks
the same lowerings against hardware results.
python tests/maxwell_warp_emu_selftest.py
@@ -195,7 +195,7 @@ def part1():
# (1 + 2^-10)^2 = 1 + 2^-9 + 2^-20 -> F16 1 + 2^-9; 1 + 2^-11 is an F16 tie -> 1.0.
check("HFMA2 rounding", r[:, 10], hpair(1 + 2 ** -9, 1.0))
- # Ryujinx Optimizer.PropagatePack: an F16 result unpacked again without an integer operation in between is the
+ # The translator's Optimizer.PropagatePack: an F16 result unpacked again without an integer operation in between is the
# unrounded F32 value (directly or through a MOV); LOP in between, or a guarded pack, keeps the F16 rounding.
third, third16 = f32bits(1 / 3), f32bits(float(np.float16(1 / 3)))
seq = [mov32i(1, third), f2f(2, 1, 1, 2), f2f(3, 2, 2, 1), # pack, unpack: folded
@@ -222,7 +222,7 @@ def part1():
check("FFMA single rounding at a tie", r[:, 4], 0x3F800001)
check("FFMA", r[:, 7], f32bits(4.5))
- # PRMT: a no-op as Ryujinx translates it, the Maxwell byte permute otherwise (0xbb99: sign of bytes 1 and 3).
+ # PRMT: a no-op as the translator translates it, the Maxwell byte permute otherwise (0xbb99: sign of bytes 1 and 3).
seq = [mov32i(1, 0x7F80C000), mov32i(2, 0xBB99), mov32i(3, 0x11111111), prmt(3, 1, 2, 255),
mov32i(4, 0x3210), mov32i(5, 0x22222222), prmt(5, 1, 4, 255), EXIT]
r = emu.run(seq, {}, prmt="ryujinx")
diff --git a/tests/romfs_prompts_test.py b/tests/romfs_prompts_test.py
index 32270c2e..c86ebc9a 100644
--- a/tests/romfs_prompts_test.py
+++ b/tests/romfs_prompts_test.py
@@ -228,11 +228,11 @@ def restbl_sizes(table):
return dict(struct.unpack_from(' str:
def pinned_blobs() -> dict[str, str]:
- """Git blob ids of MNG's vendor/ryujinx at the pinned commit. The checkout itself may be newer than the pin or
+ """Git blob ids of vendor/ryujinx in the refs/ checkout at the pinned commit. The checkout itself may be newer than the pin or
carry CRLF line ends (core.autocrlf), so its files are not compared."""
out = subprocess.run(["git", "-C", str(MNG_VENDOR.parent.parent), "ls-tree", "-r", mng_pin(), "vendor/ryujinx"],
capture_output=True, text=True)
@@ -80,7 +80,7 @@ def blob_ids(base: Path) -> dict[str, str]:
def verify_vendor() -> None:
- """tools/vendor/ryujinx must be byte-identical to MNG's copy at the pinned commit (when refs/ is present)."""
+ """tools/vendor/ryujinx must be byte-identical to the refs/ checkout's copy at the pinned commit (when present)."""
if not MNG_VENDOR.is_dir():
print("refs/MacNativeGames missing: vendor comparison skipped")
return
diff --git a/tools/button_icons.py b/tools/button_icons.py
index 0c245817..a5b91ef0 100644
--- a/tools/button_icons.py
+++ b/tools/button_icons.py
@@ -1,5 +1,4 @@
-# Adapted from MacNativeGames games//scripts/make_button_icons.py @ 933b6a0 (MIT, Copyright (c) 2026
-# MacNativeGames contributors).
+# Copyright (c) 2026 MacNativeGames contributors (MIT; see THIRD_PARTY_NOTICES.md).
"""Xbox and keyboard-and-mouse button icons for the game's prompts, drawn on the player's machine for
tools/make_romfs_patches.py --prompts.
The outlines are our own shapes with letters cut out of them in the game's own text fonts: nothing of the game is in
@@ -13,7 +12,7 @@ buttons, the triggers, Plus, Minus and the d-pad as an Xbox controller names the
cross), or every button as the key or mouse button the keyboard presses it with (pc_icons), can swap the glyphs of
the face buttons (A with B, X with Y), and has fontTools write the font again. The archive then grows by a kilobyte or
two, more than the game's resource size table allows it: grow_restbl raises those entries (without it the game stops at
-start, MacNativeGames found).
+start).
The button guide in play (bottom right) draws its buttons, L and ZL among them, from images of the common layout
archive instead (timg/__Combined.bntx, Nt_KeyTexL_00 and Nt_KeyTexZL_00): bntx_redraw paints the same icons into them,
diff --git a/tools/data/expected-v1.0.0.json b/tools/data/expected-v1.0.0.json
index 20284152..ea4a5ec5 100644
--- a/tools/data/expected-v1.0.0.json
+++ b/tools/data/expected-v1.0.0.json
@@ -1,5 +1,5 @@
{
- "_comment": "Hashes of what the build produces from a genuine v1.0.0 game card image (no game data). build_app.py checks every step against them; a mismatch stops the build.",
+ "_comment": "Hashes of what the build produces from a genuine v1.0.0 game card image (no game data). The build checks every step against them; a mismatch stops the build.",
"title_id": "0100F2C0115B6000",
"version": 0,
"display_version": "1.0.0",
diff --git a/tools/data/expected-v1.1.0.json b/tools/data/expected-v1.1.0.json
index a14f90f8..18b35e7e 100644
--- a/tools/data/expected-v1.1.0.json
+++ b/tools/data/expected-v1.1.0.json
@@ -1,5 +1,5 @@
{
- "_comment": "Written locally for the player's own 1.1.0 update (version value 0x20000). RomFS hashes filled in after the first merge; no game data here. No rewritten_sha256: this dump was not run through MacNativeGames' NSO rewriter, so the three digests of the other versions have no reference here and none of the tools read them.",
+ "_comment": "Written locally for the player's own 1.1.0 update (version value 0x20000). RomFS hashes filled in after the first merge; no game data here. No rewritten_sha256: this dump was not run through the NSO rewriter, so the three digests of the other versions have no reference here and none of the tools read them.",
"title_id": "0100F2C0115B6000",
"version": 131072,
"display_version": "1.1.0",
diff --git a/tools/extract_fonts.py b/tools/extract_fonts.py
index 43215723..af0c1828 100644
--- a/tools/extract_fonts.py
+++ b/tools/extract_fonts.py
@@ -2,9 +2,8 @@
NX2navi needs them only with Simplified Chinese, Korean or Traditional Chinese text: those font archives fall back to the
Standard shared font (runtime/ov_system.c). The fonts come from the system data NCAs 0100000000000810..814 of a
-firmware NCA directory (an unpacked firmware, or an emulator's installed `registered` directory such as
-%APPDATA%\\Ryujinx\\bis\\system\\Contents\\registered). The keys file named in config.local.toml decrypts them; key
-values are never printed. Every NCA FS header, all six IVFC levels and each BFTTF header are verified
+firmware NCA directory (an unpacked firmware, or an emulator's installed `registered` directory). The
+keys file named in config.local.toml decrypts them; key values are never printed. Every NCA FS header, all six IVFC levels and each BFTTF header are verified
(tools/vendor/macnativegames/extract_shared_fonts.py).
Runs under .venv-py314: python tools\\extract_fonts.py --firmware (or set input.firmware in config.local.toml)
diff --git a/tools/fetch_refs.sh b/tools/fetch_refs.sh
index 7c6a2f03..92e47995 100644
--- a/tools/fetch_refs.sh
+++ b/tools/fetch_refs.sh
@@ -1,13 +1,14 @@
#!/bin/sh
-# Clone the upstream projects this port builds on into refs/, at pinned commits. refs/ is read-only reference
-# material and ignored by git.
+# Clone the pinned checkout the build reads into refs/: the shared shader list (tools/shader_list.py), the NVN names
+# (tools/gen_nvn_procs.py) and the translator copy tools/build_xlate.py compares tools/vendor/ryujinx with. refs/ is
+# read-only and ignored by git.
set -eu
cd "$(dirname "$0")/.."
mkdir -p refs
# fetch [history]: a shallow checkout of the commit, or with "history" the commit and all its
-# ancestors (tools/shader_list.py walks the log of MacNativeGames' shader list). origin/HEAD names the commit either
+# ancestors (tools/shader_list.py walks the log of the shader list). origin/HEAD names the commit either
# way, so tools can read the pinned revision as origin/HEAD.
fetch() {
name=$1 url=$2 commit=$3 history=${4:-}
@@ -31,10 +32,4 @@ fetch() {
echo "$name: $commit"
}
-fetch LASRecomp https://github.com/peiikai/LASRecomp.git a6b4f03844ecfb4012f18deff96da8b410aeafcd
fetch MacNativeGames https://github.com/ly05010419/MacNativeGames.git d1509b4b62211265fad5449cf53cc9f13484ecc5 history
-fetch d2r-mobile https://github.com/jhaizhou-ops/d2r-mobile.git fae8c680fe98f79179cf3fab85f7a6c14ee28600
-fetch nxnative https://github.com/seedds/nxnative.git 99330eb81c873c3aafe9fc92194c9687d77fcdbb
-fetch SwitchRecomp https://github.com/bgyss/SwitchRecomp.git 0f99e1c5c1e78fdc8e01e58a0f8dc8622e82976b
-fetch deko3d https://github.com/devkitPro/deko3d.git 373bfd43d8b2d805fa2eb7d406dbb823032df958
-fetch SavageWindRecomp https://github.com/Revivedx/SavageWindRecomp.git bf6146c14c37fee8781a601e5a544b93dff6d75e
diff --git a/tools/gen_nvn_procs.py b/tools/gen_nvn_procs.py
index 9625e5e7..0a507832 100644
--- a/tools/gen_nvn_procs.py
+++ b/tools/gen_nvn_procs.py
@@ -1,8 +1,8 @@
"""Write runtime/nvn_procs.inc: the NVN proc names NX2navi 1.2.1 loads.
-Source names come from the MacNativeGames checkout in refs/ (MIT, Copyright (c) 2026 MacNativeGames contributors):
-NVN/names.txt plus the NVN_EXTRA definitions of nx2navi_nvn_ext.c, minus the two names 1.2.1 does not load. The file
-list format follows d2r-mobile dm/gfx/tools/gen_protos.py (MIT). No game data is read.
+Source names come from NVN_DIR in refs/ (MIT, Copyright (c) 2026 MacNativeGames contributors; see
+THIRD_PARTY_NOTICES.md): names.txt plus the NVN_EXTRA definitions of nx2navi_nvn_ext.c, minus the two names 1.2.1 does
+not load. No game data is read.
Run with .venv: python tools/gen_nvn_procs.py
"""
diff --git a/tools/hactool/mbedtls-asm-clobbers.patch b/tools/hactool/mbedtls-asm-clobbers.patch
index d0f01ed7..2cebebf1 100644
--- a/tools/hactool/mbedtls-asm-clobbers.patch
+++ b/tools/hactool/mbedtls-asm-clobbers.patch
@@ -1,4 +1,4 @@
-Applied by tools/build_hactool.py to SciresM/hactool (ISC) at 1d64a83450e025622f3468c28fc4164dad2c5ef6, ours.
+Applied by tools/build_hactool.py to hactool (ISC) at 1d64a83450e025622f3468c28fc4164dad2c5ef6, ours.
The x86-64 multiply-accumulate asm of hactool's bundled mbedtls 2.6.1 (MULADDC in bn_mul.h) adds into memory through
rdi and changes the flags without saying so. gcc happens to keep that code correct; clang (the Linux release's
toolchain) keeps memory values in registers across it at -O1 and above, the RSA arithmetic goes wrong, and every
diff --git a/tools/hactool/portable.patch b/tools/hactool/portable.patch
index 517f9bda..c5beb1a0 100644
--- a/tools/hactool/portable.patch
+++ b/tools/hactool/portable.patch
@@ -1,7 +1,6 @@
-Applied by tools/build_hactool.py to SciresM/hactool (ISC) at 1d64a83450e025622f3468c28fc4164dad2c5ef6.
-From MacNativeGames build_app.py build_hactool() (MIT, Copyright (c) 2026 MacNativeGames contributors), the parts
-that run on Windows: MNG_TITLE_KEYS names the title-key file, and the BKTR checks accept the subsection table
-padding and the subsection layout of newer cumulative updates. Its funopen base-range hook is macOS-only and left out.
+Applied by tools/build_hactool.py to hactool (ISC) at 1d64a83450e025622f3468c28fc4164dad2c5ef6.
+Copyright (c) 2026 MacNativeGames contributors (MIT; see THIRD_PARTY_NOTICES.md). MNG_TITLE_KEYS names the title-key
+file, and the BKTR checks accept the subsection table padding and the subsection layout of newer cumulative updates.
diff --git a/main.c b/main.c
index 07f53cb..7921cc4 100644
diff --git a/tools/make_release.py b/tools/make_release.py
index c2b047b0..2a3692aa 100644
--- a/tools/make_release.py
+++ b/tools/make_release.py
@@ -65,7 +65,7 @@ PGO_DIR = MAIN_ROOT / 'build' / 'pgo' # pgo-.profdata + .json (tools/
MSYS2 = 'https://repo.msys2.org/mingw/ucrt64/'
SDL_VERSION = '3.4.18'
LLVM_VERSION = '20261020'
-MNG_COMMIT = 'b75be8cfa704df3701e86130c8ced268e79d6b11' # MacNativeGames, the shader list (refs/MacNativeGames)
+MNG_COMMIT = 'b75be8cfa704df3701e86130c8ced268e79d6b11' # the shader list's pinned commit (refs/MacNativeGames)
# name: (url, sha256)
PINS = {
'python-embed': ('https://www.python.org/ftp/python/3.14.9/python-3.14.9-embed-amd64.zip',
diff --git a/tools/make_romfs_patches.py b/tools/make_romfs_patches.py
index 792bd039..871bd0d7 100644
--- a/tools/make_romfs_patches.py
+++ b/tools/make_romfs_patches.py
@@ -1,5 +1,4 @@
-# Adapted from MacNativeGames games//scripts/make_romfs_patches.py @ ebe621d (MIT, Copyright (c) 2026
-# MacNativeGames contributors).
+# Copyright (c) 2026 MacNativeGames contributors (MIT; see THIRD_PARTY_NOTICES.md).
"""Build the 60 fps RomFS overlay for NX2navi 1.1.0, 1.2.1 or 1.4.3 (runtime/romfs.c, NX2NAVI_ROMFS_PATCHES).
UI/LayoutArchive/Common.Product.<110 or 140>.Nin_NX_NVN.blarc.zs: the weapon / shield / material quick menus capture the game
@@ -7,9 +6,7 @@ picture for their background when the panes C_CaptureBG_00, C_CaptureClearBG_00
visible at animation frame 1.0 (anim/ShortCutBG_00_In.bflan), AutoBuilder the same with C_CaptureBG_00
(anim/AutoBuilder_00_In.bflan). UI animations advance 0.5 frames per game frame at 60 fps, so the capture lands after
the world stopped drawing and the background can be black. The visibility keys move to frame 0.0: the live world is
-captured at once (upstream checked weapon, shield, material and ability wheel at 60 fps, and 30 fps).
-The game-over flow fix of the same upstream script is 1.0.0 only (1.1.0, 1.2.1 and 1.4.3 run DmF_SY_GameOver.110) and is
-left out.
+captured at once (the weapon, shield, material and ability wheels were checked at 60 fps and 30 fps).
--aspect x (a game resolution of another shape than 16:9, such as 3440x1440 or 1280x800) also lays the UI out
for that shape (tools/ultrawide_layout.py): menus keep their 16:9 proportions in the middle, full-screen backgrounds
@@ -233,8 +230,8 @@ for p in files:
MALS[m[1]] = (int(m[2]), p)
MALS = sorted(p for _, p in MALS.values())
LAYOUT_MSG = 'LayoutMsg/DoCommand_00.msbt'
-# The resource size table (System/Resource/ResourceSizeTable.Product....rsizetable.zs, matched as loosely as
-# MacNativeGames make_button_icons.py does), likewise the newest version in the RomFS.
+# The resource size table (System/Resource/ResourceSizeTable.Product....rsizetable.zs, any ), likewise the
+# newest version in the RomFS.
RESTBL = max((p for p in files if p.startswith('System/Resource/ResourceSizeTable.') and p.endswith('.rsizetable.zs')),
key=lambda p: int((re.search(r'\.(\d+)\.', p) or [0, 0])[1]), default=None)
by_position = args.prompts == 'xbox' # the face buttons' prompts swapped to the labels (pad_layout = nintendo)
diff --git a/tools/prepare_shaders.py b/tools/prepare_shaders.py
index f23f51e9..bbc2e001 100644
--- a/tools/prepare_shaders.py
+++ b/tools/prepare_shaders.py
@@ -1,12 +1,12 @@
-"""Prepare the default variant of every game shader and the variants of the MacNativeGames shared shader list for a
+"""Prepare the default variant of every game shader and the variants of the shared shader list for a
build, once, before play.
-The list (refs/MacNativeGames games//assets/shader_list.tsv, MIT; docs/shader-list.md there) names shader variants
+The list (tools/shader_list.py) names shader variants
players met: a shader key (sha256 of the NVN control section and code, as tools/shader_census.py names shaders) and
the translator answers it was translated for. This tool reads the shaders from the extracted RomFS and ExeFS
(tools/shader_census.py inventory), keeps the list's variants whose shader is in this game version, adds each shader's
-default variant (every texture slot a 2D texture, float vertex inputs and colour outputs, as MacNativeGames' seed
-translates every shader for its default bind state: prepare_shader_seed.py all_default), and writes them next to the
+default variant (every texture slot a 2D texture, float vertex inputs and colour outputs: the
+default bind state), and writes them next to the
build's nx2navi.exe in the record layouts of runtime/gfx_shader.c ("answers met in play"):
seed-programs.bin "NX2NSPRG": stage, length, c1 length, runtime code hash, control section, code, c1
@@ -77,9 +77,9 @@ def read_list(path):
def pipeline_variants(key):
- """The vertex and fragment variant names of an R/B row's pipeline key. Since MacNativeGames f024ef04 (2026-10-28) the
- NX2navi list keeps keys packed, "::"; older revisions and contribution files
- hold the whole key in hex, "\\0\\0" + a Metal descriptor (docs/shader-list.md there)."""
+ """The vertex and fragment variant names of an R/B row's pipeline key. Since its revision of 2026-10-28 the
+ list keeps keys packed, "::"; older revisions and contribution files
+ hold the whole key in hex, "\\0\\0" + a Metal descriptor."""
if ':' in key:
return key.split(':', 2)[:2]
return [n.decode('ascii', 'replace') for n in bytes.fromhex(key).split(b'\0')[:2]]
diff --git a/tools/requirements-py314.txt b/tools/requirements-py314.txt
index 2b012620..0187565a 100644
--- a/tools/requirements-py314.txt
+++ b/tools/requirements-py314.txt
@@ -1,4 +1,4 @@
-# Python 3.14 venv at .venv-py314: MacNativeGames NX2navi scripts (need stdlib compression.zstd, 3.14+). Source: refs/MacNativeGames/games//requirements-dev.txt
+# Python 3.14 venv at .venv-py314: the extraction and shader scripts (need stdlib compression.zstd, 3.14+).
# Recreate: uv venv --python 3.14 .venv-py314 && uv pip install --python .venv-py314/Scripts/python.exe -r tools/requirements-py314.txt
ansicon==1.89.0
blessed==1.51.0
diff --git a/tools/requirements.txt b/tools/requirements.txt
index dbcc2509..e88661e8 100644
--- a/tools/requirements.txt
+++ b/tools/requirements.txt
@@ -1,4 +1,4 @@
-# Python 3.12.15 (uv) venv at .venv: LASRecomp-style lifter/generator tools + MacNativeGames build deps + oead/evfl/quicktex.
+# Python 3.12.15 (uv) venv at .venv: lifter/generator tools + build deps + oead/evfl/quicktex.
# Recreate: uv venv --python 3.12 .venv && uv pip install --python .venv/Scripts/python.exe -r tools/requirements.txt
altgraph==0.17.5
ansicon==1.89.0
diff --git a/tools/romfs_index.py b/tools/romfs_index.py
index a8c13994..bc93bf5c 100644
--- a/tools/romfs_index.py
+++ b/tools/romfs_index.py
@@ -1,7 +1,6 @@
"""Build the RomFS index the runtime binary-searches (runtime/romfs.c) and its romfs_config.h.
-Adapted from MacNativeGames games//scripts/prepare_romfs_backend.py @ b75be8cf (MIT, Copyright (c) 2026
-MacNativeGames contributors).
+Copyright (c) 2026 MacNativeGames contributors (MIT; see THIRD_PARTY_NOTICES.md).
Input: /index.json ({status, romfs_size, romfs_sha256, files: [{path, offset, size}]}) as tools/extract.py
writes it, and /romfs.bin, whose size must match. Output, both in the build directory (never in the repo):
diff --git a/tools/shader_census.py b/tools/shader_census.py
index 132f2d5d..200a0285 100644
--- a/tools/shader_census.py
+++ b/tools/shader_census.py
@@ -1,8 +1,8 @@
"""Census of every Maxwell shader in the extracted NX2navi RomFS and ExeFS, and an offline translation pass.
-Port of MacNativeGames games//scripts/prepare_shader_seed.py (inventory, bnsh_shaders, sharcb_shaders, sarc) and the
-package walk of locate_shaders.py @ b75be8cf (MIT, Copyright (c) 2026 MacNativeGames contributors). Differences: no
-shared shader list, no spirv-cross, no bind-state variants; the module scan reads the NSO files under exefs/ directly;
+The inventory, the bnsh, sharcb and sarc readers and the package walk: Copyright (c) 2026 MacNativeGames contributors
+(MIT; see THIRD_PARTY_NOTICES.md). This pass reads no shared shader list, runs no spirv-cross and makes no bind-state
+variants; the module scan reads the NSO files under exefs/ directly;
a control section must start with CONTROL_MAGIC (sharcb_shaders says why).
Reads build/extracted// (RomFS image plus index.json as tools/romfs_index.py reads them, and exefs/). Writes under
@@ -12,7 +12,7 @@ build//shaders/ only:
spv/.spv with --translate
failures.txt with --translate, when something failed: groups by message
-The key is sha256(control[:0x880] + code), as in MNG. Needs Python 3.14 (compression.zstd), so run in .venv-py314:
+The key is sha256(control[:0x880] + code), the shared shader list's key. Needs Python 3.14 (compression.zstd), so run in .venv-py314:
.venv-py314\\Scripts\\python tools\\shader_census.py --version v121 --translate
"""
@@ -37,7 +37,7 @@ ROOT = Path(__file__).resolve().parent.parent
XLATE = ROOT / 'build' / 'xlate' / ('nx2navi_xlate.exe' if os.name == 'nt' else 'nx2navi_xlate')
SPIRV_VAL = Path(r'C:\msys64\ucrt64\bin\spirv-val.exe') if os.name == 'nt' else Path(shutil.which('spirv-val') or '/usr/bin/spirv-val')
ZSTD = b'\x28\xb5\x2f\xfd'
-# NVN program control section magic, u32 0x98761234 (d2r-mobile dm/gfx/tools/shader_map.py)
+# NVN program control section magic, u32 0x98761234
CONTROL_MAGIC = b'\x34\x12\x76\x98'
STAGE_IDS = {0: 'vs', 1: 'ps', 5: 'cs'}
MAX_WORKERS = 20
@@ -117,8 +117,8 @@ def sharcb_shaders(data, rejected):
first 8 bytes are the code offset) and no CONTROL_MAGIC. The game hands NVN real control sections and the runtime
key hashes those, so no draw can ever produce these keys. Their code is cut from the wrong place: they were all 67
translation failures of 1.2.1 (IndexOutOfRange in ShaderHeader.ctor and ArgumentOutOfRange in Decoder.FillBlock,
- on 0 to 4,718 bytes of code). MNG's scan (prepare_shader_seed.py @ b75be8cf) keeps them; the 7 that translate are
- V rows in MNG's list only because shader_list.py add_cache() folds the seed's own .variants files back in. A
+ on 0 to 4,718 bytes of code). A scan without the magic check keeps them; the 7 that translate are
+ V rows in the shared shader list only because shader_list.py add_cache() folds the seed's own .variants files back in. A
candidate without CONTROL_MAGIC is skipped and counted in rejected[0]."""
if len(data) < 32 or data[:4] != b'BAHS':
raise ValueError('expected an agl shader package')
@@ -167,7 +167,7 @@ def nso_image(path):
def startup_package(name):
- """The RomFS files MNG's startup shaders come from; effects and UI layouts carry more."""
+ """The RomFS files the shared shader list's startup shaders come from; effects and UI layouts carry more."""
return (name == 'Lib/NintendoSDK/TextureShader.bnsh' or name == 'Pack/Bootup.Nin_NX_NVN.pack.zs' or
name.startswith('Shader/') and name.endswith('.zs'))
@@ -179,9 +179,9 @@ SHADER_DIRS = ('Shader/', 'Effect/', 'Lib/agl/', 'Lib/Terrain/', 'Lib/gsys/', 'U
def inventory(romfs, exefs, everything=True):
- """Every unique shader: key -> dict(stage, control, code, source, origin, startup). As in MNG, a shader is a startup
- shader when it comes from an agl package, a game module, or a startup_package() RomFS file; the others come from
- effect and UI layout resources, which MNG translates only for bind states players have met. Also returns the number
+ """Every unique shader: key -> dict(stage, control, code, source, origin, startup). As in the shared shader list, a shader is a
+ startup shader when it comes from an agl package, a game module, or a startup_package() RomFS file; the others come
+ from effect and UI layout resources, which the list covers only for bind states players have met. Also returns the number
of .sharcb record candidates rejected for a missing control magic (see sharcb_shaders)."""
index = json.loads((romfs / 'index.json').read_text(encoding='utf-8'))
if index.get('status') != 'pass':
diff --git a/tools/shader_list.py b/tools/shader_list.py
index fbe57338..7c656fd7 100644
--- a/tools/shader_list.py
+++ b/tools/shader_list.py
@@ -1,8 +1,8 @@
-"""The MacNativeGames shared shader list (refs/MacNativeGames games//assets/shader_list.tsv, MIT; docs/shader-list.md
-there) as our tools read it: every row of one revision, plus the V rows of every older revision that it dropped.
+"""The shared shader list (PATH in the refs/MacNativeGames checkout; MIT, see THIRD_PARTY_NOTICES.md) as our tools
+read it: every row of one revision, plus the V rows of every older revision that it dropped.
-MacNativeGames prunes V rows its own runtime no longer needs: default variants, which its seed translates for every
-shader (1.4.3 on 2026-10-22, 1.0.0 to 1.2.1 on 2026-10-25), and variants that differ only in vertex input or colour
+The list drops V rows its producer's runtime no longer needs: default variants, which that runtime translates for every
+shader (dropped 2026-10-22 to 2026-10-25), and variants that differ only in vertex input or colour
output types (2026-10-26). Our answers (runtime/gfx_shader.c) still tell those apart, so a dropped row names a variant
our play meets: at 1340bee the list alone has 134 rows of 1.4.3 shaders, its history 24,839, and of 1.2.1 6,771 and
25,238. A row no draw asks for costs one translation. No copy of the list goes into the repository.
diff --git a/tools/spin_waits.py b/tools/spin_waits.py
index 7f581fde..154f5a48 100644
--- a/tools/spin_waits.py
+++ b/tools/spin_waits.py
@@ -1,4 +1,4 @@
-# Adapted from nxnative dm/tools/patch_nso.py @ 6d34984 (MIT, Copyright (c) 2026 seedds): the spin wait search
+# Copyright (c) 2026 seedds (MIT; see THIRD_PARTY_NOTICES.md): the spin wait search
# ("Spin waits": spin_rw, spin_kind, spin_rmw, spin_lock, spin_store, spin_quick, spin_region, spin_region1).
"""Find the spin waits of the ExeFS modules and print them as `spin` lines of a patch table (recomp/patches.py).
@@ -7,8 +7,8 @@ Usage: spin_waits.py --exefs build/extracted/v143/exefs --patches recomp/patches
A guest loop that polls memory until another thread changes it fills only its own core on the Switch, where a better
thread pinned there preempts it. Here it holds one of the three virtual cores (runtime/kernel.c) and a host core, and
when the poll takes and releases a lock on every pass, two pollers hand the lock's cache line between their cores so
-that the thread whose item it is rarely wins its exclusive store (nxnative 6d34984: Breath of the Wild's job queue,
-main+0xef62dc, CPU frames of 30-210 ms every 1-10 s). The generator sends the back-edges of such loops through
+that the thread whose item it is rarely wins its exclusive store (a job queue
+polled this way gave CPU frames of 30-210 ms every 1-10 s). The generator sends the back-edges of such loops through
rt_spin_gate (runtime/kernel.c kern_spin_gate), which slows the poll down and hands the virtual core to a waiting
thread once the loop has polled for a while.
diff --git a/tools/ultrawide_layout.py b/tools/ultrawide_layout.py
index 0c2953c3..4ebe180b 100644
--- a/tools/ultrawide_layout.py
+++ b/tools/ultrawide_layout.py
@@ -1,5 +1,5 @@
-# Adapted from MacNativeGames games//scripts/ultrawide_layout.py @ 933b6a0 (MIT, Copyright (c) 2026
-# MacNativeGames contributors). Used by tools/make_romfs_patches.py --aspect.
+# Copyright (c) 2026 MacNativeGames contributors (MIT; see THIRD_PARTY_NOTICES.md). Used by
+# tools/make_romfs_patches.py --aspect.
"""The game's UI layouts for a canvas of another shape than 16:9 (output_res = 3440x1440 or 1280x800 in nx2navi.ini),
edited in place in the decompressed UI/LayoutArchive/Common.Product.*.blarc (tools/make_romfs_patches.py --aspect).
@@ -7,9 +7,8 @@ The game lays its UI out on a 1920x1080 grid and maps that grid onto the canvas,
out 34% too wide and on a 16:10 one 11% too tall. Here each layout's root pane is scaled back to 16:9 on the stretched
axis (scale x = 16/9 over the aspect when wider, scale y = the aspect over 16/9 when narrower), backgrounds that must
cover the whole screen are stretched back, and the HUD's parts move out to the screen's corners (wider) or its top and
-bottom edges (narrower). The pane list and the distances are the ones the community an ultrawide mod mod for emulators
-found for 1.0.0 .. 1.2.1 (GPL; only those values are taken, no code; THIRD_PARTY_NOTICES.md). This is an independent
-implementation, checked against 1.2.1's Common.Product.110 and 1.4.3's Common.Product.140: every pane is found by name
+bottom edges (narrower). The pane list and the distances are values only, no code (THIRD_PARTY_NOTICES.md). The
+implementation is checked against 1.2.1's Common.Product.110 and 1.4.3's Common.Product.140: every pane is found by name
and every pane field and animation key holds the value the edit expects before it is written.
"""
import struct
diff --git a/tools/xlate/AmpereLowering.cs b/tools/xlate/AmpereLowering.cs
index b055c72c..1f0707bd 100644
--- a/tools/xlate/AmpereLowering.cs
+++ b/tools/xlate/AmpereLowering.cs
@@ -1,16 +1,15 @@
-// Switch 2 (NVN2) shader programs are SM86 (Ampere) code; the Ryujinx translator decodes Maxwell (SM5x) only. This file
-// rewrites each SM86 instruction as one or more Maxwell instructions with the same meaning, so Ryujinx's Maxwell decoder,
+// Switch 2 (NVN2) shader programs are SM86 (Ampere) code; the shader translator decodes Maxwell (SM5x) only. This file
+// rewrites each SM86 instruction as one or more Maxwell instructions with the same meaning, so its Maxwell decoder,
// IR and SPIR-V backend run unchanged. Instructions this file does not know make the whole program fail with the opcode
// and the reason, so coverage grows by census (python nvn2_shaders.py over a NX2NAVI_SHADER_DUMP directory).
//
-// Encoding facts: SM70+ instruction fields as in Mesa NAK's sm70_encode.rs (MIT); the Maxwell side is Ryujinx's
-// Decoders/InstTable.cs and InstDecoders.cs. Behaviour where SM86 and the translator's Maxwell model differ (MUFU.SIN/COS
-// take turns, BSSY/BSYNC are reconvergence hints, bank 24 is never bound) was cross-checked against the system's
-// shader_recompiler/frontend/ampere/lower_to_maxwell.h (GPL-3.0, read for behaviour only; no code taken).
+// Encoding facts: the SM70+ instruction field layouts; the Maxwell side is the translator's Decoders/InstTable.cs and
+// InstDecoders.cs. Where SM86 and the translator's Maxwell model differ: MUFU.SIN/COS take turns, BSSY/BSYNC are
+// reconvergence hints, bank 24 is never bound.
//
// Layout: graphics programs keep the first 0x50 bytes of the 0x80-byte Turing+ header (the same fields as Maxwell's
// header), then the instructions; Maxwell puts a scheduling word first in every 32 bytes counted from the first
-// instruction (Ryujinx's Decoder skips them), written as 0. Compute programs start at address 0.
+// instruction (the translator's Decoder skips them), written as 0. Compute programs start at address 0.
//
// Registers: guest registers keep their numbers. Uniform registers live just above the highest register the program
// uses (UrBase, even so pairs stay aligned; URZ is RZ) and must end below R239. R239-R254 are this file's scratch
@@ -985,8 +984,8 @@ static class AmpereLowering
// index above) from a uniform register in bits 40-45 (0xf60) or, with bit 59 (.B) set, as one more operand
// right after the coordinates (0x361; with bit 60 clear Ra holds all coordinates and Rb the handle and the
// rest). Bindless becomes Maxwell TEX.B, the handle first among the meta registers (offsets bit 36, LOD mode 37):
- // the translator then indexes its texture-pool arrays with it (Ryujinx BindlessElimination GenerateBindlessAccess,
- // the handle being loaded from memory). Operand packing as the system's lower_to_maxwell.h describes (behaviour only).
+ // the translator then indexes its texture-pool arrays with it (BindlessElimination GenerateBindlessAccess,
+ // the handle being loaded from memory).
void Tex(uint op)
{
bool bindless = op != 0xb60;
@@ -1311,7 +1310,7 @@ static class AmpereLowering
// SURED.D.op U32 (bound descriptor): data 32-39, coordinates 24-31, operation 87-89 (ADD MIN MAX INC DEC AND OR
// XOR, as Maxwell's), dimension 61-63 (1D buffer or 2D), descriptor offset 40-53 in bank 54-58. Maxwell's SURED
- // is 1110101101011 in the top bits (0xeb58, Ryujinx InstTable Sured); 0xeb48 matched no instruction, so the
+ // is 1110101101011 in the top bits (0xeb58, InstTable Sured); 0xeb48 matched no instruction, so the
// translator skipped every SURED: Ocarina's edge AA (the blend-weight pass ORs its weights into an image) never
// wrote anything.
void Sured()
@@ -1519,7 +1518,7 @@ static class AmpereLowering
// on an NVIDIA GPU (tests/tensor_lowering_check.py): a negative result or -0 becomes +0, +inf stays, -inf
// becomes 0, a NaN result stays NaN (0x7fff). The sum goes to TexOut and integer operations build the mask of
// the half lanes to clear. Maxwell PRMT would be the obvious tool, but the translator emits nothing for it
- // (Ryujinx 1.3.2, Instructions/InstEmit.cs, PrmtR only logs "not implemented").
+ // (Instructions/InstEmit.cs: PrmtR only logs "not implemented").
// F32 results (78), the H0_NH1 source (86) and absolute values where Maxwell has none are not lowered. HADD2's
// second operand is B, or C for forms 2/3.
void Half(ulong maxwell)
@@ -1832,10 +1831,9 @@ static class AmpereLowering
// W2 0x000004ff: bits 78-79 = 0, round to nearest even. The compiler uses this form for unorm values it has
// already multiplied by 255.
// Each byte goes through NaN -> 0, a float clamp to [0, 255], then F2I.U32.F32 with that rounding. The clamp
- // has to be explicit. The translator's F2I (Ryujinx Instructions/InstEmitConversion.cs, EmitF2I) clamps only
+ // has to be explicit. The translator's F2I (Instructions/InstEmitConversion.cs, EmitF2I) clamps only
// U16/S16 destinations, and IDstFmt has no U8, so a plain F2I.U8 lets values above 255 through. It also feeds
- // NaN to FMax, whose SPIR-V result is undefined. Behaviour as read from the system (lower_to_maxwell.h,
- // LowerToMaxwellWith; GPL-3.0, read for behaviour only).
+ // NaN to FMax, whose SPIR-V result is undefined.
void F2ipByte()
{
if ((_i.W1 & ~0xffu) != 0 || (_i.W2 != 0x0000c4ff && _i.W2 != 0x000004ff)) throw Fail("packed float-to-byte mode");
@@ -1878,7 +1876,7 @@ static class AmpereLowering
// interleaved: dx.x, dy.x, dx.y, dy.y), descriptor word offset 40-53 in bank 54-58, dimension 61-63, second
// destination 64-71, mask 72-75, bit 90 no-dependency. Offsets (76), FP16 results (79) and the bindless forms
// (59-60) are not lowered. Bits 81-84 are set in every TXD seen (81-83: no sparse predicate).
- // Maxwell TXD (0xde00) takes the coordinates and the layer the same way in Ra.., but Ryujinx's EmitTxd reads Rb..
+ // Maxwell TXD (0xde00) takes the coordinates and the layer the same way in Ra.., but the translator's EmitTxd reads Rb..
// as dPdx (2 values) then dPdy (2 values), so the derivatives are reordered on the way into TexMeta.
// With no second destination the third and fourth channels are dropped (SM70+ register pairs), so the mask
// handed to Maxwell keeps only its two lowest channels and TexResults writes Rd, Rd+1; otherwise TexResults
@@ -1902,7 +1900,7 @@ static class AmpereLowering
int ra = (int)_i.Bits(24, 8), rb = (int)_i.Bits(32, 8);
int coords = dim == 5 ? 3 : 2;
for (int k = 0; k < coords; k++) Mov(TexCoord + k, ra == RZ ? RZ : Gpr((uint)(ra + k)), false);
- // SM86 order dx.x, dy.x, dx.y, dy.y; Ryujinx's Maxwell order dx.x, dx.y, dy.x, dy.y.
+ // SM86 order dx.x, dy.x, dx.y, dy.y; the translator's Maxwell order dx.x, dx.y, dy.x, dy.y.
int[] order = { 0, 2, 1, 3 };
for (int k = 0; k < 4; k++) Mov(TexMeta + k, rb == RZ ? RZ : Gpr((uint)(rb + order[k])), false);
EmitG(0xde00000000000000UL | TexOut | ((ulong)TexCoord << 8) | ((ulong)TexMeta << 20) | ((ulong)TexMaxwellDim[dim] << 28)
@@ -2286,7 +2284,7 @@ static class AmpereLowering
Emit(0xe24000000000000fUL | ((ulong)(_i.Bits(12, 4) ^ 8) << 16));
}
_branches.Add((_out.Count, (int)(target / 16)));
- // Predicate field 0, as Maxwell CAL encodes it (it has no predicate): Ryujinx's Decoder reads a CAL whose
+ // Predicate field 0, as Maxwell CAL encodes it (it has no predicate): the translator's Decoder reads a CAL whose
// field says PT as an unconditional branch and decodes nothing after it (Decoder.IsUnconditionalBranch).
Emit(0xe260000000000000UL);
}
@@ -2383,7 +2381,7 @@ static class AmpereLowering
try { lowered = new Lowerer(insns, sph, !graphics, table, mesh) { C1 = C1Bytes }.Run(out branches, out first); }
catch (RegisterPressureException)
{
- // Local memory after the program's own: the header's sizes (Ryujinx: low + high + CRS / 32), or the
+ // Local memory after the program's own: the header's sizes (translator: low + high + CRS / 32), or the
// translator's compute default (0x1000) for compute programs.
spillAt = 0x1000;
if (header != 0)
diff --git a/tools/xlate/Program.cs b/tools/xlate/Program.cs
index 92221f37..08ae3b0c 100644
--- a/tools/xlate/Program.cs
+++ b/tools/xlate/Program.cs
@@ -1,7 +1,6 @@
-// NX2NAVI Vulkan adaptation of MacNativeGames games//tools/nx2navi_xlate/Program.cs (MIT, see LICENSE; MNG commit b75be8cf).
-// Provenance: that file is based on D2R Mobile dm/gfx/tools/dmsh_xlate/Program.cs. Changes here: SPIR-V for Vulkan is the final
-// output (no MSL service, no VertexCounterLowering, no NEAR_IS_MINUS_W rewrite), depth clip control reported as supported,
-// non-constant texture offsets reported as unsupported, --disasm dropped.
+// NX2NAVI runtime shader translator front end. Copyright (c) 2026 jhaizhou (MIT; see THIRD_PARTY_NOTICES.md).
+// SPIR-V for Vulkan is the only output (no MSL, no vertex-counter lowering, no near-is-minus-w rewrite); depth clip control
+// is reported as supported and non-constant texture offsets as unsupported.
// Protocol (stdout carries replies only; diagnostics go to stderr):
// nx2navi_xlate --serve one request per stdin line: {"job": {...}, "out": ""}; one reply line per request:
// "ok " or "fail "; a malformed line gets "fail ? " and the loop continues.
@@ -51,7 +50,7 @@ static class SwshXlate
public SetBindingPair CreateStorageBufferBinding(int index) => new(0, _binding++);
public SetBindingPair CreateTextureBinding(int count, bool isBuffer) { int b = _binding; _binding += PoolArray(count) ? 1 : count; return new(0, b); }
public ReadOnlySpan GetCode(ulong address, int minimumSize) => MemoryMarshal.Cast(new ReadOnlySpan(_code)[(int)address..]);
- // Bindless handles loaded from memory index the whole texture and sampler pools (Ryujinx BindlessElimination
+ // Bindless handles loaded from memory index the whole texture and sampler pools (the translator's BindlessElimination
// GenerateBindlessAccess): arrays of TexturePoolLength textures (handle bits 0-19) and SamplerPoolLength samplers
// (bits 20-31; NVN sampler ids are below 4096). res.json marks them "pool": 1 (textures) / 2 (samplers); the
// runtime binds them from its global pool set (vk_exec_draw.c, texture and sampler pools).
@@ -105,7 +104,7 @@ static class SwshXlate
public int QueryComputeLocalSizeX() => Local(0);
public int QueryComputeLocalSizeY() => Local(1);
public int QueryComputeLocalSizeZ() => Local(2);
- // "local_mem": local memory bytes of a compute program (the lowering's spill area adds to it); else Ryujinx's 0x1000.
+ // "local_mem": local memory bytes of a compute program (the lowering's spill area adds to it); else the translator's 0x1000.
public int QueryComputeLocalMemorySize() => _job["local_mem"] is JsonNode n ? (int)n : 0x1000;
public int QueryComputeSharedMemorySize() => _job["shared"] is JsonNode n ? (int)n : 0; // 配对 PC 的 groupshared 声明之和 | sum of the paired PC shader's groupshared declarations
static AttributeType Attr(string s) => s switch { "sint" => AttributeType.Sint, "uint" => AttributeType.Uint, _ => AttributeType.Float };
@@ -116,30 +115,30 @@ static class SwshXlate
if (_job["fout"] is JsonObject f) foreach (var kv in f) fout[int.Parse(kv.Key)] = Attr((string)kv.Value);
// Vulkan: VK_EXT_depth_clip_control handles NEAR_IS_MINUS_W, so the shader is never rewritten ("depth_minus_w" in a job is ignored).
const bool depthMinusW = false;
- // "early_fragment_tests": the fragment shader's NVN control byte +0x718 (the driver's early-Z-force, Ryujinx's
- // EarlyZForce); the SPIR-V then declares EarlyFragmentTests (MacNativeGames ae8f4f4).
+ // "early_fragment_tests": the fragment shader's NVN control byte +0x718 (the driver's early-Z-force, the
+ // translator's EarlyZForce); the SPIR-V then declares EarlyFragmentTests.
bool earlyZ = _job["early_fragment_tests"] is JsonValue ez && ez.TryGetValue(out bool eb) && eb;
return new GpuGraphicsState(earlyZ, InputTopology.Triangles, false, TessPatchType.Triangles, TessSpacing.EqualSpacing,
false, false, false, depthMinusW, false, 1f, AlphaTestOp.Always, 0f, attr, false, fout, false,
false /* 不做 Y 取反 | no Y flip */, true /* 原点左上 | origin upper-left */, false);
}
public bool QueryHostSupportsDepthClipControl() => true;
- // Vulkan: the ConstOffset / ConstOffsets image operands Ryujinx emits must be constants. A TLD4.PTP whose offsets
+ // Vulkan: the ConstOffset / ConstOffsets image operands the translator emits must be constants. A TLD4.PTP whose offsets
// come from registers (agl_technique_pfx compute b940aa86, dfe7662f) otherwise becomes an OpConstantComposite over
// computed ids, which spirv-val rejects; false makes TexturePass emulate only non-constant offsets.
public bool QueryHostSupportsNonConstantTextureOffset() => false;
- // "softfloat64": true lowers FP64 operations to FP32 (Ryujinx's DoubleToFloat pass), for a host without shaderFloat64.
+ // "softfloat64": true lowers FP64 operations to FP32 (the translator's DoubleToFloat pass), for a host without shaderFloat64.
public bool QueryHostSupportsShaderFloat64() => _job["softfloat64"] is not JsonValue v || !(v.TryGetValue(out bool b) && b);
public bool QueryHostSupportsTextureShadowLod() => true;
- // Sub-texel precision bits of a host whose gathers round differently from Maxwell (AMD, Intel): Ryujinx then
+ // Sub-texel precision bits of a host whose gathers round differently from Maxwell (AMD, Intel): the translator then
// biases gather coordinates so the same texels are picked (TexturePass.InsertCoordGatherBias). 0: no bias.
public int QueryHostGatherBiasPrecision() => _job["gather_bias"] is JsonNode n ? (int)n : 0;
// 作业 reduced = true:放宽精度——翻译器只给强制精确的运算打 NoContraction(缺省全部打:保持 Maxwell 分开舍入的逐位结果,代价是 MSL 里大量禁优化的 spvFMul 等)
// Job reduced = true: relaxed precision - the translator marks NoContraction only on operations that must be exact (the default marks all: keeps the bit-exact results of Maxwell's separate rounding, at the cost of many optimization-disabled spvFMul etc. in the MSL)
public bool QueryHostReducedPrecision() => _job["reduced"] is JsonNode n && (bool)n;
- // Host answers for GPUs other than the RX 9070 (runtime/vk_caps.c); absent from the job they keep Ryujinx's defaults.
+ // Host answers for GPUs other than the RX 9070 (runtime/vk_caps.c); absent from the job they keep the translator's defaults.
// "sbuf_align": n: the host binds each storage buffer at its guest address rounded down to n (minStorageBufferOffsetAlignment
- // above 4), so storage offsets count from there (Ryujinx's unaligned path; the multi-target path uses n too).
+ // above 4), so storage offsets count from there (the translator's unaligned path; the multi-target path uses n too).
public bool QueryHasUnalignedStorageBuffer() => _job["sbuf_align"] is JsonNode;
public int QueryHostStorageBufferOffsetAlignment() => _job["sbuf_align"] is JsonNode n ? (int)n : 16;
// "subgroup": n: lanes per subgroup when the host cannot pin 32 (AMD GCN/Vega run 64): ballots and votes span n lanes.
diff --git a/tools/xlate/nx2navi_xlate.csproj b/tools/xlate/nx2navi_xlate.csproj
index c47e4288..3dd563e4 100644
--- a/tools/xlate/nx2navi_xlate.csproj
+++ b/tools/xlate/nx2navi_xlate.csproj
@@ -1,5 +1,5 @@
-
+
Exe