WIP: feat(saves): batched 6-slot Reorder mode with pre-flight safety checks and single SlotSwap backup #254
No reviewers
Labels
No labels
area/build
area/install
area/saves
area/tooling
area/ui
area/updates
ci: approved
good first issue
gpu/amd
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
platform/linux
platform/steam-deck
platform/windows
priority
critical
priority
high
priority
low
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
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/LongshotLauncher!254
Loading…
Reference in a new issue
No description provided.
Delete branch "Jer9/LongshotLauncher:feat/saves-slot-reorder"
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?
Players organizing saves across Slot 1–Slot 6 currently have no way to rearrange slot order without manually renaming folders on disk. Stacked cleanly on #253 (
feat/saves-slot-previews-main), this adds an explicit Reorder mode on the Saves tab that arrangesslot_00–slot_05in memory and applies the full permutation atomically on disk with a single whole-save backup first (BackupKind.SlotSwap).Summary
Core/SaveSlotOrder.cs,Core/SaveBackups.cs):^slot_0[0-5]$(SaveSlotOrder.IsGameSlot), rejectingslot_000,slot_06+, and path-traversal names before touching disk.Saves.RefuseLinks(save)before resolvingSaves.Real(save)(refusing both a symlinked/junctioned save root and any linked slot/file inside it), verifies every source slot exists, checks for destination collisions against unmoved slots, refuses to overwrite/delete any orphaned.slot_NN.longshot-oldleft by an earlier failed reorder, and refuses while Longshot, Hookshot, or an emulator is running.slotswap-<stamp>whole-save backup (skipping hidden.slot_*.longshot-old/.slot_*.longshot-stagingfolders), listed in Restore from a backup as "Before slots were reordered" (BackupKind.SlotSwap).rollbackFailedtracking: reports "Nothing was changed" only when rollback fully succeeds, and accurately names stranded.slot_NN.longshot-oldfolders if rollback itself fails.App/ViewModels/SavesViewModel.cs,App/Views/SavesView.axaml):Slot 1–Slot 6, showing empty positions as faintSlot N · Empty) with a sticky Cancel / Save order bar pinned above the scrollable list (c:Pad.Back="True"on Cancel), collapsing with zero layout spacing when not reordering.ObservableCollection<SlotRowViewModel>.Moveon▲/▼to preserve keyboard and gamepad focus without recreating item containers.Progress,Import,Hookshot,Export,Backups) while in Reorder mode, preserves anyslot_06+folders untouched with an explanatory note, and callsReload()on failure so UI state always matches disk.tests/launcher_core/SaveSlotPreviewChecks.cs,tests/launcher_app/Program.cs,tools/screenshots/Program.cs):SaveSlotOrder(strict regex, pre-flight collision, save-root and slot-level junction refusal, orphan guard, hidden temp skip during backup, clean rollback, failed rollback naming.slot_NN.longshot-old,BackupKind.SlotSwaplisting, running-game refusal, 6-slot batch into empty slots, no-op), full app-levelSaveSlotReordertests, and asaves-reorderscreenshot scene.Screenshots & walkthrough
See the attached animated WebP walkthrough and screenshots in the first comment below.
Testing
Tested (Windows 11, .NET SDK
10.0.404):dotnet build LongshotLauncher.slnx -c Release -p:RestoreLockedMode=true: 0 warnings, 0 errors;LauncherCoreTests.csproj: 0 warnings, 0 errors; zeropackages.lock.jsonchanges.dotnet format Core/LongshotLauncher.Core.csproj --verify-no-changes --include Core/SaveSlotPreview.cs Core/SaveSlotOrder.cs: PASS (exit 0).dotnet run --project tests/launcher_app/LauncherAppTests.csproj -c Release -p:RestoreLockedMode=true: PASS (includesSaveSlotPreviews+SaveSlotReorder).LauncherCoreTests.dll:SaveSlotPreviewChecks(incl.SaveSlotOrder) 39/39 passed, plusSaveArchiveChecks(78/78),SaveBackupsChecks(30/30),PadChecks,IconChecks,TranslationChecks, andShownProfileChecksall PASS.scripts/translations.py: 0 new faults (only the 4 pre-existing leftover #244 keys onmain).saves-backups-listed,saves-reorder) and interactive animated walkthrough frames: rendered and visually inspected — zero alignment shift in normal mode and clean sticky Reorder bar with disabled right-side actions in Reorder mode.Still to test (required before removing WIP / merging):
slot_00/slot_01empty — to confirm both that the game loads those slots cleanly and whether the in-game Load screen orders slots byslot_NNfolder number or bycaption.sav's internal header timestamp.▲/▼moves and full Linux CI run.Risks
WIP:until in-game verification confirms slot loading with leading empty gaps.Assisted-by: Antigravity
Adds a strictly read-only, bounded parser (Core/SaveSlotPreview.cs) for caption.sav (area name via SaveEditorText.Humanize, Child/Adult era, and bounded JPEG thumbnail) and progress.sav (hearts, rupees, 3 Spiritual Stones, 6 Sage Medallions, Gold Skulltulas, and main-quest progress), plus Durations.WhenFull for full date+time on the Saves tab. - Core/SaveSlotPreview.cs: refuses symlinks/junctions via LinkTarget and FileAttributes.ReparsePoint on both the slot directory and leaf files, bounds file sizes and JPEG SOF dimensions before decoding, ignores duplicate field IDs and out-of-range values, handles trailing bytes, and degrades cleanly to the slot-number badge. - Core/MakeGameRun.cs: adds Durations.WhenFull using Tr.F("{0}, {1}", Date(t, now), time) without changing Durations.When or SavesConfirmViewModel timestamps. - App/ViewModels/SavesViewModel.cs & App/Views/SavesView.axaml: displays 16:9 thumbnail with fallback, Grid-based Title + Era badge (no badge clipping on truncation), Tr.P pluralized rupees/skulltulas, Launcher's <c:Bar> with clarified Main quest X/9 (Y%) label, and IDisposable cleanup of previous row Bitmaps on Reload(). - docs/saves.md, tests/launcher_core/SaveSlotPreviewChecks.cs, tests/launcher_app/Program.cs, tools/screenshots/Program.cs: reconciled docs, 21 core checks (trailing bytes, duplicate IDs, out-of-range values, directory/file link refusal, WhenFull), app ViewModel checks, and synthetic gradient JPEGs for headless screenshots. Field hashes adapted from Traiver/OOT-SW2SE (MIT) and Anarkkie's LongshotLauncher#55 layout. Assisted-by: AntigravityStacks cleanly on read-only slot previews so players can arrange Slot 1..Slot 6 (including moving saves into empty slots) in memory and apply the full permutation atomically on disk with a single whole-save backup first (BackupKind.SlotSwap). - Core/SaveSlotOrder.cs: enforces strict ^slot_0[0-5]$ (rejecting slot_000/slot_06+), runs pre-flight destination collision checks, orphaned .slot_NN.longshot-old guards (never deleting stranded folders on retry), and whole-save Saves.RefuseLinks before taking any backup; skips hidden .slot_*.longshot-old/.longshot-staging during backup copy; tracks rollbackFailed explicitly and names stranded .slot_NN.longshot-old folders accurately on partial rollback. - Core/SaveBackups.cs & App/ViewModels/SavesViewModel.cs: adds BackupKind.SlotSwap ('Before slots were reordered'); uses ObservableCollection<SlotRowViewModel>.Move to preserve keyboard/gamepad focus during up/down moves; disables Progress/Import/Export/Hookshot/Backups commands during Reorder mode; preserves slot_06+ untouched with an explanatory note; calls Reload() on failure. - App/Views/SavesView.axaml: adds Reorder header trigger, sticky top Cancel (with c:Pad.Back='True') / Save order bar, and per-row up/down buttons. - tests/launcher_core/SaveSlotPreviewChecks.cs & tests/launcher_app/Program.cs: adds 16 core checks (strict regex, pre-flight collision, link refusal, orphan guard, backup skip, clean rollback, failed rollback naming .slot_NN.longshot-old, SlotSwap listing, 6-slot batch) and full app-level Reorder tests. Assisted-by: AntigravityWalkthrough & Screenshots
Animated walkthrough (entering Reorder mode on real local saves read-only, moving a slot down into empty slots with live renumbering and
Save orderenabling, then cancelling with zero disk writes):6-slot Reorder mode (real thumbnails, sticky Cancel / Save order bar, right-side actions disabled):
Synthetic fixture (
tools/screenshotssaves-reorderscene):View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.