fix(cheats): a song unlocked or relocked on the Inventory page is kept when a save reloads #3089
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
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!3089
Loading…
Reference in a new issue
No description provided.
Delete branch "llun/Longshot:fix/song-unlock-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
A song unlocked or locked again on the cheats' Inventory page changed in the running game but not in the save. After saving and loading, the change was gone.
How to see it on
main:#2326 fixed this in the C code by using the game's own setter. The Rust port (#2822) went back to writing only the value in play, so the fix was lost.
What this changes: the song edit in
inventory_edit(game/crates/game-core/src/debug.rs) usesset_bool_queued, the game's own setter, instead ofset_bool. The setter changes both the value in play and the save's copy at the game's next update.It must replace the direct write, not follow it. The game drops a queued change when the value in play already matches, and the save's copy would then be missed.
The game applies the change a moment later, so the log line now says "from the game's next update" instead of printing the new value. If the game's setter is not found, the edit is refused, as the save would not keep it.
Read first: the song branch of
inventory_edit, and theSongGametests at the end of the same file.See #2326, #2166, #2822. #3030 (open) changes other parts of the Inventory page's edits. #1411 (open) has a similar song fix, but for the old C code.
Testing
Tested: Windows 11, RTX 5080, driver 621.47, headless, sandbox on, built with llvm-mingw and gnullvm Rust. Each run started from the repository save
market-entrance: unlock Epona's Song with the Inventory page's action, save from System > Save, restart from that save, then use the same action to see whether the game knew the song.Two more runs on this change (
d9f97f706), each restarted from the save it made:dev.py smokepasses on this PR.Checks:
mainand pass here: every song, unlocked and locked again, reaches the save's copy; and a build without the game's setter refuses the edit.6d8f07555, on main1c91b18f8): all 392 game-core tests, clippy of game-core and rustfmt of the whole workspace pass.384c2408d, the same change on main9a1f19b46): thesitestests andtest_i18n_completepass too.d9f97f706(main238f4f65f); it was not run again after the last rebase, which changed no file this PR touches.test_frame_wait_bounds,test_audio_voice_biquad,test_direct_buffer_writes,test_audio_wave_buffer_release) failed while the PC was busy with other builds and passed when run again with less going on.cargo testfails only ffi-gen'sthe_repositorys_files_are_current("game/game.h is stale"), which also fails on main0b3710dc8.test_pipeline_tour, which is Linux-only.9a1f19b46) has five more failing Windows checks, not from this change:test_display_pointer,test_cursor_hidden_in_play,test_cursor_hidden_linux,test_game_menu_mouse_buttonsandtest_dlss_why. Their stand-ins do not compile. rustfmt of the whole workspace failed there too, ongather.rs; it passes on1c91b18f8.Still to test: None.
Measurements
Verdict: the song stays learned after a save and a restart.
Setup: as under Testing, the same PC, save and steps. "Song known after restart" is the game's own log line. The result is yes or no. Before is one full run of unlock, save and restart, on main plus this PR's tests alone. After is two full runs, at
8b9a962bfand, rebased, atd9f97f706, with the same result. The head is the same change on a newer main (git patch-idis the same), and no commit between touches game-core, so the results still hold.b4d56f526had 0)had 1)had 1)had 0)No speed to measure: the code runs only when a player presses the Inventory page's button.
Risks
Only the song rows of the cheats' Inventory page change. The edit now appears at the game's next update instead of at once. A revert brings back the old behaviour. After updating, players notice only that song edits are kept; songs lost before are not brought back.
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.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, RTX 5080, driver 621.47, headless, sandbox on. From the repository save market-entrance: Epona's Song unlocked with the Inventory page's action, saved from System > Save, the game restarted from that save. Without the fix (main
b4d56f526) the song was lost; with it (d9f97f706, the same change before the last rebase) it was still learned. dev.py smoke passes. Autosave was not tested: the game did not autosave in these headless runs, without the fix too.@review
Recommendation: Approve. The code is ready: only testing is left (a run of the change itself). The reported game run shows that unlocking Epona's Song now survives a manual save and restart. Relocking and autosave persistence still need the game runs identified in the pull request. Recommend approval; not approved on the forge.
Song edits now use the game's queued setter so both the live flag and saved copy can change. The edit takes effect on the next game update and is refused if the setter is unavailable.
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/crates/game-core/src/debug.rs:1006: The in-game checks have not covered relocking a song or retaining an unlock through autosave. (more on the line) Do: In a game run, relock a learned song and verify it stays locked after saving and restarting; also unlock a song, allow an autosave and verify it remains learned after restarting.Checks: Still running: 11 checks.
More: does it help, other systems, switches, what was read
Does it help: Yes for the tested unlock and manual-save case: the song was lost in one run on main and retained in two runs with the change, according to the pull request. Relocking and autosave were not tested in game.
Other systems: The change is confined to song edits on the Inventory page and uses the existing guest-thread setter also used by other game-data writes. Its behavior is independent of the renderer; Linux was not run.
Switches: None.
Reviewed:
384c2408d1against9a1f19b462: Read the changed portions of game/crates/game-core/src/debug.rs, the surrounding action dispatch, the queued setter and song-count path, repository rules, standards and pull request template. Skimmed the remaining debug code and related call sites. No generated files or translations changed. The separate Tooling checkout was unavailable.; nothing run (a code review).Checked and fine:
Testing: Read-only review; no code or tests were run. The supplied CI checks are still running.
Overlaps and merge order: #3030 changes other Inventory page edits; #1411 addresses a similar song fix in the old C code. Neither is identified as a prerequisite.
Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.
@ -1004,1 +1004,3 @@if mgr.is_none_or(|m| m.set_bool(song, have == 0).is_err()) {// the game's own setter alone, which queues the value in play and the save's copy for its next update: with the// value in play written here first, the game would drop the queued change and the save's copy with itif mgr.is_none_or(|m| m.set_bool_queued(g, song, have == 0).is_err()) {L1 (should fix): The in-game checks have not covered relocking a song or retaining an unlock through autosave.
When: The reported game runs cover an unlock followed by a manual save; the relock test uses a simulated setter and the headless game did not autosave.
Do: In a game run, relock a learned song and verify it stays locked after saving and restarting; also unlock a song, allow an autosave and verify it remains learned after restarting.
Reply to the review's L1: both game runs are done on this change (
d9f97f706, the same change before the last rebase), on Windows 11 with an RTX 5080.had 0in the log).had 1).The earlier runs got no autosave because they crossed the gate too soon after loading. The game skips the autosave for a while after a save loads, on an older build too, so it is not from this change.
The description is corrected as well:
test_pipeline_tourwas not run because it is Linux-only, and newer main's five failing Windows checks are named. No code changed.@review
Recommendation: Approve. The song edit uses the game's queued setter, and the reported game runs show that unlocking, relocking and autosaving retain the intended state after restart. CI is still running and must pass before merge. Recommend approval; not approved on the forge.
Song edits on the cheats' Inventory page now reach the save as well as the live game state. The change reuses the existing setter and adds game-free coverage, at the cost of applying the edit on the next game update.
Since the last review (on
384c2408d1)Resolved: L1 (The in-game checks have not covered relocking a song or retaining an unlock through autosa…)
Checks: Still running: 11 checks.
More: does it help, other systems, switches, what was read
Does it help: Yes. On Windows 11, the reported manual-save run lost Epona's Song on main and retained it with the change; separate runs retained a relock and an unlock through autosave.
Other systems: The changed path is song editing, independent of GPU rendering. The reported game runs were on Windows; Linux was not run. Other inventory edits remain on their existing paths.
Switches: None.
Reviewed:
384c2408d1against9a1f19b462: Read AGENTS.md, CONTRIBUTING.md, the pull request template, standards, the diff, commits, changed song branch and tests, and the relevant setter and item-count code. The remainder of debug.rs was skimmed. The review checklist and adjacent Tooling AGENTS.md were unavailable.; nothing run (a code review).Checked and fine:
Testing: No commands from the project were run. The author reports game-free tests and Windows game runs; CI remains in progress.
Overlaps and merge order: The description identifies #3030 as changing other Inventory edits and #1411 as a similar fix for the old C code.
Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.
384c2408d16d8f075557Rebased onto main
1c91b18f8(#3090). The change is the same (git patch-idmatches), and #3090 does not touch game-core. All 392 game-core tests, clippy and rustfmt pass on the new head6d8f07555. The game was not run again.@review
Recommendation: Approve. The song edit now uses the game's save-aware setter, and reported game runs show unlocking and relocking persist across reloads. CI is still running on the current head. Nothing blocking is left. Recommend approval; not approved on the forge.
Keeps Inventory-page song edits in saves by queuing them through the game's setter. The change is small and reuses existing functionality, with the edit applied at the next game update.
Since the last review (on
384c2408d1)Nothing changed in the ledger.
Checks: Still running: 11 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 lost Epona's Song after a manual save on main and retained it with the change; subsequent runs also retained a relock and an autosaved unlock.
Other systems: The changed song path uses shared game logic rather than GPU-specific code. Windows was tested in game; Linux was not run. Other Inventory edits are unchanged.
Switches: None.
Reviewed:
6d8f075557against1c91b18f86: Read AGENTS.md, CONTRIBUTING.md, the pull request template, standards, the diff, the song edit and tests in debug.rs, and the relevant setter and item-count code. Skimmed the rest of debug.rs; Tooling's AGENTS.md was unavailable locally, and docs/review-checklist.md does not exist.; nothing run (a code review).Checked and fine:
Testing: Reported game and game-free results were reviewed; no commands that build or run tests were executed. Current-head CI is pending.
Overlaps and merge order: The description identifies #3030 as changing other Inventory edits and #1411 as a similar fix for old C code; no merge dependency is established.
Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.