fix(debug): the Debug tab's ammunition amounts give the bag they need, and a removal takes what is held #2779
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/mods
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!2779
Loading…
Reference in a new issue
No description provided.
Delete branch "llun/Longshot:fix/debug-item-quantities"
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?
Summary
The Debug tab's ammunition amounts did nothing on a save without the bag that holds them. The game keeps only as many Deku Sticks, Deku Nuts, Bombs, Bombchus, Deku Seeds or Arrows as the largest bag held holds, and it clamps an add past that. With no Deku Stick Bag, Deku Nut Bag, Bomb Bag, Bullet Bag or Quiver, every add was clamped to nothing. That covered Right on the Inventory page's amounts and the Debug tab's Change quantity row. The Inventory page had no row for the Deku Stick or Deku Nut Bags, so those two could never get any. A removal of more than was held was refused whole by the game. For example, the Change quantity row's -10 on 3 Deku Nuts did nothing, and -3 on 2 Bombchus left 2.
To see it on
main: load a save without bags (the repository'smarket-entranceis one), turn Debug tools On, open Debug > Inventory > Items > Bombs > Edit amount and press Right. The amount stays 0. The log line ischeats: inventory Item_Bomb +1 (had 0, ...), the next one still sayshad 0, and the pause screen has no bombs.This changes two things:
The Inventory page also gets the Deku Stick and Nut Bags' rows (Upgrades, three sizes each, the game's
Item_StickBag_*andItem_NutBag_*), so the bigger ones can be given and taken away. PR #1411 (mooki's Progress editor) found the same bag names. Its other half, presses summed while the game hasn't yet taken the last one, stays with it.Read first:
oot_pouch_addingame/oot_tools.c(the bags table above it), thentests/test_oot_ammo_bags.py.Fixes #871. See #2335: its Magic Beans add fine here (0 to 1 to 2 to 7 in the game), and its bottle is not this (below).
Not fixed: bottles ("I can't reduce my number of empty bottles"). Adding works:
Item_BottleorWeapon_Bottle+1 put an empty bottle in the pause screen's bottle row. But the game's count by name (QueryGetPouchContentNumByActorName) reads 0 for every bottle name tried (Item_Bottle,Weapon_Bottle,Item_Bottle_Pouch,Item_Bottle_Empty,Item_Bottle_Fairy, and others) with four bottles held. So the editor shows Empty Bottle at 0, and the game refuses the removal of one it doesn't count (status 3). Bottles live in slots with contents and need the game's own bottle calls, which are not found yet. That is a follow-up.Testing
Tested: Windows 11 (build 26300), RTX 5080 (NVIDIA 621.40), this branch's game against the shared base
22d0d200(dev.py pack/rt), the repository'smarket-entrancesave (child Link, no bags), Debug tools on (HOS_OOT_CHEATS=1). The edits were sent as the menu sends them (the live input file's!cheat <action>, the same action numbers), read back from the game's own counts, the HUD and the pause screen, through the job queue.22d0d200base, the same inventory code asmain): +1, +1, +5, -2 on each counted item: Deku Nuts, Bombs, Bombchus, Deku Seeds, Arrows and Empty Bottle stayed at 0 (event status 2: the game took it and clamped it); Magic Beans and Gold Skulltula Tokens went 0, 1, 2, 7. Bomb Bag, then Bombs +63: 20; Big Bomb Bag: 30; Biggest: 40, and Bombchus stayed 0 until a Bomb Bag was held, then followed it. The same for Bullet Bags (30, 40, 50) and Quivers (30, 40, 50).Item_DekuStick needs a bag: gave Item_StickBag_Small first, and so on for each. The pause screen then showed Deku Stick 1, Deku Nut 1/20, Bombs 20, Bombchus 1, Seeds 30 and Arrows 30 (the last two in the game's counts: no Slingshot or Bow to show them). Bombs -3: 17, +1: 18. The Change quantity row's Deku Nuts -10 on 1: 0 (onmainit was refused).relaunch) and the save loaded: Deku Stick 1, Deku Nut 0, Bombs 17, Bombchus 1, Seeds 30, Arrows 30 and every small bag held, in the game's counts and on the pause screen.9963d60b's code: the samegame/andgpu/as the run above; headless, the menu ticked and drawn into the shots withRX_VK_SHOT_MENU=1, its keys fromRX_VK_MENU_SCRIPT, a freshmarket-entrancesave): Debug > Inventory > Items > Bombs > Edit amount. Right once with no bag: the Bomb Bag, 20 bombs. Left three times 50 ms apart: 19, 18, 17, each its owncheats: inventory Item_Bomb -1line, none dropped. Right: 18. The card read "Quantity 18" and the HUD 18. Then Upgrades > Biggest Deku Stick Bag > Unlock and Biggest Deku Nut Bag > Unlock: Deku Sticks 30 and Deku Nuts 40 on their cards (the bags come filled). Right on each in Edit amount left 30 and 40, their sizes. Then both bags Relock (Item_StickBag_Large -1,Item_NutBag_Large -1): Deku Sticks and Nuts 0 (with no bag the game holds none).tests/test_oot_ammo_bags.py(new) fails onmain("no Inventory row for Item_StickBag_Small"; with that part off, "Item_Bomb +1 with no bag: still 0") and passes here. Undoing the fix's two lines one at a time fails it ("Item_Bomb +1 with no bag: still 0", "Item_Bomb -3 with 2 held: still 2").test_oot_song_inventory(updated: it cutsoot_inventory_edit, which now adds throughoot_pouch_add),test_cheat_itemsandtest_oot_first_nightpass.tests/run_all.py --changed(llvm-mingw clang): 20 passed, 4 failed, 12 skipped (no gcc here). Of the 4,test_oot_first_nightfailed only on a local diagnostic that is not in this branch (it passes on the head), andtest_bug_report,test_hle_guest_rangesandtest_parity_gatesfail onmain@2a1460546the same way on this PC.game/oot_tools.cin the game build on Windows (llvm-mingw, the pack), and the renderer (vk_menu.cppreadsoot_cheat_items.h) in the same pack. Linux (WSL Ubuntu 24.04):game/oot_tools.cwith-fsyntax-only -Wall -Wextragives the same diagnostics here as onmain@2a1460546(gcc 13.3: 3 warnings, no error, on both; clang: the same 2 errors and 1 warning on both, from a header this one-file check leaves out), so nothing new from this change.scripts/check_guide_screenshots.py --review-sourcesflaggedsettings-graphics.png, whose reviewed UI sources includegame/oot_cheat_items.h(the Insert menu's code includes it); it passes onmain. The picture shows the Graphics tab, not the Inventory page's rows this adds, so it is kept and the review is recorded indocs/user/images/guide/manifest.json(the header's new hash, at9963d60b, a note why), as #2771 recorded #2730's. The checker andtests/test_guide_screenshots.pypass.Still to test:
Measurements
Verdict: it fixes the amounts: on a save with no bags, Right once on each ammunition now gives some (none on
main), and a removal of more than is held takes what is there (refused onmain). No speed to measure: the change runs only when a Debug tab inventory edit is taken (one to four extra pouch reads then), on no frame-time path.test_oot_ammo_bagswas run again onmain@3ab4db6e9and this head705b91b08(the row below). The game rows were taken on the shared base22d0d200(before) and this branch's pack over it (after); they still hold: nothing onmainsince then touches the inventory code (game/oot_tools.c,game/oot_cheat_items.h,gpu/vk/vk_menu.cpp,host/nn_hid.care the same), and the Insert menu run above was on this head's code.3ab4db6e9705b91b08test_oot_ammo_bagsPictures (in the comment below): the pause screen on
mainafter Right once on each ammunition with no bags (Deku Stick 0, Bombs 0, Bombchus 0, Deku Nut 0), and on this branch after the same, then Bombs -3 and Deku Nuts -10 (Deku Stick 1, Bombs 17, Bombchus 1, Deku Nut 0).Risks
OOT_CHEAT_ITEM_BASE + ireports; both are built from the same header, so they move together. Nothing is saved by index:longshot_options.iniholds no inventory row.Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named).main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
mainand passes here.tests/that reads changed source is updated, not weakened.mainand here, for a change that shows on screen.Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.🤖 Generated with Claude Code
Tested in game: Windows 11 (26300), RTX 5080, NVIDIA 621.40, this branch's pack over the shared base
22d0d200, the repository's market-entrance save (child, no bags), Debug tools on. Right once on Deku Sticks, Deku Nuts, Bombs, Bombchus, Deku Seeds and Arrows each gave the smallest bag and then the add: the pause screen showed Deku Stick 1, Deku Nut 1/20, Bombs 20, Bombchus 1, and the game's counts Seeds 30 and Arrows 30 (on main all stayed 0). Bombs -3 gave 17; Change quantity Deku Nuts -10 on 1 gave 0 (refused on main). A save through the pause screen's System > Save and a relaunch kept every count and bag. Adult Link: Big Quiver, Big Deku Stick and Nut Bags from their new rows held 40 arrows, 20 sticks and 30 nuts. Not driven: the Insert menu's own keys (the same action numbers were sent through the live input file).Pause screens, the repository's market-entrance save (child Link, no bags), Debug tools on, Windows 11, RTX 5080:
Before,

main(base22d0d200, the same inventory code), after Right once on Deku Sticks, Deku Nuts, Bombs, Bombchus, Deku Seeds and Arrows: every amount still 0.After, this branch @

0b66fb67f, the same presses, then Bombs -3 and the Change quantity row's Deku Nuts -10: Deku Stick 1, Bombs 17 (the Bomb Bag's 20, less 3), Bombchus 1, Deku Nut 0 (1, then -10 cut to what was held). These counts and the bags were the same after a save through the pause screen and a relaunch.Adult Link, the Big Deku Stick and Nut Bags given from their new rows, then +63 on each: Deku Stick 20 and Deku Nut 30, full.

