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

+33
View File
@@ -0,0 +1,33 @@
// Calls the drag-in loader the way OptiScaler does: the GPU-free discovery
// marker, then NGX feature requirements for every DXGI adapter.
#include <windows.h>
#include <dxgi.h>
#include <cstdio>
struct Info { unsigned SDKVersion, FeatureID; char reserved[48]; };
struct Requirement { unsigned FeatureSupported, MinHWArchitecture; char MinOSVersion[255]; };
using Requirements = unsigned (*)(IDXGIAdapter*, const Info*, Requirement*);
using Version = unsigned (*)();
int wmain(int argc, wchar_t** argv) {
if (argc != 2) { std::printf("usage: loader_selection_probe LOADER_DLL\n"); return 2; }
HMODULE loader = LoadLibraryW(argv[1]);
if (!loader) { std::printf("LOAD_FAILED error=%lu\n", GetLastError()); return 2; }
auto version = reinterpret_cast<Version>(reinterpret_cast<void*>(GetProcAddress(loader, "d4r_WindowsBackendVersion")));
auto requirements = reinterpret_cast<Requirements>(reinterpret_cast<void*>(GetProcAddress(loader, "NVSDK_NGX_D3D12_GetFeatureRequirements")));
if (!version || !requirements) { std::printf("EXPORTS_MISSING\n"); return 2; }
std::printf("MARKER version=%u hip_loaded=%d\n", version(), GetModuleHandleW(L"amdhip64_7.dll") != nullptr);
IDXGIFactory1* factory = nullptr;
if (FAILED(CreateDXGIFactory1(__uuidof(IDXGIFactory1), reinterpret_cast<void**>(&factory)))) return 2;
IDXGIAdapter1* adapter = nullptr;
for (UINT i = 0; factory->EnumAdapters1(i, &adapter) == S_OK; ++i) {
DXGI_ADAPTER_DESC1 desc{}; adapter->GetDesc1(&desc);
Info info{0x15, 1, {}}; Requirement result{};
const unsigned status = requirements(adapter, &info, &result);
std::printf("ADAPTER vendor=0x%04x status=0x%x supported=%u marker=0x%x name=%ls\n", desc.VendorId, status,
result.FeatureSupported, result.MinHWArchitecture, desc.Description);
adapter->Release();
}
factory->Release();
return 0;
}