Xbox Cloud Gaming app for PS5 Homebrew
C
120 Hz output as a Setting, off by default (VRR on OLED TVs may flicker)
Rafael Abud Ferreirab9b99e0a3172
diff --git a/README.md b/README.mdindex e1bbd4a..c175f0c 100644--- a/README.md+++ b/README.md@@ -106,6 +106,14 @@ tools/ps5/link.sh build-ps5 # -> build-ps5/eboot.bintools/ps5/package.sh build-ps5 # -> build-ps5/pkg/PPSA99810/```+**120 Hz output** (Settings, off by default) needs RADV with+`tools/ps5/patches/mesa-videoout-vrr-120hz.patch`: with the console's VRR on, a+120 Hz request becomes VRR 119.88 Hz, whose idle vblank (the TV's VRR floor,+~48 Hz) the unpatched check takes for 60 Hz and undoes. Apply it to PS5_Mesa at+PS5_Vulkan's pinned revision on a local branch, then+`PS5_MESA_REVISION=<that commit> tools/build-radv.sh release` in PS5_Vulkan. Without+it the option simply stays at 59.94 Hz.+A release is built, signed and checked with `tools/release.sh <X.Y.Z>`(see the script's header); it publishes nothing. The signing key stays withthe maintainer: the app trusts only its public half (`src/app/updater.cpp`).diff --git a/ps5/sce_sys/param.json b/ps5/sce_sys/param.jsonindex 3aa43e9..d97c512 100644--- a/ps5/sce_sys/param.json+++ b/ps5/sce_sys/param.json@@ -6,7 +6,7 @@"applicationDrmType": "free","attribute": 0,"attribute2": 0,- "attribute3": 524352,+ "attribute3": 262208,"conceptId": "99810","contentBadgeType": 1,"contentId": "UP9000-PPSA99810_00-XCLOUDPS5CLI0000",diff --git a/src/app/ps5_main.cpp b/src/app/ps5_main.cppindex 4f4b02c..0918234 100644--- a/src/app/ps5_main.cpp+++ b/src/app/ps5_main.cpp@@ -121,6 +121,7 @@ bool saveSettings(const ui::SettingsChoice& choice) {g_settings.sharpness = choice.sharpness;g_settings.deband = choice.deband;g_settings.upscaler = choice.upscaler;+ g_settings.highRefresh = choice.highRefresh;g_settings.save(settingsPath()); // warns itselfXC_LOGI("settings saved: language %s, %s, region %s", code.c_str(), g_settings.resolution.c_str(),g_settings.region.empty() ? "auto" : g_settings.region.c_str());@@ -189,6 +190,16 @@ int main(int argc, char** argv) {XC_LOGI("settings: language %s, %s, region %s", g_settings.language.c_str(), g_settings.resolution.c_str(),g_settings.region.empty() ? "auto" : g_settings.region.c_str());sceSystemServiceHideSplashScreen();+ // 120 Hz output: param.json declares it (the console grants the mode only+ // then), and RADV asks for it when the param.json it reads says so. Off+ // (the default: OLED TVs may flicker under VRR in the menus), RADV reads+ // one that doesn't. Decided once per start, as RADV opens VideoOut once.+ if (!g_settings.highRefresh) {+ std::string path = platform::dataDir() + "/videoout-60hz.json";+ platform::writeFileAtomic(path, "{\"attribute3\": 0}\n");+ ::setenv("PS5_VIDEOOUT_PARAM_JSON", path.c_str(), 1);+ }+ XC_LOGI("display: 120 Hz output %s", g_settings.highRefresh ? "on" : "off");if (g_autoplay.vkTest) {bool ok = display::gpu::init();@@ -226,6 +237,7 @@ int main(int argc, char** argv) {choice.sharpness = g_settings.sharpness;choice.deband = g_settings.deband;choice.upscaler = g_settings.upscaler;+ choice.highRefresh = g_settings.highRefresh;g_ui->setAllow1440(allow1440Locked());g_ui->setUpdateState(XC_APP_VERSION, {}, false); // Settings shows this version before any checkg_ui->setSettings(choice);diff --git a/src/app/settings.cpp b/src/app/settings.cppindex da5c4dc..9463364 100644--- a/src/app/settings.cpp+++ b/src/app/settings.cpp@@ -50,6 +50,7 @@ bool Settings::load(const std::string& path) {}gestureHints = static_cast<int>((*j)["gestureHints"].asInt(gestureHints));micEnabled = (*j)["micEnabled"].asBool(micEnabled);+ highRefresh = (*j)["highRefresh"].asBool(highRefresh);micGain = static_cast<int>(std::clamp<int64_t>((*j)["micGain"].asInt(micGain), 0, 2));audioRoute = static_cast<int>(std::clamp<int64_t>((*j)["audioRoute"].asInt(audioRoute), 0, 1));skippedUpdate = (*j)["skippedUpdate"].str();@@ -154,6 +155,7 @@ bool Settings::save(const std::string& path) const {v.set("lightBarColour", std::string(hex));v.set("gestureHints", gestureHints);v.set("micEnabled", micEnabled);+ v.set("highRefresh", highRefresh);v.set("micGain", micGain);v.set("audioRoute", audioRoute);v.set("skippedUpdate", skippedUpdate);diff --git a/src/app/settings.h b/src/app/settings.hindex 760e2ee..8350361 100644--- a/src/app/settings.h+++ b/src/app/settings.h@@ -69,6 +69,7 @@ struct Settings {int gestureHints = 0;// Voice chat & Audio routingbool micEnabled = true;+ bool highRefresh = false; // 119.88 Hz output (VRR where the console turns it on); read at startint micGain = 1; // 0: 50%, 1: 100%, 2: 150%int audioRoute = 0; // 0: TV/HDMI (Main), 1: DualSense Speaker / Headset (Pad)// The release the user said "Not now" to: not offered again on start.diff --git a/src/ui/app_ui.cpp b/src/ui/app_ui.cppindex ba93bad..8a0ed2e 100644--- a/src/ui/app_ui.cpp+++ b/src/ui/app_ui.cpp@@ -1226,6 +1226,8 @@ std::vector<std::string> AppUi::settingOptions(int row) const {out = {tr(Str::LightBarGame), tr(Str::LightBarCustom), tr(Str::Deactivated)};} else if (row == 7) {// Updates: Cross acts, no list.+ } else if (row == 9) {+ out = {tr(Str::Deactivated), tr(Str::HighRefreshOn)};} else if (row == 8) {out.push_back(tr(Str::LoginCountryOff));for (const char* country : kLoginCountries) out.push_back(loginCountryName(country));@@ -1250,6 +1252,7 @@ int AppUi::settingSelected(int row) const {if (row == 5) return settings_.circleConfirms ? 1 : 0;if (row == 6) return settings_.lightBarMode;if (row == 7) return 0;+ if (row == 9) return settings_.highRefresh ? 1 : 0;if (row == 8) {for (size_t i = 0; i < std::size(kLoginCountries); ++i)if (settings_.loginCountry == kLoginCountries[i]) return static_cast<int>(i) + 1;@@ -1277,6 +1280,8 @@ void AppUi::applySetting(int row, int index) {} else if (row == 6) {settings_.lightBarMode = index;} else if (row == 7) {+ } else if (row == 9) {+ settings_.highRefresh = index == 1;} else if (row == 8) {settings_.loginCountry = index == 0 ? std::string() : kLoginCountries[index - 1];} else {@@ -3161,8 +3166,9 @@ void AppUi::drawSettings(Canvas& c) {fonts_.bold.draw(c, tr(Str::Settings), kMargin, 170, 60, kWhite);const char* labels[kSettingRows] = {tr(Str::Language), tr(Str::Resolution), tr(Str::Region),tr(Str::Deadzone), tr(Str::TriggerRumble), tr(Str::ConfirmButton),- tr(Str::LightBar), tr(Str::Updates), tr(Str::LoginCountry)};- constexpr int kRowW = 1200, kRowH = 60;+ tr(Str::LightBar), tr(Str::Updates), tr(Str::LoginCountry),+ tr(Str::HighRefresh)};+ constexpr int kRowW = 1200, kRowH = 56, kGap = 8;Rect rows[kSettingRows];int y = 262;for (int i = 0; i < kSettingRows; ++i) {@@ -3181,7 +3187,7 @@ void AppUi::drawSettings(Canvas& c) {Color color = !updateAvailable_.empty() && !updateChecking_ ? rgba(120, 220, 120) : focused ? kWhite : kGray;int w = fonts_.regular.measure(value, 30);fonts_.regular.draw(c, value, r.x + r.w - 44 - w, fonts_.regular.centeredY(r.y, r.h, 30), 30, color);- y += kRowH + 10;+ y += kRowH + kGap;continue;}// The value, then a chevron: this opens a list.@@ -3203,7 +3209,7 @@ void AppUi::drawSettings(Canvas& c) {c.strokeArc(vx - w - 30.0f, cy, 14, 2, 0, 6.2832f, rgba(255, 255, 255, 120));}}- y += kRowH + 10;+ y += kRowH + kGap;}for (const auto& line : fonts_.regular.wrap(tr(Str::SettingsNote), 24, kRowW, 2)) {fonts_.regular.draw(c, line, kMargin, y + 20, 24, kDim);diff --git a/src/ui/app_ui.h b/src/ui/app_ui.hindex c1d56a5..cfc6eb3 100644--- a/src/ui/app_ui.h+++ b/src/ui/app_ui.h@@ -113,12 +113,13 @@ struct SettingsChoice {int sharpness = 0;int deband = 3;int upscaler = 2;+ bool highRefresh = false; // 120 Hz output, from the next start};// The largest stick dead zone Settings offers, in percent of the travel.constexpr int kMaxDeadzone = 30;-constexpr int kSettingRows = 9; // language, resolution, region, dead zone, triggers, confirm, light bar, updates,- // sign-in country+constexpr int kSettingRows = 10; // language, resolution, region, dead zone, triggers, confirm, light bar, updates,+ // sign-in country, 120 Hz output// The countries "Sign in as another country" offers (xcloud::loginCountryAddress).constexpr const char* kLoginCountries[] = {"br", "jp", "kr", "pl", "us"};diff --git a/src/ui/strings.cpp b/src/ui/strings.cppindex 64af23e..32ef3aa 100644--- a/src/ui/strings.cpp+++ b/src/ui/strings.cpp@@ -260,6 +260,8 @@ constexpr Column kEnglish = {"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"Your sign-in couldn't be saved on the console, so it will be asked again next time. Please report it (Settings > △).", // SignInNotSaved+ "120 Hz output (VRR)", // HighRefresh+ "On (after restarting the app)", // HighRefreshOn};constexpr Column kPortugueseBR = {@@ -490,6 +492,8 @@ constexpr Column kPortugueseBR = {"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.","Não foi possível salvar o login no console, então ele será pedido de novo na próxima vez. Relate o problema (Configurações > △).",+ "Saída 120 Hz (VRR)", // HighRefresh+ "Ativada (ao reabrir o app)", // HighRefreshOn};constexpr Column kSpanish = {@@ -720,6 +724,8 @@ constexpr Column kSpanish = {"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.","No se pudo guardar el inicio de sesión en la consola, así que se pedirá de nuevo la próxima vez. Infórmalo (Ajustes > △).",+ "Salida 120 Hz (VRR)", // HighRefresh+ "Activada (al reabrir la app)", // HighRefreshOn};constexpr Column kFrench = {@@ -950,6 +956,8 @@ constexpr Column kFrench = {"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.","Impossible d'enregistrer la connexion sur la console : elle sera redemandée la prochaine fois. Signalez-le (Paramètres > △).",+ "Sortie 120 Hz (VRR)", // HighRefresh+ "Activée (au redémarrage de l'app)", // HighRefreshOn};constexpr Column kGerman = {@@ -1180,6 +1188,8 @@ constexpr Column kGerman = {"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.","Die Anmeldung konnte nicht auf der Konsole gespeichert werden und wird beim nächsten Mal erneut abgefragt. Bitte melde das (Einstellungen > △).",+ "120-Hz-Ausgabe (VRR)", // HighRefresh+ "An (nach Neustart der App)", // HighRefreshOn};constexpr Column kItalian = {@@ -1410,6 +1420,8 @@ constexpr Column kItalian = {"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.","Impossibile salvare l'accesso sulla console: verrà richiesto di nuovo la prossima volta. Segnalalo (Impostazioni > △).",+ "Uscita 120 Hz (VRR)", // HighRefresh+ "Attiva (al riavvio dell'app)", // HighRefreshOn};constexpr std::array<const Column*, kLangs> kTable = {&kEnglish, &kPortugueseBR, &kSpanish,diff --git a/src/ui/strings.h b/src/ui/strings.hindex 1187eee..cf8e888 100644--- a/src/ui/strings.h+++ b/src/ui/strings.h@@ -237,6 +237,8 @@ enum class Str {ConnectionIntercepted, // a certificate refused as untrusted or for another nameClockWrongNotice, // notification: signed in, but some content refused for the clock; "%s" = the dateSignInNotSaved, // notification: the sign-in couldn't be written (asked again next start)+ HighRefresh, // Settings row: 119.88 Hz output+ HighRefreshOn, // ... its "on" choice (applies when the app starts again)Count};diff --git a/tools/ps5/patches/mesa-videoout-vrr-120hz.patch b/tools/ps5/patches/mesa-videoout-vrr-120hz.patchnew file mode 100644index 0000000..7cf1388--- /dev/null+++ b/tools/ps5/patches/mesa-videoout-vrr-120hz.patch@@ -0,0 +1,43 @@+From e1f8e11d8ccc80f91bd5a1f575b64aebe3b9acc3 Mon Sep 17 00:00:00 2001+From: Rafael Abud Ferreira <[email protected]>+Date: Thu, 15 Oct 2026 11:59:25 -0300+Subject: [PATCH] wsi/videoout: a VRR 119.88 Hz output counts (its idle vblank+ is the VRR floor)++Co-Authored-By: Claude Opus 5.5 <[email protected]>+---+ src/vulkan/wsi/wsi_common_videoout.c | 11 ++++++++++-+ 1 file changed, 10 insertions(+), 1 deletion(-)++diff --git a/src/vulkan/wsi/wsi_common_videoout.c b/src/vulkan/wsi/wsi_common_videoout.c+index 1f59ac2120e..2d6558e62e3 100644+--- a/src/vulkan/wsi/wsi_common_videoout.c++++ b/src/vulkan/wsi/wsi_common_videoout.c+@@ -74,6 +74,12 @@+ * went on refreshing at 60 Hz, as a tester's did (PS5_Vulkan, R31). */+ #define VIDEOOUT_HIGH_REFRESH_LIMIT_NS UINT64_C(12500000)+ #define VIDEOOUT_PERIOD_INTERVALS 6++/* With the system's VRR on, a 120 Hz request becomes VRR 119.88 Hz (AvControl:++ * "119.88Hz request is converted to VRR 119.88Hz"): the display then waits for++ * flips, and before the first one a vblank comes at its VRR floor (20.873 ms on++ * an LG C1, about 48 Hz), longer than a 60 Hz period. Only a period up to this++ * one, about 60 Hz, means the display stayed at 60 Hz (PSBox, 2026-10-15). */++#define VIDEOOUT_FIXED_60HZ_MAX_NS UINT64_C(18500000)+ /* param.json's attribute3 bit for 120 Hz output. PS5_Vulkan R31/R92 declared it with 0x80000+ * (a 120 Hz mode that requires VRR), which turns the system's VRR off; retail titles with VRR+ * declare 0x40 with 0x40000. VideoOut itself grants mode 15 or refuses it. */+@@ -390,7 +396,10 @@ videoout_open_locked(void)+ if (out->high_frame_rate) {+ /* A period of 0 is a failed wait: never taken for 119.88 Hz */+ const uint64_t period = videoout_vblank_period_ns(out->handle);+- if (period == 0 || period > VIDEOOUT_HIGH_REFRESH_LIMIT_NS) {++ if (period > VIDEOOUT_FIXED_60HZ_MAX_NS) {++ fprintf(stderr, "wsi/videoout: 119.88 Hz taken as VRR (an idle vblank every %.3f ms)\n",++ (double)period / 1e6);++ } else if (period == 0 || period > VIDEOOUT_HIGH_REFRESH_LIMIT_NS) {+ sceVideoOutConfigureOutput(out->handle, PS5_VIDEO_OUT_MODE_RESTORE, NULL, NULL, NULL);+ out->high_frame_rate = false;+ if (period == 0)+--+2.55.0+