Skip to content

Play your Steam library's Windows games on a jailbroken PS5.

C++

Keep saves of leftover titles as kept game data

Leonardo Lobato9a3b34de0609
diff --git a/README.md b/README.md
index 3db9ae8..51b6a55 100644
--- a/README.md
+++ b/README.md
@@ -313,7 +313,8 @@ build/homebrew-host/playden-homebrew --simulation --scenario signed-out
- Uninstall games from Playden. Title folders belong to Playden; FTP and file managers can't delete them.
Leftover titles appear in Settings › Storage. Deleting a leftover removes its title folder and Home tile;
- its game files and saves stay on disk because Playden no longer has a record linking them to the title.
+ its saves and settings move to Kept game data, where you can delete them or get them back by installing the game
+ again.
- New games can stay at *Waiting for the PS5* after you quit Playden when ShadowMountPlus stops registering titles.
Reload ShadowMountPlus.
Until the game is registered, its Cloud saves are not synced before its first launch.
diff --git a/src/homebrew/runtime_host.cpp b/src/homebrew/runtime_host.cpp
index 1ec9a37..4acac91 100644
--- a/src/homebrew/runtime_host.cpp
+++ b/src/homebrew/runtime_host.cpp
@@ -3781,6 +3781,151 @@ void RuntimeHost::ResumeLeftoverDeletes(Composition& c) {
}
}
+std::optional<RuntimeHost::RemovalFailure> RuntimeHost::KeepBottle(
+ const std::filesystem::path& bottle, const std::string& install_id, const GameId& game,
+ std::uint32_t runtime_number, const std::string& name, const std::string& operation_id) {
+ const auto kept = bottle.parent_path() / (install_id + kKeptSuffix);
+ std::error_code error;
+ struct stat info{};
+ // A Steam game's marker is as before; another store's also names its game.
+ const auto identity = game.store == Store::kSteam ? std::string()
+ : ",\"store\":\"" + std::string(Traits(game.store).key) + "\",\"game\":\"" + JsonEscaped(game.value) + "\"";
+ const auto marker = "{\"schema\":1,\"install_id\":\"" + install_id + "\",\"app_id\":" +
+ std::to_string(runtime_number) + identity + ",\"name\":\"" + JsonEscaped(name) +
+ "\",\"kept_at\":" + std::to_string(config_.unix_time ? config_.unix_time() : std::int64_t(time(nullptr))) +
+ ",\"bytes\":" + std::to_string(TreeBytes(bottle)) + "}\n";
+ const int fd = open((bottle / kKeptMarker).c_str(), O_WRONLY | O_CREAT | O_TRUNC | O_NOFOLLOW | O_CLOEXEC, 0600);
+ const bool written = fd >= 0 && write(fd, marker.data(), marker.size()) == static_cast<ssize_t>(marker.size()) &&
+ fsync(fd) == 0;
+ if (fd >= 0) close(fd);
+ if (!written) return RemovalFailure{"bottle-keep", "The game's saves could not be marked as kept."};
+ const bool restored = lstat((bottle / kRestoredMarker).c_str(), &info) == 0;
+ if (lstat(kept.c_str(), &info) == 0 && !restored) {
+ // The kept copy's saves were never brought back into this bottle (a preparation after a move or
+ // reinstall stopped before that): the kept copy holds them and stays. The newer bottle is set
+ // aside beside it, never deleted.
+ const auto aside = bottle.parent_path() / (install_id + ".set-aside-" + operation_id);
+ Log("remove keeps the unrestored kept bottle install=" + install_id + "; newer bottle set aside");
+ if (rename(bottle.c_str(), aside.c_str()) != 0)
+ return RemovalFailure{"bottle-keep", "The game's newer bottle could not be set aside (error " + std::to_string(errno) + ")."};
+ } else if (lstat(kept.c_str(), &info) == 0) {
+ // An older kept copy whose saves this bottle already has: the bottle replaces it.
+ Log("remove replaces older kept bottle install=" + install_id);
+ RemoveTreeNoFollow(kept, error);
+ if (error) return RemovalFailure{"bottle-keep", "An older copy of the game's saves could not be replaced."};
+ if (rename(bottle.c_str(), kept.c_str()) != 0)
+ return RemovalFailure{"bottle-keep", "The game's saves could not be kept (error " + std::to_string(errno) + ")."};
+ } else if (rename(bottle.c_str(), kept.c_str()) != 0) {
+ return RemovalFailure{"bottle-keep", "The game's saves could not be kept (error " + std::to_string(errno) + ")."};
+ }
+ return std::nullopt;
+}
+
+void RuntimeHost::KeepUnrecordedBottles(Composition& c) {
+ // Every reason to doubt which bottles are unrecorded stops the whole pass: a kept bottle is
+ // renamed away from where its game's title looks for it.
+ // A leftover deletion journal, even an unreadable one, may stand for a retired title that still names a bottle.
+ if (!c.repository.Loaded() || !c.leftover_journals_known || !c.blocked_leftover_titles.empty()) return;
+ const auto records = c.repository.Snapshot();
+ std::set<std::string> recorded_installs;
+ for (const auto& record : records) recorded_installs.insert(record.install_id);
+ // A PS5 title starts the bottle its game-launch.json names, running or not, whatever owns its folder and
+ // whatever the records say about it: that bottle stays until the title is deleted (Storage lists it as a leftover).
+ std::set<std::string> named_installs, named_roots;
+ {
+ std::error_code error;
+ for (std::filesystem::directory_iterator it(config_.homebrew_root, error), end; !error && it != end;
+ it.increment(error)) {
+ const auto title = it->path().filename().string();
+ if (!rt::IsManagedTitle(title)) continue;
+ struct stat info{};
+ if (lstat(it->path().c_str(), &info) != 0) {
+ Log("unrecorded bottles not kept: " + title + " cannot be inspected");
+ return;
+ }
+ if (!S_ISDIR(info.st_mode)) continue;
+ const int fd = open((it->path() / "game-launch.json").c_str(), O_RDONLY | O_NOFOLLOW | O_CLOEXEC);
+ std::string bytes;
+ if (fd >= 0) {
+ char chunk[4096];
+ for (ssize_t count; (count = read(fd, chunk, sizeof(chunk))) > 0 && bytes.size() <= 8192;)
+ bytes.append(chunk, static_cast<std::size_t>(count));
+ close(fd);
+ } else if (errno == ENOENT) {
+ continue; // no descriptor: the title names no bottle
+ }
+ const auto json = bytes.size() <= 8192 ? playden::steam::json::Parse(bytes) : std::nullopt;
+ const auto* install = json ? json->Find("install_id") : nullptr;
+ const auto* root = json ? json->Find("data_root") : nullptr;
+ if (!install || !install->is_string() || !root || !root->is_string()) {
+ Log("unrecorded bottles not kept: the game-launch.json of " + title + " cannot be read");
+ return;
+ }
+ named_installs.insert(install->text());
+ named_roots.insert(root->text());
+ }
+ if (error) {
+ Log("unrecorded bottles not kept: " + config_.homebrew_root.string() + " cannot be listed");
+ return;
+ }
+ }
+ const auto console_games = config_.package_paths.console_data_root + "/playden/games";
+ const auto games = HostPath(console_games);
+ std::vector<std::string> found;
+ {
+ std::error_code error;
+ for (std::filesystem::directory_iterator it(games, error), end; !error && it != end; it.increment(error)) {
+ const auto install_id = it->path().filename().string();
+ if (!KeptInstallId(install_id) || recorded_installs.count(install_id) || named_installs.count(install_id) ||
+ named_roots.count(console_games + "/" + install_id))
+ continue;
+ struct stat info{};
+ if (lstat(it->path().c_str(), &info) != 0 || !S_ISDIR(info.st_mode) || info.st_uid != geteuid()) continue;
+ found.push_back(install_id);
+ }
+ }
+ bool kept_any = false;
+ for (const auto& install_id : found) {
+ const auto game = ParseInstallId(install_id);
+ if (!game) continue;
+ std::uint32_t number = 0;
+ if (const auto app = game->steam_app()) {
+ number = *app;
+ } else {
+ const auto assigned = c.repository.RuntimeNumberFor(*game);
+ if (!assigned.ok()) {
+ Log("unrecorded bottle not kept install=" + install_id + ": " + assigned.message());
+ // A failed write leaves the records unread: every later decision would rest on them.
+ if (!c.repository.Loaded()) return;
+ continue;
+ }
+ number = assigned.value();
+ }
+ const auto operation = config_.uuid();
+ if (!operation) { Log("unrecorded bottles not kept: no secure random source"); return; }
+ const auto bottle = games / install_id;
+ std::string name;
+ {
+ const int fd = open((bottle / "title-metadata/sce_sys/param.json").c_str(), O_RDONLY | O_NOFOLLOW | O_CLOEXEC);
+ if (fd >= 0) {
+ std::string bytes;
+ char chunk[4096];
+ for (ssize_t count; (count = read(fd, chunk, sizeof(chunk))) > 0 && bytes.size() < 64 * 1024;)
+ bytes.append(chunk, static_cast<std::size_t>(count));
+ close(fd);
+ name = WithoutStoreSuffix(TitleNameOf(bytes).value_or(std::string{}));
+ }
+ }
+ if (const auto failed = KeepBottle(bottle, install_id, *game, number, name, *operation)) {
+ Log("unrecorded bottle not kept install=" + install_id + ": " + failed->message);
+ continue;
+ }
+ Log("unrecorded bottle kept install=" + install_id);
+ kept_any = true;
+ }
+ if (kept_any) PublishKeptBottles(c);
+}
+
// Removal of a game's PS5 title, journaled in its install record so an interrupted
// removal continues where it stopped: retire the title folder out of ShadowMount's
// scan root, unregister the title through the one-shot remover, keep or delete the
@@ -3887,38 +4032,9 @@ std::string RuntimeHost::RunRemove(Composition& c, std::uint32_t app, bool delet
ClearWork();
if (error) return fail("bottle-delete", "The game's saves and settings could not be deleted: " + error.message());
} else if (present) {
- // A Steam game's marker is as before; another store's also names its game.
- const auto game = GameOf(record);
- const auto identity = game.store == Store::kSteam ? std::string()
- : ",\"store\":\"" + std::string(Traits(game.store).key) + "\",\"game\":\"" + JsonEscaped(game.value) + "\"";
- const auto marker = "{\"schema\":1,\"install_id\":\"" + record.install_id + "\",\"app_id\":" +
- std::to_string(record.runtime_number) + identity + ",\"name\":\"" + JsonEscaped(game_name) +
- "\",\"kept_at\":" + std::to_string(config_.unix_time ? config_.unix_time() : std::int64_t(time(nullptr))) +
- ",\"bytes\":" + std::to_string(TreeBytes(bottle)) + "}\n";
- const int fd = open((bottle / kKeptMarker).c_str(), O_WRONLY | O_CREAT | O_TRUNC | O_NOFOLLOW | O_CLOEXEC, 0600);
- const bool written = fd >= 0 && write(fd, marker.data(), marker.size()) == static_cast<ssize_t>(marker.size()) &&
- fsync(fd) == 0;
- if (fd >= 0) close(fd);
- if (!written) return fail("bottle-keep", "The game's saves could not be marked as kept.");
- const bool restored = lstat((bottle / kRestoredMarker).c_str(), &info) == 0;
- if (lstat(kept.c_str(), &info) == 0 && !restored) {
- // The kept copy's saves were never brought back into this bottle (a preparation after a move or
- // reinstall stopped before that): the kept copy holds them and stays. The newer bottle is set
- // aside beside it, never deleted.
- const auto aside = bottle.parent_path() / (record.install_id + ".set-aside-" + record.journal->operation_id);
- Log("remove keeps the unrestored kept bottle install=" + record.install_id + "; newer bottle set aside");
- if (rename(bottle.c_str(), aside.c_str()) != 0)
- return fail("bottle-keep", "The game's newer bottle could not be set aside (error " + std::to_string(errno) + ").");
- } else if (lstat(kept.c_str(), &info) == 0) {
- // An older kept copy whose saves this bottle already has: the bottle replaces it.
- Log("remove replaces older kept bottle install=" + record.install_id);
- RemoveTreeNoFollow(kept, error);
- if (error) return fail("bottle-keep", "An older copy of the game's saves could not be replaced.");
- if (rename(bottle.c_str(), kept.c_str()) != 0)
- return fail("bottle-keep", "The game's saves could not be kept (error " + std::to_string(errno) + ").");
- } else if (rename(bottle.c_str(), kept.c_str()) != 0) {
- return fail("bottle-keep", "The game's saves could not be kept (error " + std::to_string(errno) + ").");
- }
+ if (const auto failed = KeepBottle(bottle, record.install_id, GameOf(record), record.runtime_number, game_name,
+ record.journal->operation_id))
+ return fail(failed->code, failed->message);
}
if (auto failed = advance("erase"); !failed.empty()) return failed;
}
@@ -4105,6 +4221,7 @@ bool RuntimeHost::RunServices() {
Log("startup installs published");
ResumeLeftoverDeletes(c);
PublishLeftoverTitles(c);
+ KeepUnrecordedBottles(c);
// Retired title folders left by an earlier removal are outside the scan
// root already; deleting them is only housekeeping.
if (c.leftover_journals_known) {
@@ -4402,7 +4519,10 @@ bool RuntimeHost::RunServices() {
});
const auto refusal = composition ? RunDeleteLeftover(*composition, *request.leftover)
: "The runtime services are unavailable.";
- if (composition) PublishLeftoverTitles(*composition);
+ if (composition) {
+ PublishLeftoverTitles(*composition);
+ KeepUnrecordedBottles(*composition);
+ }
ClearWork();
Publish([&](RuntimeSnapshot& s) {
s.deleting_leftover_title.reset();
diff --git a/src/homebrew/runtime_host.hpp b/src/homebrew/runtime_host.hpp
index b8912c5..323abcd 100644
--- a/src/homebrew/runtime_host.hpp
+++ b/src/homebrew/runtime_host.hpp
@@ -641,6 +641,13 @@ class RuntimeHost {
std::optional<RemovalFailure> UnregisterTitle(Composition& composition, const std::string& title_id,
const std::string& operation_id);
std::string DeleteRetiredTitle(const std::string& title_id, const std::string& operation_id);
+ // Marks a bottle as kept saves (<install id>.kept), as Uninstall without "delete saves" does.
+ std::optional<RemovalFailure> KeepBottle(const std::filesystem::path& bottle, const std::string& install_id,
+ const GameId& game, std::uint32_t runtime_number, const std::string& name,
+ const std::string& operation_id);
+ // Keeps bottles no install record and no unrecorded PS5 title names (their title was deleted
+ // as a leftover, or its record was lost) as kept saves, so Storage lists them.
+ void KeepUnrecordedBottles(Composition& composition);
struct LeftoverDelete {
runtime::LeftoverTitle title;
std::string operation_id;
diff --git a/src/homebrew/simulation.cpp b/src/homebrew/simulation.cpp
index 713efb9..74a1635 100644
--- a/src/homebrew/simulation.cpp
+++ b/src/homebrew/simulation.cpp
@@ -4115,7 +4115,7 @@ void Simulation::rebuild_view() {
"back. Saves in Steam Cloud stay in Steam Cloud.";
if (modal.id == "leftover-titles")
view_.subtitle = "PS5 titles Playden made but no longer has a record of. Deleting one removes its title and Home "
- "tile; its saves and game files stay.";
+ "tile; its saves and settings move to Kept game data, and its game files stay in the Library.";
if (modal.id == "download-server")
view_.subtitle = "Applies to downloads that start or resume from now.";
for (const auto& action_key : modal.action_keys) {
@@ -7479,7 +7479,7 @@ void Simulation::activate() {
state_.navigation.focus_key, {"cancel", "confirm-destructive"}, 0, true};
confirmation.body = (one ? only + " and its PS5 Home tile are" : std::to_string(leftover_selected_.size()) +
" leftover PS5 titles and their Home tiles are") + " deleted (" + format_bytes(bytes) + "). " +
- (one ? "Its" : "Their") + " saves and game files are kept.";
+ (one ? "Its" : "Their") + " saves and settings move to Kept game data; game files are not touched.";
open_modal(std::move(confirmation));
} else if (action_name == "confirm-destructive" && pending_destructive_action_ == "leftover-selection-delete") {
pending_destructive_action_.clear();
diff --git a/tests/homebrew_library_model_test.cpp b/tests/homebrew_library_model_test.cpp
index fdcc091..1b853aa 100644
--- a/tests/homebrew_library_model_test.cpp
+++ b/tests/homebrew_library_model_test.cpp
@@ -3249,7 +3249,7 @@ void leftover_titles_require_confirmation_and_follow_the_queue() {
check(model.TakeLeftoverDeleteRequests().empty(), "opening the confirmation deletes nothing");
check(model.state().navigation.focus_key == "cancel" &&
model.state().navigation.modals.back().body.find("Lost game (Steam) (FAKE78001)") != std::string::npos &&
- model.state().navigation.modals.back().body.find("saves and game files are kept") != std::string::npos,
+ model.state().navigation.modals.back().body.find("move to Kept game data") != std::string::npos,
"confirmation starts on Cancel and describes the deletion scope");
activate(model, "cancel");
check(model.TakeLeftoverDeleteRequests().empty() && model.state().navigation.modals.back().id == "leftover-titles",
diff --git a/tests/homebrew_runtime_host_test.cpp b/tests/homebrew_runtime_host_test.cpp
index 1c488af..799157b 100644
--- a/tests/homebrew_runtime_host_test.cpp
+++ b/tests/homebrew_runtime_host_test.cpp
@@ -5248,6 +5248,10 @@ constexpr const char* kLeftoverOperation = "00000000-0000-4000-8000-000000000001
RuntimeHostConfig LeftoverConfig(Fixture& fixture) {
auto config = fixture.Config();
+ // Bottles live under the fixture, where Playden looks for them.
+ config.host_namespace_prefix = fixture.root;
+ config.package_paths.console_data_root = "/data";
+ config.package_paths.host_data_root = fixture.root / "data";
config.uuid = [] { return std::optional<std::string>(kLeftoverOperation); };
config.removal_confirm_polls = 1;
config.removal_poll_interval = std::chrono::milliseconds(1);
@@ -5265,6 +5269,10 @@ fs::path MakeLeftover(Fixture& fixture) {
const auto title = fixture.root / "data/homebrew/FAKE78001";
Write(title / "sce_sys/param.json", R"({"localizedParameters":{"en-US":{"titleName":"Left Behind"}}})", 0644);
Write(title / "eboot.bin", "title-files", 0755);
+ // The title shell's descriptor names the game's bottle (see pw_title_launch.c).
+ Write(title / "game-launch.json",
+ R"({"schema_version":1,"app_id":220,"title_id":"FAKE78001","install_id":"steam-220",)"
+ R"("data_root":"/data/playden/games/steam-220"})", 0644);
CHECK(chmod(title.c_str(), 0755) == 0);
return title;
}
@@ -5325,7 +5333,15 @@ void DeletesLeftoverTitleAndResumesFailures() {
if (scenario == 5) CHECK(done.leftover_delete_failures.at("FAKE78001").find("has not confirmed") != std::string::npos);
}
}
- CHECK(Read(bottle) == "saved-game" && Read(files) == "downloaded-game");
+ if (scenario <= 1) {
+ // The title that named the bottle is gone: its saves are kept, as Uninstall keeps them.
+ const auto kept = fixture.root / "data/playden/games/steam-220.kept";
+ CHECK(!fs::exists(bottle) && Read(kept / "save.dat") == "saved-game");
+ CHECK(done.kept_bottles.size() == 1 && done.kept_bottles[0].install_id == "steam-220");
+ } else {
+ CHECK(Read(bottle) == "saved-game" && done.kept_bottles.empty());
+ }
+ CHECK(Read(files) == "downloaded-game");
host.Shutdown();
}
if (scenario < 3) continue;
@@ -5341,7 +5357,8 @@ void DeletesLeftoverTitleAndResumesFailures() {
CHECK(calls == 2 && !fixture.registered);
CHECK(!fs::exists(config.state_root / "leftover-FAKE78001.json"));
CHECK(fs::is_empty(config.state_root / "trash"));
- CHECK(Read(bottle) == "saved-game" && Read(files) == "downloaded-game");
+ CHECK(!fs::exists(bottle) && Read(fixture.root / "data/playden/games/steam-220.kept/save.dat") == "saved-game");
+ CHECK(done.kept_bottles.size() == 1 && Read(files) == "downloaded-game");
restarted.Shutdown();
}
}
@@ -5535,6 +5552,77 @@ void LeftoverDeletionRefusesANewInstallUsingTheId() {
host.Shutdown();
}
+// Bottles with no install record are kept as saves (as Uninstall keeps them) once no unrecorded
+// PS5 title names them. Any doubt (unreadable records or descriptor) keeps every bottle as it is.
+void KeepsUnrecordedBottlesAsKeptSaves() {
+ for (int scenario = 0; scenario < 6; ++scenario) {
+ Fixture fixture;
+ auto config = LeftoverConfig(fixture);
+ config.unix_time = [] { return std::int64_t{1760000000}; };
+ const auto games = fixture.root / "data/playden/games";
+ Write(games / "steam-221/save.dat", "lost-record", 0600);
+ Write(games / "steam-221/title-metadata/sce_sys/param.json",
+ R"({"localizedParameters":{"en-US":{"titleName":"Old Save"}}})", 0600);
+ Write(games / "steam-220/save.dat", "named-by-title", 0600);
+ MakeLeftover(fixture); // FAKE78001's game-launch.json names steam-220
+ Write(games / "steam-225/save.dat", "newer", 0600);
+ Write(games / "steam-225/.playden-saves-restored", "", 0600);
+ Write(games / "steam-225.kept/save.dat", "older", 0600);
+ Write(games / "steam-225.kept/playden-kept.json",
+ R"({"schema":1,"install_id":"steam-225","app_id":225,"name":"Older","kept_at":1,"bytes":5})", 0600);
+ Write(games / "steam-226.saves/1/users/save.dat", "backup", 0600);
+ // A title names its bottle by data_root even when its install_id says otherwise; one with no
+ // descriptor names none.
+ Write(games / "steam-228/save.dat", "named-by-root", 0600);
+ Write(fixture.root / "data/homebrew/FAKE78005/game-launch.json",
+ R"({"schema_version":1,"app_id":229,"title_id":"FAKE78005","install_id":"steam-229",)"
+ R"("data_root":"/data/playden/games/steam-228"})", 0644);
+ Write(fixture.root / "data/homebrew/FAKE78006/eboot.bin", "title-files", 0755);
+ Write(fixture.root / "elsewhere/save.dat", "linked", 0600);
+ fs::create_symlink(fixture.root / "elsewhere", games / "steam-227");
+ if (scenario == 1) {
+ Write(fixture.root / "data/homebrew/FAKE78003/game-launch.json", "{broken", 0644);
+ } else if (scenario == 2) {
+ Write(config.state_root / "installs.json", "broken", 0600);
+ CHECK(chmod(config.state_root.c_str(), 0700) == 0);
+ } else if (scenario == 3) {
+ // An unreadable leftover deletion journal: its retired title may still name a bottle.
+ Write(config.state_root / "leftover-FAKE78004.json", "{broken", 0600);
+ CHECK(chmod(config.state_root.c_str(), 0700) == 0);
+ } else if (scenario == 4) {
+ // A journal entry that is not even a file still reserves its title.
+ fs::create_directories(config.state_root / "leftover-FAKE78004.json");
+ CHECK(chmod(config.state_root.c_str(), 0700) == 0);
+ } else if (scenario == 5) {
+ // A title folder that cannot be inspected might name any bottle (listable, not searchable).
+ CHECK(chmod((fixture.root / "data/homebrew").c_str(), 0644) == 0);
+ }
+ RuntimeHost host(config);
+ CHECK(host.Start());
+ const auto started = WaitFor(host, Started);
+ CHECK(Read(games / "steam-220/save.dat") == "named-by-title");
+ CHECK(Read(games / "steam-228/save.dat") == "named-by-root" && !fs::exists(games / "steam-228.kept"));
+ CHECK(Read(games / "steam-226.saves/1/users/save.dat") == "backup");
+ CHECK(fs::is_symlink(games / "steam-227") && Read(fixture.root / "elsewhere/save.dat") == "linked");
+ if (scenario == 0) {
+ CHECK(!fs::exists(games / "steam-221") && Read(games / "steam-221.kept/save.dat") == "lost-record");
+ const auto marker = Read(games / "steam-221.kept/playden-kept.json");
+ CHECK(marker.find("\"install_id\":\"steam-221\",\"app_id\":221") != std::string::npos);
+ CHECK(marker.find("\"name\":\"Old Save\"") != std::string::npos);
+ // This bottle already has the older kept copy's saves: it replaces that copy.
+ CHECK(!fs::exists(games / "steam-225") && Read(games / "steam-225.kept/save.dat") == "newer");
+ std::set<std::string> kept;
+ for (const auto& view : started.kept_bottles) kept.insert(view.install_id + "=" + view.name);
+ CHECK((kept == std::set<std::string>{"steam-221=Old Save", "steam-225="})); // steam-225 has no title metadata
+ } else {
+ CHECK(Read(games / "steam-221/save.dat") == "lost-record" && !fs::exists(games / "steam-221.kept"));
+ CHECK(Read(games / "steam-225/save.dat") == "newer" && Read(games / "steam-225.kept/save.dat") == "older");
+ }
+ host.Shutdown();
+ if (scenario == 5) CHECK(chmod((fixture.root / "data/homebrew").c_str(), 0755) == 0);
+ }
+}
+
int main(int argc, char** argv) {
CHECK(argc == 2);
g_runtime_dir = argv[1];
@@ -5544,6 +5632,7 @@ int main(int argc, char** argv) {
LeftoverRemovalRevalidatesBeforeEffects();
for (int scenario = 0; scenario < 3; ++scenario) LeftoverRemovalRecoversRetireWriteGap(scenario);
LeftoverScanRequiresLoadedRecordsAndRepeatsAfterUninstall();
+ KeepsUnrecordedBottlesAsKeptSaves();
WorkerMovesGamesUnderPublicationLease();
NoKitRefusesPreparationWithoutDurableEffects();
ReloadKitAdmitsAKitInstalledWhileRunning();