Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions d3d12/scripts/play-nvidia.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,17 @@ 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.
# 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 $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')
$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') {
Expand Down
36 changes: 36 additions & 0 deletions tests/test_play_nvidia_menu_choice.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,42 @@ 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_")}
env.update(TEST_SCRIPT=str(script), TEST_EXE=str(exe), TEST_DLSS_DIR=str(root))
command = [
"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 -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, 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()
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)."""
Expand Down
Loading