Skip to content

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

C++

Say when a game's setup waits for another game's

Leonardo Lobatof70dd11aef2c
diff --git a/src/homebrew/controller.cpp b/src/homebrew/controller.cpp
index 8d8e267..7bd2e2c 100644
--- a/src/homebrew/controller.cpp
+++ b/src/homebrew/controller.cpp
@@ -1066,6 +1066,11 @@ void Controller::TickRuntime() {
// 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;
+ // Queued behind another game's setup, from the runtime's queue or a Play that waits to ask it.
+ const auto waiting_play = play_after_prepare_.find(id);
+ game.queued = snapshot.preparing_app && *snapshot.preparing_app != id &&
+ (snapshot.queued_prepares.count(id) ||
+ (waiting_play != play_after_prepare_.end() && !waiting_play->second.queued));
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.cpp
index 0cc5579..0882af1 100644
--- a/src/homebrew/simulation.cpp
+++ b/src/homebrew/simulation.cpp
@@ -3672,7 +3672,11 @@ void Simulation::rebuild_view() {
play.value = value.uninstall_status;
play.action.clear();
}
- if (!play.enabled && value.uninstall_status.empty() && value.status != "Preparing") {
+ if (value.queued && value.uninstall_status.empty()) {
+ play.value = "Queued";
+ play.enabled = false;
+ play.action.clear();
+ } else if (!play.enabled && value.uninstall_status.empty() && value.status != "Preparing") {
const auto other = std::find_if(state_.runtime_games.begin(), state_.runtime_games.end(),
[&](const auto& entry) { return entry.first != game->id && entry.second.status == "Preparing"; });
if (other != state_.runtime_games.end()) play.value = "Waiting";
@@ -3745,6 +3749,12 @@ void Simulation::rebuild_view() {
: status == "Failed" || status == "No kit" ? "problem"
: status == "Needs repair" || status == "Needs recovery" || status == "Registration pending" ||
status == "Removal incomplete" ? "attention" : "quiet";
+ // The game being set up now, when this one waits for it.
+ std::string ahead;
+ if (runtime && runtime->queued)
+ for (const auto& [other_id, other] : state_.runtime_games)
+ if (other_id != game->id && other.status == "Preparing")
+ if (const auto* other_game = find_game(state_, other_id)) ahead = other_game->title;
auto& setup = row("details-setup", RowKind::Status, "Setup", "");
setup.value = waiting ? "Waiting for the PS5" : kit_update ? "Kit update available"
: status == "Not prepared" ? "Not set up" : status == "Needs recovery" ? "Interrupted"
@@ -3752,8 +3762,15 @@ void Simulation::rebuild_view() {
: status == "Preparing" && runtime && !runtime->detail.empty() ? runtime->detail : status;
setup.tone = tone;
setup.enabled = false;
+ if (runtime && runtime->queued && runtime->uninstall_status.empty()) {
+ setup.value = ahead.empty() ? "Queued" : "Waiting for " + ahead;
+ setup.tone = "busy";
+ }
std::string hint;
- if (waiting) hint = "Quit Playden and " + game->title + " appears on the PS5 Home screen.";
+ if (runtime && runtime->queued && runtime->uninstall_status.empty())
+ hint = ahead.empty() ? "Setup starts when the game being set up is ready."
+ : "Setup starts when " + ahead + " is ready.";
+ else if (waiting) hint = "Quit Playden and " + game->title + " appears on the PS5 Home screen.";
else if (status == "Registration pending") hint = "The PS5 hasn't confirmed " + game->title + " yet.";
else if (status == "Removal incomplete") hint = "Removing " + game->title + " from the PS5 Home screen stopped partway.";
else if (status == "Needs repair") hint = "Some of " + game->title + "'s setup files changed.";
@@ -3770,7 +3787,7 @@ void Simulation::rebuild_view() {
}
if (!hint.empty()) {
auto& note = row("details-hint", RowKind::Status, hint, "");
- note.tone = tone;
+ note.tone = setup.tone;
note.enabled = false;
}
}
diff --git a/src/homebrew/simulation.hpp b/src/homebrew/simulation.hpp
index 28056e6..488f1ba 100644
--- a/src/homebrew/simulation.hpp
+++ b/src/homebrew/simulation.hpp
@@ -159,6 +159,8 @@ struct LiveRuntimeGame {
std::size_t save_backups = 0;
std::int64_t latest_save_backup = 0;
std::string failure_code; // Recorded preparation failure; detail remains available in diagnostics.
+ // Its setup waits for another game's to finish: Playden sets up one game at a time.
+ bool queued = false;
};
// Saves and settings kept from an uninstalled game (its private bottle).
struct LiveKeptBottle {
diff --git a/tests/homebrew_library_model_test.cpp b/tests/homebrew_library_model_test.cpp
index 62742a7..96e2570 100644
--- a/tests/homebrew_library_model_test.cpp
+++ b/tests/homebrew_library_model_test.cpp
@@ -1690,6 +1690,28 @@ void live_ready_prompt_matches_the_open_game() {
check(requests.size() == 1 && requests[0].game_id == 548430, "Play syncs the game named in the prompt");
}
+// A setup waiting behind another game's says so: the button goes quiet and the page names the game ahead.
+void live_queued_setup_names_the_game_ahead() {
+ using playden::homebrew::RuntimeState;
+ using playden::homebrew::LiveRuntimeGame;
+ auto model = make_live();
+ model.UpdateAccount({AuthState::SignedIn, "123", "Synthetic", {}, {}, true});
+ check(model.UpdateLibrary({{game(42, "Synthetic"), game(43, "Ahead")}, false, {}, false, false, {}}), "library loaded");
+ model.UpdateInstalls({}, {{42, 600'000'000}, {43, 700'000'000}});
+ LiveRuntimeGame queued; queued.game_id = 42; queued.status = "Needs recovery"; queued.has_title = true;
+ queued.queued = true;
+ LiveRuntimeGame ahead; ahead.game_id = 43; ahead.status = "Preparing"; ahead.detail = "Step 3 of 6 · Copying";
+ model.UpdateRuntime(RuntimeState::Ready, {queued, ahead});
+ check(model.action("details:42"), "details open");
+ const auto* play = find_row(model, "details-play");
+ check(play && play->title == "Finish setup" && play->value == "Queued" && !play->enabled && play->action.empty(),
+ "a queued setup can't be asked for again and says it is queued");
+ const auto* setup = find_row(model, "details-setup");
+ check(setup && setup->value == "Waiting for Ahead" && setup->tone == "busy", "setup names the game ahead");
+ const auto* hint = find_row(model, "details-hint");
+ check(hint && hint->title == "Setup starts when Ahead is ready." && hint->tone == "busy", "hint says when it starts");
+}
+
void live_play_does_the_next_useful_thing() {
using playden::homebrew::RuntimeState;
using playden::homebrew::LiveRuntimeGame;
@@ -2187,6 +2209,7 @@ int main() {
live_launch_failure_remains_visible_without_a_details_status_line();
live_download_reorder_reaches_service();
live_play_does_the_next_useful_thing();
+ live_queued_setup_names_the_game_ahead();
live_store_details_fill_the_description();
live_ready_to_play_quits_to_home();
live_ready_prompt_matches_the_open_game();