Repository navigation
Keep shuffled object descriptions across save and restore - #62
Merged
Merged
Conversation
restnames() keeps the running binary's oc_descr pointers, but on the restore path init_objects() is never called, so those pointers are the unshuffled defaults: every restored game showed the default appearances (e.g. "sky blue potion") and items changed names after a restore. Save the shuffle itself instead of pointers: dosave0() now appends a tagged block after the last level (tag, version, count, and for each object the index of the default description it shows). dorecover()'s level loop recognises the tag, validates the block and rebuilds oc_descr from this binary's default strings. Saves without the block (earlier versions) load as before with default descriptions; a damaged or truncated block falls back to the defaults with a warning.
Critlist
added a commit
that referenced
this pull request
Nov 11, 2026
neuhaus
pushed a commit
to neuhaus/restoHack
that referenced
this pull request
Nov 15, 2026
…iptions Keep shuffled object descriptions across save and restore
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.
After a restore, every unidentified potion, scroll, ring, wand and gem showed its fixed default appearance instead of the game's shuffled one: a "ruby potion" came back as a "sky blue potion", items changed names mid-game, and every restored game shared the same mapping. Found by play-testing; present since a868d96 (v1.1.4).
Cause: the original code saved
objects[]with rawoc_descrpointers, which only worked with fixed load addresses. a868d96 fixed the resulting crash by keeping the running binary's pointers, but the restore path never callsinit_objects(), so those are the unshuffled defaults.Fix: save the shuffle, not pointers.
dosave0()appends a tagged block after the last level (tagRHDS, version, count, and per object the index of the default description it shows).dorecover()'s level loop recognises the tag (level numbers are 1..40, so it can't collide), validates the block and rebuildsoc_descrfrom this binary's default strings.uptodate()untouched.Verified:
Known, not in scope: restoring a save written by a different binary can still crash in
restmonchn()(pointer relocation into globals outsidemons[]); pre-existing, and currently masked byuptodate().🤖 Generated with Claude Code