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

+12 -1
View File
@@ -146,12 +146,23 @@ add_dependencies(d4r_nvngx_windows d4r_pixel_code_object)
set_target_properties(d4r_nvngx_windows PROPERTIES PREFIX "" OUTPUT_NAME "d4r_nvngx")
target_compile_definitions(d4r_nvngx_windows PRIVATE WIN32_LEAN_AND_MEAN NOMINMAX __HIP_PLATFORM_AMD__)
target_include_directories(d4r_nvngx_windows PRIVATE "${D4R_HIP_ROOT}/include")
target_link_libraries(d4r_nvngx_windows PRIVATE version dbghelp d3d12 dxguid minhook)
target_link_libraries(d4r_nvngx_windows PRIVATE version dbghelp d3d12 dxguid minhook bcrypt)
install(FILES "${D4R_MINHOOK_ROOT}/LICENSE.txt" DESTINATION licenses RENAME MinHook.txt)
if(MINGW)
target_link_options(d4r_nvngx_windows PRIVATE -static)
endif()
install(TARGETS d4r_nvngx_windows RUNTIME DESTINATION bin)
# Target-independent _nvngx.dll of drag-in releases: loads _nvngx_<arch>.dll
# for the game's actual HIP architecture. Its own D4R_TARGET_ARCH is unused.
add_library(d4r_nvngx_loader SHARED tools/windows/d4r_nvngx_loader.cpp)
set_target_properties(d4r_nvngx_loader PROPERTIES PREFIX "" OUTPUT_NAME "d4r_nvngx_loader")
target_compile_definitions(d4r_nvngx_loader PRIVATE WIN32_LEAN_AND_MEAN NOMINMAX __HIP_PLATFORM_AMD__)
target_include_directories(d4r_nvngx_loader PRIVATE "${D4R_HIP_ROOT}/include")
target_link_libraries(d4r_nvngx_loader PRIVATE version dbghelp)
if(MINGW)
target_link_options(d4r_nvngx_loader PRIVATE -static)
endif()
install(TARGETS d4r_nvngx_loader RUNTIME DESTINATION bin)
if(MSVC)
target_sources(d4r_ngx_cuda_init_probe PRIVATE tools/d4r_ngx_param_msvc.cpp tools/d4r_ngx_param_host.cpp)
target_sources(d4r_d3d12_dlss_probe PRIVATE tools/d4r_ngx_param_msvc.cpp tools/d4r_ngx_param_host.cpp)