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

+19
View File
@@ -0,0 +1,19 @@
#pragma once
#include <cwctype>
#include <string>
// GE-Proton redirects DXGI in background utilities too. They share the ASI
// directory with the game but must never install files or show setup dialogs.
inline bool d4r_asi_game_process(std::wstring executable)
{
for (auto& c : executable) { c = std::towlower(c); if (c == L'/') c = L'\\'; }
const auto slash = executable.find_last_of(L'\\');
const std::wstring name = executable.substr(slash == std::wstring::npos ? 0 : slash + 1);
for (const wchar_t* utility : {L"xalia.exe", L"steam.exe", L"d4r-setup.exe", L"start_protected_game.exe",
L"crashreportclient.exe", L"unrealcefsubprocess.exe", L"unitycrashhandler64.exe",
L"unitycrashhandler32.exe", L"winedevice.exe", L"services.exe", L"explorer.exe",
L"rundll32.exe", L"conhost.exe", L"wineboot.exe", L"wineserver.exe"})
if (name == utility) return false;
return executable.find(L"\\windows\\system32\\") == std::wstring::npos &&
executable.find(L"\\windows\\syswow64\\") == std::wstring::npos;
}