What was wrong: nothing by default. The runtime allocates through the system
heap, and some builds want to compare another allocator on the CPU-bound
translation threads.
What changes: a cargo feature `mimalloc` on the leonida app (-> leonida-hle
-> leonida-gpu, optional workspace dependency mimalloc 0.1.52, no default
features) installs mimalloc as the global allocator. With diagnostics on
Windows, the counting allocator in copystat wraps mimalloc instead of the
system heap, so the allocation counters keep working. Default off: with the
feature off the code is unchanged (the system allocator, same counters), and
the only difference in the tree is the unused optional dependency in
Cargo.lock. How much mimalloc helps is not measured here. Only the allocator
part of the fork commit is ported, not its descriptor-count reporting.
Source: from TaynanGT/Vice-Tay dfdb8b4, GPL-3.0 (allocator part only).
Tests: cargo check -p leonida --features diagnostics (default) and
--features diagnostics,mimalloc; cargo check -p leonida-gpu --features
mimalloc. Not run on the game. AI-assisted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What: a new crate that runs the Lua mods of mods\<name>\ (mod.json with
"script": "main.lua", enabled unless it says false) in one Lua 5.4 state (mlua,
vendored, MIT) on a thread of its own. The `leonida` table (api_version 1):
on("frame"|"key"|"menu_open"), key_down, pad, hold_keys/release_keys, text/rect
(a draw list cleared each pass), get/set for fps_cap, dlss_sharpness, panel,
menu_scale and game_speed only, menu.page():toggle/number/action, memory
read/write u8..f64/bytes, scan with wildcards and base, log, screenshot, frame,
time, read_file/write_file in the mod's folder, require of the mod's own .lua.
Sandbox: each mod gets an environment of copies of the safe base functions and
coroutine/table/string/utf8/math and os.time/clock/date/difftime. No io, package,
debug, dofile, loadfile, string.dump, os.execute/remove/rename/exit/getenv, no
precompiled chunks, no network. A mod's error, a call that outlives its 200 ms
budget (also inside pcall and coroutines) or 128 MiB for the state switches that
mod off and nothing else. The host is behind a Platform trait; the renderer
wiring follows in the next commit. mod.json is read by a small JSON reader of
its own (json.rs): serde_json in the build made `assert_eq!(vec_of_u32, [])`
ambiguous in leonida-gpu's tests.
Why: mods can use what the runtime controls (the title's own script functions
are not reachable: docs/mod-menu.md).
How checked: cargo test -p leonida-lua --lib (34 passed): forbidden functions
gone, event dispatch, one mod failing (syntax, runtime, table errors, endless
loops, memory) leaving the others, memory reads and writes of a local buffer
with unmapped, protected and out-of-range addresses, scan across chunks and
holes, overlay list, menu pages and callbacks, settings, files, require,
manifests, the JSON reader, API version. Cargo.lock gains mlua, mlua-sys,
lua-src and their small dependencies. scripts/check_no_game_data.py on the
files. AI-assisted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A new crate with no platform in its core: pages of items (submenus,
toggles, numbers, choices, actions) with a cursor and back stack that wrap
round and scroll; keys and pad buttons to presses with repeat and
debounce, and which keys are kept from the title while it is open; the
run-time settings the rest of the runtime reads (sharpen strength,
frame-rate cap, FPS panel and frame recorder switches, screenshots, the
title's clock rate); Leonida's pages grouped as single-player trainers
group them (Player, Vehicle, Weapons, World, Time, Weather, Teleport,
Misc, Settings); script features behind a GameActions backend that says
why they are not available yet. The menu is painted on the CPU in the
classic trainer layout, in two layers (unselected and selected rows) so
the highlight can slide on the card; glyphs come from the system's fonts
through GDI at run time (Segoe Script, Segoe UI), the built-in dot font
elsewhere. Its own thread polls F4 / RB+Left and paints only on change.
LEONIDA_MENU=0 turns it off. 30 unit tests, no GPU needed.
Cherry-picked from 996fbd522 (leonida/mod-menu, written against db723a4c4)
onto the main line after the upstream renderer merge (00698e1e8). The crate
is as it was; Cargo.lock names it for the workspace only, since leonida-gpu
and leonida-hle take it in the commits that follow. The settings are fitted
to the merged renderer in the next commit.
Checked: cargo test -j 4 -p leonida-menu (30 passed).
AI-assisted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Launcher (d3d12/scripts/play-nvidia.ps1, passed through by scripts/play-d3d12.ps1;
-NoPrecompile skips it): before the title starts, `leonida shaders` translates
every shader of the title's shader archive into the cache with the settings of
that start, and `leonida warm --used` makes the host pipelines earlier runs
drew with, in processes of their own. Runs write the title's pipelines down for
it (LEONIDA_PIPELINE_BOOK=1). Until now the first load of the world after a
change of the translator ran at 0.2 fps for a minute and came up half drawn
while 2,000 shaders were translated and their pipelines made. Measured here
(Ryzen 5 7600X, the machine busy with other builds): 25,663 shaders in 109 s,
226 of them with no translation (195 containers without a program, 26 wave64
programs without a 32-lane form, 5 others); 1,891 pipelines in about 150 s. A
second start finds them in the cache. The commands' log is kept quiet for the
step instead of redirected: Windows PowerShell 5.1 turns a native command's
redirected error stream into errors.
ambient.rs: LEONIDA_REFLECT_MOST is off unless set. On the renderer merged at
00698e1e8 the guard made the whole picture posterized and grey, sky and skin in
a few flat tones (run n2: all 411 recorded frames; with it off, run n3: none of
431). The program it follows is not only the reflections' there.
Cargo.toml: profile `play` (the diag build with thin LTO and one code
generation unit), to be measured against diag.
README: the table of Leonida's fixes follows the merged renderer (DLSS in place
of -Resolution native, LEONIDA_SHARPEN gone with the compose pass it lived in),
and a section on the precompile.
AI-assisted.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
What changed:
- victory/ is now d3d12/;
- its crates are leonida-* (leonida_* code paths);
- the program is leonida.exe;
- settings are LEONIDA_*, and the older VICTORY_* names still work through apps/leonida/src/leonida.rs;
- the config file is leonida.toml;
- log names and user-facing text say Leonida.
What did not change: lines that credit upstream projects or people, URLs, copyright notices and the
GPL-3.0 LICENSE. d3d12/README.md opens with a Leonida section that says the runtime grew from
Marvisak/VIctory through trustno1-coder/VIctory-NVIDIA. The rest of that README is labelled as
trustno1-coder's.
The launchers (scripts/play-d3d12.ps1, scripts/play-linux.sh), docs/linux.md and
scripts/sync_victory.py (prefix d3d12) follow the move. Future upstream merges will need a
mapping from upstream's names onto these.
Builds with `cargo build --profile diag -p leonida --features diagnostics`. The settings alias
tests pass.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>