fix(saves): export to a folder with no save yet makes the save in it #166
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
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/LongshotLauncher!166
Loading…
Reference in a new issue
No description provided.
Delete branch "riqmarmes/LongshotLauncher:fix/saves-export-to-a-new-folder"
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?
Why. Exporting a save to a folder that holds no save yet is refused, although the Saves page offers "A portable
emulator's user folder, or any folder" and
docs/saves.mdsays "or into any folder you pick with Choose a folder".Saves → Export saves… → Another folder… → an empty folder leaves the confirm page saying "No save of the game
under … (a folder with account.sav and slot_, or 0400486024DEC000 under an emulator's nand/user/save): start the game
there once and save."* with Export disabled. It only works when the folder already holds a save (or an emulator's
empty title folder) — so it cannot be used to keep a backup of your saves, and a portable emulator cannot be pointed at
a new folder before its first run. See #165.
What changed.
Core/Saves.cs—Saves.ExportTarget(program, folder, env). For an export whose other side is a folder(
Saves.Folder), the folder needs no save: it becomes the save folder (SaveProfile(Base(folder), folder)), and thecopy writes
account.sav,option.savand the slot folders there. Imports still useLocate(an empty folder hasnothing to import), and an emulator's folder still must hold its save, since its saves live in its own layout. The top
of a drive is refused with its own message: the copy puts the new save in place by moving a folder in beside the
target, and a drive's top has no place beside it.
Saves.ImportExportresolves the other side withimport ? Locate(…) : ExportTarget(…), andSavesConfirmViewModel.Refreshdoes the same, so the confirm page appears with the copy enabled.Saves.Copy: a target with no save file in it has nothing to back up —SaveCopy.Backupis null and no emptybackup folder is made, so the page says "Nothing there yet to back up." instead of offering a backup of an empty
folder. The other files in the folder stay (the staging already copies everything but
slot_*,account.savandoption.sav), and a target that did hold a save is still backed up whole before it is replaced.docs/saves.md: says that a folder with no save is made into the save folder, and that what the save replaces isbacked up.
Screenshots. No layout change. The confirm page for a new folder now appears with "Nothing there yet to back up."
and Export enabled, instead of the "No save of the game under …" problem and a disabled button. I can attach
before/after shots if wanted.
Testing.
python -I tests/test_launcher_core.py: 1448 checks passed (1440 onmain; 8 new). The new checks cover: thepreview of a new folder names it and changes nothing; the export makes
account.sav,option.savandslot_00/slot_01there with no backup and no backup folder; that folder is the save folder afterwards; a second export to itis backed up and replaces it; a folder with other files keeps them beside the save; an emulator's folder with no save
is still refused; a missing folder still says "No folder"; the top of a drive is refused.
python -m pytest tests/test_release.py: 37 passed, 11 subtests.dotnet build LongshotLauncher.slnx: 0 warnings, 0 errors.folder → the confirm page appears; Export writes
account.sav,option.savand the slot folders into it; exportingagain offers the backup of that save. Not tested: Linux (the change is
Core/plus one line of a view model; thechecks run on Linux in CI).
Risks. What could break: nothing in the save format,
longshot_options.ini, the shader and pipeline caches, the vkABI or the builder's tools.
Locateis untouched, so imports and every emulator destination behave as before; only thefolder the player picks for an export may now be new, and only then does the launcher write save files where the player
pointed (which is the change). Turning it off: revert the commit; the old behaviour is the
Locaterule.Compatibility: saves,
longshot_options.ini, the caches, the vk ABI and the builder's tools are unchanged.A note on the shared rule.
Core/Saves.csis a port ofscripts/longshot_saves.py, and the script still refuses a--tofolder with no save (itsside()callslocate(), andnew_save_folder()returns nothing forFOLDER). Thischange is the launcher's rule for the folder the player picks in the window, where the page and the docs already promise
"any folder". If you want one rule across both, say so and I will send the script change too (a
new_save_folderentryfor
FOLDERplus a test).Fixes #165
Possibly related, for context:
Replying to the related-changes note: #26 disabled export when Longshot has no save slots (
SavesViewModel.ExportCommandis
() => Slots.Count > 0), and that stays exactly as it is — this pull request never enables the button without a saveto export.
What changes is the destination side only: the folder chosen with Another folder… may be one that holds no save yet,
which the picker ("A portable emulator's user folder, or any folder") and
docs/saves.md("or into any folder youpick") already promise. An emulator's destination still has to hold its save, because the copy writes into the layout the
emulator reads. If the old refusal of a new folder was deliberate rather than a gap, say so and I will change the wording
instead; the question is in #165.