fix(debug): the Debug tab's Empty Bottle row counts the bottles held, and Left takes one away #2785
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!2785
Loading…
Reference in a new issue
No description provided.
Delete branch "llun/Longshot:fix/debug-bottle-count"
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
Stacked on #2779 (the ammunition amounts): it touches the same functions, so merge #2779 first. This pull request's own commits are the last four:
test(debug): the Debug tab's Empty Bottle row on a save with bottles,fix(debug): the Debug tab's Empty Bottle row counts the bottles held, and Left takes one away,docs(debug): ...(one sentence about the row in the Debug tab's paragraph ofdocs/user/graphics-and-controls.md), andfix(debug): preserve recorded inventory action IDs. The guide manifest change is #2779's.Players report "I can't reduce my number of empty bottles". In the Debug tab's Inventory page, the Empty Bottle row always showed 0, and Left on it did nothing. Right did give a bottle.
The cause: the game doesn't keep bottles as a pouch content. Its count by name (
QueryGetPouchContentNumByActorName) reads 0 forItem_Bottle,Weapon_Bottleand everyItem_Bottle_*with bottles held, and it refuses to remove one (event status 3). The game keeps bottles in five slots,PlayerStatus.AssignableItem.BottleInfo.BottleAtoBottleE. Each slot is a struct with two flags: the Bool.IsValid(a bottle is there) and the Enum.BottleItem(what is in it:Empty,RedPotion, ...HalfMilk, by the hash of the name; it also readsEmptywhen no bottle is there). Seen in the game: each Right set the next slot'sIsValidwithEmptyin it, and added 1 to an Int whose name isn't known (0x8a5eeacf). That Int is the number of bottles held: the HUD reads it to show the bottle button when it is 1 or more.This changes the Empty Bottle row:
Emptyin them. A bottle with something in it isn't counted.PlayerStatus.AssignableItem.Child,.Adult) that named a bottle moved there follows it, and one that named the bottle taken is cleared.To see it on
main: load a save with bottles, or give some with Right on Debug > Inventory > Items > Empty Bottle. The row stays at 0, the log sayscheats: inventory Item_Bottle +1 (had 0, now 0, ...)each time, and Left does nothing.Read first: the
/* Bottles.block beforeoot_item_countingame/oot_tools.c(oot_bottles_takeis the removal), thentests/test_oot_bottles.py. The game's setters are together inoot_gamedata_queue(the Bool one moved there fromoot_gamedata_queue_bool, unchanged).See #2335 (its bottle half), #803.
Testing
Tested: Windows 11 (build 26300), RTX 5080 (NVIDIA 621.40). This branch's game was built as a pack over the shared base
22d0d200(dev.py pack/rt) and run through the job queue on the repository'smarket-entrancesave, the run's own copy of it, with Debug tools on (HOS_OOT_CHEATS=1). The edits were sent as the menu sends them, as!cheatactions in the live input file, and read back from the log and the pause screen.inventory Item_Bottle +1line saidhad 0, and Left did nothing. A flag scan showed what the game changes for each bottle given:BottleInfo.BottleA.IsValid, thenBottleB's, and the Int0x8a5eeacfgoing 0, 1, 2.had 0,had 1,had 2,had 3, and the pause screen showed four bottles. Left:cheats: bottles: took 1 empty of 1 asked (slots now ABC.., ...; bottles held before 4), and the pause screen showed three. Left twice more: one bottle (bottles held before 3, then2). Right:had 1, and two bottles.relaunch) and loaded the save. The inventory probe line saidItem_Bottle=2. The pause screen showed 3 bottles: the relaunched game replayed the live file's last+1(the log shows+1 (had 2, ...)after the load).tests/test_oot_bottles.pyfails at the test commit (FAIL: 4 empty bottles held, the Empty Bottle row shows 0) and passes at the fix, with both clang++ and g++. It also fails when the fix's removal is undone, or when it takes the empty bottle's own slot instead of the last one (Left on EF... left .F...).test_oot_ammo_bags.pyandtest_oot_song_inventory.pycut the same functions, so they now get the setters and the bottle block. They pass, as do the other checks that readgame/oot_tools.c. The checks that readdocs/user/graphics-and-controls.mdpass (test_settings_table.py,test_hud_layout_row.py,test_stick_dead_zone.py,test_stick_range.py,test_camera_speed.py,test_skip_title.py,test_threaded_rendering.py,test_walk_key.py).game/oot_tools.ccompiles with Linux gcc (-fsyntax-only -Wall -Wextra, WSL Ubuntu 24.04) with the same three warnings as before the change.mise run test(tests/run_all.pythrough the queue, Windows, clang from the pinned llvm-mingw,RX_CPMthe pinned headers): 635 passed, 71 failed, 187 skipped here; on #2779's head (705b91b0, the same PC and settings) 633 passed, 72 failed, 187 skipped. Every check failing here also fails there; most are this PC's Windows setup for the renderer, queue and dev-tool checks (for exampletest_parity_gates.py,test_job_queue.py,test_input_movie.py: a clang-Wunused-but-set-globalin its glue). Two of them readgame/oot_tools.c(test_bug_report.py,test_hle_guest_ranges.py): they fail the same way on #2779's head, for things outside the bottle code (bug_report_save does not take the game folder; a program not found on this PC).Still to test:
market-entrancesave with Debug tools on. Expect the row to read 4, then 3, and the pause screen to show three bottles (@Beanstalk).Measurements
Nothing to measure: the bottle change runs only when the Debug tab's Empty Bottle row is read or changed (twice a second for the count while a save is loaded: five Bool and five Enum flag reads). The inventory row order also preserves recorded action IDs. The in-game evidence is the log lines above. Before: this branch's parent (#2779 @
705b91b0) on base22d0d200; After: this PR's fix, tested at the commit before the rebase onto #2779's newest head, which only brought inmain's renderer and builder changes.Risks
0x6bee602d) names the slot of the newest bottle given. Left doesn't change it, so after a removal it can name a slot with no bottle. The pause screen opened normally on slot A after that.cheats: bottles: ... not found.Checklist
Ready for review
main; the title is a Conventional Commit. (Stacked on #2779, which is on currentmain.)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.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), the repository's market-entrance save (child Link, the Market), Debug tools on, through the job queue: Right four times on Empty Bottle read had 0, 1, 2, 3 and the pause screen showed four bottles; Left took one (pause screen: three), twice more (one), Right gave one back (two). After a map change's autosave and a relaunch the save loaded with Item_Bottle=2. Before the fix the row stayed at 0 and Left did nothing.
WIP: fix(debug): the Debug tab's Empty Bottle row counts the bottles held, and Left takes one awayto fix(debug): the Debug tab's Empty Bottle row counts the bottles held, and Left takes one awayAdded one sentence about the Empty Bottle row to the Debug tab's paragraph in docs/user/graphics-and-controls.md (
2581ff11), and ticked Docs updated. The checks that read that page pass.@review
Recommendation: Request changes. The bottle fix works for the tested empty-bottle sequence, but inserting inventory rows changes the meaning of existing recorded actions and can alter the wrong saved item on playback. The filled-bottle and assigned-button paths still need an in-game check.
The Debug inventory counts empty bottles and removes one while preserving filled bottles in its slot model. It also includes the stacked ammunition fix and bag rows; the added rows currently break compatibility with recorded inventory actions.
Blocking (1): must change before merging.
game/oot_cheat_items.h:69: Inserting these rows changes the numeric action IDs of every later inventory item, including items already present in input recordings. (more on the line) Do: Give inventory actions stable item IDs independent of menu order, or preserve the existing indices and assign new IDs to these six rows. Add a playback compatibility check for an existing later-item action.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_tools.c:427: The filled-bottle move and assigned-button updates have not yet been exercised in the game. (more on the line) Do: Run the described in-game fairy and child/adult button cases, including a save and reload, and report the results.@fixcan do L1.Checks: Still running: 7 checks.
More: does it help, other systems, switches, what was read
Does it help: Yes for the tested basic case: the Windows run showed four empty bottles, then three after Left, and two after subsequent edits and a save/load. Filled-bottle moves and item-button updates have only been checked against a game-free model.
Other systems: The slot and button edits affect saved inventory for both ages. Input recordings store the numeric Debug action and replay it through the same inventory table; existing recordings after the inserted rows are affected. The change does not target rendering or GPU-specific behavior.
Switches: None added, changed, or removed.
Reviewed:
2581ff11a2against3ab4db6e91: Read the available AGENTS.md, CONTRIBUTING.md, PR template and standards, the commit log and diff, the changed game code and tests, and the relevant flag, game-call, menu and input-recording paths. Skimmed the guide manifest and other unrelated portions of the large game file. docs/review-checklist.md and ../Tooling/AGENTS.md were absent.; nothing run (a code review).Checked and fine:
Testing: No commands from the project were run. The reported Windows game run and game-free checks were considered; CI was still running. Merge also waits for the stated #2779 dependency.
Overlaps and merge order: #2779 is the stated prerequisite and supplies the ammunition and bag changes; merge it first.
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 (blocking): Inserting these rows changes the numeric action IDs of every later inventory item, including items already present in input recordings.
When: A recording made on the base with an Adult's Wallet toggle stores its table index in the action. Playback on this branch uses that same index for Deku Stick Bag and changes that item instead; later quest and song actions are similarly shifted and can change the wrong saved state.
Do: Give inventory actions stable item IDs independent of menu order, or preserve the existing indices and assign new IDs to these six rows. Add a playback compatibility check for an existing later-item action.
@ -318,0 +424,4 @@OotBottles was, now;const char *missing = oot_gamedata_setters();if (missing || !oot_bottles_read(&was)) {if (missing) hos_log("cheats: bottles: %s not found", missing);L2 (should fix): The filled-bottle move and assigned-button updates have not yet been exercised in the game.
When: With an empty bottle before a filled bottle, Left moves the contents and rewrites the child and adult button flags. The test models those setters and flag meanings, so it cannot establish that the game retains the contents and button assignments after the actual queued writes and reload.
Do: Run the described in-game fairy and child/adult button cases, including a save and reload, and report the results.
@fix
Recommendation: Approve. The code is ready: only testing is left (a run of the change itself). The ordinary empty-bottle count and removal worked in the reported Windows run, but the filled-bottle move and assigned-button updates still need an in-game check. This pull request also depends on #2779 merging first. Recommend approval; not approved on the forge.
What
@fixchangedI changed this pull request: the new head is
ef2d9cead3. I edited its description to match the change.Changed
Nothing was built or run: the checks run again on the new head.
The Debug inventory row counts empty bottles and can remove them while preserving filled bottles and button assignments. The follow-up restores existing recorded inventory action IDs by appending the new bag rows.
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_tools.c:427: The filled-bottle move and assigned-button updates have not yet been exercised in the game. When: With an empty bottle before a filled bottle, Left moves the contents and rewrites the child and adult button flags. The test models those setters and flag meanings, so it cannot establish that the game retains the contents and button assignments after the actual queued writes and reload. Do: Run the described in-game fairy and child/adult button cases, including a save and reload, and report the results.Checks: they run again on this head; 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 for the tested empty-bottle case: the Windows run showed counts rising from 0 to 4 and falling on Left, with the result surviving a save and load. The filled-bottle and assigned-button cases remain unverified in game.
Other systems: The bottle logic writes game save flags and item-button assignments on both Windows and Linux. The reported Windows run covers empty bottles; the filled-bottle and button cases and a Linux run remain outstanding.
Switches: None added, changed or removed.
Reviewed:
ef2d9cead3against3ab4db6e91: Read AGENTS.md, CONTRIBUTING.md, the pull request template, the bottle removal and inventory edit code, the inventory item list and the relevant test fixture. Inspected the follow-up diff and references to the inventory action IDs; other changed files and the full game source were not read in full. The review checklist file was absent.; nothing run (a code review).Checked and fine:
Testing: No commands from the project were run. The author reports game-free checks and a Windows in-game empty-bottle run; the filled-bottle and assigned-button cases still need an in-game run. CI has not run on this head.
Overlaps and merge order: Stacked on #2779; merge #2779 first.
Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.
@rebase
I rebased this pull request onto
main(569537f71d): the new head is9d0162700e.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.
ef2d9cead39d0162700eRecommendation: Approve. The code is ready: only testing is left (a run of the change itself). The reported game run shows empty bottles can be counted and removed, but the filled-bottle move and assigned-button updates still need an in-game check. The change also depends on #2779 merging first. Recommend approval; not approved on the forge.
The Debug inventory row counts empty bottles and can remove them while preserving filled bottles and recorded inventory action IDs. The added slot and flag handling increases complexity, with its more involved cases covered by a game-free model.
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_tools.c:427: The filled-bottle move and assigned-button updates have not yet been exercised in the game. When: With an empty bottle before a filled bottle, Left moves the contents and rewrites the child and adult button flags. The test models those setters and flag meanings, so it cannot establish that the game retains the contents and button assignments after the actual queued writes and reload. Do: Run the described in-game fairy and child/adult button cases, including a save and reload, and report the results.Since the last review (on
ef2d9cead3)Still open: L2 (The filled-bottle move and assigned-button updates have not yet been exercised in the game…)
Checks: Still running: 11 checks.
Also noticed (3; not asked for, not blocking)
More: does it help, other systems, switches, what was read
Does it help: Yes for empty bottles: the reported Windows run showed counts rising from 0 to 4, then falling with Left, and two bottles persisted through a save and reload. Filled-bottle and assigned-button behavior remains unproven in game.
Other systems: The change writes save-backed bottle and item-button flags for both ages; the game-free test models those paths, but their actual game behavior remains to be checked. Linux has a reported syntax check but no reported in-game run.
Switches: None.
Reviewed:
9d0162700eagainst569537f71d: Read AGENTS.md and CONTRIBUTING.md, the bottle implementation and its caller, and the reported tests and review history. Skimmed the remaining diff; did not read every changed file in full.; nothing run (a code review).Checked and fine:
Testing: No commands from the project were run. The author's reported Windows game run and game-free checks were considered.
Overlaps and merge order: #2779 is the prerequisite; merge it first.
Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its rebase. Nothing was run; a maintainer decides.