Commit Graph

18 Commits

Author SHA1 Message Date
cf15c2c6ed d3d12: a typed switch wins over the F1 menu, not a value that changed (D3D12-MENU-LAST-CHOICE-WINS)
Review of the first version: a value that differs from the last start's command line was taken for the user's new
choice. That lost an explicit flag on the first start after an upgrade, never let the same flag typed again win, and
dropped a menu value the command line never mentioned when leonida-launch.txt lacked the key. The menu file was also
rewritten before the history, so a failed history write had already lost a saved choice.

Now the rule follows what the user typed:
- A switch typed for this start wins over the menu's saved value of each setting it makes. The menu file drops that
  value, so F1 shows the command line's. scripts\play-d3d12.ps1 passes the switches typed there as -Typed, so its
  Series X default and -Lowest 1080 leave the menu's choice standing. A start by hand counts its own switches, and
  -More wins like a typed switch.
- Every other setting keeps the menu's value.
- The menu's SAVE AND RESTART adds -MenuRestart to the switches it replays (LEONIDA_MENU_ARGS), so there the menu's
  values, saved after those switches, win.

leonida-launch.txt is gone. The menu file is written to a temporary file and moved over the old one, and only when a
value leaves it. If that fails, the start runs with the command line's values and the file stays whole.

Tests: 10 cases, among them the same switch typed again, an untyped default, a setting no switch makes, the restart,
a start by hand, -More and a menu file that cannot be written.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 11:20:54 -03:00
c8eea9466f d3d12: the last choice wins between the command line and the F1 menu (D3D12-MENU-LAST-CHOICE-WINS)
play-nvidia.ps1 applied leonida-settings.txt (what F1 saved) over the command line at every start. An empty value
there removed what the command line set, so a later -Resolution, -Dlss or -SeriesS was lost without a word.

Now leonida-launch.txt (git-ignored) keeps what the last start's command line made:
- A setting this command line makes otherwise than that start's did wins. The menu file drops its value, so F1
  shows and saves the new one.
- A setting it makes as before keeps the menu's value, the newer choice.
- Each start says which values came from the menu and which the command line replaced.
- A dry run writes neither file.

The F1 menu gets the native render scale (1, which -Resolution makes at the output's height) and the dynamic
resolution's lowest scale (LEONIDA_RENDER_SCALE_MIN, from -Lowest).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 11:16:56 -03:00
b7bca9eabf Trainer notes: a time of day set while the title loads ended it once; set in the world, the night is right
Runs d197 and d199: 23:00 asked 60 s after the start stopped the title within two seconds (an access violation in
KERNELBASE on another thread); asked at 120 s, in the world, it did not, and the night tour's 545 frames show no
one-frame dips or spikes.

AI-assisted (Claude). Tested on an RTX 4060 Ti 16 GB, driver 616.64, Ryzen 5 7600X.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 03:14:07 -05:00
49e93960ca Game actions: the player's place in the world's coordinates (GET_ENTITY_COORDS); lift <metres>
Run d195 had the native teleport move the player at once, but into the bay far from the deck: the place read from
the ped (+0x70, as Game::position reads it) is relative to an origin of the title's own, and SET_ENTITY_COORDS takes
the world's coordinates (the native database has GET_ENTITY_COORDS decode +0x70 into them).

- Game::world_position: GET_ENTITY_COORDS on PLAYER_PED_ID's reference (its flag 1), the vector's three floats.
- The title's thread reads it every 15 of its updates while the natives are found; game_actions::position() (the
  menu's Teleport page and its saved spots) gives that place, never the ped's own for it.
- Request::Lift (lift <metres>): that far above the player's place in the world, through Request::Teleport.
- The info line and the teleport's line give both places.

Also seen in d195: 6,805 natives found by their handlers, PLAYER_PED_ID's reference, god mode on and off.

Tests: the game_actions tests pass (lift read in script_commands_read). Not yet seen in the running title.

AI-assisted (Claude). Tested on an RTX 4060 Ti 16 GB, driver 616.64, Ryzen 5 7600X.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 02:20:20 -05:00
bbd45f5cc1 Game actions: teleports by the title's own teleport (SET_ENTITY_COORDS), and a wanted clear the HUD sees
- Request::Teleport (	eleport <x> <y> <z>): SET_ENTITY_COORDS on PLAYER_PED_ID's reference, the place as four
  packed floats in two slots, the three axis flags off and the area cleared, the last float 0 (nine slots, as the
  native database has the native take). warp(), which the menu's Teleport page and leonida.teleport call, asks
  for it whenever both natives were found, in place of the experiment that writes the ped's position
  (LEONIDA_GAME_ACTIONS_WARP=1, still there without the natives).
- Request::Wanted(0) also calls CLEAR_PLAYER_WANTED_LEVEL on the player's reference: run d179 had the HUD keep
  two red stars after the title's own function cleared the level.

Hashes from modpapi/scripthook-vi's native database (CC BY 4.0). Tests: the game_actions tests pass (teleport
read in script_commands_read). Not yet seen in the running title.

AI-assisted (Claude).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 01:14:53 -05:00
24ccd36c2e Trainer: the game actions seen working in the running title (run d179); the HUD's stars after a clear
Weather, time, wanted level, the health cheat, and the spawn of any vehicle by its model's name (the airport bus, a
model none of the nine cheats holds, came down just ahead of the player) did what was asked on the title's thread.
The HUD kept two red stars after the wanted level was cleared through the title's own function (its state read 0).

