Play your Steam library's Windows games on a jailbroken PS5.
C++
Return to Game actions when closing its sub-sheets
Leonardo Lobatob61e02318e21
diff --git a/src/homebrew/simulation.cpp b/src/homebrew/simulation.cppindex 2687892..9c54e77 100644--- a/src/homebrew/simulation.cpp+++ b/src/homebrew/simulation.cpp@@ -4447,10 +4447,8 @@ void Simulation::open_game_settings() {if (const auto found = state_.runtime_games.find(state_.navigation.selected_game_id); found != state_.runtime_games.end())found->second.activity = TitleActivity::Unknown;}- const bool from_menu = !state_.navigation.modals.empty() && state_.navigation.modals.back().id == "context";- if (from_menu) close_modal();- open_modal({"game-settings", "Game settings", from_menu ? "details-more" : state_.navigation.focus_key,- game_settings_actions(), 0, false});+ // From Game actions it opens on top of that sheet, so Circle returns there.+ open_modal({"game-settings", "Game settings", state_.navigation.focus_key, game_settings_actions(), 0, false});}void Simulation::activate() {@@ -5300,10 +5298,8 @@ void Simulation::activate() {if (const auto found = state_.runtime_games.find(state_.navigation.selected_game_id); found != state_.runtime_games.end())found->second.activity = TitleActivity::Unknown;}- const bool from_menu = !state_.navigation.modals.empty() && state_.navigation.modals.back().id == "context";- if (from_menu) close_modal();- open_modal({"game-maintenance", "Maintenance", from_menu ? "details-more" : state_.navigation.focus_key,- maintenance_actions(), 0, false});+ // From Game actions it opens on top of that sheet, so Circle returns there.+ open_modal({"game-maintenance", "Maintenance", state_.navigation.focus_key, maintenance_actions(), 0, false});} else if (action_name.rfind("maintenance-", 0) == 0) {const auto game = state_.navigation.selected_game_id;std::string refusal;diff --git a/tests/homebrew_controller_tour_test.cpp b/tests/homebrew_controller_tour_test.cppindex b613bd9..e63d7c0 100644--- a/tests/homebrew_controller_tour_test.cpp+++ b/tests/homebrew_controller_tour_test.cpp@@ -80,7 +80,8 @@ int main(int argc, char** argv) {press(simulation, "circle");require(simulation.state().navigation.focus_key == "setting-extra_arguments", "keyboard Cancel restores exact modal opener");press(simulation, "circle");- choose(simulation, "details-more");+ require(!simulation.state().navigation.modals.empty() && simulation.state().navigation.modals.back().id == "context" &&+ simulation.state().navigation.focus_key == "game-settings", "Circle on Game settings returns to Game actions");choose(simulation, "note");choose(simulation, "rating-playable");require(simulation.state().library.ratings.at(game) == Compatibility::Playable, "rating reachable through controller");diff --git a/tests/homebrew_live_model_test.cpp b/tests/homebrew_live_model_test.cppindex 8664602..26d8762 100644--- a/tests/homebrew_live_model_test.cpp+++ b/tests/homebrew_live_model_test.cpp@@ -275,7 +275,7 @@ void live_settings_follow_the_prepared_title(const std::filesystem::path& base)std::vector<std::pair<playden::homebrew::GameId, MaintenanceKind>>{{220, MaintenanceKind::ApplySettings}},"closing the sheet asks for the settings to be applied");check(has_notice(model, "settings-saved"), "closing the sheet announces the change");- activate(model, "details-more");+ check(model.state().navigation.modals.back().id == "context", "closing Game settings returns to Game actions");check(find_row(model, "game-settings")->subtitle == "Changes apply on next launch","the More menu says unpublished changes wait for the next launch");@@ -363,9 +363,12 @@ void live_program_change_applies_like_other_settings(const std::filesystem::pathcheck(find_row(model, "setting-launch_option")->badge.empty() &&find_row(model, "setting-launch_option")->value == "FalloutNV.exe","program: the Program row is an ordinary setting");- check(model.action("circle") && model.state().navigation.modals.empty(), "program: closing the sheet asks nothing");+ check(model.action("circle") && model.state().navigation.modals.size() == 1 &&+ model.state().navigation.modals.back().id == "context",+ "program: closing the sheet asks nothing");check(model.TakeMaintenanceRequests() == Requests{{22380, MaintenanceKind::ApplySettings}},"program: closing the sheet applies the new program");+ model.action("circle");activate(model, "details-play");check(model.state().navigation.modals.empty() && model.TakeRuntimePlayRequests() == std::vector<GameId>{22380},"program: Play starts at once");@@ -378,7 +381,7 @@ void live_program_change_applies_like_other_settings(const std::filesystem::path"picker: the choice is named by its program, not its id, and applies on next launch");activate(model, "value-reset");check(find_row(model, "setting-launch_option")->value == "Fallout: New Vegas", "program: reset goes back to Steam's");- check(model.action("circle") && model.state().navigation.modals.empty() &&+ check(model.action("circle") && model.state().navigation.modals.back().id == "context" &&model.TakeMaintenanceRequests() == Requests{{22380, MaintenanceKind::ApplySettings}},"program: the reset applies the same way");}diff --git a/tests/homebrew_simulation_test.cpp b/tests/homebrew_simulation_test.cppindex c83d31b..f766948 100644--- a/tests/homebrew_simulation_test.cpp+++ b/tests/homebrew_simulation_test.cpp@@ -350,6 +350,7 @@ void t08_nested_settings_restore_openers(const std::filesystem::path& fixtures,check(simulation.action("focus:setting-resolution") && simulation.action("triangle"), "T08 triangle resets");check(!simulation.state().game_settings.at(900001).overrides.count("resolution"), "T08 reset removes the override");simulation.action("circle");+ simulation.action("circle"); // Game settings returned to Game actionssimulation.action("details:900002");activate(simulation, "details-more");activate(simulation, "game-settings");@@ -412,7 +413,7 @@ void t08b_settings_sheet_rules(const std::filesystem::path& fixtures, const std:check(toast != simulation.state().notices.end() && toast->message == "Settings saved · Mouse-driven game"&& toast->detail == "1 change applies on next launch","T08b closing the sheet announces what changed");- activate(simulation, "details-more");+ check(simulation.state().navigation.modals.back().id == "context", "T08b closing Game settings returns to Game actions");activate(simulation, "game-settings");// dxvk.conf rows appear when the kit reads dxvk.conf.rt::KitCapabilities kit;@@ -440,7 +441,6 @@ void t08b_settings_sheet_rules(const std::filesystem::path& fixtures, const std:check(!find_row(simulation, "clear-shader-cache"), "T08b maintenance is not in the settings sheet");// Maintenance lives on the game page, each action behind a confirmation.simulation.action("circle");- activate(simulation, "details-more");activate(simulation, "game-maintenance");check(find_row(simulation, "maintenance-shader") && find_row(simulation, "maintenance-shader")->badge == "Game must be closed","T08b maintenance lists clear shader cache");@@ -458,6 +458,8 @@ void t08b_settings_sheet_rules(const std::filesystem::path& fixtures, const std:"T08b clear shader cache reports");// Games without a recipe still get a usable sheet.simulation.action("circle");+ check(simulation.state().navigation.modals.back().id == "context", "T08b closing Maintenance returns to Game actions");+ simulation.action("circle");simulation.action("details:900003");activate(simulation, "details-more");activate(simulation, "game-settings");