Play your Steam library's Windows games on a jailbroken PS5.
C++
Offer Reset filters when filters empty the Library
Leonardo Lobato810ec9bed438
diff --git a/src/homebrew/simulation.cpp b/src/homebrew/simulation.cppindex 08ad781..2711c68 100644--- a/src/homebrew/simulation.cpp+++ b/src/homebrew/simulation.cpp@@ -3104,8 +3104,13 @@ void Simulation::rebuild_view() {if (state_.library.favorites.contains(game->id)) item.badge = "Favorite";if (game->art_failed) item.subtitle = "Artwork unavailable";}- if (view_.rows.empty()) row(state_.library.query.empty() ? "library-empty" : "clear-search", RowKind::Action,- state_.library.query.empty() ? "Connect Steam" : "Clear search", state_.library.query.empty() ? "connect" : "clear-search");+ // An empty grid offers the way back to the games it hides; Connect Steam is only for a missing catalog.+ if (view_.rows.empty()) {+ if (!state_.library.query.empty()) row("clear-search", RowKind::Action, "Clear search", "clear-search");+ else if (!state_.library.filters.empty()) row("library-empty", RowKind::Action, "Reset filters", "filters-reset");+ else if (!state_.games.empty() && state_.library.scope != "all") row("library-empty", RowKind::Action, "Show all games", "library-show-all");+ else row("library-empty", RowKind::Action, "Connect Steam", "connect");+ }// The footer shows five legends; with a search applied, Circle clears it in place of Square Favorite.view_.legends = state_.library.query.empty()? std::vector<std::string>{"Cross Open", "Square Favorite", "Options Actions", "Triangle Filters", "Touchpad Search"}@@ -4252,6 +4257,7 @@ void Simulation::activate() {else if (action_name == "qr-cancel" || action_name == "editor-cancel" || action_name == "cancel") cancel();else if (action_name == "editor-done") commit_editor();else if (action_name == "clear-search") { state_.library.query.clear(); reconcile_library_selection(state_); }+ else if (action_name == "library-show-all") { state_.library.scope = "all"; reconcile_library_selection(state_); save_profile(); }else if (action_name == "open-game") {if (live()) force_organization_selection_ = true;state_.navigation.detail_origin = state_.navigation.route;diff --git a/tests/homebrew_library_model_test.cpp b/tests/homebrew_library_model_test.cppindex eff86dd..1c5413d 100644--- a/tests/homebrew_library_model_test.cpp+++ b/tests/homebrew_library_model_test.cpp@@ -782,6 +782,43 @@ void refresh_actions_preserve_authentication_and_wall_clock_is_external() {"external wall clock cannot alter deterministic simulation time");}+void live_empty_filter_keeps_the_signed_in_account() {+ // The Playable filter keeps only games the player rated; with no ratings the grid is empty,+ // and its only row must undo the filter rather than start a new Steam sign-in.+ auto model=make_live();+ model.UpdateAccount({AuthState::SignedIn,"123","Synthetic",{},{},true});+ check(model.UpdateLibrary({{game(42,"Synthetic")},false,{},false,false,{}}),"library loaded");+ model.TakeServiceActions();+ check(model.action("r1") && model.action("triangle"),"live filter modal opens");+ activate(model,"filter-compat-playable");+ check(model.visible_games().empty(),"no rated game passes the Playable filter");+ const auto* empty=find_row(model,"library-empty");+ check(empty!=nullptr && empty->action=="filters-reset" && empty->title=="Reset filters",+ "a filtered-out library offers Reset filters, not Connect Steam");+ activate(model,"library-empty");+ const auto actions=model.TakeServiceActions();+ check(std::find(actions.begin(),actions.end(),ServiceAction::BeginQr)==actions.end() &&+ model.state().account.authentication==AuthState::SignedIn,"resetting filters keeps the Steam sign-in");+ check(model.state().library.filters.empty() && model.visible_games().size()==1 &&+ model.state().navigation.focus_key=="game-42","reset filters shows the library again");++ // An empty scope offers the whole library back.+ check(model.action("left") && model.action("down") && model.state().navigation.focus_key=="rail-favorites" &&+ model.action("cross"),"Favorites scope opens");+ check(model.visible_games().empty(),"no favorites yet");+ empty=find_row(model,"library-empty");+ check(empty!=nullptr && empty->action=="library-show-all","an empty scope offers Show all games");+ activate(model,"library-empty");+ check(model.state().library.scope=="all" && model.visible_games().size()==1 &&+ model.state().account.authentication==AuthState::SignedIn,"Show all games returns to every game");++ // Without a catalog there is nothing to show yet, so Connect Steam stays.+ auto signed_out=make_live();+ check(signed_out.action("r1"),"library opens before sign-in");+ empty=find_row(signed_out,"library-empty");+ check(empty==nullptr || empty->action=="connect","a missing catalog still offers Connect Steam");+}+void live_filters_only_use_available_facts() {auto model=make_live();model.UpdateAccount({AuthState::SignedIn,"123","Synthetic",{},{},true});@@ -1502,6 +1539,7 @@ int main() {live_cloud_saves();live_saves_tab();live_filters_only_use_available_facts();+ live_empty_filter_keeps_the_signed_in_account();projects_only_owned_facts_and_delivery_status();loading_and_failure_preserve_last_good_snapshot();rejects_invalid_snapshots_transactionally_and_leaves_simulation_alone();