Play your Steam library's Windows games on a jailbroken PS5.
C++
Say when the install drive choice couldn't be saved
Leonardo Lobatoe236601daed4
diff --git a/src/homebrew/controller.cpp b/src/homebrew/controller.cppindex f9a7935..048a8e4 100644--- a/src/homebrew/controller.cpp+++ b/src/homebrew/controller.cpp@@ -1207,7 +1207,7 @@ void Controller::TickInstalls() {volumes.push_back(std::move(live));}model_.SetFreeSpaceSupported(steam::VolumeSpaceSupported());- model_.UpdateVolumes(volumes, snapshot.default_volume_id);+ model_.UpdateVolumes(volumes, snapshot.default_volume_id, snapshot.default_volume_saved);volume_refreshed_at_ = now;}if (snapshot.revision == install_revision_ && !account_changed && !licenses_due) return;diff --git a/src/homebrew/simulation.cpp b/src/homebrew/simulation.cppindex 5594f89..7afa221 100644--- a/src/homebrew/simulation.cpp+++ b/src/homebrew/simulation.cpp@@ -1397,7 +1397,8 @@ void Simulation::UpdateInstalls(const std::vector<LiveInstallJob>& jobs, const srebuild_view();}-void Simulation::UpdateVolumes(const std::vector<LiveVolume>& volumes, const std::string& default_volume_id) {+void Simulation::UpdateVolumes(const std::vector<LiveVolume>& volumes, const std::string& default_volume_id,+ bool default_volume_saved) {if (!live()) return;std::vector<Volume> projected;for (const auto& live_volume : volumes) {@@ -1416,6 +1417,14 @@ void Simulation::UpdateVolumes(const std::vector<LiveVolume>& volumes, const stdstate_.volumes = std::move(projected);selected_volume_id_ = default_volume_id;state_.default_volume_id = default_volume_id;+ // Said once each time saving starts failing, not on every refresh.+ if (!default_volume_saved && default_volume_saved_) {+ const auto* volume = find_volume(state_, default_volume_id);+ push_notice({"default-volume", "Install drive not saved", "", false, kLiveNoticeSeconds * 2, true,+ (volume ? volume->label : std::string("This drive")) ++ " is used until Playden closes · Console storage may be full"});+ }+ default_volume_saved_ = default_volume_saved;apply_live_volume_usage();rebuild_view();}diff --git a/src/homebrew/simulation.hpp b/src/homebrew/simulation.hppindex 346178a..d8f9165 100644--- a/src/homebrew/simulation.hpp+++ b/src/homebrew/simulation.hpp@@ -629,7 +629,9 @@ public:// Live mode: the folder holding install.log, auth.log and launch.log for the log viewer.void SetLogDirectory(std::filesystem::path directory);// Live mode: the drives installs can use and the one new installs go to.- void UpdateVolumes(const std::vector<LiveVolume>& volumes, const std::string& default_volume_id);+ // default_volume_saved false: the drive choice couldn't be written and lasts until Playden closes.+ void UpdateVolumes(const std::vector<LiveVolume>& volumes, const std::string& default_volume_id,+ bool default_volume_saved = true);// False on a console that cannot read free space at all: installs are then allowed without it.void SetFreeSpaceSupported(bool supported) noexcept { free_space_supported_ = supported; }// Live mode: Steam app-info estimates for one game (download/install size, installability).@@ -716,6 +718,7 @@ private:void request_self_update_restart(const std::string& request = "restart");void open_release_notes(bool after_update);std::string selected_volume_id_;+ bool default_volume_saved_ = true; // last install-service report, so a failed save is said once// Live: the drive chosen in the install sheet for this one install (empty: the default drive),// and whether the open storage picker chooses it rather than the default.std::string install_volume_id_;diff --git a/src/steam/install_service.cpp b/src/steam/install_service.cppindex 0998ee5..f97c668 100644--- a/src/steam/install_service.cpp+++ b/src/steam/install_service.cpp@@ -271,6 +271,7 @@ void InstallService::Scan() {}void InstallService::SaveRegistry() {+ if (!default_volume_saved_) SaveDefaultVolume();const auto& primary = volumes_.front().games_root;mkdir(primary.c_str(), 0777);const auto path = primary + "/" + kRegistry;@@ -293,9 +294,13 @@ void InstallService::SaveDefaultVolume() {const auto path = primary + "/" + kDefaultVolume;const auto temporary = path + ".tmp";FILE* file = std::fopen(temporary.c_str(), "w");- if (!file) return;- std::fprintf(file, "%s\n", default_volume_id_.c_str());- if (std::fclose(file) == 0) std::rename(temporary.c_str(), path.c_str());+ // A full disk refuses the write; the choice still holds for this session and is saved again+ // with the registry.+ bool saved = file && std::fprintf(file, "%s\n", default_volume_id_.c_str()) > 0;+ if (file) saved = std::fclose(file) == 0 && saved;+ saved = saved && std::rename(temporary.c_str(), path.c_str()) == 0;+ if (!saved) std::remove(temporary.c_str());+ default_volume_saved_ = saved;}void InstallService::SaveDismissed() {@@ -514,6 +519,7 @@ InstallSnapshot InstallService::Snapshot() {snapshot.completed = CompletedDownloads(installed_, dismissed_, WallNow());snapshot.volumes = volumes_;snapshot.default_volume_id = default_volume_id_;+ snapshot.default_volume_saved = default_volume_saved_;return snapshot;}diff --git a/src/steam/install_service.h b/src/steam/install_service.hindex 0c23058..56f54df 100644--- a/src/steam/install_service.h+++ b/src/steam/install_service.h@@ -88,6 +88,7 @@ struct InstallSnapshot {std::vector<CompletedDownload> completed;std::vector<InstallVolume> volumes;std::string default_volume_id;+ bool default_volume_saved = true; // false: the choice holds until Playden closes};// One game's install, run synchronously on the service worker. Implementations report progress@@ -175,6 +176,7 @@ class InstallService {SessionRepository& sessions_;std::vector<InstallVolume> volumes_;std::string default_volume_id_;+ bool default_volume_saved_ = true;std::mutex mutex_;std::condition_variable wake_;std::deque<Job> jobs_;diff --git a/tests/homebrew_library_model_test.cpp b/tests/homebrew_library_model_test.cppindex f02f2ac..df9543d 100644--- a/tests/homebrew_library_model_test.cpp+++ b/tests/homebrew_library_model_test.cpp@@ -387,6 +387,19 @@ void live_install_volumes() {activate(model, "settings-storage");activate(model, "volume-m2");check(model.TakeInstallRequests().empty(), "choosing the current default sends nothing");+ const auto unsaved = [&] {+ const auto& modals = model.state().navigation.modals;+ return std::count_if(modals.begin(), modals.end(), [](const auto& modal) { return modal.title == "Install drive not saved"; });+ };+ const std::vector<playden::homebrew::LiveVolume> live_volumes{{"internal", "Console storage", true, std::nullopt, std::nullopt},+ {"m2", "M.2 SSD", true, 2'000, 500},+ {"usb0", "USB drive", false, std::nullopt, std::nullopt},+ {"ext0", "Extended storage", true, 4'000, 3'000, false}};+ model.UpdateVolumes(live_volumes, "m2", false);+ check(unsaved() == 1, "a drive choice that couldn't be saved is said");+ model.UpdateVolumes(live_volumes, "m2", false);+ check(unsaved() == 1, "and said once, not on every refresh");+ model.action("circle");// Details show where a game is and where a new install goes.check(model.action("details:42"), "installed game opens");diff --git a/tests/install_service_test.cpp b/tests/install_service_test.cppindex 5ce0b20..e6f0946 100644--- a/tests/install_service_test.cpp+++ b/tests/install_service_test.cpp@@ -596,8 +596,11 @@ int main() {service.SetDefaultVolume("usb0"); // unavailable: ignoredCHECK(service.Snapshot().default_volume_id == "internal");+ // A refused write (a full disk) keeps the choice for the session and says it wasn't saved.+ std::filesystem::permissions(primary, std::filesystem::perms::owner_read | std::filesystem::perms::owner_exec);service.SetDefaultVolume("m2");- CHECK(service.Snapshot().default_volume_id == "m2");+ CHECK(service.Snapshot().default_volume_id == "m2" && !service.Snapshot().default_volume_saved);+ std::filesystem::permissions(primary, std::filesystem::perms::owner_all);CHECK(service.RootFor(800) == (second / "800").string());CHECK(service.RootFor(100) == (primary / "100").string());@@ -607,6 +610,8 @@ int main() {std::lock_guard<std::mutex> lock(multi.mutex);CHECK(multi.install_roots.size() == 1 && multi.install_roots[0] == (second / "800").string());}+ // With room again, the next registry write saves the choice too, without choosing it again.+ CHECK(service.Snapshot().default_volume_saved);for (const auto& game : service.Snapshot().installed) if (game.id == 800) CHECK(game.volume_id == "m2");service.Uninstall(500); // its drive is absent: nothing to delete, the game stays listed