d3d12: F4 trainer Get all weapons through the title's inventory functions, 1.0.2.1 (D3D12-F4-GIVE-ITEMS) #3234
Closed
leonida/mandy
eipastel wants to merge 0 commits from
f4-give-weapons into main
pull from: f4-give-weapons
merge into: leonida:main
leonida:main
leonida:github-pr/3295
leonida:beta
leonida:docs/changelog-3483-3500
leonida:github-pr/3294
leonida:github-pr/2975
leonida:github-pr/2815
leonida:feat/gate-driver-start
leonida:feat/skip-pipelines-release
leonida:perf/lazy-compare
leonida:perf/mwaitx-wait
leonida:test/prio-ceiling-main
leonida:fix/ab-cpu-stdout
leonida:fix/gate-old-crashes
leonida:diag/ab-cpu
leonida:test/main-0312
leonida:github-pr/3291
leonida:diag/indirect-clamp-census
leonida:feat/barrier-enhanced
leonida:perf/texture-frame-ceiling
leonida:perf/dstorage-threads
leonida:fix/console-queue-dma-tables
leonida:fix/port-descriptors-record-parts
leonida:fix/frame-waits-fence
leonida:fix/console-sampler-words
leonida:fix/graphics-userdata-spill
leonida:fix/xg-reserved-layout-rotation
leonida:fix/barrier-console-flags
leonida:fix/switches-wait-test-child
leonida:test/list-value-waits
leonida:test/lot-gxdk-0412
leonida:fix/bvh-compacted-size
leonida:docs/i18n-quickstarts
leonida:feat/native-pipeline-slots
leonida:fix/clippy-leonida-gpu
leonida:fix/list-value-producers
leonida:fix/descriptor-page-straddle
leonida:fix/xmem-low-window
leonida:fix/ffx-jitter-never-zero
leonida:fix/run-stdout-closed
leonida:github-pr/2892
leonida:github-pr/2896
leonida:feat/warm-save-every
leonida:github-pr/2980
leonida:github-pr/2994
leonida:github-pr/3005
leonida:github-pr/3010
leonida:github-pr/3136
leonida:github-pr/3303
leonida:github-pr/3220
leonida:github-pr/3143
leonida:github-pr/3330
leonida:github-pr/3226
leonida:github-pr/3187
leonida:carry/3395
leonida:github-pr/2946
leonida:github-pr/2947
leonida:github-pr/2945
leonida:github-pr/2983
leonida:github-pr/3001
leonida:github-pr/3372
leonida:github-pr/3128
leonida:github-pr/3296
leonida:github-pr/2588
leonida:github-pr/3119
leonida:github-pr/3378
leonida:fix/crash-diagnostics
leonida:feat/dlss-mip-bias
leonida:fix/retired-out-of-order
leonida:fix/dxr-postbuild-barrier
leonida:fix/amd-relay-default
leonida:fix/removed-report-wait
leonida:feat/heap-twin
leonida:feat/vram-margin
leonida:github-pr/2472
leonida:github-pr/3123
leonida:github-pr/3088
leonida:assets/annonce-v1
leonida:github-pr/2794
leonida:github-pr/3300
leonida:github-pr/3304
leonida:github-pr/3308
leonida:github-pr/3367
leonida:github-pr/3369
leonida:fix/launcher-dlss-diagnostics
leonida:github-pr/3269
leonida:github-pr/2957
leonida:github-pr/3205
leonida:fix/crash-zero-guard
leonida:github-pr/3185
leonida:github-pr/3099
leonida:github-pr/3104
leonida:github-pr/3348
leonida:github-pr/3379
leonida:github-pr/3377
leonida:perf/darner-title-priority-ceiling
leonida:github-pr/3376
leonida:gh-readonly-queue/main/pr-3311-b5c45b663dbc5a9c3532bb3f307e5f81b32faefa
leonida:gh-readonly-queue/main/pr-3088-af22e7847ff5808f72d1a1881c24be2fafd20b54
leonida:gh-readonly-queue/main/pr-3123-7f3fa026a94c6646e89244f28e1ce22290361867
leonida:github-pr/3373
leonida:github-pr/3368
leonida:github-pr/3198
leonida:gh-readonly-queue/main/pr-3354-637baa0b77ba47222e7280b17c1a59c6a1781d57
leonida:gh-readonly-queue/main/pr-3365-d7a0e0196a43834813014b4bd3aa5502a8263b14
leonida:gh-readonly-queue/main/pr-3361-5dfe8bbd05ed12fb2f2e1718d9af77a7c5f46fd8
leonida:gh-readonly-queue/main/pr-3366-8da9148204e9d12c585efa9ac2b7cc1ab08c7682
leonida:github-pr/3346
leonida:github-pr/3375
leonida:github-pr/2958
leonida:github-pr/3151
leonida:github-pr/3307
leonida:github-pr/3278
leonida:github-pr/3374
leonida:fix/runtime-test-conservative-fixtures
leonida:github-pr/3366
leonida:ci/shard-semantic-linux
leonida:github-pr/3354
leonida:docs/fg-limit-fps-switch
leonida:github-pr/3365
leonida:fix/read-file-hard-link
leonida:github-pr/3364
leonida:fix/book-slot-heap-never-read
leonida:github-pr/3361
leonida:github-pr/3263
leonida:github-pr/3360
leonida:github-pr/3353
leonida:github-pr/3331
leonida:fix/alias-later-queued-submissions
leonida:github-pr/3352
leonida:github-pr/3228
leonida:github-pr/3349
leonida:claude/gallant-sagan-aamatr
leonida:github-pr/3200
leonida:github-pr/3132
leonida:github-pr/3323
leonida:github-pr/3332
leonida:github-pr/3340
leonida:github-pr/3311
leonida:github-pr/3334
leonida:github-pr/3297
leonida:github-pr/3256
leonida:github-pr/2567
leonida:github-pr/2851
leonida:d3d12/agility-sdk-621
leonida:github-pr/3164
leonida:github-pr/3114
leonida:github-pr/3050
leonida:github-pr/3113
leonida:github-pr/3326
leonida:github-pr/3144
leonida:github-pr/2642
leonida:github-pr/3072
leonida:github-pr/2789
leonida:github-pr/2643
leonida:github-pr/3009
leonida:github-pr/3035
leonida:github-pr/3031
leonida:github-pr/2686
leonida:github-pr/2834
leonida:github-pr/3321
leonida:github-pr/3325
leonida:github-pr/3290
leonida:github-pr/3324
leonida:github-pr/3130
leonida:claude/fervent-curie-m19lnr
leonida:github-pr/3309
leonida:github-pr/3305
leonida:github-pr/3306
leonida:github-pr/3302
leonida:github-pr/3301
leonida:github-pr/3345
leonida:github-pr/3211
leonida:github-pr/3027
leonida:github-pr/3286
leonida:github-pr/3235
leonida:github-pr/3265
leonida:github-pr/3275
leonida:codex/skip-no-hit-ray-passes
leonida:github-pr/2823
leonida:github-pr/2911
leonida:github-pr/3262
leonida:github-pr/3125
leonida:github-pr/3206
leonida:github-pr/3250
leonida:github-pr/3238
leonida:github-pr/3188
leonida:github-pr/2952
leonida:github-pr/3217
leonida:github-pr/3168
leonida:t3/preserve-fsr-sdk-restart-path
leonida:t3/propagate-host-failure-hresult
leonida:github-pr/3209
leonida:t3/launcher-custom-parameters
leonida:github-pr/3207
leonida:github-pr/3183
leonida:github-pr/3160
leonida:github-pr/3201
leonida:ci/less-to-run
leonida:github-pr/2930
leonida:github-pr/2797
leonida:github-pr/2999
leonida:perf/native-compute-shader-forms
leonida:github-pr/3191
leonida:github-pr/3011
leonida:github-pr/3019
leonida:github-pr/2996
leonida:gh-readonly-queue/main/pr-2789-45dc41f95c1cd0dcc29c2c50582e0e9af8a77259
leonida:claude/blissful-franklin-ukp7ag
leonida:github-pr/3141
leonida:github-pr/3156
leonida:github-pr/3150
leonida:github-pr/3153
leonida:github-pr/3163
leonida:github-pr/3142
leonida:github-pr/3139
leonida:github-pr/2841
leonida:github-pr/3069
leonida:github-pr/3098
leonida:github-pr/3107
leonida:github-pr/3071
leonida:github-pr/2774
leonida:github-pr/2889
leonida:github-pr/3075
leonida:github-pr/2661
leonida:github-pr/3064
leonida:github-pr/3054
leonida:github-pr/3049
leonida:github-pr/2855
leonida:github-pr/2943
leonida:github-pr/3016
leonida:github-pr/2887
leonida:github-pr/3006
leonida:github-pr/3003
leonida:github-pr/2993
leonida:notes/card-time-and-plant-flicker
leonida:github-pr/2989
leonida:feat/vulkan-rs
leonida:github-pr/2985
leonida:github-pr/2951
leonida:github-pr/2982
leonida:github-pr/752
leonida:github-pr/792
leonida:github-pr/2877
leonida:github-pr/2654
leonida:github-pr/2893
leonida:github-pr/2948
leonida:github-pr/2944
leonida:github-pr/2919
leonida:github-pr/2915
leonida:archive/ci/less-to-run/20261202T1121Z
leonida:github-pr/2800
leonida:github-pr/2822
leonida:github-pr/2833
leonida:github-pr/2840
leonida:github-pr/2831
leonida:github-pr/2832
leonida:github-pr/2801
leonida:github-pr/2890
leonida:github-pr/2891
leonida:github-pr/2664
leonida:github-pr/2807
leonida:rt-call-trace
leonida:github-pr/2755
leonida:perf/ahead-split
leonida:github-pr/2587
leonida:github-pr/2698
leonida:github-pr/2609
leonida:github-pr/3219
leonida:docs/readme-runtime-proposal
leonida:github-pr/2017
leonida:github-pr/1741
leonida:github-pr/1667
leonida:codex/coord-claim-check-20261124-7e48
No reviewers
Assignees
Clear assignees
No assignees
Labels
Clear labels
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
enhancement
New feature or request
missing claim
Needs a claim in #14
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
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
Projects
Clear projects
No items
No project
Milestone
Clear milestone
No items
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Reference
leonida/mandy!3234
Loading…
Reference in a new issue
No description provided.
Delete branch "f4-give-weapons"
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?
Pull request closed
This pull request cannot be reopened because the branch was deleted.
Claimed in the coordination issue as: D3D12-F4-GIVE-ITEMS (https://github.com/ProjectLeonida/mandy/issues/2570, claim of 2026-12-02 20:21)
Depends on: #3114 (this branch is #3114's head
c4ebe52deplus the three commits below; only those are this pull request's)What and why
The F4 trainer's Get all weapons (
weapons.all) now gives the player every weapon the title defines, on 1.0.2.1.The give natives cannot be called from the game-actions update:
VI_GIVE_ITEM_TO_PED_ASYNCwants the task type of a calling script program and ends the title without one, and_GIVE_WEAPON_COLLECTION_TO_PEDreplaces what the player carries with a mission loadout (matthieupl87-spec's finding in #2570). Under those natives the title adds a weapon with four plain functions that need no script context: the player's inventory by entity id, a weapon's info by item hash, whether the inventory can take it, and the add, given a request filled as a pickup fills it.d3d12/apps/leonida/src/game_actions/weapons.rsreads the weapon items from the title's item registry and adds each one that way.game_actions.rs) is compared with this build's before anything is called.modmenu/weapons.rs(GPL-3.0), cited in the module header asgame_actions.rsalready cites that source.LEONIDA_GAME_ACTIONS_RUNgainsaction <menu id>(for exampleaction weapons.all), to run any menu action without the keyboard; documented indocs/mod-menu.md, the module header andd3d12/docs/switches.md(regenerated withtools/d3d12_switches.py).One line outside the topic, so CI can build:
maindoes not buildleonida-lua's tests since #3179 (Runtime::newno longer returns aResult) and #3189 (a test still calls.unwrap()on it). Commit57dfd866ddrops that.unwrap()(d3d12/crates/leonida-lua/src/tests.rs:1089), the same change as #3237; whichever lands first, the other's copy merges cleanly or drops out.Tested
cargo test -p leonida --locked(fromd3d12/): 50 + 2 + 2 passed, 0 failed. New:parse_command("action weapons.all")and its wrong forms;weapons::tests::only_weapons_not_hidden_are_kept_in_order(a hand-built registry buffer: weapon type kept, other types and the hidden list dropped, order kept) andweapon_type_is_the_hash_of_weapon. The registry test covers a function split out of existing code in the review commit, so there is no red run for it.cargo test -p leonida-menu --locked: passed. After mergingmain:cargo build --workspace --all-targets --lockedclean;cargo test -p leonida-lua -p leonida -p leonida-menu --lockedpassed, excepta_scan_without_a_size_reaches_the_end_of_the_imagefailing once and passing on three reruns (the intermittent fake-image alignment case, not touched here).cargo fmt --all --check: clean.cargo clippy -p leonida --all-targets -- -D warningsstops oncrates/leonida-gpu/src/host.rs:7628(unused_mut), which is onmainand not in this diff.python -I tools/d3d12_switches.py --check d3d12/docs/switches.md,python -m unittest discover -s tests -p "test_docs_*.py"(57 tests): OK.python -I scripts/check_no_game_data.py: clean.LEONIDA_GAME_ACTIONS=1): F4, Get all weapons gives the player the weapons, and the title keeps running.GPUs tested: n/a for the tests above (no GPU or game files involved)
AI-assisted: yes. Code: Claude Opus 5.5. Independent read-only reviewer: Claude Opus (no blockers). Addressed: the registry parse split out and tested,
action <menu id>added to the module header andswitches.md. Left as is: the menu offers the item before there is a player (the give answers "no player yet", asplayer.cashandvehicle.partsdo), and the records are read in one read (a registry that is not contiguous would fail with "unreadable", not crash).Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a)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).
VERIFY-3234 — Windows nativo: las suites pasan, el control muerde, y el crate se prueba con otro comando del que parece
(this PR)8422def75(behindmainb41763227)main—merge-treeclean,git merge --no-ffclean (auto-mergeddocs/switches.md)Ran
A note for the next person who runs it:
cargo test -p leonida --libfails withno library targets found in package leonida— the trainer lives in the binary crate, so the unit tests needcargo test -p leonidawithout--lib. That cost me one confusing run.Negative control (synthetic — the tests ship with the change, in the same file): I made
set()clear everyweapons.*toggle when any one of them is turned off, which is exactly what the clip test exists to prevent, rebuilt and ran →The test bites. And the behaviour it pins is the one that would be a bug in the title: two toggles share
SET_PED_INFINITE_AMMO_CLIP, so turning one off must not clear the other's clip — the fixture checks the shared counter goes 1 and then 0, not 2 and then 0.What the other new tests cover, from their names and my read: the item list is enumerated once and counted, the item-name hash matches the one the title computes, the float arguments go in the low half of the register, the parts list is found on a
ganado, andset()marks a change with the right keep-up rule. Eight tests, and none of them needs a GPU or the title.What I could not test
leonida-menu/src/tree.rs, +8/-7): the menu crate's 48 tests pass, but the entry appearing in the real F4 page is a run.Written with an AI assistant.
Run report for @MoonEyes's request, in game on 1.0.2.1, through
scripts/game-gate.ps1: PASS, 303 s in the world, no crash, no device loss, clean exit.57dfd866d, which already containsmainatf3865cae8(merged318f70b1).mainhas since moved toef35d683e; this run is not on that.diagnostics,dlss,mimalloc, exe157bde14df53c223, not dirty.-PlayArgs '-SeriesS -PrecompileUsed',LEONIDA_GAME_ACTIONS=1,LEONIDA_GAME_ACTIONS_RUN=240:action weapons.all(this PR's item run during the window),LEONIDA_KEYS=40:Enter,60:Enter.target, exit0x00000000(clean), pipeline cache saved.weapons.all: 61 of 131 weapons given (6 not taken: carried, or that kind full), and the title kept running afterwards.Not done: the same run on
mainalone for comparison. No logs or screenshots attached (they show game content).AI-assisted (Claude Code, Claude Opus 5.5).
#3234 is now redundant —
mainno longer has the.unwrap()I checked the file on
origin/main(81efe4566): there is noRuntime::new(...).unwrap()left inleonida-lua/src/tests.rs, and this pull request's whole diff is the one line that removes it:It landed through #3244 (
a22fa26d6, the fake image starting on a page,LEONIDA-LUA-SCAN-END-3193), and on thatmain:So: close rather than merge — the fix is in, and a second branch changing the same line is a conflict waiting to be resolved for nothing.
Thank you for having it right, though: the dangling-link test is the one that caught
Runtime::newbecoming infallible, and that a test had to be updated for it is the reason the change was noticed at all.Written with an AI assistant.
Closing for now; the weapons work depends on #3114, which is still open. Will reopen once it lands.
Hi @eipastel, thanks for Get all weapons. I tried it in game today on 1.0.2.1 (your 3 commits cherry-picked onto my local build, which has #3114; not your branch head). No crash in any run, but the inventory seems to get stuck after a few adds. What I saw, from the action log:
Get all weapons (one press)
65 of 131 given (2 not taken). The weapons show up in the inventory and in hand.One weapon at a time (same
givepath, one item per call)WEAPONSPEC_*_DEFAULTitem (after checking the registry files it as typeweapon).0(0 of 1 given), thoughcan_addsaid yes. In one session, 58 different weapons in a row (sniper FF-50 included) all came back0. After that, the weapons the player has can no longer be used.My guess, not checked: each add leaves something unfinished, maybe because the 0x70-byte callbacks block is all zeros, so nothing completes the transaction. After a few, the inventory stops taking adds and the weapon in hand stops working. Rounds alone are not it:
GET_PED_AMMO_TYPE_FROM_WEAPONgave0for these items, so I could not top them up by natives.Also from the registry, in case it helps: 27,114 items. Type
weaponx131,ammox28,currencyx4 (currency_cashplus 3 unnamed).WEAPONSPEC_MELEE_GOLFCLUB/HAMMER/PIPEWRENCH/SWITCHBLADE_DEFAULTare not weapon items there.One crash earlier, possibly related: after adding
WEAPONSPEC_PISTOL_CIVILIAN_DEFAULT, switching weapons ended the title with a read of0xa0f6d6a7, which is that item's hash, used as an address. It happened once and I could not reproduce it.Not merged into my daily build. Happy to run a branch of yours in game and post the logs.
AI-assisted (Claude Code).