launcher, play scripts: review fixes of #3272 (card mask kept out of the F1 file, -Adapter for auto FG, Linux cache and binds, clear-cache race, unreadable binds kept)

merzleckeier's reviews at 02:35, 02:47 and 02:58 and DeadlyChirp's 02:46 note:
1. The AMD/Intel card filter named NoDlss, NoFrameGen and SmoothMotion in
   -Chosen, so a real PLAY rewrote leonida-settings.txt without the F1
   menu's DLSS, DLSS frame generation and Smooth Motion. The launcher now
   passes -CardMask (card_mask) instead; play-d3d12.ps1 hands it over and
   play-nvidia.ps1 leaves those settings out of this start only, keeping
   them in the menu file (and says so); the menu's FSR stays.
2. play-nvidia.ps1's automatic DLSS frame generation looked at every card:
   with -Adapter it now judges the cards whose name holds it (all when none
   does), so an AMD card chosen beside an RTX 4070 gets none; the card
   mask's NoFrameGen also keeps it off.
3. Clear shader cache on Linux looked under the Windows data folder: it now
   uses play-linux.sh's LEONIDA_CACHE_DIR or ${XDG_DATA_HOME:-~/.local/share}
   /leonida/cache.
4. After the confirmation, clear_cache asks game_running() again, not only
   its own process.
5. Linux PLAY passes the extra variables (the Controls page's binds, the
   advanced options, Advanced winning) in play-linux.sh's environment
   (`env NAME=value sh play-linux.sh ...`); none were passed before.
6. The Controls page keeps entries it cannot read beside its rows
   (split_kbm_binds) and writes them back after them: adding a row no longer
   drops a saved list with an unknown entry. Its note called t() with a
   `text=` value, which crashed the page as soon as it showed one: the
   placeholder is {entries} now, in de/es/fr/pt too.

Tests: test_card_mask_leaves_the_menus_nvidia_values_out_and_in_the_file
(dry runs, a real start with Start-Process stubbed keeping the menu file,
AMD + RTX 4070 with -Adapter each way and with the mask); card_mask and
-CardMask in play_command; LinuxPlayTests; SplitBindsTests with a guard
that no t() call passes text=. Launcher suite OK (1 skip), win launchers
12 OK, docs links, line endings, check_no_game_data. Counter-tests: the
mask ignored, the adapter filter off, the Linux env/cache, split and
card_mask reverted each fail their tests; the guard regex matches the old
source. Real window (isolated APPDATA): the game started during the
confirmation leaves the cache and says close the game first; adding H to
`both:G=Square;vehicle:N=FutureAction` saves G, H and the unknown entry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
OreoFR
2026-12-03 04:15:54 +01:00
parent f9b9f7c624
commit f1e9718e95
10 changed files with 225 additions and 64 deletions

View File

@ -81,6 +81,10 @@ param(
# Launcher.bat: the switches of this start whose value changed since its last PLAY, comma-separated (`none`).
# Only those count as typed for the F1 menu: the launcher passes every option at every start.
[string]$Chosen,
# Launcher.bat: the switches this card cannot run (an AMD or Intel card: NoDlss, NoFrameGen, SmoothMotion),
# comma-separated. play-nvidia.ps1 leaves the F1 menu's values for them out of this start only and keeps them in
# its file, for a later start on an NVIDIA card.
[string]$CardMask,
[switch]$PrecompileUsed
)
@ -131,6 +135,11 @@ $typedHere = if ($PSBoundParameters.ContainsKey('Chosen')) {
$launch.Typed = @($typedHere | ForEach-Object {
switch ($_) { 'SeriesS' { 'SeriesX' } 'SmoothMotion' { 'NoSmoothMotion' } default { $_ } }
})
if ($CardMask) {
$launch.CardMask = @($CardMask -split ',' | ForEach-Object { $_.Trim() } | Where-Object { $_ } | ForEach-Object {
switch ($_) { 'SmoothMotion' { 'NoSmoothMotion' } default { $_ } }
})
}
# A called script sets the global exit status. Start fresh for checks that return before launch.
$global:LASTEXITCODE = 0
& (Join-Path $runtime "scripts\play-nvidia.ps1") @launch