Windows: drag-in install with a per-game d4r.ini

Players extract one ZIP into the game folder, copy their two NVIDIA
DLLs, and start the game from Steam, Epic or a shortcut. No launcher
script is needed; settings live in d4r\d4r.ini.

- Shim player mode: when the launcher has not set D4R_HIP_ROOT and
  d4r.ini sits beside the shim, derive the backend environment from it.
  Codegen flags stay at the Windows-validated values. NVIDIA DLLs must
  match an exact SHA256 in dll-pins.txt, with "you have X, you need Y"
  errors. Rejects a vkd3d/Wine d3d12.dll and code objects built for
  another GPU. [DLSS] Model accepts K or M and is applied by rewriting
  the render preset hints.

- d4r.ini exposes only options that exist on Windows: Model, AsyncInterop,
  ValidateOutput, Log, CacheDir. Invalid values fall back with a note in
  d4r_nvngx.log.

- d4r_nvngx_loader: one _nvngx.dll for all GPUs. It matches the game's
  adapter by LUID and loads _nvngx_<arch>.dll from the same folder.

- OptiScaler patch 0006: relative NvngxPath/NvngxDlssPath/
  NvngxFeaturePath resolve against OptiScaler's folder.

- package-windows-release.ps1 builds the release from the per-target
  game packages and refuses mixed targets or differing shared runtimes.

- Tests: test-player-config.ps1 (ini and DLL-pin decisions, loader
  selection on the local GPU) and test-windows-release-package.ps1.
This commit is contained in:
ayo committed 2026-10-03 03:10:19 -04:00
1 parent 7ab56d42fc
commit 65ab1460a8
13 files changed
+1004 -1

No files matched your search

@@ -0,0 +1,30 @@
Subject: [PATCH] Resolve relative d4r library paths against the OptiScaler folder
Lets a drag-in d4r install ship OptiScaler.ini with NvngxPath=d4r instead of
an absolute path that only an installer could know. Absolute paths behave
exactly as before.
---
diff --git a/OptiScaler/Config.cpp b/OptiScaler/Config.cpp
--- a/OptiScaler/Config.cpp
+++ b/OptiScaler/Config.cpp
@@ -787,9 +787,17 @@
{
MainDllPath.set_from_config(readWString("Libraries", "OptiDllPath"));
- NvngxPath.set_from_config(readWString("Libraries", "NvngxPath"));
- NVNGX_DLSS_Library.set_from_config(readWString("Libraries", "NvngxDlssPath"));
- DLSSFeaturePath.set_from_config(readWString("Libraries", "NvngxFeaturePath"));
+ // A relative library folder (d4r drag-in installs use "d4r") is resolved
+ // against this DLL's folder, as LogFileName is. Absolute paths are unchanged.
+ auto libraryPath = [](std::optional<std::wstring> value) -> std::optional<std::wstring>
+ {
+ if (!value.has_value() || value->empty() || std::filesystem::path(*value).is_absolute())
+ return value;
+ return (Util::DllPath().parent_path() / *value).lexically_normal().wstring();
+ };
+ NvngxPath.set_from_config(libraryPath(readWString("Libraries", "NvngxPath")));
+ NVNGX_DLSS_Library.set_from_config(libraryPath(readWString("Libraries", "NvngxDlssPath")));
+ DLSSFeaturePath.set_from_config(libraryPath(readWString("Libraries", "NvngxFeaturePath")));
NvapiDllPath.set_from_config(readWString("Libraries", "NvapiPath"));
FfxDx12Path.set_from_config(readWString("Libraries", "FfxDx12Path"));