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.
32 lines
1.8 KiB
Bash
Executable File
32 lines
1.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# Builds build/d4r_nvngx.dll, the D3D12/Vulkan-to-CUDA NGX core shim loaded by
|
|
# OptiScaler through its NvngxPath setting.
|
|
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
MINGW_CXX="${MINGW_CXX:-x86_64-w64-mingw32-g++}"
|
|
CLANG_CL="${CLANG_CL:-clang-cl}"
|
|
|
|
VULKAN_INCLUDE="${VULKAN_INCLUDE:-/usr/include}"
|
|
|
|
mkdir -p "$ROOT/build"
|
|
# Native configuration helper, launched automatically by InitializeASI.
|
|
"$MINGW_CXX" -std=c++20 -O2 -Wall -Wextra -Werror -static -municode \
|
|
"$ROOT/tools/d4r_asi_setup.cpp" -o "$ROOT/build/d4r-setup.exe"
|
|
bash "$ROOT/scripts/build_vulkan_staging.sh"
|
|
# Only the Vulkan headers from the host include tree, not its libc headers.
|
|
mkdir -p "$ROOT/build/vulkan-include"
|
|
ln -sfn "$VULKAN_INCLUDE/vulkan" "$ROOT/build/vulkan-include/vulkan"
|
|
ln -sfn "$VULKAN_INCLUDE/vk_video" "$ROOT/build/vulkan-include/vk_video"
|
|
PARAM_OBJECT="$ROOT/build/d4r_ngx_param_msvc.obj"
|
|
"$CLANG_CL" --target=x86_64-pc-windows-msvc /nologo /std:c++20 /O2 /c /GS- /GR- /EHs-c- /Zl \
|
|
"/Fo$PARAM_OBJECT" -- "$ROOT/tools/d4r_ngx_param_msvc.cpp"
|
|
# The engine (D4R_ENGINE) reaches Vulkan through a function table: MinGW has no Vulkan import library.
|
|
"$MINGW_CXX" -std=c++20 -O2 -Wall -Wextra -Wno-missing-field-initializers -DD4R_ENGINE_VK_TABLE -I"$ROOT/build/vulkan-include" -I"$ROOT/build/vulkan-staging" -shared -static -static-libgcc -static-libstdc++ \
|
|
"$ROOT/tools/d4r_nvngx_shim.cpp" "$ROOT/tools/d4r_ngx_param_host.cpp" "$PARAM_OBJECT" \
|
|
"$ROOT/engine/runtime.cpp" "$ROOT/engine/game.cpp" "$ROOT/engine/game_m.cpp" "$ROOT/engine/game_rr.cpp" "$ROOT/engine/vk_dispatch.cpp" \
|
|
-Wl,--entry,d4r_dll_entry -o "$ROOT/build/d4r_nvngx.dll"
|
|
printf 'Built %s\n' "$ROOT/build/d4r_nvngx.dll"
|
|
cp "$ROOT/build/d4r_nvngx.dll" "$ROOT/build/d4r.asi"
|
|
printf 'Built %s\n' "$ROOT/build/d4r.asi"
|