mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-15 19:19:58 -04:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d0da862c87 | ||
|
|
cd7cce89cb | ||
|
|
7f50cc5e29 |
@@ -4,7 +4,7 @@ Static recompilation of *Ocarina of Time* (Switch 2, ARM64, game version 1.1.1)
|
||||
|
||||
## Game content boundary
|
||||
|
||||
This repository is private, and its additions are all rights reserved (`LICENSE-ADDITIONS`). It still never holds game data: game data lives outside it and every derived file stays in ignored folders.
|
||||
The repository's additions are all rights reserved (`LICENSE-ADDITIONS`). It never holds game data: game data lives outside it and every derived file stays in ignored folders.
|
||||
|
||||
- The user's game and key paths are in `config.local.toml` (ignored). Pass the keys file path to tools; the tools read it themselves. Key values stay out of your output, logs, commands and files.
|
||||
- Everything extracted or generated goes under `build/` or `generated/`.
|
||||
|
||||
@@ -67,7 +67,7 @@ and `VK_EXT_mesh_shader`. The setup is not signed, so SmartScreen warns on its f
|
||||
|
||||
## License
|
||||
|
||||
This repository is private. Its additions and changes are all rights reserved ([LICENSE-ADDITIONS](LICENSE-ADDITIONS)):
|
||||
The source is public to read. Its additions and changes are all rights reserved ([LICENSE-ADDITIONS](LICENSE-ADDITIONS)):
|
||||
no part of them may be copied, published, or used to train, fine-tune or prompt AI models or AI coding tools without
|
||||
written permission. The base import stays under its [MIT License](LICENSE), and third-party code keeps its own license
|
||||
([THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md)). No license grants anything for Nintendo's game.
|
||||
|
||||
@@ -13,7 +13,6 @@ Code copied or adapted from another project is listed here with its source, the
|
||||
| MacNativeGames NX2navi 1.2.1 cursor and aim steps: the map cursor, vertical aim and vertical gyro aim sites, their instruction words and the step scaled by the frame ratio | https://github.com/ly05010419/MacNativeGames @ `363a6eb50434387f7d623349934bcf1e910be48f` (`runtime/game_patches.c` patch_cursor_speed), Copyright (c) 2026 MacNativeGames contributors | MIT | `recomp/patches-v121.txt` (set cursor) |
|
||||
| MacNativeGames NX2navi aspect ratio: the camera and viewport sites that hand the perspective projection its aspect ratio, and the UI layout edits for a canvas wider than 16:9 | https://github.com/ly05010419/MacNativeGames @ `933b6a0d1438de160208a0a13eb5e8d7a2cb8094` (`runtime/aspect_patch.h`, `aspect_math.h`, `game_patches_v143.c`, `scripts/ultrawide_layout.py`), Copyright (c) 2026 MacNativeGames contributors | MIT | `recomp/patches-v143.txt` (set aspect), `tools/ultrawide_layout.py`, `tools/make_romfs_patches.py` (--aspect) |
|
||||
| MacNativeGames NX2navi button icons: the Xbox controller's shoulder buttons, triggers, Menu, View and d-pad drawn with letters from the game's own text fonts, the .bfotf key, the button guide's images and their block-linear layout, the resource size table raised for the archives that grew | https://github.com/ly05010419/MacNativeGames @ `933b6a0d1438de160208a0a13eb5e8d7a2cb8094` (`scripts/make_button_icons.py`), Copyright (c) 2026 MacNativeGames contributors | MIT | `tools/button_icons.py`, `tools/make_romfs_patches.py` (--prompts) |
|
||||
| RenoDX NX2navi mod (game mod by souperman9, tonemapper by Musa, RenoDX framework by ShortFuse, RenoVK fork by Ritsu): the approach of the HDR tonemap (the game's 1 - e^-x curve kept below a pivot and continued along its tangent above it, the saturation grade applied to the colour scaled into 0..1) and the observation that the passes after the tonemap keep values above 1. No code copied; the shader is our own | https://github.com/clshortfuse/renodx @ `b6f87272ad1bfdc0e6444910a93606815944a085` (`src/tonemap.slang`, `addon.cpp`), Copyright (c) 2025 Carlos Lopez Jr. | MIT | `runtime/shaders/hdr_tonemap.frag`, `runtime/vk_hdr.c` |
|
||||
| oot-mod (Ocarina of Time Switch 2 ultrawide mod): the matrix-update sites of sead's perspective projection and the 0.01 tolerance around 16:9, the 2D canvas site with the full-screen layout projection test and the screen vtables of the capture backgrounds, the movie layer viewport site, their instruction words and what each hook does there (rewritten without branches for the generator's patch sites) | https://github.com/craftycorvid/oot-mod @ `c5ccd1cd57e8219aea3be1e758221795fa5b7ec8` (`build.py` hooks), Copyright (c) 2026 Ivan0xFF | MIT | `recomp/patches-v111.txt` (sets wide_aspect, wide_hud, wide_movie), `runtime/widescreen.c` |
|
||||
| MacNativeGames NX2navi virtual-core preemption: asynchronous preemption of an owner in top-level game code, priority inheritance through guest mutexes, the SDK's preemption-disable protocol (TLR+0x100/+0x102, SVC 0x36), the core-wait diagnostics | https://github.com/ly05010419/MacNativeGames @ `33e8fa83052ea1ae09a3583137008e9797e12950` (`runtime/threads.c`, commits 8bf0893 and 19730cd), Copyright (c) 2026 MacNativeGames contributors | MIT | `runtime/kernel.c` (SuspendThread and a register-saving stub replace SIGUSR2), `runtime/hostfn.c`, `runtime/svc.c` (host depth) |
|
||||
| MacNativeGames RomFS index builder (`NX2NRFS1` layout) | https://github.com/ly05010419/MacNativeGames @ `b75be8cfa704df3701e86130c8ced268e79d6b11` (`scripts/prepare_romfs_backend.py`), Copyright (c) 2026 MacNativeGames contributors | MIT | `tools/romfs_index.py` |
|
||||
|
||||
34
docs/releases/v0.5.0.md
Normal file
34
docs/releases/v0.5.0.md
Normal file
@@ -0,0 +1,34 @@
|
||||
A fix release for *The Legend of Zelda: Ocarina of Time* for Nintendo Switch 2 (game version 1.1.1): the fog and
|
||||
lighting are back to the game's own. **No game files are included**: the setup builds the game on your PC from your own
|
||||
dump.
|
||||
|
||||
## Install or update
|
||||
|
||||
- **Already have 0.4.0:** start the launcher; it offers 0.5.0 and updates. The first start after the update prepares
|
||||
the shaders again (about a minute and a half on the boot screen).
|
||||
- **New install:** download **`NX2navi-Setup-0.5.0.exe`** below, put it next to your `.nup` dump of the game and start
|
||||
it. Windows SmartScreen warns on the first start because the setup is not signed: choose *More info* and *Run
|
||||
anyway*. The launcher builds the game (10 to 25 minutes, once), prepares every shader and starts it.
|
||||
|
||||
**Requirements:** Windows 10 or 11; an x86-64 CPU with SSE4.2; 16 GB of RAM; about 30 GB free for the game and 1.5 GB
|
||||
for the launcher; a GPU with Vulkan 1.3, `VK_EXT_external_memory_host` and `VK_EXT_mesh_shader` (current NVIDIA and AMD
|
||||
cards).
|
||||
|
||||
## Fixed in this release
|
||||
|
||||
- Kokiri Forest and other foggy areas are no longer washed out in a bright white and yellow haze: the fog the game
|
||||
builds up on the GPU adds up correctly again (0.4.0 broke the shader loop that adds to it).
|
||||
- Small white flowers and other foliage in the grass no longer flicker white from frame to frame.
|
||||
- The trees stay fixed: no dark columns reaching the sky.
|
||||
|
||||
## Known issues
|
||||
|
||||
- Entering a new area can hold one frame for about 0.2 s while its textures are set up, and the first visit to an
|
||||
area after an install can pause briefly while the graphics driver builds what it has not seen.
|
||||
- A rare crash in the game's particle code.
|
||||
- DLSS Frame Generation is not offered yet: AMD FSR 3.1 frame generation works on every GPU, NVIDIA's included.
|
||||
|
||||
Report problems as issues, with the game's log (`logs\nx2navi.log` in the game folder) and what you were doing.
|
||||
|
||||
NX2navi is an independent, non-commercial fan project, not affiliated with or endorsed by Nintendo. *The Legend of
|
||||
Zelda*, *Ocarina of Time* and *Nintendo Switch* are trademarks of Nintendo.
|
||||
19
tools/xlate/patches/0033-cas-loop-atomic-read.patch
Normal file
19
tools/xlate/patches/0033-cas-loop-atomic-read.patch
Normal file
@@ -0,0 +1,19 @@
|
||||
--- a/src/Ryujinx.Graphics.Shader/Translation/Optimizations/GlobalToStorage.cs
|
||||
+++ b/src/Ryujinx.Graphics.Shader/Translation/Optimizations/GlobalToStorage.cs
|
||||
@@ -960,11 +960,15 @@
|
||||
|
||||
private static Operand GenerateAtomicCasLoop(EmitterContext context, Operand wordOffset, int binding, Func<Operand, Operand> opCallback)
|
||||
{
|
||||
+ // NX2NAVI: each attempt reads the word with an atomic OR of 0, which returns its current value; a plain load
|
||||
+ // could keep returning a stale cached copy (seen on AMD), so an invocation that lost the race never matched
|
||||
+ // again and the loop did not end. The read stays inside the loop: this pass runs on SSA form, and the
|
||||
+ // optimizer's copy propagation takes every value as assigned once, so no local can carry a value round it.
|
||||
Operand lblLoopHead = Label();
|
||||
|
||||
context.MarkLabel(lblLoopHead);
|
||||
|
||||
- Operand oldValue = context.Load(StorageKind.StorageBuffer, binding, Const(0), wordOffset);
|
||||
+ Operand oldValue = context.AtomicOr(StorageKind.StorageBuffer, binding, Const(0), wordOffset, Const(0));
|
||||
Operand newValue = opCallback(oldValue);
|
||||
|
||||
Operand casResult = context.AtomicCompareAndSwap(
|
||||
@@ -1,28 +0,0 @@
|
||||
--- a/src/Ryujinx.Graphics.Shader/Translation/Optimizations/GlobalToStorage.cs
|
||||
+++ b/src/Ryujinx.Graphics.Shader/Translation/Optimizations/GlobalToStorage.cs
|
||||
@@ -960,11 +960,16 @@
|
||||
|
||||
private static Operand GenerateAtomicCasLoop(EmitterContext context, Operand wordOffset, int binding, Func<Operand, Operand> opCallback)
|
||||
{
|
||||
+ // NX2NAVI: the word is loaded once; a failed compare-and-swap returns the word's current value, which becomes
|
||||
+ // the next attempt's expected value. A plain load in every attempt could keep returning a stale cached copy
|
||||
+ // (seen on AMD), so an invocation that lost the race never matched again and the loop did not end.
|
||||
Operand lblLoopHead = Label();
|
||||
|
||||
+ Operand oldValue = Local();
|
||||
+ context.Copy(oldValue, context.Load(StorageKind.StorageBuffer, binding, Const(0), wordOffset));
|
||||
+
|
||||
context.MarkLabel(lblLoopHead);
|
||||
|
||||
- Operand oldValue = context.Load(StorageKind.StorageBuffer, binding, Const(0), wordOffset);
|
||||
Operand newValue = opCallback(oldValue);
|
||||
|
||||
Operand casResult = context.AtomicCompareAndSwap(
|
||||
@@ -977,6 +982,7 @@
|
||||
|
||||
Operand casFail = context.ICompareNotEqual(casResult, oldValue);
|
||||
|
||||
+ context.Copy(oldValue, casResult);
|
||||
context.BranchIfTrue(lblLoopHead, casFail);
|
||||
|
||||
return oldValue;
|
||||
@@ -1,45 +1,6 @@
|
||||
--- a/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Instructions.cs
|
||||
+++ b/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Instructions.cs
|
||||
@@ -1802,7 +1802,13 @@
|
||||
SpvInstruction one = context.Constant(context.TypeU32(), 1);
|
||||
SpvInstruction zero = context.Constant(context.TypeU32(), 0);
|
||||
|
||||
- return new OperationResult(varType, emitU(context.GetType(varType), elemPointer, one, zero, value));
|
||||
+ SpvInstruction result = emitU(context.GetType(varType), elemPointer, one, zero, value);
|
||||
+ if (operation.StorageKind == StorageKind.GlobalMemory) // NX2NAVI: the twin (GetDeviceAddressTwinPointer)
|
||||
+ {
|
||||
+ emitU(context.GetType(varType), GlobalTwinPointer(context, operation), one, zero, value);
|
||||
+ }
|
||||
+
|
||||
+ return new OperationResult(varType, result);
|
||||
}
|
||||
|
||||
private static OperationResult GenerateAtomicMemoryCas(CodeGenContext context, AstOperation operation)
|
||||
@@ -1815,7 +1821,22 @@
|
||||
SpvInstruction one = context.Constant(context.TypeU32(), 1);
|
||||
SpvInstruction zero = context.Constant(context.TypeU32(), 0);
|
||||
|
||||
- return new OperationResult(varType, context.AtomicCompareExchange(context.GetType(varType), elemPointer, one, zero, zero, value1, value0));
|
||||
+ SpvInstruction result = context.AtomicCompareExchange(context.GetType(varType), elemPointer, one, zero, zero, value1, value0);
|
||||
+ if (operation.StorageKind == StorageKind.GlobalMemory) // NX2NAVI: the twin (GetDeviceAddressTwinPointer)
|
||||
+ {
|
||||
+ context.AtomicCompareExchange(context.GetType(varType), GlobalTwinPointer(context, operation), one, zero, zero, value1, value0);
|
||||
+ }
|
||||
+
|
||||
+ return new OperationResult(varType, result);
|
||||
+ }
|
||||
+
|
||||
+ private static SpvInstruction GlobalTwinPointer(CodeGenContext context, AstOperation operation)
|
||||
+ {
|
||||
+ return GetDeviceAddressTwinPointer(
|
||||
+ context,
|
||||
+ ((AstOperand)operation.GetSource(0)).Value,
|
||||
+ context.Get(AggregateType.U32, operation.GetSource(1)),
|
||||
+ context.Get(AggregateType.U32, operation.GetSource(2)));
|
||||
}
|
||||
|
||||
private static OperationResult GenerateLoadOrStore(CodeGenContext context, AstOperation operation, bool isStore)
|
||||
@@ -1856,11 +1877,29 @@
|
||||
@@ -1856,11 +1856,25 @@
|
||||
// second-level block, 0 for none (block 0 stays zero)
|
||||
// word 65552 second-level blocks of 4096 entries, one per 4 KiB page: the record of the buffer that holds
|
||||
// the page, 0 for none
|
||||
@@ -51,28 +12,24 @@
|
||||
+ // then the same for the page's twin, the pool's imported buffer in guest memory when the first is
|
||||
+ // its VRAM mirror (low words first); the host never changes a record a page names, so a page entry
|
||||
+ // read at any time gives a whole one
|
||||
+ // The pointer addresses the 32-bit word at the address's 4-byte-aligned word. Stores and atomics also go to the
|
||||
+ // twin (GetDeviceAddressTwinPointer): what the GPU writes into a mirror through the table is not recorded as a
|
||||
+ // GPU write, so without it the CPU never saw it and a sync of a CPU-written page copied the stale guest page
|
||||
+ // over it (runtime/vk_gpa.c).
|
||||
+ // The pointer addresses the 32-bit word at the address's 4-byte-aligned word. Stores also go to the twin
|
||||
+ // (GetDeviceAddressPointers): what the GPU writes into a mirror through the table is not recorded as a GPU write,
|
||||
+ // so without it the CPU never saw it and a sync of a CPU-written page copied the stale guest page over it
|
||||
+ // (runtime/vk_gpa.c). Atomics do not: the twin's word may be stale (a counter the GPU reset with a buffer fill
|
||||
+ // went on counting from its old value in guest memory), and that page's next sync copied the wrong count into
|
||||
+ // the mirror, so culled instance lists drew garbage for a frame (flickering foliage).
|
||||
private static SpvInstruction GetDeviceAddressPointer(CodeGenContext context, int binding, SpvInstruction low, SpvInstruction high)
|
||||
{
|
||||
+ return GetDeviceAddressPointers(context, binding, low, high, out _);
|
||||
+ }
|
||||
+
|
||||
+ // The twin of an access's pointer: the guest copy of a mirrored page, else the scratch buffer.
|
||||
+ private static SpvInstruction GetDeviceAddressTwinPointer(CodeGenContext context, int binding, SpvInstruction low, SpvInstruction high)
|
||||
+ {
|
||||
+ GetDeviceAddressPointers(context, binding, low, high, out SpvInstruction twin);
|
||||
+ return twin;
|
||||
+ }
|
||||
+
|
||||
+ // twinPointer: the guest copy of a mirrored page, else the scratch buffer.
|
||||
+ private static SpvInstruction GetDeviceAddressPointers(CodeGenContext context, int binding, SpvInstruction low, SpvInstruction high, out SpvInstruction twinPointer)
|
||||
+ {
|
||||
SpvInstruction u32 = context.TypeU32();
|
||||
SpvInstruction u64 = context.TypeInt(64, 0);
|
||||
SpvInstruction tableVar = context.StorageBuffers[binding];
|
||||
@@ -1879,16 +1918,26 @@
|
||||
@@ -1879,16 +1893,26 @@
|
||||
SpvInstruction page = context.BitwiseAnd(u32, context.ShiftRightLogical(u32, low, U(12)), U(0xfff));
|
||||
SpvInstruction record = Word(context.IAdd(u32, context.IAdd(u32, context.IMul(u32, block, U(4096)), U(65552)), page));
|
||||
SpvInstruction mapped = context.INotEqual(context.TypeBool(), record, U(0));
|
||||
@@ -101,7 +58,7 @@
|
||||
}
|
||||
|
||||
private static SpvInstruction LoadAligned(CodeGenContext context, SpvInstruction type, SpvInstruction pointer)
|
||||
@@ -1912,7 +1961,7 @@
|
||||
@@ -1912,7 +1936,7 @@
|
||||
SpvInstruction u32 = context.TypeU32();
|
||||
SpvInstruction low = context.Get(AggregateType.U32, operation.GetSource(1));
|
||||
SpvInstruction high = context.Get(AggregateType.U32, operation.GetSource(2));
|
||||
@@ -110,7 +67,7 @@
|
||||
StorageKind kind = operation.StorageKind;
|
||||
int bits = kind is StorageKind.GlobalMemoryS8 or StorageKind.GlobalMemoryU8 ? 8
|
||||
: kind is StorageKind.GlobalMemoryS16 or StorageKind.GlobalMemoryU16 ? 16 : 32;
|
||||
@@ -1921,7 +1970,9 @@
|
||||
@@ -1921,7 +1945,9 @@
|
||||
{
|
||||
if (isStore)
|
||||
{
|
||||
@@ -121,7 +78,7 @@
|
||||
return OperationResult.Invalid;
|
||||
}
|
||||
|
||||
@@ -1939,6 +1990,8 @@
|
||||
@@ -1939,6 +1965,8 @@
|
||||
SpvInstruction semantics = context.Constant(u32, 0);
|
||||
context.AtomicAnd(u32, pointer, scope, semantics, context.Not(u32, mask));
|
||||
context.AtomicOr(u32, pointer, scope, semantics, context.ShiftLeftLogical(u32, value, shift));
|
||||
|
||||
Reference in New Issue
Block a user