Xbox Cloud Gaming app for PS5 Homebrew
C
psbox: Circle / Esc on the home screen asks 'Close PSBox?' (Cross closes) — fullscreen has no other way out with a pad
Rafael Abud Ferreiraa62bb2a0513d
diff --git a/src/app/app_core.cpp b/src/app/app_core.cppindex e810c9b..525a35a 100644--- a/src/app/app_core.cpp+++ b/src/app/app_core.cpp@@ -151,6 +151,7 @@ private:// What main() kept on its stack when it ran the loop itself: made by// coreStartup(), carried from one pass to the next.struct Core {+ bool quitAsked_ = false; // desktop: "Close PSBox?" confirmed on the home screenexplicit Core(bool withDisplay) : haveDisplay(withDisplay) {}bool frame();@@ -338,7 +339,7 @@ bool coreStartup() {}bool Core::frame() {- if (!shell::pumpEvents()) return false;+ if (!shell::pumpEvents() || quitAsked_) return false;if (bool on; shell::fullscreenSwitched(on)) {// F11 / Alt+Enter on a desktop: the Display mode setting follows.{@@ -671,6 +672,7 @@ bool Core::frame() {g_command = kSignIn;break;case ui::Action::Report: openReport(ev.reportWhat, false, ui::tr(ui::Str::ReportProblem)); break;+ case ui::Action::Quit: quitAsked_ = true; break; // desktop only (the PS5 never asks)case ui::Action::OpenUrl: {// A desktop: the sign-in page, the report form, the release page.bool ok = shell::openUrl(ev.url);diff --git a/src/ui/app_ui.cpp b/src/ui/app_ui.cppindex 517d38f..809e608 100644--- a/src/ui/app_ui.cpp+++ b/src/ui/app_ui.cpp@@ -2280,7 +2280,22 @@ UiEvent AppUi::handle(const NavInput& in) {return ev;}switch (screen_) {- case Screen::Home: handleHome(in, ev); break;+ case Screen::Home:+ if (quitPrompt_) { // Cross closes the app, Circle stays+ if (in.accept) ev.action = Action::Quit;+ if (in.accept || in.back) quitPrompt_ = false, dirty_ = true;+ break;+ }+ // A desktop window has no system menu to close it from (fullscreen,+ // a controller in hand): Circle / Esc at the top of the home screen+ // asks. On the PS5 the system closes the app; Circle does nothing here.+ if (caps_.desktopWindow && in.back && !searching_) {+ quitPrompt_ = true;+ dirty_ = true;+ break;+ }+ handleHome(in, ev);+ break;case Screen::SignIn:// A desktop: Cross (Enter) opens the sign-in page in the browser.if (in.accept && caps_.openUrl) {@@ -3686,6 +3701,12 @@ void AppUi::drawCountryPicker(Canvas& c) {}}+void AppUi::drawQuitPrompt(Canvas& c) {+ drawModal(c, 760, 170, tr(Str::QuitTitle));+ c.fillRect({0, kH - 80, kW, 80}, kBg); // its own hints over drawModal's+ drawHints(c, {{kIconCross, tr(Str::QuitConfirm)}, {kIconCircle, tr(Str::Cancel)}});+}+void AppUi::drawUpdatePrompt(Canvas& c) {c.fillRect({0, 0, kW, kH}, rgba(0, 0, 0, 160));constexpr int kPanelW = 960, kPanelH = 340, kButtonW = 360, kButtonH = 72;@@ -4150,6 +4171,7 @@ void AppUi::render(Canvas& c, uint64_t nowMs) {case Screen::Streaming: break;}if (screen_ == Screen::Home && updatePrompt_) drawUpdatePrompt(c);+ if (screen_ == Screen::Home && quitPrompt_) drawQuitPrompt(c);if (screen_ == Screen::Error && countryPickerOpen_) drawCountryPicker(c);if (reportOpen_) drawReport(c);if ((screen_ == Screen::Home && !updatePrompt_) || screen_ == Screen::Error) drawSignOutHold(c, nowMs);diff --git a/src/ui/app_ui.h b/src/ui/app_ui.hindex a75f91e..e1e6de0 100644--- a/src/ui/app_ui.h+++ b/src/ui/app_ui.h@@ -178,7 +178,8 @@ enum class Action {GameSettingsChanged,Report, // "Report a problem" (Triangle on an error or in Settings): reportWhat is the error shownLoginCountry, // the sign-in country changed (settings): save them and sign in again- OpenUrl // a link on screen to open in the browser (UiCaps::openUrl): `url`+ OpenUrl, // a link on screen to open in the browser (UiCaps::openUrl): `url`+ Quit // desktop: the user closed the app from the home screen};// How "Your games" is sorted (R3).@@ -439,6 +440,7 @@ private:void drawError(Canvas& c);void drawSettings(Canvas& c);void drawUpdatePrompt(Canvas& c);+ void drawQuitPrompt(Canvas& c);void drawReport(Canvas& c);void drawCountryPicker(Canvas& c);// The light bar's colour picker (Settings > Light bar > Custom colour).@@ -552,6 +554,7 @@ private:std::string settingsCountry_; // the sign-in country when Settings openedstd::string reportUrl_, reportHeading_, reportDetail_;bool updatePrompt_ = false; // the pop-up is up (on the home screen)+ bool quitPrompt_ = false; // desktop: "Close PSBox?" is up (Circle / Esc on the home screen)int promptFocus_ = 0; // 0 Update now, 1 Not nowstd::string updatingTo_, updateStatus_;float updateFraction_ = -1;diff --git a/src/ui/strings.cpp b/src/ui/strings.cppindex 80bd335..392b3c9 100644--- a/src/ui/strings.cpp+++ b/src/ui/strings.cpp@@ -295,6 +295,8 @@ constexpr Column kEnglish = {"Display mode", // DisplayMode"Window", // DisplayWindow"Fullscreen", // DisplayFullscreen+ "Close PSBox?", // QuitTitle+ "Close", // QuitConfirm};constexpr Column kPortugueseBR = {@@ -560,6 +562,8 @@ constexpr Column kPortugueseBR = {"Modo de exibição", // DisplayMode"Janela", // DisplayWindow"Tela cheia", // DisplayFullscreen+ "Fechar o PSBox?", // QuitTitle+ "Fechar", // QuitConfirm};constexpr Column kSpanish = {@@ -825,6 +829,8 @@ constexpr Column kSpanish = {"Modo de pantalla", // DisplayMode"Ventana", // DisplayWindow"Pantalla completa", // DisplayFullscreen+ "¿Cerrar PSBox?", // QuitTitle+ "Cerrar", // QuitConfirm};constexpr Column kFrench = {@@ -1090,6 +1096,8 @@ constexpr Column kFrench = {"Mode d'affichage", // DisplayMode"Fenêtre", // DisplayWindow"Plein écran", // DisplayFullscreen+ "Fermer PSBox ?", // QuitTitle+ "Fermer", // QuitConfirm};constexpr Column kGerman = {@@ -1355,6 +1363,8 @@ constexpr Column kGerman = {"Anzeigemodus", // DisplayMode"Fenster", // DisplayWindow"Vollbild", // DisplayFullscreen+ "PSBox schließen?", // QuitTitle+ "Schließen", // QuitConfirm};constexpr Column kItalian = {@@ -1620,6 +1630,8 @@ constexpr Column kItalian = {"Modalità schermo", // DisplayMode"Finestra", // DisplayWindow"Schermo intero", // DisplayFullscreen+ "Chiudere PSBox?", // QuitTitle+ "Chiudi", // QuitConfirm};constexpr std::array<const Column*, kLangs> kTable = {&kEnglish, &kPortugueseBR, &kSpanish,diff --git a/src/ui/strings.h b/src/ui/strings.hindex 61b67de..2fc29cf 100644--- a/src/ui/strings.h+++ b/src/ui/strings.h@@ -272,6 +272,8 @@ enum class Str {DisplayMode, // Settings row on a desktop: the app in a window or fullscreen (F11 / Alt+Enter switch it too)DisplayWindow, // ... in a windowDisplayFullscreen, // ... fullscreen+ QuitTitle, // desktop: Circle / Esc on the home screen asks before closing the app+ QuitConfirm, // ... the hint that closes itCount};