Play your Steam library's Windows games on a jailbroken PS5.
C++
Name the game when a start from Home fails
Leonardo Lobatoa4b007430daf
diff --git a/src/homebrew/simulation.cpp b/src/homebrew/simulation.cppindex 8a68a16..1943672 100644--- a/src/homebrew/simulation.cpp+++ b/src/homebrew/simulation.cpp@@ -1456,6 +1456,15 @@ void Simulation::NotifyUninstallFinished(GameId id) {}void Simulation::NotifyPlayStopped(GameId id, const std::string& reason) {+ // A start from Home is reported as Playden starts, before its store's library: wait for the name.+ if (live() && !find_game(state_, id) && !catalog_sources_.count(id.store)) {+ pending_play_stops_[id] = reason;+ return;+ }+ tell_play_stopped(id, reason);+}++void Simulation::tell_play_stopped(GameId id, const std::string& reason) {const auto* game = find_game(state_, id);rechosen_after_refusal_.erase(id);const auto text = (game ? game->title : std::string("A game")) + " · " + reason;@@ -2506,6 +2515,16 @@ bool Simulation::UpdateLibrary(LibraryUpdate update) {account.cache_available = update.cache_available;account.error = std::move(update.error);if (update.retrieved_at) account.last_sync = *update.retrieved_at;+ // Launches that stopped before this store's library arrived are told now, by name. A library that+ // could not load still tells them, without the name.+ if (!update.loading) {+ for (auto stop = pending_play_stops_.begin(); stop != pending_play_stops_.end();) {+ if (stop->first.store != update.source) { ++stop; continue; }+ const auto [id, reason] = *stop;+ stop = pending_play_stops_.erase(stop);+ tell_play_stopped(id, reason);+ }+ }// A game just added from the Import sheet is listed now: its page opens (from Startup too).if (!pending_imports_.empty()) settle_pending_imports();// A store without an account brought games while nothing is signed in (or Steam's saved sign-indiff --git a/src/homebrew/simulation.hpp b/src/homebrew/simulation.hppindex 2be496b..90f7754 100644--- a/src/homebrew/simulation.hpp+++ b/src/homebrew/simulation.hpp@@ -980,6 +980,10 @@ private:// Games refused at Prepare whose program or "Try anyway" the player changed since: their page// no longer shows the old refusal.std::set<GameId> rechosen_after_refusal_;+ // Launches that stopped before their store's library arrived (a start from Home reported when Playden+ // starts): told once the game's name is known.+ std::map<GameId, std::string> pending_play_stops_;+ void tell_play_stopped(GameId id, const std::string& reason);// Game settings asked for on a game not set up yet: it opens once preparing makes a draft or a title.std::set<GameId> settings_after_prepare_;void open_settings_after_prepare();diff --git a/tests/homebrew_library_model_test.cpp b/tests/homebrew_library_model_test.cppindex 2d93381..bfc300f 100644--- a/tests/homebrew_library_model_test.cpp+++ b/tests/homebrew_library_model_test.cpp@@ -1925,6 +1925,36 @@ void live_play_does_the_next_useful_thing() {check(!has_row(model, "details-setup") && !has_row(model, "details-hint"), "uninstalled games have no setup facts or hints");}+// A start from Home that failed is reported as Playden starts, before the library: the dialog still names the game.+void live_launch_failure_before_the_library_names_the_game() {+ using playden::homebrew::LiveRuntimeGame;+ using playden::homebrew::RuntimeState;+ auto model = make_live();+ model.UpdateAccount({AuthState::SignedIn, "123", "Synthetic", {}, {}, true});+ LiveRuntimeGame stopped; stopped.game_id = SteamId(42); stopped.status = "Ready"; stopped.ready = true; stopped.can_play = true;+ stopped.play_detail = "The game could not start.";+ model.UpdateRuntime(RuntimeState::Ready, {stopped});+ check(model.state().navigation.modals.empty() && model.state().notices.empty(),+ "a launch failure for a game not listed yet waits for the library");+ check(model.UpdateLibrary({{game(SteamId(42), "BeamNG.drive")}, false, {}, false, false, {}}), "library loaded");+ const auto& modals = model.state().navigation.modals;+ check(modals.size() == 1 && modals.back().title == "Can't play" &&+ modals.back().body.rfind("BeamNG.drive · The game could not start.", 0) == 0,+ "the waiting launch failure names the game once the library arrives");+ activate(model, "alert-ok");+ model.UpdateLibrary({{game(SteamId(42), "BeamNG.drive")}, false, {}, false, false, {}});+ check(model.state().navigation.modals.empty(), "the launch failure is told once");++ // A library that cannot load still tells a waiting failure, without the name.+ auto offline = make_live();+ offline.UpdateAccount({AuthState::SignedIn, "123", "Synthetic", {}, {}, true});+ offline.UpdateRuntime(RuntimeState::Ready, {stopped});+ offline.UpdateLibrary({{}, false, "Library sync is unavailable. Try again later.", false, false, {}});+ const auto& offline_modals = offline.state().navigation.modals;+ check(!offline_modals.empty() && offline_modals.back().body.rfind("A game · The game could not start.", 0) == 0,+ "a library that could not load still tells the waiting failure");+}+void live_launch_failure_remains_visible_without_a_details_status_line() {using playden::homebrew::LiveRuntimeGame;using playden::homebrew::RuntimeState;@@ -3079,6 +3109,7 @@ int main() {non_canonical_game_keys_select_nothing();live_stay_signed_in_preference_loads();live_launch_failure_remains_visible_without_a_details_status_line();+ live_launch_failure_before_the_library_names_the_game();live_download_reorder_reaches_service();live_play_does_the_next_useful_thing();live_queued_setup_names_the_game_ahead();