Repository navigation
fix(launcher): remove installation keeps the saves and trophies, and no rebuild can lose them - #119
Merged
Merged
Conversation
…no rebuild can lose them A game's saves, trophies and download data live in the installation the launcher builds (its data folder), so Remove Installation deleted them with it. Uninstall now keeps them in the store first, as Delete game does (the same code), and the next unlock takes them back. The card says so. A rebuild that fails or is interrupted while the new bundle takes the old one's place leaves them in the game or in the store, never in the half-made bundle that is removed, and the game's files without their bundle still give their saves to the next unlock.
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.
Found while adding Delete game (#114): a game's saves and trophies live inside the installation the launcher builds (
.AnyPS5/Data/<game>/game), so Remove Installation deleted them with it, without saying so. The same fix, rules and wording as on Windows and Linux (AnyTogether/AnyPS5-Desktop, branchfix/keep-saves).Where saves were lost before
AppModel.uninstall(AppModel.swift:1936) calledInstaller.setAside, which moves the whole data folder intoRemoving(Installer.swift:297-314), andInstaller.removethen deleted it, saves included..appremoved by hand, or an unlock the launcher was quit over after the old bundle went):Installer.placecarried the saves over only through the old bundle'sContents/Resources/gamelink (Installer.swift:706) and then removedData/<game>/game(Installer.swift:715), saves included..partialbundle (Installer.swift:706), andrunremoves that bundle when it throws (Installer.swift:503).Installer.swift:715) can take a while, and all that time the saves sat in the.partialbundle, which the next start (removeLeftovers,Installer.swift:337-345) or the next unlock (Installer.swift:586) deleted.The rebuilds themselves (after an engine change, the automatic rebuild of a stale copy from #116, Update from Git's Relink All, a game's own engine, the relinker options, an update added, Unlock Again) all go through
AppModel.unlockto the oneInstaller.run, andplacecarried the saves over when it finished. That part was right and now has tests.What changes
_sd), the save memory (_sd_mem), the trophies (_trophy), the other profiles' parked saves (_profiles), the mark that says whose are in place, and now also the game's download data (download0todownload2, what the engine gives the game as /download0 and keeps between runs). They move to.AnyPS5/Saves/<game>in the games folder before anything is set aside, and the next unlock of the game takes them back. This is Delete game's code (Installer.keepSaves), now inside the newInstaller.uninstall, which Remove Installation and Delete game both call.Saves.placealso carries over from the game's files themselves, so they give their saves to the new installation whether or not their bundle is there.placethat throws moves the saves out of the half-made bundle into.AnyPS5/Saves/<game>before the bundle is removed..AnyPS5/Saves/<game>. One they cannot be taken out of stays.There was no way to delete a game's saves on purpose before this change other than Remove Installation doing it silently, so none is added. Deleting a profile still removes that profile's saves from the installed games, as before.
Release note
Remove Installation keeps your saves: a game's saves and trophies live inside the installation AnyPS5 builds, and Remove Installation used to delete them with it without saying so. It now keeps them, together with the game's download data, in the games folder under
.AnyPS5/Saves, and they come back when you unlock the game again, the same way as after Delete game. The card says they are kept. Saves are also safe when an unlock is interrupted or fails just as the new installation takes the old one's place.Tests
Tests/AnyPS5CoreTests/SavesKeptTests.swift, with a fake engine and the realInstaller.run: Remove Installation keeps every part and the next unlock takes them back, saves that cannot be kept remove nothing, a part that cannot be moved puts the others back, a rebuild after an engine change, with another engine altogether, after the relinker options change, after an update is added, a rebuild that fails, the game's files without their bundle, aplacethat throws, a half-made bundle with the old game still there and with it gone, andremoveLeftovers.Tests/AnyPS5Tests/SavesSurviveModelTests.swift, the launcher's model with an engine folder of its own: the card's text, Remove Installation from the card then Unlock, the notice when saves cannot be kept, the stale copy rebuilt by Play, and Unlock Again from Game Settings.Every test works in temporary folders.
Not run
Nothing was built or run on a Mac: no local
swift buildorswift test, CI only. The card was not looked at on a screen and no real game was removed or rebuilt. The model tests cover the stale copy's rebuild and Unlock Again. The other rebuilds (Update from Git, a game's own engine, the relinker options, an update added) are tested at the installer, which they all reach through the sameunlock. All 28 language files have the two new texts. English and Turkish were written by hand, the other 26 are machine translations built from the words those files already use.