Keep ROM list positions on the card - #1942
Open
robcodedev wants to merge 2 commits into
Open
Conversation
romwinidx.json lives in /appconfigs, on internal storage. Move the card to another device and every list position is gone. Copy it off the card at boot and back at shutdown. If there's no copy on the card yet we remove the device file, so you start clean instead of inheriting whatever that device happened to have.
Copilot AI
added a commit
to Amiga500/Onion
that referenced
this pull request
Sep 9, 2026
…1943 OnionUI#1944 OnionUI#1945 OnionUI#1946 (runtime.sh, keymon, lt.lang) Co-authored-by: Amiga500 <16525337+Amiga500@users.noreply.github.com>
save_romwinidx runs from check_off_order, so it is skipped when the device crashes or loses power. The restore at boot then overwrote the device file with an older card copy, throwing away every position recorded since the last clean shutdown. Stock kept those. restore_romwinidx now touches config/.romwinidx_dirty after running and save_romwinidx removes it, so a mark surviving a boot means the last session never reached a clean shutdown. Leave both files alone in that case and let the next clean shutdown publish whatever the device has. Not promoting the device file to the card there is deliberate: if the card also moved, that would overwrite a good copy with a different device's stale one. A mark rather than comparing modification times, because mtime answers which device was written to most recently rather than whether the last session was clean, and those differ exactly when the card has moved. Problem reported by @Amiga500 and fixed in this new commit.
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.
Problem
MainUI stores per-folder list positions in
/appconfigs/romwinidx.json, which lives on internal storage. Move a card to another device, or reflash one, and every position is lost with no way to carry them across.What this does
Restores from
$sysdir/config/romwinidx.jsonat boot and writes back on shutdown. If there is no copy on the card yet, the device file is removed, so the first boot after installing starts from a known state rather than inheriting whatever that device happened to have.Unclean shutdowns
The write-back happens in check_off_order, so it is skipped on a crash or power loss. Restoring unconditionally would then overwrite the device file with an older card copy. restore_romwinidx touches config/.romwinidx_dirty and save_romwinidx removes it, so a mark surviving a boot means the last session ended uncleanly - in that case neither file is touched.
Problem with unclean shutdowns reported by @Amiga500 and fixed in new commit.
Known limitation
Positions from a session that ended uncleanly stay on the device and never reach the card, so they don't follow it to another device until the next clean shutdown.
Testing
Moved a card between two devices and confirmed positions follow it.