Skip to content

Xbox Cloud Gaming app for PS5 Homebrew

C

Tell the user when the console's clock breaks some content, not only sign-in

Rafael Abud Ferreirabc1b37427988
diff --git a/src/app/cli_main.cpp b/src/app/cli_main.cpp
index 3cccb6c..928fd58 100644
--- a/src/app/cli_main.cpp
+++ b/src/app/cli_main.cpp
@@ -613,8 +613,9 @@ int main(int argc, char** argv) {
req.url = argv[argi];
auto r = net::perform(req);
static const char* kProblems[] = {"none", "clock", "untrusted", "name mismatch", "other"};
- std::printf("status %d, problem: %s, date %s\nerror: %s\n", r.status,
- kProblems[static_cast<int>(net::lastTlsProblem())], net::todayText().c_str(), r.error.c_str());
+ std::printf("status %d, problem: %s, clock problem seen: %s, date %s\nerror: %s\n", r.status,
+ kProblems[static_cast<int>(net::lastTlsProblem())], net::clockProblemSeen() ? "yes" : "no",
+ net::todayText().c_str(), r.error.c_str());
return 0;
} else if (cmd == "ui-tls" && argi < argc) {
// Offline: the sign-in errors for a refused certificate (the
diff --git a/src/app/ps5_main.cpp b/src/app/ps5_main.cpp
index 9a9634e..2af4e4c 100644
--- a/src/app/ps5_main.cpp
+++ b/src/app/ps5_main.cpp
@@ -284,6 +284,15 @@ int main(int argc, char** argv) {
ui::tr(ui::Str::CrashedLastTime));
}
}
+ // A Microsoft service refused for the console's clock: said once, even
+ // if signing in worked (only some content then fails to load).
+ static bool clockTold = false;
+ if (!clockTold && net::clockProblemSeen()) {
+ clockTold = true;
+ // Not over the sign-in error that already says it.
+ if (g_ui->screen() != ui::Screen::Error)
+ platform::notify(ui::trf(ui::Str::ClockWrongNotice, net::todayText()), "the console's clock looks wrong (notification)");
+ }
if (g_restartWanted) {
// After an update: the new version, started in place of this one.
if (!g_autoplay.noRestart) platform::restartApp();
diff --git a/src/net/http.cpp b/src/net/http.cpp
index a6a8965..af36825 100644
--- a/src/net/http.cpp
+++ b/src/net/http.cpp
@@ -204,7 +204,19 @@ bool g_builtinCa = false;
std::atomic<int> g_tlsProblem{0}; // TlsProblem
+std::atomic<bool> g_clockSeen{false};
+
TlsProblem lastTlsProblem() { return static_cast<TlsProblem>(g_tlsProblem.load()); }
+bool clockProblemSeen() { return g_clockSeen; }
+
+bool microsoftHost(const std::string& host) {
+ for (const char* domain : {"xboxlive.com", "microsoft.com", "s-microsoft.com", "live.com", "xbox.com", "gamepass.com"}) {
+ std::string d = domain;
+ if (host == d || (host.size() > d.size() && host.compare(host.size() - d.size() - 1, d.size() + 1, "." + d) == 0))
+ return true;
+ }
+ return false;
+}
std::string todayText() {
std::time_t now = std::time(nullptr);
@@ -345,6 +357,7 @@ Response performOnce(const Request& req) {
: flags & MBEDTLS_X509_BADCERT_NOT_TRUSTED ? TlsProblem::Untrusted
: TlsProblem::Other;
g_tlsProblem = static_cast<int>(problem);
+ if (problem == TlsProblem::Clock && microsoftHost(url.host)) g_clockSeen = true;
char info[512];
int n = mbedtls_x509_crt_verify_info(info, sizeof info, "", flags);
std::string why = n > 0 ? std::string(info, static_cast<size_t>(n)) : "flags " + std::to_string(flags);
diff --git a/src/net/http.h b/src/net/http.h
index 22798bc..bcc23ce 100644
--- a/src/net/http.h
+++ b/src/net/http.h
@@ -68,6 +68,14 @@ bool usingBuiltinCa();
// site), or another reason.
enum class TlsProblem { None, Clock, Untrusted, NameMismatch, Other };
TlsProblem lastTlsProblem();
+// Since start, a Microsoft service (xboxlive.com, (s-)microsoft.com, live.com,
+// xbox.com, gamepass.com) refused for the clock: the console's date is
+// surely wrong, even when signing in still works (certificates renewed after
+// that date fail: prices, images, the user's consoles...). Kept for the whole
+// session.
+bool clockProblemSeen();
+// The hosts that count for clockProblemSeen().
+bool microsoftHost(const std::string& host);
// The console's date, "2026-10-14" (for the messages about its clock).
std::string todayText();
// Trusts the certificates in this PEM file too (the update test's local
diff --git a/src/ui/strings.cpp b/src/ui/strings.cpp
index ab7f5b0..1da216a 100644
--- a/src/ui/strings.cpp
+++ b/src/ui/strings.cpp
@@ -258,6 +258,7 @@ constexpr Column kEnglish = {
"United States", // CountryUS
"Secure connections were refused because the PS5's date and time look wrong (it says %s). Set them in Settings > System > Date and Time, then try again.", // ClockWrong
"A secure connection was refused: something on the network (a DNS server, proxy or filter) is answering for Microsoft's sites. Try without it, then try again.", // ConnectionIntercepted
+ "PS5 date and time look wrong (%s): some content can't load. Set them in Settings > System > Date and Time.", // ClockWrongNotice
};
constexpr Column kPortugueseBR = {
@@ -486,6 +487,7 @@ constexpr Column kPortugueseBR = {
"Estados Unidos",
"As conexões seguras foram recusadas porque a data e a hora do PS5 parecem erradas (ele diz %s). Acerte em Configurações > Sistema > Data e hora e tente de novo.",
"Uma conexão segura foi recusada: algo na rede (um servidor DNS, proxy ou filtro) está respondendo no lugar dos sites da Microsoft. Tente sem ele e tente de novo.",
+ "A data e a hora do PS5 parecem erradas (%s): parte do conteúdo não carrega. Acerte em Configurações > Sistema > Data e hora.",
};
constexpr Column kSpanish = {
@@ -714,6 +716,7 @@ constexpr Column kSpanish = {
"Estados Unidos",
"Se rechazaron las conexiones seguras porque la fecha y la hora de la PS5 parecen incorrectas (indica %s). Ajústalas en Ajustes > Sistema > Fecha y hora y vuelve a intentarlo.",
"Se rechazó una conexión segura: algo en la red (un servidor DNS, proxy o filtro) responde en lugar de los sitios de Microsoft. Prueba sin él y vuelve a intentarlo.",
+ "La fecha y la hora de la PS5 parecen incorrectas (%s): parte del contenido no carga. Ajústalas en Ajustes > Sistema > Fecha y hora.",
};
constexpr Column kFrench = {
@@ -942,6 +945,7 @@ constexpr Column kFrench = {
"États-Unis",
"Les connexions sécurisées ont été refusées car la date et l'heure de la PS5 semblent fausses (elle indique %s). Réglez-les dans Paramètres > Système > Date et heure, puis réessayez.",
"Une connexion sécurisée a été refusée : quelque chose sur le réseau (serveur DNS, proxy ou filtre) répond à la place des sites de Microsoft. Essayez sans, puis réessayez.",
+ "La date et l'heure de la PS5 semblent fausses (%s) : une partie du contenu ne se charge pas. Réglez-les dans Paramètres > Système > Date et heure.",
};
constexpr Column kGerman = {
@@ -1170,6 +1174,7 @@ constexpr Column kGerman = {
"USA",
"Sichere Verbindungen wurden abgelehnt, weil Datum und Uhrzeit der PS5 falsch zu sein scheinen (sie zeigt %s). Stelle sie unter Einstellungen > System > Datum und Uhrzeit ein und versuche es erneut.",
"Eine sichere Verbindung wurde abgelehnt: Etwas im Netzwerk (DNS-Server, Proxy oder Filter) antwortet anstelle der Microsoft-Seiten. Versuche es ohne und dann erneut.",
+ "Datum und Uhrzeit der PS5 scheinen falsch zu sein (%s): Einige Inhalte laden nicht. Stelle sie unter Einstellungen > System > Datum und Uhrzeit ein.",
};
constexpr Column kItalian = {
@@ -1398,6 +1403,7 @@ constexpr Column kItalian = {
"Stati Uniti",
"Le connessioni sicure sono state rifiutate perché la data e l'ora della PS5 sembrano errate (indica %s). Impostale in Impostazioni > Sistema > Data e ora, poi riprova.",
"Una connessione sicura è stata rifiutata: qualcosa nella rete (un server DNS, proxy o filtro) risponde al posto dei siti Microsoft. Prova senza e riprova.",
+ "La data e l'ora della PS5 sembrano errate (%s): alcuni contenuti non si caricano. Impostale in Impostazioni > Sistema > Data e ora.",
};
constexpr std::array<const Column*, kLangs> kTable = {&kEnglish, &kPortugueseBR, &kSpanish,
diff --git a/src/ui/strings.h b/src/ui/strings.h
index 70362c0..c40e390 100644
--- a/src/ui/strings.h
+++ b/src/ui/strings.h
@@ -235,6 +235,7 @@ enum class Str {
CountryUS,
ClockWrong, // a certificate refused for the console's date: "%s" = that date
ConnectionIntercepted, // a certificate refused as untrusted or for another name
+ ClockWrongNotice, // notification: signed in, but some content refused for the clock; "%s" = the date
Count
};
diff --git a/tests/test_main.cpp b/tests/test_main.cpp
index e65f0db..0f71f9a 100644
--- a/tests/test_main.cpp
+++ b/tests/test_main.cpp
@@ -747,6 +747,15 @@ static void testStoreLeftovers() {
std::system("rm -rf /tmp/xcloud-store-test");
}
+static void testMicrosoftHost() {
+ // The services whose refusal for the clock says the console's date is wrong.
+ for (const char* h : {"login.live.com", "displaycatalog.mp.microsoft.com", "xhome.gssv-play-prod.xboxlive.com",
+ "store-images.s-microsoft.com", "www.xbox.com", "catalog.gamepass.com", "xboxlive.com"})
+ CHECK(net::microsoftHost(h));
+ for (const char* h : {"expired.badssl.com", "evilxboxlive.com", "microsoft.com.evil.example", "github.com", ""})
+ CHECK(!net::microsoftHost(h));
+}
+
static void testHostPacer() {
// Five a second per Microsoft host; other hosts never wait; a 429 holds
// the host for its Retry-After (30 s at most).
@@ -816,6 +825,7 @@ int main() {
testPrivacyAndRobustness();
testStoreLeftovers();
testHostPacer();
+ testMicrosoftHost();
testAudioEncoder();
testAutoDeband();
testControllerTuning();