Fix Save Editor inventory edits leaving C/D-pad buttons desynced - #7008
Open
bassdr wants to merge 2 commits into
Open
Fix Save Editor inventory edits leaving C/D-pad buttons desynced#7008bassdr wants to merge 2 commits into
bassdr wants to merge 2 commits into
Conversation
The Save Editor's Inventory tab writes gSaveContext.inventory.items[] directly, but a C/D-pad item button mirrors the slot it points at (buttonItems[i] == items[cButtonSlots[i-1]]). That derived value was never refreshed, so e.g. emptying a bottle assigned to a button left the button showing its old contents -- a desync the game's equip/inventory consistency then trips on at the next age swap or bottle update. Re-sync any button pointing at an edited slot after the write. Equipment assigned to a button stores an equipment-page index in cButtonSlots (>= inventory size), so it never matches an inventory slot and is left untouched. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KMnZEp5CRuq4e3ozJbhRZy
serprex
reviewed
Aug 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
While testing #6951 I hit the recurring save corruption tracked in #7004 and first suspected that PR. After investigating, I'm now confident the origin is the Inventory debug menu, not #6951.
Cause
The Save Editor's Inventory tab writes
inventory.items[]directly, but a C/D-pad item button mirrors the slot it points at (buttonItems[i] == items[cButtonSlots[i-1]]). That mirror was never refreshed after a raw edit, so changing a bottle assigned to a button (e.g. emptying it) leaves the button on stale contents — an equip/inventory desync the game then trips on at the next age swap or bottle update.Fix
After an Inventory-tab slot write, re-sync any button pointing at that slot. Equipment on a button stores an equipment-page index in
cButtonSlots(≥ inventory size), so it never matches an inventory slot and is left untouched. Debug menu only; no gameplay behavior changes.Build Artifacts