Files
mandy/docs/launcher.md
OreoFR 00a35d6d68 launcher: greyed controls where another choice makes them pointless
UI only (switch_args and play_command unchanged; 288 control combinations give the same switches and
variables as before). A greyed control keeps its value and ignores clicks and the space bar; undoing
the other choice brings it back:
- hardware ray tracing greys frame generation's mode and limit, with a note (the scripts leave frame
  generation off with ray tracing; LEONIDA_FG_WITH_RT=1 in the advanced options overrides);
- DLSS off greys the DLSS mode; DLSS with a mode greys the resolution (left out of the command then);
- frame generation off greys its limit;
- every pipeline precompiled keeps shader preparation on and greyed (it needs it).
Toggle and Segmented get enabled(); a disabled drop-down looks muted. Checked in a real window: each
rule both ways, clicks on greyed controls change nothing, and the same check fails on the previous
commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-02 21:43:33 +01:00

13 KiB

The Mandy Launcher

The Python launcher has the Mandy name and the look of the launcher mockup: an indigo palette with violet and pink, MANDY in the rail with the update state, commit, card and driver under it, and cards on every page. The folders it reads and writes keep the Leonida names (%APPDATA%\Leonida, %LOCALAPPDATA%\Leonida), so no setting, cache or save moves.

A desktop window for the port, in the usual shape of a game launcher: a narrow navigation column on the left and pages of cards. It is Leonida's own design: no other company's name, logo, font or artwork, no picture files, and no game assets in the repository. It is not an official product.

Starting it

  • Windows: double-click Launcher.bat at the repository root. It looks for Python 3.12 or newer with Tcl/Tk (the window needs it): the py launcher's versions, python on PATH, then the per-user installs under %LOCALAPPDATA%\Programs\Python. Without one it asks, then installs Python 3.12 for your user account only (no admin): winget if present, else the python.org installer pinned and checked against its SHA-256, the same one Build.bat uses, with Tcl/Tk. LEONIDA_PY_INSTALL_DRYRUN=1 prints those commands and runs nothing.
  • Linux: python3 tools/leonida_launcher.py (needs Tkinter: the python3-tk package).

