Skip to content

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

C++

Open Run a program once before the game is checked

Leonardo Lobato4d4f82a2c254
diff --git a/src/homebrew/simulation.cpp b/src/homebrew/simulation.cpp
index 3562606..a9b4006 100644
--- a/src/homebrew/simulation.cpp
+++ b/src/homebrew/simulation.cpp
@@ -6103,8 +6103,12 @@ void Simulation::rebuild_view() {
}
} else if (action_key == "run-once") {
item.subtitle = "Starts a program from the game folder, such as its settings launcher, one time. Play doesn't change.";
+ // Only a game known to run waits: opening the list asks whether it runs, and Run once checks again.
std::string refusal;
- if (live() && !game_closed(state_.navigation.selected_game_id, &refusal)) {
+ const auto runtime_game = state_.runtime_games.find(state_.navigation.selected_game_id);
+ const bool checking = runtime_game != state_.runtime_games.end() &&
+ runtime_game->second.activity == TitleActivity::Unknown;
+ if (live() && !checking && !game_closed(state_.navigation.selected_game_id, &refusal)) {
item.enabled = false;
item.subtitle = refusal;
}
diff --git a/tests/homebrew_live_model_test.cpp b/tests/homebrew_live_model_test.cpp
index 1f1f76c..3c96fda 100644
--- a/tests/homebrew_live_model_test.cpp
+++ b/tests/homebrew_live_model_test.cpp
@@ -703,6 +703,18 @@ void live_runs_setup_program_once(const std::filesystem::path& base) {
activate(model, "details-more");
check(find_row(model, "run-once") && !find_row(model, "run-once")->enabled, "setup program: waits while the game runs");
model.action("circle");
+ // Not known yet: the list opens (and asks), and Run once waits for the answer.
+ runtime.activity = TitleActivity::Unknown;
+ model.UpdateRuntime(playden::homebrew::RuntimeState::Ready, {runtime});
+ activate(model, "details-more");
+ check(find_row(model, "run-once")->enabled, "setup program: a game not known to run can open the list");
+ activate(model, "run-once");
+ check(model.TakeActivityRequests() == std::vector<GameId>{SteamId(35140)}, "setup program: the list asks whether it runs");
+ activate(model, "setup-program-0");
+ activate(model, "run-once-start");
+ check(model.TakeRuntimePlayRequests().empty() && !model.state().navigation.modals.empty(),
+ "setup program: Run once waits until the game is known to be closed");
+ while (!model.state().navigation.modals.empty()) model.action("circle");
runtime.activity = TitleActivity::Stopped;
model.UpdateRuntime(playden::homebrew::RuntimeState::Ready, {runtime});