From c0e16af8563826865526eb034c7ca9376325bbf1 Mon Sep 17 00:00:00 2001 From: merzleckeier <362449027+merzleckeier@users.noreply.github.com> Date: Sun, 29 Nov 2026 20:11:32 +0100 Subject: [PATCH] Preserve motion blur when restarting from the settings menu D3D12-MOTION-BLUR-RESTART. AI-assisted with OpenAI Codex (GPT-6). --- d3d12/scripts/play-nvidia.ps1 | 2 +- tests/test_win_launchers.py | 50 ++++++++++++++++++++++++++++++++++- 2 files changed, 50 insertions(+), 2 deletions(-) diff --git a/d3d12/scripts/play-nvidia.ps1 b/d3d12/scripts/play-nvidia.ps1 index 643f7ea2c1..6bdeca4d16 100644 --- a/d3d12/scripts/play-nvidia.ps1 +++ b/d3d12/scripts/play-nvidia.ps1 @@ -525,7 +525,7 @@ $settings.LEONIDA_MENU_CONSOLE = $console $settings.LEONIDA_MENU_FILE = $menuFile $settings.LEONIDA_MENU_PLAY = $MyInvocation.MyCommand.Path $again = @("-Exe '$($Exe -replace "'", "''")'", "-Build $Build") -foreach ($s in 'NoSmoothMotion', 'NoDlss', 'SeriesX', 'Quality', 'RayTracing', 'FsrFrameGen', 'NoPrecompile', 'Log', 'Capture') { +foreach ($s in 'NoSmoothMotion', 'MotionBlur', 'NoDlss', 'SeriesX', 'Quality', 'RayTracing', 'FsrFrameGen', 'NoPrecompile', 'Log', 'Capture') { if ($PSBoundParameters[$s]) { $again += "-$s" } } foreach ($s in 'Resolution', 'Lowest', 'Dlss', 'FrameGen', 'Aspect', 'PresentScale', 'Adapter', 'DlssDir', 'StreamlineDir', 'FidelityFxDir') { diff --git a/tests/test_win_launchers.py b/tests/test_win_launchers.py index 6be7776634..6dd78303dd 100644 --- a/tests/test_win_launchers.py +++ b/tests/test_win_launchers.py @@ -1,4 +1,4 @@ -"""Tests for Build.bat and Mods.bat quoted per-user Python lookup and non-interactive pause control. +"""Tests for the Windows launchers. python -I tests/test_win_launchers.py """ @@ -14,6 +14,8 @@ ROOT = Path(__file__).resolve().parents[1] BUILD_BAT = ROOT / "Build.bat" MODS_BAT = ROOT / "Mods.bat" +NVIDIA_LAUNCHER = ROOT / "d3d12" / "scripts" / "play-nvidia.ps1" +POWERSHELL = shutil.which("pwsh") or shutil.which("powershell.exe") FAKE_PY_CS = r""" using System; @@ -37,6 +39,52 @@ class WinLaunchersTests(unittest.TestCase): + @unittest.skipUnless(POWERSHELL, "requires PowerShell") + def test_nvidia_menu_restart_preserves_motion_blur_switch(self) -> None: + with tempfile.TemporaryDirectory() as td: + root = Path(td) + scripts = root / "scripts" + scripts.mkdir() + launcher = scripts / NVIDIA_LAUNCHER.name + shutil.copyfile(NVIDIA_LAUNCHER, launcher) + executable = root / "synthetic title.exe" + executable.touch() + + command = r""" +$ErrorActionPreference = 'Stop' +function Get-CimInstance { + param([string]$ClassName) + if ($ClassName -ne 'Win32_OperatingSystem') { throw "Unexpected CIM query: $ClassName" } + [pscustomobject]@{ BuildNumber = '26100' } +} +$options = @{ + Exe = $env:TEST_NVIDIA_EXE + DryRun = $true + NoDlss = $true + NoPrecompile = $true + WindowsBarMB = 0 +} +& $env:TEST_NVIDIA_LAUNCHER @options -MotionBlur +& $env:TEST_NVIDIA_LAUNCHER @options -MotionBlur:$false +& $env:TEST_NVIDIA_LAUNCHER @options +""" + env = {name: value for name, value in os.environ.items() if not name.upper().startswith("LEONIDA_")} + env.update(TEST_NVIDIA_LAUNCHER=str(launcher), TEST_NVIDIA_EXE=str(executable)) + result = subprocess.run( + [POWERSHELL, "-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-Command", command], + env=env, + check=True, + capture_output=True, + encoding="utf-8", + errors="replace", + timeout=30, + ) + restart_args = [line for line in result.stdout.splitlines() if line.startswith("LEONIDA_MENU_ARGS=")] + self.assertEqual(len(restart_args), 3, result.stdout) + self.assertRegex(restart_args[0], r"(?:^| )-MotionBlur(?: |$)") + for args in restart_args[1:]: + self.assertNotRegex(args, r"(?:^| )-MotionBlur(?: |$)") + def test_static_quoting_and_no_pause_guards(self) -> None: build_txt = BUILD_BAT.read_text(encoding="utf-8") mods_txt = MODS_BAT.read_text(encoding="utf-8")