ASI add-on for existing OptiScaler installs

Add an optional D4R_INSTALL_MODE=asi release (d4r-<version>-asi.zip)
holding only d4r.asi and a companion d4r/ folder, to drop into an
existing OptiScaler plugin directory.

- Shim: export InitializeASI. It identifies OptiScaler by its PE export
  name to find the active INI, then launches d4r-setup.exe out of
  process (no GPU or network work under the loader lock). The .asi
  build loads its runtime and config from the companion d4r/ folder.

- tools/d4r_asi_setup.cpp: native helper. It waits for the game to
  exit, installs the D3D12 wrapper and the private d4r12core.dll beside
  the EXE, and merges the NGX route into the loader's INI (including
  GE-Proton's prefix-local INI) with backups. Unchanged launches do
  nothing. It skips Proton helpers and background utilities and runs
  setup for one plugin install at a time.

- scripts/private_d3d12_core.py: points vkd3d's d3d12.dll forwarder at
  d4r12core.dll without moving code addresses.

- install.sh runs from inside the ASI's d4r/ as well as the proxy
  release root. d4r-check.sh checks ASI installs (loader, plugin path,
  LoadAsiPlugins, HookOriginalNvngxOnly, Wine drive paths).

- Packaging, build script, docs, ASI_README.txt and tests.
This commit is contained in:
ayo committed 2026-10-12 17:36:01 -04:00
1 parent 85175e0b27
commit d5c8be25c8
16 files changed
+1091 -39

No files matched your search

+9 -7
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# Release installer: copy this beside D4R_README.txt and the extracted d4r/ folder.
# NVIDIA installer: beside the proxy release's d4r/ or inside the ASI's d4r/.
set -euo pipefail
DLSS_URL=https://raw.githubusercontent.com/NVIDIA/DLSS/a291cc7d2cc642a51566f3dfd5376f635cd1b284/lib/Windows_x86_64/rel/nvngx_dlss.dll
DLSS_SHA256=be6e434a94ca32499515eb62ca0e6c274526055d568d0426e4c652dcdfb6ee6e
@@ -18,12 +18,14 @@ if [[ ${1:-} == --help || ${1:-} == -h ]]; then
fi
[[ $# -le 1 ]] || fail 'Usage: bash install.sh [extracted-release-directory]'
ROOT=$(cd -- "${1:-$(dirname -- "${BASH_SOURCE[0]}")}" && pwd)
[[ -f "$ROOT/d4r/nvngx.dll" && -f "$ROOT/d4r/d4r.ini" ]] || fail "Extract the release ZIP first; no d4r runtime found in $ROOT"
RUNTIME="$ROOT/d4r"
[[ ! -f "$ROOT/d4r.ini" ]] || RUNTIME="$ROOT"
[[ -f "$RUNTIME/nvngx.dll" && -f "$RUNTIME/d4r.ini" ]] || fail "Extract the release ZIP first; no d4r runtime found in $ROOT"
command -v sha256sum >/dev/null || fail 'Missing sha256sum (install coreutils).'
valid() { [[ -f "$1" ]] && [[ $(sha256sum -- "$1" | cut -d' ' -f1) == "$2" ]]; }
need_dlss=1; need_ngx=1
valid "$ROOT/d4r/nvngx_dlss.dll" "$DLSS_SHA256" && need_dlss=0
valid "$ROOT/d4r/ngx/_nvngx.dll" "$NGX_SHA256" && need_ngx=0
valid "$RUNTIME/nvngx_dlss.dll" "$DLSS_SHA256" && need_dlss=0
valid "$RUNTIME/ngx/_nvngx.dll" "$NGX_SHA256" && need_ngx=0
if (( need_dlss == 0 && need_ngx == 0 )); then
echo 'NVIDIA DLLs are already installed and verified.'
exit 0
@@ -79,6 +81,6 @@ place() {
STAGED=''
printf 'Installed: %s\n' "$dst"
}
(( need_dlss == 0 )) || place "$TMP/nvngx_dlss.dll" "$ROOT/d4r/nvngx_dlss.dll"
(( need_ngx == 0 )) || place "$TMP/ngx/_nvngx.dll" "$ROOT/d4r/ngx/_nvngx.dll"
echo 'NVIDIA DLLs installed and verified. Follow D4R_README.txt for Steam launch options.'
(( need_dlss == 0 )) || place "$TMP/nvngx_dlss.dll" "$RUNTIME/nvngx_dlss.dll"
(( need_ngx == 0 )) || place "$TMP/ngx/_nvngx.dll" "$RUNTIME/ngx/_nvngx.dll"
echo 'NVIDIA DLLs installed and verified. Follow the included README for Steam launch options.'