mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-15 19:19:58 -04:00
Shaders: a switch whose index is clamped against a register that a MOV of an immediate set before it now finds its jump table (AmpereLowering.cs BrxTargets), so all 36,031 of the game's shader variants translate and no draw is skipped for a failed one. The compare-and-swap loop behind storage-buffer atomics (patch 0033) takes the value a failed swap returns as its next expected value instead of loading the word again, which on some drivers kept returning a stale copy. Memory: an unused physical pool outlives the submission being recorded, as virtual pages may still reach it through device addresses; an image whose creation failed is not tried again for 2 s. The installer and Linux texts name this game. The README has the project icon, the current status, features, requirements and known issues. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
66 lines
2.8 KiB
Python
66 lines
2.8 KiB
Python
"""Write runtime/nvn_procs.inc: the NVN proc names NX2navi 1.2.1 loads.
|
|
|
|
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
|
|
"""
|
|
|
|
import re
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parent.parent
|
|
# the game folder of the refs checkout that holds the NVN front end
|
|
NVN_DIR = next((ROOT / "refs/MacNativeGames/games").glob("*/third_party/d2r_gfx/gfx/nvn"),
|
|
ROOT / "refs/MacNativeGames/games/third_party/d2r_gfx/gfx/nvn")
|
|
OUT = ROOT / "runtime/nvn_procs.inc"
|
|
|
|
NOT_LOADED = {"nvnDeviceApplyDeferredFinalizes", "nvnQueueAcquireTexture"}
|
|
SUBSDK0 = [ # section 0.1: asked by the movie library through nvnDeviceGetProcAddress
|
|
"nvnDeviceGetProcAddress",
|
|
"nvnSyncFinalize",
|
|
"nvnSyncGetNvRmSyncNVX",
|
|
"nvnSyncInitializeFromNvRmSyncNVX",
|
|
"nvnTextureGetNvRmSurfaceNVX",
|
|
]
|
|
MAIN_COUNT = 534
|
|
# NVN2 (Switch 2) procs this host implements; the rest of the NVN2 names get traps (runtime/nvn_procs.c nvn_trap).
|
|
NVN2 = [
|
|
"nvnCommandBufferDrawMeshTasks",
|
|
"nvnCommandBufferDrawMeshTasksIndirect",
|
|
"nvnCommandBufferPushComputeConstants",
|
|
"nvnCommandBufferSetGeometryProcessingMode",
|
|
"nvnProgramBuilderSetDefaults",
|
|
"nvnProgramBuilderSetDevice",
|
|
"nvnProgramBuilderSetShaders",
|
|
"nvnProgramInitializeFromBuilder",
|
|
]
|
|
|
|
|
|
def main() -> int:
|
|
names = [n.strip() for n in (NVN_DIR / "names.txt").read_text(encoding="utf-8").splitlines() if n.strip()]
|
|
extras = re.findall(r"^NVN_EXTRA\((\w+)", (NVN_DIR / "nx2navi_nvn_ext.c").read_text(encoding="utf-8"), re.M)
|
|
if len(extras) != 13:
|
|
print(f"expected 13 NVN_EXTRA names, found {len(extras)}", file=sys.stderr)
|
|
return 1
|
|
main_names = [n for n in names if n not in NOT_LOADED] + extras
|
|
if len(main_names) != len(set(main_names)) or len(main_names) != MAIN_COUNT:
|
|
print(f"expected {MAIN_COUNT} distinct main names, found {len(main_names)} "
|
|
f"({len(set(main_names))} distinct)", file=sys.stderr)
|
|
return 1
|
|
# nvnDeviceGetProcAddress is in both lists; keep one row per name.
|
|
extra_sub = [n for n in SUBSDK0 if n not in main_names]
|
|
rows = sorted(main_names) + sorted(extra_sub) + sorted(n for n in NVN2 if n not in main_names)
|
|
text = ("// Generated by tools/gen_nvn_procs.py: the NVN proc names of NX2navi 1.2.1.\n"
|
|
+ "".join(f"NVN_PROC({n})\n" for n in rows))
|
|
OUT.write_text(text, encoding="utf-8", newline="\n")
|
|
print(f"{OUT.relative_to(ROOT)}: {len(main_names)} main names + {len(extra_sub)} subsdk0-only names "
|
|
f"({len(SUBSDK0)} asked by subsdk0), {len(rows)} rows")
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|