WIP: fix(debug): the Inventory page keeps the edits made while the game's pause menu is open, and an unlocked Fairy Bow or Slingshot comes with its bag #2990
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
4 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!2990
Loading…
Reference in a new issue
No description provided.
Delete branch "cuecuemoar/Longshot:fix/debug-inventory-unlock"
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
#2980: Debug > Inventory looked broken while the game's own pause screen was open. Enter or A on a locked card did nothing you could see, and when you closed the pause screen only your last edit was applied. The rest were lost.
How to see it on main:
Why it happened: the game takes the Debug tab's actions during Link's own update (
oot_update_player_cheatsingame/oot_tools.c), and Link doesn't update while the pause screen is open. The Inventory page put each edit in the tools' single action slot (cheat_action), so each new edit replaced the one before. The menu side worked: with the game running, Enter and A unlock every card.What this changes:
item_pendingingpu/vk/vk_menu.cpp): Unlock or Relock, or the total of its amount changes. Pressing Enter again on a card whose Unlock or Relock is waiting takes it back (the action button reads Undo). A removal waits only down to what is held, since the game cuts the rest.menu_take_cheat_actionhands the game one edit per update, after the tools' own action (a teleport, an age switch), earliest entered first (item_pressed). A mask's Unlock returns the mask held, so with two masks entered while paused the one held after is the last entered, as in play.menu.buttonWaitsite (hos_site_menu_button_waitingame/oot_sites.c) now reads every screen's name, not only while Skip title screen waits. On the title screen (Title_00) it tells the menu (OOT_CHEAT_TITLE_ID,game/oot_cheat_items.h), which drops the waiting edits and the counts before the next save's first update. Only the title counts, because the save list may also be the in-game save screen.#2416 (what's left of it): unlocking the Fairy Bow or the Fairy Slingshot in the Inventory page gave no Quiver or Bullet Bag. The game keeps only as many arrows or seeds as the largest bag held holds, so everything picked up afterwards stayed at 0. Unlocking the Bow or the Slingshot now gives the smallest bag first when none is held, as the game's chest does (
oot_ammo_bagsingame/oot_tools.chas a weapon column). #2779 already fixed the ammunition rows themselves.Read first:
hos_site_menu_button_waitingame/oot_sites.cand theOOT_CHEAT_TITLE_IDcase inmenu_option_set.inventory_edit,inventory_takeandinventory_waitingbeside the Inventory page's state ingpu/vk/vk_menu.cpp, thenmenu_take_cheat_action.menu_tick.oot_ammo_bagsandoot_pouch_addingame/oot_tools.c.The guide's Graphics image is kept:
vk_menu.cppchanges only the Debug tab's Inventory page, nothing on the Graphics tab it pictures, so this PR updates only its andgame/oot_cheat_items.h's fingerprints (docs/user/images/guide/source-review-2980.md). On main56823e27a,check_guide_screenshots.py --review-sourcesalready reportsvk_dlss.h,vk_temporal.handvk_texture.h(from #2807, #2930 and #2909), and this PR leaves those three as they are.Overlaps #1411 (mooki's Progress editor, open): it also changes how the Debug tab's actions wait, as a queue of sixteen with an item's amount presses summed. Both PRs change
menu_take_cheat_actionandmenu_tick's Inventory branch, so whichever merges second rebases onto the other. This PR is the small fix for the pause-screen case alone: every edit is kept per item, and the page says when edits are waiting.Fixes #2980
See #2416
See #1411
Testing
Tested: Windows 10, RTX 4090, keyboard and an Xbox-style controller, through the PC's job queue.
cheats: inventory Item_GlassTruth +1,Item_MagicBean +1,Item_ZeldaLetter +1). The Lens of Truth then showed in the game's pause screen.cheats: Weapon_Range_Bow needs a bag: gave Item_Quiver_Small first, then the Bow. The same happened for the Slingshot with its Bullet Bag.c3fcfb4ef(after BeanBot's review):Armor_Child_Mask_Truth +1, thenreturned Armor_Child_Mask_Truth,Armor_Child_Mask_Keaton +1), so Keaton is held.cheats: inventoryline.9c3da4c00, headless, kokiri-start, the game's pause screen open under the Insert menu: Enter on the Lens of Truth's card shows "Unlock waiting", and the help shows the paused message (screenshots in a comment, against main56823e27a, where the card stays "Locked"). Since 840e0281d, the head adds only the floor on a waiting removal (Left on Magic Beans at 0 now leaves "Quantity 0", not "Quantity 0 -1" as the earlier head did) and the guide record (manifest.json,source-review-2980.md).The checks:
tests/test_debug_inventory_wait.py, cuts the Inventory page's code,menu_tick's Inventory branch andmenu_take_cheat_actionout ofvk_menu.cpp. It presses keys while the game takes nothing, then lets play go on.FAIL: edits made while the game took none (its pause menu open): Lens Unlock x0, Bow Unlock x0, Bombs +1, other 0 reached the game once play went on (want 1, 1, +2, 0).hos_site_menu_button_waitandmenu_option_set's title case, and checks that edits arrive in the order entered (two masks, the table's later one first) and that an edit waiting when the title screen shows doesn't reach the next save.tests/test_skip_title.pyruns the button-wait site over made-up memory. It now expects the name read at every wait, the title told to the menu, and Skip title told only while it waits. It passes with gcc and clang, and fails without the title report.tests/test_oot_ammo_bags.py, fails on main withFAIL: Unlock Weapon_Range_Bow with no bag: 1 held, 0 bags, 0 Item_Arrow_Normaland passes here.test_oot_bottles.pyandtest_cheat_items.pypass.test_oot_song_inventory.pyfails with g++ on main too ("taking address of temporary array", in code this PR doesn't touch) and passes with clang++.--strict: the renderer builds and the host warnings are the same as main's.tests/run_all.pygives 829 passed and 89 failed on the final headc3fcfb4ef, against 828 passed and 89 failed on main56823e27a. The same 89 files fail on both, and the one extra pass is the new test.Still to test: none. The change is in the menu and the game's item handling, not in the GPU path.
Measurements
Nothing to measure: a Debug-tab change. Per update it adds a look at 92 counters while nothing waits; it adds nothing to rendering or presenting.
Risks
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
https://claude.ai/code/session_01VxeaZjwDPeBQHm27jxvFnQ
Tested in game: Windows 10, RTX 4090, keyboard and an Xbox-style controller. By hand on a player's save (840e0281d): with the game's pause screen open under the Insert menu, Debug > Inventory's Lens of Truth, Magic Beans and Zelda's Letter read 'Unlock waiting', a second press undid one, and closing the pause screen applied all three in order; the Lens then showed in the pause screen (on main the cards stayed Locked and only the last edit applied). Headless on kokiri-start: the final head
9c3da4c00shows the waiting card and the paused help, and Fairy Bow / Slingshot unlocks give the Quiver / Bullet Bag first.Screenshots: the same steps on main and on this PR (headless, 1280x720, kokiri-start, Debug tools on). The game's pause screen is open under the Insert menu; Debug > Inventory, Enter on Lens of Truth, then Right to Magic Beans, Enter, Left, Enter.
Before: main @
56823e27a: the Lens of Truth's card stays Locked and the help says nothing; the edit waits unseen in the tools' one action slot.After: this PR @
9c3da4c00: the Lens of Truth reads "Unlock waiting", and the help says the game is paused and the changes apply when its menu closes. Left on Magic Beans at 0 leaves no removal waiting.Possibly related, for context:
@review
Recommendation: Request changes. The per-item queue can apply edits in a different order from the one entered, changing the resulting inventory. Pending edits can also cross into another save because the save-state refresh happens after an action is taken.
The change preserves multiple Inventory edits while Link is paused and gives an unlocked Bow or Slingshot its smallest ammunition bag. The queue improves feedback, but its ordering and save lifetime can produce unintended inventory changes.
Blocking (2): must change before merging.
gpu/vk/vk_menu.cpp:781: Pending edits are delivered in item-table order, not the order in which the player entered them. (more on the line) Do: Preserve the relative order of edits whose effects can interact, and add a test that enters two masks in reverse table order and checks the final held mask.gpu/vk/vk_menu.cpp:4871: Clearing pending edits on a negative count does not reliably detect a save going away. (more on the line) Do: Invalidate pending edits on an independently observed save unload or save identity change, before any action can be taken for the next save; test a queued edit across that transition.@fixcan do L1 and L2.Checks: Still running: 11 checks.
More: does it help, other systems, switches, what was read
Does it help: Yes for the reported cases: the author reproduced the lost edits on main and reports three edits applying on 840e0281d, plus waiting feedback on final head. The queue does not preserve the order claimed for all items, and its save transition behavior remains incorrect.
Other systems: The game-side inventory handler, mask slot, save transitions, other debug actions and input recording share the action path. The reported Windows game run covers the main pause case; the supplied game-free tests model the bag behavior and queue but do not cover mask ordering or changing saves with pending edits.
Switches: None.
Reviewed:
9c3da4c004against56823e27a1: Read the repository rules, PR template, standards, both changed tests, the changed game-side and menu sections and their callers, the item table, commit messages and screenshot source review. Skimmed the manifest and test runner. The full 6,079-line vk_menu.cpp and 1,611-line oot_tools.c were not read in full; the recorded screenshots were not available locally.; nothing run (a code review).Checked and fine:
Testing: No commands from the project were run, as requested. The supplied CI checks are still running; the author's reported runs are described in the pull request.
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.
@ -762,0 +778,4 @@/// The game's thread: the first item with an edit waiting, as its action (OOT_CHEAT_ITEM_ACTION + item * 256 + op; an amount/// in steps the op holds, -64 to 63), taken from the wait; 0 noneint inventory_take() {for (int i = 0; i < kItems; ++i)L1 (blocking): Pending edits are delivered in item-table order, not the order in which the player entered them.
When: With the game paused, unlock Mask of Truth and then Keaton Mask. Keaton is earlier in the table, so it is applied first; applying Mask of Truth afterward returns Keaton from the shared mask slot, leaving Mask of Truth instead of the last selected mask.
Do: Preserve the relative order of edits whose effects can interact, and add a test that enters two masks in reverse table order and checks the final held mask.
@ -4826,6 +4868,7 @@ void menu_option_set(int id, int value) {if (id >= OOT_CHEAT_ITEM_BASE && id < OOT_CHEAT_ITEM_BASE + kItems) { // (the game side's inventory counts)if (item_counts[id - OOT_CHEAT_ITEM_BASE].exchange(value, std::memory_order_relaxed) != value && page == 4)menu_refresh = true;if (value < 0) item_pending[id - OOT_CHEAT_ITEM_BASE].store(0, std::memory_order_relaxed); // (no save: its edits go)L2 (blocking): Clearing pending edits on a negative count does not reliably detect a save going away.
When: Queue an edit while Link is paused, return to the title and load another save before Link updates. Inventory counts are refreshed only during Link's update, and that update takes an action before refreshing counts; the queued edit is therefore applied to the newly loaded save while its counts are valid.
Do: Invalidate pending edits on an independently observed save unload or save identity change, before any action can be taken for the next save; test a queued edit across that transition.
WIP: fix(debug): the Inventory page keeps the edits made while the game's pause menu is open, and an unlocked Fairy Bow or Slingshot comes with its bagto fix(debug): the Inventory page keeps the edits made while the game's pause menu is open, and an unlocked Fairy Bow or Slingshot comes with its bag@review
Recommendation: Request changes. Pending inventory edits still run in item-table order, and edits can survive a save change because the refresh that clears them runs only during Link’s update. Both can change the outcome of edits made while the game is paused.
The change keeps multiple Debug Inventory edits while the pause menu is open and gives an unlocked Bow or Slingshot its smallest bag. It adds pending-state handling, but ordering and save-lifetime handling remain incorrect.
Blocking (2): must change before merging.
gpu/vk/vk_menu.cpp:781: Pending edits are delivered in item-table order, not the order in which the player entered them. When: With the game paused, unlock Mask of Truth and then Keaton Mask. Keaton is earlier in the table, so it is applied first; applying Mask of Truth afterward returns Keaton from the shared mask slot, leaving Mask of Truth instead of the last selected mask. Do: Preserve the relative order of edits whose effects can interact, and add a test that enters two masks in reverse table order and checks the final held mask.gpu/vk/vk_menu.cpp:4871: Clearing pending edits on a negative count does not reliably detect a save going away. When: Queue an edit while Link is paused, return to the title and load another save before Link updates. Inventory counts are refreshed only during Link's update, and that update takes an action before refreshing counts; the queued edit is therefore applied to the newly loaded save while its counts are valid. Do: Invalidate pending edits on an independently observed save unload or save identity change, before any action can be taken for the next save; test a queued edit across that transition.@fixcan do L1 and L2.Since the last review (on
9c3da4c004)Still open: L1 (Pending edits are delivered in item-table order, not the order in which the player entered…); L2 (Clearing pending edits on a negative count does not reliably detect a save going away.)
Checks: Still running: 10 checks.
Also noticed (1; not asked for, not blocking)
More: does it help, other systems, switches, what was read
Does it help: Yes for the reported pause-menu case: the author reports three edits applying after unpausing on Windows, and reports Bow and Slingshot bag checks. The remaining ordering and save-change cases are not fixed.
Other systems: The pending actions share the Debug tools’ action path and can affect a subsequent save. The game-side item handling runs on Windows and Linux; the author reports builds on both and a Windows game run.
Switches: None.
Reviewed:
9c3da4c004against56823e27a1: Read AGENTS.md, CONTRIBUTING.md, the pull request template, the relevant diff and the pending-edit and game refresh paths. Skimmed the recorded runs, test diff and guide record. The changed code files were not read in full; docs/review-checklist.md and the adjacent Tooling AGENTS.md were absent.; nothing run (a code review).Checked and fine:
Testing: No tests were run during this read-only review. The author reports a Windows game run, game-free checks, Linux and Windows builds; CI is still running.
Overlaps and merge order: #1411 also changes the inventory action path; whichever merges second needs to reconcile the changes.
Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.
9c3da4c004c3fcfb4ef9Addressed BeanBot's review (both points held up in the code), now at
c3fcfb4ef(test7af51e9cb, fixc3fcfb4ef), still on main56823e27a:item_pressedstamps;inventory_taketakes the earliest). The test enters Mask of Truth, then Keaton Mask, and Lens, Bow, Bombs (each the reverse of the table), and checks the order. In the game, headless:Armor_Child_Mask_Truth +1, thenreturned Armor_Child_Mask_Truth,Armor_Child_Mask_Keaton +1, so Keaton is held.hos_site_menu_button_waitnow reads every screen's name, and the title screen (Title_00) tells the menu (OOT_CHEAT_TITLE_ID), which drops the waiting edits and the counts before the next save's first update of Link's. The test runs the real site into the realmenu_option_setcase. By hand on Windows: Lens of Truth waiting, back to the title through the game's System menu, a save loaded: the Lens stayed Locked, and nocheats: inventoryline. Only the title counts: the save list may also be the in-game save screen.tests/test_skip_title.py's run of the site is updated to match, and Skip title screen still loads the save in the game (11.4 s).--strict: 829 passed and 89 failed onc3fcfb4ef, against 828 and 89 on main, the same files.@review
Recommendation: Approve. The waiting inventory edits are taken in entry order, and returning to the title clears them before another save loads. The reported in-game checks cover both fixes. Recommend approval; not approved on the forge.
The Debug Inventory page retains edits made while the game is paused and shows that they are waiting; unlocking the Bow or Slingshot also supplies the corresponding small bag when needed. The fix adds per-item pending state and ordering logic.
Since the last review (on
9c3da4c004)Resolved: L1 (Pending edits are delivered in item-table order, not the order in which the player entered…); L2 (Clearing pending edits on a negative count does not reliably detect a save going away.)
Checks: Still running: 10 checks.
More: does it help, other systems, switches, what was read
Does it help: Yes. The author reports that three paused edits applied in order, two masks left the last-entered mask held, and a waiting edit did not reach a subsequently loaded save. This is not a performance change.
Other systems: The title-screen hook also runs when Skip title screen is enabled; the author reports that autoload still reached the save. The change affects game and menu action handling on both Windows and Linux, rather than GPU rendering.
Switches: None.
Reviewed:
c3fcfb4ef9against56823e27a1: Read the changed inventory ordering and title-clearing code, the relevant game-site and item-handling diffs, the commit history, and the supplied test reports. Skimmed the repository rules and the remaining site code; the full changed code and tests were not read.; nothing run (a code review).Checked and fine:
Testing: No commands from the pull request were run. The author reports Windows in-game checks, Linux and Windows builds, and game-free checks; CI is still running.
Overlaps and merge order: #1411 also changes inventory action handling; whichever merges second needs to rebase.
Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.
Please rebase on mod-api branch!
fix(debug): the Inventory page keeps the edits made while the game's pause menu is open, and an unlocked Fairy Bow or Slingshot comes with its bagto WIP: fix(debug): the Inventory page keeps the edits made while the game's pause menu is open, and an unlocked Fairy Bow or Slingshot comes with its bagSuperseded by #3030, as HumanBean asked: the same fix for
mod-api, where the game side and the Debug tools are now Rust. This PR can't be rebased there: the files it changes (game/oot_tools.c,game/oot_sites.c, the Inventory page invk_menu.cpp) are gone onmod-api.#3030 keeps every Inventory edit made while the game's pause screen is open and gives them to the game in the order made, and an Amount of more than 63 arrives whole. It also covers what the reviews here raised: the mask order, and no edit reaching another save (a map loading drops them). It ran in the game on
mod-api, before and after; the log lines and screenshots are there.The Fairy Bow and Slingshot bag (#2416's part of this PR) goes to its own PR on
mod-api, as BeanBot asked on #3030; it will be linked there.Pull request closed