Standard library only (tools/leonida_launcher.py). The window tells Windows it draws at the screen's own scale, so its text is sharp at 125-200 %; sizes in pixels follow that scale. Nothing slow runs on the window's thread before it first draws (no picture is read at all; git and the card's name are read by workers), so it cannot open white. An error in a button's code is written into the output box instead of being lost.

Languages

English, French, Spanish, Portuguese and German. The launcher follows Windows' display language (GetUserDefaultUILanguage; on Linux the LANG-style variables) and falls back to English; Language in Settings overrides it. The translations are tools/launcher_i18n/<code>.json, each mapping the English text in tools/leonida_launcher.py to its translation: a text without one shows in English. A new text in the launcher needs its line in every file, which tests/test_leonida_launcher.py checks (same keys, same {fields}).

Pages

  • Play: three cards.

    • Play: the PLAY pill runs powershell -NoProfile -ExecutionPolicy Bypass -File scripts\play-d3d12.ps1 -Game <folder> -Data <folder> plus the switches chosen in Settings (on Linux scripts/play-linux.sh <folder>/game_scarlett_master.exe, with --series-x if chosen). Under it: the state, the game folder (or where to choose it) and the options PLAY passes. The state reads a few of the script's own messages: Starting, Building the runtime, Preparing shaders, Running (a guess from the text; the log is the truth); at the end it says the game closed, closed right after starting (with what to send), or stopped with an error code. Only one thing runs at a time: while it runs PLAY becomes Stop, which, after a confirmation, ends the process and everything it started (taskkill /T /F; on Linux the process group).
    • Updates: up to date, how many updates there are, or why it cannot tell (a zip copy, no git, no branch to follow, a failed fetch); the time of the last check with Check now; what is new, one line per new commit on the followed branch's first-parent line (a merged pull request is named #N and its title), six at most and "+ n more"; and Update Mandy when there is something to take.
    • Output: the script's output, with Run in diagnostic mode and Copy my info.

    The rail shows the same update state at its bottom, with the time of the last check.

  • Settings: the page of the launcher mockup OreoFR chose: cards in two columns with switches, segmented choices and lists, a short line under some options and the longer text when the pointer rests on one; saved with Save (PLAY saves too):

    • Picture: the profile (Series S is -SeriesS; Series X is the script's default), DLSS (off is -NoDlss), the DLSS mode (-Dlss quality|balanced|performance|ultra, Auto = none; on Series X DLSS makes the picture only with one), the resolution (-Resolution, Default = none, left out with a DLSS mode) and -Quality.
    • Frame generation: the mode, DLSS (nothing passed: the runtime's own choice, 2x on RTX 40 and 50 with NVIDIA's files; a -FrameGen multiplier saved earlier is still passed), FSR (-FsrFrameGen) or Off (-NoFrameGen); the frame limit, Auto (nothing passed: the runtime's followed limit), 30, 40, 60 or No limit (LEONIDA_FG_LIMIT_FPS through -More); -SmoothMotion.
    • Ray tracing: Off or Hardware (-HardwareRT, a trial). Software ray tracing (-RayTracing) is no longer offered; a software choice saved by an older launcher is dropped at the next Save or PLAY.
    • Shaders: shader preparation (off is -NoPrecompile) and full pipeline precompilation; fresh settings enable both, and turning the full one off with the preparation on passes -PrecompileUsed. Turning the full one on turns the preparation on. With the note on NVIDIA's shader cache size.
    • General, diagnostics & advanced: the language, -Log, crash tracing (LEONIDA_D3D12_DRED=1), the update check, and Advanced options: LEONIDA_* variables as NAME=value separated by ;, for when someone asks you to try one (they win over the frame limit above). A part that is not such a pair is shown in red and not passed. With variables to pass, PLAY starts the script with powershell -Command "& '...\play-d3d12.ps1' ... -More @{NAME='value'}", since -File cannot hand over a hashtable (play-nvidia.ps1 clears inherited LEONIDA_* variables, so -More is the way in); every argument is single-quoted, a quote doubled.
    • Game folders (not in the mockup, under its cards): the game folder (a picker, and a check that game_scarlett_master.exe is in it), the data folder (empty = the script's default) and the mods folder.

    -Capture is in the diagnostics card. A control another choice makes pointless is greyed (its value is kept, and comes back when that choice is undone): frame generation's mode and limit with hardware ray tracing (the scripts leave frame generation off with it; a note says so), the DLSS mode with DLSS off, the resolution with a DLSS mode, the frame limit with frame generation off, and shader preparation, kept on, while every pipeline is precompiled. On Linux only the game folder and Series X are used.

  • Run in diagnostic mode (Play, Settings and Tools): PLAY with -Log and LEONIDA_D3D12_DRED=1; when the game ends the logs folder opens, for the newest file to go with a report.

  • Copy my info (the same three places): puts on the clipboard what a report needs and shows it first: the Leonida commit and its date, each graphics card with its driver (NVIDIA's own number, 621.47, from the Windows one, 32.0.16.2147), Python, Tk and Windows versions, the switches and variables PLAY passes, and whether the game folder holds the game. No folder names: they can carry the user's name.

  • Mods: the mods\*\mod.json of the mods folder (this repository's mods unless changed), with the enabled flag written back as the mod manager does it (tools/leonida_mods.py); a button opens that manager.

  • Saves: the D3D12 runtime's saves under the data folder, <data>\data\7952987A\saves\<user id>\<configuration>\<Name>~<FNV-1a 64 hex>\v<N>\{0, 1, manifest} (d3d12/crates/leonida-hle/src/modules/xgamesave.rs; tools/leonida_saves.py). Containers and their blobs are listed with size, modified time and the newest readable version. Actions: back up one container or all (a ZIP in <data>\save-backups), restore from a backup (confirmation, and the current saves are backed up first), duplicate a container under a new name, delete (the folder is moved to save-backups\deleted, not erased), export and import a single blob, and a read-only hex and strings viewer. All of them are refused while the game is running.

  • Updates: at start (unless Check for updates at start is off in Settings) the launcher runs git fetch in its own folder and, when the clone is behind the branch it follows, lists the new commits in the Play page's Updates card (git log --first-parent HEAD..@{u}) with an Update Mandy button. Update runs git pull --ff-only (it stops, changing nothing, if local changes or another branch are in the way), then rebuilds the runtime when d3d12/ changed. A copy downloaded as a zip has no .git: the launcher says so, and updating means a git clone of the repository instead.

  • Tools: update Leonida (as above), fetch NVIDIA's DLSS files (d3d12\Get-NVIDIA-DLSS.cmd, after a confirmation: about 70 MB from NVIDIA's GitHub), rebuild the runtime (d3d12\scripts\build-nvidia.ps1), open the logs folder (%LOCALAPPDATA%\Leonida\logs) and the screenshots folder. The two scripts are Windows only.

  • About: what the port is, that it runs your own copy, the credits (see d3d12/README.md) and the licence.

Settings file

%APPDATA%\Leonida\launcher.json (Linux: ~/.config/leonida/launcher.json), written when you press Save or close the window. Unknown or mistyped keys are ignored.

Tests

python -I tests/test_leonida_saves.py does the same for the Saves page on fake save trees. python -I tests/test_leonida_launcher.py covers the parts without a window: reading and writing the settings, the command line each option produces (checked against the switch names in scripts/play-d3d12.ps1), the advanced options and their quoting, the translations (every text of the window in every language), the language choice, the driver number, Copy my info, the mod list, what is new upstream (the pull requests' titles) and the Python offer of Launcher.bat.

Saves: what the bytes are, and what is not edited

  • Layout. A container's folder is its name with every byte but letters, digits, - and _ written %XX (cut at 100 characters), ~, and the 64-bit FNV-1a of the exact name in 16 hex digits. Inside, the highest v<N> whose manifest parses is the container; the manifest is u32-LE-length-prefixed strings: container name, display name, then the blob names, and blob i is the file i. The runtime writes a new version as v<N>.new and one rename commits it, and drops older versions the next time it opens the container. Duplicate therefore writes a folder with the new name's hash and a manifest naming it; any change to a blob is written the same way, as a new v<N+1> beside the old one, after a backup.
  • Blobs. Every container measured has two: Save Game Data and Save Game Header (296 bytes). Save Game Data is an ASAV file (saves.md). The profile and settings containers are plain ASAV (mode 1: the body is the record or hash-keyed JSON text, entropy 0.4 to 4.6 bits per byte). The story-save containers are mode 3 and their body has an entropy of 8.00: compressed or encrypted, and no format note in docs/ names an algorithm for it.
  • Editing. The launcher shows a packed save as "this save is packed (compressed or encrypted); editing is not supported" and does not try to decode, decompress or work around it. For the plain ones the ASAV header carries a checksum at 0x160 whose algorithm is open (docs/saves.md), and the header blob repeats the size, so the launcher does not edit values: that would write saves the title may reject, on the strength of a guess. What is offered is replacing a whole blob with a file you changed yourself (export, change, import), with the backup and the new version described above; a changed size no longer matches the header blob, which the page warns about.
  • Nothing from a real save is in the repository: tests/test_leonida_saves.py builds its own fake trees.

The HTML launcher (launcher/, in progress)

launcher/index.html is a second front end in the layout of a publisher's game launcher (a slim rail with the game's tile, a picture over the whole window, the sections top right, the logo with a large PLAY button), and launcher/serve.py the small server behind it. python -I launcher/serve.py serves it on 127.0.0.1 only and opens it in a window of its own (Edge or Chrome in app mode, else the default browser). --no-run only looks: PLAY and the tools print the command they would run. Launcher.bat still opens the Tkinter window above.

  • Who may ask: a request must name this machine in Host and carry the token written into the page for that run (a header for /api, a cookie for pictures and the event stream). Mods, saves and captures are named by folder, name or index, never by path.
  • The picture behind PLAY: the one chosen in Settings, else the newest background.webp, .png or .jpg in the launcher's settings folder (%APPDATA%\Leonida), else the newest capture, else art the page draws. When there is none, the server fetches the game's key art from rockstargames.com once and keeps it there as background.jpg (or .webp, by what comes back); --no-art leaves it. The request names a plain browser and nothing about you or the project. The picture is never part of the repository. That download is the launcher's only internet access.
  • python -I tests/test_launcher_serve.py covers the above without a browser or the internet.