Play your Steam library's Windows games on a jailbroken PS5.
C++
Count import copies apart from downloads in Queue
Leonardo Lobato9f02233a2c9e
diff --git a/src/homebrew/queue_layout.cpp b/src/homebrew/queue_layout.cppindex 7ad4839..35148e9 100644--- a/src/homebrew/queue_layout.cpp+++ b/src/homebrew/queue_layout.cpp@@ -52,7 +52,10 @@ QueueSection downloads(const State& state) {std::vector<const Job*> finished;std::size_t paused = 0, failed = 0;for (const auto* job : jobs) {- if (running(*job)) ++section.running;+ if (running(*job)) {+ ++section.running;+ if (job->game_id.store == Store::kLocal) ++section.copying;+ }else if (job->state == JobState::Queued) ++section.waiting;else if (job->state == JobState::Paused || job->state == JobState::Interrupted) ++paused;else if (job->state == JobState::Failed) ++failed;@@ -73,7 +76,8 @@ QueueSection downloads(const State& state) {std::string downloads_words(const QueueSection& section, std::size_t paused, std::size_t failed) {std::string text;- if (section.running) join(text, std::to_string(section.running) + " downloading");+ if (section.running > section.copying) join(text, std::to_string(section.running - section.copying) + " downloading");+ if (section.copying) join(text, std::to_string(section.copying) + " copying");if (section.waiting) join(text, std::to_string(section.waiting) + " waiting");if (paused) join(text, std::to_string(paused) + " paused");if (failed) join(text, std::to_string(failed) + " failed");@@ -234,7 +238,8 @@ QueueLayout BuildQueueLayout(const State& state) {summarize(prepare, prepare_words, prepare_attention, "No preparation queued");std::string summary;- if (download.running) join(summary, std::to_string(download.running) + " downloading");+ 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 (download.waiting + prepare.waiting) join(summary, std::to_string(download.waiting + prepare.waiting) + " waiting");if (download.attention + prepare.attention)diff --git a/src/homebrew/queue_layout.hpp b/src/homebrew/queue_layout.hppindex 0616a89..99c38a9 100644--- a/src/homebrew/queue_layout.hpp+++ b/src/homebrew/queue_layout.hpp@@ -37,6 +37,7 @@ struct QueueSection {// Unfinished entries after the card (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 copying = 0; // of those running, imported games copied into Playdenstd::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;diff --git a/src/homebrew/view.cpp b/src/homebrew/view.cppindex 3575f7e..088cac9 100644--- a/src/homebrew/view.cpp+++ b/src/homebrew/view.cpp@@ -2065,7 +2065,7 @@ class Render::Implif (entry->completed){// The files are here; preparing them is the Preparation section's.- value = "Downloaded";+ value = job->game_id.store == Store::kLocal ? "Copied" : "Downloaded";tone = "good";aside = byte_count(job->total_bytes);if (job->finished_at > 0 && !state.simulation_mode)diff --git a/tests/homebrew_library_model_test.cpp b/tests/homebrew_library_model_test.cppindex 751c156..e52a7e8 100644--- a/tests/homebrew_library_model_test.cpp+++ b/tests/homebrew_library_model_test.cpp@@ -2259,6 +2259,27 @@ const playden::homebrew::ViewRow* queue_row(const Simulation& model, const std::return nullptr;}+// Queue: an imported game copied into Playden runs in Downloads, counted as copying, not downloading.+void live_queue_counts_copies() {+ using namespace playden::homebrew;+ auto model = make_live();+ model.UpdateAccount({AuthState::SignedIn, "123", "Synthetic", {}, {}, true});+ const auto rally = playden::GameId::Local("6d1f3a52-0c55-4f3e-9b2a-5d1c7e0a9f11");+ const auto sky = playden::GameId::Local("7c9e6679-7425-40de-944b-e07fc1f90ae7");+ check(model.UpdateLibrary({{game(SteamId(20), "Hollow")}, false, {}, false, false, {}}), "Steam library");+ LibraryUpdate imported{{game(rally, "Rally"), game(sky, "Sky")}, false, {}, false, false, {}};+ imported.source = playden::Store::kLocal;+ check(model.UpdateLibrary(imported), "imported library");+ model.UpdateInstalls({{rally, JobState::Downloading, 64, 100, {}}, {SteamId(20), JobState::Queued, 0, 100, {}}},+ {{sky, 1, "internal", true}}, {{sky, 1, "internal", 1'000}});+ model.action("r1");+ model.action("r1");+ check(model.state().navigation.route == Route::Downloads && model.view().subtitle == "1 copying · 1 waiting",+ "the page counts the copy as copying");+ check(queue_row(model, "queue-downloads")->value == "1 copying · 1 waiting · 1 completed",+ "Downloads counts the copy as copying");+}+// Queue: both workflows, one section expanded at a time. A collapsed section keeps its card and counts.// Waiting preparations are numbered in the runtime's order, completed ones follow them in the same list,// and Prepare next moves a waiting game first without touching the one being prepared.@@ -2829,6 +2850,7 @@ int main() {live_details_keep_personal_edits_and_block_fixture_operations();refresh_actions_preserve_authentication_and_wall_clock_is_external();live_queue_shows_downloads_and_preparations();+ live_queue_counts_copies();live_queue_history_and_empty_states();live_queue_lists_preparations_needing_attention();live_details_prepare_next();