d3d12: F4 trainer player, vehicle, weapon and world items through the title's natives, money and vehicle parts (D3D12-F4-TRAINER-NATIVES) #3114
Open
github-bot
wants to merge 9 commits from
github-bot/gh-3114 into main
AGit
pull from: github-bot/gh-3114
merge into: github:main
github:main
github:perf/darner-title-priority-ceiling
github:gh-readonly-queue/main/pr-3311-b5c45b663dbc5a9c3532bb3f307e5f81b32faefa
github:gh-readonly-queue/main/pr-3088-af22e7847ff5808f72d1a1881c24be2fafd20b54
github:gh-readonly-queue/main/pr-3123-7f3fa026a94c6646e89244f28e1ce22290361867
github:gh-readonly-queue/main/pr-3354-637baa0b77ba47222e7280b17c1a59c6a1781d57
github:gh-readonly-queue/main/pr-3365-d7a0e0196a43834813014b4bd3aa5502a8263b14
github:gh-readonly-queue/main/pr-3361-5dfe8bbd05ed12fb2f2e1718d9af77a7c5f46fd8
github:gh-readonly-queue/main/pr-3366-8da9148204e9d12c585efa9ac2b7cc1ab08c7682
github:fix/runtime-test-conservative-fixtures
github:ci/shard-semantic-linux
github:docs/fg-limit-fps-switch
github:fix/runtime-test-fixture-paths
github:fix/runtime-test-fixture-readers
github:fix/read-file-hard-link
github:fix/book-slot-heap-never-read
github:fix/depth-resolve-spv-path
github:fix/indirect-unused-batched
github:gh-pr/3358/base
github:fix/xmem-refusal-diagnostics
github:gh-pr/3357/base
github:ci/shorten-ci-time
github:fix/alias-later-queued-submissions
github:claude/gallant-sagan-aamatr
github:gh-pr/3342/base
github:gh-pr/3341/base
github:d3d12/agility-sdk-621
github:gh-pr/3293/base
github:gh-pr/3319/base
github:gh-pr/3318/base
github:gh-pr/3315/base
github:gh-pr/3313/base
github:gh-pr/3314/base
github:claude/fervent-curie-m19lnr
github:gh-pr/3216/base
github:gh-pr/3272/base
github:gh-pr/3276/base
github:gh-pr/3279/base
github:gh-pr/3257/base
github:gh-pr/3258/base
github:gh-pr/3271/base
github:codex/skip-no-hit-ray-passes
github:gh-pr/3230/base
github:gh-pr/3266/base
github:gh-pr/3247/base
github:gh-pr/3246/base
github:gh-pr/3244/base
github:claude/sharp-sagan-1jqnp3
github:t3/preserve-fsr-sdk-restart-path
github:t3/propagate-host-failure-hresult
github:t3/launcher-custom-parameters
github:t3/series-x-2160-startup
github:codex/d3d12-uncapped-simulation
github:ci/less-to-run
github:perf/native-compute-shader-forms
github:claude/blissful-franklin-ukp7ag
github:codex/full-precompile-default
github:gh-pr/3166/base
github:gh-pr/3148/base
github:gh-pr/3138/base
github:gh-pr/3106/base
github:gh-pr/3057/base
github:gh-pr/2756/base
github:gh-pr/2812/base
github:gh-pr/3032/base
github:gh-pr/2992/base
github:notes/card-time-and-plant-flicker
github:gh-pr/2986/base
github:gh-pr/3000/base
github:gh-pr/2966/base
github:gh-pr/2924/base
github:gh-pr/726/base
github:gh-pr/2761/base
github:gh-pr/2663/base
github:gh-pr/2861/base
github:gh-pr/2862/base
github:gh-pr/2820/base
github:gh-pr/2811/base
github:gh-pr/2803/base
github:rt-call-trace
github:gh-pr/2802/base
github:gh-pr/2766/base
github:perf/ahead-split
github:gh-pr/2589/base
github:gh-pr/2699/base
github:gh-pr/2696/base
github:docs/readme-runtime-proposal
github:gh-pr/1346/base
github:codex/coord-claim-check-20261124-7e48
No reviewers
Labels
Clear labels
accessibility
Barrier affecting people with disabilities
area: ci
.github/ workflows and settings
area: d3d12
The D3D12 runtime in d3d12/ (Rust: leonida.exe and its crates)
area: docs
Documentation
area: launcher
The launcher (launcher/)
area: runtime (legacy)
The earlier Vulkan runtime in runtime/
area: shader translator
The shader translator (leonida-shader, tools/rdna2spirv) and its tests
area: tools
tools/ and scripts/
area: viewer
The map viewer (viewer/)
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
duplicate
This issue or pull request already exists
enhancement
New feature or request
good first issue
Good for newcomers
help wanted
Extra attention is needed
invalid
This doesn't seem right
missing claim
Needs a claim in #14
needs in-game run
Changes the code a frame runs through: needs the 300 s in-game gate (docs/game_gate.md)
needs rebase
Conflicts with the base branch: rebase it on main
needs-triage
Needs maintainer evaluation before the next triage state
question
Further information is requested
ready-for-agent
Fully specified and ready for an AFK agent
submodules
Pull requests that update submodules code
wontfix
This will not be worked on
No labels
accessibility
area: ci
area: d3d12
area: docs
area: launcher
area: runtime (legacy)
area: shader translator
area: tools
area: viewer
bug
dependencies
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs in-game run
needs rebase
needs-triage
question
ready-for-agent
submodules
wontfix
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!3114
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3114"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@matthieupl87-spec on GitHub · 2026-12-02 11:30 UTC · original
matthieupl87-spec:f4-trainer-natives→main· +788 −19 · 3 files · 9 commits · openClaimed in the coordination issue as: D3D12-F4-TRAINER-NATIVES
What and why
The F4 trainer's player, vehicle, weapon and world items had no effect on 1.0.2.1. This wires them through the title's own natives, run from the game-actions update on the title's thread (
d3d12/apps/leonida/src/game_actions/effects.rs), plus two items read or written in memory:samples/trainer/trainer.hpp,trainer::cash, MIT licence), found from the title's balance native. It is rewritten here, not copied.hash x quantity.Never wanted on
mainreads the wanted level at a place that gives 0 on 1.0.2.1 while the police chase, so it never cleared anything. It now goes through the title's natives:_SET_DISABLE_PLAYER_WANTED_LEVEL,SET_POLICE_IGNORE_PLAYERandSET_MAX_WANTED_LEVEL(0), with the old maximum put back when it is turned off. Seen in game: crimes gave no stars.A toggle is given again now and then, because a new ped or vehicle (after a death, a character switch or another car) does not carry it. A toggle whose subject is missing (no vehicle) waits quietly.
The memory places are 1.0.2.1's only.
known_buildchecks the player place before anything is read or written; on another build those items say they are not available. This is the same check as #3009'swarp::supported_build. The player place is found by its pattern at start, so it lands on that exact address only in this build. The native hashes are from the community nativedb (CC BY 4.0) and were checked against the title's native table at start.Not in this PR:
*_DENSITY_MULTIPLIER_THIS_FRAME,SET_CREATE_RANDOM_COPSandSET_GRAVITY_LEVELnatives were taken without error but changed nothing on screen, so these menu items stay as they are onmain.VI_GIVE_ITEM_TO_PED_ASYNCcalled from here ends the title: it needs a script's task context. The finding is posted in #2570.Tested
On 1.0.2.1, Windows 11, diag build through
scripts/build-nvidia.ps1. The build has one local commit outside this PR, inrun.rs, unrelated.to 20 000(the log showscash 19105 -> 20000 $). The real balance changes at once. The HUD figure updates at the next purchase.cash 14 -> 20000 $. The value was then saved: the next manual save holds it in Jason's inventory.cargo test --locked --profile diag -p leonida --features diagnostics,mimalloc -- game_actions vehicle item_names(15 passed)cargo test --locked --profile diag -p leonida-menu(49 passed)python -I scripts/check_no_game_data.pypasses.GPUs tested: NVIDIA GeForce RTX 5070 Ti 16 GB, driver 621.47, Windows 11 Pro
AI-assisted: yes. Claude Code (Claude Opus 5.5) wrote the code with me. A separate read-only Claude reviewer agent read the diff before this PR.
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)🤖 Generated with Claude Code
@matthieupl87-spec on GitHub · 2026-12-02 12:40 UTC · original
Progress from more play-testing on 1.0.2.1, and where the menu is going next. Same rig as in the description.
Confirmed in game since the description:
main) alone does not stop stars: crimes still bring the police. On my local branch, a toggle that also calls_SET_DISABLE_PLAYER_WANTED_LEVEL,SET_POLICE_IGNORE_PLAYERandSET_MAX_WANTED_LEVEL(0)works, but only with Never wanted on as well. With both on, no police come at all. I will bring it here once I know which of those calls does the work.Open problems I am working on (local branch, not in this PR yet):
SET_VEHICLE_IS_STOLEN(false),SET_VEHICLE_HAS_BEEN_OWNED_BY_PLAYER(true)andSET_VEHICLE_INFLUENCES_WANTED_LEVEL(false)on the current vehicle do not change that.integrated_tracker,tracker,advanced_trackerandmilitary_tracker. Scripts use them with three unnamed vehicle natives:_0x5F92584040AFFA8B(vehicle, int) -> int,_0xBAF45734DD937C4E(vehicle, int)and_0xF8D9720AB9633C40(vehicle, int).GET_CLOSEST_VEHICLEreturns 0 on this build every time: within 4 m of the spot where the vehicle was just created, both with flags 70 and 0. So the spawned vehicle's handle has to come another way.SET_VEHICLE_CAN_BE_VISIBLY_DAMAGED,SET_ENTITY_CAN_BE_DAMAGEDandSET_VEHICLE_STRONGso the body does not dent.Each piece will come as a separate PR once it works in game.
A word from me (Pooldead): my PC is a Ryzen 5 5600X, an RTX 5070 Ti and 32 GB of DDR4. The game runs at about 15 fps here. I am waiting for the optimisations the project brings, and meanwhile I prefer to contribute to the menu: I can run it and do the tests in game. Thank you all for contributing to this project. It is magnificent.
AI-assisted (Claude Code).
@MoonEyes on GitHub · 2026-12-02 12:41 UTC · original
This pull request touches the render path, so it needs an in-game run before it can be merged: unit tests and CI do not catch rendering regressions (a device loss after an earlier merge is why this gate exists).
Could you, or anyone with a working setup, post a run report on the current head merged onto current
main:mainSHA it was merged onto;mainalone for comparison, if you can.Please do not attach logs or screenshots that show game content. If a run on this exact head is already posted, a link to it in a reply is enough.
AI-assisted (Claude Code).
@Kal0s-design on GitHub · 2026-12-02 13:00 UTC · original
Ran natively on Windows 11, head
609eb190bmerged into currentmain(23a51c494, clean merge). I used a plain debug build (overflow checks on) with default features, not thediagprofile withdiagnostics,mimallocfrom the description.d3d12/)cargo test --locked -p leonida --binsgame_actions::effects)cargo test --locked -p leonida-menucargo clippy --locked -p leonida --bins --testsgame_actions.rs,game_actions/effects.rsortree.rs(the one warning is inleonida-gpu/src/host.rs, already onmain)cargo clippy --locked -p leonida-menu --libtree.rsleonida-menuhas 48#[test]functions both on this branch and on currentmain, so the 49 in the description probably comes from a different base. None of the 20 ids inTOGGLES,GRAVITYandACTIONSis matched earlier inavailable,valueorapply, so all of them reacheffects.The memory-reading code can run without the game, so I tried it with throwaway tests in
effects.rs(not committed).cash_amount_aton a synthetic inventory. I built the layout from your doc comment in heap memory: the manager map at+0x77C8/+0x77D0, the0xC0000003inventory with its tag at+0x0C, and an item map holding twocurrency_cashitems. One item's parent has the player's tag at+0x40and the other's has a different tag.cash_amount_atreturned the player's+0x18and skipped the other item, which matches what you saw in game.find_partsnever tries the last offset. The scan is0..block.len().saturating_sub(0x1C). The check needso + 0x1C <= len, soo == len - 0x1Cis never tried. Here is a 0x1C-byte block that holds a complete one-item list (cap 1, count 1, first 9, 0, then the item with id 9):Only a one-item list ending exactly at
PARTS_BLOCK_LENhits this, so it's narrow.0..=block.len().saturating_sub(0x1C)should cover it, sinceword()already givesNonepast the end, but I didn't run that change. Oversized counts are refused without a panic (cap/count 0x100 in a 0x800 block givesNone), and blocks of every length from 0 to 63 bytes don't panic.map_slotswalkscountgroups. This one is a question. With the player's inventory in the second group of a two-group map and the count word set to 1,cash_amount_atreturnsNone. That's what the function says it does, and it's right if+0x77C8holds the number of groups. If it holds the number of entries, an inventory in a later group would not be found. Do you know which it is?From reading the code (no test): No reload and Infinite ammo both call
SET_PED_INFINITE_AMMO_CLIP(ped, on). With both on, switching one off sendsfalseat the next update, and the clip stays finite until the other toggle's next refresh. That's up to 15 updates if Infinite ammo is still on, up to 60 if No reload is. It could look like turning off No reload also turned off Infinite ammo. Sendingno_reload || infinite_ammofrom both would avoid that.Not checked: the game. Nothing that calls natives (
keep_up,run, the vehicle resolver at0xD35050) can run without the title, and I had no 1.0.2.1 image, so the hashes and places weren't checked against the binary either.GPUs tested: n/a (CPU-only tests).
AI-assisted: yes (Claude Code).
@matthieupl87-spec on GitHub · 2026-12-02 13:28 UTC · original
Run report for the current head, as asked.
609eb190b, merged ontomainbf7886746(merge3d03fa8a7). One local commit outside both, inrun.rs(theLEONIDA_PATCHstart-up byte patch, so my story saves load), unrelated to rendering.scripts/build-nvidia.ps1; launched throughscripts/play-d3d12.ps1withLEONIDA_GAME_ACTIONS=1. The shader cache was rebuilt for this build before the run.main, not the menu.mainalone: not run on this exactmainyet. My earlier runs ofmainon this rig gave a similar 13-15 fps median.AI-assisted (Claude Code).
@matthieupl87-spec on GitHub · 2026-12-02 13:36 UTC · original
Second run on the same build (head
609eb190bmerged ontomainbf7886746), this time using the menu.main.AI-assisted (Claude Code).
@matthieupl87-spec on GitHub · 2026-12-02 13:39 UTC · original
Pushed
057bd7cc2:I will post a new run report on this head. AI-assisted (Claude Code).
@matthieupl87-spec on GitHub · 2026-12-02 13:59 UTC · original
Run report on the current head
feb5d5453, merged ontomainbf7886746(merge91b782a09). As before, there is one local commit outside both, inrun.rs(theLEONIDA_PATCHstart-up byte patch, so my story saves load), unrelated to rendering.scripts/play-d3d12.ps1,LEONIDA_GAME_ACTIONS=1.Together with the two runs above on
057bd7cc2(0 crashes, medians 15 and 18 fps), this head has shown no rendering problem here. The only change since057bd7cc2is the moon gravity item left out ofeffects.rs.In game, the menu items in this PR:
AI-assisted (Claude Code).
@matthieupl87-spec on GitHub · 2026-12-02 14:02 UTC · original
@MoonEyes, a note on scope, so the run above is not misread: vehicle spawning by model is not in this PR, and it was not in the build I ran. In that build, Spawn selected still behaves as on
main(the model is not found on 1.0.2.1).The spawn fix is offered to #3009 instead, since it builds on Phlanka's spawner: one commit,
623779c2a, on top of #3009's head29bcd2471(comment). With it, the 315 models of 1.0.2.1 spawn on the ground in front of the player; I tested that separately (0 crashes).The run report above covers only this PR's head
feb5d5453.AI-assisted (Claude Code).
@matthieupl87-spec on GitHub · 2026-12-02 14:10 UTC · original
@Kal0s-design, thank you for the review. Pushed
5bd4b50f4:no_reload || infinite_ammotoSET_PED_INFINITE_AMMO_CLIP, so turning one off no longer takes the clip from the other. There is a unit test for it.find_partsexact fit: the range is now0..=block.len().saturating_sub(0x1C). A one-item list that ends exactly at the end of the block is in the test.+0x77C8: it is the number of groups. That is how fraustiz/fro-trainer reads the title's balance native (_0x816B3FF0E9A2B799): itscash::Carriedwalks that many groups of 16 control bytes plus 16 slots, the same asmap_slotshere. The item map's+0x60is read the same way. In game, on 1.0.2.1, this found Jason's inventory and his cash every time I used Money. I did not log the count's value, though, so the game runs do not prove it on their own: if Jason's inventory sits in the first group, both readings find it.Tests: the
leonidafilter (16 passed),leonida-menu(48 passed),check_no_game_data.pypasses. Not run in game yet; the change touches only these two items.AI-assisted (Claude Code).
@matthieupl87-spec on GitHub · 2026-12-02 15:33 UTC · original
@MoonEyes, one small addition while you review. Pushed
c4ebe52de:_0x5F92584040AFFA8Basks,0xBAF45734DD937C4Eand0xF8D9720AB9633C40set). It gives the slot's kind and 0 to each setter, then the kind and the tracker it holds, and logs each step.Seen in game (my local build, which also has #3009's spawn and one local commit outside this PR, in
run.rs, unrelated): spawned cars, then got in. The car is no longer tracked and counts as the player's (Jason / Lucia). Also seen when spawning while already driving an earlier spawned car. Not proven: the ask native still returns the same value after the setters, so which setter does the work is not known yet; the log shows all of them.For #3009: the automatic removal hangs on one call,
effects::spawned(self, frame). In this PR it is on the cheat spawn path. Once both PRs are in, the same line after #3009's spawn (whenvehicle_spawn::take_spot()gives a spot) covers its 315 models. Happy to send that as a follow-up.Tests: the
leonidafilter (16 passed), the menu crate (48 passed),check_no_game_data.pypasses. Not run in game on this branch itself.AI-assisted (Claude Code).
@MoonEyes on GitHub · 2026-12-02 17:07 UTC · original
RUN (in game, batch of eleven render-path pull requests), each head merged with
git merge --no-ffonto main3c106eb2f, in one build: #3071c2065b540, #298265155eceb, #296400a068106, #310779333e26b, #2833823087ec3, #2947b07f64346, #291933e2e4c13, #2962a4a26ec63, #2847c8b950cb4, #3114c4ebe52de, #26640e2b6287c. RTX 4060 8 GB, driver 610.88, Windows 11. Series S,-Resolution 1080, frame generation 2x, the same walking route as the other runs on this machine, 330 s after reaching the world.For reference, the same machine and route rendered 13.3 to 17.2 fps today on main with single pull requests or other batches. These fps are a check that nothing fell over, not a measurement of a gain.
Verdict: PASS for the in-game gate (300 s or more in the world, no device loss) for this batch, on the heads listed above. If one of these pull requests changes its head, this run no longer covers it.
Limits: one run; free system memory was low (median 0.6 GB); arrival in the world was driven by keys and not checked on pictures. An earlier attempt of this batch is not counted: two runs were started at the same time by mistake on one GPU (no device loss in either, but the measure is not clean).
AI-assisted (Claude Code).
@MoonEyes on GitHub · 2026-12-02 18:02 UTC · original
Light code review only, not built (Windows-only
leonidaapp). Ready, on the in-game gate already passed.c4ebe52de, merge base8422def75, 206 behind currentmain45dc41f95. A trial merge is clean.action_required).#3114 c4ebe52de, this exact head. More than 300 s in the world, 0 device lost, verdict PASS. The author also ran it in game on earlier heads.Review of
d3d12/apps/leonida/src/game_actions/effects.rs(757 new lines),game_actions.rsandleonida-menu/src/tree.rs:known_build, the same check aswarp::supported_build, so a different build reports "not available" instead of writing. That is the right guard for build-specific offsets.Verdict: ready.
AI-assisted verification: Claude Opus (Claude Code), separate agent per batch.
Generated by Claude Code
@matthieupl87-spec on GitHub · 2026-12-02 22:10 UTC · original
@MoonEyes for information, not a change to this PR: on my local branch I now have a working No traffic for 1.0.2.1. It came out of this PR, where No traffic was removed for having no effect. The details are in #3009: #3009. In short:
CLEAR_AREAwith the flag0xffff, every 2 s around the player, and the player's own vehicle kept.In game, the game felt smoother with the roads empty: 22-25 fps at moments, where this area usually gives 14-18. To be fair, the median over one measured run did not move: 14 fps without it (225 s) and 14 with it (500 s). So I can only say it costs nothing; a gain is not shown yet. If it is wanted, I can open it as a separate PR after #3114, with a full run report.
AI-assisted (Claude Code).
@fiestorra on GitHub · 2026-12-02 23:28 UTC · original
VERIFY-3114 — Windows nativo: la suite de la app pasa, el commit no trae ningún test, y hay una decisión que merece revisión
c4ebe52de—game_actions/effects.rs(+96),game_actions.rs(+4),leonida-menu/src/tree.rs(+1)Ran
But note what that number is: the existing suite. This commit adds no
#[test]and no test function — I searched the diff for both. Sored not constructible, and the behaviour is a native call against the title's memory, which no test here can reach.What it adds: an F4 action
vehicle.trackerthat queries the current vehicle'strackerslot throughTRACKER_QUERY, and if it is not zero tries six setter/argument shapes in order (TRACKER_SET_BandTRACKER_SET_A, with[slot, 0],[held],[0]), re-querying after each and stopping at the first that changes the value. The comment says the two setters are "void (add / remove, which is which not known yet)".Two things I would not let through without a sentence in the body, and neither is a refusal:
if after != before { break; }— if a setter replaces the tracker with a different one instead of removing it, the query changes, the loop stops, and the action reports what looks like a removal. The action is named after removing; a check of "it changed" is weaker than "it is zero", and the zero case is the one the code already knows how to test (before == 0→(none)).nativedbdoes not name them; the argument lists here are the author's inference. A wrong arity or a wrong kind in a native call is not a no-op — the safest shape for a probe is the one the code already has (log before, try, log after, and stop), and it does that — but the F4 entry reads like a finished feature, and on this evidence it is a probe. The description or the entry should say so.The part I want to credit: it checks
before != 0first, logs every attempt with the setter and the arguments ({setter:#018x}{rest:x?} -> {after:#010x}), and stops on the first change instead of running all six blindly. That is how a probe should be written.What I could not test
Written with an AI assistant.
@matthieupl87-spec on GitHub · 2026-12-03 12:36 UTC · original
@fiestorra thanks for the review of
c4ebe52de. Both points are fair. What changed, in58b8f1ccd(pushed to this branch):0. The log line ends with(removed)when it ended empty and(still held)otherwise, so a setter that swaps the tracker for another one is no longer reported as a removal.Remove tracker: the description says it tries to take the tracker off, and the log line now says honestly whether the slot ended empty. The natives stay unnamed and their argument shapes guessed (said in the code comment).Still true: no test. The behaviour is native calls on a live vehicle, so I have no red test to offer for it.
One thing from my own runs (02-03/12, several sessions, no crash): in every log the slot read
0xbcd8a25fbefore and after all six tries, also when the tracker looked gone in game. So either the query does not read what I think it reads, or no setter shape removes it. With this code (run today in my local build, not on this branch's head) the action now says(still held)in that case instead of claiming success.AI-assisted (Claude Code).
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.