Trainer menu: player, vehicle, weapon items through the title's natives, and Get all weapons (D3D12-F4-GIVE-ITEMS) #3391

Code

Clone this repository

Checkout

From your project repository, check out a new branch and test the changes.

git fetch -u  "f4-give-weapons:pastel-f4-give-weapons"
git switch "pastel-f4-give-weapons"
Open
leonida/mandy
pastel wants to merge 15 commits from pastel/mandy:f4-give-weapons into main

This branch is out-of-date with the base branch

Conversation
Reviewers 0 approvals
  • No reviewers
Details
This pull request is blocked because it's outdated.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'f4-give-weapons:pastel-f4-give-weapons'
git switch 'pastel-f4-give-weapons'
First-time contributor

Claimed in the coordination issue as: D3D12-F4-GIVE-ITEMS (claim comment on #3312)

What and why

This carries two pieces that were open on GitHub before the takedown:

  1. Pooldead's trainer menu (8 commits, his authorship kept; it was ProjectLeonida/mandy#3114 on GitHub): player, vehicle, weapon and world items through the title's script natives, called by their hashes, in d3d12/apps/leonida/src/game_actions/effects.rs. It covers money up to the game's 20 000 $ cap, the vehicle's parts, tyres and lights, Never wanted, the clip toggles and Remove tracker.
  2. Get all weapons (eipastel): every weapon item of the title's item registry given through its inventory functions, in game_actions/weapons.rs. It runs on 1.0.2.1 only, and each function's first bytes are checked before the call. The action <menu id> console command runs a menu action (action weapons.all).

@Pooldead: your branch was not on this repository yet, so it is here under your name, cherry-picked onto current main with no textual conflict. If you would rather open your own PR, say so and this one will build on it instead.

After the port, a separate read-only reviewer compared it with what main gained meanwhile (god mode, spawn and teleports through natives, native_scan.rs). God mode, spawn, teleport and the wanted clear stay main's. One last commit fixes what that reviewer found:

  • Never wanted turned off before the most stars were ever read no longer caps the player at 1 star.
  • The tracker removal armed after a spawn now runs on 1.0.2.1 only, as the explicit Remove tracker item does.
  • docs/mod-menu.md's Game actions table describes the new items and the natives-based Never wanted.

The leftover commit 57dfd86 from the old branch (dangling-link test) was dropped: main builds that test already.

Tested

  • In the game (RTX 5060 8 GB, driver 621.01): Get all weapons gave 65 of 131 weapons once the 4096-record bound from the review was taken out again (5ebe5d4133: the registry has 27,114 records, and its u16 count bounds the read). Details in the comment below.

  • cargo build --workspace --all-targets --locked (from d3d12/): builds; only main's existing warning.

  • cargo test -p leonida -p leonida-menu -p leonida-lua --locked: all pass, including every_item_is_once_and_counted (each menu id once, with the right kind) and the weapon-registry test.

  • cargo clippy -p leonida -p leonida-menu --locked --all-targets: clean.

  • python -I scripts/check_no_game_data.py on the changed files and tests/test_docs_*.py: pass.

  • Not run in the title on this repository; LEONIDA_GAME_ACTIONS=1 stays off by default.

GPUs tested: n/a (unit tests only)

AI-assisted: yes, Claude Opus 5.5 for the Get all weapons code, the port and the review fixes, and for the separate read-only reviewer agent. Pooldead's commits are his.

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request. (Two pieces: Get all weapons needs the trainer menu under it.)
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)

🤖 Generated with Claude Code

