fix(debug): keep inventory song edits when a save reloads #2326
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
Total time spent: 4 hours 39 minutes
Due date
posihdun
4 hours 39 minutes
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!2326
Loading…
Reference in a new issue
No description provided.
Delete branch "posihdun/Longshot:fix/debug-song-save"
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
I unlocked Epona's Song in Debug → Inventory. It showed as learned until I loaded the next save, where the song was locked again.
The editor now uses the game's Bool setter so the next save keeps the edit. Unlock and relock both use the same path. Start with
oot_inventory_editinhost/hos_main.c.Fixes #2166.
Testing
Tested: Ubuntu 24.04.5, Intel Arc B580, Mesa 26.2.7. I started from the castle-gate save, unlocked Epona's Song with the same action as Debug → Inventory, and went into Castle Town. On the patched build, the autosave kept the flag and it was still set after restarting and loading that save.
I also started from a save where Epona's Song was learned, relocked it with the Debug Inventory action, and used System → Save. I restarted and loaded that manual save. The song was still locked.
The song test now runs the real Bool setter helper with a stand-in for the game call. I changed the helper locally to write only the live flag and confirmed the test failed after reload. The song and teleport checks passed with GCC and Clang. The Linux suite had 924 passes, 15 failures, and 18 skips. The same 15 checks also failed on current
main: audio_source, control, crash_record, dev_packs, heart_containers, longshot_ctl, mise_build, obj_cache_size, oot_state_tap, perf_report, pipeline_state_computes, pipeline_tour, program_cache_reader, saveload_warm_cache, and seed_reader.Still to test:
Measurements
Verdict: The game now writes the edited song flag to the save.
Setup: Ubuntu 24.04.5, Arc B580, Mesa 26.2.7, child Link at the castle gate. Unlock Epona's Song, enter Castle Town, and read the flag in the published autosave. The baseline build is older than current main. The inventory code is the same on both.
a2dc53858b8ae997Risks
This uses the same game setter already used by debug teleport. The edit is applied when the game processes its queue. A normal save is still required to keep it. A revert restores the old edit path.
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.Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.Tested in game: Ubuntu 24.04.5, Arc B580, Mesa 26.2.7. I unlocked Epona’s Song with the Debug Inventory action, went into Castle Town, and reloaded the autosave. The song stayed learned.
Possibly related, for context:
WIP: fix(debug): keep inventory song edits when a save reloadsto fix(debug): keep inventory song edits when a save reloads@review
Recommendation: Approve. The reported game run shows that unlocking a song survives an autosave, but the regression test replaces the persistence fix with a fake and cannot detect its removal. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge.
Song edits now use the game's queued Bool setter so a later save can retain them. The shared setter also replaces the equivalent teleport code; the added test exercises inventory toggles but does not verify the real setter path.
Should fix (1): not blocking, but worth doing before merging.
tests/test_oot_song_inventory.py:51: The test substitutes its own queued setter, so it never exercises the helper that implements the persistence fix. (more on the line) Do: Compile the real queue helper into the fixture with stand-in guest lookup and manager calls, and model the live-only path separately so reverting the fix fails on the saved flag.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)
@fixcan do L1.Checks: Still running: 9 checks.
More: does it help, other systems, switches, what was read
Does it help: Yes for the reported unlock case: the author's Ubuntu game run reports the saved flag changing from 0 on the older baseline to 1 on this PR, and remaining set after reload. Relocking after a save and reload has not been reported.
Other systems: The shared helper also handles teleport's minimap repair; its argument order and context restoration match the previous path. The change does not target rendering or GPU-specific behavior. Windows and the relock path remain untested in game.
Switches: None.
Reviewed:
8b8ae997e9against0e32bc100d: Read the repository rules, standards, PR template, commits, both changed-file diffs, the song test and the affected host functions and callers. Skimmed the remainder of host/hos_main.c and the teleport regression fixture. docs/review-checklist.md and the adjacent Tooling checkout were absent. No generated files or recorded runs were changed.; nothing run (a code review).Checked and fine:
Testing: No commands from the project or tests were run, as requested. The author reports a successful Linux unlock and reload and GCC and Clang checks; CI is still running.
Overlaps and merge order: Unknown; the network was closed.
Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.
@ -51,3 +51,1 @@const auto i = flags.find(hash);if (i == flags.end() || reject_flag_write) return 0;i->second = value;static const char *oot_gamedata_queue_bool(Ctx *, uint32_t hash, int value) {L1 (should fix): The test substitutes its own queued setter, so it never exercises the helper that implements the persistence fix.
When: If oot_gamedata_queue_bool is changed back to a live-only write, this fixture still updates saved_flags through its fake pending queue and passes, even though song edits are lost after reload.
Do: Compile the real queue helper into the fixture with stand-in guest lookup and manager calls, and model the live-only path separately so reverting the fix fails on the saved flag.
BeanBot’s test flag is fixed in
066e8395. The test now runs the real queued Bool helper. I checked that it fails after reload if the helper only writes the live flag. The updated test passes with GCC and Clang.I also relocked Epona’s Song on Linux, saved through System → Save, restarted, and loaded that save. The song stayed locked.
@review
Recommendation: Approve. The song edit now uses the game's queued Bool setter, and the reported Linux runs show both unlocking and relocking survive a save reload. The updated game-free test exercises the actual helper. Recommend approval; not approved on the forge.
Debug Inventory song edits persist after a normal save and reload. The shared setter helper also keeps teleport's existing behavior, with little added complexity.
Since the last review (on
8b8ae997e9)Resolved: L1 (The test substitutes its own queued setter, so it never exercises the helper that implemen…); L2 (The reported game run covers unlocking but not relocking a learned song.)
Checks: Still running: 9 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 Linux comparison shows Epona's Song's saved flag changing from 0 before the fix to 1 afterward; a separate manual-save run confirms relocking persists.
Other systems: The helper is also used by debug teleport; its existing setter, arguments and context restoration are retained. The path is shared by Windows and Linux; the reported game run is on Linux.
Switches: None.
Reviewed:
066e839546against0e32bc100d: Read the changed test and the relevant inventory, game-data and teleport code; inspected both diffs, commits, repository rules and the pull request template. The remainder of host/hos_main.c was skimmed; docs/review-checklist.md is absent.; nothing run (a code review).Checked and fine:
Testing: Author reports game runs for unlock and relock on Ubuntu, and the updated test passing with GCC and Clang; no tests were run during this review.
Overlaps and merge order: None found in the supplied information.
Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.
@BeanBot wrote in #2326 (comment):
thanks robobean, ily <3
@review
Recommendation: Approve. The queued Bool setter preserves song edits in the reported Linux save-and-reload runs, and the game-free test exercises both unlock and relock. No blocking issue remains in the supplied ledger. Recommend approval; not approved on the forge.
Debug Inventory song edits now use the game's queued setter so a subsequent save retains them. The shared helper also preserves teleport's existing setter behavior with little added complexity.
Since the last review (on
066e839546)Nothing changed in the ledger.
Checks: Still running: 9 checks.
Also noticed (4; not asked for, not blocking)
More: does it help, other systems, switches, what was read
Does it help: Yes. The author reports the saved Epona's Song flag was 0 before the fix and 1 afterward on Linux; a separate manual-save run retained a relocked song.
Other systems: The shared helper also serves debug teleport and retains its setter arguments and guest context restoration. The path is shared by Windows and Linux; the reported game runs were on Linux.
Switches: None.
Reviewed:
066e839546against0e32bc100d: Read the full changed test, the diff, commits, repository rules, standards and pull request template; read the relevant inventory, game-data and teleport code in host/hos_main.c and skimmed the rest. docs/review-checklist.md and the adjacent Tooling AGENTS.md were unavailable.; nothing run (a code review).Checked and fine:
Testing: The author reports Linux game runs for unlock and relock, and the updated test passing with GCC and Clang. No tests or project scripts were run for this review.
Overlaps and merge order: None found in the supplied information.
Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.