Play your Steam library's Windows games on a jailbroken PS5.
C++
Show imported games on Home and in the Installed count
Leonardo Lobato83d2f572e4e5
diff --git a/src/homebrew/browse.cpp b/src/homebrew/browse.cppindex 0a21863..6d4ea49 100644--- a/src/homebrew/browse.cpp+++ b/src/homebrew/browse.cpp@@ -234,6 +234,17 @@ std::vector<Shelf> shelves(const State& state)++installation)if (installation->installed_bytes > 0)append_known(state, recent, installation->game_id, seen);+ // Imported games playing from their folder, newest first: without a store sign-in, they are+ // the whole of Home.+ std::vector<const Game*> in_place;+ for (const LiveExternalGame& external : state.external_games)+ if (const Game* game = find_game(state, external.game_id))+ in_place.push_back(game);+ std::stable_sort(in_place.begin(), in_place.end(), [](const Game* left, const Game* right) {+ return optional_descending(left->added_at, right->added_at);+ });+ for (const Game* game : in_place)+ append_known(state, recent, game->id, seen);append_shelf(result, std::move(recent));Shelf favorites{"favorites", "Favorites", {}};diff --git a/src/homebrew/view.cpp b/src/homebrew/view.cppindex a2bb134..68dda1a 100644--- a/src/homebrew/view.cpp+++ b/src/homebrew/view.cpp@@ -1538,11 +1538,12 @@ class Render::Implstd::string value;bool selected = false;};+ // As the Installed scope counts them: imported games playing from their folder too.const std::size_t installed = std::count_if(state.installations.begin(), state.installations.end(),[&state](const Installation &installation) {return installation.installed_bytes > 0 || !state.simulation_mode;- });+ }) + state.external_games.size();std::vector<RailEntry> entries = {{"rail-installed", "Installed", std::to_string(installed), state.library.scope == "installed"},{"rail-all", "All", std::to_string(state.games.size()), state.library.scope == "all"},diff --git a/tests/homebrew_browse_test.cpp b/tests/homebrew_browse_test.cppindex 4ed678d..c393712 100644--- a/tests/homebrew_browse_test.cpp+++ b/tests/homebrew_browse_test.cpp@@ -316,6 +316,34 @@ void imported_scope_lists_local_games(const std::filesystem::path& fixtures)check(filtered_games(state).size() > 1, "All still lists every game");}+// Signed out with only imported games playing from their folders, Home shows them under Recently+// installed, newest first, and the Installed scope lists them.+void imported_games_fill_home_signed_out()+{+ State state;+ state.simulation_mode = false;+ state.account().authentication = AuthState::SignedOut;+ const auto add = [&state](const char* uuid, const char* title, std::int64_t added) {+ Game game;+ game.id = playden::GameId::Local(uuid);+ game.title = title;+ game.added_at = added;+ state.games.push_back(game);+ state.external_games.push_back({game.id, "usb0", true, ""});+ return game.id;+ };+ const auto older = add("0f8fad5b-d9cb-469f-a165-70867728950e", "Bastion", 100);+ const auto newer = add("7c9e6679-7425-40de-944b-e07fc1f90ae7", "GRIS", 200);+ const auto projected = shelves(state);+ const auto recent = std::find_if(projected.begin(), projected.end(), [](const Shelf& shelf) {+ return shelf.key == "installed";+ });+ check(recent != projected.end() && recent->game_ids == std::vector<GameId>{newer, older},+ "Recently installed lists imported games newest first");+ state.library.scope = "installed";+ check(filtered_games(state).size() == 2, "the Installed scope lists imported games playing in place");+}+} // namespacevoid continue_playing_ends_in_more(const std::filesystem::path& fixtures)@@ -374,6 +402,7 @@ int main(int argc, char** argv)utf8_caret_boundaries();disconnected_installations_remain_installed(fixtures);imported_scope_lists_local_games(fixtures);+ imported_games_fill_home_signed_out();std::cout << "homebrew browse tests passed\n";return 0;}