From ebb9ecb9836378176b9b6699ffcccfd65b55772a Mon Sep 17 00:00:00 2001 From: ubiquitarianism <283527159+ubiquitarianism@users.noreply.github.com> Date: Tue, 1 Dec 2026 13:30:30 -0500 Subject: [PATCH 1/2] d3d12: honor saved DLSS at stock Series S resolution --- d3d12/scripts/play-nvidia.ps1 | 10 ++++++++ tests/test_play_nvidia_menu_choice.py | 34 +++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/d3d12/scripts/play-nvidia.ps1 b/d3d12/scripts/play-nvidia.ps1 index dfa371e08c..ee9f679636 100644 --- a/d3d12/scripts/play-nvidia.ps1 +++ b/d3d12/scripts/play-nvidia.ps1 @@ -615,6 +615,16 @@ foreach ($k in $More.Keys) { $settings[$k] = $More[$k] } if ($settings.LEONIDA_UPSCALE -eq 'dlss' -and -not $dlssCan) { if ($console -eq 'series-x') { $settings.Remove('LEONIDA_UPSCALE') } else { $settings.LEONIDA_UPSCALE = 'stretch' } } +# A saved DLSS choice can replace the game upscaler implied by a fixed resolution on Series S. +# Use the stock 720p-to-1080p path, which needs neither the explicit scale nor its FidelityFX size patch. +if ($console -eq 'series-s' -and $menu['LEONIDA_UPSCALE'] -eq 'dlss' -and $settings.LEONIDA_UPSCALE -eq 'dlss' -and + $settings.LEONIDA_OWN_UPSCALER -eq '1' -and $settings.LEONIDA_RENDER_SCALE -eq $dlssScale.quality -and + -not $settings.LEONIDA_RENDER_SCALE_MIN -and + (-not $settings.LEONIDA_OUTPUT -or $settings.LEONIDA_OUTPUT -eq '1920x1080') -and + -not $menu.Contains('LEONIDA_OWN_UPSCALER') -and -not $More.ContainsKey('LEONIDA_OWN_UPSCALER')) { + $settings.Remove('LEONIDA_OWN_UPSCALER') + $settings.Remove('LEONIDA_RENDER_SCALE') +} # DLSS frame generation and real ray tracing do not work together yet (0.1 frames a second): with ray tracing # on, frame generation is left off and Smooth Motion can do the extra frames. if ($settings.LEONIDA_BVH_BUILDER -eq '1' -and $settings.LEONIDA_FRAME_GEN -and $settings.LEONIDA_FG_WITH_RT -ne '1') { diff --git a/tests/test_play_nvidia_menu_choice.py b/tests/test_play_nvidia_menu_choice.py index 128608acec..9faeb69294 100644 --- a/tests/test_play_nvidia_menu_choice.py +++ b/tests/test_play_nvidia_menu_choice.py @@ -184,6 +184,40 @@ def test_a_typed_frame_generation_replaces_the_menus_other_one(self): @unittest.skipUnless(os.name == "nt", "Windows PowerShell launcher") class MenuRestartArgsTests(unittest.TestCase): + def test_series_s_saved_dlss_replaces_the_upscaler_implied_by_resolution(self): + with tempfile.TemporaryDirectory() as tmp: + root = Path(tmp) + scripts = root / "scripts" + scripts.mkdir() + script = scripts / SCRIPT.name + script.write_bytes(SCRIPT.read_bytes()) + exe = root / "placeholder.exe" + exe.touch() + (root / "nvngx_dlss.dll").touch() + menu = root / "leonida-settings.txt" + env = {k: v for k, v in os.environ.items() if not k.startswith("LEONIDA_")} + command = [ + "powershell.exe", "-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-File", str(script), + "-Exe", str(exe), "-DlssDir", str(root), "-NoFrameGen", "-DryRun", + ] + cases = ( + ("dlss", ["-Resolution", "720"], "0.6667", None, "1"), + ("dlss", ["-Resolution", "720", "-MenuRestart"], None, "dlss", None), + ("dlss", ["-Resolution", "540", "-MenuRestart"], "0.5", "dlss", "1"), + ("dlss\nLEONIDA_OWN_UPSCALER=1", ["-Resolution", "720", "-MenuRestart"], "0.6667", "dlss", "1"), + ) + for saved, args, scale, upscaler, own in cases: + with self.subTest(saved=saved, args=args): + menu.write_text(f"LEONIDA_UPSCALE={saved}\n", encoding="utf-8") + res = subprocess.run(command + args, env=env, capture_output=True, text=True, encoding="utf-8", + errors="replace", timeout=60) + self.assertEqual(res.returncode, 0, res.stderr) + settings = dict(line.split("=", 1) for line in res.stdout.splitlines() + if line.startswith("LEONIDA_") and "=" in line) + self.assertEqual(settings.get("LEONIDA_RENDER_SCALE"), scale) + self.assertEqual(settings.get("LEONIDA_UPSCALE"), upscaler) + self.assertEqual(settings.get("LEONIDA_OWN_UPSCALER"), own) + def test_the_restart_replays_every_frame_generation_switch(self): """The menu's SAVE AND RESTART starts the launcher again with LEONIDA_MENU_ARGS: a switch left out of it is lost on that start (-NoFrameGen was, and the restart turned frame generation on).""" From 0b1f6b5887456102aa610e4eb0de55cb244652bf Mon Sep 17 00:00:00 2001 From: ubiquitarianism <283527159+ubiquitarianism@users.noreply.github.com> Date: Tue, 1 Dec 2026 13:47:17 -0500 Subject: [PATCH 2/2] d3d12: preserve explicit render scale on F1 restart --- d3d12/scripts/play-nvidia.ps1 | 3 ++- tests/test_play_nvidia_menu_choice.py | 16 +++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/d3d12/scripts/play-nvidia.ps1 b/d3d12/scripts/play-nvidia.ps1 index ee9f679636..26862777f5 100644 --- a/d3d12/scripts/play-nvidia.ps1 +++ b/d3d12/scripts/play-nvidia.ps1 @@ -617,9 +617,10 @@ if ($settings.LEONIDA_UPSCALE -eq 'dlss' -and -not $dlssCan) { } # A saved DLSS choice can replace the game upscaler implied by a fixed resolution on Series S. # Use the stock 720p-to-1080p path, which needs neither the explicit scale nor its FidelityFX size patch. +# Leave an explicitly overridden scale alone, even when it equals the stock ratio. if ($console -eq 'series-s' -and $menu['LEONIDA_UPSCALE'] -eq 'dlss' -and $settings.LEONIDA_UPSCALE -eq 'dlss' -and $settings.LEONIDA_OWN_UPSCALER -eq '1' -and $settings.LEONIDA_RENDER_SCALE -eq $dlssScale.quality -and - -not $settings.LEONIDA_RENDER_SCALE_MIN -and + -not $settings.LEONIDA_RENDER_SCALE_MIN -and -not $More.ContainsKey('LEONIDA_RENDER_SCALE') -and (-not $settings.LEONIDA_OUTPUT -or $settings.LEONIDA_OUTPUT -eq '1920x1080') -and -not $menu.Contains('LEONIDA_OWN_UPSCALER') -and -not $More.ContainsKey('LEONIDA_OWN_UPSCALER')) { $settings.Remove('LEONIDA_OWN_UPSCALER') diff --git a/tests/test_play_nvidia_menu_choice.py b/tests/test_play_nvidia_menu_choice.py index 9faeb69294..ef07200d5a 100644 --- a/tests/test_play_nvidia_menu_choice.py +++ b/tests/test_play_nvidia_menu_choice.py @@ -196,20 +196,22 @@ def test_series_s_saved_dlss_replaces_the_upscaler_implied_by_resolution(self): (root / "nvngx_dlss.dll").touch() menu = root / "leonida-settings.txt" env = {k: v for k, v in os.environ.items() if not k.startswith("LEONIDA_")} + env.update(TEST_SCRIPT=str(script), TEST_EXE=str(exe), TEST_DLSS_DIR=str(root)) command = [ - "powershell.exe", "-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-File", str(script), - "-Exe", str(exe), "-DlssDir", str(root), "-NoFrameGen", "-DryRun", + "powershell.exe", "-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-Command", ] + launch = "& $env:TEST_SCRIPT -Exe $env:TEST_EXE -DlssDir $env:TEST_DLSS_DIR -NoFrameGen -DryRun" cases = ( - ("dlss", ["-Resolution", "720"], "0.6667", None, "1"), - ("dlss", ["-Resolution", "720", "-MenuRestart"], None, "dlss", None), - ("dlss", ["-Resolution", "540", "-MenuRestart"], "0.5", "dlss", "1"), - ("dlss\nLEONIDA_OWN_UPSCALER=1", ["-Resolution", "720", "-MenuRestart"], "0.6667", "dlss", "1"), + ("dlss", "-Resolution 720", "0.6667", None, "1"), + ("dlss", "-Resolution 720 -MenuRestart", None, "dlss", None), + ("dlss", "-Resolution 540 -MenuRestart", "0.5", "dlss", "1"), + ("dlss\nLEONIDA_OWN_UPSCALER=1", "-Resolution 720 -MenuRestart", "0.6667", "dlss", "1"), + ("dlss", "-Resolution 720 -MenuRestart -More @{LEONIDA_RENDER_SCALE='0.6667'}", "0.6667", "dlss", "1"), ) for saved, args, scale, upscaler, own in cases: with self.subTest(saved=saved, args=args): menu.write_text(f"LEONIDA_UPSCALE={saved}\n", encoding="utf-8") - res = subprocess.run(command + args, env=env, capture_output=True, text=True, encoding="utf-8", + res = subprocess.run([*command, f"{launch} {args}"], env=env, capture_output=True, text=True, encoding="utf-8", errors="replace", timeout=60) self.assertEqual(res.returncode, 0, res.stderr) settings = dict(line.split("=", 1) for line in res.stdout.splitlines()