Commit Graph

6 Commits

Author SHA1 Message Date
c53cf975c5 D3D12-CLIPPY-NON-GPU-CRATES: fix all 31 clippy warnings outside leonida-gpu (#2681) 2026-12-01 11:38:45 +01:00
8b79ed2720 mods: gate_driver presses at the menus' pace after a probe that shows no move (review)
A probe that showed no move pressed Enter at once, and the menus then probed again at once: Enter came
every 3 to 5 s (68 times in 6 min on a cold cache), with no press_every and no check that frames had
moved on. It now asks the menus for one press at their pace, and a probe waits for Enter to be up.
The docs say what idle cannot tell (a held player) and what a cold cache does to CONTROL.
2026-11-30 21:49:19 +01:00
923dc26741 mods: gate_driver takes a run from the menus into the world (D3D12-GATE-DRIVER-MOD)
A Lua mod for in-game gates and A/Bs: it presses Enter through the title's menus only once frames
have moved on since the last press, shows control by holding W (the player must walk 1 to 30 m in
3 s; more is the title placing the player, which it waits out without a press), then stands still
(idle) or walks a fixed loop (roam). It logs GATE PRESS/PROBE/CONTROL/MARK/SHOT/FAIL lines with
distances only, never a position. It ships disabled; a run enables a copy with LEONIDA_MODS and
needs LEONIDA_GAME_ACTIONS=1 for the player's position.

The logic is in driver.lua and takes the calls it uses as an argument, so leonida-lua's tests run
it on a stub with a simulated clock: menus, control, roam, no position, no control, a jump.
2026-11-30 21:02:29 +01:00
4fc6d11141 Teleport page and leonida.teleport work through the player hook when a position is known
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 02:45:50 -05:00
58e1f3c272 leonida-lua: a test runs the example mod; the README row
What: a test copies mods/example_lua enabled into a temporary folder and drives it
on the fake host: its page (toggle, number, two actions), the overlay line, F9
turning it off, the menu callbacks, the menu_open event. d3d12/README.md gets the
row for the Lua mods that the last commit left out.
How checked: cargo test -p leonida-lua --lib (35 passed); cargo test -p
leonida-menu --lib (47 passed). AI-assisted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 00:11:50 -05:00
312dfeac0d leonida-lua: a sandboxed Lua 5.4 modding API (events, overlay, settings, menu pages, checked memory)
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>
2026-11-27 00:11:49 -05:00