WIP: feat(saves): one slot at a time: export it, copy it to another slot, delete it, or restore it alone from a backup #183

Draft
dyst wants to merge 6 commits from dyst/LongshotLauncher:feat/saves-slots into main
Member

Every save action in the launcher worked on the whole save: there was no way to send one adventure, to make a second copy of one before a risky part, to clear one slot, or to get one slot back from a backup without the rest. Now a slot on the Saves page has its own actions.

Stacked on #182 (restore from a backup), which is stacked on #181 (the save folder as a .zip): this branch holds both their commits, so merge it after them.

What changes

Select a slot on the Saves page (it highlights, as a version's row does on the home) for:

  • Export…: the slot's folder whole, everything in it. A dialog picks A .zip file… (slot_NN/ on top and whatever it holds, links left out, what made it in the zip's comment, through #181's SaveArchive.ExportSlot; Save As starts from Longshot Slot 2 <date>.zip) or A folder… (its slot_NN folder copied in whole; never over a slot_NN already there, never into the save itself; a link in the slot refuses it). Such a .zip is not a whole save folder, so importing it follows #181's save-files rule: only progress.sav and caption.sav in the slot (anything else in it refuses the import), and it replaces the slots of Longshot's save, as any import of save files does; the confirm page shows that.
  • Copy to another slot…: Slot 1 to Slot 6 (the ones the game shows), each with "Empty" or when it was saved; the first empty one is picked. Picking a used one shows "Slot 2, saved yesterday 12:30, is replaced."
  • Delete (the bin): "Delete Slot 4? Saved 11 Nov. Your saves are backed up first, so Restore from a backup can bring it back." with Keep it / Delete.

Restore from a backup gains Only one slot: under each backup: its slots as links. One opens "Restore Slot 2 from this backup? Only this slot changes: Slot 2 now, saved yesterday 12:30, is replaced by the one saved 13 Nov." The save's other slots and files stay as they are.

Each action that changes the save:

  • backs the save up whole first: slotcopy-, slotrestore-, slotdelete-<slot>-<stamp>, which the backups page lists ("Before a slot was copied to Slot 5", "Before Slot 2 was restored from a backup", "Before Slot 4 was deleted");
  • puts the slot in place the way Saves.Copy puts a save: made beside it, then two renames, so a failure leaves the slot as it was. A deleted slot is renamed out of the game's sight (hidden) first, then deleted;
  • is refused while Longshot, Hookshot or an emulator runs. The dialog stays open and says why; a failure also goes to the launcher's log.

Done: the dialog closes, the page reloads, and a toast says what happened ("Slot 1 copied to Slot 5. Your saves from before are backed up.").

How

  • Core/SaveSlots.cs: Copy (within the save, or from a backup's save: command slotrestore), Delete, ExportToFolder, LongshotSave (the save the page shows), Shown (slot_00 to slot_05). Saves.CopyTree, DeleteTree and Beside are now internal for it.
  • SaveBackups: BackupKind.SlotCopy, SlotRestore, SlotDelete.
  • App/ViewModels/SlotActionViewModel.cs (SlotRowViewModel, SlotActionViewModel for the four dialogs) and App/Views/SlotActionView.axaml; the Saves page's slot rows; the backups page's Only one slot: links.
  • tools/screenshots: saves-slot-selected, -export, -copy, -delete, -restore.
  • docs/saves.md: One slot; README's Saves lines.

Translations

34 new texts in the 12 full catalogs. They need a native speaker's check (es, fr and pt-BR put an article before "Slot {0}"'s translation; worth a look). scripts/translations.py: only the 30 texts per catalog main already lacks.

Testing

  • python -I tests/test_launcher_core.py: 1658 checks passed (new SaveSlotsChecks: copy into an empty and a used slot with the backup whole first, two in one second; refused: onto itself, slot_06, ../slot_00, a slot with no game, no save, a game running, a link; a failure between the renames leaves the slot; one slot from a backup leaves the other slots and the backup as they were; delete, its backup, a missing slot, an emulator running, a failed rename; the backups page lists the three kinds; export to a folder, never over one there, never into the save, refused while running; a slot's .zip holds its folder whole, a nested file included, and nothing else; its folder export copies it whole).
  • python -I tests/test_release.py: 37 tests OK. dotnet build App -c Release and tools/screenshots: 0 warnings, 0 errors.
  • Not done: a click-through in the real window (the screens are drawn headless), and Linux (Windows 11 only).

Screenshots, Before / After: in the first comment.

Every save action in the launcher worked on the whole save: there was no way to send one adventure, to make a second copy of one before a risky part, to clear one slot, or to get one slot back from a backup without the rest. Now a slot on the Saves page has its own actions. **Stacked on #182** (restore from a backup), which is stacked on #181 (the save folder as a .zip): this branch holds both their commits, so merge it after them. ## What changes **Select a slot** on the Saves page (it highlights, as a version's row does on the home) for: - **Export…**: the slot's folder **whole**, everything in it. A dialog picks *A .zip file…* (`slot_NN/` on top and whatever it holds, links left out, what made it in the zip's comment, through #181's `SaveArchive.ExportSlot`; Save As starts from `Longshot Slot 2 <date>.zip`) or *A folder…* (its `slot_NN` folder copied in whole; never over a `slot_NN` already there, never into the save itself; a link in the slot refuses it). Such a .zip is not a whole save folder, so importing it follows #181's save-files rule: only `progress.sav` and `caption.sav` in the slot (anything else in it refuses the import), and it replaces the slots of Longshot's save, as any import of save files does; the confirm page shows that. - **Copy to another slot…**: Slot 1 to Slot 6 (the ones the game shows), each with "Empty" or when it was saved; the first empty one is picked. Picking a used one shows "Slot 2, saved yesterday 12:30, is replaced." - **Delete** (the bin): "Delete Slot 4? Saved 11 Nov. Your saves are backed up first, so Restore from a backup can bring it back." with *Keep it* / *Delete*. **Restore from a backup** gains **Only one slot:** under each backup: its slots as links. One opens "Restore Slot 2 from this backup? Only this slot changes: Slot 2 now, saved yesterday 12:30, is replaced by the one saved 13 Nov." The save's other slots and files stay as they are. Each action that changes the save: - backs the save up whole first: `slotcopy-`, `slotrestore-`, `slotdelete-<slot>-<stamp>`, which the backups page lists ("Before a slot was copied to Slot 5", "Before Slot 2 was restored from a backup", "Before Slot 4 was deleted"); - puts the slot in place the way `Saves.Copy` puts a save: made beside it, then two renames, so a failure leaves the slot as it was. A deleted slot is renamed out of the game's sight (hidden) first, then deleted; - is refused while Longshot, Hookshot or an emulator runs. The dialog stays open and says why; a failure also goes to the launcher's log. Done: the dialog closes, the page reloads, and a toast says what happened ("Slot 1 copied to Slot 5. Your saves from before are backed up."). ## How - `Core/SaveSlots.cs`: `Copy` (within the save, or from a backup's save: command `slotrestore`), `Delete`, `ExportToFolder`, `LongshotSave` (the save the page shows), `Shown` (slot_00 to slot_05). `Saves.CopyTree`, `DeleteTree` and `Beside` are now `internal` for it. - `SaveBackups`: `BackupKind.SlotCopy`, `SlotRestore`, `SlotDelete`. - `App/ViewModels/SlotActionViewModel.cs` (`SlotRowViewModel`, `SlotActionViewModel` for the four dialogs) and `App/Views/SlotActionView.axaml`; the Saves page's slot rows; the backups page's *Only one slot:* links. - `tools/screenshots`: `saves-slot-selected`, `-export`, `-copy`, `-delete`, `-restore`. - `docs/saves.md`: *One slot*; README's Saves lines. ## Translations 34 new texts in the 12 full catalogs. **They need a native speaker's check** (es, fr and pt-BR put an article before "Slot {0}"'s translation; worth a look). `scripts/translations.py`: only the 30 texts per catalog `main` already lacks. ## Testing - `python -I tests/test_launcher_core.py`: 1658 checks passed (new `SaveSlotsChecks`: copy into an empty and a used slot with the backup whole first, two in one second; refused: onto itself, slot_06, `../slot_00`, a slot with no game, no save, a game running, a link; a failure between the renames leaves the slot; one slot from a backup leaves the other slots and the backup as they were; delete, its backup, a missing slot, an emulator running, a failed rename; the backups page lists the three kinds; export to a folder, never over one there, never into the save, refused while running; a slot's .zip holds its folder whole, a nested file included, and nothing else; its folder export copies it whole). - `python -I tests/test_release.py`: 37 tests OK. `dotnet build App -c Release` and `tools/screenshots`: 0 warnings, 0 errors. - **Not done:** a click-through in the real window (the screens are drawn headless), and Linux (Windows 11 only). Screenshots, Before / After: in the first comment.
feat(saves): export the saves to one .zip file, and import one back after checking it holds only saves
All checks were successful
CI / Compile and test (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 4s
e103e43677
Export saves… and From an emulator… gain "A .zip file…". The export writes the save files of Longshot's save folder
(account.sav, option.sav, slot_NN/progress.sav and caption.sav, with their times) and a small note
(longshot-save.json) into a file the Save As dialog picks, made beside it and renamed into place. The import checks the
zip as a Hookshot save is checked (only save files, no path out of it, no link, sizes, at least one slot with a
progress.sav; a bomb stops at what comes out, whatever the zip claims), unpacks it into a temporary folder of its own,
and copies it in as an import from a folder: confirmed first, Longshot's save backed up (import-zip-<stamp>).

Core/SaveArchive.cs with tests/launcher_core/SaveArchiveChecks.cs; the Saves scenes in tools/screenshots; docs/saves.md
"As a .zip file"; the new texts in the 12 full catalogs.

Assisted-by: Claude Code
Co-Authored-By: Claude Opus 5.5 <[email protected]>
feat(saves): restore from a backup: every save the copies backed up, newest first, put back after a confirmation
All checks were successful
CI / Compile and test (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 4s
34d9c14713
Every copy backs up what it replaces, but getting a backup back meant copying folders by hand. The Saves page gains
"Restore from a backup…" (under the slots): a page listing every save in the backups folder, newest first, with what
made it (an import, an export, Hookshot's import, the versions' saves brought together, a version deleted), when, its
slots and its size, the folder of each one a click away. Restore… opens the import's confirmation: the backup's slots,
what they replace, Keep Longshot's game settings, and Longshot's own save backed up first (restore-backup-<stamp>).
The backup itself is only read; nothing on the page deletes one.

Core/SaveBackups.cs with tests/launcher_core/SaveBackupsChecks.cs; SaveMode.Restore through the confirm and result
pages; App/Views/BackupsView.axaml; the backup scenes in tools/screenshots; docs/saves.md "Restore from a backup"; the
new texts in the 12 full catalogs. Stacked on the .zip export and import.

Assisted-by: Claude Code
Co-Authored-By: Claude Opus 5.5 <[email protected]>
feat(saves): one slot at a time: export it, copy it to another slot, delete it, or restore it alone from a backup
All checks were successful
CI / Compile and test (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 9s
43e7662e22
Every save action worked on the whole save. Select a slot on the Saves page for Export… (a .zip of that slot and the
game's settings, or its slot folder into a folder, never over one there), Copy to another slot… (Slot 1 to Slot 6, with
what is there and what gets replaced) and Delete (after a confirmation). On Restore from a backup, "Only one slot:" puts
one slot of a backup back, the save's other slots as they were.

Each that changes the save backs it up whole first (slotcopy-, slotrestore-, slotdelete-<slot>-<stamp>, listed with the
other backups) and puts the slot in place as a copy does: made beside it, then renamed, so a failure changes nothing.
Refused while a game or an emulator runs.

Core/SaveSlots.cs with tests/launcher_core/SaveSlotsChecks.cs; SlotActionViewModel and SlotActionView; the slot scenes in
tools/screenshots; docs/saves.md "One slot"; the new texts in the 12 full catalogs. Stacked on restore from a backup.

Assisted-by: Claude Code
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Member

Screenshots from tools/screenshots (headless, Windows layout, made-up save files and backups), this PR's base (34d9c14, restore from a backup) against this PR (43e7662).

The Saves page: a slot selected

Before (a slot is only a line) After (selected: Export, Copy to another slot, Delete)
before after

Restore from a backup: Only one slot

Before After
before after

New, no before

Export one slot: a .zip, or its slot folder into a folder.

export

Copy to another slot: what is there, and what gets replaced.

copy

Delete a slot.

delete

Restore only one slot from a backup.

restore one

Screenshots from `tools/screenshots` (headless, Windows layout, made-up save files and backups), this PR's base (34d9c14, restore from a backup) against this PR (43e7662). ### The Saves page: a slot selected | Before (a slot is only a line) | After (selected: Export, Copy to another slot, Delete) | |---|---| | ![before](https://git.magicbean.dev/attachments/d5d95283-477f-4010-85dc-5a78547ca2c3) | ![after](https://git.magicbean.dev/attachments/eeeb3348-81cb-4b5a-b0eb-1197d4089c40) | ### Restore from a backup: Only one slot | Before | After | |---|---| | ![before](https://git.magicbean.dev/attachments/0039a53b-53d5-4082-b830-afc351c64edf) | ![after](https://git.magicbean.dev/attachments/27e73e19-ead7-4468-a253-fdfd251cddda) | ### New, no before Export one slot: a .zip, or its slot folder into a folder. ![export](https://git.magicbean.dev/attachments/5fdb1230-1fef-495b-9ed8-97aba56aa9e1) Copy to another slot: what is there, and what gets replaced. ![copy](https://git.magicbean.dev/attachments/90e1ee8a-e545-4eed-8cfe-2625f7b4e292) Delete a slot. ![delete](https://git.magicbean.dev/attachments/1d13a68e-d340-47c0-94dc-078e82780446) Restore only one slot from a backup. ![restore one](https://git.magicbean.dev/attachments/8dcc808e-35e9-4b59-a29d-9c18d5193be1)
Collaborator

Possibly related, for context:

  • PR #166 fix(saves): export to a folder with no save yet makes the save in it — Export-to-folder PR overlaps Saves export behavior and confirm-page code.
  • issue #146 Launcher: Updating to v3.0.0-rc.5 deleted all saves without a prompt — Save-loss report is relevant to the new backup-before-delete and slot restore safeguards.
Possibly related, for context: - PR #166 fix(saves): export to a folder with no save yet makes the save in it — Export-to-folder PR overlaps Saves export behavior and confirm-page code. - issue #146 Launcher: Updating to v3.0.0-rc.5 deleted all saves without a prompt — Save-loss report is relevant to the new backup-before-delete and slot restore safeguards.
dyst force-pushed feat/saves-slots from 43e7662e22
All checks were successful
CI / Compile and test (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 9s
to 19f43f08d8
All checks were successful
CI / Compile and test (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 2s
2026-11-17 19:56:44 +00:00
Compare
Author
Member

Rebased onto #182 (bb44444), itself on #181's whole-save-folder zip, and force-pushed: 2f55cfa (this PR's change) and 19f43f0 (a slot's export is its folder whole, everything in it, through SaveArchive.ExportSlot; links left out; docs say which import rule such a zip follows). 1658 checks pass (a slot's .zip holds a nested file and nothing else; the folder export copies it whole), 37 release tests OK, 0 warnings. The export dialog's text changed: its new screenshot follows.

Rebased onto #182 (bb44444), itself on #181's whole-save-folder zip, and force-pushed: 2f55cfa (this PR's change) and 19f43f0 (a slot's export is its folder whole, everything in it, through SaveArchive.ExportSlot; links left out; docs say which import rule such a zip follows). 1658 checks pass (a slot's .zip holds a nested file and nothing else; the folder export copies it whole), 37 release tests OK, 0 warnings. The export dialog's text changed: its new screenshot follows.
Author
Member

The slot's Export dialog, whose text changed with the slot folder exported whole (tools/screenshots, headless): 2f55cfa against 19f43f0.

Before (2f55cfa) After (19f43f0)
before after
The slot's Export dialog, whose text changed with the slot folder exported whole (`tools/screenshots`, headless): 2f55cfa against 19f43f0. | Before (2f55cfa) | After (19f43f0) | |---|---| | ![before](https://git.magicbean.dev/attachments/89e7c70f-adbf-43b6-9c75-b8bf46b67638) | ![after](https://git.magicbean.dev/attachments/a9fff5b5-4863-4609-8824-f6cadba87c05) |
dyst changed title from feat(saves): one slot at a time: export it, copy it to another slot, delete it, or restore it alone from a backup to WIP: feat(saves): one slot at a time: export it, copy it to another slot, delete it, or restore it alone from a backup 2026-11-17 20:11:33 +00:00
Author
Member

Back to WIP: the one-slot actions are on hold while we decide whether the Saves page should have them. #181 and #182 (whole save folder export, import and restore) go ahead without this one.

Back to WIP: the one-slot actions are on hold while we decide whether the Saves page should have them. #181 and #182 (whole save folder export, import and restore) go ahead without this one.
dyst force-pushed feat/saves-slots from 19f43f08d8
All checks were successful
CI / Compile and test (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 2s
to 8fe35896fb
All checks were successful
CI / Compile and test (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 4s
2026-11-17 21:03:14 +00:00
Compare
dyst force-pushed feat/saves-slots from 8fe35896fb
All checks were successful
CI / Compile and test (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 4s
to be68020a0f
All checks were successful
CI / Compile and test (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 3s
2026-11-17 21:14:20 +00:00
Compare
Author
Member

Rebased onto main (8594b47: #180, #171 and #179 merged). Only the language files and the screenshot tool's scene list conflicted, both sides adding entries; both kept, each catalog checked as JSON with no duplicate key, the app and the screenshot tool build with 0 warnings. The code is otherwise unchanged, so the earlier test runs stand. Merge order: #181, #182, #184, #185.

Rebased onto main (8594b47: #180, #171 and #179 merged). Only the language files and the screenshot tool's scene list conflicted, both sides adding entries; both kept, each catalog checked as JSON with no duplicate key, the app and the screenshot tool build with 0 warnings. The code is otherwise unchanged, so the earlier test runs stand. Merge order: #181, #182, #184, #185.
HumanBean left a comment

Verdict: Request changes. Copy, Delete and the one-slot Restore write to the first profile folder in Longshot's save\, and that is not always the save the game opens. When a stray profile sorts ahead of it, the player changes a save the game never reads, while the whole-save Restore on the same page writes to the other folder.

For a player, this lets them export one slot, copy it into another slot, delete it, or put back one slot from a backup without touching the rest. Each action is confirmed, backed up whole first and swapped in by renames, so it would be a real gain. Apart from the profile it writes to, the core is careful and I see nothing that regresses for players. One more thing a maintainer should know: the author's comment of 20:11 puts these actions on hold until the team decides whether the Saves page should have them, and the 21:14 merge order (181, 182, 184, 185) leaves this PR out. That decision is still open and is not part of this verdict.

Reviewed: be68020a0f against 7c78639d14 (the head of #182; this PR's own two commits only). Read in full: Core/SaveSlots.cs, Core/SaveBackups.cs (diff and file), App/ViewModels/SlotActionViewModel.cs, the SavesViewModel.cs changes, SlotActionView.axaml, SavesView.axaml, BackupsView.axaml, tests/launcher_core/SaveSlotsChecks.cs, the tools/screenshots scenes, docs/saves.md and README. Also read the helpers they rely on in Core/Saves.cs (Beside, CopyTree, DeleteTree, Real, Inside, RefuseLinks, Running, Shared, ImportTarget, and main's slot-by-slot Gather from #175), LauncherService.SaveSlots and SaveArchive.ExportSlot's signature. Translations: every new key was checked mechanically in all 15 catalogs (presence and placeholders), and the French was read. Nothing was run; this is a code review.
Fixed in this review: nothing.
Checked and fine:

  • Delete: a confirmation ("Keep it" / "Delete", the date shown). The save is backed up whole first (slotdelete-<slot>-<stamp>), and the backups page lists it as "Before Slot N was deleted". The slot is renamed out of the game's sight before it is deleted. A failed rename leaves the slot in place.
  • Copy onto an occupied slot: the dialog names what is replaced ("Slot 2, saved …, is replaced.") and picks the first empty slot by default. The whole save is backed up first. The new slot is built beside the target and swapped in with two renames, and a failure between them rolls back (tested with the swap fault). Copying a slot onto itself, to slot_06+, or with ../ in the name is refused.
  • One-slot restore: only that slot folder changes. account.sav, option.sav and the other slots stay as they are, and the backup is only read (tested).
  • Save format: each slot is self-contained. Main's Gather (#175) already moves a slot to another slot_NN, and Longshot's repo saves load from a slot renamed slot_00 with no account.sav. No checksum or header outside the slot ties it to its number, and the PR rewrites no file contents, so no checksum can go stale.
  • Game running: Copy, Delete and both exports are refused while Longshot, Hookshot or an emulator runs. The check comes after the file picker and before any write.
  • Export to a folder: never over an existing slot_NN, never into the save itself, links refused, staged and then renamed.
  • The rest: backup names parse through SaveBackups.Named (slotcopy-slot_04-… gives Name slot_04), and a second backup in the same second gets -2. All 34 new texts are present in the 12 full catalogs with matching {n} placeholders. The en-GB, es-419 and fr-CA catalogs add none, as elsewhere. No new dependencies, and nothing reaches outside the save and backups folders.

Blocking (to change before merge)

  1. Core/SaveSlots.cs:17: LongshotSave is Saves.Shared(env).Profiles[0], the first profile folder in ordinal order. The game opens only Saves.ImportTarget(env) (save\5a3c9e1f…0001, per the comment on ImportTarget: "Another profile folder in save\ (a stray one, a copy made by hand) is never read by the game"). Here is a case where it goes wrong. A player once copied a Hookshot profile by hand into Longshot's save\ as 0123456789abcdef…. That folder sorts first, so the Saves page shows its slots (LauncherService.SaveSlots, unchanged). Delete, Copy and Restore-one-slot then change that folder, the toast says it worked, and the game shows the save as it was. The whole-save Restore and every import in the same window write to ImportTarget, so the two restores on one page put saves in different places. To fix it, make LongshotSave return ImportTarget(env) when that folder exists, and have LauncherService.SaveSlots (and the page's "Every build" row) describe the same folder, so the dialogs' "what is replaced" text matches what gets written. A check with two profiles in save\, the stray one sorting first, would cover it.

Suggestions (the author may take or leave)

  • A slot's .zip is billed as "one slot to keep or to send", but importing it replaces every slot of the receiver's save (the save-files rule from #181). The receiver's other slots are backed up and the confirm page shows what goes, but that is a surprise for a friend who only wanted the one adventure. Importing a single-slot zip into the first free slot, the way main's Gather places a slot, would match what the export promises. Until then, the export dialog could say how the receiver gets it in.
  • Reuse versus duplication with #175: nothing on main copies one slot into place, so SaveSlots.Copy is new work, not a duplicate. Two pieces do repeat, though. The stage, rename-aside, rename-in and roll-back block is now in Saves.Copy, Saves.Gather and SaveSlots.Copy, and one helper in Saves could serve all three. The six-slot count also exists twice: Saves.GameSlots (const int GameSlots = 6) and SaveSlots.Shown. Shown could be built from GameSlots.
  • Core/SaveSlots.cs:96: if the roll-back rename itself fails, the exception reaches this catch and the message still says "Nothing was changed: slot_NN is as it was", while the slot may actually be sitting in .slot_NN.longshot-old. That is rare, and the backup holds it. Saying "it may be in …" when target is missing would be accurate.
  • After a one-slot restore started from the backups page, BackupsViewModel.Rows was built once from page.Backups, so the new "Before Slot 2 was restored" backup doesn't appear until the page is reopened. Rebuilding that page after the modal closes would fix it.

Questions

  • Is the 20:11 hold still on? If the team decides against per-slot actions, SaveArchive.ExportSlot in #182 has no caller outside the tests, which the reviewers of that PR may want to know.

Testing: per the author, 1658 core checks and 37 release tests pass on Windows 11, and dotnet build gives 0 warnings. CI's compile-and-test was skipped for this head, and nothing was run here. The new SaveSlotsChecks cover copy into an empty and an occupied slot, the refusals, a failure between the renames, a one-slot restore, delete and its failures, the backup listing, and both exports. They don't model a second profile in save\ (the blocker above) or a failed roll-back. Missing: a click-through in the real window (the screenshots were drawn headless), any run on Linux or the Steam Deck, and a run in the game showing a slot copied to another number, or restored alone, loading. That game run should come before this leaves WIP, since it is the first time players move a slot by hand.
Overlaps and merge order: stacked on #181, then #182, then this one; merge in that order. The head sits on main 8594b47 with no textual conflict I could see, and it is not mergeable only because it is WIP and stacked. It touches the same export and confirm code as #166 (already merged).

**Verdict: Request changes.** Copy, Delete and the one-slot Restore write to the first profile folder in Longshot's `save\`, and that is not always the save the game opens. When a stray profile sorts ahead of it, the player changes a save the game never reads, while the whole-save Restore on the same page writes to the other folder. For a player, this lets them export one slot, copy it into another slot, delete it, or put back one slot from a backup without touching the rest. Each action is confirmed, backed up whole first and swapped in by renames, so it would be a real gain. Apart from the profile it writes to, the core is careful and I see nothing that regresses for players. One more thing a maintainer should know: the author's comment of 20:11 puts these actions on hold until the team decides whether the Saves page should have them, and the 21:14 merge order (181, 182, 184, 185) leaves this PR out. That decision is still open and is not part of this verdict. **Reviewed:** be68020a0f7c against 7c78639d147f (the head of https://git.magicbean.dev/MagicBeanDev/LongshotLauncher/pulls/182; this PR's own two commits only). Read in full: `Core/SaveSlots.cs`, `Core/SaveBackups.cs` (diff and file), `App/ViewModels/SlotActionViewModel.cs`, the `SavesViewModel.cs` changes, `SlotActionView.axaml`, `SavesView.axaml`, `BackupsView.axaml`, `tests/launcher_core/SaveSlotsChecks.cs`, the `tools/screenshots` scenes, `docs/saves.md` and README. Also read the helpers they rely on in `Core/Saves.cs` (`Beside`, `CopyTree`, `DeleteTree`, `Real`, `Inside`, `RefuseLinks`, `Running`, `Shared`, `ImportTarget`, and main's slot-by-slot `Gather` from https://git.magicbean.dev/MagicBeanDev/LongshotLauncher/pulls/175), `LauncherService.SaveSlots` and `SaveArchive.ExportSlot`'s signature. Translations: every new key was checked mechanically in all 15 catalogs (presence and placeholders), and the French was read. Nothing was run; this is a code review. **Fixed in this review:** nothing. **Checked and fine:** - **Delete:** a confirmation ("Keep it" / "Delete", the date shown). The save is backed up whole first (`slotdelete-<slot>-<stamp>`), and the backups page lists it as "Before Slot N was deleted". The slot is renamed out of the game's sight before it is deleted. A failed rename leaves the slot in place. - **Copy onto an occupied slot:** the dialog names what is replaced ("Slot 2, saved …, is replaced.") and picks the first empty slot by default. The whole save is backed up first. The new slot is built beside the target and swapped in with two renames, and a failure between them rolls back (tested with the `swap` fault). Copying a slot onto itself, to `slot_06+`, or with `../` in the name is refused. - **One-slot restore:** only that slot folder changes. `account.sav`, `option.sav` and the other slots stay as they are, and the backup is only read (tested). - **Save format:** each slot is self-contained. Main's `Gather` (https://git.magicbean.dev/MagicBeanDev/LongshotLauncher/pulls/175) already moves a slot to another `slot_NN`, and Longshot's repo saves load from a slot renamed `slot_00` with no `account.sav`. No checksum or header outside the slot ties it to its number, and the PR rewrites no file contents, so no checksum can go stale. - **Game running:** Copy, Delete and both exports are refused while Longshot, Hookshot or an emulator runs. The check comes after the file picker and before any write. - **Export to a folder:** never over an existing `slot_NN`, never into the save itself, links refused, staged and then renamed. - **The rest:** backup names parse through `SaveBackups.Named` (`slotcopy-slot_04-…` gives Name `slot_04`), and a second backup in the same second gets `-2`. All 34 new texts are present in the 12 full catalogs with matching `{n}` placeholders. The en-GB, es-419 and fr-CA catalogs add none, as elsewhere. No new dependencies, and nothing reaches outside the save and backups folders. **Blocking** (to change before merge) 1. `Core/SaveSlots.cs:17`: `LongshotSave` is `Saves.Shared(env).Profiles[0]`, the first profile folder in ordinal order. The game opens only `Saves.ImportTarget(env)` (`save\5a3c9e1f…0001`, per the comment on `ImportTarget`: "Another profile folder in save\ (a stray one, a copy made by hand) is never read by the game"). Here is a case where it goes wrong. A player once copied a Hookshot profile by hand into Longshot's `save\` as `0123456789abcdef…`. That folder sorts first, so the Saves page shows its slots (`LauncherService.SaveSlots`, unchanged). Delete, Copy and Restore-one-slot then change that folder, the toast says it worked, and the game shows the save as it was. The whole-save Restore and every import in the same window write to `ImportTarget`, so the two restores on one page put saves in different places. To fix it, make `LongshotSave` return `ImportTarget(env)` when that folder exists, and have `LauncherService.SaveSlots` (and the page's "Every build" row) describe the same folder, so the dialogs' "what is replaced" text matches what gets written. A check with two profiles in `save\`, the stray one sorting first, would cover it. **Suggestions** (the author may take or leave) - A slot's .zip is billed as "one slot to keep or to send", but importing it replaces every slot of the receiver's save (the save-files rule from https://git.magicbean.dev/MagicBeanDev/LongshotLauncher/pulls/181). The receiver's other slots are backed up and the confirm page shows what goes, but that is a surprise for a friend who only wanted the one adventure. Importing a single-slot zip into the first free slot, the way main's `Gather` places a slot, would match what the export promises. Until then, the export dialog could say how the receiver gets it in. - Reuse versus duplication with https://git.magicbean.dev/MagicBeanDev/LongshotLauncher/pulls/175: nothing on main copies one slot into place, so `SaveSlots.Copy` is new work, not a duplicate. Two pieces do repeat, though. The stage, rename-aside, rename-in and roll-back block is now in `Saves.Copy`, `Saves.Gather` and `SaveSlots.Copy`, and one helper in `Saves` could serve all three. The six-slot count also exists twice: `Saves.GameSlots` (`const int GameSlots = 6`) and `SaveSlots.Shown`. `Shown` could be built from `GameSlots`. - `Core/SaveSlots.cs:96`: if the roll-back rename itself fails, the exception reaches this catch and the message still says "Nothing was changed: slot_NN is as it was", while the slot may actually be sitting in `.slot_NN.longshot-old`. That is rare, and the backup holds it. Saying "it may be in …" when `target` is missing would be accurate. - After a one-slot restore started from the backups page, `BackupsViewModel.Rows` was built once from `page.Backups`, so the new "Before Slot 2 was restored" backup doesn't appear until the page is reopened. Rebuilding that page after the modal closes would fix it. **Questions** - Is the 20:11 hold still on? If the team decides against per-slot actions, `SaveArchive.ExportSlot` in https://git.magicbean.dev/MagicBeanDev/LongshotLauncher/pulls/182 has no caller outside the tests, which the reviewers of that PR may want to know. **Testing:** per the author, 1658 core checks and 37 release tests pass on Windows 11, and `dotnet build` gives 0 warnings. CI's compile-and-test was skipped for this head, and nothing was run here. The new `SaveSlotsChecks` cover copy into an empty and an occupied slot, the refusals, a failure between the renames, a one-slot restore, delete and its failures, the backup listing, and both exports. They don't model a second profile in `save\` (the blocker above) or a failed roll-back. Missing: a click-through in the real window (the screenshots were drawn headless), any run on Linux or the Steam Deck, and a run in the game showing a slot copied to another number, or restored alone, loading. That game run should come before this leaves WIP, since it is the first time players move a slot by hand. **Overlaps and merge order:** stacked on https://git.magicbean.dev/MagicBeanDev/LongshotLauncher/pulls/181, then https://git.magicbean.dev/MagicBeanDev/LongshotLauncher/pulls/182, then this one; merge in that order. The head sits on main 8594b47 with no textual conflict I could see, and it is not mergeable only because it is WIP and stacked. It touches the same export and confirm code as https://git.magicbean.dev/MagicBeanDev/LongshotLauncher/pulls/166 (already merged).
@ -514,0 +692,4 @@
void Restore(BackupSave b) => Page.Main.Navigate(new SavesConfirmViewModel(Page, new SaveOp { Mode = SaveMode.Restore, Backup = b }));
static string SlotOf(string? name) => name != null && SaveText.Number(name) > 0 ? Tr.F("Slot {0}", SaveText.Number(name)) : Tr.T("a slot");
Owner

Nit: the fallback "a slot" ends up in French as "Avant la copie d'un emplacement vers l'un emplacement". It is only reached for a backup name the launcher didn't write, but a separate sentence for that case would read better.

Nit: the fallback "a slot" ends up in French as "Avant la copie d'un emplacement vers l'un emplacement". It is only reached for a backup name the launcher didn't write, but a separate sentence for that case would read better.
@ -0,0 +100,4 @@
{
SlotAction.Export => Tr.T("One slot to keep or to send: its folder whole, everything in it, as a .zip or copied into a folder you pick."),
SlotAction.Copy => Tr.T("The game shows six slots. A slot copied over is replaced, and your saves are backed up first."),
SlotAction.Delete => Tr.F("Saved {0}. Your saves are backed up first, so Restore from a backup can bring it back.", When),
Owner

Nit: a slot with no progress.sav (Saved null) reads "Saved . Your saves…". Leaving the first sentence out when When is empty would avoid that.

Nit: a slot with no `progress.sav` (Saved null) reads "Saved . Your saves…". Leaving the first sentence out when `When` is empty would avoid that.
@ -0,0 +11,4 @@
static readonly Regex SlotName = new("^slot_[0-9]{2,3}$", RegexOptions.CultureInvariant);
/// The slots the game shows: slot_00 to slot_05 (Slot 1 to Slot 6), the ones a slot can be copied into
public static readonly IReadOnlyList<string> Shown = Enumerable.Range(0, 6).Select(i => $"slot_{i:00}").ToList();
Owner

The same six slots as Saves.GameSlots (from #175). One constant would keep them from drifting apart.

The same six slots as `Saves.GameSlots` (from https://git.magicbean.dev/MagicBeanDev/LongshotLauncher/pulls/175). One constant would keep them from drifting apart.
@ -0,0 +14,4 @@
public static readonly IReadOnlyList<string> Shown = Enumerable.Range(0, 6).Select(i => $"slot_{i:00}").ToList();
/// Longshot's save, the one the Saves page shows (LauncherService.SaveSlots: the shared folder's first profile); null: none yet
public static string? LongshotSave(SaveEnvironment env) => Saves.Shared(env) is { Found: true } s ? s.Profiles[0].Path : null;
Owner

Blocking: Profiles[0] is the first profile folder in ordinal order, not necessarily Saves.ImportTarget(env), the only one the game opens. With a stray profile that sorts first (a Hookshot profile copied in by hand, 0123…), Copy, Delete and Restore-one-slot change a save the game never reads. Use ImportTarget when it exists, and have LauncherService.SaveSlots describe the same folder.

Blocking: `Profiles[0]` is the first profile folder in ordinal order, not necessarily `Saves.ImportTarget(env)`, the only one the game opens. With a stray profile that sorts first (a Hookshot profile copied in by hand, `0123…`), Copy, Delete and Restore-one-slot change a save the game never reads. Use `ImportTarget` when it exists, and have `LauncherService.SaveSlots` describe the same folder.
@ -0,0 +93,4 @@
catch (Exception e) when (e is IOException or UnauthorizedAccessException)
{
Saves.DeleteTree(staging);
throw new SaveFailure($"The slot could not be copied ({e.Message}). Nothing was changed: {toSlot} is as it was. A backup of the save is in {backup}.",
Owner

If the roll-back Directory.Move(aside, target) fails too, this still says the slot "is as it was", while it may be in .slot_NN.longshot-old. That is rare (the backup has it), but the message could say so when target is missing.

If the roll-back `Directory.Move(aside, target)` fails too, this still says the slot "is as it was", while it may be in `.slot_NN.longshot-old`. That is rare (the backup has it), but the message could say so when `target` is missing.
All checks were successful
CI / Compile and test (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 3s
This pull request has changes conflicting with the target branch.
  • App/MainWindow.axaml
  • App/ViewModels/SavesViewModel.cs
  • App/Views/SavesView.axaml
  • App/Views/Views.cs
  • Core/Lang/de.json
  • Core/Lang/es.json
  • Core/Lang/fr.json
  • Core/Lang/it.json
  • Core/Lang/ja.json
  • Core/Lang/ko.json
  • Core/Lang/nl.json
  • Core/Lang/pl.json
  • Core/Lang/pt-BR.json
  • Core/Lang/ru.json
  • Core/Lang/zh-Hans.json
  • Core/Lang/zh-Hant.json
  • README.md
  • docs/saves.md
  • tests/launcher_core/Program.cs
  • tools/screenshots/Program.cs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'feat/saves-slots:dyst-feat/saves-slots'
git switch 'dyst-feat/saves-slots'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/LongshotLauncher!183
No description provided.