AI-assisted (Claude). Tested on an RTX 4060 Ti 16 GB, driver 616.64, Ryzen 5 7600X.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 01:12:32 -05:00
5f8f20d774 Game actions: the title's script natives found by their handlers; god mode through them (god, native <hash>)
The natives were never found as a table (docs/mod-menu.md, "Looking for the script natives"): the title builds
its own at run time. Every handler has one shape, though: it checks its argument count first
(`cmp dword [rcx + 10h], 0`) and on a negative one jumps (`js`) to an error block that stores its native's own
64-bit hash where the result goes (`mov rax, [r]; mov r2, imm64; mov [rax], r2`).

- leonida_loader::natives: scan() reads that hash from every such handler in the code and keeps the start of the
  function it lies in (from .pdata, at most 0x20 bytes before the check); a hash at two handlers names neither.
  find() does it over the mapped image. In the 1.0.2.1 executable: more than 6,000 natives, PLAYER_PED_ID's and
  SET_ENTITY_INVINCIBLE's hashes among them (the handler with the latter is the one El1xr's trainer calls for it).
- Game actions: call_native() passes a handler its call context (argument slots, the results' slots, the count;
  16-byte aligned slots), on the title's thread that runs its cheats. New requests: God(on), SET_ENTITY_INVINCIBLE
  on PLAYER_PED_ID's reference (`god <0|1>`), and Native { hash, args } (`native <0x hash> [slots]`, for tests).
  The natives are scanned at install and counted in the console.

The shape and the call context are kylepelham/El1xr's findings (third_party/victory/.../modmenu/natives.rs,
GPL-3.0); the hashes are modpapi/scripthook-vi's native database's (CC BY 4.0). Written here anew.

Tests: natives::tests (a handler's hash names it, near and far jumps; a hash at two handlers, a handler outside the
unwind table, other registers or a load through rsp or a check too deep name nothing; the unwind table read
sorted; the retail executable's natives with LEONIDA_GAME_DIR), game_actions spawn_tests
a_native_call_hands_its_handler_the_slots_and_the_count, and the new commands in script_commands_read. All pass.
Not yet seen in the running title.

AI-assisted (Claude). Tested on an RTX 4060 Ti 16 GB, driver 616.64, Ryzen 5 7600X (unit tests and the
executable check only).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 01:02:21 -05:00
89991dc8e0 Docs: the keyboard and mouse keys for players, and how the layout knows what the player is in
d3d12/README.md lists the keys on foot and in a vehicle. docs/gameinput.md
has the two tables with the pad button of each key, the GTA V keys left
out and why, the hand-over rule, what is read from the title (and that it
was read from the code, not yet seen running), the speed rule's limits and
the switches. docs/mod-menu.md counts the eleventh place.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 18:02:38 -05: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
590bc35a6c Teleport writer: skip zero or distant members; finder: leave camera-focus vectors out; record the result in docs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 04:43:51 -05:00
57e9ec4bf0 Probe: batches with bisection, wider z window, sector-relative frames, upstream detection; teleport waits for the finder
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 04:29:07 -05:00
6304460297 Finder: write probe finds what the derived position follows; teleport waits for it; threaded pointer scan on that struct
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 04:08:30 -05:00
082c18a361 Finder: strict candidate filters with counts, position-vector and double modes, threaded scan, no track cap bias
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 03:39:02 -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
9b11139408 Native scan: function starts only, 32-bit offsets from an unknown base (LEONIDA_NATIVE_U32)
Pointers into code must be .pdata function starts or follow int3 padding. In 32-bit mode,
runs of non-zero values with the same low nibble are checked against the function starts
to find the base they are offsets from, and the globals that hold that base.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 02:23:14 -05:00
7de60c0505 Diagnostics: LEONIDA_NATIVE_SCAN looks for the script engine's handler tables in the title's memory at run time
Walks committed memory (own-process ReadProcessMemory, nothing written) for runs of
pointers/RVAs into the executable section, lists the candidates with distinct
handler counts, overlaps and key-slot statistics, and the union of handlers.
Output goes to %TEMP%\leonida-natives, not the repository.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 01:45:24 -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
7b7d36a31b docs: the trainer menu on the merged renderer, what works, and the search for the script natives
docs/mod-menu.md, from ce5b53e8e (leonida/mod-menu), made true for the main
line after the renderer merge (00698e1e8): the three overlays and their keys
(F1 settings, F3 panel, F4 trainer) and how they share the keyboard and the
corner; host/trainer.rs in place of host/menu.rs; where the menu is drawn
at present and what that means with frame generation; the one atomic load a
present pays while it is closed; LEONIDA_MENU_OPEN=1 for a test without the
keyboard; the items that now drive the renderer's own settings (DLSS
sharpness in place of LEONIDA_SHARPEN, upstream's LEONIDA_FPS_CAP in place
of a second cap) and the ones that use capture.rs (screenshots, the rec
file); the tests as they are now. It says at the top that the menu has not
been tried in the running title yet. The licence findings and the search
for the script natives (counts only, no game bytes) are as they were.
d3d12/README.md: a row for the menu. docs/README.md: its row in the index.

Checked: python -I tests/test_docs_links.py, test_docs_table_rows.py,
test_docs_encoding.py, test_docs_list_items.py, test_docs_repeated_lines.py
(OK). test_docs_cli_flags.py, test_docs_env_vars.py, test_docs_python_deps.py
and test_docs_repo_paths.py fail on the main line already, on other files;
none of their failures names this document or a variable it describes.

AI-assisted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-26 22:59:38 -05:00