Play your Steam library's Windows games on a jailbroken PS5.
C++
Close the open Queue section from its heading
Leonardo Lobatoeb654e30d803
diff --git a/src/homebrew/queue_layout.cpp b/src/homebrew/queue_layout.cppindex 35148e9..ae8c6a1 100644--- a/src/homebrew/queue_layout.cpp+++ b/src/homebrew/queue_layout.cpp@@ -211,7 +211,7 @@ QueueLayout BuildQueueLayout(const State& state) {if (row.key == focus) open = section->id;const auto section = [&](const std::string& id) -> QueueSection& { return id == kQueueDownloads ? download : prepare; };if (open.empty() && !state.queue_expanded.empty() && !section(state.queue_expanded).empty()) open = state.queue_expanded;- if (open.empty()) {+ if (open.empty() && state.queue_expanded != kQueueCollapsed) {if (prepare.waiting > 0) open = kQueuePreparation;else if (download.unfinished()) open = kQueueDownloads;else if (prepare.unfinished()) open = kQueuePreparation;diff --git a/src/homebrew/queue_layout.hpp b/src/homebrew/queue_layout.hppindex 99c38a9..a47f2be 100644--- a/src/homebrew/queue_layout.hpp+++ b/src/homebrew/queue_layout.hpp@@ -13,6 +13,7 @@namespace playden::homebrew {inline constexpr const char* kQueueDownloads = "downloads";inline constexpr const char* kQueuePreparation = "preparation";+inline constexpr const char* kQueueCollapsed = "none"; // the player closed the open section// One game in a section. Downloads point at their job; preparations carry what their row says.struct QueueEntry {@@ -57,7 +58,7 @@ struct QueueLayout {};// The section shown expanded: the one whose row has focus, else the player's choice when it still-// has something to show, else Preparation when games wait there, Downloads with unfinished work,+// has something to show (none when they closed it), else Preparation when games wait there, Downloads with unfinished work,// then whichever has anything.QueueLayout BuildQueueLayout(const State& state);// The section a Queue focus key belongs to (a heading, card or row); empty for other keys.diff --git a/src/homebrew/simulation.cpp b/src/homebrew/simulation.cppindex 3c2d73b..440b8ad 100644--- a/src/homebrew/simulation.cpp+++ b/src/homebrew/simulation.cpp@@ -6166,7 +6166,8 @@ void Simulation::activate() {prepare_next(selected.game_id);state_.navigation.focus_key = selected.key;} else if (action_name == "queue-expand") {- state_.queue_expanded = selected.section;+ // The open section's heading closes it; the other's opens that one instead.+ state_.queue_expanded = state_.queue_expanded == selected.section ? kQueueCollapsed : selected.section;} else if (action_name == "prep-action") {// The same kind of menu as a download's: what this preparation allows, then Cancel.const auto& key = selected.key;diff --git a/src/homebrew/simulation.hpp b/src/homebrew/simulation.hppindex eab3b16..6fd4545 100644--- a/src/homebrew/simulation.hpp+++ b/src/homebrew/simulation.hpp@@ -549,7 +549,8 @@ struct State {std::map<GameId, LiveCloudGame> cloud; // live: Steam Cloud save state by gamestd::map<GameId, LiveRuntimeGame> runtime_games; // live: per-game runtime statePreparationQueue preparation_queue; // live: games being prepared, waiting and done- // Queue: the section the player expanded ("downloads", "preparation"); empty until they choose.+ // Queue: the section the player expanded ("downloads", "preparation"), "none" once they closed it;+ // empty until they choose.std::string queue_expanded;std::size_t runtime_leftover_requests = 0; // live: unused settings requests to clean upLiveKitInfo kit; // live: the compatibility kit in usediff --git a/tests/homebrew_library_model_test.cpp b/tests/homebrew_library_model_test.cppindex e52a7e8..34e81d8 100644--- a/tests/homebrew_library_model_test.cpp+++ b/tests/homebrew_library_model_test.cpp@@ -2334,6 +2334,17 @@ void live_queue_shows_downloads_and_preparations() {"Down from the last download reaches the Preparation heading");check(has_row(model, "job-21") && !has_row(model, "prep-11"), "moving onto the other heading doesn't open it");+ activate(model, "queue-downloads");+ check((queue_keys(model) == std::vector<std::string>{"queue-downloads", "job-20", "queue-preparation", "prep-active-10"}),+ "the open section's heading closes it, both keeping their cards");+ check(model.state().navigation.focus_key == "queue-downloads", "focus stays on the heading");+ check(queue_row(model, "queue-downloads")->value == "2 more games queued · 1 completed", "closed Downloads counts");+ model.UpdateInstalls({{SteamId(20), JobState::Downloading, 80, 100, {}}, {SteamId(21), JobState::Queued, 0, 100, {}},+ {SteamId(22), JobState::Queued, 0, 100, {}}},+ {{SteamId(10), 1, "internal", true}, {SteamId(11), 1, "internal", true}, {SteamId(12), 1, "internal", true},+ {SteamId(13), 1, "internal", true}, {SteamId(14), 1, "internal", true}, {SteamId(23), 1, "internal", true}},+ {{SteamId(23), 1, "internal", 1'000}});+ check(!has_row(model, "job-21") && !has_row(model, "prep-11"), "both stay closed while the queues change");activate(model, "queue-preparation");activate(model, "prep-11");check(!has_row(model, "prep-next-11") && has_row(model, "prep-open-11"), "the game up next has no Prepare next");@@ -2386,7 +2397,7 @@ void live_queue_history_and_empty_states() {check(model.TakePreparedClear() && model.TakeInstallRequests().empty(), "Clear completed clears only preparations");// Games waiting with none being prepared (Steam details still on their way) still count when collapsed.model.UpdatePreparationQueue({std::nullopt, {SteamId(14)}, {{SteamId(15), 4'000}}, {}});- activate(model, "queue-downloads");+ check(model.state().queue_expanded == "downloads", "focus left on a download keeps Downloads open");check(queue_row(model, "queue-preparation")->value == "1 waiting · 1 completed", "a collapsed section counts what waits");model.UpdatePreparationQueue({});check(!has_row(model, "queue-preparation") && has_row(model, "job-23"), "Preparation empties; Downloads keeps its entry");