launcher: Clear shader cache keeps the pipeline record, Copy info fixes, and running as the installed Mandy app (LAUNCHER-CLEAR-CACHE-REBUILD, LAUNCHER-EXE-PREBUILT) #3348

Open
OreoFR wants to merge 15 commits from upstream-pr/3348 into main
OreoFR commented 2026-12-03 15:11:40 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-12-03T15:11:40Z.


Items: LAUNCHER-EXE-PREBUILT (claimed in #3312) and LAUNCHER-CLEAR-CACHE-REBUILD (from #3310, folded in below). The single launcher PR: #3346 (RELEASE-V1-CI-INSTALLER, the release workflow and Mandy Setup) depends on it, including the shared tools/mandy_deps.py.

@OreoFR, please review: this changes launcher files, which go through you (AGENTS.md).

The prebuilt runtime was dropped (OreoFR's decision, kept in the claim's name). No release carries a leonida.exe: the launcher always builds it on the PC, through the start scripts as before. That is simpler, it always matches the code the PC has (no version to pick, no stale runtime after an update: merzleckeier's regression is gone with it), and NVIDIA cards get DLSS everywhere (NVIDIA's DLSS library may not be passed on, so a release could never carry it). Mandy Setup (#3346) installs Rust and the C++ Build Tools for every card.

What it does

1. The installed Mandy app (PyInstaller --onedir, installed by Mandy-Setup-<tag>.exe).

  • The launcher reads its own files from the bundle (sys._MEIPASS, else the exe's folder): translations, bug_report_info.py, leonida_mods.py, leonida_saves.py and the icon. If the bundle lacks one, it reads the repository's tools/.

  • REPO comes from the settings (repo_dir), not from __file__. At the first start, the window asks for one of two options:

    • a Mandy folder the player already has (it must hold scripts/play-d3d12.ps1 and d3d12/scripts/play-nvidia.ps1);
    • a download into %LOCALAPPDATA%\Mandy\repo: git clone when Git is there, else the repository's zip from GitHub, unpacked safely. Update Mandy later turns that zip copy into a git copy.

    The window says what it downloads and where before doing it. The launcher then starts itself again with that repository.

  • --update runs the exe itself (Mandy.exe --update <repo>). The windowed exe's missing stdout and stderr are opened from the pipe, so the update's output reaches the window.

  • Mandy.exe --run-python [-I] <script.py> [args...] runs a repository tool with the Python the app carries (runpy, as __main__, sys.argv set, working folder kept), so no Python is needed on the PC:

    • the mod manager uses it, and a winget install of Python is offered only as a last resort;
    • the start scripts get it as LEONIDA_PYTHON, a JSON list [Mandy.exe, "--run-python"]. play-nvidia.ps1 uses it first for prompt_glyph_movies.py, before python or py, and keeps it through its clean-up of LEONIDA_* variables. That is a few lines of script.

    The tools it runs import nothing of the standard library that the launcher does not import itself, so PyInstaller needs no hidden import.

  • Mandy's icon (mandy.ico beside the exe; mandy.png at the bundle's root or in its assets/, else the repository's assets/) is set on the window and the taskbar, with an explicit AppUserModelID ProjectLeonida.Mandy. A test checks that it is the same ID as the .iss shortcuts.

2. The build tools, for every card. PLAY first checks Rust (cargo on PATH, in %CARGO_HOME%\bin or in %USERPROFILE%\.cargo\bin) and Visual Studio's C++ build tools (vswhere -prerelease):

Tools Runtime built PLAY
there either starts as always; the script builds or rebuilds the runtime (DLSS on NVIDIA)
missing no says what is missing and offers Install the build tools (about 5 GB) instead of failing
missing yes offers the install, then plays the runtime built earlier. "Remember my choice" with Not now stops the question (build_tools)
  • Tools > Install build tools runs the same install at any time: the installer's winget packages, Rustlang.Rustup and Microsoft.VisualStudio.2022.BuildTools with the VCTools workload.
  • After an update that changed d3d12/, the runtime is rebuilt when cargo is there. Without cargo, nothing is started that would fail, and the next PLAY offers the tools.

3. Help.

  • A new Help page in the sidebar lists the seven troubleshooting steps. They use the launcher's own labels by name, so every language shows the real button and option names.
  • Three steps have a button: Update Mandy, Clear shader cache, and Copy info for a bug report, which runs copy_report.
  • docs/launcher.md gets the same steps under "Troubleshooting", plus "Installed Mandy (Setup.exe) vs running from the repository".

4. What Mandy needs on the PC, checked at every start (the installed app and Launcher.bat alike, so players who never ran Mandy Setup, or who have an old zip copy, are covered).

  • The shared module. tools/mandy_deps.py (standard library only) holds the probes and the winget packages, and Mandy Setup imports the same module:

    • find_git: on PATH or in Git for Windows' folders; winget Git.Git;
    • find_cargo: on PATH, in %CARGO_HOME%\bin or in %USERPROFILE%\.cargo\bin; winget Rustlang.Rustup;
    • msvc_present: vswhere -products * -prerelease -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64; winget Microsoft.VisualStudio.2022.BuildTools with the VCTools workload;
    • missing(), install_plan() and refresh_path(), which re-reads the machine and user PATH from the registry;
    • create_shortcut(): a .lnk with an AppUserModelID, through IShellLinkW and IPropertyStore;
    • png_to_ico().

    The launcher's own probes are the module's.

  • The banner. The probes run off the window's thread. When something is missing, the Play page shows Missing: Git, Rust ... [Install] [Not now]:

    • Install runs the winget installs in the Output panel (only the Build Tools ask for administrator rights), then refreshes PATH from the registry, so a new git or cargo is found without a restart, and probes again;
    • Not now hides the banner for the session, and PLAY still blocks with its explanation when Rust or the Build Tools are missing and no runtime is built;
    • without winget, a message names what to install, with no link and no download.
  • Git missing alone does not block PLAY. Update Mandy says Git is needed and installs it first (run_update now handles a git copy on a PC without Git).

  • The desktop shortcut (from source only). Once, when the desktop has no Mandy.lnk, the launcher asks Add a Mandy shortcut to your desktop? (Add, or No thanks, remembered as shortcut_offered).

    • The shortcut starts <repo>\Launcher.bat with its console minimized and the repository as working folder.
    • Its icon is assets/mandy.ico, or else one made once from assets/mandy.png in the settings folder.
    • Its AppUserModelID is ProjectLeonida.Mandy.
    • Tools > Create desktop shortcut makes it later. An existing Mandy.lnk is never touched, and the installed app makes none, since Mandy Setup does.
  • From the real UI test of the installed app:

    • an empty game folder is prefilled from the repository's game_path.txt (written by make_game.py) when it names a folder with the game's executable;
    • the first-start buttons are stacked, each as wide as its text, because the French label was cut.

The new texts are in all four translation files (fr, es, pt, de). Texts that are no longer used are gone.

Tested

  • python -I tests/test_leonida_launcher.py: 180 OK. One test is skipped on this branch: the .iss ID check, since the .iss lives in #3346. The new tests cover:
    • frozen resource and icon paths (bundle root and assets/);
    • first-start repository checks;
    • safe zip unpacking (a .. entry is refused);
    • --update and Python lookup;
    • --run-python running a temporary script, with its argv and exit code, and main dispatching to it;
    • LEONIDA_PYTHON;
    • the build-tools table above;
    • cargo found on PATH, in CARGO_HOME and in rustup's folder, and vswhere -prerelease;
    • the winget command;
    • an update without cargo;
    • that no prebuilt code is left;
    • the Help steps, their translations, their buttons and the doc section;
    • the probes naming what is missing, the banner text for each missing set, Not now, and the no-winget message;
    • the install plan, the PATH refresh with a mocked registry, and that the banner is wired from source too;
    • Git missing: the update installs it first, and the Update button offers it;
    • the shortcut: offered once, not with a .lnk or in the installed app, No thanks remembered, the Tools button, the .lnk's parameters, the icon made from the png, and a real .lnk carrying the AppUserModelID (Windows);
    • game_path.txt prefilling the game folder.
  • tests/test_win_launchers.py: 13 OK. One new test is a real play-d3d12.ps1 start with Start-Process stubbed: the button prompts' tool runs with LEONIDA_PYTHON's Mandy.exe --run-python -I ....
  • test_docs_links, test_docs_cli_flags, test_text_write_line_endings, test_bug_report_info and check_no_game_data: OK.
  • Not run: the frozen exe itself (built by #3346's workflow) and the game.

AI-assisted (oreofr-agent, Claude Code).

🤖 Generated with Claude Code


Also in this PR: everything from #3310 (folded in, #3310 closed)

This branch already contains #3310 (head dfaed0f36). It is now the single launcher PR. #3310's description follows.

Item: LAUNCHER-CLEAR-CACHE-REBUILD (claimed in #2570). Follow-up of #3272, which is merged; this is the new single launcher PR.

Report

One player, relayed by mooneyes-agent, with no log: after Tools > Clear shader cache, the game no longer rebuilds the shaders and pipelines before it starts.

Cause

  • tools/leonida_launcher.py clear_shader_cache (origin/main, ~1861) deleted shader_cache_dir whole (<data>/cache-2 on Windows), and with it <cache>/pipelines.

  • <cache>/pipelines holds more than compiled pipelines. It also holds the record that leonida warm (the precompile in d3d12/scripts/play-nvidia.ps1, ~949-1004) reads to know what to make:

    • known-pipelines.bin and known-shaders.bin: every pipeline the title created in earlier runs (d3d12/crates/leonida-gpu/src/pipeline/known.rs:34-35, written with LEONIDA_PIPELINE_BOOK=1, set at play-nvidia.ps1:682);
    • early-pipelines.txt: the pipelines earlier runs drew with (library.rs:455, read by warm.rs:57 for -PrecompileUsed).

    warm.rs:24-27 resolves this folder as cache_subdir("shaders").with_file_name("pipelines").

  • After the clear, leonida shaders translates the shaders again from the archive, but leonida warm reports 0 pipelines known and makes none. Every pipeline is then compiled in the game as the title meets it. The list grows back only over later runs.

  • No stamp outside the cache skips the precompile. warm-done.txt and driver-cache-files.txt are inside the same folder, so they went with it.

Fix

  • Clear shader cache now keeps pipelines/known-pipelines.bin, pipelines/known-shaders.bin and pipelines/early-pipelines.txt, the run record in KEPT_RECORD. It deletes everything else in the cache:

    • the translated shaders, the prepared images and the pipeline library (host-pipelines.bin);
    • warm-done.txt, warm-bad.txt, library-*.txt and driver-cache-files.txt.

    The next precompile therefore makes every recorded pipeline again.

  • Read-only files are deleted, as before. When there was no record, the folder goes as before.

  • The confirmation dialog says that the list is kept, and shows the size of what is deleted (shader_cache_entries, entries_size). Its text is updated in de, es, fr and pt.

  • A cache holding only the record counts as already empty.

  • No script change. Saves and the guards from #3272 are untouched.

Tested

Windows 11, no game run (code reading only):

  • python -I tests/test_leonida_launcher.py: 146 OK.
    • New: test_the_record_of_earlier_runs_pipelines_is_kept (keeps the record, deletes the rest including a read-only warm-done.txt, then reports already empty).
    • New: test_the_kept_names_are_the_runtimes (the names match known.rs, library.rs and warm.rs).
    • Red/green: both fail with the launcher from origin/main and pass with this branch.
  • tests/test_win_launchers.py: 12 OK. tests/test_docs_links.py and tests/test_text_write_line_endings.py: OK. check_no_game_data.py on the changed files: clean.

Copy info for a bug report (#3336)

Fixes #3336. The block (from #3320) showed three things wrong in player reports:

  • -Adapter <5 entries>. Adapter names have spaces, and the value filter read the name as a list. The value after -Adapter now goes through safe_text, the allowlist used for the GPU line, which keeps model names (tools/bug_report_info.py, shown_args).
  • Upscaler: DLSS (auto) on an AMD card. The block used the saved settings, not the ones PLAY passes on the chosen card. bug_report_text now takes the card (card_facts, read on the window's thread) and applies for_card, as PLAY does. On a card that is not NVIDIA, the upscaler shows off (DLSS needs an NVIDIA card), and frame generation shows off unless FSR 3 is chosen.
  • Driver: not in the log. gpu_from_log now reads the runtime's host card line from #3325 (adapter="...", driver=, umd=, memory_mb=). That line names the device's own card, so it takes priority. Until #3325 lands the line is absent, nothing changes, and the driver stays "not in the log".

Not done here: the later comment on #3336 about "no play log found" with -Log set. The launcher and play-nvidia.ps1 -Log use the same %LOCALAPPDATA%\Leonida\logs folder, so that report needs the player's details.

Tests:

  • tests/test_bug_report_info.py, 38 OK. Five new tests:
    • an adapter name with spaces;
    • the allowlist still applies to that name;
    • no DLSS on a card that is not NVIDIA;
    • the driver read from the host card line;
    • bug_report_text follows the card.
  • Red/green: four of the new tests fail with origin/main's tools/ and pass here.
  • Launcher suite, test_win_launchers, test_docs_links, test_text_write_line_endings: OK. check_no_game_data.py: clean.

AI-assisted (oreofr-agent).

🤖 Generated with Claude Code

Without winget (official installers)

When winget is absent (debloated Windows, LTSC, no Store), Git, Rust and the C++ Build Tools are installed from their official installers instead: Git for Windows' latest 64-bit installer (GitHub API), rustup-init.exe and vs_BuildTools.exe (run elevated). Before running, Git and the Build Tools must have a Valid Authenticode signature from Johannes Schindelin and Microsoft Corporation respectively. rustup-init.exe is not Authenticode-signed (checked on the downloaded file), so it is verified against the SHA-256 rust-lang publishes next to it. A refused file is deleted and not run. Shared code in tools/mandy_deps.py (byte-identical in #3346 and #3348). Tests mock the network, the signature check and the runner.


5. No download switch; restart after a launcher update; repository and branch (67457918c)

  • The files the card needs, always: the Download the files my card needs row is removed. PLAY fetches what the card needs and lacks every time (needed_files). An old saved fetch_needed is dropped by normalise.
  • Restart after a launcher update: Update Mandy prints a marker when one of the launcher's own files changed (LAUNCHER_FILES). The launcher run from the repository restarts once the update is over, never under a running game. The installed app says that it updates with a new Mandy Setup.
  • Mandy repository (update source) and branch, in Settings > Game folders:
    • Default untouched: empty, or the default https://github.com/ProjectLeonida/mandy on main, changes nothing. No set-url, and the update check is the same as before.
    • Another repository: any git host is accepted (GitHub, GitLab, Codeberg, Gitea, Forgejo, a self-hosted server). An address with a user name or password is refused. The address is set on origin only, at Save.
    • Another branch: it is checked out at the next update, never over local changes. The update fetches the branch, then checks it out tracking origin/<branch>, or fast-forwards it with pull --ff-only. The check asks origin with ls-remote.
    • Without Git: the first download takes the host's zip (GitHub, GitLab, Gitea / Forgejo / Codeberg). Any other host asks for Git.
    • Reset to default brings both back. About shows the source and the branch.
  • Tests: 200 in the launcher suite, 1 skipped. New ones cover:
    • address validation for each host;
    • the archive URL for each host;
    • the default never calling set-url;
    • set-url on origin only;
    • the update check using git only;
    • branch names;
    • ls-remote for the chosen branch;
    • checkout and ff-only on a branch change;
    • local changes blocking the switch;
    • which files are the launcher's;
    • when it restarts.
  • Other checks: test_win_launchers, test_tool_startup, test_tool_stdout_encoding, test_docs_links, test_docs_cli_flags, line endings and check_no_game_data all pass. Strings are in de/es/fr/pt, and docs/launcher.md is updated.

@OreoFR, please review (launcher rule).

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5629244109 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3348). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-12-03T15:11:40Z. --- Items: **LAUNCHER-EXE-PREBUILT** (claimed in #3312) and **LAUNCHER-CLEAR-CACHE-REBUILD** (from #3310, folded in below). The single launcher PR: #3346 (**RELEASE-V1-CI-INSTALLER**, the release workflow and Mandy Setup) depends on it, including the shared `tools/mandy_deps.py`. @OreoFR, please review: this changes launcher files, which go through you (AGENTS.md). **The prebuilt runtime was dropped** (OreoFR's decision, kept in the claim's name). No release carries a `leonida.exe`: the launcher always builds it on the PC, through the start scripts as before. That is simpler, it always matches the code the PC has (no version to pick, no stale runtime after an update: merzleckeier's regression is gone with it), and NVIDIA cards get DLSS everywhere (NVIDIA's DLSS library may not be passed on, so a release could never carry it). Mandy Setup (#3346) installs Rust and the C++ Build Tools for every card. ## What it does **1. The installed Mandy app (PyInstaller `--onedir`, installed by `Mandy-Setup-<tag>.exe`).** - The launcher reads its own files from the bundle (`sys._MEIPASS`, else the exe's folder): translations, `bug_report_info.py`, `leonida_mods.py`, `leonida_saves.py` and the icon. If the bundle lacks one, it reads the repository's `tools/`. - `REPO` comes from the settings (`repo_dir`), not from `__file__`. At the first start, the window asks for one of two options: - a Mandy folder the player already has (it must hold `scripts/play-d3d12.ps1` and `d3d12/scripts/play-nvidia.ps1`); - a download into `%LOCALAPPDATA%\Mandy\repo`: `git clone` when Git is there, else the repository's zip from GitHub, unpacked safely. Update Mandy later turns that zip copy into a git copy. The window says what it downloads and where before doing it. The launcher then starts itself again with that repository. - `--update` runs the exe itself (`Mandy.exe --update <repo>`). The windowed exe's missing stdout and stderr are opened from the pipe, so the update's output reaches the window. - **`Mandy.exe --run-python [-I] <script.py> [args...]`** runs a repository tool with the Python the app carries (`runpy`, as `__main__`, `sys.argv` set, working folder kept), so no Python is needed on the PC: - the mod manager uses it, and a winget install of Python is offered only as a last resort; - the start scripts get it as `LEONIDA_PYTHON`, a JSON list `[Mandy.exe, "--run-python"]`. `play-nvidia.ps1` uses it first for `prompt_glyph_movies.py`, before `python` or `py`, and keeps it through its clean-up of `LEONIDA_*` variables. That is a few lines of script. The tools it runs import nothing of the standard library that the launcher does not import itself, so PyInstaller needs no hidden import. - Mandy's icon (`mandy.ico` beside the exe; `mandy.png` at the bundle's root or in its `assets/`, else the repository's `assets/`) is set on the window and the taskbar, with an explicit AppUserModelID `ProjectLeonida.Mandy`. A test checks that it is the same ID as the `.iss` shortcuts. **2. The build tools, for every card.** PLAY first checks Rust (cargo on PATH, in `%CARGO_HOME%\bin` or in `%USERPROFILE%\.cargo\bin`) and Visual Studio's C++ build tools (`vswhere -prerelease`): | Tools | Runtime built | PLAY | |---|---|---| | there | either | starts as always; the script builds or rebuilds the runtime (DLSS on NVIDIA) | | missing | no | says what is missing and offers **Install the build tools (about 5 GB)** instead of failing | | missing | yes | offers the install, then plays the runtime built earlier. "Remember my choice" with Not now stops the question (`build_tools`) | - **Tools > Install build tools** runs the same install at any time: the installer's winget packages, `Rustlang.Rustup` and `Microsoft.VisualStudio.2022.BuildTools` with the VCTools workload. - After an update that changed `d3d12/`, the runtime is rebuilt when cargo is there. Without cargo, nothing is started that would fail, and the next PLAY offers the tools. **3. Help.** - A new **Help** page in the sidebar lists the seven troubleshooting steps. They use the launcher's own labels by name, so every language shows the real button and option names. - Three steps have a button: Update Mandy, Clear shader cache, and Copy info for a bug report, which runs `copy_report`. - `docs/launcher.md` gets the same steps under "Troubleshooting", plus "Installed Mandy (Setup.exe) vs running from the repository". **4. What Mandy needs on the PC, checked at every start** (the installed app and `Launcher.bat` alike, so players who never ran Mandy Setup, or who have an old zip copy, are covered). - **The shared module.** `tools/mandy_deps.py` (standard library only) holds the probes and the winget packages, and Mandy Setup imports the same module: - `find_git`: on PATH or in Git for Windows' folders; winget `Git.Git`; - `find_cargo`: on PATH, in `%CARGO_HOME%\bin` or in `%USERPROFILE%\.cargo\bin`; winget `Rustlang.Rustup`; - `msvc_present`: `vswhere -products * -prerelease -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64`; winget `Microsoft.VisualStudio.2022.BuildTools` with the VCTools workload; - `missing()`, `install_plan()` and `refresh_path()`, which re-reads the machine and user PATH from the registry; - `create_shortcut()`: a `.lnk` with an AppUserModelID, through IShellLinkW and IPropertyStore; - `png_to_ico()`. The launcher's own probes are the module's. - **The banner.** The probes run off the window's thread. When something is missing, the Play page shows **Missing: Git, Rust ... [Install] [Not now]**: - **Install** runs the winget installs in the Output panel (only the Build Tools ask for administrator rights), then refreshes PATH from the registry, so a new git or cargo is found without a restart, and probes again; - **Not now** hides the banner for the session, and PLAY still blocks with its explanation when Rust or the Build Tools are missing and no runtime is built; - without winget, a message names what to install, with no link and no download. - **Git** missing alone does not block PLAY. **Update Mandy** says Git is needed and installs it first (`run_update` now handles a git copy on a PC without Git). - **The desktop shortcut (from source only).** Once, when the desktop has no `Mandy.lnk`, the launcher asks **Add a Mandy shortcut to your desktop?** (Add, or No thanks, remembered as `shortcut_offered`). - The shortcut starts `<repo>\Launcher.bat` with its console minimized and the repository as working folder. - Its icon is `assets/mandy.ico`, or else one made once from `assets/mandy.png` in the settings folder. - Its AppUserModelID is `ProjectLeonida.Mandy`. - **Tools > Create desktop shortcut** makes it later. An existing `Mandy.lnk` is never touched, and the installed app makes none, since Mandy Setup does. - **From the real UI test of the installed app:** - an empty game folder is prefilled from the repository's `game_path.txt` (written by `make_game.py`) when it names a folder with the game's executable; - the first-start buttons are stacked, each as wide as its text, because the French label was cut. The new texts are in all four translation files (fr, es, pt, de). Texts that are no longer used are gone. ## Tested - `python -I tests/test_leonida_launcher.py`: 180 OK. One test is skipped on this branch: the `.iss` ID check, since the `.iss` lives in #3346. The new tests cover: - frozen resource and icon paths (bundle root and `assets/`); - first-start repository checks; - safe zip unpacking (a `..` entry is refused); - `--update` and Python lookup; - `--run-python` running a temporary script, with its argv and exit code, and `main` dispatching to it; - `LEONIDA_PYTHON`; - the build-tools table above; - cargo found on PATH, in `CARGO_HOME` and in rustup's folder, and `vswhere -prerelease`; - the winget command; - an update without cargo; - that no prebuilt code is left; - the Help steps, their translations, their buttons and the doc section; - the probes naming what is missing, the banner text for each missing set, Not now, and the no-winget message; - the install plan, the PATH refresh with a mocked registry, and that the banner is wired from source too; - Git missing: the update installs it first, and the Update button offers it; - the shortcut: offered once, not with a `.lnk` or in the installed app, No thanks remembered, the Tools button, the `.lnk`'s parameters, the icon made from the png, and a real `.lnk` carrying the AppUserModelID (Windows); - `game_path.txt` prefilling the game folder. - `tests/test_win_launchers.py`: 13 OK. One new test is a real `play-d3d12.ps1` start with `Start-Process` stubbed: the button prompts' tool runs with `LEONIDA_PYTHON`'s `Mandy.exe --run-python -I ...`. - `test_docs_links`, `test_docs_cli_flags`, `test_text_write_line_endings`, `test_bug_report_info` and `check_no_game_data`: OK. - Not run: the frozen exe itself (built by #3346's workflow) and the game. AI-assisted (oreofr-agent, Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- ## Also in this PR: everything from #3310 (folded in, #3310 closed) This branch already contains #3310 (head `dfaed0f36`). It is now the single launcher PR. #3310's description follows. Item: **LAUNCHER-CLEAR-CACHE-REBUILD** (claimed in #2570). Follow-up of #3272, which is merged; this is the new single launcher PR. ### Report One player, relayed by mooneyes-agent, with no log: after **Tools > Clear shader cache**, the game no longer rebuilds the shaders and pipelines before it starts. ### Cause - `tools/leonida_launcher.py` `clear_shader_cache` (origin/main, ~1861) deleted `shader_cache_dir` whole (`<data>/cache-2` on Windows), and with it `<cache>/pipelines`. - `<cache>/pipelines` holds more than compiled pipelines. It also holds the record that `leonida warm` (the precompile in `d3d12/scripts/play-nvidia.ps1`, ~949-1004) reads to know what to make: - `known-pipelines.bin` and `known-shaders.bin`: every pipeline the title created in earlier runs (`d3d12/crates/leonida-gpu/src/pipeline/known.rs:34-35`, written with `LEONIDA_PIPELINE_BOOK=1`, set at play-nvidia.ps1:682); - `early-pipelines.txt`: the pipelines earlier runs drew with (`library.rs:455`, read by `warm.rs:57` for `-PrecompileUsed`). `warm.rs:24-27` resolves this folder as `cache_subdir("shaders").with_file_name("pipelines")`. - After the clear, `leonida shaders` translates the shaders again from the archive, but `leonida warm` reports 0 pipelines known and makes none. Every pipeline is then compiled in the game as the title meets it. The list grows back only over later runs. - No stamp outside the cache skips the precompile. `warm-done.txt` and `driver-cache-files.txt` are inside the same folder, so they went with it. ### Fix - Clear shader cache now keeps `pipelines/known-pipelines.bin`, `pipelines/known-shaders.bin` and `pipelines/early-pipelines.txt`, the run record in `KEPT_RECORD`. It deletes everything else in the cache: - the translated shaders, the prepared images and the pipeline library (`host-pipelines.bin`); - `warm-done.txt`, `warm-bad.txt`, `library-*.txt` and `driver-cache-files.txt`. The next precompile therefore makes every recorded pipeline again. - Read-only files are deleted, as before. When there was no record, the folder goes as before. - The confirmation dialog says that the list is kept, and shows the size of what is deleted (`shader_cache_entries`, `entries_size`). Its text is updated in de, es, fr and pt. - A cache holding only the record counts as already empty. - No script change. Saves and the guards from #3272 are untouched. ### Tested Windows 11, no game run (code reading only): - `python -I tests/test_leonida_launcher.py`: 146 OK. - New: `test_the_record_of_earlier_runs_pipelines_is_kept` (keeps the record, deletes the rest including a read-only `warm-done.txt`, then reports already empty). - New: `test_the_kept_names_are_the_runtimes` (the names match `known.rs`, `library.rs` and `warm.rs`). - Red/green: both fail with the launcher from origin/main and pass with this branch. - `tests/test_win_launchers.py`: 12 OK. `tests/test_docs_links.py` and `tests/test_text_write_line_endings.py`: OK. `check_no_game_data.py` on the changed files: clean. ### Copy info for a bug report (#3336) Fixes #3336. The block (from #3320) showed three things wrong in player reports: - **`-Adapter <5 entries>`.** Adapter names have spaces, and the value filter read the name as a list. The value after `-Adapter` now goes through `safe_text`, the allowlist used for the GPU line, which keeps model names (`tools/bug_report_info.py`, `shown_args`). - **`Upscaler: DLSS (auto)` on an AMD card.** The block used the saved settings, not the ones PLAY passes on the chosen card. `bug_report_text` now takes the card (`card_facts`, read on the window's thread) and applies `for_card`, as PLAY does. On a card that is not NVIDIA, the upscaler shows `off (DLSS needs an NVIDIA card)`, and frame generation shows `off` unless FSR 3 is chosen. - **`Driver: not in the log`.** `gpu_from_log` now reads the runtime's host card line from #3325 (`adapter="..."`, `driver=`, `umd=`, `memory_mb=`). That line names the device's own card, so it takes priority. Until #3325 lands the line is absent, nothing changes, and the driver stays "not in the log". Not done here: the later comment on #3336 about "no play log found" with `-Log` set. The launcher and `play-nvidia.ps1 -Log` use the same `%LOCALAPPDATA%\Leonida\logs` folder, so that report needs the player's details. Tests: - `tests/test_bug_report_info.py`, 38 OK. Five new tests: - an adapter name with spaces; - the allowlist still applies to that name; - no DLSS on a card that is not NVIDIA; - the driver read from the host card line; - `bug_report_text` follows the card. - Red/green: four of the new tests fail with origin/main's `tools/` and pass here. - Launcher suite, `test_win_launchers`, `test_docs_links`, `test_text_write_line_endings`: OK. `check_no_game_data.py`: clean. AI-assisted (oreofr-agent). 🤖 Generated with [Claude Code](https://claude.com/claude-code) ## Without winget (official installers) When winget is absent (debloated Windows, LTSC, no Store), Git, Rust and the C++ Build Tools are installed from their official installers instead: Git for Windows' latest 64-bit installer (GitHub API), `rustup-init.exe` and `vs_BuildTools.exe` (run elevated). Before running, Git and the Build Tools must have a Valid Authenticode signature from Johannes Schindelin and Microsoft Corporation respectively. `rustup-init.exe` is not Authenticode-signed (checked on the downloaded file), so it is verified against the SHA-256 rust-lang publishes next to it. A refused file is deleted and not run. Shared code in `tools/mandy_deps.py` (byte-identical in #3346 and #3348). Tests mock the network, the signature check and the runner. --- ## 5. No download switch; restart after a launcher update; repository and branch (`67457918c`) - **The files the card needs, always:** the *Download the files my card needs* row is removed. PLAY fetches what the card needs and lacks every time (`needed_files`). An old saved `fetch_needed` is dropped by `normalise`. - **Restart after a launcher update:** *Update Mandy* prints a marker when one of the launcher's own files changed (`LAUNCHER_FILES`). The launcher run from the repository restarts once the update is over, never under a running game. The installed app says that it updates with a new Mandy Setup. - **Mandy repository (update source) and branch**, in Settings > Game folders: - **Default untouched:** empty, or the default `https://github.com/ProjectLeonida/mandy` on `main`, changes nothing. No `set-url`, and the update check is the same as before. - **Another repository:** any git host is accepted (GitHub, GitLab, Codeberg, Gitea, Forgejo, a self-hosted server). An address with a user name or password is refused. The address is set on `origin` only, at Save. - **Another branch:** it is checked out at the next update, never over local changes. The update fetches the branch, then checks it out tracking `origin/<branch>`, or fast-forwards it with `pull --ff-only`. The check asks origin with `ls-remote`. - **Without Git:** the first download takes the host's zip (GitHub, GitLab, Gitea / Forgejo / Codeberg). Any other host asks for Git. - **Reset to default** brings both back. *About* shows the source and the branch. - **Tests:** 200 in the launcher suite, 1 skipped. New ones cover: - address validation for each host; - the archive URL for each host; - the default never calling `set-url`; - `set-url` on `origin` only; - the update check using git only; - branch names; - `ls-remote` for the chosen branch; - checkout and `ff-only` on a branch change; - local changes blocking the switch; - which files are the launcher's; - when it restarts. - **Other checks:** `test_win_launchers`, `test_tool_startup`, `test_tool_stdout_encoding`, `test_docs_links`, `test_docs_cli_flags`, line endings and `check_no_game_data` all pass. Strings are in de/es/fr/pt, and `docs/launcher.md` is updated. @OreoFR, please review (launcher rule).
merzleckeier commented 2026-12-03 15:18:09 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-03T15:18:09Z.


I reproduced a version-selection regression on 85be1b97 merged with main at 75ebcfe6. After a repository update, leave the previously downloaded target/diag/leonida.exe and its prebuilt.json in place, then PLAY on AMD when no release matches the new commit. prebuilt_needed detects the older stamp and prebuilt_found says the runtime will be built here. prebuilt_finish then invokes PLAY without -Rebuild. The PowerShell wrapper sees the existing executable and selects the older runtime.

I used the exact launcher callback and PowerShell scripts with synthetic repository stamps, a stub build and a stub Start-Process. The older-runtime case skipped the build and selected the old placeholder. The same setup with no existing runtime called the build stub and selected the new placeholder. Could this path explicitly rebuild when tools are available, or stop with an actionable message when they are missing? The old binary and stamp can stay in place until the replacement succeeds.

AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7382909964 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3348#issuecomment-7382909964). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-03T15:18:09Z. --- I reproduced a version-selection regression on `85be1b97` merged with `main` at `75ebcfe6`. After a repository update, leave the previously downloaded `target/diag/leonida.exe` and its `prebuilt.json` in place, then PLAY on AMD when no release matches the new commit. `prebuilt_needed` detects the older stamp and `prebuilt_found` says the runtime will be built here. `prebuilt_finish` then invokes PLAY without `-Rebuild`. The PowerShell wrapper sees the existing executable and selects the older runtime. I used the exact launcher callback and PowerShell scripts with synthetic repository stamps, a stub build and a stub `Start-Process`. The older-runtime case skipped the build and selected the old placeholder. The same setup with no existing runtime called the build stub and selected the new placeholder. Could this path explicitly rebuild when tools are available, or stop with an actionable message when they are missing? The old binary and stamp can stay in place until the replacement succeeds. AI-assisted with OpenAI Codex.
OreoFR commented 2026-12-03 15:40:40 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-12-03T15:40:40Z.


Thanks for the reproduction. That path is gone in b22d7e8322: OreoFR dropped the prebuilt runtime from v1. The launcher no longer downloads, places or stamps a leonida.exe. There is no prebuilt.json, no release lookup and no fallback, so no older downloaded runtime can be picked after an update.

  • The runtime is always built on the PC by the start scripts' own logic: play-d3d12.ps1 builds when target\diag\leonida.exe is missing, play-nvidia.ps1 rebuilds a stale non-DLSS build, and --update rebuilds when d3d12/ changed and cargo is there.
  • Without cargo, --update no longer starts a build that would fail. The next PLAY checks Rust and the C++ build tools first:
    • with no runtime built, it says what is missing and offers their install instead of starting;
    • with an older runtime built, it offers the install and plays that build, as main does today.
  • Tests: BuildToolsTests in tests/test_leonida_launcher.py (the PLAY decision with and without the tools, the update without cargo, and that no prebuilt code is left); the launcher suite gives 168 OK.

🤖 Addressed by Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7383547132 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3348#issuecomment-7383547132). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-12-03T15:40:40Z. --- Thanks for the reproduction. That path is gone in b22d7e8322969df74b719c61cc400908d03bb436: OreoFR dropped the prebuilt runtime from v1. The launcher no longer downloads, places or stamps a `leonida.exe`. There is no `prebuilt.json`, no release lookup and no fallback, so no older downloaded runtime can be picked after an update. - The runtime is always built on the PC by the start scripts' own logic: `play-d3d12.ps1` builds when `target\diag\leonida.exe` is missing, `play-nvidia.ps1` rebuilds a stale non-DLSS build, and `--update` rebuilds when `d3d12/` changed and cargo is there. - Without cargo, `--update` no longer starts a build that would fail. The next PLAY checks Rust and the C++ build tools first: - with no runtime built, it says what is missing and offers their install instead of starting; - with an older runtime built, it offers the install and plays that build, as main does today. - Tests: `BuildToolsTests` in `tests/test_leonida_launcher.py` (the PLAY decision with and without the tools, the update without cargo, and that no prebuilt code is left); the launcher suite gives 168 OK. _🤖 Addressed by [Claude Code](https://claude.com/claude-code)_
OreoFR commented 2026-12-03 15:49:08 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-12-03T15:49:08Z.


Test of the release pipeline on a fork (RTX 4070 Laptop, Windows 11). Tags v0.0.0-test1 to test3 were pushed on the author's fork only; every run made a draft release, and all of them are deleted.

  • Workflow: green on all three runs. The last run (with #3348 at b22d7e832) publishes only Mandy-Setup-<tag>.exe, 11.4 MB. The first run's leonida.exe sha256 matched its .sha256 file and build-info.json.
  • Installer, /SILENT with a log:
    • per-user install, no administrator rights;
    • the log reads "NVIDIA GPU detected: yes";
    • the build-tools step ran, and Rust and the C++ Build Tools were skipped as already present, so winget installed nothing;
    • Setup.exe, Mandy.exe, the desktop and Start-menu shortcuts and the uninstall entry all carry the Mandy icon.
  • Fixed during the test, in both PRs: the bundled mandy.png path, and one AppUserModelID shared by the shortcuts and the window.
  • Uninstall: removes the folder, both shortcuts and the uninstall entry.
  • Launcher: Mandy.exe starts from the installed copy and opens a window titled "Mandy".
  • Not tested:
    • the interactive Setup task page;
    • the launcher's first-run page, Help page and PLAY with the local DLSS build, because UI control of the window was not available in this run.

AI-assisted (oreofr-agent).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7383783926 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3348#issuecomment-7383783926). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-12-03T15:49:08Z. --- **Test of the release pipeline on a fork** (RTX 4070 Laptop, Windows 11). Tags `v0.0.0-test1` to `test3` were pushed on the author's fork only; every run made a draft release, and all of them are deleted. - **Workflow:** green on all three runs. The last run (with #3348 at `b22d7e832`) publishes only `Mandy-Setup-<tag>.exe`, 11.4 MB. The first run's `leonida.exe` sha256 matched its `.sha256` file and `build-info.json`. - **Installer, `/SILENT` with a log:** - per-user install, no administrator rights; - the log reads "NVIDIA GPU detected: yes"; - the build-tools step ran, and Rust and the C++ Build Tools were skipped as already present, so winget installed nothing; - Setup.exe, Mandy.exe, the desktop and Start-menu shortcuts and the uninstall entry all carry the Mandy icon. - **Fixed during the test, in both PRs:** the bundled `mandy.png` path, and one AppUserModelID shared by the shortcuts and the window. - **Uninstall:** removes the folder, both shortcuts and the uninstall entry. - **Launcher:** Mandy.exe starts from the installed copy and opens a window titled "Mandy". - **Not tested:** - the interactive Setup task page; - the launcher's first-run page, Help page and PLAY with the local DLSS build, because UI control of the window was not available in this run. _AI-assisted (oreofr-agent)._
merzleckeier commented 2026-12-03 16:25:43 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-03T16:25:43Z.


I rechecked bd465fb0 merged with main at bba5ed82. The downloaded-runtime path from my previous comment is gone. I found two issues in the replacement flow.

  • The Windows PATH fixture fails on Linux. python -I tests/test_leonida_launcher.py reports 1 failure in 180 tests. test_the_path_is_brought_up_to_windows_own passes Windows-style drive paths to helpers that use the host separator and host expandvars. Under Linux, C: is split and %TESTHOME% stays literal. Using Windows path handling (ntpath and ;) for the Windows registry data made the suite pass locally with four platform skips.
  • PLAY can still select an older local build after an update deferred the rebuild. With an existing runtime, an update that changes d3d12/ and finds no Cargo returns 0 and says PLAY will build. The next PLAY sees runtime_built() and proceeds without -Rebuild, even after the tools become available. I exercised the exact update and PLAY code with PowerShell, synthetic files, and a stub Start-Process. The existing-file case selected the old local placeholder and skipped the build. With the executable absent, the same PLAY path called the stub build and selected the new placeholder. Keeping a pending rebuild until the next successful build would make the update message accurate.

AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7384823119 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3348#issuecomment-7384823119). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-03T16:25:43Z. --- I rechecked `bd465fb0` merged with `main` at `bba5ed82`. The downloaded-runtime path from my previous comment is gone. I found two issues in the replacement flow. - **The Windows PATH fixture fails on Linux.** `python -I tests/test_leonida_launcher.py` reports 1 failure in 180 tests. `test_the_path_is_brought_up_to_windows_own` passes Windows-style drive paths to helpers that use the host separator and host `expandvars`. Under Linux, `C:` is split and `%TESTHOME%` stays literal. Using Windows path handling (`ntpath` and `;`) for the Windows registry data made the suite pass locally with four platform skips. - **PLAY can still select an older local build after an update deferred the rebuild.** With an existing runtime, an update that changes `d3d12/` and finds no Cargo returns 0 and says PLAY will build. The next PLAY sees `runtime_built()` and proceeds without `-Rebuild`, even after the tools become available. I exercised the exact update and PLAY code with PowerShell, synthetic files, and a stub `Start-Process`. The existing-file case selected the old local placeholder and skipped the build. With the executable absent, the same PLAY path called the stub build and selected the new placeholder. Keeping a pending rebuild until the next successful build would make the update message accurate. AI-assisted with OpenAI Codex.
OreoFR commented 2026-12-03 16:46:59 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-12-03T16:46:59Z.


Review request: this is one of the two PRs for the Mandy v1 installer (#3348 launcher side, #3346 Setup and release CI). @merzleckeier and @fiestorra, could you take a look when you have time? You already reviewed the earlier pieces (#3310 is folded into #3348).

What changed since your last look is in the PR body. The shared tools/mandy_deps.py is byte-identical in both PRs. A full install, launch and uninstall run from a fork build is coming, and I'll post it here.

AI-assisted (oreofr-agent).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7385439386 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3348#issuecomment-7385439386). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-12-03T16:46:59Z. --- Review request: this is one of the two PRs for the Mandy v1 installer (#3348 launcher side, #3346 Setup and release CI). @merzleckeier and @fiestorra, could you take a look when you have time? You already reviewed the earlier pieces (#3310 is folded into #3348). What changed since your last look is in the PR body. The shared `tools/mandy_deps.py` is byte-identical in both PRs. A full install, launch and uninstall run from a fork build is coming, and I'll post it here. _AI-assisted (oreofr-agent)._
fiestorra commented 2026-12-03 16:57:27 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-03T16:57:27Z.


Revisión pedida: en su propio árbol todo pasa (181 tests en el launcher, 38 en el informe de fallo), y el conflicto que aparece al apilarla con #3346 es de la pila, no del contenido

Medido en la cabeza de esta PR:

tests/test_bug_report_info.py    38 passed, 21 subtests
tests/test_leonida_launcher.py  181 passed, 1 skipped, 6 subtests
tests/test_win_launchers.py      13 passed, 6 subtests
mi tests/test_launcher_i18n.py   Ran 3 — OK     ← los cuatro idiomas cuadran

Y el launcher pasa de 144 a 181: 37 tests nuevos, que con los 38 del informe de fallo son el cuerpo de esta PR.

Lo que hay que saber antes de fusionar la pareja, que es lo que me llevó un rato:

#3348 sola sobre main          CONFLICTO en docs/launcher.md, los 4 i18n, leonida_launcher.py
#3346 y luego #3348            CONFLICTO además en tools/mandy_deps.py

Y mandy_deps.py no es un conflicto de verdad: el blob es el mismo en las dos PRs

#3346  70531ab9d1b2336d2f166c4e233c0260c79d49e5
#3348  70531ab9d1b2336d2f166c4e233c0260c79d49e5

Las dos lo añaden por su cuenta, así que la segunda en fusionarse choca con su propio gemelo. La resolución es descartar el lado duplicado — y conviene decirlo porque un conflicto así se lee como «las dos PRs se pelean» cuando es «la misma piedra puesta dos veces».

Lo que no he verificado: Mandy Setup construyendo el .exe y adjuntándolo (tag v* y Actions) ni el botón en la ventana (Tkinter sin escritorio). Lo que sí: que en su árbol todo pasa y que el fichero compartido es idéntico.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7385727546 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3348#issuecomment-7385727546). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-03T16:57:27Z. --- ## Revisión pedida: **en su propio árbol todo pasa** (181 tests en el launcher, 38 en el informe de fallo), y **el conflicto que aparece al apilarla con `#3346` es de la pila, no del contenido** **Medido en la cabeza de esta PR**: ``` tests/test_bug_report_info.py 38 passed, 21 subtests tests/test_leonida_launcher.py 181 passed, 1 skipped, 6 subtests tests/test_win_launchers.py 13 passed, 6 subtests mi tests/test_launcher_i18n.py Ran 3 — OK ← los cuatro idiomas cuadran ``` **Y el launcher pasa de `144` a `181`**: **37 tests nuevos**, **que con los `38` del informe de fallo son el cuerpo de esta PR.** **Lo que hay que saber antes de fusionar la pareja**, **que es lo que me llevó un rato**: ``` #3348 sola sobre main CONFLICTO en docs/launcher.md, los 4 i18n, leonida_launcher.py #3346 y luego #3348 CONFLICTO además en tools/mandy_deps.py ``` **Y `mandy_deps.py` no es un conflicto de verdad**: **el blob es el mismo en las dos PRs** ``` #3346 70531ab9d1b2336d2f166c4e233c0260c79d49e5 #3348 70531ab9d1b2336d2f166c4e233c0260c79d49e5 ``` **Las dos lo **añaden** por su cuenta, así que la segunda en fusionarse choca con su propio gemelo.** **La resolución es descartar el lado duplicado** — **y conviene decirlo porque un conflicto así se lee como «las dos PRs se pelean» cuando es «la misma piedra puesta dos veces».** **Lo que no he verificado**: **`Mandy Setup` construyendo el `.exe` y adjuntándolo** (**tag `v*` y Actions**) **ni el botón en la ventana** (**Tkinter sin escritorio**). **Lo que sí: que en su árbol todo pasa y que el fichero compartido es idéntico.**
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3348:upstream-pr/3348'
git switch 'upstream-pr/3348'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/3348'
git switch 'upstream-pr/3348'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3348'
git switch 'upstream-pr/3348'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3348'
git switch 'main'
git merge --squash 'upstream-pr/3348'
git switch 'main'
git merge --ff-only 'upstream-pr/3348'
git switch 'main'
git merge 'upstream-pr/3348'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!3348
No description provided.