Claim ORG-SWITCHES-NO-CONFLICT (#3312).
Every pull request that adds a LEONIDA_* name regenerates d3d12/docs/switches.md,
and the page opened with "N names; M have a sentence of a comment", which each
addition changes, so two such pull requests conflicted on that line however far
apart their rows were. The "Only in tests" and "Only in comments" sections were
one comma-joined line each, the same trap.
The generator now writes no total (the sentence is replaced by a fixed one) and
lists the test-only and comment-only names one per line. An addition touches
only its own row. Two additions conflict only when they land in the same gap
between two existing rows. --check reads the new list form; a test asserts that
an added name adds exactly one line and that no "N names" line exists.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- AGENTS.md: agents never merge their own pull request, as CONTRIBUTING.md says; the cargo test command no longer
skips depth_bounds_pipeline_loads_and_filters_draws, which d3d12.yml runs and passes.
- The switches page said no CI job keeps it current; tests/test_d3d12_switches.py runs --check on it in the required
check job. Fixed in the generator and the page.
- docs/design.md carried "PAL stage descriptors" twice, byte for byte; the second copy is gone.
- port_status.md and port_plan.md describe the Vulkan base and victory/, which no longer exists: a banner says so and
points to d3d12/, and the index lists them under a historical heading instead of "Start here".
Claim: DOCS-STALE-AGENT-RULES (#3312)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
merzleckeier's review of 4b64ba9e4:
- Two Clear shader cache tests expected Windows' cache-2 while calling the
platform default, so they failed on Linux (CI's linux-python-and-viewer).
They pass windows=True now (clear_shader_cache takes `windows`).
- After an NVIDIA PLAY, choosing the AMD card made -Chosen name Adapter, Dlss,
FrameGen, NoDlss and SmoothMotion: -Chosen compared for_card's output with
last_switches, so the card filter looked like the player's edits and the
F1 merge dropped the saved DLSS, frame generation and Smooth Motion. Now
-Chosen compares the player's own switches (switch_args of the saved
settings, -Log for a diagnostic start) and last_switches keeps those too
(launch_snapshot, still taken with the queued command); the card's part
goes as -CardMask only.
- play-nvidia.ps1's LEONIDA_MENU_ARGS (the F1 menu's SAVE AND RESTART)
carries -CardMask, so a masked LEONIDA_FRAME_GEN=2 stays masked on the
restarted start.
- Clear shader cache clears a LEONIDA_CACHE_DIR typed in the Advanced
options, the cache PLAY uses on both systems, instead of the default.
Tests: test_a_new_card_is_no_change_of_the_players (NVIDIA PLAY then AMD:
-Chosen is Adapter only, -CardMask the three); the snapshot test now expects
the player's switches; test_an_advanced_cache_dir_is_the_one_cleared;
test_win_launchers runs the generated restart command (-CardMask in it,
LEONIDA_FRAME_GEN masked, the upscale the stretch). Launcher suite 139 OK on
Windows and 139 OK (2 skipped) under Linux (WSL Ubuntu, Python 3.12), where
the old tests fail on the two cache tests as in CI; test_win_launchers 12 OK.
Counter-tests: the old snapshot/chosen and no Advanced lookup fail 3 of 3;
no -CardMask in the restart arguments fails the restart case.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Conflicts: docs/launcher.md keeps the card-mask text with FSR 3's name;
tests/test_leonida_launcher.py keeps both sides' new classes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
- d3d12/scripts/get-amd-fidelityfx.ps1 (and Get-AMD-FidelityFX.cmd): AMD's
two signed DLLs FSR 3 frame generation needs, amd_fidelityfx_loader_dx12.dll
(39 184 bytes) and amd_fidelityfx_framegeneration_dx12.dll (29 679 376), from
FidelityFX SDK v2.4.0's Kits/FidelityFX/signedbin on AMD's GitHub (the SDK
whose structure versions fsr.rs speaks: frame generation 4.0.2, its DX12
swap chain 4.0.0) into amd-sdk\FidelityFX\bin, the folder play-nvidia.ps1
reads. Each is kept only with its pinned size and git blob hash and a valid
Authenticode signature of Advanced Micro Devices, both or neither; AMD's
licence (docs/license.md) is saved beside them. amd-sdk/ is git-ignored.
- Tools > Fetch AMD FidelityFX files, with a confirmation naming the size.
- needed_files(card): the DLSS fetch on an NVIDIA RTX card without NVIDIA's
files, the FidelityFX fetch on a card DLSS frame generation does not run on
(not an RTX 40 or 50, play-nvidia.ps1's own test) without AMD's DLLs; none
for an unread card or off Windows, none once the files are there. With the
new setting "Download the files my card needs" (on by default, Picture),
PLAY runs those fetches first in the Output panel, then the game, also when
one failed (the script starts without DLSS or FSR 3 then). Stop during a
fetch ends the start. card_facts now names the judged cards.
- Frame generation's mode reads "FSR 3"; with it chosen and AMD's DLLs
missing, a note says PLAY downloads them first, or where Tools does.
New texts in de/es/fr/pt; docs/launcher.md says it.
Tests: NeededFilesTests (every card kind with nothing there, nothing once
the files are, a half set fetched again, no card or off Windows, the RTX
40/50 test and the folder are the script's, the note, the setting, the
fetcher's pins and signature check and that its two names and fsr.rs's
versions agree; a real run of the fetcher on files that are not AMD's keeps
nothing, and an unpinned tag is refused). 130 OK, test_win_launchers OK.
Counter-tests: needed_files and the note doing nothing fail 3 of 3; the
fetcher without its checks keeps the fake DLLs and fails. Real window (AMD
card stubbed): "FSR 3" fits, the note shows, the Tools button; PLAY with
stubbed commands runs the fetch then the game after a failed fetch, and
only the game with the setting off. No real download was made.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
merzleckeier's review of c179023f9: with vehicle:G=Y;foot:G=RB and no
context, a G tapped inside the 400 ms pause after Caps Lock gave a neutral
pad (the pause holds back keys that change with the table), yet letting it
go switched to the on-foot table: `leaving` was armed from the raw press.
Now `leaving_sent` records that the key counted in a driving pad (its Y
sent); letting it go switches only then, otherwise driving by hand goes on.
Holding it through the pause sends Y and switches on release as before.
Tests: leaving_a_vehicle_by_hand_follows_the_remap gains the swallowed tap
(still driving, leaving cleared) and the held press (Y, then on foot).
cargo test -p leonida-hle 258 passed, 2 ignored; clippy -D warnings clean.
With the release switching unconditionally the test fails.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
merzleckeier's review of 94950d4a5:
- key_named used `then_some(VK_F1 + n - 1)` and `then_some(VK_NUMPAD0 +
digit)`, which add before the range check: F144 or Numpad160 overflowed u8
(a panic with overflow checks) instead of an "unknown key" warning. Now
`then(|| ...)`.
- With no context measured, Caps Lock's driving table ended on the physical
F, so `vehicle:F=RB` left driving and gave no RB. It now ends on a key just
pressed that is the pad's Y in the driving table (F unless remapped;
Binds::exit_pressed). A key that is Y on foot too switches at once, as F
did; one that is another input on foot keeps the driving table while held
(`leaving`), so its Y reaches the title, and the on-foot table comes when
it is let go. Caps Lock or a measured context drops `leaving`.
Tests: four out-of-range names in bind_entries_read (F144, F255,
Numpad160, Num250); leaving_a_vehicle_by_hand_follows_the_remap
(vehicle:F=RB stays RB and driving; both:G=Y leaves at once with Y; G Y in a
vehicle and RB on foot holds Y until let go, then on-foot W is the stick and
G is RB; Caps Lock while leaving drops it). cargo test -p leonida-hle 258
passed, 2 ignored; clippy -D warnings clean. With the old then_some and the
physical-F rule both tests fail (overflow panic, vehicle:F=RB leaving).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review of beb149402 (merzleckeier, ecox982745):
- Parity on malformed values: the launcher's card_memory took byte arrays
of 1 to 8 bytes, the script's decode took 8 or more and cast strings, so
a 5-byte, 9-byte or string value greyed frame generation on one side and
not the other. Both now read only an integer (REG_QWORD/REG_DWORD) or
exactly eight little-endian bytes; anything else is no size.
- A terminating error reading one adapter (Get-ItemProperty, now with
-ErrorAction Stop inside the per-adapter try) and an error while listing
the class (-ErrorAction SilentlyContinue, a foreach over what was listed)
no longer stop the walk before a later adapter's size.
Tests: test_nvidia_frame_generation_with_ray_tracing gains seven cases
(5-byte, 9-byte and string values; an 8 GB integer followed by a 5-byte or
9-byte 24 GB value; an adapter whose read throws before an 8 GB one; a
listing that reports an error before an 8 GB adapter); card_memory's test
gains the 5-byte and 9-byte arrays. tests/test_win_launchers.py 11 OK and
tests/test_leonida_launcher.py OK in Windows PowerShell 5.1; on the
previous script the new cases fail (9-byte and string values, 8 GB + 9-byte
24 GB, the throwing adapter and the listing error).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
$vram, the largest HardwareInformation.qwMemorySize of the display class,
cast the value straight to [uint64]. Some drivers write it as eight
little-endian bytes (REG_BINARY); the cast then threw inside the walk's one
try, so the walk stopped there. With the Series X 20 GB rule for frame
generation with ray tracing, an 8 GB card written as bytes kept 2x, and an
integer 8 GB followed by a 24 GB card in bytes left it off, while the
launcher's card_facts (which decodes the bytes) said the opposite
(merzleckeier's review on #3272).
The value is now decoded with [BitConverter]::ToUInt64 when it is a byte
array of eight or more bytes, and each adapter has its own try, so an odd
value skips that adapter only.
Tests: test_nvidia_frame_generation_with_ray_tracing's registry stub takes
several adapters, each an integer or a byte array; four new cases (8 GB and
24 GB as bytes, integer 8 GB + 24 GB bytes, and the reverse order). All 11
tests of tests/test_win_launchers.py pass in Windows PowerShell 5.1; on the
unpatched script the new cases fail exactly as reported (8 GB bytes keeps 2x,
8 GB int + 24 GB bytes leaves it off).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`LEONIDA_KBM_BINDS=scope:key=action;...` (scope foot, vehicle or both; key a
letter, digit or name such as Space, LShift, Numpad8, F5, MouseLeft; action a
pad input such as A, Square, RB, LT, DpadUp, LeftY+, or none) changes the
GTA V layout's two tables. An entry replaces every default bind of its key in
its scope; several keys may give one action. The tables are built once
(LazyLock) from the consts plus the entries, and the stand-in pad, `outputs`
and the hand-over rule (`changes`) all read the built tables, so a remapped key
that ends up another input in a vehicle than on foot waits for a fresh press
after a change of table.
Entries that do not read, and the runtime's own keys (F1 settings menu, F3
numbers panel, F4 trainer menu, F8 ped dump, F9 frame capture, Left/Right Alt,
Caps Lock), are skipped with one warning each naming the entry; nothing
panics. Unset, the tables are the consts bind for bind (tested over all 256
keys); LEONIDA_KBM=classic does not read the variable.
Tests: cargo test -p leonida-hle (257 passed, 2 ignored), clippy -p
leonida-hle --all-targets -D warnings clean; a counter-test that keeps the
default binds of a named key fails 3 of the new tests, one that runs the
hand-over on the default tables fails the remapped hand-over test.
docs/gameinput.md documents the syntax; d3d12/docs/switches.md regenerated.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The automatic 2x of RTX 40/50 cards (with -Resolution or -Lowest, the Series X default) came along with
-HardwareRT once ray tracing stopped removing frame generation. Turning ray tracing on must not turn frame
generation on: with ray tracing it runs only when asked for (-FrameGen, the F1 menu, LEONIDA_FRAME_GEN). The
dry-run test gains three automatic cases (hardware RT, software RT, none); it fails without the condition.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A player's RTX 5080 (16 GB), Series X, hardware RT, DLSS quality, frame generation 2x with LEONIDA_FG_WITH_RT=1,
7 minutes: frames generated, then about 5 minutes in the process passed the card's budget (13.0 of 12.95 GB, up to
14.2), Streamline reported eWarnOutOfVRAM and frames over 100 ms went from 8-15 to 46-53 a minute. A 3090 reached
18.6 GB on the same profile. 20 GB is just above: 16 GB cards keep it on Series S, and on Series X with
LEONIDA_FG_WITH_RT=1. The dry-run test gains a 24 GB case; 16 GB on Series X is now off (fails at 12 GB).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The F1 menu's SAVE AND RESTART starts play-nvidia.ps1 again with LEONIDA_MENU_ARGS, which listed the switches but
not -More. The launcher's frame limit, advanced options and crash tracing, and a LEONIDA_FG_WITH_RT=1 given by hand,
were gone after the restart (with ray tracing on, frame generation was then turned off again).
The table now goes into LEONIDA_MENU_ARGS as a PowerShell literal (the menu runs it with -Command), every quote
doubled. On that restart a value the menu saved for the same setting wins over the replayed -More, since it was
chosen after it; a normal start keeps -More over the menu as before.
Test: tests/test_win_launchers.py test_nvidia_menu_restart_replays_more (dry run, then the replayed command);
it fails without either change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
a_scan_without_a_size_reaches_the_end_of_the_image failed about one run
in twenty. The fake title image was a plain 4096-byte Vec at whatever
address the allocator gave. A scan whose range is not all readable (the
second scan starts 100 bytes below the image) reads by pages, and a page
only partly inside the buffer is unreadable in the fake, so when the
buffer started within 100 bytes after a page boundary the page holding the
marker was skipped. A real image is whole pages, where that cannot happen.
The fake now keeps its 4096 bytes on a page boundary, and a test pins it.
Also takes the .unwrap() off Runtime::new in the dangling-link test, the
same one-line change as #3237, so the crate's tests build on main.
Fixes#3193
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The comment now gives the RTX 3090 24 GB run (frames generated on both profiles, at most 14.4 GB used on
Series X), says 12 GB sits between the 8 GB card that ran out and the 16 GB one that did not, with 10-12 GB
cards untested, and quotes this head's own 300 s run without -More. Comment only.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Frame generation (DLSS's, FSR 3's and the automatic 2x on RTX 40/50) was left off whenever ray tracing was on
("0.1 frames a second", a measure of the software walk from before this renderer). It now runs with ray tracing,
software or hardware, except on the Series X profile with under 12 GB of video memory, where it is left off with
a message; unknown video memory does not block. When kept, LEONIDA_FG_WITH_RT=1 is set so the runtime's own guard
(fg.rs) starts it; -More LEONIDA_FG_WITH_RT='1' forces it everywhere, '0' keeps it off.
Measured on an RTX 4070 Laptop 8 GB, main 45dc41f95, 2026-12-02, 240 s walks, one run each:
- Series S, -HardwareRT -FrameGen 2: 21 rendered / 43 shown fps once warm, frames generated, no device lost.
- Series S, -RayTracing -FrameGen 2: 10-11 rendered / 21 shown.
- Series X, -HardwareRT -Dlss quality -FrameGen 2: 5 fps, no generated frame, Streamline eWarnOutOfVRAM.
- A player's 16 GB card, Series X, same switches: no out-of-memory warning, frames generated part of the time.
DryRun checked (settings against origin/main): runs without ray tracing are identical; Series S with RT and
-FrameGen 2 gains LEONIDA_FRAME_GEN=2 and LEONIDA_FG_WITH_RT=1; Series X with RT on this 8 GB card leaves it off
with the message; video memory forced to 16, 12 and 0 GB keeps it, 11 GB leaves it off.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keep native status in both log modes and report explicit heights above the console output as failures. Verify both launch entry points with a synthetic Windows executable.
A mod that fails to load no longer holds its state (and up to 128 MiB) until the
next reload; the handles it left behind go when the failure switches it off.
(Review of #3179.)
The junction case pins inside()'s refusal; the file link is the one that
escaped before the fix and runs only where links can be made.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`manifest::inside` checked the deepest part of the path that exists, found
with `Path::exists`. That follows links, so a link inside the mod's folder
whose target is missing counted as absent: the walk went on to the folder
holding it, which is inside, and `leonida.write_file` then made the link's
target, which may be out of the mod's folder.
- The walk now stops at the deepest entry `symlink_metadata` finds, so a
link counts as there even when its target is missing (also as a folder
part of the path). Canonicalising a link to nothing fails, and that is
now a refusal that names the path: "`out.txt` cannot be resolved inside
the mod's folder (...)".
- Test: a file link to a missing file and a junction (Unix: a folder link)
to a missing folder; neither write goes through and neither target is
made. Without the fix the file write returns true and makes outside.txt.
- docs/lua-modding.md: a link that leads to nothing is refused too.
Not reachable from Lua today (no API makes links): hardening.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
One Lua state held every mod, so the 128 MiB limit was one budget for all
of them: a mod holding memory made another's ordinary allocation fail, and
collectgarbage("count") reported the other mods' memory too. Each mod now
loads into its own state (one shared time guard, since one call runs at a
time), with the same 128 MiB limit.
`psv()` wrote the PSV0 string table with one copy of a semantic name for
all elements that shared it. The DXIL validator rebuilds PSV0 from the
module and compares the parts for container layouts before 1.8, and that
table holds a copy per element: a repeated arbitrary semantic (two
TEXCOORDs, two clip distances) left the later element with an offset the
regenerated table does not contain, so the program was refused with
"Container part 'Pipeline State Validation' does not match expected for
module".
Write one copy per arbitrary element in element order, as DXC does;
system values keep the empty name at offset 0. The regression test parses
the emitted part and fails on the shared offset. On main the rectangle
geometry-stage validator test is red with dxil.dll 1.7.2308; with this
change the full crate suite is 429 passed, 0 failed, 6 ignored (without
and with LEONIDA_DXIL pointing at 1.7.2308), and
`cargo check --workspace --all-targets --locked` passes.
No game data, no GPU.