Commit Graph

34 Commits

Author SHA1 Message Date
32f0fe3ad9 leonida warm: only pipelines drawn with go into the pipeline library
With -PrecompileAll every known pipeline is made (some 88,000 against 4,000
drawn with). Those never drawn with now stay in the driver's cache alone and
are kept out of the pipeline library: the driver checks an entry of its own
cache against the pipeline asked for and compiles again where they differ,
while a library entry is taken as it was stored.

With them in the library (1.5 GB, 91,525 entries) the device was removed
twice during a burst of first loads in a new place (RTX 3060, driver 621.40):
no hang, no page fault, the library file whole. With them kept out, a run of
the same settings stayed up. The cause inside the driver is not known.

The rule is into_library(), with a unit test that fails without it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 17:30:37 -05:00
2d769e5f46 hle: skip the title's Bink movies on request (LEONIDA_SKIP_BINK)
LEONIDA_SKIP_BINK=1 skips the movies that play once (logos, the intro);
=all skips the looping ones too (menu backgrounds, which then stay dark).
Unset, nothing changes and no import is bound anew.

The title's Bink DLL still opens every movie. The exports a player loop
calls on an open movie (BinkWait, BinkDoFrame*, BinkNextFrame, BinkGoto,
BinkShouldSkip, BinkClose) are bound to wrappers that put a skipped movie
on its last frame and keep it from reaching the DLL, so the title's own
end-of-movie check closes it. The executable's imports and those of DLLs
the title loads later go through the wrapper; GetProcAddress does not.

The technique is from fxceless/victory-fork (pull request 613, by
C-GDev), as carried by trustno1-coder/VIctory-NVIDIA and
lobomfz/VIctory-xmem 0a4aadf (GPL-3.0); written anew for this loader.

