Skip to content

Xbox Cloud Gaming app for PS5 Homebrew

C

My consoles: how a console shows up, and Search again

Rafael Abud Ferreira5ee1bad5d0f7
diff --git a/src/app/ps5_main.cpp b/src/app/ps5_main.cpp
index 0dea908..8f64fbf 100644
--- a/src/app/ps5_main.cpp
+++ b/src/app/ps5_main.cpp
@@ -158,7 +158,8 @@ int g_autoplaySeconds = 0;
bool g_autoplayDump = false;
int g_autoplayRuns = 1;
bool g_autoplayIdle = false;
-bool g_autoplayConsolesTab = false; // autoplay "consolestab": open My consoles, save consoles.ppm
+bool g_autoplayConsolesTab = false;
+bool g_autoplayConsolesEmpty = false; // with "consolestab": as if none were found // autoplay "consolestab": open My consoles, save consoles.ppm
bool g_autoplayConsoles = false; // autoplay "consoles": log the account's own consoles (xhome)
bool g_autoplayPad = false; // autoplay "pad": the physical pad stays in use, its buttons logged
bool g_autoplayDetailTest = false; // open a game to buy far down the list, save its page
@@ -208,6 +209,7 @@ void loadAutoplay() {
if (opt == "pad") g_autoplayPad = true;
if (opt == "consoles") g_autoplayConsoles = true;
if (opt == "consolestab") g_autoplayConsolesTab = true;
+ if (opt == "consolesempty") g_autoplayConsolesTab = g_autoplayConsolesEmpty = true;
if (opt == "librarytest") g_autoplayLibraryTest = true;
if (opt == "imetest") g_autoplayImeTest = true;
if (opt == "menutest") g_autoplayMenuTest = true;
@@ -1320,6 +1322,7 @@ int main(int argc, char** argv) {
static uint64_t shownAt = 0;
if (!shownAt) {
g_ui->showTab(ui::Tab::Consoles);
+ if (g_autoplayConsolesEmpty) g_ui->setConsoles({}, true);
shownAt = now;
} else if (now - shownAt > 3000) {
saveCanvas("consoles.ppm");
diff --git a/src/ui/app_ui.cpp b/src/ui/app_ui.cpp
index 80c76a7..7c1383c 100644
--- a/src/ui/app_ui.cpp
+++ b/src/ui/app_ui.cpp
@@ -931,6 +931,13 @@ void AppUi::handleHome(const NavInput& in, UiEvent& ev) {
switch (tab_) {
case Tab::Consoles: {
int n = static_cast<int>(consoles_.size());
+ // Search again: Cross with none listed, Triangle otherwise.
+ if (consolesKnown_ && ((n == 0 && in.accept) || in.triangle)) {
+ if (n == 0) consolesKnown_ = false; // the spinner while it looks
+ ev.action = Action::ConsolesShown;
+ dirty_ = true;
+ break;
+ }
if (n == 0) break;
int before = consoleFocus_;
if (in.right && consoleFocus_ + 1 < n) ++consoleFocus_;
@@ -1421,6 +1428,24 @@ void AppUi::drawTabs(Canvas& c) {
namespace {
+// A QR code of `url` on a white card whose top-right corner is (right, top),
+// about `target` px of code; the card's rect (empty when it can't be encoded).
+Rect drawQr(Canvas& c, const std::string& url, int right, int top, int target) {
+ uint8_t qr[qrcodegen_BUFFER_LEN_MAX], tmp[qrcodegen_BUFFER_LEN_MAX];
+ if (!qrcodegen_encodeText(url.c_str(), tmp, qr, qrcodegen_Ecc_MEDIUM, qrcodegen_VERSION_MIN, qrcodegen_VERSION_MAX,
+ qrcodegen_Mask_AUTO, true))
+ return {};
+ int n = qrcodegen_getSize(qr);
+ int module = target / (n + 2), size = module * (n + 2);
+ Rect box{right - size - 40, top, size + 40, size + 40};
+ c.fillRect(box, kWhite, 20);
+ int ox = box.x + 20 + module, oy = box.y + 20 + module;
+ for (int yy = 0; yy < n; ++yy)
+ for (int xx = 0; xx < n; ++xx)
+ if (qrcodegen_getModule(qr, xx, yy)) c.fillRect({ox + xx * module, oy + yy * module, module, module}, kBg);
+ return box;
+}
+
const char* platformLabel(const std::string& code) {
if (code == "360") return "XBOX 360";
if (code == "ONE") return "XBOX ONE";
@@ -1680,14 +1705,34 @@ void AppUi::drawConsoles(Canvas& c, uint64_t nowMs) {
drawSpinner(c, kW / 2.0f, 520, 26, nowMs);
drawCentered(c, fonts_.semibold, tr(Str::ConsolesLoading), 580, 28, kGray);
animating_ = true;
+ drawHints(c, {{kIconOptions, tr(Str::Settings)}, {kIconTouchpad, tr(Str::HoldSignOut)}});
} else {
- int y = 480;
- for (const auto& line : fonts_.regular.wrap(tr(Str::NoConsoles), 28, 1200, 3)) {
- drawCentered(c, fonts_.regular, line, y, 28, kGray);
- y += 42;
+ // How a console shows up: three numbered steps, and Microsoft's
+ // help on the phone.
+ fonts_.bold.draw(c, tr(Str::NoConsoles), kMargin, 340, 40, kWhite);
+ int y = 420;
+ const Str steps[] = {Str::ConsoleStep1, Str::ConsoleStep2, Str::ConsoleStep3};
+ for (int i = 0; i < 3; ++i) {
+ c.fillCircle(static_cast<float>(kMargin + 22), static_cast<float>(y + 20), 22, kGreen);
+ std::string num = std::to_string(i + 1);
+ fonts_.bold.draw(c, num, kMargin + 22 - fonts_.bold.measure(num, 24) / 2,
+ fonts_.bold.centeredY(y - 2, 44, 24), 24, kWhite);
+ for (const auto& line : fonts_.regular.wrap(tr(steps[i]), 28, 980, 2)) {
+ fonts_.regular.draw(c, line, kMargin + 70, y + 2, 28, kGray);
+ y += 40;
+ }
+ y += 34;
+ }
+ Rect box = drawQr(c, "https://support.xbox.com/help/games-apps/game-setup-and-play/how-to-use-remote-play",
+ kW - kMargin, 330, 340);
+ if (box.w > 0) {
+ int w = fonts_.semibold.measure(tr(Str::ScanForHelp), 24);
+ fonts_.semibold.draw(c, tr(Str::ScanForHelp), box.x + (box.w - w) / 2, box.y + box.h + 22, 24, kWhite);
}
+ drawHints(c, {{kIconCross, tr(Str::SearchAgain)},
+ {kIconOptions, tr(Str::Settings)},
+ {kIconTouchpad, tr(Str::HoldSignOut)}});
}
- drawHints(c, {{kIconOptions, tr(Str::Settings)}, {kIconTouchpad, tr(Str::HoldSignOut)}});
drawPads(c);
return;
}
@@ -1725,7 +1770,10 @@ void AppUi::drawConsoles(Canvas& c, uint64_t nowMs) {
c.fillCircle(static_cast<float>(x + 32), static_cast<float>(kTop + 336), 6, on ? rgba(60, 200, 60) : kDim);
fonts_.semibold.draw(c, state, x + 48, kTop + 322, 24, on ? kWhite : kGray);
}
- drawHints(c, {{kIconCross, tr(Str::Play)}, {kIconOptions, tr(Str::Settings)}, {kIconTouchpad, tr(Str::HoldSignOut)}});
+ drawHints(c, {{kIconCross, tr(Str::Play)},
+ {kIconTriangle, tr(Str::SearchAgain)},
+ {kIconOptions, tr(Str::Settings)},
+ {kIconTouchpad, tr(Str::HoldSignOut)}});
drawPads(c);
}
@@ -1875,18 +1923,8 @@ void AppUi::drawDetails(Canvas& c, uint64_t nowMs) {
ty += 34;
}
}
- std::string url = "https://www.xbox.com/games/store/p/" + g->productId;
- uint8_t qr[qrcodegen_BUFFER_LEN_MAX], tmp[qrcodegen_BUFFER_LEN_MAX];
- if (qrcodegen_encodeText(url.c_str(), tmp, qr, qrcodegen_Ecc_MEDIUM, qrcodegen_VERSION_MIN,
- qrcodegen_VERSION_MAX, qrcodegen_Mask_AUTO, true)) {
- int n = qrcodegen_getSize(qr);
- int module = 440 / (n + 2), size = module * (n + 2);
- Rect box{kW - kMargin - size - 40, 190, size + 40, size + 40};
- c.fillRect(box, kWhite, 20);
- int ox = box.x + 20 + module, oy = box.y + 20 + module;
- for (int yy = 0; yy < n; ++yy)
- for (int xx = 0; xx < n; ++xx)
- if (qrcodegen_getModule(qr, xx, yy)) c.fillRect({ox + xx * module, oy + yy * module, module, module}, kBg);
+ Rect box = drawQr(c, "https://www.xbox.com/games/store/p/" + g->productId, kW - kMargin, 190, 440);
+ if (box.w > 0) {
const char* scan = tr(g->freeInStore ? Str::ScanToGet : Str::ScanToBuy);
int w = fonts_.semibold.measure(scan, 26);
fonts_.semibold.draw(c, scan, box.x + (box.w - w) / 2, box.y + box.h + 22, 26, kWhite);
diff --git a/src/ui/strings.cpp b/src/ui/strings.cpp
index ff1207f..35270ae 100644
--- a/src/ui/strings.cpp
+++ b/src/ui/strings.cpp
@@ -162,10 +162,15 @@ constexpr Column kEnglish = {
"Sleeping", // ConsoleSleeping
"Off", // ConsoleOff
"Looking for your consoles...", // ConsolesLoading
- "No Xbox found. On your Xbox, turn on Settings > Devices & connections > Remote features, with the Sleep power mode.", // NoConsoles
+ "No Xbox found yet", // NoConsoles
"Play your own Xbox here: its screen, games and apps.", // ConsolesHint
"Waking up your Xbox...", // WakingConsole
"%s did not answer. Check that Remote features are on and the power mode is Sleep, or turn it on, then try again.", // WakeFailed
+ "On your Xbox, sign in with this same Microsoft account.", // ConsoleStep1
+ "Settings > Devices & connections > Remote features: turn on remote features.", // ConsoleStep2
+ "Settings > General > Power options: choose Sleep, so it wakes up by itself.", // ConsoleStep3
+ "Scan for Microsoft's help", // ScanForHelp
+ "Search again", // SearchAgain
};
constexpr Column kPortugueseBR = {
@@ -298,10 +303,15 @@ constexpr Column kPortugueseBR = {
"Em espera",
"Desligado",
"Procurando seus consoles...",
- "Nenhum Xbox encontrado. No seu Xbox, ative Configurações > Dispositivos e conexões > Recursos remotos, com o modo de energia Suspensão.",
+ "Nenhum Xbox encontrado ainda",
"Jogue no seu próprio Xbox por aqui: a tela, os jogos e os apps dele.",
"Ligando o seu Xbox...",
"%s não respondeu. Confira se os Recursos remotos estão ativos e o modo de energia é Suspensão, ou ligue o console, e tente de novo.",
+ "No seu Xbox, entre com esta mesma conta Microsoft.",
+ "Configurações > Dispositivos e conexões > Recursos remotos: ative os recursos remotos.",
+ "Configurações > Geral > Opções de energia: escolha Suspensão, para ele acordar sozinho.",
+ "Escaneie para a ajuda da Microsoft",
+ "Procurar de novo",
};
constexpr Column kSpanish = {
@@ -434,10 +444,15 @@ constexpr Column kSpanish = {
"En reposo",
"Apagada",
"Buscando tus consolas...",
- "No se encontró ninguna Xbox. En tu Xbox, activa Configuración > Dispositivos y conexiones > Funciones remotas, con el modo de energía Suspensión.",
+ "Aún no se encontró ninguna Xbox",
"Juega en tu propia Xbox desde aquí: su pantalla, juegos y aplicaciones.",
"Encendiendo tu Xbox...",
"%s no respondió. Comprueba que las Funciones remotas estén activadas y el modo de energía sea Suspensión, o enciéndela, y vuelve a intentarlo.",
+ "En tu Xbox, inicia sesión con esta misma cuenta Microsoft.",
+ "Configuración > Dispositivos y conexiones > Funciones remotas: activa las funciones remotas.",
+ "Configuración > General > Opciones de energía: elige Suspensión, para que se encienda sola.",
+ "Escanea para ver la ayuda de Microsoft",
+ "Buscar de nuevo",
};
constexpr Column kFrench = {
@@ -570,10 +585,15 @@ constexpr Column kFrench = {
"En veille",
"Éteinte",
"Recherche de vos consoles...",
- "Aucune Xbox trouvée. Sur votre Xbox, activez Paramètres > Appareils et connexions > Fonctionnalités à distance, avec le mode d'alimentation Veille.",
+ "Aucune Xbox trouvée pour l'instant",
"Jouez sur votre propre Xbox d'ici : son écran, ses jeux et ses applications.",
"Réveil de votre Xbox...",
"%s n'a pas répondu. Vérifiez que les fonctionnalités à distance sont activées et le mode Veille choisi, ou allumez-la, puis réessayez.",
+ "Sur votre Xbox, connectez-vous avec ce même compte Microsoft.",
+ "Paramètres > Appareils et connexions > Fonctionnalités à distance : activez-les.",
+ "Paramètres > Général > Options d'alimentation : choisissez Veille, pour qu'elle se réveille seule.",
+ "Scannez pour l'aide de Microsoft",
+ "Rechercher à nouveau",
};
constexpr Column kGerman = {
@@ -706,10 +726,15 @@ constexpr Column kGerman = {
"Im Standby",
"Aus",
"Deine Konsolen werden gesucht...",
- "Keine Xbox gefunden. Aktiviere auf deiner Xbox Einstellungen > Geräte & Verbindungen > Remotefunktionen, mit dem Energiemodus Ruhezustand.",
+ "Noch keine Xbox gefunden",
"Spiele hier auf deiner eigenen Xbox: ihr Bildschirm, ihre Spiele und Apps.",
"Deine Xbox wird geweckt...",
"%s hat nicht geantwortet. Prüfe, ob die Remotefunktionen aktiv sind und der Energiemodus Ruhezustand ist, oder schalte sie ein und versuche es erneut.",
+ "Melde dich auf deiner Xbox mit genau diesem Microsoft-Konto an.",
+ "Einstellungen > Geräte & Verbindungen > Remotefunktionen: Remotefunktionen aktivieren.",
+ "Einstellungen > Allgemein > Energieoptionen: Ruhezustand wählen, damit sie von selbst aufwacht.",
+ "Scannen für die Hilfe von Microsoft",
+ "Erneut suchen",
};
constexpr Column kItalian = {
@@ -842,10 +867,15 @@ constexpr Column kItalian = {
"In standby",
"Spenta",
"Ricerca delle tue console...",
- "Nessuna Xbox trovata. Sulla tua Xbox attiva Impostazioni > Dispositivi e connessioni > Funzionalità remote, con la modalità di alimentazione Sospensione.",
+ "Nessuna Xbox trovata per ora",
"Gioca sulla tua Xbox da qui: il suo schermo, i giochi e le app.",
"Accensione della tua Xbox...",
"%s non ha risposto. Controlla che le Funzionalità remote siano attive e la modalità sia Sospensione, oppure accendila, e riprova.",
+ "Sulla tua Xbox, accedi con questo stesso account Microsoft.",
+ "Impostazioni > Dispositivi e connessioni > Funzionalità remote: attiva le funzionalità remote.",
+ "Impostazioni > Generale > Opzioni di alimentazione: scegli Sospensione, così si accende da sola.",
+ "Scansiona per l'aiuto di Microsoft",
+ "Cerca di nuovo",
};
constexpr std::array<const Column*, kLangs> kTable = {&kEnglish, &kPortugueseBR, &kSpanish,
diff --git a/src/ui/strings.h b/src/ui/strings.h
index e539fb6..89544d8 100644
--- a/src/ui/strings.h
+++ b/src/ui/strings.h
@@ -139,10 +139,15 @@ enum class Str {
ConsoleSleeping,
ConsoleOff,
ConsolesLoading,
- NoConsoles, // none, or remote features off
+ NoConsoles, // heading when none is found
ConsolesHint, // under the tab's title
WakingConsole, // the loading screen while the Xbox wakes up
WakeFailed, // "%s" = the console's name
+ ConsoleStep1, // how a console shows up, three steps
+ ConsoleStep2,
+ ConsoleStep3,
+ ScanForHelp, // under the QR code of Microsoft's Remote Play help
+ SearchAgain, // refresh the console list
Count
};