Play your Steam library's Windows games on a jailbroken PS5.
C++
Don't announce the controller found at start
Leonardo Lobatob7bfa1e46bb2
diff --git a/src/homebrew/simulation.cpp b/src/homebrew/simulation.cppindex e802d4d..88f5df8 100644--- a/src/homebrew/simulation.cpp+++ b/src/homebrew/simulation.cpp@@ -725,7 +725,11 @@ void Simulation::reset_default_state() {void Simulation::SetControllerConnected(bool connected) {const bool changed = state_.controller_connected != connected;state_.controller_connected = connected;- if (live() && changed) {+ // The pad reads as disconnected for the first frames after start: only a change after the+ // controller has been seen once is a real disconnect or reconnect.+ const bool announce = live() && changed && controller_seen_;+ if (connected) controller_seen_ = true;+ if (announce) {if (!connected) {push_notice({"controller", "Controller disconnected", "", true, 0, true, "Reconnect it to keep playing"});} else {diff --git a/src/homebrew/simulation.hpp b/src/homebrew/simulation.hppindex 1ebe979..347c9cd 100644--- a/src/homebrew/simulation.hpp+++ b/src/homebrew/simulation.hpp@@ -891,6 +891,7 @@ private:std::uint64_t cancelled_challenge_generation_ = 0;std::uint64_t next_collection_serial_ = 1;std::uint64_t next_job_serial_ = 1;+ bool controller_seen_ = false; // a connected controller has been reported this runstd::vector<ServiceRequest> pending_service_actions_;std::optional<SignInCredentials> pending_credentials_;std::optional<std::string> pending_guard_code_;diff --git a/tests/homebrew_library_model_test.cpp b/tests/homebrew_library_model_test.cppindex 2335b66..6401ce4 100644--- a/tests/homebrew_library_model_test.cpp+++ b/tests/homebrew_library_model_test.cpp@@ -585,7 +585,12 @@ void live_install_notifications() {model.SetWallClock(1'040);check(!find_notice(model, "install-42") && !find_notice(model, "install-44"), "visible notifications expire");- // Controller: a lasting warning while disconnected, a short notice on reconnect.+ // Controller: the pad reads as disconnected for the first frames after start; that says nothing.+ model.SetControllerConnected(false);+ model.SetControllerConnected(true);+ check(!find_notice(model, "controller") && !find_notice(model, "controller-connected"),+ "the controller found at start is not announced");+ // Then a lasting warning while disconnected, a short notice on reconnect.model.SetControllerConnected(false);const auto* lost = find_notice(model, "controller");check(lost && lost->persistent && lost->failure, "a disconnected controller raises a lasting warning");