Claimed in the coordination issue as: D3D12-F4-GIVE-ITEMS (claim comment on #3312) ### What and why This carries two pieces that were open on GitHub before the takedown: 1. **Pooldead's trainer menu** (8 commits, his authorship kept; it was ProjectLeonida/mandy#3114 on GitHub): player, vehicle, weapon and world items through the title's script natives, called by their hashes, in `d3d12/apps/leonida/src/game_actions/effects.rs`. It covers money up to the game's 20 000 $ cap, the vehicle's parts, tyres and lights, Never wanted, the clip toggles and Remove tracker. 2. **Get all weapons** (eipastel): every weapon item of the title's item registry given through its inventory functions, in `game_actions/weapons.rs`. It runs on 1.0.2.1 only, and each function's first bytes are checked before the call. The `action <menu id>` console command runs a menu action (`action weapons.all`). @Pooldead: your branch was not on this repository yet, so it is here under your name, cherry-picked onto current main with no textual conflict. If you would rather open your own PR, say so and this one will build on it instead. After the port, a separate read-only reviewer compared it with what main gained meanwhile (god mode, spawn and teleports through natives, `native_scan.rs`). God mode, spawn, teleport and the wanted clear stay main's. One last commit fixes what that reviewer found: - Never wanted turned off before the most stars were ever read no longer caps the player at 1 star. - The tracker removal armed after a `spawn` now runs on 1.0.2.1 only, as the explicit Remove tracker item does. - `docs/mod-menu.md`'s Game actions table describes the new items and the natives-based Never wanted. The leftover `commit 57dfd86` from the old branch (dangling-link test) was dropped: main builds that test already. ### Tested - **In the game** (RTX 5060 8 GB, driver 621.01): Get all weapons gave 65 of 131 weapons once the 4096-record bound from the review was taken out again (`5ebe5d4133`: the registry has 27,114 records, and its u16 count bounds the read). Details in the comment below. - `cargo build --workspace --all-targets --locked` (from `d3d12/`): builds; only main's existing warning. - `cargo test -p leonida -p leonida-menu -p leonida-lua --locked`: all pass, including `every_item_is_once_and_counted` (each menu id once, with the right kind) and the weapon-registry test. - `cargo clippy -p leonida -p leonida-menu --locked --all-targets`: clean. - `python -I scripts/check_no_game_data.py` on the changed files and `tests/test_docs_*.py`: pass. - **Not run in the title** on this repository; `LEONIDA_GAME_ACTIONS=1` stays off by default. GPUs tested: n/a (unit tests only) AI-assisted: yes, Claude Opus 5.5 for the Get all weapons code, the port and the review fixes, and for the separate read-only reviewer agent. Pooldead's commits are his. ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [ ] One topic; follow-up work goes in a new pull request. (Two pieces: Get all weapons needs the trainer menu under it.) - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator change) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Money: the cash Jason carries, filled to the cap through the title's inventory manager (the way is
fraustiz/fro-trainer's, MIT, rewritten). Vehicle parts: the item list of the current vehicle (read only).
Fix tyres, bulletproof tyres, unbreakable lights, a wash that takes the marks off. 1.0.2.1 only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Never wanted read 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 disables the player's wanted level, has the police ignore the player and sets the most
stars to 0 (put back when off): seen in game, crimes gave no stars. The density and random-cop natives were taken
by the title without error but changed nothing on screen, so those three items are not done here.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
No reload and Infinite ammo both call SET_PED_INFINITE_AMMO_CLIP. Each now sends
whether either is on, so turning one off does not take the clip from the other.
find_parts tried offsets up to len - 0x1C exclusive, missing a one-item list
that ends exactly at the end of the block. Both found by Kal0s-design's review.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The tracker natives are the unnamed ones the title's scripts call with a vehicle and a tracker kind; each setter is
given the slot's kind and 0, then the kind and the tracker it holds, and every step is logged.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The give natives cannot run from the game-actions update (VI_GIVE_ITEM_TO_PED_ASYNC wants a script
program's task type and ends the title; _GIVE_WEAPON_COLLECTION_TO_PED replaces the loadout). The item
registry's weapon items are added the way a pickup adds one, 1.0.2.1 only, each function's first bytes
checked. LEONIDA_GAME_ACTIONS_RUN gains action <menu id> to run a menu action without the keyboard.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
First-time contributor

Thanks @pastel. Go ahead with #3391 on top of my commits; I won't open my own PR. I'm moving to vehicle tuning (claim on #3312).

One finding from my in-game tests on GitHub (03/12, build 1.0.2.1, RTX 5070 Ti), in case my comment on the old #3234 was lost with the takedown:

  • Get all weapons gave 65 of 131 items in one go, and the given weapons could not be used.
  • Weapons given one by one (WEAPONSPEC_*_DEFAULT) worked at first. After several gives, every later give returned "0 of 1 given", and the weapons became unusable again.
  • My guess is inventory transactions that are never finished, but I did not prove it.

It would be worth one in-game run of weapons.all before merge.

AI-assisted (Claude Code).

Thanks @pastel. Go ahead with #3391 on top of my commits; I won't open my own PR. I'm moving to vehicle tuning (claim on #3312). One finding from my in-game tests on GitHub (03/12, build 1.0.2.1, RTX 5070 Ti), in case my comment on the old #3234 was lost with the takedown: - **Get all weapons** gave 65 of 131 items in one go, and the given weapons could not be used. - Weapons given **one by one** (`WEAPONSPEC_*_DEFAULT`) worked at first. After several gives, every later give returned "0 of 1 given", and the weapons became unusable again. - My guess is inventory transactions that are never finished, but I did not prove it. It would be worth one in-game run of `weapons.all` before merge. AI-assisted (Claude Code).
Author
First-time contributor

In-game test (RTX 5060 8 GB, driver 621.01, Windows 11; diag build with DLSS; Series X profile; LEONIDA_GAME_ACTIONS=1, commands by LEONIDA_GAME_ACTIONS_RUN):

  • Get all weapons: found a bug and fixed it. The 4096-record bound added in the review commit refused the read: the title's item registry has 27,114 records. The u16 count already bounds the read, so 5ebe5d4133 takes the bound out. With it: weapons.all: 65 of 131 weapons given, and the player holds a gas can in the next frame.
  • Cash, wanted level, spawn: not judged. The run was a new game in the prologue (in a cell): the player's cash was not found in the inventory (no cash item yet), wanted level 0 -> 2 asked, now 0, and the spawn was asked of the title with no car to see indoors.
  • No panic and no crash in about 10 minutes in the world.

Description updated: the 4096 bound is gone.

In-game test (RTX 5060 8 GB, driver 621.01, Windows 11; diag build with DLSS; Series X profile; `LEONIDA_GAME_ACTIONS=1`, commands by `LEONIDA_GAME_ACTIONS_RUN`): - **Get all weapons: found a bug and fixed it.** The 4096-record bound added in the review commit refused the read: the title's item registry has 27,114 records. The u16 count already bounds the read, so `5ebe5d4133` takes the bound out. With it: `weapons.all: 65 of 131 weapons given`, and the player holds a gas can in the next frame. - **Cash, wanted level, spawn:** not judged. The run was a new game in the prologue (in a cell): `the player's cash was not found in the inventory` (no cash item yet), `wanted level 0 -> 2 asked, now 0`, and the spawn was asked of the title with no car to see indoors. - No panic and no crash in about 10 minutes in the world. Description updated: the 4096 bound is gone.
Author
First-time contributor

@Pooldead thanks, I had missed your finding. My run does not contradict it: I saw the weapons arrive (65 of 131, a gas can in hand), but I did not fire one, so whether they can be used is not verified. The repeat gives match yours too: in an earlier run on the same save, the second weapons.all gave 1 of 131 and the third 0 of 131.

So Get all weapons is not ready to merge as it is. I'll look at whether the inventory transaction the give opens is ever finished, and report back here. Until then, this PR should not be merged.

@Pooldead thanks, I had missed your finding. My run does not contradict it: I saw the weapons arrive (65 of 131, a gas can in hand), but I did not fire one, so whether they can be used is **not verified**. The repeat gives match yours too: in an earlier run on the same save, the second `weapons.all` gave 1 of 131 and the third 0 of 131. So Get all weapons is not ready to merge as it is. I'll look at whether the inventory transaction the give opens is ever finished, and report back here. Until then, this PR should not be merged.
pastel changed title from Trainer menu: player, vehicle, weapon items through the title's natives, and Get all weapons (D3D12-F4-GIVE-ITEMS) to WIP: Trainer menu: player, vehicle, weapon items through the title's natives, and Get all weapons (D3D12-F4-GIVE-ITEMS) 2026-12-04 04:12:19 +00:00
The bare add only opens an inventory transaction; weapons given that way were reported carried but not usable,
and later adds failed (Pooldead's runs on #3391). The title's give (read from this build's callers of the add)
adds, then hands the transaction to the inventory's owner. In a run the title now shows its pickup notice for
each weapon given (65 of 131).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
First-time contributor

@Pooldead I think I found the cause. 12e30f8c5a changes how the weapons are given.

  • Cause (from this build's code, read locally): the add we called (+0x2ee4c60) only opens an inventory transaction. The title never calls it alone: its give of an item to a ped (+0x192d2a0) calls the add, then, when the transaction is not its "no transaction" id, hands it to the inventory's owner to be finished (a completion registered through +0x13b3e70), then frees what the request holds. We skipped that step, which fits weapons carried but not usable and later adds failing.
  • Fix: Get all weapons now calls that give (its first bytes checked like the others) instead of the bare add, and counts a weapon when the transaction is not the title's no-transaction id (read from +0xab3cd80).
  • In the game (RTX 5060, story prologue): 65 of 131 given, and now the title shows its pickup notice for each weapon (before: nothing). A second give: 1 of 131.
  • Not verified: firing one. In the prologue's cell the title keeps weapons out of hand (no weapon wheel), so I could not shoot.

Could you run weapons.all in the open world on your save and try firing a couple of the weapons given? Title WIP removed so it can be reviewed; I'd hold the merge for that check.

@Pooldead I think I found the cause. `12e30f8c5a` changes how the weapons are given. - **Cause (from this build's code, read locally):** the add we called (+0x2ee4c60) only opens an inventory transaction. The title never calls it alone: its give of an item to a ped (+0x192d2a0) calls the add, then, when the transaction is not its "no transaction" id, hands it to the inventory's owner to be finished (a completion registered through +0x13b3e70), then frees what the request holds. We skipped that step, which fits weapons carried but not usable and later adds failing. - **Fix:** Get all weapons now calls that give (its first bytes checked like the others) instead of the bare add, and counts a weapon when the transaction is not the title's no-transaction id (read from +0xab3cd80). - **In the game** (RTX 5060, story prologue): 65 of 131 given, and now the title shows its pickup notice for each weapon (before: nothing). A second give: 1 of 131. - **Not verified:** firing one. In the prologue's cell the title keeps weapons out of hand (no weapon wheel), so I could not shoot. Could you run `weapons.all` in the open world on your save and try firing a couple of the weapons given? Title WIP removed so it can be reviewed; I'd hold the merge for that check.
pastel changed title from WIP: Trainer menu: player, vehicle, weapon items through the title's natives, and Get all weapons (D3D12-F4-GIVE-ITEMS) to Trainer menu: player, vehicle, weapon items through the title's natives, and Get all weapons (D3D12-F4-GIVE-ITEMS) 2026-12-04 05:29:11 +00:00
pastel force-pushed f4-give-weapons from 12e30f8c5a to 4ce37bedb0 2026-12-04 12:19:56 +00:00 Compare
Author
First-time contributor

@Pooldead firing works on the rebased head 4ce37bedb0 (the give routine), RTX 5060 8 GB, driver 621.01, Windows 11, diag build.

  • Given: an open-world save, away from Jason's house. weapons.all gave 61 of 131 (6 not taken: carried, or that kind full), each with the title's pickup notice.
  • Fired: a weapon given by Get all weapons, picked on the weapon wheel, aimed and fired by hand. It shoots normally.
  • Not a bug: at Jason's house the title keeps every weapon in its holster, the save's own weapons too. My earlier "cannot aim" runs were there, which is why they showed nothing.
  • Rebased on current main; cargo test -p leonida -p leonida-menu -p leonida-gpu --locked passes, check_no_game_data clean.

Tested in game by pastel; run and report with Claude Code (Claude Opus 5.5).

@Pooldead firing works on the rebased head `4ce37bedb0` (the give routine), RTX 5060 8 GB, driver 621.01, Windows 11, diag build. - **Given:** an open-world save, away from Jason's house. `weapons.all` gave 61 of 131 (6 not taken: carried, or that kind full), each with the title's pickup notice. - **Fired:** a weapon given by Get all weapons, picked on the weapon wheel, aimed and fired by hand. It shoots normally. - **Not a bug:** at Jason's house the title keeps every weapon in its holster, the save's own weapons too. My earlier "cannot aim" runs were there, which is why they showed nothing. - Rebased on current `main`; `cargo test -p leonida -p leonida-menu -p leonida-gpu --locked` passes, `check_no_game_data` clean. Tested in game by pastel; run and report with Claude Code (Claude Opus 5.5).
pastel force-pushed f4-give-weapons from 9cdd9cdf48 to cd2cb52d3f 2026-12-04 14:03:32 +00:00 Compare
First-time contributor

RUN — In-game Regression & Test Gate (NVIDIA RTX 5070 12 GB, Windows 11)

Tested PR head cd2cb52d3f fast-forwarded cleanly onto main (30c683055), diagnostic release build (-SeriesS, no frame generation, 315 s automated baseline run from the same save; note: automated stability/regression pass only, interactive F4 menu toggles were not exercised here), compared against main (30c683055):

Metric main (30c683055) PR #3391 (cd2cb52d3f)
World samples (>=1000 draws) 36 (max_draws=5187) 41 (max_draws=5170)
Median FPS / frame time 23.0 fps (43.5 ms) 24.7 fps (40.5 ms)
Slowest 10% / fastest 10% 13.7 / 25.0 fps 16.7 / 25.6 fps
3000-4999 draws/frame median 23.2 fps (28 samples) 24.9 fps (31 samples)
Errors / warnings / device lost 0 / 0 / 0 0 / 0 / 0

Unit & Repo Checks

  • cargo test -p leonida --locked — PASS (71/71 unit tests including game_actions::effects::tests + 6/6 integration tests)
  • python -I tools/d3d12_switches.py --check d3d12/docs/switches.md — PASS
  • python -I scripts/check_no_game_data.py — PASS

Verdict

PASS on automated regression/test gate (clean fast-forward on 30c683055, all tests pass, zero errors and no FPS regression over 315 s).

AI-assisted: yes

### RUN — In-game Regression & Test Gate (NVIDIA RTX 5070 12 GB, Windows 11) Tested PR head `cd2cb52d3f` fast-forwarded cleanly onto `main` (`30c683055`), diagnostic release build (`-SeriesS`, no frame generation, 315 s automated baseline run from the same save; note: automated stability/regression pass only, interactive F4 menu toggles were not exercised here), compared against `main` (`30c683055`): | Metric | `main` (`30c683055`) | PR `#3391` (`cd2cb52d3f`) | | --- | --- | --- | | World samples (`>=1000` draws) | `36` (`max_draws=5187`) | `41` (`max_draws=5170`) | | Median FPS / frame time | `23.0 fps` (`43.5 ms`) | `24.7 fps` (`40.5 ms`) | | Slowest 10% / fastest 10% | `13.7` / `25.0 fps` | `16.7` / `25.6 fps` | | `3000-4999` draws/frame median | `23.2 fps` (`28` samples) | `24.9 fps` (`31` samples) | | Errors / warnings / device lost | `0` / `0` / `0` | `0` / `0` / `0` | ### Unit & Repo Checks - `cargo test -p leonida --locked` — PASS (`71/71` unit tests including `game_actions::effects::tests` + `6/6` integration tests) - `python -I tools/d3d12_switches.py --check d3d12/docs/switches.md` — PASS - `python -I scripts/check_no_game_data.py` — PASS ### Verdict **PASS** on automated regression/test gate (clean fast-forward on `30c683055`, all tests pass, zero errors and no FPS regression over 315 s). AI-assisted: yes
pastel force-pushed f4-give-weapons from cd2cb52d3f to 23b7ae6586 2026-12-04 15:13:53 +00:00 Compare
Author
First-time contributor

@und3rlake thank you for the gate run on the 5070, and for the baseline against main next to it. Good to see no errors and no FPS loss over the 315 s run. The F4 toggles were tested by hand on a 5060 (the firing run above). Head is now 23b7ae6586, rebased on main ebbb84048c with no code change (cargo test -p leonida -p leonida-menu -p leonida-gpu --locked and the clean-room check pass).

AI-assisted: yes

@und3rlake thank you for the gate run on the 5070, and for the baseline against `main` next to it. Good to see no errors and no FPS loss over the 315 s run. The F4 toggles were tested by hand on a 5060 (the firing run above). Head is now `23b7ae6586`, rebased on `main` `ebbb84048c` with no code change (`cargo test -p leonida -p leonida-menu -p leonida-gpu --locked` and the clean-room check pass). AI-assisted: yes
pastel force-pushed f4-give-weapons from 23b7ae6586 to ae0a8cdf30 2026-12-04 16:12:47 +00:00 Compare
pastel force-pushed f4-give-weapons from ae0a8cdf30 to e382b3e5dc 2026-12-05 06:11:24 +00:00 Compare
Sign in to join this conversation.
No description provided.