Commit Graph

12 Commits

Author SHA1 Message Date
69cd4106ce Merge pull request #3051 from imShangLi/fix/d3d12-lua-require-inside-folder
D3D12-LUA-LINKS-STAY-IN-THE-FOLDER: require and the script refuse a link that leads out
2026-12-02 13:22:25 +00:00
9d962894ce D3D12-LUA-LINKS-STAY-IN-THE-FOLDER: the doc says the rule holds for require too 2026-12-02 13:43:13 +08:00
915d4d5aad D3D12-LUA-MEMORY-SCAN-BOUNDS: the doc says what an empty range is 2026-12-02 12:50:31 +08:00
ffc320527b D3D12-LUA-MEMORY-SCAN-BOUNDS: the second review's points
- the doc says that a string which names a whole number is taken as that
  number, so the sentence is true
- the test covers a negative size and a negative max too
2026-12-02 12:40:30 +08:00
d138e52199 D3D12-LUA-MEMORY-SCAN-BOUNDS: the review's points
- the test for the default range stands on its own, so it shows red without
  the fix (on the base the mod is disabled by the typed option before it
  gets there)
- the doc says what is really refused: a numeric string is a whole number
  and is taken
2026-12-02 12:32:02 +08:00
76ba820fb8 D3D12-LUA-MEMORY-SCAN-BOUNDS: a scan covers a bounded range and its options are checked
The range of leonida.memory.scan was checked against the process, not against
the work it causes: a mod could ask for the whole user range (128 TiB) and the
scan's time was refunded to the call budget, so nothing stopped it. The one
thread that runs every mod then sat in the scan for hours, and the other mods,
the menu callbacks and the reload path waited for it.

- one scan covers at most 256 MiB (the whole image, when it is bigger)
- start, size and max are whole numbers: a negative one or another kind of
  value is refused with the reason, not taken for something else
- without a size, the range reaches the end of the image (it ended 100 bytes
  short when it started below the image)
2026-12-02 12:19:23 +08: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
68a13c4d5e Trainer menu: game actions through the title's own cheat system (LEONIDA_GAME_ACTIONS=1)
The title has a cheat system of its own: a table of sixteen handlers without
arguments, and the functions those call take plain arguments. Ten places in
its code are found by short byte signatures (each once in the executable),
which give the cheat dispatcher and table, the title's deferred call, the
player's ped, the functions that set a ped's wanted level, the time of day
and the forced weather type, and the globals they work on.

The title's once-a-frame call of its cheat input function becomes a call of
ours (a near stub, written before any title code runs); the menu only queues
a request, and the hook hands the title's own deferred-call queue (the one
its cheats go through) the work. Wanted level, clear, never wanted, hour,
clock paused, sync with system, weather by name, freeze weather, the health
cheat and the nine vehicle cheats are wired; the player's position and
heading come from the ped itself. Moving the player, god mode and the rest
still say why they are not there.

Off unless LEONIDA_GAME_ACTIONS=1: built and unit-tested, not yet run in the
title. LEONIDA_GAME_ACTIONS_RUN scripts commands for a test without the
keyboard and logs to %TEMP%\leonida-actions.

docs/mod-menu.md: how it was found, with counts; the 6,811 script command
wrappers (each carries its own 64-bit hash) and what was tried to find the
table that binds them.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 12:17:56 -05: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
581440a319 Lua mods: an example mod, the docs, and the mod manager lists them
What: mods/example_lua (mod.json disabled by default, main.lua: a frame-rate and
time line in the lower left, a page in the F4 menu with a toggle, a number and two
actions, an F9 key handler); docs/lua-modding.md (the API reference, the sandbox
rules, what is not available and why, what was not tried), pointers in
docs/README.md, docs/mod-menu.md, docs/modding.md and a row in d3d12/README.md.
tools/leonida_mods.py reads "script": it must be a .lua path inside the folder, the
list shows `Lua main.lua`, the JSON report has "script", and a Lua mod no longer
warns that it has no archetype_swaps.
Why: a Lua mod is mods\<name>\mod.json plus a script, so the manager that lists the
asset mods should list these too, and a mod author needs the reference.
How checked: python -I tests/test_leonida_mods.py (13 tests, 3 new, pass; the one
failure, test_run_print_builds_gta6rt_command, fails the same on the base: no gta6rt
build here). The example's script was not run in the title. AI-assisted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 00:11:50 -05:00