Play your Steam library's Windows games on a jailbroken PS5.
C++
Follow uninstalls in the Queue tab
Leonardo Lobatod8d639499b92
diff --git a/src/homebrew/controller.cpp b/src/homebrew/controller.cppindex e9941c9..15985c4 100644--- a/src/homebrew/controller.cpp+++ b/src/homebrew/controller.cpp@@ -1167,6 +1167,9 @@ void Controller::TickRuntime() {if (const auto id = GameIn(snapshot, app); game_roots_.count(id) && queue.active != id &&std::find(queue.waiting.begin(), queue.waiting.end(), id) == queue.waiting.end())queue.refused[id] = refusal;+ // Uninstalls in the order they run; only those at work say their step.+ for (const auto id : uninstalls_.Active())+ queue.uninstalls.push_back({id, uninstalls_.Started(id) ? UninstallStatus(id) : std::string()});model_.UpdatePreparationQueue(std::move(queue));}if (snapshot.revision == runtime_revision_ && install_revision_ == runtime_install_revision_ &&@@ -1503,7 +1506,10 @@ void Controller::TickUninstalls() {++play_notes_revision_;break;case UninstallAction::Kind::kStop: StopUninstall(id, action.reason); break;- case UninstallAction::Kind::kFinished: ++play_notes_revision_; break;+ case UninstallAction::Kind::kFinished:+ model_.NotifyUninstallFinished(id);+ ++play_notes_revision_;+ break;}}project();diff --git a/src/homebrew/queue_layout.cpp b/src/homebrew/queue_layout.cppindex ef67f75..991df73 100644--- a/src/homebrew/queue_layout.cpp+++ b/src/homebrew/queue_layout.cpp@@ -1,4 +1,4 @@-// queue_layout.cpp - What the Queue screen shows: downloads and preparations, each section's rows and counts.+// queue_layout.cpp - What the Queue screen shows: downloads, and preparations and uninstalls, each section's rows and counts.// Copyright (c) 2026 Playden contributors// SPDX-License-Identifier: MIT#include "homebrew/queue_layout.hpp"@@ -105,6 +105,32 @@ QueueSection preparations(const State& state) {section.active = item;section.running = 1;}+ // Uninstalls run apart from preparations, first in, first out. The first at work takes the card when+ // no preparation does; the others at work come first after it, and those waiting after the waiting+ // preparations. They are not numbered: their order is not the preparation queue's.+ std::vector<QueueEntry> uninstalls_running, uninstalls_waiting;+ for (const auto& uninstall : queue.uninstalls) {+ QueueEntry item;+ item.key = "prep-unin-" + ToKey(uninstall.game_id);+ item.game_id = uninstall.game_id;+ item.title = game_title(state, uninstall.game_id);+ item.uninstall = true;+ if (uninstall.step.empty()) {+ item.status = "Waiting to uninstall";+ item.tone = "quiet";+ uninstalls_waiting.push_back(std::move(item));+ ++section.waiting;+ continue;+ }+ item.status = "Uninstalling";+ item.note = uninstall.step;+ item.tone = "busy";+ ++section.running;+ ++section.uninstalling;+ if (!section.active) section.active = std::move(item);+ else uninstalls_running.push_back(std::move(item));+ }+ section.rows = std::move(uninstalls_running);int position = 0;for (const auto id : queue.waiting) {if (queue.active && id == *queue.active) continue;@@ -120,9 +146,14 @@ QueueSection preparations(const State& state) {section.rows.push_back(std::move(item));++section.waiting;}- // Games whose preparation needs the player: it failed, stopped part way or waits for the PS5.+ for (auto& item : uninstalls_waiting) section.rows.push_back(std::move(item));+ // Games whose preparation needs the player: it failed, stopped part way or waits for the PS5. A game+ // being uninstalled is listed as such only.+ const auto uninstalling = [&queue](GameId id) {+ return std::any_of(queue.uninstalls.begin(), queue.uninstalls.end(), [id](const LiveUninstall& item) { return item.game_id == id; });+ };const auto listed = [&](GameId id) {- return (queue.active && *queue.active == id) ||+ return (queue.active && *queue.active == id) || uninstalling(id) ||std::find(queue.waiting.begin(), queue.waiting.end(), id) != queue.waiting.end();};for (const auto& [id, game] : state.runtime_games) {@@ -154,6 +185,22 @@ QueueSection preparations(const State& state) {section.rows.push_back(std::move(item));++section.attention;}+ // Uninstalls that stopped: the reason, until the game goes again or the player dismisses it.+ for (const auto& ended : state.ended_uninstalls) {+ if (ended.stopped.empty() || uninstalling(ended.game_id)) continue;+ QueueEntry item;+ item.key = "prep-unin-attn-" + ToKey(ended.game_id);+ item.game_id = ended.game_id;+ item.title = !ended.title.empty() ? ended.title : game_title(state, ended.game_id);+ item.status = "Uninstall stopped";+ item.note = ended.stopped;+ item.tone = "attention";+ item.uninstall = true;+ section.rows.push_back(std::move(item));+ ++section.attention;+ }+ // Finished preparations and uninstalls together, newest first.+ std::vector<QueueEntry> finished;for (const auto& done : queue.completed) {QueueEntry item;item.key = "prep-done-" + ToKey(done.game_id) + "-" + std::to_string(done.finished_at);@@ -163,9 +210,25 @@ QueueSection preparations(const State& state) {item.tone = "good";item.completed = true;item.finished_at = done.finished_at;- section.rows.push_back(std::move(item));- ++section.completed;+ finished.push_back(std::move(item));+ }+ for (const auto& ended : state.ended_uninstalls) {+ if (!ended.stopped.empty()) continue;+ QueueEntry item;+ item.key = "prep-unin-done-" + ToKey(ended.game_id) + "-" + std::to_string(ended.finished_at);+ item.game_id = ended.game_id;+ item.title = !ended.title.empty() ? ended.title : game_title(state, ended.game_id);+ item.status = "Uninstalled";+ item.tone = "good";+ item.uninstall = true;+ item.completed = true;+ item.finished_at = ended.finished_at;+ finished.push_back(std::move(item));}+ std::stable_sort(finished.begin(), finished.end(),+ [](const QueueEntry& left, const QueueEntry& right) { return left.finished_at > right.finished_at; });+ section.completed = finished.size();+ for (auto& item : finished) section.rows.push_back(std::move(item));return section;}@@ -176,7 +239,8 @@ void summarize(QueueSection& section, const std::string& expanded_words, const sstd::string text;// Games after the card waiting their turn; what needs the player is counted apart.const std::size_t more = static_cast<std::size_t>(std::count_if(section.rows.begin(), section.rows.end(), [](const QueueEntry& row) {- return row.job ? row.job->state == JobState::Queued || running(*row.job) : row.position > 0;+ if (row.job) return row.job->state == JobState::Queued || running(*row.job);+ return row.position > 0 || (row.uninstall && !row.completed && row.tone != "attention");}));if (section.expanded) {text = expanded_words;@@ -195,6 +259,14 @@ void summarize(QueueSection& section, const std::string& expanded_words, const s}} // namespace+std::size_t QueuePending(const State& state) {+ auto pending = static_cast<std::size_t>(std::count_if(state.jobs.begin(), state.jobs.end(), [](const Job& job) {+ return job.state != JobState::Cancelled && job.state != JobState::Downloaded && job.stage != JobStage::Uninstall;+ }));+ const auto& preparation = state.preparation_queue;+ return pending + preparation.waiting.size() + (preparation.active ? 1U : 0U) + preparation.uninstalls.size();+}+std::string QueueSectionOf(const std::string& key) {if (key == "queue-downloads" || key.rfind("job-", 0) == 0) return kQueueDownloads;if (key == "queue-preparation" || key.rfind("prep-", 0) == 0) return kQueuePreparation;@@ -234,7 +306,8 @@ QueueLayout BuildQueueLayout(const State& state) {if (failed) join(download_attention, std::to_string(failed) + " failed");summarize(download, downloads_words(download, paused, failed), download_attention, "No downloads");std::string prepare_words, prepare_attention;- if (prepare.running) join(prepare_words, "1 preparing");+ if (prepare.running > prepare.uninstalling) join(prepare_words, "1 preparing");+ if (prepare.uninstalling) join(prepare_words, std::to_string(prepare.uninstalling) + " uninstalling");if (prepare.waiting) join(prepare_words, std::to_string(prepare.waiting) + " waiting");if (prepare.attention) join(prepare_attention, need_attention(prepare.attention));join(prepare_words, prepare_attention);@@ -243,7 +316,8 @@ QueueLayout BuildQueueLayout(const State& state) {std::string summary;if (download.running > download.copying) join(summary, std::to_string(download.running - download.copying) + " downloading");if (download.copying) join(summary, std::to_string(download.copying) + " copying");- if (prepare.running) join(summary, "1 preparing");+ if (prepare.running > prepare.uninstalling) join(summary, "1 preparing");+ if (prepare.uninstalling) join(summary, std::to_string(prepare.uninstalling) + " uninstalling");if (download.waiting + prepare.waiting) join(summary, std::to_string(download.waiting + prepare.waiting) + " waiting");if (download.attention + prepare.attention)join(summary, need_attention(download.attention + prepare.attention));diff --git a/src/homebrew/queue_layout.hpp b/src/homebrew/queue_layout.hppindex a47f2be..4d1784e 100644--- a/src/homebrew/queue_layout.hpp+++ b/src/homebrew/queue_layout.hpp@@ -1,5 +1,5 @@#pragma once-// queue_layout.hpp - What the Queue screen shows: downloads and preparations, each section's rows and counts.+// queue_layout.hpp - What the Queue screen shows: downloads, and preparations and uninstalls, each section's rows and counts.// Copyright (c) 2026 Playden contributors// SPDX-License-Identifier: MIT#include "homebrew/simulation.hpp"@@ -15,16 +15,19 @@ 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.+// One game in a section. Downloads point at their job; preparations and uninstalls carry what their row says.struct QueueEntry {- std::string key; // the row's focus key: job-<id>, prep-<id>, prep-attn-<id>, prep-done-<id>-<time>+ // The row's focus key: job-<id>, prep-<id>, prep-attn-<id>, prep-done-<id>-<time>; uninstalls+ // prep-unin-<id>, prep-unin-attn-<id>, prep-unin-done-<id>-<time>.+ std::string key;GameId game_id;const Job* job = nullptr;std::string title;- std::string status; // the right-hand tag: "Up next", "Queued", "Waiting for the PS5", "Ready"+ std::string status; // the right-hand tag: "Up next", "Queued", "Waiting for the PS5", "Ready", "Uninstalling"std::string note; // beside the title: why it waits or failedstd::string tone; // good, busy, attention, problem, quietint position = 0; // waiting preparations, from 1+ bool uninstall = false;bool completed = false;std::int64_t finished_at = 0; // completed entries (Unix seconds), 0 unknown};@@ -33,12 +36,14 @@ struct QueueSection {std::string id; // kQueueDownloads or kQueuePreparationstd::string name; // "Downloads", "Preparation"// The running download or preparation, shown in the card; a paused or failed download at the front- // of the queue takes the card too, as Downloads always showed it.+ // of the queue takes the card too, as Downloads always showed it. With no preparation running, the+ // first uninstall at work takes Preparation's card.std::optional<QueueEntry> active;- // Unfinished entries after the card (waiting, then needing attention), then completed ones, newest first.+ // Unfinished entries after the card (running, waiting, then needing attention), then completed ones, newest first.std::vector<QueueEntry> rows;- std::size_t running = 0; // downloading or preparing now+ std::size_t running = 0; // downloading, preparing or uninstalling nowstd::size_t copying = 0; // of those running, imported games copied into Playden+ std::size_t uninstalling = 0; // of those running, uninstallsstd::size_t waiting = 0; // queued to run, card included when it only waitsstd::size_t attention = 0; // paused, failed or blocked: not ordinary waiting workstd::size_t completed = 0;@@ -61,6 +66,8 @@ struct QueueLayout {// 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 Queue tab's badge: unfinished downloads, and preparations and uninstalls running or waiting.+std::size_t QueuePending(const State& state);// The section a Queue focus key belongs to (a heading, card or row); empty for other keys.std::string QueueSectionOf(const std::string& key);} // namespace playden::homebrewdiff --git a/src/homebrew/simulation.cpp b/src/homebrew/simulation.cppindex d9c009f..01e43f4 100644--- a/src/homebrew/simulation.cpp+++ b/src/homebrew/simulation.cpp@@ -471,7 +471,7 @@ std::string action_label(const std::string& key) {{"cloud-use-local", "Use console saves"}, {"cloud-confirm-account", "Use this account"},{"cloud-confirm-account-all", "Upload all"},{"saves-delete-confirm", "Delete saves"}, {"manage-saves", "Manage saves"}, {"saves-leftover-confirm", "Remove"}, {"saves-quit-anyway", "Play without syncing"},- {"install-confirm", "Install"}, {"storage-picker", "Change storage"}, {"installed-close", "Close"}, {"installed-show-all", "Show all games"},+ {"install-confirm", "Install"}, {"storage-picker", "Change storage"}, {"installed-close", "Close"},{"value-edit", "Edit…"}, {"value-reset", "Reset to recipe"}, {"override-add", "Add an override…"},{"unlock-setting", "Change anyway"}, {"export-recipe", "Export as recipe"}, {"program-scan", "Looking for programs…"},{"preset-picker", "Preset"}, {"game-settings", "Game settings"}, {"game-maintenance", "Maintenance"}, {"runtime-check-again", "Check again"}, {"reset-settings", "Reset all to preset"}, {"clear-shader-cache", "Clear shader cache"},@@ -506,7 +506,8 @@ std::string action_label(const std::string& key) {{"job-pause-", "Pause download"}, {"job-resume-", "Resume download"}, {"job-retry-", "Retry download"},{"job-cancel-", "Cancel download"}, {"job-now-", "Download now"}, {"job-up-", "Move up"}, {"job-down-", "Move down"},{"job-open-", "Open game"}, {"job-dismiss-", "Dismiss"}, {"prep-next-", "Prepare next"},- {"prep-open-", "Game details"}, {"prep-retry-", "Try again"}, {"prep-dismiss-", "Dismiss"}})+ {"prep-open-", "Game details"}, {"prep-retry-", "Try again"}, {"prep-dismiss-", "Dismiss"},+ {"uninstall-dismiss-", "Dismiss"}})if (key.rfind(prefix, 0) == 0) return label;std::string title = key;std::replace(title.begin(), title.end(), '-', ' ');@@ -1296,21 +1297,9 @@ std::string Simulation::installed_blocker(GameId id) const {return {};}-bool Simulation::uninstall_batch_done() const {- return uninstall_batch_ && uninstall_batch_->uninstalled.size() + uninstall_batch_->stopped.size() >= uninstall_batch_->ids.size();-}--// The list: Sort and Select all, the games, then the footer's Uninstall selected and Close. While-// a batch runs it lists only the batch's games, with Close (and Show all games once all are done).+// The list: Sort and Select all, the games, then the footer's Uninstall selected and Close.std::vector<std::string> Simulation::installed_manager_actions() const {- std::vector<std::string> actions;- if (uninstall_batch_) {- for (const auto id : uninstall_batch_->ids) actions.push_back("installed-step-" + ToKey(id));- if (uninstall_batch_done()) actions.push_back("installed-show-all");- actions.push_back("installed-close");- return actions;- }- actions = {"installed-sort", "installed-select-all"};+ std::vector<std::string> actions = {"installed-sort", "installed-select-all"};for (const auto id : installed_list()) actions.push_back("installed-toggle-" + ToKey(id));actions.push_back("installed-selection-uninstall");actions.push_back("installed-close");@@ -1320,7 +1309,7 @@ std::vector<std::string> Simulation::installed_manager_actions() const {// Where a key of the Installed games list sits: 0 Sort and Select all, 1 the games, 2 the footer.static int installed_part(const std::string& key) {if (key == "installed-sort" || key == "installed-select-all") return 0;- if (key.rfind("installed-toggle-", 0) == 0 || key.rfind("installed-step-", 0) == 0) return 1;+ if (key.rfind("installed-toggle-", 0) == 0) return 1;return 2;}@@ -1362,7 +1351,7 @@ void Simulation::refresh_installed_manager() {auto& modal = modals[index];if (modal.id != "installed-games") continue;auto actions = installed_manager_actions();- if (!uninstall_batch_ && actions.size() == 4) {+ if (actions.size() == 4) {if (index + 1 == modals.size()) close_modal();break;}@@ -1402,20 +1391,47 @@ std::vector<GameId> Simulation::TakeActivityRequests() {return requests;}+void Simulation::request_uninstall(GameId id, bool delete_saves, bool batch) {+ pending_install_requests_.push_back({InstallRequestKind::Uninstall, id, {}, delete_saves});+ pending_uninstalls_.insert(id);+ if (const auto* game = find_game(state_, id); game && !game->title.empty()) uninstall_titles_[id] = game->title;+ // Asked again: an earlier stop no longer applies.+ std::erase_if(state_.ended_uninstalls, [id](const EndedUninstall& ended) { return ended.game_id == id && !ended.stopped.empty(); });+ if (batch) batch_uninstalls_.insert(id);+ else batch_uninstalls_.erase(id);+}++// Queue keeps how this session's uninstalls ended, newest first: a game's latest stop, and every finish.+void Simulation::end_uninstall(GameId id, const std::string& stopped) {+ auto& ended = state_.ended_uninstalls;+ std::erase_if(ended, [id](const EndedUninstall& entry) { return entry.game_id == id && !entry.stopped.empty(); });+ std::string title;+ if (const auto* game = find_game(state_, id); game && !game->title.empty()) title = game->title;+ else if (const auto known = uninstall_titles_.find(id); known != uninstall_titles_.end()) title = known->second;+ ended.insert(ended.begin(), {id, std::move(title), stopped, state_.clock_ticks});+ uninstall_titles_.erase(id);+ pending_uninstalls_.erase(id);+}++const EndedUninstall* Simulation::uninstall_stop(GameId id) const {+ for (const auto& ended : state_.ended_uninstalls)+ if (ended.game_id == id && !ended.stopped.empty()) return &ended;+ return nullptr;+}+void Simulation::NotifyUninstallStopped(GameId id, const std::string& reason) {- // A game the open Installed games list uninstalls says why in its row instead.- if (uninstall_batch_ && installed_list_open() &&- std::find(uninstall_batch_->ids.begin(), uninstall_batch_->ids.end(), id) != uninstall_batch_->ids.end()) {- uninstall_batch_->stopped[id] = reason;- pending_uninstalls_.erase(id);- refresh_installed_manager();- rebuild_view();- return;- }+ end_uninstall(id, reason);const auto* game = find_game(state_, id);- push_notice({"uninstall-" + ToKey(id), "Uninstall stopped", "", false, kLiveNoticeSeconds * 2, true,- (game ? game->title : std::string("A game")) + " · " + reason});- pending_uninstalls_.erase(id);+ const auto text = (game ? game->title : std::string("A game")) + " · " + reason;+ // A game of a batch is followed in Queue, which keeps the reason: a corner notice is enough there.+ const bool batch = batch_uninstalls_.erase(id) > 0;+ push_notice({"uninstall-" + ToKey(id), "Uninstall stopped", "", false, kLiveNoticeSeconds * 2, true, text, !batch});+ rebuild_view();+}++void Simulation::NotifyUninstallFinished(GameId id) {+ end_uninstall(id, {});+ batch_uninstalls_.erase(id);rebuild_view();}@@ -1449,6 +1465,10 @@ void Simulation::UpdatePreparationQueue(PreparationQueue queue) {if (found == queue.waiting.end() || found == queue.waiting.begin()) prepare_next_asked_.reset();else std::rotate(queue.waiting.begin(), found, found + 1);}+ // Uninstalled games may leave the library (imported ones): their names are kept for Queue.+ for (const auto& uninstall : queue.uninstalls)+ if (const auto* game = find_game(state_, uninstall.game_id); game && !game->title.empty())+ uninstall_titles_[uninstall.game_id] = game->title;if (queue == state_.preparation_queue) return;state_.preparation_queue = std::move(queue);rebuild_view();@@ -1890,15 +1910,10 @@ void Simulation::UpdateInstalls(const std::vector<LiveInstallJob>& jobs, const spush_notice({"install-" + ToKey(job.game_id), "Download failed", "", false, kLiveNoticeSeconds * 2, true,title(job.game_id) + (job.failure.empty() ? std::string() : " · " + job.failure), false});}- const bool batch_open = uninstall_batch_ && installed_list_open();for (const auto id : live_installed_ids_) {if (installed_ids.contains(id) || job_states.contains(id) || !pending_uninstalls_.contains(id)) continue;- // The open Installed games list says so in the game's row.- if (batch_open && std::find(uninstall_batch_->ids.begin(), uninstall_batch_->ids.end(), id) != uninstall_batch_->ids.end()) {- uninstall_batch_->stopped.erase(id);- uninstall_batch_->uninstalled.insert(id);- continue;- }+ // A batch's games are followed in Queue instead.+ if (batch_uninstalls_.contains(id)) continue;push_notice({"install-" + ToKey(id), "Game uninstalled", "", false, kLiveNoticeSeconds, false, title(id)});}}@@ -3538,17 +3553,10 @@ std::vector<const Game*> Simulation::visible_games() const {return filtered_games(state_);}-bool Simulation::installed_list_open() const {- return std::any_of(state_.navigation.modals.begin(), state_.navigation.modals.end(),- [](const ModalEntry& modal) { return modal.id == "installed-games"; });-}-void Simulation::rebuild_view() {// The Library left for another tab: the order "More" showed ends with that visit.if (state_.navigation.route != Route::Library && state_.navigation.route != Route::Details)state_.library.view_sort.clear();- // An uninstall batch lives while its list is open; later stops are notices again.- if (!rebuilding_overlay_ && uninstall_batch_ && !installed_list_open()) uninstall_batch_.reset();const bool has_overlay = state_.editor.active || !state_.navigation.modals.empty();if (has_overlay) {// Only the flag is set aside: a copy of the editor would keep a password in memory.@@ -3684,31 +3692,13 @@ void Simulation::rebuild_view() {view_.subtitle = "For this game only." + (fallback ? " Other games still install to " + fallback->label + "." : std::string());}if (modal.id == "installed-games") {- if (!uninstall_batch_) {- view_.subtitle = !installed_message_.empty() ? installed_message_- : "Choose games to uninstall. Their saves and settings are kept unless you choose to delete them.";- std::uint64_t bytes = 0;- for (const auto& installation : state_.installations)- if (installed_selected_.contains(installation.game_id)) bytes += installation.installed_bytes;- view_.footer = installed_selected_.empty() ? std::string("Select games to uninstall")- : std::to_string(installed_selected_.size()) + " selected · " + format_bytes(bytes);- } else {- view_.subtitle = uninstall_batch_done() ? "Finished uninstalling." : "Uninstalling the selected games.";- const auto& batch = *uninstall_batch_;- const auto ended = batch.uninstalled.size() + batch.stopped.size();- if (ended < batch.ids.size()) {- view_.footer = "Uninstalling " + std::to_string(ended + 1) + " of " + std::to_string(batch.ids.size()) + "…";- } else {- std::uint64_t freed = 0;- for (const auto id : batch.uninstalled) freed += batch.bytes.at(id);- std::vector<std::string> parts;- if (!batch.uninstalled.empty())- parts.push_back(std::to_string(batch.uninstalled.size()) + " uninstalled" +- (freed > 0 ? " · about " + format_bytes(freed) + " freed" : std::string()));- if (!batch.stopped.empty()) parts.push_back(std::to_string(batch.stopped.size()) + " stopped");- for (const auto& part : parts) view_.footer += (view_.footer.empty() ? "" : " · ") + part;- }- }+ view_.subtitle = !installed_message_.empty() ? installed_message_+ : "Choose games to uninstall. Their saves and settings are kept unless you choose to delete them.";+ std::uint64_t bytes = 0;+ for (const auto& installation : state_.installations)+ if (installed_selected_.contains(installation.game_id)) bytes += installation.installed_bytes;+ view_.footer = installed_selected_.empty() ? std::string("Select games to uninstall")+ : std::to_string(installed_selected_.size()) + " selected · " + format_bytes(bytes);}if (modal.id == "import-games")view_.subtitle = state_.import_candidates.empty() ? kImportEmptyText@@ -4069,13 +4059,12 @@ void Simulation::rebuild_view() {item.selected = installed_selected_.contains(id);item.value = installation ? format_bytes(installation->installed_bytes) : std::string();const auto blocker = installed_blocker(id);- const auto stopped = installed_stops_.find(id);if (!blocker.empty()) {item.subtitle = blocker;item.enabled = false;- } else if (stopped != installed_stops_.end()) {- // Stopped in the batch just shown: the reason stays until the list closes.- item.subtitle = "Stopped: " + stopped->second;+ } else if (const auto* stopped = uninstall_stop(id)) {+ // Its uninstall stopped: the reason stays until it goes again or is dismissed in Queue.+ item.subtitle = "Stopped: " + stopped->stopped;item.tone = "problem";} else {const auto when = game && game->last_played ? time_ago(state_.clock_ticks, *game->last_played) : std::string();@@ -4088,28 +4077,6 @@ void Simulation::rebuild_view() {item.subtitle = volume->label + " · " + item.subtitle;}}- else if (action_key.rfind("installed-step-", 0) == 0 && uninstall_batch_) {- // A game of the running batch: how far its uninstall is, then how it ended.- const auto id = key_id(std::string_view(action_key).substr(15));- const auto* game = find_game(state_, id);- const auto& batch = *uninstall_batch_;- item.kind = RowKind::Status;- item.game_id = id;- item.title = game && !game->title.empty() ? game->title : "Steam app " + ToKey(id);- item.value = format_bytes(batch.bytes.count(id) ? batch.bytes.at(id) : 0);- const auto runtime = state_.runtime_games.find(id);- if (batch.uninstalled.contains(id)) {- item.subtitle = "Uninstalled";- item.tone = "good";- } else if (const auto stopped = batch.stopped.find(id); stopped != batch.stopped.end()) {- item.subtitle = "Stopped: " + stopped->second;- item.tone = "problem";- } else if (runtime != state_.runtime_games.end() && !runtime->second.uninstall_status.empty()) {- item.subtitle = runtime->second.uninstall_status;- } else {- item.subtitle = "Waiting";- }- }else if (action_key == "installed-selection-uninstall") {item.title = "Uninstall selected";item.dangerous = true;@@ -4328,11 +4295,7 @@ void Simulation::rebuild_view() {else if (modal.id == "import-programs" || modal.id == "import-choice") view_.legends = {"Cross Select", "Circle Back"};else if (modal.id == "steam-programs") view_.legends = {"Cross Choose", "Circle Cancel"};else if (modal.id == "import-storage") view_.legends = {"Cross Import here", "Circle Back"};- else if (modal.id == "installed-games")- // The batch's rows only report; Cross does something only on its buttons.- view_.legends = !uninstall_batch_ ? std::vector<std::string>{"Cross Select", "Triangle Uninstall", "Circle Close"}- : installed_part(state_.navigation.focus_key) == 2 ? std::vector<std::string>{"Cross Choose", "Circle Close"}- : std::vector<std::string>{"Circle Close"};+ else if (modal.id == "installed-games") view_.legends = {"Cross Select", "Triangle Uninstall", "Circle Close"};else if (!modal.setting_id.empty()) view_.legends = {"Cross Select", "Triangle Reset", "L1/R1 Jump", "Circle Back"};} else if (state_.navigation.route == Route::Startup && state_.root_access_missing) {if (state_.root_access_granted) {@@ -6261,9 +6224,26 @@ void Simulation::activate() {const auto& key = selected.key;const auto id = ToKey(selected.game_id);std::vector<std::string> actions;- if (key.rfind("prep-done-", 0) == 0) {+ std::string title = "Preparation actions";+ // Clear completed is offered with more than one finished preparation or uninstall.+ const auto completed_count = [this] {+ return state_.preparation_queue.completed.size() ++ static_cast<std::size_t>(std::count_if(state_.ended_uninstalls.begin(), state_.ended_uninstalls.end(),+ [](const EndedUninstall& ended) { return ended.stopped.empty(); }));+ };+ if (key.rfind("prep-unin-", 0) == 0) {+ // An uninstall: its game's page while the library has it; one that ended leaves the list.+ if (find_game(state_, selected.game_id)) actions.push_back("prep-open-" + id);+ if (key.rfind("prep-unin-done-", 0) == 0) {+ actions.push_back("uninstall-dismiss-" + key.substr(std::strlen("prep-unin-done-")));+ } else if (const auto* stopped = uninstall_stop(selected.game_id); stopped && key.rfind("prep-unin-attn-", 0) == 0) {+ actions.push_back("uninstall-dismiss-" + id + "-" + std::to_string(stopped->finished_at));+ }+ if (key.rfind("prep-unin-done-", 0) == 0 && completed_count() > 1) actions.push_back("prep-clear-completed");+ title = "Uninstall actions";+ } else if (key.rfind("prep-done-", 0) == 0) {actions = {"prep-open-" + id, "prep-dismiss-" + key.substr(std::strlen("prep-done-"))};- if (state_.preparation_queue.completed.size() > 1) actions.push_back("prep-clear-completed");+ if (completed_count() > 1) actions.push_back("prep-clear-completed");} else if (key.rfind("prep-attn-", 0) == 0) {const auto runtime = state_.runtime_games.find(selected.game_id);if (runtime != state_.runtime_games.end() && runtime->second.can_prepare && !runtime->second.awaiting_registration)@@ -6278,7 +6258,7 @@ void Simulation::activate() {actions.push_back("prep-open-" + id);}actions.push_back("cancel");- open_modal({"prep-actions", "Preparation actions", key, std::move(actions), 0, false});+ open_modal({"prep-actions", std::move(title), key, std::move(actions), 0, false});} else if (action_name == "storage-details") {open_modal({"storage-details", selected.title, selected.key, {"storage-close"}, 0, false});} else if (action_name == "storage-close") {@@ -6305,12 +6285,22 @@ void Simulation::activate() {pending_prepared_dismissals_.push_back(done);prepared_dismissed_.push_back(done);std::erase(state_.preparation_queue.completed, done);+ } else if (action_name.rfind("uninstall-dismiss-", 0) == 0) {+ // uninstall-dismiss-<game>-<time>: that ended uninstall leaves Queue.+ const auto rest = action_name.substr(std::strlen("uninstall-dismiss-"));+ const auto dash = rest.rfind('-');+ const auto id = key_id(std::string_view(rest).substr(0, dash));+ const std::int64_t at = dash == std::string::npos ? 0 : std::strtoll(rest.c_str() + dash + 1, nullptr, 10);+ close_modal();+ std::erase_if(state_.ended_uninstalls, [&](const EndedUninstall& ended) { return ended.game_id == id && ended.finished_at == at; });} else if (action_name == "prep-clear-completed") {close_modal();pending_prepared_clear_ = true;auto& completed = state_.preparation_queue.completed;prepared_dismissed_.insert(prepared_dismissed_.end(), completed.begin(), completed.end());completed.clear();+ // Finished uninstalls go too; stopped ones still need the player.+ std::erase_if(state_.ended_uninstalls, [](const EndedUninstall& ended) { return ended.stopped.empty(); });} else if (action_name == "saves-filter") {state_.navigation.saves_filter = std::clamp(std::atoi(selected.key.c_str() + std::strlen("saves-filter-")), 0,static_cast<int>(kSavesFilters.size()) - 1);@@ -6434,10 +6424,7 @@ void Simulation::activate() {} else if (live() && action_name == "runtime-remove-retry") {// Continues the saved removal (with its first choice about saves), then removes the download.const auto id = state_.navigation.detail_id.value_or(state_.navigation.selected_game_id);- if (id.valid()) {- pending_install_requests_.push_back({InstallRequestKind::Uninstall, id, {}, false});- pending_uninstalls_.insert(id);- }+ if (id.valid()) request_uninstall(id, false, false);} else if (live() && action_name == "runtime-cleanup") {// Deleting data asks first, as the row's disclosure promises.const auto count = state_.runtime_leftover_requests;@@ -6669,28 +6656,13 @@ void Simulation::activate() {} else if (live() && action_name == "installed-manage") {if (state_.installations.empty()) return;installed_selected_.clear();- uninstall_batch_.reset();installed_message_.clear();- installed_stops_.clear();installed_list_focus_.clear();auto actions = installed_manager_actions();// Focus starts on the first game; Sort and Select all are above it.open_modal({"installed-games", "Installed games", state_.navigation.focus_key, std::move(actions), 2, false});} else if (action_name == "installed-close") {close_modal();- } else if (live() && action_name == "installed-show-all") {- // The finished batch gives way to the list of what is installed now; a stopped game keeps- // its reason there and can be chosen again.- if (uninstall_batch_) installed_stops_ = uninstall_batch_->stopped;- uninstall_batch_.reset();- refresh_installed_manager();- if (!state_.navigation.modals.empty() && state_.navigation.modals.back().id == "installed-games") {- auto& list = state_.navigation.modals.back();- const auto game = std::find_if(list.action_keys.begin(), list.action_keys.end(),- [](const std::string& key) { return key.rfind("installed-toggle-", 0) == 0; });- list.focused_action = game == list.action_keys.end() ? 0 : static_cast<int>(game - list.action_keys.begin());- state_.navigation.focus_key = list.action_keys[static_cast<std::size_t>(list.focused_action)];- }} else if (live() && action_name == "installed-sort") {installed_by_played_ = !installed_by_played_;refresh_installed_manager();@@ -6737,41 +6709,34 @@ void Simulation::activate() {: all_steam ? "Their files are removed from this console. You can install them again from Steam.": "Their files are removed from this console.";if (any_cloud && state_.cloud_saves_auto)- confirmation.body += " Steam Cloud saves are synced first. If that fails for a game, that game stays installed and its row says why.";+ confirmation.body += " Steam Cloud saves are synced first. If that fails for a game, that game stays installed and Queue says why.";else if (any_cloud)confirmation.body += " Automatic Cloud sync is off, so their saves are not synced first.";open_modal(std::move(confirmation));} else if (action_name == "confirm-destructive" && live() && pending_destructive_action_ == "installed-selection-uninstall") {- GameId first;+ // In the list's order (its current sort), which is the order they run in.+ std::vector<GameId> started;installed_message_.clear();for (const auto id : installed_list()) {- if (!installed_selected_.contains(id) || !installed_blocker(id).empty()) continue;- const auto* installation = find_installation(state_, id);- if (!installation) continue;- if (!uninstall_batch_) uninstall_batch_.emplace();- auto& batch = *uninstall_batch_;- pending_install_requests_.push_back({InstallRequestKind::Uninstall, id, {}, uninstall_delete_saves_});- pending_uninstalls_.insert(id);- if (std::find(batch.ids.begin(), batch.ids.end(), id) == batch.ids.end()) batch.ids.push_back(id);- batch.bytes[id] = installation->installed_bytes;- batch.stopped.erase(id);- installed_stops_.erase(id);- if (!first.valid()) first = id;- }- // Every checked game started running or downloading while the dialog was open.- if (!first.valid()) installed_message_ = "None of the selected games can be uninstalled now.";+ if (!installed_selected_.contains(id) || !installed_blocker(id).empty() || !find_installation(state_, id)) continue;+ request_uninstall(id, uninstall_delete_saves_, true);+ started.push_back(id);+ }installed_selected_.clear();uninstall_delete_saves_ = false;pending_destructive_action_.clear();- close_modal(); // back to the list, which shows how each game goes- refresh_installed_manager();- if (first.valid() && !state_.navigation.modals.empty() && state_.navigation.modals.back().id == "installed-games") {- auto& list = state_.navigation.modals.back();- const auto found = std::find(list.action_keys.begin(), list.action_keys.end(), "installed-step-" + ToKey(first));- if (found != list.action_keys.end()) {- list.focused_action = static_cast<int>(found - list.action_keys.begin());- state_.navigation.focus_key = *found;- }+ if (started.empty()) {+ // Every checked game started running or downloading while the dialog was open.+ installed_message_ = "None of the selected games can be uninstalled now.";+ close_modal(); // back to the list, which says so+ refresh_installed_manager();+ } else {+ // Queue follows the uninstalls: the list closes, back to Settings.+ state_.navigation.focus_key = state_.navigation.modals.front().opener_focus_key;+ state_.navigation.modals.clear();+ const auto* game = started.size() == 1 ? find_game(state_, started.front()) : nullptr;+ push_notice({"uninstall-batch", "Uninstalling " + (game && !game->title.empty() ? game->title : kept_count(started.size())),+ "", false, kLiveNoticeSeconds, false, started.size() == 1 ? "Follow it in Queue" : "Follow them in Queue"});}} else if (action_name == "import-manage") {open_import_sheet();@@ -6923,9 +6888,7 @@ void Simulation::activate() {} else if (action_name == "confirm-destructive" && live() &&(pending_destructive_action_.rfind("job-cancel-", 0) == 0 || pending_destructive_action_ == "uninstall")) {if (pending_destructive_action_ == "uninstall") {- pending_install_requests_.push_back({InstallRequestKind::Uninstall, state_.navigation.selected_game_id, {},- uninstall_delete_saves_});- pending_uninstalls_.insert(state_.navigation.selected_game_id);+ request_uninstall(state_.navigation.selected_game_id, uninstall_delete_saves_, false);uninstall_delete_saves_ = false;} else if (const auto* job = find_job(state_, pending_destructive_action_.substr(11))) {pending_install_requests_.push_back({InstallRequestKind::Cancel, job->game_id});diff --git a/src/homebrew/simulation.hpp b/src/homebrew/simulation.hppindex 25fdc6e..5407bda 100644--- a/src/homebrew/simulation.hpp+++ b/src/homebrew/simulation.hpp@@ -191,6 +191,20 @@ struct LiveCompletedPreparation {std::int64_t finished_at = 0; // Unix secondsbool operator==(const LiveCompletedPreparation&) const = default;};+// An uninstall that runs or waits its turn, listed in Queue's Preparation section.+struct LiveUninstall {+ GameId game_id;+ std::string step; // what it does now, e.g. "Removing PS5 title…"; empty while it waits its turn+ bool operator==(const LiveUninstall&) const = default;+};+// An uninstall that ended this session: uninstalled, or stopped with the reason.+struct EndedUninstall {+ GameId game_id;+ std::string title; // kept: an imported game leaves the library once it is uninstalled+ std::string stopped; // why it stopped; empty once uninstalled+ std::int64_t finished_at = 0; // Unix seconds, 0 unknown+ bool operator==(const EndedUninstall&) const = default;+};// Live: the runtime's preparation queue, for Queue's Preparation section.struct PreparationQueue {std::optional<GameId> active; // being prepared now@@ -198,6 +212,7 @@ struct PreparationQueue {std::vector<LiveCompletedPreparation> completed; // newest first// Why the latest preparation of a game that is neither prepared nor waiting was refused.std::map<GameId, std::string> refused;+ std::vector<LiveUninstall> uninstalls; // in the order they were asked forbool operator==(const PreparationQueue&) const = default;};// Saves and settings kept from an uninstalled game (its private bottle).@@ -561,6 +576,7 @@ 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+ std::vector<EndedUninstall> ended_uninstalls; // live: this session's, newest first; one stop per game// Queue: the section the player expanded ("downloads", "preparation"), "none" once they closed it;// empty until they choose.std::string queue_expanded;@@ -744,6 +760,8 @@ public:[[nodiscard]] std::vector<std::pair<GameId, MaintenanceKind>> TakeMaintenanceRequests();[[nodiscard]] std::vector<GameId> TakeActivityRequests();void NotifyUninstallStopped(GameId id, const std::string& reason);+ // The uninstall is over: the game's PS5 title and files are gone. Queue lists it as done.+ void NotifyUninstallFinished(GameId id);// Play prepared the game first and that ended without a playable title.void NotifyPlayStopped(GameId id, const std::string& reason);// A preparation the player started left the game waiting for the PS5: ask, when@@ -929,16 +947,10 @@ private:// Installed games (Settings > Storage): the checked games and the list's order.std::set<GameId> installed_selected_;bool installed_by_played_ = false; // false: largest first; true: never played, then the oldest- // The games the player uninstalled together from the list, while the list stays open: their- // size when confirmed and how each ended ("" while it runs, "Uninstalled" or the stop reason).- struct UninstallBatch {- std::vector<GameId> ids;- std::map<GameId, std::uint64_t> bytes;- std::map<GameId, std::string> stopped;- std::set<GameId> uninstalled;- };- std::optional<UninstallBatch> uninstall_batch_;- std::map<GameId, std::string> installed_stops_; // why games stopped in the batch last shown+ // Games uninstalled together from the Installed games list: Queue follows them, so they post+ // no notice of their own when they finish, and a stop is a corner notice, not a dialog.+ std::set<GameId> batch_uninstalls_;+ std::map<GameId, std::string> uninstall_titles_; // names of games being uninstalled, for once they are gonestd::string installed_list_focus_; // the game row the focus left for the footerstd::string installed_message_; // the list's note when a confirmed uninstall could not startbool rebuilding_overlay_ = false; // rebuild_view is building the screen under an open sheet@@ -1107,8 +1119,10 @@ private:[[nodiscard]] std::string installed_blocker(GameId id) const;[[nodiscard]] std::vector<std::string> installed_manager_actions() const;void refresh_installed_manager();- [[nodiscard]] bool installed_list_open() const;- [[nodiscard]] bool uninstall_batch_done() const;+ // Asks the controller to uninstall a game; batch: from the Installed games list.+ void request_uninstall(GameId id, bool delete_saves, bool batch);+ void end_uninstall(GameId id, const std::string& stopped);+ [[nodiscard]] const EndedUninstall* uninstall_stop(GameId id) const;void move_installed_manager(int delta_x, int delta_y);[[nodiscard]] std::vector<std::string> collection_sheet_actions(const std::string& sheet) const;void refresh_collection_sheets(const std::string& focus = {});diff --git a/src/homebrew/view.cpp b/src/homebrew/view.cppindex 68dda1a..94c060d 100644--- a/src/homebrew/view.cpp+++ b/src/homebrew/view.cpp@@ -825,15 +825,7 @@ class Render::Implif (current_state_->simulation_mode)pending = 1;else- {- // Unfinished downloads and preparations (the one running and those waiting).- pending = static_cast<std::size_t>(std::count_if(current_state_->jobs.begin(), current_state_->jobs.end(),- [](const Job &job) {- return job.state != JobState::Cancelled && job.state != JobState::Downloaded && job.stage != JobStage::Uninstall;- }));- const auto &preparation = current_state_->preparation_queue;- pending += preparation.waiting.size() + (preparation.active ? 1U : 0U);- }+ pending = QueuePending(*current_state_);// Saves: the games that need the player, or a spinner while a check or Sync all runs.std::size_t needs_you = 0;for (const auto &[id, cloud] : current_state_->cloud)@@ -2041,14 +2033,15 @@ class Render::Impl}else{- // Preparing: the actual step, with a spinner; no percentage or time is made up.- const float status_width = fonts_.semibold.measure("Preparing", 24.0F);+ // Preparing or uninstalling: the actual step, with a spinner; no percentage or time is made up.+ const char *label = entry->uninstall ? "Uninstalling" : "Preparing";+ const float status_width = fonts_.semibold.measure(label, 24.0F);spinner(right - status_width - 22.0F, top + 36.0F, 9.0F, kBlue);- ui::text(scene_, fonts_.semibold, "Preparing", right, top + 44.0F, 24.0F, kBlue, gfx::Align::right);+ ui::text(scene_, fonts_.semibold, label, right, top + 44.0F, 24.0F, kBlue, gfx::Align::right);ui::text(scene_, fonts_.regular, fit(fonts_.regular, entry->note.empty() ? "Starting…" : entry->note, 24.0F, 1100.0F),text_x, top + 88.0F, 24.0F, kText);- ui::text(scene_, fonts_.regular, "Setting up for this PS5", right, top + 88.0F, 21.0F, kSecondary,- gfx::Align::right);+ ui::text(scene_, fonts_.regular, entry->uninstall ? "Removing from this PS5" : "Setting up for this PS5", right,+ top + 88.0F, 21.0F, kSecondary, gfx::Align::right);}focus_ring(scene_, box, amount, true);continue;@@ -3899,7 +3892,7 @@ class Render::Implif (focused) head.focused_row = static_cast<int>(head.rows.size());head.rows.push_back(row);}- else if (row.key.rfind("installed-toggle-", 0) == 0 || row.key.rfind("installed-step-", 0) == 0)+ else if (row.key.rfind("installed-toggle-", 0) == 0){if (focused) list.focused_row = static_cast<int>(list.rows.size());list.rows.push_back(row);diff --git a/tests/homebrew_library_graphical_test.cpp b/tests/homebrew_library_graphical_test.cppindex 8e3d064..74b374b 100644--- a/tests/homebrew_library_graphical_test.cpp+++ b/tests/homebrew_library_graphical_test.cpp@@ -281,19 +281,31 @@ int main(int argc,char** argv) {assert(live.action("cross"));assert(live.action("focus:installed-toggle-43") && live.action("cross"));capture_live("installed-games.png");- // A batch: one game stops on Cloud, the other is uninstalled; the list shows how each went.+ // A batch: the list closes and Queue follows it; one game is uninstalled, the other stops on Cloud.assert(live.action("focus:installed-toggle-42") && live.action("cross"));assert(live.action("focus:installed-selection-uninstall") && live.action("cross"));capture_live("installed-games-confirm.png");assert(live.action("focus:confirm-destructive") && live.action("cross"));titled.uninstall_status="Removing PS5 title…";live.UpdateRuntime(RuntimeState::Ready, {titled, playing});- capture_live("installed-games-progress.png");+ live.UpdatePreparationQueue({std::nullopt, {}, {}, {}, {{SteamId(42), "Syncing saves…"}, {SteamId(43), ""}}});+ capture_live("installed-games-queued.png");+ live.action("l1");+ live.action("l1");+ assert(live.state().navigation.route==Route::Downloads);+ capture_live("queue-uninstalls.png");live.NotifyUninstallStopped(SteamId(43), "Cloud saves could not be synced. Fix them in Saves, then try again.");+ live.UpdatePreparationQueue({std::nullopt, {}, {}, {}, {{SteamId(42), "Removing PS5 title…"}}});+ capture_live("queue-uninstalls-stopped.png");titled.uninstall_status.clear();live.UpdateRuntime(RuntimeState::Ready, {playing});+ live.UpdatePreparationQueue({});live.UpdateInstalls({}, {{SteamId(43), 8'400'000'000ull, "internal"}, {SteamId(44), 1'200'000'000ull, "internal"}});- capture_live("installed-games-done.png");+ live.NotifyUninstallFinished(SteamId(42));+ capture_live("queue-uninstalls-done.png");+ live.action("r1");+ live.action("r1");+ assert(live.state().navigation.route==Route::Settings);// With every Storage row shown the list scrolls; back on the first row the usage card shows again.while(!live.state().navigation.modals.empty()) assert(live.action("circle"));live.SetRuntimeLeftovers(1);diff --git a/tests/homebrew_library_model_test.cpp b/tests/homebrew_library_model_test.cppindex e06f592..c42bf6f 100644--- a/tests/homebrew_library_model_test.cpp+++ b/tests/homebrew_library_model_test.cpp@@ -2,6 +2,7 @@// Copyright (c) 2026 Playden contributors// SPDX-License-Identifier: MIT+#include "homebrew/queue_layout.hpp"#include "homebrew/simulation.hpp"#include "homebrew/store_art.hpp"@@ -1290,8 +1291,8 @@ void live_storage_section_and_installed_games() {const auto& confirm = model.state().navigation.modals.back();check(confirm.destructive && confirm.title == "Uninstall 3 games?", "the confirmation counts the games");check(confirm.body.find("Beta, Alpha and Gamma. Frees about 30.0 GB.") == 0, "it names them and the space freed");- check(confirm.body.find("Steam Cloud saves are synced first. If that fails for a game, that game stays installed and its "- "row says why.") != std::string::npos, "Cloud is synced first, and a failure keeps that game");+ check(confirm.body.find("Steam Cloud saves are synced first. If that fails for a game, that game stays installed and Queue "+ "says why.") != std::string::npos, "Cloud is synced first, and a failure keeps that game");const auto* saves = find_row(model, "uninstall-delete-saves");check(saves && !saves->selected, "deleting saves is a choice, off by default");activate(model, "uninstall-delete-saves");@@ -1308,60 +1309,43 @@ void live_storage_section_and_installed_games() {return request.kind == InstallRequestKind::Uninstall && !request.delete_saves;}),"each checked game is uninstalled, keeping its saves");- check(model.state().navigation.modals.size() == 1 && model.state().navigation.modals.back().id == "installed-games",- "the list stays open as the progress view");- // While the batch runs the list shows only its games, in the batch's order, as status rows.- check(model.state().navigation.modals.back().action_keys ==- std::vector<std::string>{"installed-step-11", "installed-step-10", "installed-step-12", "installed-close"},- "the batch view lists only the batch's games, then Close");- check(!has_row(model, "installed-sort") && !has_row(model, "installed-select-all") &&- !has_row(model, "installed-toggle-13"), "Sort, Select all and the other games are hidden");- check(model.state().navigation.focus_key == "installed-step-11", "focus is on the batch's first game");- check(model.view().footer == "Uninstalling 1 of 3…", "the footer says how far the batch is");- check(model.view().subtitle == "Uninstalling the selected games.", "the header says what the list shows");- const auto* waiting = find_row(model, "installed-step-12");- check(waiting && waiting->kind == RowKind::Status && waiting->subtitle == "Waiting" && waiting->value == "5.0 GB",- "a game not started yet waits, without a checkbox");- const auto batch_notices = model.state().notices.size();- check(!model.action("triangle") || model.TakeInstallRequests().empty(), "Triangle starts nothing in the batch view");- titled.uninstall_status = "Syncing saves…";+ // The list closes: Queue follows the uninstalls, and a notice says so.+ check(model.state().navigation.modals.empty() && model.state().navigation.focus_key == "settings-installed",+ "the confirmed list closes back to Settings");+ check(!model.state().notices.empty() && model.state().notices.back().id == "uninstall-batch" &&+ model.state().notices.back().message == "Uninstalling 3 games" &&+ model.state().notices.back().detail == "Follow them in Queue" && !model.state().notices.back().failure,+ "a notice sends the player to Queue");+ const auto notices = model.state().notices.size();+ model.UpdatePreparationQueue({std::nullopt, {}, {}, {}, {{SteamId(11), "Removing PS5 title…"}, {SteamId(10), ""}, {SteamId(12), ""}}});+ titled.uninstall_status = "Waiting to uninstall";model.UpdateRuntime(RuntimeState::Ready, {titled, running, preparing});- check(find_row(model, "installed-step-10")->subtitle == "Syncing saves…", "a row shows its game's uninstall step");+ activate(model, "settings-installed");+ check(!find_row(model, "installed-toggle-10")->enabled && find_row(model, "installed-toggle-10")->subtitle == "Waiting to uninstall",+ "a game waiting to uninstall says so and can't be chosen");+ model.action("circle");- // One stops on Cloud: its row says why, without a notice.- const auto notices = batch_notices;+ // One stops on Cloud: Queue keeps the reason, and a corner notice says so instead of a dialog.model.NotifyUninstallStopped(SteamId(12), "Cloud saves could not be synced.");- check(model.state().notices.size() == notices && model.state().navigation.modals.back().id == "installed-games",- "a stop in the batch posts no notice");- const auto* stopped = find_row(model, "installed-step-12");- check(stopped && stopped->subtitle == "Stopped: Cloud saves could not be synced." && stopped->tone == "problem",- "the stopped game shows the reason");- check(model.view().footer == "Uninstalling 2 of 3…", "a stop counts as done");- check(!has_row(model, "installed-show-all"), "Show all games waits for the batch to finish");-- // The other two finish: their rows say so and the totals count only them.+ check(model.state().navigation.modals.empty() && model.state().notices.size() == notices + 1 &&+ model.state().notices.back().message == "Uninstall stopped" && !model.state().notices.back().alert,+ "a stop in the batch is a corner notice, not a dialog");++ // The other two finish without a notice each.+ model.UpdatePreparationQueue({});titled.uninstall_status.clear();model.UpdateRuntime(RuntimeState::Ready, {running, preparing});model.UpdateInstalls({LiveInstallJob{SteamId(15), JobState::Queued, 0, gb, {}, "internal"}},{{SteamId(12), 5 * gb, "internal"}, {SteamId(13), 1 * gb, "internal"}, {SteamId(14), 2 * gb, "internal"},{SteamId(15), 3 * gb, "internal"}, {SteamId(16), 4 * gb, "internal"}});- check(model.state().notices.size() == notices, "the batch posts no Game uninstalled notices");- const auto* gone = find_row(model, "installed-step-11");- check(gone && gone->subtitle == "Uninstalled" && gone->tone == "good" && gone->value == "20.0 GB", "an uninstalled game says so");- check(model.view().footer == "2 uninstalled · about 25.0 GB freed · 1 stopped", "the totals count freed space and stops");- check(model.state().navigation.modals.back().action_keys.size() == 5 && has_row(model, "installed-show-all") &&- find_row(model, "installed-show-all")->title == "Show all games",- "a finished batch offers Show all games beside Close");- check(model.view().subtitle == "Finished uninstalling.", "the header says the batch is done");- check(model.view().legends == std::vector<std::string>{"Circle Close"}, "a status row offers no Cross");- check(model.action("focus:installed-show-all"), "Show all games is focused");- check(model.view().legends == std::vector<std::string>{"Cross Choose", "Circle Close"}, "a footer button offers Cross");-- // Show all games returns to the installed games; the stopped one keeps its reason and can go again.- activate(model, "installed-show-all");+ model.NotifyUninstallFinished(SteamId(11));+ model.NotifyUninstallFinished(SteamId(10));+ check(model.state().notices.size() == notices + 1, "the batch posts no Game uninstalled notices");++ // The list shows the stopped game with its reason; it can go again.+ activate(model, "settings-installed");check(installed_order(model) == std::vector<std::string>{"12", "16", "15", "14", "13"},- "the full list shows what is installed now, without the uninstalled games");- check(model.state().navigation.focus_key == "installed-toggle-12", "focus is on the first game");+ "the list shows what is installed now, without the uninstalled games");check(find_row(model, "installed-toggle-12")->enabled &&find_row(model, "installed-toggle-12")->subtitle == "Stopped: Cloud saves could not be synced.","the stopped game says why and can be chosen");@@ -1372,13 +1356,16 @@ void live_storage_section_and_installed_games() {activate(model, "confirm-destructive");requests = model.TakeInstallRequests();check(requests.size() == 1 && requests[0].game_id == SteamId(12), "the stopped game is uninstalled again");- check(model.view().footer == "Uninstalling 1 of 1…" && find_row(model, "installed-step-12")->subtitle == "Waiting",- "the retry is a batch of its own");+ check(model.state().navigation.modals.empty() && model.state().notices.back().message == "Uninstalling Gamma" &&+ model.state().notices.back().detail == "Follow it in Queue", "one game's notice names it");+ check(model.state().ended_uninstalls.size() == 2 &&+ std::all_of(model.state().ended_uninstalls.begin(), model.state().ended_uninstalls.end(),+ [](const auto& ended) { return ended.stopped.empty(); }),+ "going again clears the stop; the finished ones stay");model.UpdateInstalls({LiveInstallJob{SteamId(15), JobState::Queued, 0, gb, {}, "internal"}},{{SteamId(13), 1 * gb, "internal"}, {SteamId(14), 2 * gb, "internal"}, {SteamId(15), 3 * gb, "internal"},{SteamId(16), 4 * gb, "internal"}});- check(model.view().footer == "1 uninstalled · about 5.0 GB freed", "the retry's totals");- activate(model, "installed-show-all");+ activate(model, "settings-installed");check(!has_row(model, "installed-toggle-12"), "the uninstalled game leaves the list");// The footer is reached from the last game and left again; Left/Right move between its buttons.@@ -1420,7 +1407,7 @@ void live_storage_section_and_installed_games() {check(model.TakeInstallRequests().empty() && model.view().subtitle == "None of the selected games can be uninstalled now.","without a batch the list says nothing could go");- // Closing the list ends the batch: later stops are notices again.+ // The list closes with Close. A game uninstalled on its own still says why it stopped in a dialog.const auto* close = find_row(model, "installed-close");check(close && close->title == "Close", "the list closes with Close");activate(model, "installed-close");@@ -1428,7 +1415,7 @@ void live_storage_section_and_installed_games() {check(find_row(model, "settings-installed")->value == "4 games · 10.0 GB", "the Settings row follows");model.NotifyUninstallStopped(SteamId(13), "Cloud saves could not be synced.");check(!model.state().navigation.modals.empty() && model.state().navigation.modals.back().title == "Uninstall stopped",- "after the list closes a stop is told as before");+ "a stop outside a batch is told in a dialog");model.action("circle");// Without a batch the list follows the installs, and closes when none is left.@@ -1438,9 +1425,10 @@ void live_storage_section_and_installed_games() {model.UpdateInstalls({}, {{SteamId(12), 5 * gb, "internal"}, {SteamId(13), 1 * gb, "usb0"}});activate(model, "settings-installed");check(installed_order(model) == std::vector<std::string>{"12", "13"}, "the list shows what is installed now");- check(find_row(model, "installed-toggle-13")->subtitle == "USB drive · Played yesterday" &&- find_row(model, "installed-toggle-12")->subtitle == "Console storage · Played 100 days ago",+ check(find_row(model, "installed-toggle-12")->subtitle == "Console storage · Played 100 days ago","with games on two drives each row names its drive");+ check(find_row(model, "installed-toggle-13")->subtitle == "Stopped: Cloud saves could not be synced.",+ "a stopped uninstall keeps its reason in the list until the game goes again or Queue dismisses it");check(model.action("focus:installed-toggle-13"), "the last game is focused");model.UpdateInstalls({}, {{SteamId(12), 5 * gb, "internal"}});check(installed_order(model) == std::vector<std::string>{"12"}, "the list follows an uninstall that finished");@@ -2446,6 +2434,90 @@ void live_queue_history_and_empty_states() {check(!has_row(model, "queue-preparation") && has_row(model, "job-23"), "Preparation empties; Downloads keeps its entry");}+// Queue lists uninstalls in Preparation: those at work, those waiting their turn, a stop with its reason+// and finished ones, counted with the preparations and in the tab's badge.+void live_queue_lists_uninstalls() {+ using namespace playden::homebrew;+ constexpr std::int64_t now = 1'800'000'000;+ auto model = make_live();+ model.SetWallClock(now);+ model.UpdateAccount({AuthState::SignedIn, "123", "Synthetic", {}, {}, true});+ check(model.UpdateLibrary({{game(SteamId(10), "Ninja"), game(SteamId(11), "Shovel"), game(SteamId(40), "Alpha"), game(SteamId(41), "Beta"),+ game(SteamId(42), "Gamma")}, false, {}, false, false, {}}), "library loaded");+ model.UpdateInstalls({}, {{SteamId(10), 1, "internal", true}, {SteamId(11), 1, "internal", true}, {SteamId(40), 1, "internal", true},+ {SteamId(41), 1, "internal", true}, {SteamId(42), 1, "internal", true}});+ model.UpdatePreparationQueue({SteamId(10), {SteamId(11)}, {}, {},+ {{SteamId(40), "Removing PS5 title…"}, {SteamId(41), ""}, {SteamId(42), ""}}});+ model.action("r1");+ model.action("r1");+ check((queue_keys(model) == std::vector<std::string>{"queue-preparation", "prep-active-10", "prep-unin-40", "prep-11", "prep-unin-41",+ "prep-unin-42"}),+ "a preparation keeps the card; the uninstall at work follows it, those waiting come after the waiting preparations");+ check(queue_row(model, "queue-preparation")->value == "1 preparing · 1 uninstalling · 3 waiting" &&+ model.view().subtitle == "1 preparing · 1 uninstalling · 3 waiting",+ "the heading and the page count uninstalls at work and waiting");+ check(queue_row(model, "prep-unin-40")->value == "Uninstalling" && queue_row(model, "prep-unin-40")->subtitle == "Removing PS5 title…" &&+ queue_row(model, "prep-unin-40")->tone == "busy",+ "the uninstall at work says its step");+ check(queue_row(model, "prep-unin-41")->value == "Waiting to uninstall" && queue_row(model, "prep-unin-41")->subtitle.empty() &&+ queue_row(model, "prep-11")->value == "Up next",+ "a waiting uninstall says so, unnumbered; the preparation queue keeps its own order");+ check(QueuePending(model.state()) == 5, "the tab badge counts preparations and uninstalls running or waiting");+ activate(model, "prep-unin-41");+ check(has_row(model, "prep-open-41") && !has_row(model, "prep-next-41") && model.view().title == "Uninstall actions",+ "a waiting uninstall offers its game's page");+ model.action("circle");++ // With no preparation running the first uninstall at work takes the card.+ model.UpdatePreparationQueue({std::nullopt, {}, {}, {},+ {{SteamId(40), "Deleting files…"}, {SteamId(41), "Removing PS5 title…"}, {SteamId(42), ""}}});+ const auto layout = BuildQueueLayout(model.state());+ check(layout.preparation.active && layout.preparation.active->key == "prep-unin-40" && layout.preparation.active->uninstall &&+ layout.preparation.active->status == "Uninstalling" && layout.preparation.active->note == "Deleting files…",+ "the uninstall at work takes the card");+ check((queue_keys(model) == std::vector<std::string>{"queue-preparation", "prep-unin-40", "prep-unin-41", "prep-unin-42"}),+ "a second one at work is a row after the card, then the one waiting");+ check(queue_row(model, "queue-preparation")->value == "2 uninstalling · 1 waiting", "both at work are counted");+ activate(model, "queue-preparation");+ check(queue_row(model, "queue-preparation")->value == "2 more games queued", "a closed section counts uninstalls after its card");+ activate(model, "queue-preparation");++ // One finishes, one stops (on its own, so the stop is a dialog too), one goes on.+ model.NotifyUninstallFinished(SteamId(40));+ model.NotifyUninstallStopped(SteamId(41), "Choose which Cloud saves to keep, then uninstall again.");+ activate(model, "alert-ok");+ model.UpdatePreparationQueue({std::nullopt, {}, {}, {}, {{SteamId(42), "Removing PS5 title…"}}});+ const auto done_key = "prep-unin-done-40-" + std::to_string(now);+ check((queue_keys(model) == std::vector<std::string>{"queue-preparation", "prep-unin-42", "prep-unin-attn-41", done_key}),+ "the one at work, then the stop, then the finished one");+ check(queue_row(model, "prep-unin-attn-41")->value == "Uninstall stopped" &&+ queue_row(model, "prep-unin-attn-41")->subtitle == "Choose which Cloud saves to keep, then uninstall again." &&+ queue_row(model, "prep-unin-attn-41")->tone == "attention",+ "a stopped uninstall needs the player and says why");+ check(queue_row(model, done_key)->value == "Uninstalled" && queue_row(model, done_key)->tone == "good", "a finished one says so");+ check(queue_row(model, "queue-preparation")->value == "1 uninstalling · 1 needs attention · 1 completed" &&+ model.view().subtitle == "1 uninstalling · 1 needs attention",+ "stops and finishes are counted apart from the work");+ check(QueuePending(model.state()) == 1, "the badge counts only what runs or waits");++ // A stop and a finish can be dismissed; Clear completed takes finished uninstalls with finished preparations.+ activate(model, "prep-unin-attn-41");+ check(has_row(model, "prep-open-41") && has_row(model, "uninstall-dismiss-41-" + std::to_string(now)),+ "a stopped uninstall offers its game's page and Dismiss");+ activate(model, "uninstall-dismiss-41-" + std::to_string(now));+ check(!has_row(model, "prep-unin-attn-41"), "Dismiss takes the stop off the list");+ activate(model, done_key);+ check(has_row(model, "uninstall-dismiss-40-" + std::to_string(now)) && !has_row(model, "prep-clear-completed"),+ "a finished uninstall offers Dismiss");+ model.action("circle");+ model.UpdatePreparationQueue({std::nullopt, {}, {{SteamId(10), now - 60}}, {}, {}});+ check((queue_keys(model) == std::vector<std::string>{"queue-preparation", done_key, "prep-done-10-" + std::to_string(now - 60)}),+ "finished uninstalls and preparations are listed together, newest first");+ activate(model, done_key);+ activate(model, "prep-clear-completed");+ check(model.TakePreparedClear() && model.state().ended_uninstalls.empty(), "Clear completed clears both");+}+// A game whose preparation needs the player stays in Preparation without a running preparation.void live_queue_lists_preparations_needing_attention() {using namespace playden::homebrew;@@ -2916,6 +2988,7 @@ int main() {live_queue_counts_copies();live_queue_history_and_empty_states();live_queue_lists_preparations_needing_attention();+ live_queue_lists_uninstalls();live_details_prepare_next();std::cout << "homebrew_library_model_test passed\n";return 0;