mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-06 04:55:44 +00:00
upscale: DLSS signature fix on by default
DLSS games only work with the nvapi64.dll hooks that let NGX accept the bridge DLLs (without them the DLSS sample stops at GetFeatureRequirements with PlatformError; with them it runs Full FSR 4.1 on the NPU in D3D11 and D3D12, Red Magic 12 Pro). DLSS mode now has the fix on unless the player switches it off: the app stores "1" or "0" for DLSS games and reads a missing entry as on, and droiddeck-game-env passes 1 unless the game stores 0. Upstream always installs the hooks.
This commit is contained in:
1 parent
d83c18417d
commit
d47ed325fd
5 files changed
+27
-7
No files matched your search
@@ -62,7 +62,7 @@ object GameUpscaler {
|
||||
val engine: Engine = DEFAULT_ENGINE,
|
||||
val sharpness: Int = DEFAULT_SHARPNESS,
|
||||
val npuSync: Boolean = false,
|
||||
val signatureFix: Boolean = false,
|
||||
val signatureFix: Boolean = true,
|
||||
)
|
||||
|
||||
fun choice(config: GameEnvironment.Config, scope: String): Choice? {
|
||||
@@ -74,7 +74,7 @@ object GameUpscaler {
|
||||
engine = Engine.byId(entries[ENGINE]) ?: DEFAULT_ENGINE,
|
||||
sharpness = entries[SHARPNESS]?.toIntOrNull()?.coerceIn(0, 100) ?: DEFAULT_SHARPNESS,
|
||||
npuSync = entries[NPU_SYNC] == "1",
|
||||
signatureFix = entries[SIGFIX] == "1",
|
||||
signatureFix = entries[SIGFIX] != "0",
|
||||
)
|
||||
}
|
||||
|
||||
@@ -83,7 +83,8 @@ object GameUpscaler {
|
||||
put(ENGINE, choice.engine.id)
|
||||
put(SHARPNESS, choice.sharpness.coerceIn(0, 100).toString())
|
||||
if (choice.npuSync) put(NPU_SYNC, "1")
|
||||
if (choice.signatureFix && choice.mode == Mode.DLSS) put(SIGFIX, "1")
|
||||
// DLSS games need NGX to accept the bridge DLLs; on unless the player switched it off (stored as "0").
|
||||
if (choice.mode == Mode.DLSS) put(SIGFIX, if (choice.signatureFix) "1" else "0")
|
||||
}
|
||||
|
||||
fun withChoice(config: GameEnvironment.Config, scope: String, choice: Choice?): GameEnvironment.Config {
|
||||
|
||||
@@ -49,6 +49,16 @@ class GameUpscalerTest {
|
||||
assertEquals(GameUpscaler.Engine.SGSR2, GameUpscaler.Engine.byId("sgsr2_gpu"))
|
||||
}
|
||||
|
||||
@Test fun dlssGamesHaveTheSignatureFixOnUnlessSwitchedOff() {
|
||||
val saved = GameEnvironment.Config().withEntries("7", mapOf(GameUpscaler.MODE to "dlss"))
|
||||
assertTrue(GameUpscaler.choice(saved, "7")!!.signatureFix)
|
||||
assertEquals("1", GameUpscaler.entries(GameUpscaler.Choice(GameUpscaler.Mode.DLSS))[GameUpscaler.SIGFIX])
|
||||
val off = GameUpscaler.entries(GameUpscaler.Choice(GameUpscaler.Mode.DLSS, signatureFix = false))
|
||||
assertEquals("0", off[GameUpscaler.SIGFIX])
|
||||
val reread = GameUpscaler.choice(GameEnvironment.Config().withEntries("7", off), "7")!!
|
||||
assertFalse(reread.signatureFix)
|
||||
}
|
||||
|
||||
@Test fun theControlFileUsesTheLayersKeys() {
|
||||
assertEquals("enabled=1\nbackend=fsr4_1_lite_gpu\nsharpness=0.55\nnpu_sync=0\n",
|
||||
GameUpscaler.controlText(GameUpscaler.Engine.FSR4_LITE_GPU, 55, npuSync = false, enabled = true))
|
||||
|
||||
@@ -1273,8 +1273,8 @@ def upscale_settings(env, prefix):
|
||||
result["DXVK_ENABLE_NVAPI"] = "1"
|
||||
result["WINE_HIDE_NVIDIA_GPU"] = "0"
|
||||
dxvk = 'dxgi.hideNvidiaGpu = False; dxgi.customVendorId = 10de; dxgi.customDeviceId = 1f08; dxgi.customDeviceDesc = "NVIDIA GeForce RTX 2060"'
|
||||
if env.get("DROIDDECK_UPSCALE_SIGFIX") == "1":
|
||||
result["DROIDDECK_UPSCALE_SIGFIX"] = "1"
|
||||
# NGX rejects the bridge DLLs without the signature fix; on unless this game switched it off ("0").
|
||||
result["DROIDDECK_UPSCALE_SIGFIX"] = "0" if env.get("DROIDDECK_UPSCALE_SIGFIX") == "0" else "1"
|
||||
try:
|
||||
if prefix and upscale_registry(prefix):
|
||||
notes.append("NVIDIA NGX registry entries added to the prefix (DLSS mode)")
|
||||
|
||||
@@ -101,6 +101,14 @@ class UpscalerSettingsTest(unittest.TestCase):
|
||||
self.assertEqual(b"MZ-xess", target.read_bytes())
|
||||
self.assertEqual(source.stat().st_ino, target.stat().st_ino)
|
||||
|
||||
def test_dlss_mode_turns_the_signature_fix_on_unless_switched_off(self):
|
||||
env, _ = MODULE["upscale_settings"]({"DROIDDECK_UPSCALE_MODE": "dlss"}, None)
|
||||
self.assertEqual("1", env["DROIDDECK_UPSCALE_SIGFIX"])
|
||||
env, _ = MODULE["upscale_settings"]({"DROIDDECK_UPSCALE_MODE": "dlss", "DROIDDECK_UPSCALE_SIGFIX": "0"}, None)
|
||||
self.assertEqual("0", env["DROIDDECK_UPSCALE_SIGFIX"])
|
||||
env, _ = MODULE["upscale_settings"]({"DROIDDECK_UPSCALE_MODE": "fsr"}, None)
|
||||
self.assertNotIn("DROIDDECK_UPSCALE_SIGFIX", env)
|
||||
|
||||
def test_a_game_started_on_xess_without_the_runtime_says_so(self):
|
||||
prefix = tempfile.mkdtemp()
|
||||
self.addCleanup(shutil.rmtree, prefix, True)
|
||||
|
||||
@@ -56,7 +56,7 @@ pack (`tools/packs/build.sh`), whose entries are `bridges/{x86_64,aarch64}-windo
|
||||
| --- | --- | --- |
|
||||
| `DROIDDECK_UPSCALE_BACKEND` (then `DROIDDECK_UPSCALE_ENGINE`, `WINLATOR_FSR4_BACKEND`, `WINLATOR_FSR4_ENGINE`) | `fsr4_1_full_npu` | Backend the bridges assume until the layer writes its live control word: `fsr3_gpu`, `xess3_gpu`, `sgsr2_gpu`, `fsr4_1_lite_npu`, `fsr4_1_full_npu`, `fsr4_1_lite_gpu`, `fsr4_1_full_gpu` (`fsr4_0_npu` = `fsr4_1_full_npu`) |
|
||||
| `DROIDDECK_UPSCALE_VRAM_MB` (then `WINLATOR_FSR4_VRAM_MB`, `WRAPPER_VMEM_MAX_SIZE`) | DXGI adapter 0, else 12 GB | VRAM `nvapi64.dll` reports (512-65536 MB) |
|
||||
| `DROIDDECK_UPSCALE_SIGFIX=1` | off | `nvapi64.dll` patches the import tables of loaded modules (LoadLibrary*, GetProcAddress, GetFileAttributes*, CreateFileW, Reg*), redirects `nvngx`/`_nvngx` loads to `C:\windows\system32\_nvngx.dll`, fakes the NVIDIA signature-override registry keys, forces `WinVerifyTrust` success and redirects `CryptQueryObject` for `nvngx`/`amd_fidelityfx*`, so games that signature-check NGX load the bridge. Never applied to rdr2.exe, playrdr2.exe or gta5.exe |
|
||||
| `DROIDDECK_UPSCALE_SIGFIX=1` | on in DLSS mode (`droiddeck-game-env` sets `1` unless the game stores `0`) | `nvapi64.dll` patches the import tables of loaded modules (LoadLibrary*, GetProcAddress, GetFileAttributes*, CreateFileW, Reg*), redirects `nvngx`/`_nvngx` loads to `C:\windows\system32\_nvngx.dll`, fakes the NVIDIA signature-override registry keys, forces `WinVerifyTrust` success and redirects `CryptQueryObject` for `nvngx`/`amd_fidelityfx*`, so games that signature-check NGX load the bridge. Never applied to rdr2.exe, playrdr2.exe or gta5.exe |
|
||||
| `DROIDDECK_UPSCALE_LOG=1` | off | Hook messages appended to `C:\windows\temp\wl_fsr4_bridge.log` |
|
||||
|
||||
## Changes from the fork
|
||||
@@ -64,7 +64,8 @@ pack (`tools/packs/build.sh`), whose entries are `bridges/{x86_64,aarch64}-windo
|
||||
- Until upstream r5, D3D11 NGX reported DLSS unavailable here (the fork returned success and rendered
|
||||
nothing). Since r5 the D3D11 entry points reach the Vulkan layer through DXVK's interop
|
||||
(`wl_dxvk_interop.h`), as upstream does.
|
||||
- The `nvapi64.dll` hooks are off unless `DROIDDECK_UPSCALE_SIGFIX=1`; the fork always installed them.
|
||||
- The `nvapi64.dll` hooks follow `DROIDDECK_UPSCALE_SIGFIX`, which DLSS games get as `1` unless switched off (the fork
|
||||
always installed them). Without them NGX rejects the bridges (DLSS sample: `GetFeatureRequirements` PlatformError).
|
||||
- Logging is off unless `DROIDDECK_UPSCALE_LOG=1`; the fork always wrote the log.
|
||||
- `DROIDDECK_UPSCALE_*` variables are read first, the fork's names after them (`dd_env.h`).
|
||||
- `fsr4_seam_proto.h` is included from this folder instead of `../fsr4npu/`.
|
||||
|
||||
Reference in new issue
Block a user