@review
Recommendation: Approve. The code is ready: only testing is left (a run of the change itself). The reported game runs show that ammunition can be added without an existing bag and that oversized removals take the amount held. The actual Insert menu interaction and the largest stick and nut bag rows still need an in-game check. Recommend approval; not approved on the forge.
The debug inventory gives ammunition its smallest bag when needed, limits removals to the amount held, and exposes stick and nut bag upgrades. It adds a few pouch queries per edit and can persist a newly granted bag in the save.
Testing before merging (1) (the change behaves the same on every system: one run of the change itself is enough; it doesn't hold the recommendation)
game/oot_cheat_items.h:69: The new bag rows and ammunition edit have not been exercised through the Insert menu itself. (more on the line) Do: On one supported setup, use the Insert menu to add and remove bombs, then give and remove the largest stick and nut bags and check their capacities.Checks: Failing on this head, which is behind its base, where it passes:
CI / Third-party parts and guide screenshots (pull_request).@rebase(or@fix) brings it up to date and runs it again; not held against it. Still running: 7 checks.More: does it help, other systems, switches, what was read
Does it help: Yes. The author's Windows game run reports ammunition staying at 0 on the base and becoming nonzero on the branch; Deku Nuts -10 on 1 changed from 1 to 0. The run used the menu's action numbers rather than driving the menu itself.
Other systems: The shared item list feeds both renderer labels and game-side actions, so their indices move together. The change affects debug inventory edits and saved inventory, not rendering or normal gameplay paths. Windows game behavior and save/reload were reported; the actual menu interaction remains untested.
Switches: None added, changed or removed.
Reviewed:
0b66fb67f8against2a1460546e: Read AGENTS.md, CONTRIBUTING.md, the pull request template, relevant standards, the full diff, commit messages, game/oot_cheat_items.h, tests/test_oot_ammo_bags.py and tests/test_oot_song_inventory.py. Read the changed functions and their callers in game/oot_tools.c and the inventory menu wiring; skimmed unrelated portions of the larger files, documentation and translations. No review-checklist file was found.; nothing run (a code review).Checked and fine:
Testing: Read-only review; no tests or project code were run. The author reports Windows game and game-free checks; CI is still running.
Overlaps and merge order: PR #1411 is described as having related inventory work; its separate pending-input handling remains with that PR. Merge order is not established here.
Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.
@ -66,6 +66,12 @@OOT_ITEM("Bullet Bag", "Item_BulletBag_Small", 0) \OOT_ITEM("Big Bullet Bag", "Item_BulletBag_Medium", 0) \OOT_ITEM("Biggest Bullet Bag", "Item_BulletBag_Large", 0) \OOT_ITEM("Deku Stick Bag", "Item_StickBag_Small", 0) \L1 (should fix): The new bag rows and ammunition edit have not been exercised through the Insert menu itself.
When: The reported run sent action numbers directly, so it did not check selecting and operating the new rows or entering and leaving amount editing through the menu.
Do: On one supported setup, use the Insert menu to add and remove bombs, then give and remove the largest stick and nut bags and check their capacities.
@fix
0b66fb67f83a5b1d0cdeRecommendation: Approve. The code is ready: only testing is left (a run of the change itself). The reported game runs show the ammunition fix working, but the new bag rows and ammunition edits still need an end-to-end run through the Insert menu. Recommend approval; not approved on the forge.
What
@fixchangedI changed this pull request: the new head is
3a5b1d0cde. I rebased it ontomain(8efea58644).Nothing was built or run: the checks run again on the new head.
Adding ammunition without a bag now gives the smallest bag first, and removals are limited to the amount held. The inventory also gains stick and nut bag rows; the extra pouch reads occur only during debug edits.
Testing before merging (1) (the change behaves the same on every system: one run of the change itself is enough; it doesn't hold the recommendation)
game/oot_cheat_items.h:69: The new bag rows and ammunition edit have not been exercised through the Insert menu itself. When: The reported run sent action numbers directly, so it did not check selecting and operating the new rows or entering and leaving amount editing through the menu. Do: On one supported setup, use the Insert menu to add and remove bombs, then give and remove the largest stick and nut bags and check their capacities.Checks: they run again on this head (
CI / Third-party parts and guide screenshots (pull_request)failed on the last one); a failure shows on the pull request.Also noticed (2; not asked for, not blocking)
More: does it help, other systems, switches, what was read
Does it help: Yes: the reported Windows game run changed ammunition from 0 to a nonzero amount with no bag, and a Deku Nut removal of 10 from 1 left 0 instead of 1. The menu itself was not driven.
Other systems: The change affects debug inventory edits on Windows and Linux, independently of GPU. Windows game behavior and save/load were reported; a Linux game run remains unreported.
Switches: None added, changed or removed. Existing HOS_OOT_CHEATS enables the debug tools.
Reviewed:
3a5b1d0cdeagainst8efea58644: Read the repository rules, the PR-specific diff, game/oot_cheat_items.h, game/oot_tools.c, and the two changed tests; inspected the menu action wiring and the reported runs. The user documentation was reviewed at the changed passage; unrelated rebased shader changes were not reviewed in full.; nothing run (a code review).Checked and fine:
Testing: No commands that build or run tests were executed. The author reports Windows game and game-free test results; the Insert menu still needs a manual end-to-end run.
Overlaps and merge order: PR #1411 also concerns the inventory editor; its separate handling of presses pending game processing remains there.
Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.
56cecd0e3f705b91b081Rebased on
main@3ab4db6e9; head705b91b08.BeanBot's L1 (the Insert menu itself): done, in the game through the job queue (Windows 11, RTX 5080, NVIDIA 621.40). The menu ran headless, drawn into the shots with
RX_VK_SHOT_MENU=1and driven by its own keys (RX_VK_MENU_SCRIPT), on a freshmarket-entrancesave with no bags:The Biggest bags' sizes are no longer under Still to test. Pictures follow in the next comment.
The failed CI job, "Third-party parts and guide screenshots": this is this PR's, not
main's.scripts/check_guide_screenshots.py --review-sourcespasses onmain@8efea586and failed here withREVIEW REQUIRED: settings-graphics.png: game/oot_cheat_items.h changed since reviewed revision 694ae582. The Insert menu's code includes that header, so it counts among the Graphics tab picture's sources. The picture shows the Graphics tab, not the Inventory page's new rows, so the PNG stays as it is. The review is recorded indocs/user/images/guide/manifest.json(the header's new hash at9963d60b, and a note), the way #2771 recorded #2730's. The checker andtests/test_guide_screenshots.pypass here.The Rust job's failure on the last head (
3a5b1d0c) is not from this PR, which changes no Rust. I couldn't read its log (it needs a sign-in), so the next run on this head will show whether it is still there.The Insert menu run's own shots (
RX_VK_SHOT_MENU=1), this branch, a freshmarket-entrancesave:Bombs in Edit amount after Right (the Bomb Bag, 20), Left three times and Right: the card and the HUD at 18.

After Unlock on the Biggest Deku Stick Bag and Biggest Deku Nut Bag (Upgrades), then Right on each: Deku Sticks 30, Deku Nuts 40.

After Relock on both bags: Deku Sticks 0, Deku Nuts 0.

@review
Recommendation: Approve. The reported Insert menu run shows the ammunition edit and new bag rows working, including removal and relocking. The manifest update records why the existing Graphics tab image remains applicable. Recommend approval; not approved on the forge.
Debug inventory edits now give ammunition its smallest required bag and limit removals to the amount held; players can also manage Deku Stick and Nut Bags. The change adds a small amount of work when an inventory edit is applied.
Since the last review (on
3a5b1d0cde)Resolved: L1 (The new bag rows and ammunition edit have not been exercised through the Insert menu itsel…); L2 (The check
CI / Third-party parts and guide screenshots (pull_request)fails on this head…)Checks: Still running: 7 checks.
Also noticed (2; not asked for, not blocking)
More: does it help, other systems, switches, what was read
Does it help: Yes. The reported Windows game run changed Bombs from 0 to 20 with one Right press and reduced them to 17 with three Left presses; on the base, ammunition additions without bags stayed at 0.
Other systems: The reported run covers Windows and the Insert menu, including save and reload. A Linux game run remains unreported; the change is debug inventory logic rather than GPU-specific rendering.
Switches: None added, changed or removed.
Reviewed:
705b91b081against3ab4db6e91: Read the pull request diff, repository rules and reported runs; inspected the changed guide manifest and inventory code. The full changed code files, template and referenced developer standards were not read in full; generated manifest content was skimmed.; nothing run (a code review).Checked and fine:
Testing: No commands that build or run project code were executed. The author's reported Windows game and menu runs passed; CI is still running.
Overlaps and merge order: Not checked; network access is closed.
Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.
@rebase
I rebased this pull request onto
main(a3e0d2316e): the new head isfc5fe43766.Conflicts resolved
Nothing was built or run: read the resolution before merging.
Automated rebase by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
705b91b081fc5fe43766Recommendation: Approve. The ammunition fix is demonstrated in game and the rebased manifest preserves the guide image review. The remaining PR description check is still running. Nothing blocking is left. Recommend approval; not approved on the forge.
Debug inventory edits now give ammunition its required smallest bag and clamp removals to the quantity held. The change adds bag rows and a focused game-free test, at the cost of a few pouch reads per edit.
Since the last review (on
705b91b081)Nothing changed in the ledger.
Checks: Still running:
PR description / Title and description (pull_request_target).Also noticed (2; not asked for, not blocking)
More: does it help, other systems, switches, what was read
Does it help: Yes. The author reports that ammunition additions went from 0 on the shared base to nonzero amounts on Windows, and a Deku Nut removal of 10 from 1 went from 1 remaining to 0.
Other systems: The changed inventory logic is shared by Windows and Linux and is independent of GPU rendering. Windows game and menu runs are reported; a Linux game run remains unreported.
Switches: None.
Reviewed:
fc5fe43766againsta3e0d2316e: Read the PR diff, commit list, repository rules, PR template, changed inventory header and test, and relevant manifest and checker sections. The manifest, other changed files, surrounding code and recorded runs were skimmed; tool output limits prevented a complete read of all changed files.; nothing run (a code review).Checked and fine:
Testing: No commands from the project or tests were run. The author reports Windows game and menu runs and game-free test results; the PR description check is still running.
Overlaps and merge order: None identified.
Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its rebase. Nothing was run; a maintainer decides.