Launcher: only options changed since the last PLAY win over the F1 menu (LAUNCHER-CHOSEN-SWITCHES) #3061
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!3061
Loading…
Reference in a new issue
No description provided.
Delete branch "launcher-typed-changed"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Pull request successfully merged and closed
Claimed in the coordination issue as: LAUNCHER-CHOSEN-SWITCHES (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7338303972)
Fixes #2953
Fixes #2987
What and why
Launcher.bat(tools/leonida_launcher.py) passes every option at every start (-Dlss,-FrameGen,-SmoothMotion,-SeriesS,-Resolution...). Under D3D12-MENU-LAST-CHOICE-WINS (cf15c2c6e) each of them counts as typed, so it wins over the F1 menu's value and the menu file drops that value: a DLSS mode, frame generation or Smooth Motion picked in F1 is replaced by the launcher's at the next PLAY, though nothing was changed in the launcher.This keeps that rule and fixes what the launcher reports as typed:
launcher.json,last_switches, written once the game started) and passes-Chosenwith those whose value changed since (nonefor none).scripts/play-d3d12.ps1 -Chosen: only those count as typed (-Typedto play-nvidia.ps1). A start by hand, without-Chosen, counts its typed switches as before.-NoDlssdropped) is chosen too, so its default beats the menu's value; unchanged options leave the menu's values standing.Tested
python -m unittest tests.test_leonida_launcher tests.test_win_launchers: OK, with two new tests (test_only_switches_changed_since_the_last_play_are_chosen: first PLAY, same options, changed / added / removed switch, corrupt record;test_play_command_names_the_chosen_switches). Both fail onmain(nochosen_switches, no-Chosen).python -m unittest tests.test_play_nvidia_menu_choice: OK (the play-nvidia.ps1 contract is unchanged).scripts/play-d3d12.ps1 -DryRun -SeriesS -FrameGen 4against a menu file withLEONIDA_FRAME_GEN=2(MEASURED):-Chosen none: the menu's 2 stands;-Chosen FrameGen: "LEONIDA_FRAME_GEN 2 -> 4 (-FrameGen)"; without-Chosen(by hand): 2 -> 4 as onmain.python -I scripts/check_no_game_data.pyon the changed files: clean.GPUs tested: n/a (launcher and script logic; dry runs only)
AI-assisted: yes (implementation: Claude Opus 5.5 via Claude Code; separate read-only reviewer agent: Claude Opus, whose two notes are addressed: the record is written only once the game started, and the first-PLAY behaviour is stated above)
Checklist
mainand merges cleanly.docs/design.md(n/a: no translator change).🤖 Generated with Claude Code
VERIFY-3061 — Linux, Fedora 45, CPython 3.15.2, no Tkinter, no pwsh (PowerShell), no GPU device, no game files
Verdict: PASS with caveats. The change implements what it says and the two new tests are genuine (they fail on the base with exactly the missing feature and pass with the pull request); the red/green verdict is
red then green. The caveats are a real over-reporting edge case inchosen_switches(turning DLSS off after it was on with a mode reports bothDlssandNoDlssas chosen, so the F1 menu drops settings the launcher did not touch —tools/leonida_launcher.py:193, effect viascripts/play-d3d12.ps1:126-131andd3d12/scripts/play-nvidia.ps1:563-564), a description/code wording mismatch ("written once the game started" vs. written when the launch process spawns,tools/leonida_launcher.py:618-619), and the whole.ps1/menu path being unverifiable here (no PowerShell).head
246528624c6a79c71b293232721c0de3317a5d1c("Launcher: the last PLAY's switches are kept only once the game started"), base (GitHubbase.sha) = merge base =229d352ee38a49f3f743ead80857bc48dd18d176(the merge of #3058).origin/mainhas since advanced toa917c54dand already contains229d352e, so the pull request now sits directly onmain; the diff against it is unchanged. Two commits (bc1393ef,24652862), three files, +72/−5:tools/leonida_launcher.py(+40/−3),scripts/play-d3d12.ps1(+9/−2),tests/test_leonida_launcher.py(+23/−0). No comments, no reviews on the pull request.1. What it changes
Launcher.bat(tools/leonida_launcher.py) passes every option at every start (-Dlss,-FrameGen,-SmoothMotion,-SeriesS,-Resolution…). UnderD3D12-MENU-LAST-CHOICE-WINS(cf15c2c6e) each counts as typed, so it wins over the F1 menu's saved value and the menu file drops that value — a DLSS mode, frame generation or Smooth Motion picked in F1 is replaced by the launcher's at the next PLAY even though nothing changed in the launcher. The pull request keeps that rule and fixes what the launcher reports as typed:switch_argsof its last PLAY inlauncher.jsonaslast_switches(tools/leonida_launcher.py:63), written after the launch (see below), and passes-Chosentoscripts/play-d3d12.ps1with only the switches whose value changed since (nonefor none):chosen_switches(:182-193) andplay_command(:204-211), called from the Play button (:611).scripts/play-d3d12.ps1takes[string]$Chosen(:83) and, when it is present, builds$launch.Typedfrom it instead of from all bound parameters (:125-131); only those count as typed for the F1 menu. A start by hand (no-Chosen) counts its own switches as before.2. The claims, checked one by one
play-d3d12.ps1set$launch.Typed = @($PSBoundParameters.Keys | …), i.e. every switch the launcher passed.cf15c2c6eand the$switchSettings/$chosenNowlogic inplay-nvidia.ps1:542-591are the "typed wins" rule. Checked by reading the old and newplay-d3d12.ps1.last_switches, written once the game started)" — the record exists (:63, written at:618-619, saved viasave_settings). The "once the game started" wording is not what the code does: the record is written right afterself.run(...)returns, i.e. as soon as thepowershelllaunch process spawns (:618), not when the game itself starts. The comment at:616-617says "only once it started" — the code's "it" is the launch process. So a launch that spawnspowershellbut then fails (a build error, a bad path, the title crashing at startup) still records the switches. In practice this is benign: if nothing is changed before the next PLAY, nothing is chosen and the untouched menu file's values stand, which is what a failed start should leave. But the description overstates the code.-Chosenwith those whose value changed since (nonefor none)" —play_commandadds["-Chosen", ",".join(chosen) or "none"](:208-209);chosen_switchescomparesswitch_valuesof the currentargsand the parsedlast(:193). Verified by the new testtest_play_command_names_the_chosen_switches(the command carries-Chosen FrameGen,-Chosen none, and no-ChosenwhenchosenisNone).scripts/play-d3d12.ps1 -Chosen: only those count as typed (-Typedto play-nvidia.ps1)" —:126-131: when-Chosenis bound,$typedHereis the parsed list, and$launch.TypedmapsSeriesS→SeriesX,SmoothMotion→NoSmoothMotion, the rest unchanged. Verified by reading the script.-Chosen, counts its typed switches as before" —$typedHere = @($PSBoundParameters.Keys)when-Chosenis absent (:126-128), the pre-change behaviour. Verified by reading; backward compatible.chosen_switchesreturns a switch present in either side whose value differs, so a switch that disappears (turned off) is chosen. Verified bytest_only_switches_changed_since_the_last_play_are_chosen(changed value, turned on, turned off).chosen_switches(args, "")returns[](an emptylastyields no record) and a corrupt record ("not json") also returns[](:185-191). Verified by the test.play-d3d12.ps1 -DryRunnumbers in "Tested" — not re-checked: that needs PowerShell (nopwshhere) and I have no Windows box.main(nochosen_switches, no-Chosen)" — confirmed on the red side (see §3): the failures areAttributeError: module 'leonida_launcher' has no attribute 'chosen_switches'andTypeError: play_command() got an unexpected keyword argument 'chosen'.3. What the tests do here
python3 -I scripts/red_green.py pr3061 --base 229d352e --no-fetch --work-dir /home/shangli/oc-workspace/gta6/rg-3061 --no-cargo(the pull request is stacked, so the base is its GitHub base229d352e, and I passed the local ref because--no-fetch):tests/test_leonida_launcher.py229d352e+ only the PR's test hunks)test_only_switches_changed_since_the_last_play_are_chosen(AttributeError: no attribute 'chosen_switches'),test_play_command_names_the_chosen_switches(TypeError: play_command() got an unexpected keyword argument 'chosen'); 16 pass24652862, the pull request head)Verdict:
red then green— exactly the two new tests go red→green, 0 regressions, 16 pass on both sides. The red side's failures are the missing feature, not a skip or a no-op.The pull request changes no Rust crate and no other Python test file, so the verifier ran only this file. On the head, the full launcher suite is 18/18;
test_win_launchers.py(5 tests, 4 skipped) andtest_play_nvidia_menu_choice.py(16 tests, all skipped) skip on Linux for lack ofpwsh— the author'spython -m unittest tests.test_play_nvidia_menu_choice: OKwas on Windows.python3 -I -m unittest discover -s tests -p "test_docs_*.py" -v: 57/57 OK.python3 -I scripts/check_no_game_data.py tools/leonida_launcher.py scripts/play-d3d12.ps1 tests/test_leonida_launcher.py: exit 0.4. Anything wrong, with file and line
chosen_switches(tools/leonida_launcher.py:193) takes the union of the current and previous switch names, andswitch_argsuses different names for the same setting's on/off states (-Dlss <mode>vs-NoDlss,tools/leonida_launcher.py:143-147). So going from-Dlss performanceto-NoDlssreturns["Dlss", "NoDlss"](and the reverse too) — I verified this directly:chosen_switches(["-NoDlss"], '["-Dlss","performance"]')→["Dlss","NoDlss"]. Inplay-d3d12.ps1:129-131both pass through to$launch.Typed, and inplay-nvidia.ps1the$switchSettingsentry forDlss(:563) is a superset of the one forNoDlss(:564):DlssnamesLEONIDA_RENDER_SCALE,LEONIDA_RENDER_SCALE_MIN,LEONIDA_OWN_UPSCALER,LEONIDA_FSR_UPSCALER,LEONIDA_OUTPUTin addition toLEONIDA_UPSCALE. So when the launcher turns DLSS off it only passed-NoDlss, yet the menu drops those five settings too, and they fall to the script's defaults. This is a residual of the very bug the pull request fixes, narrow to the on↔off transition (a repeated off state comparesNoDlsstoNoDlssand is fine), and it only over-reaches, never under-reaches — but it contradicts "only options changed since the last PLAY win". The fix would be to map-Dlss/-NoDlss(and the other paired names) to one canonical setting name before comparing, the wayplay-d3d12.ps1:129-131already mapsSeriesS→SeriesXandSmoothMotion→NoSmoothMotion(those two pairs happen to collapse to one setting each, so they do not over-report). I could not confirm the final runtime effect (no PowerShell, no game); what I did confirm is that the chosen set includes both names.tools/leonida_launcher.py:618-619). Benign as analysed in §2, but the description does not match the code.Depends on: #Nin the pull request body, although the pull request was opened with base229d352e(the merge of #3058) —CONTRIBUTING.mdasks forDepends on:on every pull request built on another. Sincemainnow contains229d352ethis is moot, but it was a stacked PR.test_only_switches_changed_since_the_last_play_are_chosencovers a changed value, a switch turned on and a switch turned off, but only forFrameGen,LogandSmoothMotion, none of which use a paired on/off name except SmoothMotion (whose off state has no switch of its own). TheDlss/NoDlssandSeriesS/SeriesXpairs are not tested; the latter is harmless (both map toSeriesX), the former is the over-reporting above.5. What I did not check
pwsh): I could not runscripts/play-d3d12.ps1ord3d12/scripts/play-nvidia.ps1, so I could not re-run the author's end-to-end-DryRunclaim, nor confirm that a-Chosenlist maps through$launch.Typedto the menu exactly as read.test_win_launchers.pyandtest_play_nvidia_menu_choice.py(the latter is the direct test of the menu logic this interacts with) both skip here.leonida-settings.txtlive in the title; I could not check that a chosen switch really wins over the menu's saved value in a running game, nor that dropping a setting from the menu file changes the runtime outcome. The DLSS over-reporting consequence in §4 is exactly such a thing.play-d3d12.ps1is a Windows script; I only read it.last_switchespersistence across launcher restarts with a reallauncher.json, and the record-on-failed-start behaviour need Tkinter and a display; none here.#3056,#3058) and the Rust crates — not run; the change is confined to the launcher.Merging. Head
246528624merges cleanly withmain83046a713and does not force a rebase of #2566. Third-party verification by MoonEyes' agent (https://github.com/ProjectLeonida/mandy/pull/3061#issuecomment-7340916664): targeted test red before the fix and green after, on head 246528624c6a79c71b293232721c0de3317a5d1c; CI green including no-game-data; no open review or question. AI-assisted (Claude Code). Merged by MoonEyes.AI-assisted (Claude Code).