Play your Steam library's Windows games on a jailbroken PS5.
C++
Add an Update runtime button beside Play
Leonardo Lobato03785f56b0d4
diff --git a/src/homebrew/controller.cpp b/src/homebrew/controller.cppindex aa702f8..4b93838 100644--- a/src/homebrew/controller.cpp+++ b/src/homebrew/controller.cpp@@ -881,11 +881,11 @@ void Controller::TickRuntime() {} else if (record && record->state == runtime::PreparationState::kReady && !record->recovery_pending &&!record->title_current) {game.status = "Update available"; game.can_prepare = usable;- game.detail = "Play updates the Windows runtime first, not the game";+ game.detail = "Play or Update runtime updates it first; the game and its saves stay as they are";} else if (record && record->state == runtime::PreparationState::kReady && !record->recovery_pending &&record->admission != "ok") {game.status = "Needs repair"; game.can_prepare = usable;- game.detail = "Play repairs the Windows runtime first (" + record->admission + ")";+ game.detail = "Play repairs the runtime first (" + record->admission + ")";} else if (record && record->state == runtime::PreparationState::kReady && !record->recovery_pending) {game.status = "Ready"; game.detail = record->title_id; game.ready = true;} else if (record && record->awaiting_registration) {@@ -938,8 +938,9 @@ void Controller::TickRuntime() {snapshot.launch->state == runtime::LaunchState::kReadyToHandoff ||snapshot.launch->state == runtime::LaunchState::kLaunching ||snapshot.launch->state == runtime::LaunchState::kRunning);- // Updating or repairing waits while this game is being started or played.- if (launching && busy) game.can_prepare = false;+ // Updating or repairing waits while this game is being started or played, and a queued+ // preparation is not asked for twice.+ if ((launching && busy) || snapshot.queued_prepares.count(id)) game.can_prepare = false;game.can_play = game.ready && !busy && snapshot.preparing_app != id && !cloud_busy_.count(id) &&play_queued_.empty() && !sync_before_play_.count(id);if (const auto note = play_notes_.find(id); note != play_notes_.end() && !launching) game.play_detail = note->second;diff --git a/src/homebrew/simulation.cpp b/src/homebrew/simulation.cppindex 3f6ab66..2d354d3 100644--- a/src/homebrew/simulation.cpp+++ b/src/homebrew/simulation.cpp@@ -2918,6 +2918,10 @@ void Simulation::rebuild_view() {play.value = trimmed(play.value.substr(0, play.value.find("…"))) + " " +std::to_string(static_cast<int>(*value.progress * 100.0F)) + "%";}+ // A title made with an earlier kit's runtime can be updated without starting the+ // game; Play still updates it first. A repair stays on Play: that title is broken.+ if (value.status == "Update available" && value.can_prepare && value.uninstall_status.empty())+ row("details-update-runtime", RowKind::Action, "Update runtime", "runtime-update");}// Steam Cloud saves: sync on demand; a pending choice opens its dialog.const auto cloud = state_.cloud.find(game->id);@@ -4125,6 +4129,11 @@ void Simulation::activate() {const auto id = state_.navigation.detail_id.value_or(state_.navigation.selected_game_id);close_modal();if (id != 0) pending_runtime_prepare_requests_.push_back(id);+ } else if (live() && action_name == "runtime-update") {+ // The button goes once the update starts; Play shows its progress, so focus moves there.+ const auto id = state_.navigation.detail_id.value_or(state_.navigation.selected_game_id);+ if (id != 0) pending_runtime_prepare_requests_.push_back(id);+ state_.navigation.focus_key = "details-play";} else if (live() && action_name == "runtime-prepare") {const auto id = state_.navigation.detail_id.value_or(state_.navigation.selected_game_id);if (id != 0) pending_runtime_prepare_requests_.push_back(id);diff --git a/tests/homebrew_library_model_test.cpp b/tests/homebrew_library_model_test.cppindex 7b479b9..d2f9a93 100644--- a/tests/homebrew_library_model_test.cpp+++ b/tests/homebrew_library_model_test.cpp@@ -1083,7 +1083,23 @@ void live_play_does_the_next_useful_thing() {"the note names the runtime, not the game");activate(model, "details-play");check(model.TakeRuntimePlayRequests() == std::vector<playden::GameId>{42}, "Play goes to the controller");+ // Only an update can happen without starting the game; a broken title is repaired by Play.+ const auto* update = find_row(model, "details-update-runtime");+ if (status == "Update available") {+ check(update && update->title == "Update runtime" && update->enabled && update->action == "runtime-update",+ "Update runtime sits beside Play");+ activate(model, "details-update-runtime");+ check(model.TakeRuntimePrepareRequests() == std::vector<playden::GameId>{42} &&+ model.TakeRuntimePlayRequests().empty(),+ "Update runtime updates without starting the game");+ check(model.state().navigation.focus_key == "details-play", "focus moves to Play, which shows the progress");+ } else {+ check(!update, "a repair offers no separate button");+ }}+ // While the runtime cannot act on it (queued, being played, uninstalling), there is no Update button.+ show("Update available", false, false);+ check(!find_row(model, "details-update-runtime"), "no Update runtime while the game cannot be prepared");// A title that needs the player's attention turns Play into that action.for (const auto& [status, label] : std::vector<std::pair<std::string, std::string>>{{"Needs recovery", "Resume"}, {"Failed", "Retry"}, {"Registration pending", "Check again"}}) {