Skip to content

Xbox Cloud Gaming app for PS5 Homebrew

C

psbox: the quit question with Quit / Cancel buttons (left / right picks, Cancel first)

Rafael Abud Ferreira91fc82740d58
diff --git a/src/ui/app_ui.cpp b/src/ui/app_ui.cpp
index 809e608..f29f31c 100644
--- a/src/ui/app_ui.cpp
+++ b/src/ui/app_ui.cpp
@@ -2281,8 +2281,9 @@ UiEvent AppUi::handle(const NavInput& in) {
}
switch (screen_) {
case Screen::Home:
- if (quitPrompt_) { // Cross closes the app, Circle stays
- if (in.accept) ev.action = Action::Quit;
+ if (quitPrompt_) { // two buttons, Close / Cancel: left / right picks, Cross presses, Circle cancels
+ if (in.left || in.right) promptFocus_ = in.left ? 0 : 1, dirty_ = true;
+ if (in.accept && promptFocus_ == 0) ev.action = Action::Quit;
if (in.accept || in.back) quitPrompt_ = false, dirty_ = true;
break;
}
@@ -2291,6 +2292,7 @@ UiEvent AppUi::handle(const NavInput& in) {
// asks. On the PS5 the system closes the app; Circle does nothing here.
if (caps_.desktopWindow && in.back && !searching_) {
quitPrompt_ = true;
+ promptFocus_ = 1; // Cancel first: a second Circle / Esc never closes by accident
dirty_ = true;
break;
}
@@ -3702,9 +3704,20 @@ void AppUi::drawCountryPicker(Canvas& c) {
}
void AppUi::drawQuitPrompt(Canvas& c) {
- drawModal(c, 760, 170, tr(Str::QuitTitle));
+ // As the update pop-up: the question, then Close and Cancel as buttons.
+ constexpr int kButtonW = 300, kButtonH = 72, kPanelW = 2 * kButtonW + 24 + 112, kPanelH = 250;
+ Rect panel = drawModal(c, kPanelW, kPanelH, tr(Str::QuitTitle));
+ const char* labels[2] = {tr(Str::QuitConfirm), tr(Str::Cancel)};
+ for (int i = 0; i < 2; ++i) {
+ Rect b{panel.x + 56 + i * (kButtonW + 24), panel.y + panel.h - kButtonH - 44, kButtonW, kButtonH};
+ bool on = i == promptFocus_;
+ c.fillRect(b, on ? kWhite : rgba(255, 255, 255, 30), 14);
+ int tw = fonts_.semibold.measure(labels[i], 28);
+ fonts_.semibold.draw(c, labels[i], b.x + (b.w - tw) / 2, fonts_.semibold.centeredY(b.y, b.h, 28), 28,
+ on ? kBg : kWhite);
+ }
c.fillRect({0, kH - 80, kW, 80}, kBg); // its own hints over drawModal's
- drawHints(c, {{kIconCross, tr(Str::QuitConfirm)}, {kIconCircle, tr(Str::Cancel)}});
+ drawHints(c, {{kIconCross, tr(Str::Select)}, {kIconCircle, tr(Str::Cancel)}});
}
void AppUi::drawUpdatePrompt(Canvas& c) {
diff --git a/src/ui/strings.cpp b/src/ui/strings.cpp
index 392b3c9..c352c5f 100644
--- a/src/ui/strings.cpp
+++ b/src/ui/strings.cpp
@@ -295,8 +295,8 @@ constexpr Column kEnglish = {
"Display mode", // DisplayMode
"Window", // DisplayWindow
"Fullscreen", // DisplayFullscreen
- "Close PSBox?", // QuitTitle
- "Close", // QuitConfirm
+ "Quit PSBox?", // QuitTitle
+ "Quit", // QuitConfirm
};
constexpr Column kPortugueseBR = {
@@ -562,8 +562,8 @@ constexpr Column kPortugueseBR = {
"Modo de exibição", // DisplayMode
"Janela", // DisplayWindow
"Tela cheia", // DisplayFullscreen
- "Fechar o PSBox?", // QuitTitle
- "Fechar", // QuitConfirm
+ "Sair do PSBox?", // QuitTitle
+ "Sair", // QuitConfirm
};
constexpr Column kSpanish = {
@@ -829,8 +829,8 @@ constexpr Column kSpanish = {
"Modo de pantalla", // DisplayMode
"Ventana", // DisplayWindow
"Pantalla completa", // DisplayFullscreen
- "¿Cerrar PSBox?", // QuitTitle
- "Cerrar", // QuitConfirm
+ "¿Salir de PSBox?", // QuitTitle
+ "Salir", // QuitConfirm
};
constexpr Column kFrench = {
@@ -1096,8 +1096,8 @@ constexpr Column kFrench = {
"Mode d'affichage", // DisplayMode
"Fenêtre", // DisplayWindow
"Plein écran", // DisplayFullscreen
- "Fermer PSBox ?", // QuitTitle
- "Fermer", // QuitConfirm
+ "Quitter PSBox ?", // QuitTitle
+ "Quitter", // QuitConfirm
};
constexpr Column kGerman = {
@@ -1363,8 +1363,8 @@ constexpr Column kGerman = {
"Anzeigemodus", // DisplayMode
"Fenster", // DisplayWindow
"Vollbild", // DisplayFullscreen
- "PSBox schließen?", // QuitTitle
- "Schließen", // QuitConfirm
+ "PSBox beenden?", // QuitTitle
+ "Beenden", // QuitConfirm
};
constexpr Column kItalian = {
@@ -1630,8 +1630,8 @@ constexpr Column kItalian = {
"Modalità schermo", // DisplayMode
"Finestra", // DisplayWindow
"Schermo intero", // DisplayFullscreen
- "Chiudere PSBox?", // QuitTitle
- "Chiudi", // QuitConfirm
+ "Uscire da PSBox?", // QuitTitle
+ "Esci", // QuitConfirm
};
constexpr std::array<const Column*, kLangs> kTable = {&kEnglish, &kPortugueseBR, &kSpanish,