Fix Save Editor inventory edits leaving C/D-pad buttons desynced - #7008
Merged
serprex merged 3 commits intoAug 3, 2026
Merged
Conversation
serprex
reviewed
Aug 1, 2026
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
bassdr
force-pushed
the
fix/save-editor-button-desync
branch
from
August 2, 2026 15:40
8cc38b2 to
7982735
Compare
Contributor
|
The function seems to do what it should and it has equivalents in z_kaleido_item. |
Address review: add a default-on "Keep C/D-pad buttons in sync" checkbox (mirroring "Restrict to valid items") so inventory edits can intentionally leave a slot desynced from its button for RBA practice/debugging. Also trim the helper comment. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KMnZEp5CRuq4e3ozJbhRZy
Contributor
Author
|
Thanks! Applied both — added a default-on "Keep C/D-pad buttons in sync" toggle (mirroring "Restrict to valid items") so it can be turned off to intentionally desync a slot from its button for RBA setup/practice, and trimmed the comment. |
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