Checked on an RX 6800 (Windows 11, driver 32.0.21030.2001): with =1 all
eight wrapped exports the executable imports from Bink2Scarlett.dll are
bound to the wrappers. Booting with no save and pressing Enter, the first
movie (3840x2160, 450 frames, not looping) was skipped and the title went
on to its setup screen. The unit test fails when the wrappers are not
bound.
2026-12-01 11:48:05 -05:00
c53cf975c5 D3D12-CLIPPY-NON-GPU-CRATES: fix all 31 clippy warnings outside leonida-gpu (#2681) 2026-12-01 11:38:45 +01:00
410fb011ea The precompile notes what it made per executable name, and fills a name's driver cache from the pipeline library
The driver keeps a cache on disk for each name a process runs under, and the launcher runs the game as
`leonida_sm.exe` (its Smooth Motion copy) when frame generation is off. `warm-done.txt` noted pipelines by
the translation alone, so after a precompile as `leonida.exe` a start as `leonida_sm.exe` made nothing,
and its world came up with some 1,700 pipelines still being loaded from the library, 5.4 s a frame
(run d291, stopped), where a start as `leonida.exe` had none (d292). A load from the library is quick
once the name's cache has seen the pipeline: 400 loaded as `leonida_sm.exe` took 43 s together the first
time (90th percentile 214 ms) and 16 s the next; as `leonida.exe` 28 s.

The notes are now per name (`<fingerprint>-<name>`; `leonida.exe` keeps the bare fingerprint, so what it
noted stands). Pipelines in the library already are not compiled again for another name: the store loads
them under that name, which fills its cache (with --again, after the cache was emptied, all of them).

AI-assisted (Claude). Tested on RTX 4060 Ti 16 GB, driver 616.64: type-checked; library loads timed as
both names (above); checked in a run with frame generation off after this commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 02:01:33 -05:00
6479135328 The precompile's store runs on as many threads as its processes, and notes each pipeline by what the library holds
The driver's own cache on disk does not keep all that the precompile's processes compile: of 400
pipelines a precompile had just made (run d287's), 116 were compiled again by the next process to ask
for them (138 s in all; the other 284 took about 2 ms each), with the launcher's own settings and with
none alike. That is why the game compiled some 1,700 pipelines in the world right after a precompile,
and why the store's one thread took over nine minutes for its first thousand (run d288, stopped). It now
works on as many threads as the precompile has processes (8 on a 12-thread CPU), as the game's pipeline
workers do; whether each pipeline ended in the library (loaded from it, or made and stored) is taken
from the library call itself, not from counters other threads move too. A store that ended badly twice
for one translation is not tried again for it (`library-failed.txt`).

AI-assisted (Claude). Tested on RTX 4060 Ti 16 GB, driver 616.64: type-checked; the same 30 and 400
pipelines timed as a precompile worker, as the store with the 1.6 GB library and with an empty one
(each stopped before writing); checked in a run of the game after this commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 01:13:46 -05:00
d22cd3b6bb The precompile puts its pipelines into the pipeline library, which the game loads them from
The precompile (`leonida warm`) left the pipelines it made to the driver's own cache on disk, and the
game's runs did not take them from it: right after a precompile that had made them, 1,100 to 2,300
pipelines were "being made" in the first world frames (runs d257, d285, d286, d287), compiled again at
a few to thirty a second while frames took 2 to 10 s (the launcher waits up to 10 s a frame for a
pipeline), and in d287 none of the driver's cache files was written in the four minutes the game
compiled 1,700 pipelines. The game loads pipelines from the pipeline library (a run of 2026-11-27:
2,338 loaded, none made), which it writes only at a run's normal end, and the library on this PC was
last written on 2026-11-29: every change of the translator since meant minutes of compiling in the
world at the next start.

After making them, the precompile now puts those of this translation that are not in the library yet
into it, in one process of its own (`warm --store`): with the library and the static sampler list in
use before its device is made, as the game has them, each pipeline is loaded by the name the game looks
it up by or made (from the driver's cache the processes before filled) and stored; then the library is
written. They are noted in `library-done.txt` only once it is written; a store that fails leaves things
as they were. `LEONIDA_WARM_LIBRARY=0` leaves the library alone, as before.

AI-assisted (Claude). Tested on RTX 4060 Ti 16 GB, driver 616.64: type-checked; checked in a run of the
game right after this commit (see the next one).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 00:51:55 -05:00
58db554c7d d3d12: a test runs leonida and finds the settings line in its log (review)
The unit tests of settings_line could only fail on main by not building.
This one runs the built binary on a title that does not exist, with two
LEONIDA_ settings, one a folder, and reads its log: on main there is no
settings line and it fails by assertion; with the change the line names
both settings and shows the folder only by its length.
2026-11-30 19:32:01 +01:00
4d18c0d3b4 d3d12: a run logs the LEONIDA_ settings it starts with (D3D12-RUN-SETTINGS-LINE)
A tester could not show from a run's log that a switch was on. `leonida
run` now logs one line, under the `settings` target, with every LEONIDA_
variable present, sorted, as NAME=value. A value with any character other
than letters, digits, space and ._,:+=*- (a folder, which names the user,
a file, a command line) shows only its length, so posted logs carry no
path; one longer than 120 characters is cut. Names that came from an older
VICTORY_ name say so. `LEONIDA_LOG=warn,settings=info` keeps the line on
its own.

It says what a run was started with, not that the code read it.
2026-11-30 19:08:50 +01: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
33991d48c7 Trainer menu: God mode works through the title's natives, and is kept up while on
The menu's God mode item (player.god) was dimmed for want of the title's script natives. With the natives found by
their handlers (5f8f20d77) it is available when PLAYER_PED_ID and SET_ENTITY_INVINCIBLE were both found and the
player is in the world; turning it on or off asks for Request::God on the title's thread. While it is on, the
player is made invincible again every 60 of the title's updates: a ped made anew (after a death, or a change of
character) is not. The run script's `god <0|1>` does the same.

Tests: the game_actions tests pass. Not yet seen in the running title.

AI-assisted (Claude).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 01:09:34 -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
6dae2ac1d0 Game actions: spawn a vehicle of any model through the title's own vehicle spawn (spawn <name|0x key>)
The title's nine vehicle cheats are each `sub rsp, 28h; mov rcx, <model key>; call <spawn>`: the spawn takes one
64-bit model key. A new request, Spawn(key), calls that function with another model's key on the title's thread
that runs its cheats (the deferred queue the other game actions use), as the cheats do: ahead of the player, the
vehicle the spawn made before going as with the cheats.

- The function is read from the cheat table found already (Site::CheatTable): every handler of that form must
  call the same function, inside the image, two or more of them (spawn_call_target, spawn_function). No address
  and no new pattern.
- A model's key is the low 64 bits of MurmurHash3_x64_128 (seed 0) of its lower-cased name (model_key, written
  from the algorithm's definition): checked against the 1.0.2.1 executable, where a vehicle cheat's key is that
  hash of a model's name. The form is kylepelham/El1xr's finding (modmenu/names.rs, GPL-3.0); their trainer's
  spawn is a port of tsuremen2/MandyMenu (GPL-3.0) after XeMo's PS5 research. No names are kept here: a script
  or the user names the model.
- LEONIDA_GAME_ACTIONS_RUN takes `spawn <model name|0x key>`.

Tests: model_keys_are_murmur3_x64_128_of_the_lower_cased_name (the algorithm's published vectors), and
a_vehicle_cheat_gives_the_spawn_it_calls; script_commands_read takes the new command. All of the game_actions
tests pass. Not yet seen in the running title (the game-actions tour comes next).

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 00:20:32 -05:00
9da3f83bbb Merge pull request #2557 from owenjbendon-creator/win10-agility-loader
d3d12: Windows 10 runs the D3D12 runtime with the Agility SDK (D3D12-RUNTIME-WIN10-AGILITY)
2026-11-28 21:19:50 +01:00
dd26534459 agility: a section past u32::MAX is no section, not an overflow (review of #2557)
exported_sdk_version's section lookup added va + size and rva - va + raw
unchecked: a malformed or truncated D3D12Core.dll could panic there in a
build with overflow checks. Both are checked now, and such a section is
skipped (None), as zmasi suggested in the review.

New test exported_sdk_version_is_none_for_a_section_past_u32_max: with
overflow checks on (CARGO_PROFILE_DIAG_OVERFLOW_CHECKS=true) it fails
before this change ("attempt to add with overflow") and passes after;
agility::tests 6 passed on Windows 10 22H2, RTX 3090.

Written with AI assistance (Claude).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 15:30:25 +00:00
99bb9dadfe d3d12: Windows 10 runs the D3D12 runtime with the Agility SDK (D3D12-RUNTIME-WIN10-AGILITY)
Windows 10's own Direct3D 12 stops at shader model 6.5 and refuses the
heap-directly-indexed root signatures every translated pipeline uses, so on
Windows 10 leonida.exe made no host pipeline at all.

leonida.exe now exports D3D12SDKVersion and D3D12SDKPath (.\D3D12\), so
Windows loads Microsoft's newer runtime from a D3D12 folder beside it.
D3D12SDKVersion is set first thing in main to the version of the
D3D12Core.dll that is there (a mismatch makes Windows refuse Direct3D 12,
0x887E0003), or to Windows' own runtime's without one, so nothing changes on
Windows 11. d3d12.dll is delay-loaded so that Windows reads the version main
set. Get-D3D12.cmd (scripts\get-d3d12.ps1) fetches Agility SDK 1.614.1 from
nuget.org with pinned SHA-256s and a Microsoft signature check, and
play-nvidia.ps1 stops with that hint on Windows 10 without the folder.

Ported from trustno1-coder/VIctory-NVIDIA (GPL-3.0-or-later), commits
10862a6, e69e39c, f3534e6 and 0f0ada1 there.

Tested on Windows 10 Pro 22H2 (19045), RTX 3090, driver 610.88, Ryzen 7
9800X3D: `leonida warm --used --again --limit 30` made 30 of 30 host
pipelines with D3D12\D3D12Core.dll (1.620) beside the exe, and 30 of 30 had
no host pipeline without it. New tests: agility::tests (version and export
parsing, Windows' own runtime: it exports D3D12SDKVersion 2 on Windows 10
22H2) and tests/agility.rs (the exe exports both symbols; d3d12.dll is
delay-loaded, not imported).

Written with AI assistance (Claude).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 03:17:47 +00:00
963c31c1f1 leonida warm: a pipeline that got no host pipeline is not written down as done (LEONIDA_WARM_DONE_ALL=1: as before)
One left out by the warm's switches or refused went into warm-done.txt, so a
later warm under other switches passed it over for good and the run made it in
play, with the driver's background compile behind it. Only those that have a
host pipeline are done now; the others are asked again by the next warm.

From trustno1-coder/VIctory-NVIDIA 5ed66db74f6d (Yorivel; there a cherry-pick of
4f2be389a4da), GPL-3.0. Its numbers, RTX 4090 with ray tracing: about 670
pipelines being made in a run's first minutes, frames of 3 to 10 s while the
D3D background threads compiled. Not measured here.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 22:14:14 -05:00
4e55134cde Keyboard and mouse: what the player is in is read from the title, and LEONIDA_PED_DUMP
apps/leonida/src/player_context.rs tells gameinput whether the player is
on foot or in a vehicle. A thread of ours reads a few words of the title
every 16 ms through ReadProcessMemory on the own process: nothing is
written, no title code is called, and it does not need
LEONIDA_GAME_ACTIONS=1 (without the game actions it looks the two globals
up itself at start: two passes over the code, about 0.15 s).

What says "in a vehicle", the first there is:
- LEONIDA_PED_VEHICLE_AT=0x<offset>: a pointer in the player's ped that is
  null on foot. None is known, so unset.
- The title's own global of the player's vehicle: a new place in
  leonida-loader's game_actions (Site::PlayerVehicle, a pattern that is in
  the 1.0.2.1 executable once). Read from the code, not seen in the running
  title yet: the global is written by one function, called with a vehicle
  from a large function, with null where a ped that is the player is taken
  out of a vehicle, and with what the title's "the vehicle this ped is in"
  gives when the player's ped is set. LEONIDA_PLAYER_VEHICLE_AT names
  another global, or turns it off.
- LEONIDA_KBM_SPEED=1: the speed rule (12 m/s for a second; never from a
  standstill, never "on foot"). Off unless asked for, and always run as a
  check of the two above, into the log.

LEONIDA_PED_DUMP=<folder outside the repository>: F8 in the game's window,
or a file named dump there, writes the first 0x4000 bytes of the player's
ped (and 0x1000 of the vehicle the global names) with a line in index.txt,
for measuring by comparing a dump on foot with one in a car.

leonida-loader: resolve_some and find look for some of the places only.

Checked: cargo test -p leonida-loader game_actions with LEONIDA_GAME_DIR
(every place once in the retail executable), cargo test -p leonida --
player_context game_actions, cargo check --profile diag -p leonida
--features diagnostics,mimalloc. Not run in the game yet.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 18:02:38 -05:00
4b22da0877 Merge branch 'feat/game-actions' into port/d3d12-nvidia 2026-11-27 12:27:00 -05:00
a83d7670eb Series X with DLSS: the upscaler's context is made of the sizes the title's DLL ships
With LEONIDA_FSR_UPSCALER=1 on the Series X profile the title asks its FidelityFX DLL for a
context of 2560x1440 to 3840x2160. The DLL ships the tables of one fixed mode and refuses it
("maxUpscaleSize must be 1920x1080; received 3840x2160"); the title goes on without a context,
its jitter phase count stays zero and its frame counter is divided by it after the first
upscale (0xC0000094 at title+0x28f03e8, run of 2026-11-27 with -FrameGen 2).

While the dispatch is ours (LEONIDA_UPSCALE=stretch|dlss) ffxCreateContext is taken too: the
DLL is asked for the context it does make (1280x720 to 1920x1080), which then only answers the
title's queries; the title's description is put back after the call.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 12:27:00 -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
193152d00a Series X: DLSS and frame generation through the title's FidelityFX upscaler
DLSS and the frame generation tags were Series S only because both hang on
ffxDispatch, and the title only upscales through FidelityFX when its device
type is a Series S: on Series X its own temporal upscaler runs, as passes of
its own that hand nothing over.

LEONIDA_FSR_UPSCALER=1 gives every console the Series S answer in the
upscaler choice (rva 0x7e941f, `test al, al` -> `or al, 1`: FidelityFX when
the title has it). Off Series S that upscaler renders at scale 1.0, by a load
of its own, which LEONIDA_RENDER_SCALE now points at the scale as well
(constants for 1/3, 0.4, 0.5, 0.58, 0.6, 2/3, 0.75 and 1). The launcher takes
ffxDispatch on Series X too when that switch is on.

Frame generation is tagged from a stretched upscale as well, and says once
when no upscale has handed anything over.

Every place and constant is checked against the 1.0.2.1 executable by a test
that reads LEONIDA_GAME_DIR. Not run in the game yet.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 12:01:01 -05:00
2aea01bcaa Port 2: the title's descriptor-table stores tell their slots (LEONIDA_PORT_DESCRIPTORS=1, off by default)
Ported from Belobug/VIctory-Belobug-AMD d3cf70dc (renderer port 2, GPL-3.0;
introduced in 9997d25, memcpy marks 4cb90be, disjoint parts 4ad8527).

The six stores of the 1.0.2.1 executable's descriptor-table fillers
(+0x4d9efd0, +0x4eec8e0) are patched, byte-checked and behind the build's
hash, to set a byte per slot in maps of ours; sync_heaps takes the marked
slots in place of asking the write watch of the heap and reading ~290 changed
pages. Marked runs are coalesced (gaps up to 64 slots) into disjoint parts
(plan_parts), our own Create*View/CopyDescriptors marks too, and the title's
memcpy/memmove imports (chained after titlewrite's) mark the view records
they copy in. A fallback asks the watch every 8 frames (..._EVERY) and looks
at 16 pages whole (..._CHECK; 0: never asks), counting view records no mark
told of with the code that last faulted on their block.

Every site is left alone if its bytes differ or the hash is not the build's;
with a site unpatched the page route stays. With LEONIDA_AB naming the
switch, the stores are patched at start and the sync side toggles live.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 08:09:57 -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
f4333dea6b Find the local player's transform in memory (LEONIDA_FIND_PLAYER) and write a new position into it
Diagnostics: lists unit-axis transforms in writable memory, samples them against the held keys, ranks the ones
that move with W/S/D and stay put otherwise, then searches pointer paths from the title's image to the best
ones (paths.txt). player.rs follows those paths and moves the player (LEONIDA_TELEPORT).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 02:45:49 -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
130ada08ba Offer a mimalloc build of the runtime (cargo feature, off by default)
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>
2026-11-27 01:16:38 -05:00
4451198973 leonida-gpu, hle, app: wire the Lua mods into the renderer, the input shim and the start-up
What: the renderer starts the mods' thread where it makes the presenter
(leonida_lua::start(), before the menu's, so the F4 menu has its Mods page), calls
leonida_lua::tick() once per present (one atomic load with LEONIDA_LUA=0), draws the
mods' overlay with a second trainer Overlay at the place the drawing says
(Frame::origin), before the F4 menu, and lends the mods checked reads and writes of
the title's memory (host::lua_read over read_into; lua_write over safecopy::copy,
or NtWriteVirtualMemory with LEONIDA_SAFE_COPY=0). The input shim adds the keys mods
hold (knobs::injected_keys) to what it already feeds the title for LEONIDA_KEYS and
LEONIDA_KEYS_FILE. The app tells the mods where the title's image is mapped.
Why: the pieces of the last two commits were not connected to anything.
How checked: cargo check --profile diag -p leonida --features diagnostics and
cargo check -p leonida-gpu --features diagnostics --tests (no new warnings). NOT run:
no GPU test (the GPU was in use) and not the title; plain `cargo check -p leonida`
(no diagnostics) already fails on the base at gameinput.rs `held_from_file()`, which
only exists with the feature - left as it is. AI-assisted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 00:11:49 -05:00
00698e1e84 d3d12: the runtime takes trustno1-coder/VIctory-NVIDIA b190242 (CGBJ's renderer, DLSS, frame generation, F1 menu)
Upstream's four commits past 6a31e43 (5b36758, 9e7ab9d, 6395727, b190242;
GPL-3.0), brought in as a three-way merge: upstream's trees before and after
written under Leonida's names (crates leonida-*, LEONIDA_* settings) and the
difference merged onto Leonida's own changes. What comes with it, by its
authors:
- the renderer of codec-d/cool_fox f4b48ad (CGBJ) with trustno1-coder's NVIDIA
  fixes on top (residency.rs, stretch.rs, the title's upscale dispatch);
- DLSS for the title's upscale, from avatarmanz/VIctory-7900XTX pull request
  203 (feature dlss, LEONIDA_UPSCALE=dlss): the game renders its own 720p and
  DLSS takes it to 1080p on the Series S profile;
- DLSS frame generation through NVIDIA Streamline (streamline.rs, fg.rs), an
  F1 settings menu (host/menu.rs), LEONIDA_FPS_CAP, real ray tracing as an
  option (LEONIDA_BVH_BUILDER=1: the structure builder runs on NVIDIA).
NVIDIA's own files (DLSS, Streamline) are not part of the repository:
d3d12/Get-NVIDIA-DLSS.cmd fetches them from NVIDIA's GitHub into
d3d12/nvidia-sdk/ (git-ignored).

Where both sides had changed the same lines:
- compose.rs is upstream's (planes drawn by a pixel shader into the back
  buffer); Leonida's LEONIDA_SHARPEN lived in the compute pass it replaces
  and is not in this commit (DLSS has its own sharpness setting).
- draw.rs keeps Leonida's slow-beat texture re-check (300 frames by default);
  upstream's switch of the same name is dropped.
- ambient.rs keeps LEONIDA_AMBIENT_MOST and the reflection guard.
- play-nvidia.ps1 is upstream's with Leonida's defaults put back while rays
  are off: strict indirect batches (INDIRECT_BATCH=1), the light stand-in
  (AMBIENT=0.8, AMBIENT_MOST=2), ray walks ended at the root and the
  ray-resolve skip list. With upstream's defaults (stand-in off, no skip
  list) shade was black and the sky white in the world, and the card worked
  33-50 ms a frame (run n1).
- scripts/play-d3d12.ps1 follows the new launcher: DLSS by default, a shader
  cache of its own (cache-2), -NoDlss, -RayTracing, -Capture, -Log.

Builds with and without the dlss feature (cargo build --profile diag
-p leonida --features diagnostics[,dlss]). In the world on an RTX 4060 Ti 16 GB
(driver as installed) and a Ryzen 5 7600X: DLSS starts (1280x720 to
1920x1080), about 14 fps where it was 13.4. The picture is not right yet: a
posterized look in run n2 is being traced. AI-assisted.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-26 21:48:18 -05:00
fee07ff779 d3d12: Leonida's D3D12 runtime under its own name
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>
2026-11-26 16:11:32 -05:00