Skip to content

Xbox Cloud Gaming app for PS5 Homebrew

C

feat(release): v1.4.0 with web panel, rating badges, bitrate slider, and audio polish

Rafael Abud Ferreiraf4e3d41c0128
diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml
index 31e190e..1e047c5 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.yml
+++ b/.github/ISSUE_TEMPLATE/bug_report.yml
@@ -20,6 +20,17 @@ body:
description: What you did, what you expected, and what you saw (error text, black screen, crash, no sound...).
validations:
required: true
+ - type: dropdown
+ id: platform
+ attributes:
+ label: Platform
+ description: Platform where you run the application.
+ options:
+ - PlayStation 5 (PPSA99810)
+ - Linux
+ - Other
+ validations:
+ required: true
- type: input
id: release
attributes:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 561a2f7..1e443d0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# Copyright (C) 2026 RafaelNGP
cmake_minimum_required(VERSION 3.20)
-project(xcloud_ps5 VERSION 1.3.4 LANGUAGES C CXX)
+project(xcloud_ps5 VERSION 1.4.0 LANGUAGES C CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
@@ -102,6 +102,7 @@ add_library(xcloud_ui STATIC
src/app/crash_guard.cpp
src/app/updater.cpp
src/app/auto_deband.cpp
+ src/app/web_server.cpp
extern/qrcodegen/qrcodegen.c
)
target_compile_definitions(xcloud_ui PUBLIC XC_APP_VERSION="${PROJECT_VERSION}")
diff --git a/ROADMAP.md b/ROADMAP.md
index 70f0845..1906bef 100644
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@ -4,7 +4,7 @@ Where PSBox Cloud Gaming goes next, most valuable first. Each item says why it
matters, what "done" looks like, and how it is measured on the console.
Status: **next** (being worked on), **planned**, **later**, **dropped**.
-Last update: 2026-10-21, v1.3.4.
+Last update: 2026-10-21, v1.4.0.
## Now
@@ -255,12 +255,13 @@ is rolled back at the next start), then the app restarts itself
| **Network test in Settings** (done) | Round trip, jitter and loss to each region, and the bandwidth a stream would get, with a suggestion (region, bitrate cap); also kept in the report, for troubleshooting | small–medium |
| **Achievements on the game page** (done) | Progress and gamerscore for the game, the unlocked / locked list; popup achievement viewer with L3, gamerscore disc pill on details | medium |
| **Store wishlist** (done) | Toggle titles on Details with R3, dedicated Wishlist row in Library, notify on sales or Game Pass entry | small–medium |
-| **Playtime per game on the card** (done) | The time played (the app already measures it) shown on each card and on the game page | small |
-| **Web configuration panel via QR code** | A QR code in Settings that opens a local web interface on a phone/PC browser to view live session stats, adjust controller mappings, tweak network settings and options comfortably | medium |
-| **Steam Deck + AppImage** | The Linux build as an AppImage (one file, runs on SteamOS and most distributions; glibc baseline from CI's ubuntu-24.04), attached to each release by the Linux workflow; on the Deck: gamescope / Game Mode, the 1280x800 screen (UI scale), the Deck's own controls and gyro through SDL, added to Steam as a non-Steam game | small–medium |
+| **Web configuration panel via QR code** (done) | Embedded micro HTTP server on port 8080 with QR Code in Settings, remote keyboard for TV search, interactive controller and keyboard remapping, direct sanitized log download | medium |
+| **Steam Deck + AppImage** (done) | Standalone universal AppImage packaging script (`tools/desktop/package-appimage.sh`), bundling SDL3, AppRun, icon, desktop file, full compatibility with SteamOS/Steam Deck gamescope and Linux distros | small–medium |
+| **Age rating on game details** (done) | Official age classification badge (ClassInd for Brazil, ESRB for US, PEGI for EU) with color coding and content descriptors on the details page | small–medium |
| **Discord Rich Presence (desktop)** | "Playing Fortnite on PSBox" with the game's art and elapsed time, through the local Discord client's IPC (no account data sent); an on/off in Settings; desktop only (capability-gated, a no-op on the PS5) | small |
| **Mouse in the desktop UI** | Today the mouse only goes to the game (native MKB / mouse as a stick); on desktop menus, hover moves the focus and a click presses (cards, rows, buttons, dropdowns, the search keys), the wheel scrolls; never on the PS5, never during a game | small–medium |
-| **Windows (M2)** | The desktop app for Windows, cross-built with llvm-mingw, tested under wine (`docs/multiplatform.md`) | medium |
+| **Windows (planned)** | The desktop app for Windows, cross-built with llvm-mingw, tested under wine (`docs/multiplatform.md`) | medium |
+| **Android (planned)** | Native Android client with touch overlay, controller support and hardware video decoding | medium |
| Ideas to weigh (no decision yet) | A first-run guide (sign-in, region, controls) | — |
## Dropped (and why)
diff --git a/notes.md b/notes.md
index 546d48e..43c91b7 100644
--- a/notes.md
+++ b/notes.md
@@ -1,27 +1,47 @@
-## Novidades e Melhorias no v1.3.4
-
-### 🔊 Alerta Sonoro de Fila no DualSense (Queue-Ready)
-- **Áudio no Alto-falante do Controle**: O aviso sonoro de jogo pronto na fila agora toca diretamente pelo alto-falante integrado do DualSense (`PADSPK`), além do sinal tátil (vibração).
-- **Sem Popups de Debug**: Ao testar o som do alerta nas Configurações pressionando <kbd>▢</kbd>, o som é reproduzido de forma limpa pelo controle, sem exibir popups ou toasts técnicos na tela.
-
-### ⭐ Lista de Desejos (Wishlist)
-- **Acesso Dedicado pela Pesquisa**: Para acessar a lista de desejos, abra a pesquisa na aba **"Meus jogos"** e ative o filtro **"Lista de desejos"**.
-- **Preços Atualizados e Estado Vazio**: Exibe apenas os jogos marcados com seus valores da loja atualizados em tempo real, ou a mensagem *"A lista de desejos está vazia"* caso não haja itens favoritados.
-- **Destaque na Biblioteca**: Jogos da lista de desejos recebem um selo com **estrela azul** no canto superior direito do card na seção *"Disponíveis para comprar"* e são fixados sempre no **topo da lista** em qualquer tipo de ordenação.
-- **Regra de Adição**: Apenas títulos não adquiridos podem ser adicionados à lista de desejos.
-
-### 🎨 Diagramação Visual e Padronização
-- **Separação de Selos nos Cards**: O selo do console (`SERIES X|S`, `XBOX ONE`) foi ajustado para largura proporcional compacta, e o selo de controle/teclado foi centralizado, eliminando qualquer colisão ou sobreposição com os selos de preço e jogos gratuitos.
-- **Alinhamento dos Rótulos de Ordenação**: Os textos *"Ordenar: Recentes primeiro"*, *"Ordenar: A-Z"* e *"Ordenar: Por console"* agora estão alinhados de forma precisa com as informações do perfil do usuário no cabeçalho superior direito.
-- **Padronização dos Botões da UI**: Os atalhos <kbd>L3</kbd> (*Atualizar*) e <kbd>R3</kbd> (*Ordenar*) foram padronizados na mesma geometria arredondada de pílula dos botões <kbd>L2</kbd> / <kbd>R2</kbd>.
-
-### ⚙️ Ajustes nas Configurações
-- **Remoção de Opção Obsoleta**: Removida a opção redundante *"Volume do jogo"*.
-- **Reorganização de Controles**: A categoria Controles agora segue a ordem intuitiva:
- *Botões do controle → Teclas do teclado → Zona morta dos analógicos → Mira por giroscópio → Vibração dos gatilhos → Botão de confirmar → Barra de luz → Aviso sonoro de fila pronta*.
-
----
-### 📦 Assets da Release
-- `PPSA99810.zip`: Pacote oficial limpo pronto para instalação no PS5 via ProsperoStore / Direct Package Installer.
-- `PPSA99810.zip.sig`: Assinatura criptográfica ECDSA para o in-app updater oficial.
-- `PPSA99810.zip.sha256`: Checksum SHA-256 de integridade.
+<!-- LANG:PT -->
+## Novidades e Melhorias no v1.4.0
+
+### 🌐 Painel Web Local & Teclado Remoto (QR Code)
+- **Acesso pelo Navegador do Celular**: Na tela de Configurações, aponte a câmera para o QR Code lateral para abrir o novo painel web responsivo servido diretamente pelo console (porta 8080).
+- **Teclado Remoto para Busca**: Digite confortavelmente pelo smartphone com atualização em tempo real na pesquisa da TV, eliminando a digitação lenta pelo controle virtual.
+- **Remapeamento Interativo**: Visualize e ajuste o mapeamento de botões do DualSense e teclas de teclado diretamente no navegador, salvando as alterações no console com um toque.
+- **Download Direto de Logs**: Baixe o arquivo `xcloud.log` devidamente sanitizado (sem tokens ou dados privados) direto no celular para relatar bugs e obter suporte com facilidade.
+
+### 🔞 Classificação Indicativa nos Detalhes dos Jogos
+- **Selos Visuais Oficiais**: A tela de detalhes de cada jogo agora exibe o selo oficial de classificação etária com cores padronizadas (ClassInd no Brasil, ESRB nos EUA e PEGI na Europa).
+- **Descritores de Conteúdo**: Informações claras sobre conteúdo sensível (violência, drogas lícitas, linguagem imprópria) integradas de forma elegante abaixo das informações do título.
+
+### 🎮 Áudio do DualSense & Novos Limites de Taxa de Bits
+- **Volume do Alto-falante do Controle**: Controle deslizante dedicado no menu de transmissão durante o jogo e nas Configurações para ajustar o volume dos avisos do DualSense de 0% (Mudo) a 100%.
+- **Limites de Taxa de Bits (Bitrate Caps)**: Novas opções configuráveis de 5 a 50 Mbps para gerenciar com precisão a largura de banda e a estabilidade da transmissão em redes com limites de dados.
+
+### 📦 Aquisição Direta de Jogos Free-to-Play no Console
+- **Botão "Obter Grátis"**: Adicione títulos gratuitos (Fortnite, Warzone, Roblox, etc.) à sua conta Microsoft diretamente na tela de detalhes do jogo no PS5, sem precisar acessar o navegador do PC ou celular.
+- **Áudio de Inicialização PS5**: Adicionado o áudio oficial de abertura do sistema (`snd0.at9`) ao iniciar o aplicativo.
+
+### 🐧 Pacote Universal AppImage (Steam Deck & Linux)
+- **Executável Único para Linux**: Disponibilizado o pacote `.AppImage` autocontido com bibliotecas SDL3, ícones, atalhos de desktop e total compatibilidade com o SteamOS e modo jogo do Steam Deck.
+
+<!-- LANG:EN -->
+## What's New in Version 1.4.0
+
+### 🌐 Local Web Control & Remote Keyboard (QR Code)
+- **Mobile Browser Access**: Point your smartphone camera at the QR Code on the right side of Settings to access the lightweight, responsive web management interface served directly by the console (port 8080).
+- **Remote Search Keyboard**: Type comfortably on your phone with real-time live synchronization to the TV search screen, making catalog searches instant and effortless.
+- **Interactive Remapping**: Rebind controller buttons and keyboard keys directly through your mobile browser with automatic persistence to the console.
+- **Direct Log Download**: Download the sanitized `xcloud.log` (free of tokens or personal identifiers) directly to your device for easy issue reporting and community troubleshooting.
+
+### 🔞 Age Rating & Content Descriptors on Details
+- **Official Age Badges**: The game details screen now displays official content rating badges with authentic color coding (ClassInd for Brazil, ESRB for US, PEGI for Europe).
+- **Content Descriptors**: Contextual indicators (violence, language, simulated gambling) elegantly formatted alongside developer and platform metadata.
+
+### 🎮 DualSense Speaker Volume & New Bitrate Caps
+- **Dedicated Controller Speaker Volume**: Intuitive slider in the in-game overlay menu and Settings allowing DualSense speaker volume adjustment from 0% (Mute) up to 100%.
+- **Expanded Bitrate Caps**: Granular options from 5 to 50 Mbps to accommodate bandwidth limits and optimize latency on diverse network configurations.
+
+### 📦 In-Console Free-to-Play Entitlement Claiming
+- **Direct "Get Free" Button**: Claim free-to-play licenses (such as Fortnite, Warzone, Roblox) directly on the PS5 details page without opening an external browser.
+- **Official Boot Audio**: PS5 startup chime (`snd0.at9`) added on app launch for native console presentation.
+
+### 🐧 Universal AppImage Package (Steam Deck & Linux)
+- **Standalone Linux Package**: Available as a universal `.AppImage` bundle with SDL3 runtime, desktop integration, and full out-of-the-box compatibility with Steam Deck and SteamOS Game Mode.
diff --git a/ps5/sce_sys/param.json b/ps5/sce_sys/param.json
index 13d468f..01e17dc 100644
--- a/ps5/sce_sys/param.json
+++ b/ps5/sce_sys/param.json
@@ -10,7 +10,7 @@
"conceptId": "99810",
"contentBadgeType": 1,
"contentId": "UP9000-PPSA99810_00-XCLOUDPS5CLI0000",
- "contentVersion": "01.304.000",
+ "contentVersion": "01.400.000",
"downloadDataSize": 256,
"gameIntent": {
"permittedIntents": [
diff --git a/ps5/sce_sys/snd0.at9 b/ps5/sce_sys/snd0.at9
new file mode 100644
index 0000000..203a801
Binary files /dev/null and b/ps5/sce_sys/snd0.at9 differ
diff --git a/src/app/app_core.cpp b/src/app/app_core.cpp
index b74c89d..9d759e6 100644
--- a/src/app/app_core.cpp
+++ b/src/app/app_core.cpp
@@ -16,6 +16,7 @@
#include "app/settings.h"
#include "app/shell.h"
#include "app/stream_screen.h"
+#include "app/web_server.h"
#include "display/display.h"
#include "input/controller.h"
#include "input/input_ext.h"
@@ -26,6 +27,7 @@
#include "ui/pad_glyphs.h"
#include "input/tuning.h"
#include "net/http.h"
+#include "media/audio_out.h"
#include "platform/platform.h"
#include "ui/app_ui.h"
#include "ui/strings.h"
@@ -74,7 +76,9 @@ void openReport(const std::string& what, bool previousSession, const std::string
info.title = what.empty() ? "Problem report" : report::shorten(info.what, 70);
info.release = XC_APP_VERSION;
info.firmware = platform::firmwareVersion();
- info.log = report::sanitize(report::logExcerpt(logText, previousSession), privateWords);
+ info.platform = platform::platformName();
+ std::string platHeader = "[Platform: " + info.platform + "]\n";
+ info.log = platHeader + report::sanitize(report::logExcerpt(logText, previousSession), privateWords);
info.crash = report::sanitize(crash, privateWords);
std::string url = report::issueUrl(info);
std::string detail = info.crash;
@@ -257,6 +261,7 @@ bool coreStartup() {
XC_LOGW("settings: %s could not be read; defaults used, the file kept as %s", settingsPath().c_str(), bad.c_str());
}
ui::setLanguage(ui::languageFromCode(g_settings.language));
+ media::setPadSpeakerVolume(g_settings.padSpeakerVolume);
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());
shell::beforeDisplay(g_settings); // the PS5: the splash screen hidden, the video mode (120 Hz) settled
@@ -289,6 +294,96 @@ bool coreStartup() {
g_ui = std::make_unique<ui::AppUi>(fonts, *g_images);
g_ui->showSplash(ui::tr(ui::Str::SigningIn));
startPriceLoop();
+ setWebServerHooks({
+ /*getSettings=*/[](json::Value& root) {
+ std::lock_guard<std::mutex> lock(g_settingsMutex);
+ root.set("language", g_settings.language);
+ root.set("resolution", g_settings.resolution);
+ root.set("padMap", input::padMapJson(g_settings.padMap));
+ root.set("keyMap", keyMapToJson(g_settings.keyMap));
+ },
+ /*updateSettings=*/[](const json::Value& root) -> bool {
+ bool changed = false;
+ {
+ std::lock_guard<std::mutex> lock(g_settingsMutex);
+ if (root.has("padMap")) {
+ input::PadMap newPad;
+ if (input::readPadMap(root["padMap"], newPad)) {
+ g_settings.padMap = newPad;
+ changed = true;
+ }
+ }
+ if (root.has("keyMap")) {
+ g_settings.keyMap = keyMapFromJson(root["keyMap"], g_settings.keyMap);
+ changed = true;
+ }
+ if (changed) {
+ g_settings.save(settingsPath());
+ refreshSettingsUiLocked();
+ }
+ }
+ return true;
+ },
+ /*getSearchQuery=*/[]() -> std::string {
+ return g_ui ? g_ui->searchQuery() : "";
+ },
+ /*setSearchQuery=*/[](const std::string& q) {
+ if (g_ui) {
+ g_ui->setSearchQuery(q);
+ }
+ },
+ /*setSearchParams=*/[](const std::string* q, const std::string* tab, const json::Value* filters) {
+ if (!g_ui) return;
+ ui::Tab targetTab = g_ui->tab();
+ const ui::Tab* tabPtr = nullptr;
+ if (tab) {
+ if (*tab == "gamepass" || *tab == "0") {
+ targetTab = ui::Tab::GamePass;
+ tabPtr = &targetTab;
+ } else if (*tab == "library" || *tab == "meus_jogos" || *tab == "1") {
+ targetTab = ui::Tab::Library;
+ tabPtr = &targetTab;
+ }
+ }
+ std::vector<std::pair<ui::AppUi::Filter, int>> filterList;
+ if (filters && filters->isObject()) {
+ auto checkField = [&](const char* f1, const char* f2, ui::AppUi::Filter filter) {
+ if (filters->has(f1)) {
+ const auto& val = (*filters)[f1];
+ filterList.push_back({filter, val.isBool() ? (val.asBool() ? 1 : 0) : val.asInt()});
+ } else if (f2 && filters->has(f2)) {
+ const auto& val = (*filters)[f2];
+ filterList.push_back({filter, val.isBool() ? (val.asBool() ? 1 : 0) : val.asInt()});
+ }
+ };
+ checkField("wishlist", "filterWishlist", ui::AppUi::Filter::Wishlist);
+ checkField("free", "filterFree", ui::AppUi::Filter::Free);
+ checkField("cheapest", "filterCheapest", ui::AppUi::Filter::Cheapest);
+ checkField("mouseKeyboard", "filterMouseKeyboard", ui::AppUi::Filter::MouseKeyboard);
+ checkField("plan", "filterPlan", ui::AppUi::Filter::Plan);
+ checkField("console", "filterConsole", ui::AppUi::Filter::Console);
+ checkField("mode", "filterMode", ui::AppUi::Filter::Mode);
+ checkField("language", "filterLanguage", ui::AppUi::Filter::Language);
+ }
+ g_ui->setSearchState(q, tabPtr, (filters || !filterList.empty()) ? &filterList : nullptr);
+ },
+ /*getSearchParams=*/[](std::string& outQuery, std::string& outTab, json::Value& outFilters) {
+ if (!g_ui) return;
+ outQuery = g_ui->searchQuery();
+ outTab = (g_ui->tab() == ui::Tab::Library) ? "library" : "gamepass";
+ outFilters = json::Value::object();
+ outFilters.set("wishlist", g_ui->filterSelectedPublic(ui::AppUi::Filter::Wishlist) != 0);
+ outFilters.set("free", g_ui->filterSelectedPublic(ui::AppUi::Filter::Free) != 0);
+ outFilters.set("cheapest", g_ui->filterSelectedPublic(ui::AppUi::Filter::Cheapest) != 0);
+ outFilters.set("mouseKeyboard", g_ui->filterSelectedPublic(ui::AppUi::Filter::MouseKeyboard) != 0);
+ outFilters.set("plan", g_ui->filterSelectedPublic(ui::AppUi::Filter::Plan));
+ outFilters.set("console", g_ui->filterSelectedPublic(ui::AppUi::Filter::Console));
+ outFilters.set("mode", g_ui->filterSelectedPublic(ui::AppUi::Filter::Mode));
+ outFilters.set("language", g_ui->filterSelectedPublic(ui::AppUi::Filter::Language));
+ }
+ });
+ startWebServer();
+ g_ui->setWebUrl(webServerUrl());
{
g_ui->setAllow1440(allow1440Locked());
g_ui->setUpdateState(XC_APP_VERSION, {}, false); // Settings shows this version before any check
@@ -765,6 +860,7 @@ void coreShutdown() {
// _exit() afterwards, so no static destructor races a thread still
// running.
XC_LOGI("=== PSBox Cloud Gaming closing ===");
+ stopWebServer();
const uint64_t start = platform::nowMs();
requestQuit();
bool workerDone = waitForWorker(5000);
diff --git a/src/app/autoplay.cpp b/src/app/autoplay.cpp
index 3a2d096..c4b0190 100644
--- a/src/app/autoplay.cpp
+++ b/src/app/autoplay.cpp
@@ -31,6 +31,7 @@ namespace {
// The home screen was saved: the tests that start from it may go.
bool uiSaved = false;
bool settingsShot = false; // "settingstest": save the screen now
+bool bitrateShot = false; // "bitratetest": save the screen now
bool donationShot = false; // "donationtest": save the screen now
const char* keysShot = nullptr; // "keystest": the screen to save now
uint64_t homeSince = 0, launchSince = 0;
@@ -81,7 +82,8 @@ struct SettingsWalk {
void loadAutoplay() {
std::string text;
- if (!platform::readFile(platform::dataDir() + "/autoplay.txt", text)) return;
+ if (!platform::readFile(platform::dataDir() + "/autoplay.txt", text) &&
+ !platform::readFile("/data/homebrew/PPSA99810/autoplay.txt", text)) return;
char title[128] = {};
char option[512] = {};
int seconds = 0;
@@ -122,6 +124,10 @@ void loadAutoplay() {
if (opt == "badca") g_autoplay.badCa = true;
if (opt == "consolesempty") g_autoplay.consolesTab = g_autoplay.consolesEmpty = true;
if (opt == "librarytest") g_autoplay.libraryTest = true;
+ if (opt == "block1test") g_autoplay.block1Test = true;
+ if (opt == "block2test") g_autoplay.block2Test = true;
+ if (opt == "block3test") g_autoplay.block3Test = true;
+ if (opt == "bitratetest") g_autoplay.bitrateTest = true;
if (opt == "imetest") g_autoplay.imeTest = true;
if (opt == "menutest") g_autoplay.menuTest = true;
if (opt.rfind("res=", 0) == 0) g_autoplay.resolution = opt.substr(4);
@@ -799,6 +805,48 @@ void autoplayNav(ui::NavInput& nav, bool& menuCombo, uint64_t now) {
}
}
+ if (g_autoplay.bitrateTest && uiSaved) {
+ static uint64_t since = 0;
+ static int step = 0;
+ static std::optional<ui::SettingsChoice> settingsBefore;
+ if (!since) {
+ since = now;
+ settingsBefore = g_ui->settings();
+ }
+ static SettingsWalk walk;
+ const uint64_t at[] = {500, 1500, 2500, 4000, 4800};
+ if (step < 5 && now - since >= at[step]) {
+ bool next = true;
+ if (step == 0) nav.options = true;
+ if (step == 1) next = walk.step(nav, downsTo(10)); // down to row 10 (BitrateCap)
+ if (step == 2) {
+ if (onSettingsRow(10, "bitrate test")) {
+ // Step right until 50 Mbps is reached on the inline slider
+ for (int k = 0; k < 10; ++k) {
+ ui::NavInput r;
+ r.right = true;
+ g_ui->handle(r);
+ }
+ } else {
+ g_autoplay.bitrateTest = false;
+ g_ui->showHome();
+ }
+ }
+ if (step == 3) {
+ bitrateShot = true; // saved below once drawn
+ }
+ if (step == 4) {
+ if (settingsBefore) {
+ g_ui->setSettings(*settingsBefore);
+ saveSettingsChoice(*settingsBefore);
+ }
+ g_ui->showHome();
+ g_autoplay.bitrateTest = false;
+ }
+ if (next) ++step;
+ }
+ }
+
if (g_autoplay.queueUiTest && uiSaved) {
static uint64_t since = 0;
static int step = 0;
@@ -1023,6 +1071,11 @@ void autoplayScreens(const ui::Canvas& canvas, uint64_t now) {
saveCanvas("settings.ppm");
XC_LOGI("AUTOPLAY END: settings test");
}
+ if (bitrateShot) {
+ bitrateShot = false;
+ saveCanvas("settings_bitrate_caps.ppm");
+ XC_LOGI("AUTOPLAY END: bitrate test");
+ }
if (donationShot) {
donationShot = false;
saveCanvas("donation.ppm");
@@ -1212,6 +1265,209 @@ void autoplayScreens(const ui::Canvas& canvas, uint64_t now) {
XC_LOGI("AUTOPLAY END: friends test");
}
}
+ if (g_autoplay.block1Test && uiSaved) {
+ static uint64_t since = 0;
+ static int step = 0;
+ if (!since) since = now;
+ if (step == 0 && now - since > 2000) {
+ // 1. 3x3 filter grid on Search tab
+ g_ui->showFilteredSearch(ui::Tab::Library, false, 0, "", 0, -1);
+ ++step;
+ } else if (step == 1 && now - since > 4000) {
+ saveCanvas("search_grid3x3.ppm");
+ // 2. Settings screen with focused description at bottom (row 0: Language)
+ g_ui->showHome();
+ ui::NavInput opt;
+ opt.options = true;
+ g_ui->handle(opt);
+ ++step;
+ } else if (step == 2 && now - since > 6000) {
+ saveCanvas("settings_desc_row0.ppm");
+ // Focus row 1 (Resolution)
+ ui::NavInput down;
+ down.down = true;
+ g_ui->handle(down);
+ ++step;
+ } else if (step == 3 && now - since > 7500) {
+ saveCanvas("settings_desc_row1.ppm");
+ // 3. Free game in Details with "Adquirir grátis" button (zero price trial with freeInStore == false)
+ ui::GameTile freeTile;
+ freeTile.productId = "9P0LHV4DV2BG";
+ freeTile.titleId = "TITLE_JUSTDANCE";
+ freeTile.name = "Just Dance 2026 Trial";
+ freeTile.publisher = "Ubisoft";
+ freeTile.description = "Experimente gratuitamente por tempo limitado no xCloud.";
+ freeTile.purchasable = false;
+ freeTile.playable = false;
+ freeTile.freeInStore = false;
+ g_ui->setPrices({{"9P0LHV4DV2BG", {ui::tr(ui::Str::Free), "", 0.0, 0.0}}});
+ g_ui->showDetails(freeTile);
+ ++step;
+ } else if (step == 4 && now - since > 9500) {
+ saveCanvas("detail_free.ppm");
+ // 4. Launching screen with rotating loading tips
+ ui::GameTile launchTile;
+ launchTile.name = "Forza Horizon 5";
+ launchTile.publisher = "Playground Games";
+ g_ui->showLaunching(launchTile, "Iniciando sessão na nuvem...");
+ ++step;
+ } else if (step == 5 && now - since > 11500) {
+ saveCanvas("launch_tip1.ppm");
+ ++step;
+ } else if (step == 6 && now - since > 17000) {
+ saveCanvas("launch_tip2.ppm");
+ g_ui->showHome();
+ g_autoplay.block1Test = false;
+ XC_LOGI("AUTOPLAY END: block1 test");
+ ++step;
+ }
+ }
+ if (g_autoplay.block2Test && uiSaved) {
+ static uint64_t since = 0;
+ static int step = 0;
+ if (!since) since = now;
+ if (step == 0 && now - since > 2000) {
+ std::string sampleNotes =
+ "<!-- LANG:PT -->\n"
+ "## Novidades na Versão 1.3.4\n"
+ "- Controle de volume do alto-falante DualSense no menu\n"
+ "- Novos limites de taxa de bits: opções de 5 a 50 Mbps\n"
+ "- Suporte a notas de lançamento bilingues e atalho Quadrado\n"
+ "<!-- LANG:EN -->\n"
+ "## What's New in Version 1.3.4\n"
+ "- DualSense speaker volume control in stream menu\n"
+ "- New bitrate caps: options from 5 to 50 Mbps\n"
+ "- Bilingual release notes support and Square shortcut\n";
+ g_ui->showHome();
+ g_ui->setUpdateState("v1.3.3", "v1.3.4", false, sampleNotes);
+ g_ui->offerUpdate(sampleNotes);
+ ++step;
+ } else if (step == 1 && now - since > 4500) {
+ saveCanvas("update_prompt_3buttons.ppm");
+ ui::NavInput sq;
+ sq.square = true;
+ g_ui->handle(sq);
+ ++step;
+ } else if (step == 2 && now - since > 7000) {
+ saveCanvas("update_notes_modal.ppm");
+ ui::NavInput back;
+ back.back = true;
+ g_ui->handle(back);
+ g_ui->handle(back);
+
+ auto saveMenu = [](const char* name, const ui::Canvas& c) {
+ std::string ppm = "P6\n" + std::to_string(c.width()) + " " + std::to_string(c.height()) + "\n255\n";
+ ppm.reserve(ppm.size() + static_cast<size_t>(c.width() * c.height() * 3));
+ for (size_t i = 0; i < static_cast<size_t>(c.width() * c.height()); ++i) {
+ uint32_t p = c.data()[i];
+ ppm += static_cast<char>(p & 0xFF);
+ ppm += static_cast<char>((p >> 8) & 0xFF);
+ ppm += static_cast<char>((p >> 16) & 0xFF);
+ }
+ platform::writeFileAtomic(platform::dataDir() + "/" + name, ppm);
+ XC_LOGI("AUTOPLAY: %s saved", name);
+ };
+
+ ui::StreamInfo info;
+ info.region = "Brazil South";
+ info.rttMs = 12;
+ info.fps = 60.0;
+ info.mbps = 50.0;
+ info.decodeMs = 1.8;
+ info.onScreenMs = 9.5;
+ info.width = 1920;
+ info.height = 1080;
+ ui::PadSlots pads{};
+ pads[0].connected = true;
+ pads[0].name = "DualSense Controller";
+
+ ui::StreamMenu menu100(g_ui->fonts());
+ menu100.open(0, false, 1, 1, 0, false, true, false, 2, 15, false, 0.5f, false, 100);
+ for (int i = 0; i < 12; ++i) {
+ ui::NavInput down;
+ down.down = true;
+ menu100.handle(down);
+ }
+ menu100.setPads(pads);
+ saveMenu("stream_menu_spk100.ppm", menu100.renderMenu(info));
+
+ ui::StreamMenu menu50(g_ui->fonts());
+ menu50.open(0, false, 1, 1, 0, false, true, false, 2, 15, false, 0.5f, false, 50);
+ for (int i = 0; i < 12; ++i) {
+ ui::NavInput down;
+ down.down = true;
+ menu50.handle(down);
+ }
+ menu50.setPads(pads);
+ saveMenu("stream_menu_spk50.ppm", menu50.renderMenu(info));
+ ++step;
+ } else if (step == 3 && now - since > 9500) {
+ g_ui->showHome();
+ ui::NavInput opt;
+ opt.options = true;
+ g_ui->handle(opt);
+ ui::NavInput down;
+ down.down = true;
+ while (g_ui->settingsFocus() != 10) {
+ g_ui->handle(down);
+ }
+ ui::NavInput right;
+ right.right = true;
+ for (int k = 0; k < 10; ++k) {
+ g_ui->handle(right);
+ }
+ ++step;
+ } else if (step == 4 && now - since > 12000) {
+ saveCanvas("settings_bitrate_caps.ppm");
+ ui::NavInput back;
+ back.back = true;
+ g_ui->handle(back);
+ g_ui->showHome();
+ g_autoplay.block2Test = false;
+ XC_LOGI("AUTOPLAY END: block2 test");
+ ++step;
+ }
+ }
+ if (g_autoplay.block3Test && uiSaved) {
+ static uint64_t since = 0;
+ static int step = 0;
+ if (!since) since = now;
+ if (step == 0 && now - since > 2000) {
+ g_ui->showHome();
+ ui::NavInput opt;
+ opt.options = true;
+ g_ui->handle(opt);
+ ++step;
+ } else if (step == 1 && now - since > 4500) {
+ saveCanvas("settings_web_qr.ppm");
+ ui::NavInput back;
+ back.back = true;
+ g_ui->handle(back);
+ g_ui->showHome();
+
+ ui::GameTile tile;
+ if (!g_ui->findTile("FORTNITE", tile) && !g_ui->firstTile(tile)) {
+ tile.name = "Forza Horizon 5";
+ tile.publisher = "Xbox Game Studios";
+ tile.description = "Explore os cenários dinâmicos do México com ação automobilística ilimitada.";
+ tile.categories = {"Corrida", "Mundo Aberto"};
+ }
+ tile.ratingAge = "14+";
+ tile.ratingSystem = "ClassInd";
+ tile.ratingDescriptors = {"Violência", "Drogas Lícitas"};
+ g_ui->showDetails(tile);
+ ++step;
+ } else if (step == 2 && now - since > 7000) {
+ saveCanvas("game_details_rating.ppm");
+ ui::NavInput back;
+ back.back = true;
+ g_ui->handle(back);
+ g_ui->showHome();
+ g_autoplay.block3Test = false;
+ XC_LOGI("AUTOPLAY END: block3 test");
+ ++step;
+ }
+ }
if (g_autoplay.streamMenuTest && uiSaved) {
static uint64_t since = 0;
static int step = 0;
diff --git a/src/app/autoplay.h b/src/app/autoplay.h
index 0dc7f04..12a579e 100644
--- a/src/app/autoplay.h
+++ b/src/app/autoplay.h
@@ -46,6 +46,10 @@ struct Autoplay {
bool padSpkTest = false; // "padspktest": play queue-ready chime and vibration on controller speaker
bool queueUiTest = false; // "queueuitest": open settings, focus queueReadyAlert row, test sound with Square
bool wishlistTest = false; // "wishlisttest": test wishlist filter, empty state, and active wishlisted items
+ bool block1Test = false; // "block1test": verify 3x3 filter grid, settings descriptions, free acquire button, and loading tips
+ bool block2Test = false; // "block2test": verify update prompt 3 buttons, notes modal, pad speaker volume, and bitrate caps
+ bool block3Test = false; // "block3test": verify web server qr in settings and official age rating on details
+ bool bitrateTest = false; // "bitratetest": open settings, focus Bitrate row, test slider, save settings_bitrate_caps.ppm
bool detailTest = false; // open a game to buy far down the list, save its page
bool libraryTest = false; // open "Your games", save it at 4 s and 25 s
bool vkTest = false; // the GPU presenting instead of the CPU display
diff --git a/src/app/cli_main.cpp b/src/app/cli_main.cpp
index 08be276..0a655a8 100644
--- a/src/app/cli_main.cpp
+++ b/src/app/cli_main.cpp
@@ -688,8 +688,10 @@ int main(int argc, char** argv) {
for (int i = 0; i < 30; ++i) log += "08:11:3" + std::to_string(i % 10) + " [I] gpu: something at step " + std::to_string(i) + "\n";
log += "08:11:37 [E] TLS setup: certificates /app0/assets/cacert.pem: PK - Read/write of file failed (-15872)\n"
"08:11:37 [I] NOTIFY: PSBox: secure connections unavailable\n";
- app::report::Info info{error.substr(0, 70), error, XC_APP_VERSION, "13.00",
- app::report::sanitize(app::report::logExcerpt(log, false), {})};
+ std::string plat = platform::platformName();
+ std::string sanitizedLog = "[Platform: " + plat + "]\n" +
+ app::report::sanitize(app::report::logExcerpt(log, false), {});
+ app::report::Info info{error.substr(0, 70), error, XC_APP_VERSION, "13.00", sanitizedLog, "", plat};
std::string url = app::report::issueUrl(info);
std::printf("url: %zu characters\n%s\n", url.size(), url.c_str());
app.showReport(url, ui::tr(ui::Str::ReportProblem));
diff --git a/src/app/library.cpp b/src/app/library.cpp
index ec94e75..56fa4ce 100644
--- a/src/app/library.cpp
+++ b/src/app/library.cpp
@@ -48,6 +48,13 @@ json::Value productToJson(const xcloud::Product& p) {
for (const auto& [lang, bits] : p.languages) langs.set(lang, static_cast<int64_t>(bits));
v.set("langs", langs);
}
+ if (!p.ratingAge.empty()) {
+ v.set("rage", p.ratingAge);
+ v.set("rsys", p.ratingSystem);
+ json::Value rdesc = json::Value::array();
+ for (const auto& d : p.ratingDescriptors) rdesc.push(d);
+ v.set("rdesc", rdesc);
+ }
return v;
}
@@ -69,6 +76,9 @@ xcloud::Product productFromJson(const std::string& id, const json::Value& v) {
p.modes = static_cast<uint32_t>(v["modes"].asInt(0));
p.plan = static_cast<uint8_t>(v["plan"].asInt(0));
for (const auto& [lang, bits] : v["langs"].members()) p.languages[lang] = static_cast<uint8_t>(bits.asInt(0));
+ p.ratingAge = v["rage"].str();
+ p.ratingSystem = v["rsys"].str();
+ for (const auto& d : v["rdesc"].items()) p.ratingDescriptors.push_back(d.str());
return p;
}
@@ -140,6 +150,9 @@ ui::GameTile Library::tile(const std::string& productId, const std::string& titl
t.categories = p.categories;
t.detailed = p.detailed;
t.modes = p.modes;
+ t.ratingAge = p.ratingAge;
+ t.ratingSystem = p.ratingSystem;
+ t.ratingDescriptors = p.ratingDescriptors;
if (auto lang = p.languages.find(language_.substr(0, language_.find('-'))); lang != p.languages.end())
t.languages = lang->second; // in the app's language
if (ownershipKnown_) t.playable = ownedTitles_.count(t.titleId) || ownedProducts_.count(t.productId);
diff --git a/src/app/report.cpp b/src/app/report.cpp
index 9279b10..2bb360f 100644
--- a/src/app/report.cpp
+++ b/src/app/report.cpp
@@ -142,14 +142,26 @@ std::string issueUrl(const Info& info, size_t maxLength) {
what.find(info.release) == std::string::npos) {
what += " (v" + info.release + ")";
}
- std::string head = std::string(kForm) + "&title=" + encode(info.title) + "&what=" + encode(what) +
- "&release=" + encode(info.release) + "&firmware=" + encode(info.firmware) + "&log=";
+ std::string head = std::string(kForm) + "&title=" + encode(info.title) + "&what=" + encode(what);
+ if (!info.platform.empty()) head += "&platform=" + encode(info.platform);
+ head += "&release=" + encode(info.release) + "&firmware=" + encode(info.firmware) + "&log=";
// The log's end matters most: whole lines are dropped from its start
- // until the link fits.
+ // until the link fits. Preserve the [Platform: ...] header if present.
std::string log = info.log;
+ std::string platHeader;
+ if (log.rfind("[Platform:", 0) == 0) {
+ size_t nl = log.find('\n');
+ if (nl != std::string::npos) {
+ platHeader = log.substr(0, nl + 1);
+ log = log.substr(nl + 1);
+ }
+ } else if (!info.platform.empty()) {
+ platHeader = "[Platform: " + info.platform + "]\n";
+ }
for (;;) {
- std::string url = head + encode(log);
- if (url.size() <= maxLength || log.empty()) return url.size() <= maxLength ? url : head;
+ std::string fullLog = platHeader + log;
+ std::string url = head + encode(fullLog);
+ if (url.size() <= maxLength || log.empty()) return url.size() <= maxLength ? url : head + encode(platHeader);
size_t nl = log.find('\n', log.compare(0, 4, "...\n") == 0 ? 4 : 0);
log = nl == std::string::npos ? std::string() : "...\n" + log.substr(nl + 1);
}
diff --git a/src/app/report.h b/src/app/report.h
index 9ec8985..5b66ef7 100644
--- a/src/app/report.h
+++ b/src/app/report.h
@@ -19,6 +19,7 @@ struct Info {
std::string firmware; // PS5 system software, when known
std::string log; // logExcerpt()'s
std::string crash; // crash: SIGSEGV pc=eboot+0x... (from the marker)
+ std::string platform; // platform name ("PlayStation 5 (PPSA99810)", "Linux", etc.)
};
// The bug form's link, at most `maxLength` characters: the log is cut from
diff --git a/src/app/settings.cpp b/src/app/settings.cpp
index 2022207..0e510a5 100644
--- a/src/app/settings.cpp
+++ b/src/app/settings.cpp
@@ -12,11 +12,14 @@
namespace xc::app {
-namespace {
+json::Value keyMapToJson(const input::KeyMap& m) {
+ json::Value v = json::Value::array();
+ for (const auto& keys : m)
+ for (uint8_t k : keys) v.push(static_cast<int>(k));
+ return v;
+}
-// "keyMap": each input's two keys, in KeyAction order (flat). Anything else
-// (an older file, another count) keeps `fallback`.
-input::KeyMap readKeyMap(const json::Value& v, const input::KeyMap& fallback) {
+input::KeyMap keyMapFromJson(const json::Value& v, const input::KeyMap& fallback) {
const auto& items = v.items();
if (items.size() != static_cast<size_t>(input::kKeyActions) * 2) return fallback;
input::KeyMap m{};
@@ -25,12 +28,7 @@ input::KeyMap readKeyMap(const json::Value& v, const input::KeyMap& fallback) {
return m;
}
-json::Value keyMapJson(const input::KeyMap& m) {
- json::Value v = json::Value::array();
- for (const auto& keys : m)
- for (uint8_t k : keys) v.push(static_cast<int>(k));
- return v;
-}
+namespace {
// "padMap": absent keeps `fallback`; present but not a complete map of
// this version (an edited or damaged file) gives the default map.
@@ -91,9 +89,9 @@ bool Settings::load(const std::string& path) {
micEnabled = (*j)["micEnabled"].asBool(micEnabled);
highRefresh = (*j)["highRefresh"].asBool(highRefresh);
desktopFullscreen = (*j)["desktopFullscreen"].asBool(desktopFullscreen);
- maxBitrateMbps = static_cast<int>(std::clamp<int64_t>((*j)["maxBitrateMbps"].asInt(maxBitrateMbps), 0, 40));
+ maxBitrateMbps = static_cast<int>(std::clamp<int64_t>((*j)["maxBitrateMbps"].asInt(maxBitrateMbps), 0, 50));
gameVolume = static_cast<int>(std::clamp<int64_t>((*j)["gameVolume"].asInt(gameVolume), 0, 200));
- keyMap = readKeyMap((*j)["keyMap"], input::defaultKeyMap());
+ keyMap = keyMapFromJson((*j)["keyMap"], input::defaultKeyMap());
padMap = readPadMapOr((*j)["padMap"], input::defaultPadMap(), "the settings");
keyboardPlayer = static_cast<int>(std::clamp<int64_t>((*j)["keyboardPlayer"].asInt(keyboardPlayer), 0, 3));
gyroMode = static_cast<int>(std::clamp<int64_t>((*j)["gyroMode"].asInt(gyroMode), 0, 2));
@@ -101,6 +99,7 @@ bool Settings::load(const std::string& path) {
touchpadMouse = (*j)["touchpadMouse"].asBool(touchpadMouse);
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));
+ padSpeakerVolume = static_cast<int>(std::clamp<int64_t>((*j)["padSpeakerVolume"].asInt(padSpeakerVolume), 0, 100));
skippedUpdate = (*j)["skippedUpdate"].str();
maxHeightCloud = static_cast<int>((*j)["maxHeightCloud"].asInt(0));
maxHeightHome = static_cast<int>((*j)["maxHeightHome"].asInt(0));
@@ -142,7 +141,7 @@ bool Settings::load(const std::string& path) {
p.triggerProfile = static_cast<int>(std::clamp<int64_t>(obj["triggerProfile"].asInt(triggerProfile), 0, 2));
p.circleConfirms = obj["circleConfirms"].asBool(circleConfirms);
p.highRefresh = obj["highRefresh"].asBool(highRefresh);
- p.keyMap = readKeyMap(obj["keyMap"], keyMap);
+ p.keyMap = keyMapFromJson(obj["keyMap"], keyMap);
p.padMap = readPadMapOr(obj["padMap"], padMap, id.c_str());
p.gyroMode = static_cast<int>(std::clamp<int64_t>(obj["gyroMode"].asInt(gyroMode), 0, 2));
p.gyroLevel = static_cast<int>(std::clamp<int64_t>(obj["gyroLevel"].asInt(gyroLevel), 1, 10));
@@ -243,7 +242,7 @@ bool Settings::save(const std::string& path) const {
v.set("desktopFullscreen", desktopFullscreen);
v.set("maxBitrateMbps", maxBitrateMbps);
v.set("gameVolume", gameVolume);
- v.set("keyMap", keyMapJson(keyMap));
+ v.set("keyMap", keyMapToJson(keyMap));
v.set("padMap", input::padMapJson(padMap));
v.set("keyboardPlayer", keyboardPlayer);
v.set("gyroMode", gyroMode);
@@ -251,6 +250,7 @@ bool Settings::save(const std::string& path) const {
v.set("touchpadMouse", touchpadMouse);
v.set("micGain", micGain);
v.set("audioRoute", audioRoute);
+ v.set("padSpeakerVolume", padSpeakerVolume);
v.set("queueReadyAlert", queueReadyAlert);
json::Value pt = json::Value::object();
for (const auto& [id, sec] : titlePlaytime)
@@ -277,7 +277,7 @@ bool Settings::save(const std::string& path) const {
obj.set("triggerProfile", p.triggerProfile);
obj.set("circleConfirms", p.circleConfirms);
obj.set("highRefresh", p.highRefresh);
- obj.set("keyMap", keyMapJson(p.keyMap));
+ obj.set("keyMap", keyMapToJson(p.keyMap));
obj.set("padMap", input::padMapJson(p.padMap));
obj.set("gyroMode", p.gyroMode);
obj.set("gyroLevel", p.gyroLevel);
diff --git a/src/app/settings.h b/src/app/settings.h
index 3996274..c078c81 100644
--- a/src/app/settings.h
+++ b/src/app/settings.h
@@ -11,8 +11,15 @@
#include <string>
#include <vector>
+namespace xc::json {
+class Value;
+}
+
namespace xc::app {
+json::Value keyMapToJson(const input::KeyMap& m);
+input::KeyMap keyMapFromJson(const json::Value& v, const input::KeyMap& fallback);
+
struct GameProfile {
// Picture
int sharpness = 2; // 0 off, 1..3 low, medium (FSR RCAS), high
@@ -91,7 +98,7 @@ struct Settings {
// Voice chat & Audio routing
bool micEnabled = true;
bool highRefresh = false; // 119.88 Hz output (VRR where the console turns it on) while streaming
- int maxBitrateMbps = 0; // the stream's bitrate cap: 0 automatic (the tier's), else 30, 25, 22, 20, 15, 10 or 5
+ int maxBitrateMbps = 0; // the stream's bitrate cap: 0 automatic (the tier's), else 50, 45, 40, 35, 30, 25, 20, 15, 10 or 5
int gameVolume = 100; // percent: 25, 50, 75, 100 or 150
input::KeyMap keyMap = input::defaultKeyMap(); // the keys when the keyboard is a player's controller
// Which pad button plays which Xbox button in a game (input/pad_map.h;
@@ -103,6 +110,7 @@ struct Settings {
bool touchpadMouse = false; // touchpad as mouse in games with native MKB support
int micGain = 1; // 0: 50%, 1: 100%, 2: 150%
int audioRoute = 0; // 0: TV/HDMI (Main), 1: DualSense Speaker / Headset (Pad)
+ int padSpeakerVolume = 100; // 0 to 100% (DualSense controller speaker)
bool queueReadyAlert = true; // Queue-ready chime and rumble alert
std::map<std::string, uint64_t> titlePlaytime; // accumulated playtime in seconds (productId or titleId -> seconds)
diff --git a/src/app/stream_player.cpp b/src/app/stream_player.cpp
index 8bcb9fa..5d55318 100644
--- a/src/app/stream_player.cpp
+++ b/src/app/stream_player.cpp
@@ -555,7 +555,7 @@ struct StreamPlayer::Impl {
: gssv.resolution() == xcloud::Resolution::P1080HQ ? 30000000
: 25000000;
if (maxBitrateMbps > 0) // the user's cap (Wi-Fi) or test override: REMB offers this rate
- opts.maxBitrate = static_cast<uint32_t>(maxBitrateMbps) * 1000000u;
+ opts.maxBitrate = static_cast<uint32_t>(std::clamp(maxBitrateMbps, 5, 50)) * 1000000u;
opts.simulatedVideoLoss = simulatedLoss;
if (const char* loss = std::getenv("XC_SIM_LOSS")) opts.simulatedVideoLoss = std::atoi(loss);
callbacks = cb;
@@ -866,7 +866,7 @@ void StreamPlayer::stop() { impl_->stop(); }
void StreamPlayer::setHwDecodeProbe(bool on) { impl_->hwProbe = on; }
void StreamPlayer::setDecodeThreads(int threads) { impl_->decodeThreads = std::max(1, threads); }
-void StreamPlayer::setMaxBitrate(int mbps) { impl_->maxBitrateMbps = std::max(0, mbps); }
+void StreamPlayer::setMaxBitrate(int mbps) { impl_->maxBitrateMbps = std::clamp(mbps, 0, 50); }
void StreamPlayer::setSimulatedLoss(int percent) { impl_->simulatedLoss = std::clamp(percent, 0, 50); }
StreamPlayer::Stats StreamPlayer::stats() const {
diff --git a/src/app/stream_screen.cpp b/src/app/stream_screen.cpp
index 9ac8b14..047fd15 100644
--- a/src/app/stream_screen.cpp
+++ b/src/app/stream_screen.cpp
@@ -194,8 +194,13 @@ void StreamScreen::update(const input::ControllerState& pad, ui::NavInput nav, b
menu_.setDebandInUse(autoDeband_.level());
menu_.setGyro(gyroMode_, gyroLevel_);
menu_.setStatsMask(g_settings.statsMask);
+ int padVol = 100;
+ {
+ std::lock_guard<std::mutex> settingsLock(g_settingsMutex);
+ padVol = g_settings.padSpeakerVolume;
+ }
menu_.open(streamResolution_, showStats_, sharpness_, deband_, upscaler_, g_playingHome, allow1440,
- hasCustomProfile_, triggerStrength_, deadzone_, circleConfirms_, micLvl, micMuted);
+ hasCustomProfile_, triggerStrength_, deadzone_, circleConfirms_, micLvl, micMuted, padVol);
overlaySeq_ = 0;
} else if (wasOpen && (menuCombo || swipeMenu_)) {
// The same gesture or key closes it again.
@@ -212,6 +217,14 @@ void StreamScreen::update(const input::ControllerState& pad, ui::NavInput nav, b
g_player->requestKeyframe();
XC_LOGI("menu_: Xbox button");
break;
+ case ui::MenuAction::PadSpeakerVolume: {
+ int vol = menu_.padSpeakerVolume();
+ media::setPadSpeakerVolume(vol);
+ std::lock_guard<std::mutex> settingsLock(g_settingsMutex);
+ g_settings.padSpeakerVolume = vol;
+ g_settings.save(settingsPath());
+ break;
+ }
case ui::MenuAction::Close: g_player->requestKeyframe(); break; // a clean picture back in the game
case ui::MenuAction::Resolution:
streamResolution_ = menu_.resolution();
diff --git a/src/app/update_check.cpp b/src/app/update_check.cpp
index cd74719..12f31b0 100644
--- a/src/app/update_check.cpp
+++ b/src/app/update_check.cpp
@@ -60,6 +60,7 @@ bool findLatestRelease(Release& out, std::string& err, const std::string& feedUr
}
out = {};
out.tag = (*j)["tag_name"].str();
+ out.notes = (*j)["body"].str();
const auto& assets = (*j)["assets"];
for (size_t i = 0; i < assets.size(); ++i) {
const auto& a = assets[i];
@@ -73,4 +74,115 @@ bool findLatestRelease(Release& out, std::string& err, const std::string& feedUr
return true;
}
+std::string filterReleaseNotes(const std::string& notes, const std::string& langCode) {
+ if (notes.empty()) return {};
+
+ struct Section {
+ std::string tag;
+ std::string content;
+ };
+ std::vector<Section> sections;
+
+ size_t pos = 0;
+ while (pos < notes.size()) {
+ size_t commentStart = notes.find("<!--", pos);
+ if (commentStart == std::string::npos) break;
+
+ size_t commentEnd = notes.find("-->", commentStart + 4);
+ if (commentEnd == std::string::npos) break;
+
+ size_t p = commentStart + 4;
+ while (p < commentEnd && (notes[p] == ' ' || notes[p] == '\t' || notes[p] == '\r' || notes[p] == '\n')) ++p;
+
+ if (p + 4 <= commentEnd &&
+ (notes[p] == 'L' || notes[p] == 'l') &&
+ (notes[p+1] == 'A' || notes[p+1] == 'a') &&
+ (notes[p+2] == 'N' || notes[p+2] == 'n') &&
+ (notes[p+3] == 'G' || notes[p+3] == 'g')) {
+ p += 4;
+ while (p < commentEnd && (notes[p] == ' ' || notes[p] == '\t')) ++p;
+ if (p < commentEnd && notes[p] == ':') {
+ ++p;
+ while (p < commentEnd && (notes[p] == ' ' || notes[p] == '\t')) ++p;
+ size_t tagStart = p;
+ while (p < commentEnd && notes[p] != ' ' && notes[p] != '\t' && notes[p] != '\r' && notes[p] != '\n' && notes[p] != '-') {
+ ++p;
+ }
+ if (p < commentEnd && notes[p] == '-' && p + 1 < commentEnd && notes[p+1] != '-') {
+ ++p;
+ while (p < commentEnd && notes[p] != ' ' && notes[p] != '\t' && notes[p] != '\r' && notes[p] != '\n' && notes[p] != '-') {
+ ++p;
+ }
+ }
+ std::string tag;
+ for (size_t ti = tagStart; ti < p; ++ti) {
+ char c = notes[ti];
+ if (c == '_') c = '-';
+ tag += static_cast<char>(std::toupper(static_cast<unsigned char>(c)));
+ }
+
+ if (!tag.empty()) {
+ if (!sections.empty()) {
+ sections.back().content = notes.substr(pos, commentStart - pos);
+ }
+ sections.push_back({tag, {}});
+ pos = commentEnd + 3;
+ continue;
+ }
+ }
+ }
+ pos = commentEnd + 3;
+ }
+
+ if (sections.empty()) {
+ return notes;
+ }
+
+ sections.back().content = notes.substr(pos);
+
+ auto trim = [](std::string s) -> std::string {
+ while (!s.empty() && (s.back() == ' ' || s.back() == '\t' || s.back() == '\r' || s.back() == '\n')) {
+ s.pop_back();
+ }
+ size_t lead = 0;
+ while (lead < s.size() && (s[lead] == ' ' || s[lead] == '\t' || s[lead] == '\r' || s[lead] == '\n')) {
+ ++lead;
+ }
+ return lead > 0 ? s.substr(lead) : s;
+ };
+
+ for (auto& sec : sections) {
+ sec.content = trim(sec.content);
+ }
+
+ std::string primaryCode;
+ for (char c : langCode) {
+ if (c == '-' || c == '_') break;
+ primaryCode += static_cast<char>(std::toupper(static_cast<unsigned char>(c)));
+ }
+ std::string fullCode;
+ for (char c : langCode) {
+ if (c == '_') c = '-';
+ fullCode += static_cast<char>(std::toupper(static_cast<unsigned char>(c)));
+ }
+
+ auto findSec = [&](const std::string& t) -> const Section* {
+ for (const auto& sec : sections) {
+ if (sec.tag == t) return &sec;
+ }
+ return nullptr;
+ };
+
+ if (!fullCode.empty()) {
+ if (auto* s = findSec(fullCode)) return s->content;
+ }
+ if (!primaryCode.empty()) {
+ if (auto* s = findSec(primaryCode)) return s->content;
+ }
+ if (auto* s = findSec("EN")) return s->content;
+ if (auto* s = findSec("EN-US")) return s->content;
+
+ return sections[0].content;
+}
+
} // namespace xc::app
diff --git a/src/app/update_check.h b/src/app/update_check.h
index a6a8dde..0cc348e 100644
--- a/src/app/update_check.h
+++ b/src/app/update_check.h
@@ -22,8 +22,13 @@ struct Release {
std::string zipUrl; // PPSA99810.zip
std::string sigUrl; // PPSA99810.zip.sig, its signature
long zipSize = -1;
+ std::string notes;
};
+// Filters release notes delimited by <!-- LANG:PT --> / <!-- LANG:EN --> etc.
+// Returns the matching section or full notes if no language tags exist.
+std::string filterReleaseNotes(const std::string& notes, const std::string& langCode);
+
// The latest GitHub release, or the release `feedUrl` describes (the same
// JSON; the update test's local server). False with `err` when there is
// none or it can't be asked (no network, rate limit).
diff --git a/src/app/web_server.cpp b/src/app/web_server.cpp
new file mode 100644
index 0000000..23bcb8d
--- /dev/null
+++ b/src/app/web_server.cpp
@@ -0,0 +1,1077 @@
+// SPDX-License-Identifier: GPL-3.0-or-later
+// Copyright (C) 2026 RafaelNGP
+#include "app/web_server.h"
+#include "app/report.h"
+#include "app/settings.h"
+#include "input/key_map.h"
+#include "input/pad_map.h"
+#include "platform/platform.h"
+#include "ui/app_ui.h"
+#include "util/json.h"
+#include "util/log.h"
+
+#include <arpa/inet.h>
+#include <cerrno>
+#include <cstring>
+#include <fcntl.h>
+#include <netinet/in.h>
+#include <poll.h>
+#include <sys/socket.h>
+#include <unistd.h>
+
+namespace xc::app {
+
+namespace {
+
+const char* kIndexHtml = R"html(<!DOCTYPE html>
+<html lang="pt-BR">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
+<title>PSBox Cloud Gaming - Web Control</title>
+<style>
+:root {
+ --bg: #0b0d13;
+ --surface: #141722;
+ --surface-alt: #1c2130;
+ --border: #282f44;
+ --primary: #107C41;
+ --primary-hover: #169c53;
+ --accent: #0070d8;
+ --text: #f0f3f8;
+ --text-dim: #9aa4b8;
+ --danger: #d93838;
+}
+* { box-sizing: border-box; margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
+html, body { width: 100%; max-width: 100%; overflow-x: hidden; background: var(--bg); color: var(--text); padding-bottom: 40px; }
+header { box-sizing: border-box; background: var(--surface); border-bottom: 1px solid var(--border); padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; max-width: 100%; overflow-x: hidden; }
+.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 auto; }
+.logo-icon { flex-shrink: 0; width: 32px; height: 32px; border-radius: 50%; box-shadow: 0 0 10px rgba(16, 124, 65, 0.45); }
+.brand-text { min-width: 0; flex: 1 1 auto; }
+.brand-text h1 { font-size: clamp(0.76rem, 3.6vw, 0.96rem); font-weight: 700; letter-spacing: 0.5px; color: #fff; text-transform: uppercase; line-height: 1.2; white-space: nowrap; }
+.brand-subtitle { font-size: 0.70rem; color: var(--text-dim); display: block; font-weight: 500; white-space: nowrap; }
+header .badge { background: var(--primary); color: #fff; font-size: 0.70rem; padding: 3px 7px; border-radius: 12px; font-weight: 600; text-transform: uppercase; flex-shrink: 0; }
+.nav-tabs { display: flex; background: var(--surface); border-bottom: 1px solid var(--border); width: 100%; max-width: 100%; overflow-x: hidden; }
+.nav-tab { flex: 1 1 0; min-width: 0; text-align: center; padding: 12px 6px; font-size: clamp(0.78rem, 3.2vw, 0.88rem); font-weight: 600; color: var(--text-dim); border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; user-select: none; }
+.nav-tab.active { color: #fff; border-bottom-color: var(--primary); background: var(--surface-alt); }
+.content { max-width: 680px; width: 100%; margin: 14px auto; padding: 0 12px; overflow-x: hidden; }
+.subnav { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; width: 100%; max-width: 100%; }
+.subnav .btn { flex: 1 1 120px; }
+.subnav .btn.active { background: var(--primary); border-color: var(--primary); }
+.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px; margin-bottom: 14px; width: 100%; max-width: 100%; overflow-x: hidden; }
+.card h2 { font-size: 1.0rem; margin-bottom: 8px; font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
+.card p { font-size: 0.82rem; color: var(--text-dim); margin-bottom: 12px; line-height: 1.4; word-break: break-word; }
+
+/* Search tabs & chips */
+.search-tabs { display: flex; gap: 8px; margin-bottom: 12px; width: 100%; max-width: 100%; }
+.search-tab { flex: 1 1 0; min-width: 0; padding: 10px 8px; background: var(--surface-alt); border: 1px solid var(--border); border-radius: 10px; color: var(--text-dim); font-size: clamp(0.82rem, 3.4vw, 0.88rem); font-weight: 600; cursor: pointer; transition: all 0.2s; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; outline: none; }
+.search-tab:hover { border-color: var(--primary); color: #fff; }
+.search-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 2px 8px rgba(16, 124, 65, 0.4); }
+.filter-section { margin-top: 12px; margin-bottom: 12px; width: 100%; max-width: 100%; }
+.filter-label { font-size: 0.76rem; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
+.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; max-width: 100%; }
+.chip { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 6px 11px; border-radius: 20px; font-size: 0.80rem; font-weight: 600; background: var(--surface-alt); border: 1px solid var(--border); color: var(--text-dim); cursor: pointer; transition: all 0.2s; user-select: none; max-width: 100%; outline: none; white-space: nowrap; }
+.chip:hover { border-color: var(--primary-hover); color: var(--text); }
+.chip.active { background: rgba(16, 124, 65, 0.28); border-color: var(--primary); color: #4ade80; }
+.chip-select { display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 20px; background: var(--surface-alt); border: 1px solid var(--border); font-size: 0.80rem; color: var(--text-dim); font-weight: 600; max-width: 100%; }
+.chip-select.active { border-color: var(--primary); background: rgba(16, 124, 65, 0.28); color: #4ade80; }
+.chip-select select { background: transparent; border: none; color: #fff; font-size: 0.80rem; font-weight: 600; outline: none; cursor: pointer; padding: 2px 0; max-width: 100%; }
+.chip-select select option { background: var(--surface); color: #fff; }
+
+.input-group { display: flex; gap: 8px; margin-bottom: 12px; width: 100%; max-width: 100%; }
+input[type="text"] { flex: 1 1 auto; min-width: 0; background: var(--surface-alt); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font-size: 0.92rem; color: #fff; outline: none; transition: border-color 0.2s; }
+input[type="text"]:focus { border-color: var(--primary); }
+.btn { display: inline-flex; align-items: center; justify-content: center; background: var(--surface-alt); color: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font-size: 0.86rem; font-weight: 600; cursor: pointer; text-decoration: none; transition: background 0.2s, border-color 0.2s; max-width: 100%; white-space: normal; text-align: center; }
+.btn:hover { background: var(--border); }
+.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
+.btn-primary:hover { background: var(--primary-hover); }
+.status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 20px; font-size: 0.80rem; background: rgba(16, 124, 65, 0.2); color: #4ade80; border: 1px solid rgba(16, 124, 65, 0.4); margin-top: 4px; max-width: 100%; word-break: break-word; }
+.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; flex-shrink: 0; }
+.grid-map { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 12px; width: 100%; max-width: 100%; }
+@media (min-width: 580px) {
+ .grid-map { grid-template-columns: repeat(2, 1fr); }
+}
+.map-item { background: var(--surface-alt); border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px; display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; max-width: 100%; min-width: 0; flex-wrap: wrap; }
+.map-item label { font-size: 0.84rem; font-weight: 600; flex: 1 1 110px; min-width: 0; word-break: break-word; }
+.selects-wrap { display: flex; gap: 6px; flex-wrap: wrap; flex: 1 1 180px; min-width: 0; justify-content: flex-end; }
+.selects-wrap select { flex: 1 1 calc(50% - 4px); min-width: 85px; max-width: 100%; }
+.map-item > select { flex: 0 1 auto; max-width: 100%; min-width: 0; }
+select { background: var(--surface); color: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 7px 9px; font-size: 0.80rem; outline: none; min-width: 0; }
+.btn-row { margin-top: 16px; display: flex; gap: 8px; flex-wrap: wrap; width: 100%; max-width: 100%; }
+.btn-row .btn { flex: 1 1 130px; }
+pre { background: #07080b; border: 1px solid var(--border); border-radius: 10px; padding: 12px; font-family: monospace; font-size: 0.78rem; color: #c4ccdc; overflow-x: auto; max-height: 380px; white-space: pre-wrap; word-break: break-all; max-width: 100%; }
+.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #169c53; color: #fff; padding: 10px 20px; border-radius: 24px; font-size: 0.88rem; font-weight: 600; box-shadow: 0 4px 16px rgba(0,0,0,0.5); opacity: 0; pointer-events: none; transition: opacity 0.3s; z-index: 1000; max-width: 90%; text-align: center; }
+.toast.show { opacity: 1; }
+</style>
+</head>
+<body>
+<header>
+ <div class="brand">
+ <svg class="logo-icon" viewBox="0 0 100 100" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <circle cx="50" cy="50" r="50" fill="#ffffff"/>
+ <path fill="#107C41" d="M 50.00 40.10 s 0.12 0.00 0.00 0.00 c 15.07 11.46 40.60 39.60 32.88 47.57 -8.84 7.72 -20.30 12.33 -32.88 12.33 s -24.16 -4.61 -32.88 -12.33 c -7.85 -7.97 17.81 -36.11 32.75 -47.45 0.00 -0.12 0.12 -0.12 0.12 -0.12 z m 26.03 -32.75 C 68.43 2.74 60.09 0.00 50.00 0.00 s -18.43 2.74 -26.03 7.35 c -0.12 0.00 -0.12 0.12 -0.12 0.25 s 0.12 0.12 0.25 0.12 c 9.71 -2.12 24.41 6.23 25.78 7.10 h 0.25 c 1.37 -0.87 16.06 -9.22 25.78 -7.10 0.12 0.00 0.25 0.00 0.25 -0.12 s 0.00 -0.25 -0.12 -0.25 z M 15.01 14.32 c -0.12 0.00 -0.12 0.12 -0.25 0.12 -9.09 9.09 -14.69 21.67 -14.69 35.49 0.00 11.33 3.86 21.92 10.21 30.26 0.00 0.12 0.12 0.12 0.25 0.12 s 0.12 -0.12 0.00 -0.25 c -3.86 -11.83 15.69 -40.35 25.78 -52.30 l 0.12 -0.12 c 0.00 -0.12 0.00 -0.12 -0.12 -0.12 -15.32 -15.19 -20.42 -13.57 -21.30 -13.20 z m 48.69 13.08 l -0.12 0.12 s 0.00 0.12 0.12 0.12 c 10.09 11.96 29.51 40.47 25.78 52.30 v 0.25 c 0.12 0.00 0.25 0.00 0.25 -0.12 6.35 -8.34 10.21 -18.93 10.21 -30.26 0.00 -13.82 -5.60 -26.40 -14.82 -35.49 -0.12 -0.12 -0.12 -0.12 -0.25 -0.12 -0.75 -0.25 -5.85 -1.87 -21.17 13.20 z"/>
+ </svg>
+ <div class="brand-text">
+ <h1>PSBOX CLOUD GAMING</h1>
+ <span class="brand-subtitle">Painel Web</span>
+ </div>
+ </div>
+ <span class="badge">v1.4.0</span>
+</header>
+
+<div class="nav-tabs">
+ <div class="nav-tab active" id="navTab-search" onclick="switchTab('search')">🔍 Busca</div>
+ <div class="nav-tab" id="navTab-remap" onclick="switchTab('remap')">🎮 Controles</div>
+ <div class="nav-tab" id="navTab-logs" onclick="switchTab('logs')">📋 Logs</div>
+</div>
+
+<div class="content">
+ <!-- TAB: SEARCH -->
+ <div id="tab-search" class="tab-pane">
+ <div class="card">
+ <h2>🔍 Teclado Remoto para Busca</h2>
+ <p>Digite no celular para atualizar a pesquisa ativa na TV em tempo real sem precisar do controle.</p>
+
+ <!-- Search destination tabs -->
+ <div class="search-tabs">
+ <button class="search-tab active" id="tabBtnGamePass" type="button" onclick="setSearchTab('gamepass')">🎮 Game Pass</button>
+ <button class="search-tab" id="tabBtnLibrary" type="button" onclick="setSearchTab('library')">📚 Meus jogos</button>
+ </div>
+
+ <div class="input-group">
+ <input type="text" id="searchInput" placeholder="Digite o nome de um jogo..." autocomplete="off">
+ <button class="btn" onclick="clearSearch()">Limpar</button>
+ </div>
+
+ <!-- Search filters -->
+ <div class="filter-section">
+ <div class="filter-label">Filtros da pesquisa:</div>
+
+ <!-- Game Pass filters -->
+ <div id="filtersGamePass" class="filter-chips">
+ <div class="chip-select" id="chipSelectPlan">
+ <label for="filterPlan">👑 Plano:</label>
+ <select id="filterPlan" onchange="onFilterChange()">
+ <option value="0">Meu plano</option>
+ <option value="1">Ultimate</option>
+ <option value="2">Premium</option>
+ <option value="3">Essential</option>
+ <option value="4">Todos os planos</option>
+ </select>
+ </div>
+ <div class="chip-select" id="chipSelectConsoleGP">
+ <label for="filterConsoleGP">🎮 Console:</label>
+ <select id="filterConsoleGP" onchange="onFilterChange()">
+ <option value="0">Todos</option>
+ <option value="1">Series X|S</option>
+ <option value="2">Xbox One</option>
+ <option value="3">Xbox 360</option>
+ </select>
+ </div>
+ <button class="chip" id="chipMouseGP" type="button" onclick="toggleChip('chipMouseGP')">
+ ⌨️🖱️ Teclado e mouse
+ </button>
+ <div class="chip-select" id="chipSelectModeGP">
+ <label for="filterModeGP">👤 Modo:</label>
+ <select id="filterModeGP" onchange="onFilterChange()">
+ <option value="0">Todos</option>
+ <option value="1">Um jogador</option>
+ <option value="2">Multijogador online</option>
+ <option value="3">Cooperativo online</option>
+ <option value="4">Multijogador local</option>
+ </select>
+ </div>
+ <div class="chip-select" id="chipSelectLangGP">
+ <label for="filterLangGP">🌐 Idioma:</label>
+ <select id="filterLangGP" onchange="onFilterChange()">
+ <option value="0">Qualquer</option>
+ <option value="1">Legendas</option>
+ <option value="2">Dublado</option>
+ </select>
+ </div>
+ </div>
+
+ <!-- Meus Jogos (Library) filters -->
+ <div id="filtersLibrary" class="filter-chips" style="display:none;">
+ <button class="chip" id="chipWishlist" type="button" onclick="toggleChip('chipWishlist')">
+ 💖 Lista de desejos
+ </button>
+ <button class="chip" id="chipFree" type="button" onclick="toggleChip('chipFree')">
+ 🎁 Grátis
+ </button>
+ <button class="chip" id="chipCheapest" type="button" onclick="toggleChip('chipCheapest')">
+ 🏷️ Menor preço
+ </button>
+ <div class="chip-select" id="chipSelectConsoleLib">
+ <label for="filterConsoleLib">🎮 Console:</label>
+ <select id="filterConsoleLib" onchange="onFilterChange()">
+ <option value="0">Todos</option>
+ <option value="1">Series X|S</option>
+ <option value="2">Xbox One</option>
+ <option value="3">Xbox 360</option>
+ </select>
+ </div>
+ <button class="chip" id="chipMouseLib" type="button" onclick="toggleChip('chipMouseLib')">
+ ⌨️🖱️ Teclado e mouse
+ </button>
+ <div class="chip-select" id="chipSelectModeLib">
+ <label for="filterModeLib">👤 Modo:</label>
+ <select id="filterModeLib" onchange="onFilterChange()">
+ <option value="0">Todos</option>
+ <option value="1">Um jogador</option>
+ <option value="2">Multijogador online</option>
+ <option value="3">Cooperativo online</option>
+ <option value="4">Multijogador local</option>
+ </select>
+ </div>
+ <div class="chip-select" id="chipSelectLangLib">
+ <label for="filterLangLib">🌐 Idioma:</label>
+ <select id="filterLangLib" onchange="onFilterChange()">
+ <option value="0">Qualquer</option>
+ <option value="1">Legendas</option>
+ <option value="2">Dublado</option>
+ </select>
+ </div>
+ </div>
+ </div>
+
+ <div class="status-pill">
+ <div class="status-dot"></div>
+ <span id="searchStatus">Pronto para pesquisar</span>
+ </div>
+ </div>
+ </div>
+
+ <!-- TAB: REMAP -->
+ <div id="tab-remap" class="tab-pane" style="display:none;">
+ <div class="subnav">
+ <button class="btn active" id="btnSubPad" onclick="switchRemapSub('pad')">🎮 DualSense</button>
+ <button class="btn" id="btnSubKey" onclick="switchRemapSub('key')">⌨️ Teclado</button>
+ </div>
+
+ <div id="subRemapPad">
+ <div class="card">
+ <h2>🎮 Remapeamento de Botões (DualSense)</h2>
+ <p>Ajuste os botões do controle para o jogo na nuvem. Suas alterações são sincronizadas e salvas automaticamente.</p>
+ <div class="grid-map" id="padGrid"></div>
+ <div class="btn-row">
+ <button class="btn btn-primary" onclick="saveSettings()">Salvar no Console</button>
+ <button class="btn" onclick="resetPadMap()">Restaurar Controle Padrão</button>
+ </div>
+ </div>
+ </div>
+
+ <div id="subRemapKey" style="display:none;">
+ <div class="card">
+ <h2>⌨️ Remapeamento de Teclado (WASD / Teclas)</h2>
+ <p>Mapeie teclas e botões do mouse para os comandos do Xbox na nuvem. Cada ação possui tecla Primária e Secundária.</p>
+ <div class="grid-map" id="keyGrid"></div>
+ <div class="btn-row">
+ <button class="btn btn-primary" onclick="saveSettings()">Salvar no Console</button>
+ <button class="btn" onclick="resetKeyMap()">Restaurar Teclado Padrão</button>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <!-- TAB: LOGS -->
+ <div id="tab-logs" class="tab-pane" style="display:none;">
+ <div class="card">
+ <h2>📋 Download de Logs</h2>
+ <p>Baixe o arquivo <code>xcloud.log</code> sanitizado (sem tokens ou dados privados) para anexar em relatórios de erros no GitHub.</p>
+ <div class="btn-row" style="margin-top: 0; margin-bottom: 14px;">
+ <a href="/api/log" download="xcloud.log" class="btn btn-primary">⬇️ Baixar xcloud.log</a>
+ <button class="btn" onclick="loadLogPreview()">Visualizar Últimas Linhas</button>
+ </div>
+ <pre id="logPreview">Clique em "Visualizar Últimas Linhas" para carregar o log...</pre>
+ </div>
+ </div>
+</div>
+
+<div id="toast" class="toast">Alterações salvas com sucesso!</div>
+
+<script>
+const padFunctions = [
+ "A (Sul / Cruz)", "B (Leste / Círculo)", "X (Oeste / Quadrado)", "Y (Norte / Triângulo)",
+ "LB (L1)", "RB (R1)", "LT (L2)", "RT (R2)", "LS (L3)", "RS (R3)",
+ "View (Touchpad / Share)", "Menu (Options)", "D-pad Cima", "D-pad Baixo", "D-pad Esquerda", "D-pad Direita"
+];
+const padSources = [
+ {id: 0, name: "Cruz (South)"}, {id: 1, name: "Círculo (East)"}, {id: 2, name: "Quadrado (West)"}, {id: 3, name: "Triângulo (North)"},
+ {id: 4, name: "L1 (LB)"}, {id: 5, name: "R1 (RB)"}, {id: 6, name: "L2 (LT)"}, {id: 7, name: "R2 (RT)"},
+ {id: 8, name: "L3 (LS)"}, {id: 9, name: "R3 (RS)"}, {id: 10, name: "Touchpad (View)"}, {id: 11, name: "Options (Menu)"},
+ {id: 12, name: "D-pad Cima"}, {id: 13, name: "D-pad Baixo"}, {id: 14, name: "D-pad Esquerda"}, {id: 15, name: "D-pad Direita"}
+];
+
+const keyActionNames = [
+ "Analógico Esq. Cima", "Analógico Esq. Baixo", "Analógico Esq. Esquerda", "Analógico Esq. Direita",
+ "D-pad Cima", "D-pad Baixo", "D-pad Esquerda", "D-pad Direita",
+ "A (Cruz)", "B (Círculo)", "X (Quadrado)", "Y (Triângulo)",
+ "LB (L1)", "RB (R1)", "LT (L2)", "RT (R2)", "LS (L3)", "RS (R3)",
+ "View (Share / Touch)", "Menu (Options)"
+];
+
+const keyList = [
+ {id: 0, name: "(Nenhuma)"},
+ {id: 87, name: "W"}, {id: 65, name: "A"}, {id: 83, name: "S"}, {id: 68, name: "D"},
+ {id: 81, name: "Q"}, {id: 69, name: "E"}, {id: 82, name: "R"}, {id: 70, name: "F"},
+ {id: 67, name: "C"}, {id: 86, name: "V"}, {id: 90, name: "Z"}, {id: 88, name: "X"},
+ {id: 66, name: "B"}, {id: 71, name: "G"}, {id: 84, name: "T"}, {id: 89, name: "Y"},
+ {id: 72, name: "H"}, {id: 74, name: "J"}, {id: 75, name: "K"}, {id: 76, name: "L"},
+ {id: 77, name: "M"}, {id: 78, name: "N"}, {id: 79, name: "O"}, {id: 80, name: "P"},
+ {id: 85, name: "U"}, {id: 73, name: "I"},
+ {id: 48, name: "0"}, {id: 49, name: "1"}, {id: 50, name: "2"}, {id: 51, name: "3"},
+ {id: 52, name: "4"}, {id: 53, name: "5"}, {id: 54, name: "6"}, {id: 55, name: "7"},
+ {id: 56, name: "8"}, {id: 57, name: "9"},
+ {id: 32, name: "Espaço (Space)"},
+ {id: 16, name: "Shift"}, {id: 17, name: "Ctrl"}, {id: 18, name: "Alt"},
+ {id: 9, name: "Tab"}, {id: 27, name: "Esc"}, {id: 13, name: "Enter"}, {id: 8, name: "Backspace"},
+ {id: 38, name: "Seta Cima"}, {id: 40, name: "Seta Baixo"},
+ {id: 37, name: "Seta Esquerda"}, {id: 39, name: "Seta Direita"},
+ {id: 241, name: "Mouse L (Esq)"}, {id: 242, name: "Mouse R (Dir)"},
+ {id: 243, name: "Mouse M (Meio)"}, {id: 244, name: "Mouse 4"}, {id: 245, name: "Mouse 5"}
+];
+
+const defaultKeyMap = [
+ 87, 0, 83, 0, 65, 0, 68, 0,
+ 38, 0, 40, 0, 37, 0, 39, 0,
+ 32, 0, 67, 0, 82, 0, 69, 0,
+ 81, 0, 70, 0, 242, 0, 241, 0,
+ 16, 0, 86, 243, 9, 0, 27, 0
+];
+
+let currentSettings = {
+ padMap: [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15],
+ keyMap: [...defaultKeyMap]
+};
+
+let currentSearchTab = 'gamepass';
+let currentFilters = {
+ plan: 0,
+ consoleGP: 0,
+ consoleLib: 0,
+ modeGP: 0,
+ modeLib: 0,
+ langGP: 0,
+ langLib: 0,
+ mouseGP: false,
+ mouseLib: false,
+ wishlist: false,
+ free: false,
+ cheapest: false
+};
+
+function switchTab(name) {
+ document.querySelectorAll('.tab-pane').forEach(el => el.style.display = 'none');
+ document.querySelectorAll('.nav-tab').forEach(el => el.classList.remove('active'));
+ const pane = document.getElementById('tab-' + name);
+ if (pane) pane.style.display = 'block';
+ const tabBtn = document.getElementById('navTab-' + name);
+ if (tabBtn) tabBtn.classList.add('active');
+}
+
+function switchRemapSub(mode) {
+ document.getElementById('subRemapPad').style.display = mode === 'pad' ? 'block' : 'none';
+ document.getElementById('subRemapKey').style.display = mode === 'key' ? 'block' : 'none';
+ document.getElementById('btnSubPad').classList.toggle('active', mode === 'pad');
+ document.getElementById('btnSubKey').classList.toggle('active', mode === 'key');
+}
+
+function showToast(msg) {
+ const t = document.getElementById('toast');
+ t.textContent = msg;
+ t.classList.add('show');
+ setTimeout(() => t.classList.remove('show'), 2500);
+}
+
+const searchInput = document.getElementById('searchInput');
+let searchDebounce = null;
+
+function applySearchTabUI(tab) {
+ currentSearchTab = tab;
+ document.getElementById('tabBtnGamePass').classList.toggle('active', tab === 'gamepass');
+ document.getElementById('tabBtnLibrary').classList.toggle('active', tab === 'library');
+ document.getElementById('filtersGamePass').style.display = tab === 'gamepass' ? 'flex' : 'none';
+ document.getElementById('filtersLibrary').style.display = tab === 'library' ? 'flex' : 'none';
+}
+
+function setSearchTab(tab) {
+ applySearchTabUI(tab);
+ sendSearch(true);
+}
+
+function toggleChip(id) {
+ const el = document.getElementById(id);
+ el.classList.toggle('active');
+ const active = el.classList.contains('active');
+ if (id === 'chipWishlist') currentFilters.wishlist = active;
+ if (id === 'chipFree') currentFilters.free = active;
+ if (id === 'chipCheapest') currentFilters.cheapest = active;
+ if (id === 'chipMouseGP') currentFilters.mouseGP = active;
+ if (id === 'chipMouseLib') currentFilters.mouseLib = active;
+ sendSearch(true);
+}
+
+function onFilterChange() {
+ currentFilters.plan = parseInt(document.getElementById('filterPlan').value, 10);
+ currentFilters.consoleGP = parseInt(document.getElementById('filterConsoleGP').value, 10);
+ currentFilters.consoleLib = parseInt(document.getElementById('filterConsoleLib').value, 10);
+ currentFilters.modeGP = parseInt(document.getElementById('filterModeGP').value, 10);
+ currentFilters.modeLib = parseInt(document.getElementById('filterModeLib').value, 10);
+ currentFilters.langGP = parseInt(document.getElementById('filterLangGP').value, 10);
+ currentFilters.langLib = parseInt(document.getElementById('filterLangLib').value, 10);
+
+ document.getElementById('chipSelectPlan').classList.toggle('active', currentFilters.plan > 0);
+ document.getElementById('chipSelectConsoleGP').classList.toggle('active', currentFilters.consoleGP > 0);
+ document.getElementById('chipSelectConsoleLib').classList.toggle('active', currentFilters.consoleLib > 0);
+ document.getElementById('chipSelectModeGP').classList.toggle('active', currentFilters.modeGP > 0);
+ document.getElementById('chipSelectModeLib').classList.toggle('active', currentFilters.modeLib > 0);
+ document.getElementById('chipSelectLangGP').classList.toggle('active', currentFilters.langGP > 0);
+ document.getElementById('chipSelectLangLib').classList.toggle('active', currentFilters.langLib > 0);
+ sendSearch(true);
+}
+
+function updateSearchStatusText() {
+ const q = searchInput.value;
+ const isLib = currentSearchTab === 'library';
+ let status = isLib ? 'Meus jogos' : 'Game Pass';
+ if (q) status += ' • "' + q + '"';
+ const filterNames = [];
+ if (isLib) {
+ if (currentFilters.wishlist) filterNames.push('Lista de desejos');
+ if (currentFilters.free) filterNames.push('Grátis');
+ if (currentFilters.cheapest) filterNames.push('Menor preço');
+ if (currentFilters.mouseLib) filterNames.push('Teclado e mouse');
+ if (currentFilters.consoleLib > 0) {
+ const cNames = ['Todos', 'Series X|S', 'Xbox One', 'Xbox 360'];
+ filterNames.push(cNames[currentFilters.consoleLib]);
+ }
+ if (currentFilters.modeLib > 0) {
+ const mNames = ['Todos', 'Um jogador', 'Multijogador online', 'Cooperativo online', 'Multijogador local'];
+ filterNames.push(mNames[currentFilters.modeLib]);
+ }
+ if (currentFilters.langLib > 0) {
+ const lNames = ['Qualquer', 'Legendas', 'Dublado'];
+ filterNames.push(lNames[currentFilters.langLib]);
+ }
+ } else {
+ if (currentFilters.plan > 0) {
+ const pNames = ['Meu plano', 'Ultimate', 'Premium', 'Essential', 'Todos os planos'];
+ filterNames.push(pNames[currentFilters.plan]);
+ }
+ if (currentFilters.mouseGP) filterNames.push('Teclado e mouse');
+ if (currentFilters.consoleGP > 0) {
+ const cNames = ['Todos', 'Series X|S', 'Xbox One', 'Xbox 360'];
+ filterNames.push(cNames[currentFilters.consoleGP]);
+ }
+ if (currentFilters.modeGP > 0) {
+ const mNames = ['Todos', 'Um jogador', 'Multijogador online', 'Cooperativo online', 'Multijogador local'];
+ filterNames.push(mNames[currentFilters.modeGP]);
+ }
+ if (currentFilters.langGP > 0) {
+ const lNames = ['Qualquer', 'Legendas', 'Dublado'];
+ filterNames.push(lNames[currentFilters.langGP]);
+ }
+ }
+ if (filterNames.length > 0) {
+ status += ' [' + filterNames.join(', ') + ']';
+ }
+ document.getElementById('searchStatus').textContent = status;
+}
+
+function sendSearch(immediate = false) {
+ clearTimeout(searchDebounce);
+ const doFetch = () => {
+ const q = searchInput.value;
+ const isLib = currentSearchTab === 'library';
+ const activeFilters = {
+ plan: isLib ? 0 : currentFilters.plan,
+ console: isLib ? currentFilters.consoleLib : currentFilters.consoleGP,
+ mode: isLib ? currentFilters.modeLib : currentFilters.modeGP,
+ language: isLib ? currentFilters.langLib : currentFilters.langGP,
+ mouseKeyboard: isLib ? currentFilters.mouseLib : currentFilters.mouseGP,
+ wishlist: isLib ? currentFilters.wishlist : false,
+ free: isLib ? currentFilters.free : false,
+ cheapest: isLib ? currentFilters.cheapest : false
+ };
+
+ updateSearchStatusText();
+
+ fetch('/api/search', {
+ method: 'POST',
+ headers: {'Content-Type': 'application/json'},
+ body: JSON.stringify({
+ query: q,
+ tab: currentSearchTab,
+ filters: activeFilters
+ })
+ }).catch(e => console.error(e));
+ };
+
+ if (immediate) {
+ doFetch();
+ } else {
+ searchDebounce = setTimeout(doFetch, 120);
+ }
+}
+
+searchInput.addEventListener('input', () => {
+ sendSearch(false);
+});
+
+function clearSearch() {
+ searchInput.value = '';
+ sendSearch(true);
+}
+
+function renderPadMap() {
+ const grid = document.getElementById('padGrid');
+ grid.innerHTML = '';
+ const map = currentSettings.padMap || [];
+ padFunctions.forEach((fnName, idx) => {
+ const item = document.createElement('div');
+ item.className = 'map-item';
+ const label = document.createElement('label');
+ label.textContent = fnName;
+ const select = document.createElement('select');
+ select.id = 'pad_fn_' + idx;
+ padSources.forEach(s => {
+ const opt = document.createElement('option');
+ opt.value = s.id;
+ opt.textContent = s.name;
+ if (map[idx] === s.id) opt.selected = true;
+ select.appendChild(opt);
+ });
+ item.appendChild(label);
+ item.appendChild(select);
+ grid.appendChild(item);
+ });
+}
+
+function renderKeyMap() {
+ const grid = document.getElementById('keyGrid');
+ grid.innerHTML = '';
+ const kmap = (currentSettings.keyMap && currentSettings.keyMap.length === 40) ? currentSettings.keyMap : defaultKeyMap;
+ keyActionNames.forEach((actName, idx) => {
+ const item = document.createElement('div');
+ item.className = 'map-item';
+ const label = document.createElement('label');
+ label.textContent = actName;
+ const selectsWrap = document.createElement('div');
+ selectsWrap.className = 'selects-wrap';
+ for (let slot = 0; slot < 2; slot++) {
+ const select = document.createElement('select');
+ select.id = 'key_act_' + idx + '_' + slot;
+ const code = kmap[idx * 2 + slot];
+ let hasMatch = false;
+ keyList.forEach(k => {
+ const opt = document.createElement('option');
+ opt.value = k.id;
+ opt.textContent = k.name;
+ if (code === k.id) { opt.selected = true; hasMatch = true; }
+ select.appendChild(opt);
+ });
+ if (!hasMatch && code > 0) {
+ const opt = document.createElement('option');
+ opt.value = code;
+ opt.textContent = "Key #" + code;
+ opt.selected = true;
+ select.appendChild(opt);
+ }
+ selectsWrap.appendChild(select);
+ }
+ item.appendChild(label);
+ item.appendChild(selectsWrap);
+ grid.appendChild(item);
+ });
+}
+
+function resetPadMap() {
+ currentSettings.padMap = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15];
+ renderPadMap();
+ saveSettings();
+}
+
+function resetKeyMap() {
+ currentSettings.keyMap = [...defaultKeyMap];
+ renderKeyMap();
+ saveSettings();
+}
+
+function saveSettings() {
+ const padMap = [];
+ for (let i = 0; i < 16; i++) {
+ const sel = document.getElementById('pad_fn_' + i);
+ padMap.push(sel ? parseInt(sel.value, 10) : i);
+ }
+ const keyMap = [];
+ for (let i = 0; i < 20; i++) {
+ const s0 = document.getElementById('key_act_' + i + '_0');
+ const s1 = document.getElementById('key_act_' + i + '_1');
+ keyMap.push(s0 ? parseInt(s0.value, 10) : 0);
+ keyMap.push(s1 ? parseInt(s1.value, 10) : 0);
+ }
+ fetch('/api/settings', {
+ method: 'POST',
+ headers: {'Content-Type': 'application/json'},
+ body: JSON.stringify({ padMap: padMap, keyMap: keyMap })
+ }).then(r => r.json()).then(res => {
+ if (res.ok) {
+ showToast('Configurações salvas no console!');
+ }
+ }).catch(e => showToast('Erro ao salvar configurações'));
+}
+
+function loadLogPreview() {
+ const p = document.getElementById('logPreview');
+ p.textContent = 'Carregando log...';
+ fetch('/api/log').then(r => r.text()).then(text => {
+ const lines = text.split('\n');
+ p.textContent = lines.slice(-50).join('\n') || 'Log vazio.';
+ }).catch(e => {
+ p.textContent = 'Erro ao carregar log: ' + e;
+ });
+}
+
+fetch('/api/settings').then(r => r.json()).then(s => {
+ currentSettings = s;
+ if (s.query) searchInput.value = s.query;
+ if (s.tab) {
+ currentSearchTab = s.tab;
+ }
+ if (s.filters) {
+ if (s.filters.wishlist) {
+ currentFilters.wishlist = true;
+ const el = document.getElementById('chipWishlist');
+ if (el) el.classList.add('active');
+ }
+ if (s.filters.free) {
+ currentFilters.free = true;
+ const el = document.getElementById('chipFree');
+ if (el) el.classList.add('active');
+ }
+ if (s.filters.cheapest) {
+ currentFilters.cheapest = true;
+ const el = document.getElementById('chipCheapest');
+ if (el) el.classList.add('active');
+ }
+ if (s.filters.mouseKeyboard) {
+ currentFilters.mouseGP = true;
+ currentFilters.mouseLib = true;
+ const elGP = document.getElementById('chipMouseGP');
+ if (elGP) elGP.classList.add('active');
+ const elLib = document.getElementById('chipMouseLib');
+ if (elLib) elLib.classList.add('active');
+ }
+ if (s.filters.plan !== undefined && s.filters.plan > 0) {
+ currentFilters.plan = s.filters.plan;
+ const sel = document.getElementById('filterPlan');
+ if (sel) sel.value = s.filters.plan;
+ const wrap = document.getElementById('chipSelectPlan');
+ if (wrap) wrap.classList.add('active');
+ }
+ if (s.filters.console !== undefined && s.filters.console > 0) {
+ currentFilters.consoleGP = s.filters.console;
+ currentFilters.consoleLib = s.filters.console;
+ const selGP = document.getElementById('filterConsoleGP');
+ if (selGP) selGP.value = s.filters.console;
+ const selLib = document.getElementById('filterConsoleLib');
+ if (selLib) selLib.value = s.filters.console;
+ const wrapGP = document.getElementById('chipSelectConsoleGP');
+ if (wrapGP) wrapGP.classList.add('active');
+ const wrapLib = document.getElementById('chipSelectConsoleLib');
+ if (wrapLib) wrapLib.classList.add('active');
+ }
+ if (s.filters.mode !== undefined && s.filters.mode > 0) {
+ currentFilters.modeGP = s.filters.mode;
+ currentFilters.modeLib = s.filters.mode;
+ const selGP = document.getElementById('filterModeGP');
+ if (selGP) selGP.value = s.filters.mode;
+ const selLib = document.getElementById('filterModeLib');
+ if (selLib) selLib.value = s.filters.mode;
+ const wrapGP = document.getElementById('chipSelectModeGP');
+ if (wrapGP) wrapGP.classList.add('active');
+ const wrapLib = document.getElementById('chipSelectModeLib');
+ if (wrapLib) wrapLib.classList.add('active');
+ }
+ if (s.filters.language !== undefined && s.filters.language > 0) {
+ currentFilters.langGP = s.filters.language;
+ currentFilters.langLib = s.filters.language;
+ const selGP = document.getElementById('filterLangGP');
+ if (selGP) selGP.value = s.filters.language;
+ const selLib = document.getElementById('filterLangLib');
+ if (selLib) selLib.value = s.filters.language;
+ const wrapGP = document.getElementById('chipSelectLangGP');
+ if (wrapGP) wrapGP.classList.add('active');
+ const wrapLib = document.getElementById('chipSelectLangLib');
+ if (wrapLib) wrapLib.classList.add('active');
+ }
+ }
+ applySearchTabUI(currentSearchTab);
+ updateSearchStatusText();
+ renderPadMap();
+ renderKeyMap();
+}).catch(e => {
+ renderPadMap();
+ renderKeyMap();
+});
+</script>
+</body>
+</html>)html";
+
+std::string extractJsonField(const std::string& body, const std::string& field) {
+ auto j = json::parse(body);
+ if (j && j->isObject()) {
+ auto val = (*j)[field];
+ if (val.isString()) return val.str();
+ }
+ // Fallback: simple urlencoded or key=value
+ std::string needle = field + "=";
+ auto pos = body.find(needle);
+ if (pos != std::string::npos) {
+ auto end = body.find('&', pos);
+ if (end == std::string::npos) end = body.size();
+ return body.substr(pos + needle.size(), end - (pos + needle.size()));
+ }
+ return "";
+}
+
+} // namespace
+
+std::unique_ptr<WebServer> g_webServer;
+
+WebServer::WebServer() = default;
+
+WebServer::~WebServer() {
+ stop();
+}
+
+std::string WebServer::localIp() const {
+ return platform::localIPv4();
+}
+
+std::string WebServer::url() const {
+ return "http://" + localIp() + ":" + std::to_string(port_);
+}
+
+bool WebServer::start(uint16_t port) {
+ if (running_.load()) return true;
+ port_ = port;
+
+ listenFd_ = ::socket(AF_INET, SOCK_STREAM, 0);
+ if (listenFd_ < 0) {
+ XC_LOGW("web server: socket() failed (errno %d)", errno);
+ return false;
+ }
+
+ int one = 1;
+ ::setsockopt(listenFd_, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one));
+
+ sockaddr_in addr{};
+ addr.sin_family = AF_INET;
+ addr.sin_addr.s_addr = INADDR_ANY;
+ addr.sin_port = htons(port_);
+
+ if (::bind(listenFd_, reinterpret_cast<sockaddr*>(&addr), sizeof(addr)) < 0) {
+ XC_LOGW("web server: bind(%u) failed (errno %d)", port_, errno);
+ ::close(listenFd_);
+ listenFd_ = -1;
+ return false;
+ }
+
+ if (::listen(listenFd_, 8) < 0) {
+ XC_LOGW("web server: listen() failed (errno %d)", errno);
+ ::close(listenFd_);
+ listenFd_ = -1;
+ return false;
+ }
+
+ running_.store(true);
+ if (!platform::startThread(thread_, [this] { threadLoop(); })) {
+ XC_LOGW("web server: failed to start thread");
+ running_.store(false);
+ ::close(listenFd_);
+ listenFd_ = -1;
+ return false;
+ }
+
+ XC_LOGI("web server: running at %s", url().c_str());
+ return true;
+}
+
+void WebServer::stop() {
+ if (!running_.exchange(false)) return;
+ if (listenFd_ >= 0) {
+ ::shutdown(listenFd_, SHUT_RDWR);
+ ::close(listenFd_);
+ listenFd_ = -1;
+ }
+ if (thread_.joinable()) {
+ thread_.join();
+ }
+ XC_LOGI("web server: stopped");
+}
+
+void WebServer::threadLoop() {
+ while (running_.load()) {
+ pollfd pfd{listenFd_, POLLIN, 0};
+ int pr = ::poll(&pfd, 1, 250);
+ if (pr <= 0) continue;
+ if (pfd.revents & POLLIN) {
+ sockaddr_in clientAddr{};
+ socklen_t clientLen = sizeof(clientAddr);
+ int clientFd = ::accept(listenFd_, reinterpret_cast<sockaddr*>(&clientAddr), &clientLen);
+ if (clientFd >= 0) {
+ handleClient(clientFd);
+ ::close(clientFd);
+ }
+ }
+ }
+}
+
+void WebServer::handleClient(int clientFd) {
+ timeval tv{2, 0}; // 2s timeout prevents hung clients from deadlocking server thread
+ ::setsockopt(clientFd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
+ ::setsockopt(clientFd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv));
+
+ std::string req;
+ char buf[8192];
+ size_t contentLength = 0;
+ bool headersComplete = false;
+
+ while (req.size() < 65536) {
+ ssize_t n = ::recv(clientFd, buf, sizeof(buf), 0);
+ if (n <= 0) break;
+ req.append(buf, static_cast<size_t>(n));
+
+ if (!headersComplete) {
+ auto hdrEnd = req.find("\r\n\r\n");
+ if (hdrEnd != std::string::npos) {
+ headersComplete = true;
+ std::string lowerHdr = req.substr(0, hdrEnd);
+ for (char& c : lowerHdr) c = static_cast<char>(std::tolower(static_cast<unsigned char>(c)));
+ auto clPos = lowerHdr.find("content-length:");
+ if (clPos != std::string::npos) {
+ size_t valStart = clPos + 15;
+ while (valStart < hdrEnd && (lowerHdr[valStart] == ' ' || lowerHdr[valStart] == '\t')) valStart++;
+ size_t valEnd = lowerHdr.find("\r\n", valStart);
+ if (valEnd != std::string::npos) {
+ try {
+ contentLength = std::stoul(lowerHdr.substr(valStart, valEnd - valStart));
+ } catch (...) {}
+ }
+ }
+ }
+ }
+
+ if (headersComplete) {
+ auto hdrEnd = req.find("\r\n\r\n");
+ size_t bodyReceived = req.size() - (hdrEnd + 4);
+ if (bodyReceived >= contentLength) {
+ break;
+ }
+ }
+ }
+
+ if (req.empty()) return;
+
+ auto lineEnd = req.find("\r\n");
+ if (lineEnd == std::string::npos) lineEnd = req.find('\n');
+ if (lineEnd == std::string::npos) return;
+
+ std::string firstLine = req.substr(0, lineEnd);
+ auto sp1 = firstLine.find(' ');
+ auto sp2 = firstLine.rfind(' ');
+ if (sp1 == std::string::npos || sp2 == std::string::npos || sp1 >= sp2) return;
+
+ std::string method = firstLine.substr(0, sp1);
+ std::string path = firstLine.substr(sp1 + 1, sp2 - (sp1 + 1));
+
+ // Strip query string if any from path
+ auto qpos = path.find('?');
+ if (qpos != std::string::npos) path = path.substr(0, qpos);
+
+ // Find body if present
+ std::string body;
+ auto hdrEnd = req.find("\r\n\r\n");
+ if (hdrEnd != std::string::npos) {
+ body = req.substr(hdrEnd + 4);
+ if (contentLength > 0 && body.size() > contentLength) {
+ body.resize(contentLength);
+ }
+ }
+
+ HttpResponse res = handleRequest(method, path, body);
+
+ std::string statusText = res.status == 200 ? "200 OK"
+ : res.status == 204 ? "204 No Content"
+ : res.status == 400 ? "400 Bad Request"
+ : res.status == 404 ? "404 Not Found"
+ : "500 Internal Server Error";
+
+ std::string response = "HTTP/1.1 " + statusText + "\r\n";
+ response += "Content-Type: " + res.contentType + "\r\n";
+ response += "Content-Length: " + std::to_string(res.body.size()) + "\r\n";
+ response += "Access-Control-Allow-Origin: *\r\n";
+ response += "Access-Control-Allow-Methods: GET, POST, OPTIONS\r\n";
+ response += "Access-Control-Allow-Headers: Content-Type\r\n";
+ if (!res.extraHeaders.empty()) response += res.extraHeaders;
+ response += "Connection: close\r\n\r\n";
+ response += res.body;
+
+ size_t sent = 0;
+ while (sent < response.size()) {
+ ssize_t w = ::send(clientFd, response.data() + sent, response.size() - sent, 0);
+ if (w <= 0) break;
+ sent += static_cast<size_t>(w);
+ }
+}
+
+static WebServerHooks s_hooks;
+
+void setWebServerHooks(WebServerHooks hooks) {
+ s_hooks = std::move(hooks);
+}
+
+WebServer::HttpResponse WebServer::handleRequest(const std::string& method, const std::string& path,
+ const std::string& body) {
+ if (method == "OPTIONS") {
+ return {204, "text/plain", "", ""};
+ }
+
+ if (method == "GET") {
+ if (path == "/" || path == "/index.html") {
+ return {200, "text/html; charset=utf-8", "", kIndexHtml};
+ }
+ if (path == "/api/settings" || path == "/api/status") {
+ json::Value root = json::Value::object();
+ root.set("ok", true);
+ if (s_hooks.getSettings) {
+ s_hooks.getSettings(root);
+ } else {
+ root.set("language", "en");
+ root.set("resolution", "1080p");
+ root.set("padMap", input::padMapJson(input::defaultPadMap()));
+ root.set("keyMap", keyMapToJson(input::defaultKeyMap()));
+ }
+ if (s_hooks.getSearchParams) {
+ std::string q, tab;
+ json::Value filters = json::Value::object();
+ s_hooks.getSearchParams(q, tab, filters);
+ root.set("query", q);
+ root.set("tab", tab);
+ root.set("filters", filters);
+ } else if (s_hooks.getSearchQuery) {
+ root.set("query", s_hooks.getSearchQuery());
+ root.set("tab", "gamepass");
+ root.set("filters", json::Value::object());
+ } else {
+ root.set("query", "");
+ root.set("tab", "gamepass");
+ root.set("filters", json::Value::object());
+ }
+ return {200, "application/json", "", root.dump()};
+ }
+ if (path == "/api/log") {
+ std::string rawLog;
+ platform::readFile(platform::dataDir() + "/xcloud.log", rawLog);
+ std::string clean = report::sanitize(rawLog, {});
+ return {200, "text/plain; charset=utf-8", "Content-Disposition: attachment; filename=\"xcloud.log\"\r\n", clean};
+ }
+ }
+
+ if (method == "POST") {
+ if (path == "/api/search") {
+ auto j = json::parse(body);
+ std::string q;
+ std::string tab = "gamepass";
+ json::Value filtersObj = json::Value::object();
+ bool hasQuery = false;
+ bool hasTab = false;
+ bool hasFilters = false;
+
+ if (j && j->isObject()) {
+ if ((*j).has("query") && (*j)["query"].isString()) {
+ q = (*j)["query"].str();
+ hasQuery = true;
+ }
+ if ((*j).has("tab") && (*j)["tab"].isString()) {
+ tab = (*j)["tab"].str();
+ hasTab = true;
+ }
+ if ((*j).has("filters") && (*j)["filters"].isObject()) {
+ filtersObj = (*j)["filters"];
+ hasFilters = true;
+ }
+ for (const char* k : {"wishlist", "free", "cheapest", "mouseKeyboard", "plan", "console", "mode", "language",
+ "filterWishlist", "filterFree", "filterCheapest", "filterMouseKeyboard", "filterPlan", "filterConsole",
+ "filterMode", "filterLanguage"}) {
+ if ((*j).has(k)) {
+ filtersObj.set(k, (*j)[k]);
+ hasFilters = true;
+ }
+ }
+ } else {
+ q = extractJsonField(body, "query");
+ hasQuery = !q.empty() || body.find("query=") != std::string::npos;
+ std::string t = extractJsonField(body, "tab");
+ if (!t.empty()) {
+ tab = t;
+ hasTab = true;
+ }
+ }
+
+ if (s_hooks.setSearchParams) {
+ s_hooks.setSearchParams(hasQuery ? &q : nullptr, hasTab ? &tab : nullptr, hasFilters ? &filtersObj : nullptr);
+ } else if (s_hooks.setSearchQuery && hasQuery) {
+ s_hooks.setSearchQuery(q);
+ }
+
+ if (!hasTab && s_hooks.getSearchParams) {
+ std::string curQ, curTab;
+ json::Value curF = json::Value::object();
+ s_hooks.getSearchParams(curQ, curTab, curF);
+ if (!curTab.empty()) tab = curTab;
+ }
+
+ json::Value res = json::Value::object();
+ res.set("ok", true);
+ res.set("query", q);
+ res.set("tab", tab);
+ res.set("filters", filtersObj);
+ return {200, "application/json", "", res.dump()};
+ }
+ if (path == "/api/settings") {
+ auto j = json::parse(body);
+ if (!j || !j->isObject()) {
+ return {400, "application/json", "", "{\"ok\":false,\"error\":\"invalid json\"}"};
+ }
+ bool ok = true;
+ if (s_hooks.updateSettings) {
+ ok = s_hooks.updateSettings(*j);
+ }
+ return {ok ? 200 : 400, "application/json", "", ok ? "{\"ok\":true}" : "{\"ok\":false,\"error\":\"update failed\"}"};
+ }
+ }
+
+ return {404, "text/plain", "", "404 Not Found\n"};
+}
+
+void startWebServer(uint16_t port) {
+ if (!g_webServer) {
+ g_webServer = std::make_unique<WebServer>();
+ }
+ g_webServer->start(port);
+}
+
+void stopWebServer() {
+ if (g_webServer) {
+ g_webServer->stop();
+ }
+}
+
+std::string webServerUrl() {
+ return g_webServer ? g_webServer->url() : "http://" + platform::localIPv4() + ":8080";
+}
+
+} // namespace xc::app
diff --git a/src/app/web_server.h b/src/app/web_server.h
new file mode 100644
index 0000000..43a5803
--- /dev/null
+++ b/src/app/web_server.h
@@ -0,0 +1,64 @@
+// SPDX-License-Identifier: GPL-3.0-or-later
+// Copyright (C) 2026 RafaelNGP
+// Lightweight embedded HTTP server (port 8080) for remote configuration,
+// live search typing, and log download via mobile browser / QR code.
+#pragma once
+
+#include "platform/platform.h"
+#include "util/json.h"
+
+#include <atomic>
+#include <cstdint>
+#include <functional>
+#include <memory>
+#include <string>
+
+namespace xc::app {
+
+struct WebServerHooks {
+ std::function<void(json::Value& root)> getSettings;
+ std::function<bool(const json::Value& root)> updateSettings;
+ std::function<std::string()> getSearchQuery;
+ std::function<void(const std::string& query)> setSearchQuery;
+ std::function<void(const std::string* query, const std::string* tab, const json::Value* filters)> setSearchParams;
+ std::function<void(std::string& outQuery, std::string& outTab, json::Value& outFilters)> getSearchParams;
+};
+void setWebServerHooks(WebServerHooks hooks);
+
+class WebServer {
+public:
+ WebServer();
+ ~WebServer();
+
+ bool start(uint16_t port = 8080);
+ void stop();
+ bool isRunning() const { return running_.load(); }
+ uint16_t port() const { return port_; }
+ std::string localIp() const;
+ std::string url() const;
+
+ // Direct request handler for testing without networking
+ struct HttpResponse {
+ int status = 200;
+ std::string contentType;
+ std::string extraHeaders;
+ std::string body;
+ };
+ HttpResponse handleRequest(const std::string& method, const std::string& path, const std::string& body);
+
+private:
+ void threadLoop();
+ void handleClient(int clientFd);
+
+ std::atomic<bool> running_{false};
+ uint16_t port_ = 8080;
+ int listenFd_ = -1;
+ platform::Thread thread_{};
+};
+
+extern std::unique_ptr<WebServer> g_webServer;
+void startWebServer(uint16_t port = 8080);
+void stopWebServer();
+std::string webServerUrl();
+
+} // namespace xc::app
diff --git a/src/app/worker.cpp b/src/app/worker.cpp
index e54a021..22f39a1 100644
--- a/src/app/worker.cpp
+++ b/src/app/worker.cpp
@@ -629,13 +629,13 @@ void checkForUpdate() {
std::lock_guard<std::mutex> lock(g_releaseMutex);
g_release = offer ? r : Release{};
}
- g_ui->setUpdateState(XC_APP_VERSION, offer || (newer && !selfUpdate) ? r.tag : std::string(), false);
+ g_ui->setUpdateState(XC_APP_VERSION, offer || (newer && !selfUpdate) ? r.tag : std::string(), false, r.notes);
bool skipped;
{
std::lock_guard<std::mutex> lock(g_settingsMutex);
skipped = g_settings.skippedUpdate == r.tag;
}
- if (offer && !skipped) g_ui->offerUpdate();
+ if (offer && !skipped) g_ui->offerUpdate(r.notes);
}
// The update itself, then the restart into the new version. A failure
diff --git a/src/media/audio_out.h b/src/media/audio_out.h
index ba77361..c6ee840 100644
--- a/src/media/audio_out.h
+++ b/src/media/audio_out.h
@@ -25,5 +25,8 @@ void audioPush(const float* interleaved, size_t frames);
// Plays a short audio sample or chime directly through the DualSense controller speaker,
// falling back to main output if the pad speaker port is not available.
bool playPadSpeakerAudio(const float* interleavedStereo, size_t frames);
+// Sets the DualSense pad speaker volume (0 to 100%).
+void setPadSpeakerVolume(int percent);
+int padSpeakerVolume();
} // namespace xc::media
diff --git a/src/media/audio_out_null.cpp b/src/media/audio_out_null.cpp
index 324fe45..f55bb70 100644
--- a/src/media/audio_out_null.cpp
+++ b/src/media/audio_out_null.cpp
@@ -6,7 +6,9 @@
#include "media/audio_queue.h"
+#include <algorithm>
#include <atomic>
+#include <vector>
namespace xc::media {
@@ -28,9 +30,24 @@ void audioStop() {
audioQueue().clear();
}
+static std::atomic<int> g_padSpeakerVolume{100};
+
+void setPadSpeakerVolume(int percent) {
+ g_padSpeakerVolume = std::clamp(percent, 0, 100);
+}
+
+int padSpeakerVolume() {
+ return g_padSpeakerVolume.load();
+}
+
bool playPadSpeakerAudio(const float* interleavedStereo, size_t frames) {
if (!interleavedStereo || frames == 0) return false;
- audioQueue().push(interleavedStereo, frames);
+ int vol = g_padSpeakerVolume.load();
+ if (vol <= 0) return true;
+ float gain = vol / 100.0f;
+ std::vector<float> scaled(frames * 2);
+ for (size_t i = 0; i < frames * 2; ++i) scaled[i] = interleavedStereo[i] * gain;
+ audioQueue().push(scaled.data(), frames);
return true;
}
diff --git a/src/media/audio_out_ps5.cpp b/src/media/audio_out_ps5.cpp
index 2bbe061..643aba2 100644
--- a/src/media/audio_out_ps5.cpp
+++ b/src/media/audio_out_ps5.cpp
@@ -79,8 +79,18 @@ void loop() {
}
}
+std::atomic<int> g_padSpeakerVolume{100};
+
} // namespace
+void setPadSpeakerVolume(int percent) {
+ g_padSpeakerVolume = std::clamp(percent, 0, 100);
+}
+
+int padSpeakerVolume() {
+ return g_padSpeakerVolume.load();
+}
+
bool audioStart() {
if (g_running) return true;
// Once per process: a second sceAudioOutInit answers "already
@@ -122,8 +132,10 @@ void audioStop() {
bool playPadSpeakerAudio(const float* interleavedStereo, size_t frames) {
if (!interleavedStereo || frames == 0) return false;
+ int volPercent = g_padSpeakerVolume.load();
+ if (volPercent <= 0) return true; // 0% volume: silenced
- std::thread([pcm = std::vector<float>(interleavedStereo, interleavedStereo + frames * 2)]() {
+ std::thread([pcm = std::vector<float>(interleavedStereo, interleavedStereo + frames * 2), volPercent]() {
platform::setThreadAffinity(platform::ThreadRole::Audio, "ps5_pad_audio");
static bool initialised = false;
@@ -156,19 +168,23 @@ bool playPadSpeakerAudio(const float* interleavedStereo, size_t frames) {
XC_LOGW("pad speaker: failed to open controller speaker port, fallback to main audio");
audioStart();
constexpr size_t kChunk = (kRate * 20) / 1000;
- size_t total = pcm.size() / 2;
+ float gain = volPercent / 100.0f;
+ std::vector<float> scaledPcm(pcm.size());
+ for (size_t i = 0; i < pcm.size(); ++i) scaledPcm[i] = pcm[i] * gain;
+ size_t total = scaledPcm.size() / 2;
size_t off = 0;
while (off < total) {
size_t n = std::min(kChunk, total - off);
- audioPush(pcm.data() + off * 2, n);
+ audioPush(scaledPcm.data() + off * 2, n);
off += n;
if (off < total) platform::sleepMs(18);
}
return;
}
+ int rawVol = (volPercent * 127 + 50) / 100;
sceAudioOutSetMixLevelPadSpk(padHandle, 32768);
- sceAudioOutSetPadSpkVolume(padHandle, 127);
+ sceAudioOutSetPadSpkVolume(padHandle, rawVol);
size_t totalFrames = pcm.size() / 2;
size_t offset = 0;
diff --git a/src/media/audio_out_sdl.cpp b/src/media/audio_out_sdl.cpp
index 3d2d37f..68c90c4 100644
--- a/src/media/audio_out_sdl.cpp
+++ b/src/media/audio_out_sdl.cpp
@@ -13,6 +13,8 @@
#include <SDL3/SDL.h>
+#include <algorithm>
+#include <atomic>
#include <mutex>
#include <vector>
#include <thread>
@@ -80,10 +82,25 @@ void audioStop() {
XC_LOGI("audio output closed");
}
+static std::atomic<int> g_padSpeakerVolume{100};
+
+void setPadSpeakerVolume(int percent) {
+ g_padSpeakerVolume = std::clamp(percent, 0, 100);
+}
+
+int padSpeakerVolume() {
+ return g_padSpeakerVolume.load();
+}
+
bool playPadSpeakerAudio(const float* interleavedStereo, size_t frames) {
if (!interleavedStereo || frames == 0) return false;
+ int vol = g_padSpeakerVolume.load();
+ if (vol <= 0) return true;
audioStart();
- std::thread([pcm = std::vector<float>(interleavedStereo, interleavedStereo + frames * 2)]() {
+ float gain = vol / 100.0f;
+ std::vector<float> pcm(frames * 2);
+ for (size_t i = 0; i < frames * 2; ++i) pcm[i] = interleavedStereo[i] * gain;
+ std::thread([pcm = std::move(pcm)]() {
constexpr size_t kRate = AudioQueue::kRate;
constexpr size_t kChunk = (kRate * 20) / 1000;
size_t total = pcm.size() / 2;
diff --git a/src/platform/linux/platform_linux.cpp b/src/platform/linux/platform_linux.cpp
index cf29d21..855cbe1 100644
--- a/src/platform/linux/platform_linux.cpp
+++ b/src/platform/linux/platform_linux.cpp
@@ -168,6 +168,7 @@ KeyboardStatus pollSystemKeyboard(std::string&) { return KeyboardStatus::Closed;
bool restartApp() { return false; }
std::string firmwareVersion() { return {}; }
+std::string platformName() { return "Linux"; }
void setThreadAffinity(ThreadRole role, const char* name) {
if (name && *name) {
diff --git a/src/platform/platform.h b/src/platform/platform.h
index 887de1b..880a212 100644
--- a/src/platform/platform.h
+++ b/src/platform/platform.h
@@ -41,6 +41,8 @@ bool randomBytes(void* out, size_t len);
// resolv.conf, so the console goes through sceNetResolver instead of
// getaddrinfo. Returns false (with a message in `err`) on failure.
bool resolveIPv4(const std::string& host, uint32_t& addr, std::string& err);
+// Returns the active local IPv4 address (e.g. "192.168.1.50") or "127.0.0.1".
+std::string localIPv4();
uint64_t nowMs(); // monotonic
uint64_t nowUs(); // monotonic
void sleepMs(uint32_t ms);
@@ -93,6 +95,9 @@ bool restartApp();
// The console's system software ("13.00"); empty where unknown.
std::string firmwareVersion();
+// Platform description ("PlayStation 5 (PPSA99810)" or "Linux").
+std::string platformName();
+
bool readFile(const std::string& path, std::string& out);
bool writeFileAtomic(const std::string& path, const std::string& data);
// A file holding the sign-in, once written: readable by this user only on a
diff --git a/src/platform/posix_common.cpp b/src/platform/posix_common.cpp
index b698ec3..f441416 100644
--- a/src/platform/posix_common.cpp
+++ b/src/platform/posix_common.cpp
@@ -3,9 +3,15 @@
// File helpers shared by both platforms (the PS5 libc is POSIX enough).
#include "platform/platform.h"
+#include <arpa/inet.h>
#include <cerrno>
#include <cstdio>
+#include <cstring>
+#include <ifaddrs.h>
+#include <net/if.h>
+#include <netinet/in.h>
#include <pthread.h>
+#include <sys/socket.h>
#include <time.h>
#include <unistd.h>
@@ -90,4 +96,49 @@ void Thread::join() {
void sleepMs(uint32_t ms) { usleep(static_cast<useconds_t>(ms) * 1000u); }
+std::string localIPv4() {
+ std::string candidate;
+ ifaddrs* ifa = nullptr;
+ if (::getifaddrs(&ifa) == 0) {
+ for (ifaddrs* i = ifa; i; i = i->ifa_next) {
+ if (!i->ifa_addr || i->ifa_addr->sa_family != AF_INET) continue;
+ if ((i->ifa_flags & IFF_LOOPBACK) || !(i->ifa_flags & IFF_UP)) continue;
+ char ip[INET_ADDRSTRLEN];
+ auto* sa = reinterpret_cast<sockaddr_in*>(i->ifa_addr);
+ if (::inet_ntop(AF_INET, &sa->sin_addr, ip, sizeof(ip))) {
+ std::string s = ip;
+ if (s != "127.0.0.1" && s.rfind("169.254.", 0) != 0) {
+ if (s.rfind("192.168.", 0) == 0 || s.rfind("10.", 0) == 0 || s.rfind("172.", 0) == 0) {
+ candidate = s;
+ break;
+ }
+ if (candidate.empty()) candidate = s;
+ }
+ }
+ }
+ ::freeifaddrs(ifa);
+ }
+ if (!candidate.empty()) return candidate;
+
+ int s = ::socket(AF_INET, SOCK_DGRAM, 0);
+ if (s >= 0) {
+ sockaddr_in dst{};
+ dst.sin_family = AF_INET;
+ dst.sin_port = htons(80);
+ ::inet_pton(AF_INET, "8.8.8.8", &dst.sin_addr);
+ if (::connect(s, reinterpret_cast<sockaddr*>(&dst), sizeof(dst)) == 0) {
+ sockaddr_in local{};
+ socklen_t len = sizeof(local);
+ if (::getsockname(s, reinterpret_cast<sockaddr*>(&local), &len) == 0) {
+ char ip[INET_ADDRSTRLEN];
+ if (::inet_ntop(AF_INET, &local.sin_addr, ip, sizeof(ip))) {
+ candidate = ip;
+ }
+ }
+ }
+ ::close(s);
+ }
+ return candidate.empty() ? "127.0.0.1" : candidate;
+}
+
} // namespace xc::platform
diff --git a/src/platform/ps5/platform_ps5.cpp b/src/platform/ps5/platform_ps5.cpp
index fca59a0..55e7411 100644
--- a/src/platform/ps5/platform_ps5.cpp
+++ b/src/platform/ps5/platform_ps5.cpp
@@ -240,6 +240,10 @@ std::string firmwareVersion() {
return s;
}
+std::string platformName() {
+ return "PlayStation 5 (PPSA99810)";
+}
+
// One user per app sandbox: nothing to hide the sign-in from.
void makePrivate(const std::string&) {}
diff --git a/src/ui/app_ui.cpp b/src/ui/app_ui.cpp
index 89361d4..fda89d3 100644
--- a/src/ui/app_ui.cpp
+++ b/src/ui/app_ui.cpp
@@ -13,6 +13,7 @@
#include "ui/brand.h"
#include "ui/strings.h"
#include "ui/toast_view.h"
+#include "app/update_check.h"
#include "qrcodegen.h"
@@ -51,7 +52,7 @@ constexpr Color kGreen = rgba(16, 124, 16);
constexpr Color kPanel = rgba(36, 36, 36);
constexpr Color kPlaceholder = rgba(44, 44, 44);
-enum Icon { kIconCross, kIconCircle, kIconOptions, kIconTriangle, kIconTouchpad, kIconSquare, kIconR3, kIconL3, kIconL2R2 };
+enum Icon { kIconCross, kIconCircle, kIconOptions, kIconTriangle, kIconTouchpad, kIconSquare, kIconR3, kIconL3, kIconL2R2, kIconDpadLR };
// The resolution list, lowest first: SettingsChoice::resolution value per
// position (0 = 1080p, 1 = 720p, 2 = 1440p, as saved).
@@ -672,6 +673,17 @@ bool AppUi::isAcquired(const GameTile& t) const {
return false;
}
+bool AppUi::isFreeGame(const GameTile& t) const {
+ if (t.freeInStore) return true;
+ auto price = prices_.find(t.productId);
+ if (price != prices_.end()) {
+ if (price->second.list < 0.005 && price->second.msrp < 0.005) {
+ return true;
+ }
+ }
+ return false;
+}
+
void AppUi::toggleWishlist(const GameTile& tile, UiEvent& ev) {
// Caller holds mutex_.
if (tile.productId.empty()) return;
@@ -893,9 +905,27 @@ void AppUi::showFilteredSearch(Tab tab, bool cheapest, int mode, const std::stri
filterLanguage_ = language;
filterPublisher_ = 0;
runSearch();
- keyRow_ = kKeyRows + 2; // the row of lists
+ keyRow_ = kKeyRows + 2; // row 1 of filters
keyCol_ = std::max(0, openList);
- if (openList >= 0) pressFilter(filterRow(1)[static_cast<size_t>(openList)]);
+ if (openList >= 0) {
+ Filter targets[] = {Filter::Mode, Filter::Genre, Filter::Publisher, Filter::Language};
+ if (static_cast<size_t>(openList) < sizeof(targets) / sizeof(targets[0])) {
+ Filter want = targets[openList];
+ bool found = false;
+ for (int r = 0; r < 3 && !found; ++r) {
+ auto chips = filterRow(r);
+ for (size_t c = 0; c < chips.size(); ++c) {
+ if (chips[c] == want) {
+ keyRow_ = kKeyRows + 1 + r;
+ keyCol_ = static_cast<int>(c);
+ pressFilter(want);
+ found = true;
+ break;
+ }
+ }
+ }
+ }
+ }
dirty_ = true;
}
@@ -1441,11 +1471,22 @@ void AppUi::handleColourPicker(const NavInput& in) {
}
}
-void AppUi::setUpdateState(const std::string& current, const std::string& available, bool checking) {
+void AppUi::setUpdateState(const std::string& current, const std::string& available, bool checking, const std::string& notes) {
std::lock_guard<std::mutex> lock(mutex_);
updateCurrent_ = current;
updateAvailable_ = available;
updateChecking_ = checking;
+ if (!notes.empty()) {
+ updateNotes_ = notes;
+ formatUpdateNotes();
+ }
+ dirty_ = true;
+}
+
+void AppUi::setUpdateNotes(const std::string& notes) {
+ std::lock_guard<std::mutex> lock(mutex_);
+ updateNotes_ = notes;
+ formatUpdateNotes();
dirty_ = true;
}
@@ -1471,10 +1512,14 @@ NetworkTestState AppUi::networkTestState() const {
return networkTest_;
}
-void AppUi::offerUpdate() {
+void AppUi::offerUpdate(const std::string& notes) {
std::lock_guard<std::mutex> lock(mutex_);
updatePrompt_ = true;
+ showingUpdateNotes_ = false;
+ updateNotesScroll_ = 0;
promptFocus_ = 0;
+ if (!notes.empty()) updateNotes_ = notes;
+ formatUpdateNotes();
dirty_ = true;
}
@@ -1483,6 +1528,19 @@ bool AppUi::updateOffered() const {
return updatePrompt_ && screen_ == Screen::Home;
}
+bool AppUi::showingUpdateNotes() const {
+ std::lock_guard<std::mutex> lock(mutex_);
+ return updatePrompt_ && showingUpdateNotes_;
+}
+
+void AppUi::showUpdateNotes(bool show) {
+ std::lock_guard<std::mutex> lock(mutex_);
+ showingUpdateNotes_ = show;
+ updateNotesScroll_ = 0;
+ if (show) formatUpdateNotes();
+ dirty_ = true;
+}
+
void AppUi::showUpdating(const std::string& version) {
std::lock_guard<std::mutex> lock(mutex_);
screen_ = Screen::Updating;
@@ -1525,6 +1583,81 @@ int AppUi::settingsFocus() const {
return settingsRow_;
}
+void AppUi::setWebUrl(const std::string& url) {
+ std::lock_guard<std::mutex> lock(mutex_);
+ webUrl_ = url;
+ dirty_ = true;
+}
+
+std::string AppUi::webUrl() const {
+ std::lock_guard<std::mutex> lock(mutex_);
+ return webUrl_;
+}
+
+void AppUi::setSearchQuery(const std::string& query) {
+ std::lock_guard<std::mutex> lock(mutex_);
+ query_ = query;
+ if (screen_ == Screen::Home || screen_ == Screen::Details || screen_ == Screen::Settings || screen_ == Screen::Error) {
+ screen_ = Screen::Home;
+ searching_ = true;
+ searchOnKeys_ = true;
+ filterList_ = -1;
+ runSearch();
+ dirty_ = true;
+ }
+}
+
+std::string AppUi::searchQuery() const {
+ std::lock_guard<std::mutex> lock(mutex_);
+ return query_;
+}
+
+void AppUi::setSearchTab(Tab t) {
+ setSearchState(nullptr, &t, nullptr);
+}
+
+Tab AppUi::searchTab() const {
+ return tab();
+}
+
+void AppUi::setSearchState(const std::string* query, const Tab* tab,
+ const std::vector<std::pair<Filter, int>>* filters) {
+ std::lock_guard<std::mutex> lock(mutex_);
+ if (query) {
+ query_ = *query;
+ }
+ if (tab) {
+ tab_ = *tab;
+ }
+ if (filters) {
+ for (const auto& [f, val] : *filters) {
+ applyFilterLocked(f, val);
+ }
+ }
+ if (screen_ == Screen::Home || screen_ == Screen::Details || screen_ == Screen::Settings || screen_ == Screen::Error) {
+ screen_ = Screen::Home;
+ searching_ = true;
+ searchOnKeys_ = true;
+ filterList_ = -1;
+ runSearch();
+ dirty_ = true;
+ }
+}
+
+int AppUi::filterSelectedPublic(Filter f) const {
+ std::lock_guard<std::mutex> lock(mutex_);
+ if (f == Filter::Free) return filterFree_ ? 1 : 0;
+ if (f == Filter::Cheapest) return filterCheapest_ ? 1 : 0;
+ if (f == Filter::MouseKeyboard) return filterMouseKeyboard_ ? 1 : 0;
+ if (f == Filter::Wishlist) return filterWishlist_ ? 1 : 0;
+ return filterSelected(f);
+}
+
+bool AppUi::filterOnPublic(Filter f) const {
+ std::lock_guard<std::mutex> lock(mutex_);
+ return filterOn(f);
+}
+
void AppUi::setGyroDefaults(int mode, int level) {
std::lock_guard<std::mutex> lock(mutex_);
gyroMode_ = mode;
@@ -1643,7 +1776,7 @@ void AppUi::setRegions(std::vector<std::string> regions, const std::string& defa
}
// Settings' bitrate caps (Mbps, after Automatic) and game volumes (percent).
-constexpr int kBitrateCaps[] = {30, 25, 22, 20, 15, 10, 5};
+constexpr int kBitrateCaps[] = {5, 10, 15, 20, 25, 30, 35, 40, 45, 50};
constexpr int kVolumes[] = {25, 50, 75, 100, 150};
std::vector<std::string> AppUi::settingOptions(int row) const {
@@ -1724,9 +1857,17 @@ int AppUi::settingSelected(int row) const {
if (row == 15) return std::clamp(settings_.gyroMode, 0, 2);
if (row == 16) return settings_.queueReadyAlert ? 1 : 0;
if (row == 10) {
- for (size_t i = 0; i < std::size(kBitrateCaps); ++i)
- if (kBitrateCaps[i] == settings_.maxBitrateMbps) return static_cast<int>(i) + 1;
- return 0;
+ if (settings_.maxBitrateMbps <= 0) return 0;
+ int closest = 1;
+ int minDiff = 1000;
+ for (size_t i = 0; i < std::size(kBitrateCaps); ++i) {
+ int diff = std::abs(kBitrateCaps[i] - settings_.maxBitrateMbps);
+ if (diff < minDiff) {
+ minDiff = diff;
+ closest = static_cast<int>(i) + 1;
+ }
+ }
+ return closest;
}
if (row == 11) {
for (size_t i = 0; i < std::size(kVolumes); ++i)
@@ -1786,7 +1927,15 @@ void AppUi::applySetting(int row, int index) {
void AppUi::changeSetting(int delta) {
// Caller holds mutex_. Left / right: the previous / next choice.
int n = static_cast<int>(settingOptions(settingsRow_).size());
- if (n > 0) applySetting(settingsRow_, (settingSelected(settingsRow_) + delta + n) % n);
+ if (n <= 0) return;
+ if (settingsRow_ == 10) {
+ // Bitrate slider: clamp between 0 (Automatic) and n - 1 (50 Mbps)
+ int cur = settingSelected(10);
+ int next = std::clamp(cur + delta, 0, n - 1);
+ if (next != cur) applySetting(10, next);
+ return;
+ }
+ applySetting(settingsRow_, (settingSelected(settingsRow_) + delta + n) % n);
}
Screen AppUi::screen() const {
@@ -2148,9 +2297,16 @@ bool AppUi::anyFilter() const {
std::vector<AppUi::Filter> AppUi::filterRow(int row) const {
// Caller holds mutex_. Prices only matter in "Your games" (Game Pass
// games aren't bought).
- if (row == 1) return {Filter::Mode, Filter::Genre, Filter::Publisher, Filter::Language};
- if (tab_ == Tab::GamePass) return {Filter::Plan, Filter::Console, Filter::MouseKeyboard};
- return {Filter::Wishlist, Filter::Free, Filter::Cheapest, Filter::Console, Filter::MouseKeyboard};
+ if (tab_ == Tab::GamePass) {
+ if (row == 0) return {Filter::Plan, Filter::Console, Filter::MouseKeyboard};
+ if (row == 1) return {Filter::Mode, Filter::Genre, Filter::Publisher};
+ if (row == 2) return {Filter::Language};
+ return {};
+ }
+ if (row == 0) return {Filter::Wishlist, Filter::Free, Filter::Cheapest};
+ if (row == 1) return {Filter::Mode, Filter::Genre, Filter::Publisher};
+ if (row == 2) return {Filter::Console, Filter::Language, Filter::MouseKeyboard};
+ return {};
}
std::vector<std::string> AppUi::poolGenres() const {
@@ -2223,7 +2379,7 @@ void AppUi::chooseFilter(Filter f, int index) {
chooseFilterLocked(f, index);
}
-void AppUi::chooseFilterLocked(Filter f, int index) {
+void AppUi::applyFilterLocked(Filter f, int index) {
// Caller holds mutex_.
if (f == Filter::Plan) filterPlan_ = index;
if (f == Filter::Console) filterConsole_ = index;
@@ -2238,6 +2394,11 @@ void AppUi::chooseFilterLocked(Filter f, int index) {
auto genres = poolGenres();
filterGenre_ = index > 0 && index <= static_cast<int>(genres.size()) ? genres[static_cast<size_t>(index - 1)] : "";
}
+}
+
+void AppUi::chooseFilterLocked(Filter f, int index) {
+ // Caller holds mutex_.
+ applyFilterLocked(f, index);
filterList_ = -1;
runSearch();
dirty_ = true;
@@ -2333,7 +2494,11 @@ std::vector<int> AppUi::keyCenters(int row) const {
for (int k = 0; k < 3; ++k)
out.push_back(kMargin + kWideCols[k] * (kKeyW + kKeyGap) + (kWideSpan[k] * kKeyW + (kWideSpan[k] - 1) * kKeyGap) / 2);
} else {
- int n = static_cast<int>(filterRow(row - kKeyRows - 1).size()), w = chipWidth(n);
+ int r = row - kKeyRows - 1;
+ auto chips = filterRow(r);
+ int n = static_cast<int>(chips.size());
+ constexpr int kCols = 3;
+ int w = (kKeysW - kChipGap * (kCols - 1)) / kCols;
for (int k = 0; k < n; ++k) out.push_back(kMargin + k * (w + kChipGap) + w / 2);
}
return out;
@@ -2341,8 +2506,8 @@ std::vector<int> AppUi::keyCenters(int row) const {
void AppUi::handleSearchKeys(const NavInput& in) {
// Caller holds mutex_. keyRow_ == kKeyRows is the row of wide keys, where
- // keyCol_ is 0..2 (Space, Delete, Clear); kKeyRows + 1 and + 2 the two
- // rows of filters.
+ // keyCol_ is 0..2 (Space, Delete, Clear); kKeyRows + 1, + 2 and + 3 the three
+ // rows of filters in the 3x3 grid.
if (filterList_ >= 0) {
// A filter's drop-down: up / down, Cross picks, Circle closes it unchanged.
Filter f = static_cast<Filter>(filterList_);
@@ -2356,7 +2521,8 @@ void AppUi::handleSearchKeys(const NavInput& in) {
}
bool wide = keyRow_ == kKeyRows, filters = keyRow_ > kKeyRows;
int filterCount = filters ? static_cast<int>(filterRow(keyRow_ - kKeyRows - 1).size()) : 0;
- if ((in.up && keyRow_ > 0) || (in.down && keyRow_ < kKeyRows + 2)) {
+ bool canDown = (keyRow_ < kKeyRows + 3) && (!filters || !filterRow(keyRow_ - kKeyRows).empty());
+ if ((in.up && keyRow_ > 0) || (in.down && canDown)) {
// To the item on the next row whose middle is nearest this one's
// (the rows have 6, 3 and a few items of different widths).
auto from = keyCenters(keyRow_);
@@ -2366,7 +2532,7 @@ void AppUi::handleSearchKeys(const NavInput& in) {
int best = 0;
for (int k = 1; k < static_cast<int>(to.size()); ++k)
if (std::abs(to[static_cast<size_t>(k)] - x) < std::abs(to[static_cast<size_t>(best)] - x)) best = k;
- keyCol_ = best;
+ keyCol_ = std::clamp(best, 0, std::max(0, static_cast<int>(to.size()) - 1));
} else if (in.left && keyCol_ > 0) {
--keyCol_;
} else if (in.right) {
@@ -2656,10 +2822,71 @@ UiEvent AppUi::handle(const NavInput& in) {
return ev;
}
if (screen_ == Screen::Home && updatePrompt_) {
- // The update pop-up has the pad: left / right, Cross picks, Circle is "Not now".
- if (in.left || in.right) promptFocus_ = 1 - promptFocus_, dirty_ = true;
- if (in.accept || in.back) {
- ev.action = in.accept && promptFocus_ == 0 ? Action::UpdateNow : Action::UpdateLater;
+ if (showingUpdateNotes_) {
+ if (in.up) {
+ if (updateNotesScroll_ > 0) {
+ --updateNotesScroll_;
+ dirty_ = true;
+ }
+ } else if (in.down) {
+ if (updateNotesScroll_ < updateNotesMaxScroll_) {
+ ++updateNotesScroll_;
+ dirty_ = true;
+ }
+ } else if (in.l1 || in.l2) {
+ if (updateNotesScroll_ > 0) {
+ updateNotesScroll_ = std::max(0, updateNotesScroll_ - 5);
+ dirty_ = true;
+ }
+ } else if (in.r1 || in.r2) {
+ if (updateNotesScroll_ < updateNotesMaxScroll_) {
+ updateNotesScroll_ = std::min(updateNotesMaxScroll_, updateNotesScroll_ + 5);
+ dirty_ = true;
+ }
+ } else if (in.scrollRows != 0) {
+ int next = std::clamp(updateNotesScroll_ + in.scrollRows, 0, updateNotesMaxScroll_);
+ if (next != updateNotesScroll_) {
+ updateNotesScroll_ = next;
+ dirty_ = true;
+ }
+ } else if (in.back || in.accept || in.square) {
+ showingUpdateNotes_ = false;
+ dirty_ = true;
+ }
+ return ev;
+ }
+ // 3 buttons: 0 Update now, 1 What's new, 2 Not now
+ if (in.square) {
+ showingUpdateNotes_ = true;
+ updateNotesScroll_ = 0;
+ formatUpdateNotes();
+ dirty_ = true;
+ return ev;
+ }
+ if (in.left) {
+ promptFocus_ = (promptFocus_ + 2) % 3;
+ dirty_ = true;
+ } else if (in.right) {
+ promptFocus_ = (promptFocus_ + 1) % 3;
+ dirty_ = true;
+ }
+ if (in.accept) {
+ if (promptFocus_ == 0) {
+ ev.action = Action::UpdateNow;
+ updatePrompt_ = false;
+ dirty_ = true;
+ } else if (promptFocus_ == 1) {
+ showingUpdateNotes_ = true;
+ updateNotesScroll_ = 0;
+ formatUpdateNotes();
+ dirty_ = true;
+ } else {
+ ev.action = Action::UpdateLater;
+ updatePrompt_ = false;
+ dirty_ = true;
+ }
+ } else if (in.back) {
+ ev.action = Action::UpdateLater;
updatePrompt_ = false;
dirty_ = true;
}
@@ -2789,6 +3016,10 @@ UiEvent AppUi::handle(const NavInput& in) {
ev.action = Action::UpdateNow;
ev.settings = settings_;
}
+ } else if (in.accept && settingsRow_ == 10) {
+ // Inline bitrate slider: cycles to next option, no dropdown modal
+ int n = static_cast<int>(settingOptions(10).size());
+ if (n > 0) applySetting(10, (settingSelected(10) + 1) % n);
} else if (in.accept) {
dropdownOpen_ = true;
dropdownIndex_ = settingSelected(settingsRow_);
@@ -2847,14 +3078,13 @@ UiEvent AppUi::handle(const NavInput& in) {
if (in.accept) {
if (detailButtonFocus_ == 1 && hasAchievements) {
openAchievements();
- } else if ((detail_.playable || detail_.freeInStore) && !detail_.titleId.empty()) {
- if (detail_.playable) {
- ev.action = Action::Play;
- ev.game = detail_;
- } else if (detail_.freeInStore) {
- ev.action = Action::ClaimFreeGame;
- ev.game = detail_;
- }
+ } else if (isFreeGame(detail_) && !detail_.playable) {
+ ev.action = Action::ClaimFreeGame;
+ ev.game = detail_;
+ ev.game.freeInStore = true;
+ } else if (detail_.playable) {
+ ev.action = Action::Play;
+ ev.game = detail_;
}
}
}
@@ -2871,12 +3101,13 @@ UiEvent AppUi::handle(const NavInput& in) {
if (in.back) ev.action = Action::CancelLaunch;
break;
case Screen::Error:
- if (!errorGame_.titleId.empty()) {
+ if (!errorGame_.titleId.empty() || !errorGame_.productId.empty()) {
if (in.accept) {
- if (errorGame_.freeInStore && !errorGame_.playable) {
+ if (isFreeGame(errorGame_) && !errorGame_.playable) {
ev.action = Action::ClaimFreeGame;
ev.game = errorGame_;
- } else {
+ ev.game.freeInStore = true;
+ } else if (errorGame_.playable && !errorGame_.titleId.empty()) {
ev.action = Action::Play;
ev.game = errorGame_;
}
@@ -3102,6 +3333,22 @@ void AppUi::drawHints(Canvas& c, const std::vector<std::pair<int, const char*>>&
fonts_.bold.draw(c, l2, l2Pill.x + (l2w - fonts_.bold.measure(l2, 14)) / 2,
fonts_.bold.centeredY(l2Pill.y, l2Pill.h, 14), 14, kGray);
x = l2Pill.x;
+ } else if (icon == kIconDpadLR) {
+ const char* l = "\xE2\x86\x90";
+ const char* r = "\xE2\x86\x92";
+ int lw = fonts_.bold.measure(l, 14) + 14;
+ int rw = fonts_.bold.measure(r, 14) + 14;
+ constexpr int kPillGap = 4;
+ int rightX = x + 2 * kR;
+ Rect rPill{rightX - rw, static_cast<int>(cy) - 12, rw, 24};
+ c.fillRect(rPill, rgba(255, 255, 255, 40), 8);
+ fonts_.bold.draw(c, r, rPill.x + (rw - fonts_.bold.measure(r, 14)) / 2,
+ fonts_.bold.centeredY(rPill.y, rPill.h, 14), 14, kGray);
+ Rect lPill{rPill.x - kPillGap - lw, static_cast<int>(cy) - 12, lw, 24};
+ c.fillRect(lPill, rgba(255, 255, 255, 40), 8);
+ fonts_.bold.draw(c, l, lPill.x + (lw - fonts_.bold.measure(l, 14)) / 2,
+ fonts_.bold.centeredY(lPill.y, lPill.h, 14), 14, kGray);
+ x = lPill.x;
} else if (icon == kIconR3 || icon == kIconL3) {
const char* label = buttonName(style, icon == kIconR3 ? PadButton::R3 : PadButton::L3);
int pillW = fonts_.bold.measure(label, 14) + 16;
@@ -3426,12 +3673,13 @@ void AppUi::drawCard(Canvas& c, const GameTile& t, int x, int y, bool focused, b
int maxLeftW = std::max(40, rightBadgeLeft - (x + 10) - 4);
const char* planBadge = planBadgeLabel(t.plan);
uint8_t myPlan = xcloud::planTier(subscription_);
- bool otherPlan = planBadge && (!t.playable || (myPlan > 0 && !xcloud::planIncludes(myPlan, t.plan, t.freeInStore)));
+ bool otherPlan = planBadge && (!t.playable || (myPlan > 0 && !xcloud::planIncludes(myPlan, t.plan, isFreeGame(t))));
bool showPlan = otherPlan || (planBadge && searching_ && tab_ == Tab::GamePass && filterPlan_ > 0 && t.friends.empty());
- if (t.purchasable) {
+ if (!t.playable && (t.purchasable || isFreeGame(t))) {
c.fillRect({x, y, kCard, kCard}, rgba(0, 0, 0, 70), 10);
auto price = prices_.find(t.productId);
- std::string label = t.freeInStore ? tr(Str::Free)
+ bool free = isFreeGame(t);
+ std::string label = free ? tr(Str::Free)
: price != prices_.end() ? price->second.now
: tr(Str::BuyBadge);
int tw = fonts_.bold.measure(label, 11);
@@ -3676,15 +3924,16 @@ void AppUi::drawSearch(Canvas& c, uint64_t nowMs) {
}
c.gradientV({0, kH - 190, kW, 110}, withAlpha(kBg, 0), withAlpha(kBg, 245));
c.fillRect({0, kH - 80, kW, 80}, withAlpha(kBg, 245));
- // The filters, two rows under the keys (over the fade): green when on;
- // the lists with a chevron.
- const int gap = kChipGap, px = 18, fh = 50;
- const int fy0 = kKeysY + (kKeyRows + 1) * (kKeyH + kKeyGap) + 6;
+ // The filters, 3x3 grid under the keys: green when on; the lists with a chevron.
+ const int gap = kChipGap, px = 18, fh = 48;
+ const int fy0 = kKeysY + (kKeyRows + 1) * (kKeyH + kKeyGap) + 8;
+ constexpr int kCols = 3;
+ const int chipW = (kKeysW - gap * (kCols - 1)) / kCols;
Rect openChip{};
- for (int row = 0; row < 2; ++row) {
+ for (int row = 0; row < 3; ++row) {
auto chips = filterRow(row);
- int fy = fy0 + row * (fh + 10);
- int chipW = chipWidth(static_cast<int>(chips.size()));
+ if (chips.empty()) continue;
+ int fy = fy0 + row * (fh + 8);
for (size_t k = 0; k < chips.size(); ++k) {
Filter f = chips[k];
bool on = filterOn(f);
@@ -3694,17 +3943,17 @@ void AppUi::drawSearch(Canvas& c, uint64_t nowMs) {
c.fillRect(chip, focused ? kWhite : on ? rgba(16, 124, 16, 255) : kPanel, fh / 2);
if (on && focused) c.strokeRect({chip.x + 3, chip.y + 3, chip.w - 6, chip.h - 6}, kGreen, 3, fh / 2 - 3);
Color text = focused ? kBg : kWhite;
- int room = chip.w - (isList(f) ? 44 : 16);
+ int room = chip.w - (isList(f) ? 56 : 20);
int chipPx = px;
while (chipPx > 13 && fonts_.semibold.measure(filterText(f), chipPx) > room) --chipPx;
std::string label = fonts_.semibold.fit(filterText(f), chipPx, room);
int tw = fonts_.semibold.measure(label, chipPx);
- int tx = chip.x + (isList(f) ? (chip.w - 22 - tw) / 2 : (chip.w - tw) / 2);
+ int tx = chip.x + (chip.w - tw) / 2;
fonts_.semibold.draw(c, label, tx, fonts_.semibold.centeredY(chip.y, chip.h, chipPx), chipPx, text);
if (isList(f)) { // a list: a chevron at the right
- float cx = static_cast<float>(chip.x + chip.w - 24), cy = static_cast<float>(chip.y + chip.h / 2);
- c.line(cx - 6, cy - 3, cx, cy + 3, 2.5f, text);
- c.line(cx, cy + 3, cx + 6, cy - 3, 2.5f, text);
+ float cx = static_cast<float>(chip.x + chip.w - 20), cy = static_cast<float>(chip.y + chip.h / 2);
+ c.line(cx - 5, cy - 3, cx, cy + 2, 2.2f, text);
+ c.line(cx, cy + 2, cx + 5, cy - 3, 2.2f, text);
}
}
}
@@ -3966,7 +4215,7 @@ void AppUi::drawDetails(Canvas& c, uint64_t nowMs) {
if (!drawHero(c, nowMs, g->heroUrl, true)) {
// No hero art (yet): the cover, until the art arrives and fades in.
drawBackground(c);
- if (!g->purchasable || g->freeInStore) { // paid games show their QR code there instead
+ if (g->playable || !g->purchasable || isFreeGame(*g)) { // paid games show their QR code there instead
if (auto img = images_.get(g->tileUrl, kCover, kCover)) c.drawImage(*img, cover.x, cover.y, 255, 16);
else c.fillRect(cover, kPlaceholder, 16);
}
@@ -3987,6 +4236,51 @@ void AppUi::drawDetails(Canvas& c, uint64_t nowMs) {
fonts_.semibold.draw(c, byLine, kMargin, y, 26, kGray);
y += 40;
}
+
+ // Age rating & content descriptors (ClassInd, ESRB, PEGI)
+ if (!g->ratingAge.empty()) {
+ Color badgeBg = rgba(100, 100, 100);
+ Color badgeFg = kWhite;
+ if (g->ratingAge == "Livre" || g->ratingAge == "E" || g->ratingAge == "3+" || g->ratingAge == "0") {
+ badgeBg = rgba(0, 160, 60);
+ } else if (g->ratingAge == "10+" || g->ratingAge == "E10+" || g->ratingAge == "7+") {
+ badgeBg = rgba(0, 120, 220);
+ } else if (g->ratingAge == "12+") {
+ badgeBg = rgba(230, 180, 0);
+ badgeFg = rgba(20, 20, 20);
+ } else if (g->ratingAge == "14+" || g->ratingAge == "T") {
+ badgeBg = rgba(235, 100, 0);
+ } else if (g->ratingAge == "16+" || g->ratingAge == "M") {
+ badgeBg = rgba(210, 30, 30);
+ } else if (g->ratingAge == "18+" || g->ratingAge == "AO") {
+ badgeBg = rgba(30, 30, 30);
+ }
+
+ int textW = fonts_.bold.measure(g->ratingAge, 20);
+ int badgeW = std::max(38, textW + 16);
+ int badgeH = 28;
+ Rect badge{kMargin, y + 2, badgeW, badgeH};
+ c.fillRect(badge, badgeBg, 6);
+ if (badgeBg == rgba(30, 30, 30)) {
+ c.strokeRect(badge, rgba(255, 255, 255, 160), 1, 6);
+ }
+ fonts_.bold.draw(c, g->ratingAge, badge.x + (badge.w - textW) / 2, fonts_.bold.centeredY(badge.y, badge.h, 20), 20, badgeFg);
+
+ std::string descLine;
+ if (!g->ratingSystem.empty()) descLine = g->ratingSystem;
+ for (const auto& d : g->ratingDescriptors) {
+ std::string next = (descLine.empty() ? "" : " \xE2\x80\xA2 ") + d;
+ if (fonts_.semibold.measure(descLine + next, 22) > 750) {
+ descLine += " ...";
+ break;
+ }
+ descLine += next;
+ }
+ if (!descLine.empty()) {
+ fonts_.semibold.draw(c, descLine, badge.x + badge.w + 14, fonts_.semibold.centeredY(badge.y, badge.h, 22), 22, kDim);
+ }
+ y += 38;
+ }
std::string cats;
if (const char* p = platformLabel(g->platform)) cats = p;
for (const auto& cat : g->categories) cats += (cats.empty() ? "" : " \xE2\x80\xA2 ") + cat;
@@ -3997,18 +4291,19 @@ void AppUi::drawDetails(Canvas& c, uint64_t nowMs) {
}
y += 10;
// Shorter for a free game, whose page also has the hint and Play below.
- int descLines = g->purchasable && g->freeInStore ? 4 : 6;
+ int descLines = !g->playable && isFreeGame(*g) ? 4 : 6;
for (const auto& line : fonts_.regular.wrap(g->description, 24, 880, descLines)) {
fonts_.regular.draw(c, line, kMargin, y, 24, kGray);
y += 34;
}
- if (g->purchasable) {
+ if (!g->playable && (g->purchasable || isFreeGame(*g))) {
// Streams once bought: the price and how to buy it on the left, a
// large QR code of the store page (for the phone) on the right. The
// console's browser can't run the xbox.com store, so no button.
int ty = y + 30;
auto price = prices_.find(g->productId);
- if (g->freeInStore) {
+ bool free = isFreeGame(*g);
+ if (free) {
// Free to play: "Get Free" button to claim license directly.
fonts_.bold.draw(c, tr(Str::Free), kMargin, ty, 52, kWhite);
ty += 84;
@@ -4038,7 +4333,7 @@ void AppUi::drawDetails(Canvas& c, uint64_t nowMs) {
}
ty += 84;
}
- if (!g->freeInStore) {
+ if (!free) {
drawBag(c, kMargin + 12, ty + 16, kGreen);
fonts_.semibold.draw(c, tr(Str::BuyToPlay), kMargin + 36, ty, 28, kWhite);
ty += 48;
@@ -4054,7 +4349,7 @@ void AppUi::drawDetails(Canvas& c, uint64_t nowMs) {
}
}
std::vector<Hint> hints;
- if (g->freeInStore) hints.push_back({kIconCross, tr(Str::ClaimFree)});
+ if (free) hints.push_back({kIconCross, tr(Str::ClaimFree)});
hints.push_back({kIconOptions, tr(Str::GameSettings)});
hints.push_back({kIconTriangle, tr(favorites_.count(g->productId) ? Str::RemoveFavorite : Str::AddFavorite)});
hints.push_back({kIconSquare, tr(hidden_.count(g->productId) ? Str::Unhide : Str::Hide)});
@@ -4175,8 +4470,20 @@ void AppUi::drawLaunching(Canvas& c, uint64_t nowMs) {
drawCentered(c, fonts_.bold, launching_.name, 500, 48, kWhite);
drawCentered(c, fonts_.semibold, tr(Str::GettingReady), 576, 30, kGray);
drawCentered(c, fonts_.regular, status_, 630, 26, kDim);
- // The touchpad's gestures, or the buttons and keys that do the same.
- drawCentered(c, fonts_.regular, tr(caps_.touchpad ? Str::GestureHint : Str::GestureHintButtons), 900, 22, kDim);
+ // Helpful tips rotating every ~5 seconds.
+ static constexpr Str kTips[] = {
+ Str::TipTouchpadMenu,
+ Str::TipKeyboardMouse,
+ Str::TipFreeStore,
+ Str::TipBugReportQr,
+ Str::TipSupportKofi,
+ Str::Tip120HzVideo,
+ Str::TipAnalogDeadzone,
+ Str::TipDualSenseMic,
+ };
+ constexpr size_t kTipCount = sizeof(kTips) / sizeof(kTips[0]);
+ size_t tipIndex = (nowMs / 5000) % kTipCount;
+ drawCentered(c, fonts_.regular, tr(kTips[tipIndex]), 900, 22, kDim);
drawHints(c, {{kIconCircle, tr(Str::Cancel)}});
}
@@ -4259,6 +4566,19 @@ void AppUi::drawSettings(Canvas& c) {
y += kRowH + kGap;
continue;
}
+ if (i == 10) {
+ // BitrateCap: inline slider without dropdown chevron
+ auto options = settingOptions(i);
+ int sel = settingSelected(i);
+ std::string value = sel < static_cast<int>(options.size()) ? options[static_cast<size_t>(sel)] : "";
+ std::string disp = "< " + value + " >";
+ int w = fonts_.regular.measure(disp, kRowPx);
+ int vx = r.x + r.w - 40;
+ fonts_.regular.draw(c, disp, vx - w, fonts_.regular.centeredY(r.y, r.h, kRowPx), kRowPx,
+ focused ? kWhite : kGray);
+ y += kRowH + kGap;
+ continue;
+ }
// The value, then a chevron: this opens a list.
auto options = settingOptions(i);
int sel = settingSelected(i);
@@ -4280,9 +4600,66 @@ void AppUi::drawSettings(Canvas& c) {
}
y += kRowH + kGap;
}
- for (const auto& line : fonts_.regular.wrap(tr(Str::SettingsNote), 22, kRowW, 2)) {
- fonts_.regular.draw(c, line, kMargin, y + 6, 22, kDim);
- y += 28;
+ static constexpr Str kSettingDescs[kSettingRows] = {
+ Str::SettingDescLanguage,
+ Str::SettingDescResolution,
+ Str::SettingDescRegion,
+ Str::SettingDescDeadzone,
+ Str::SettingDescTriggerRumble,
+ Str::SettingDescConfirmButton,
+ Str::SettingDescLightBar,
+ Str::SettingDescUpdates,
+ Str::SettingDescLoginCountry,
+ Str::SettingDescHighRefresh,
+ Str::SettingDescBitrateCap,
+ Str::SettingDescGameVolume,
+ Str::SettingDescKeyboardKeys,
+ Str::SettingDescDisplayMode,
+ Str::SettingDescControllerButtons,
+ Str::SettingDescGyro,
+ Str::SettingDescQueueReady,
+ Str::SettingDescCheckSignIn,
+ Str::SettingDescNetworkTest,
+ Str::SettingDescSupportProject,
+ };
+ if (settingsRow_ >= 0 && settingsRow_ < kSettingRows) {
+ int dy = 936;
+ const char* desc = tr(kSettingDescs[settingsRow_]);
+ for (const auto& line : fonts_.regular.wrap(desc, 22, kRowW, 3)) {
+ fonts_.regular.draw(c, line, kMargin, dy, 22, kDim);
+ dy += 28;
+ }
+ }
+
+ // Web UI / Remote QR panel on the right side (x = 1320..1840)
+ if (tester_ == Tester::None && !pickerOpen_) {
+ std::string qrUrl = !webUrl_.empty() ? webUrl_ : "http://" + platform::localIPv4() + ":8080";
+ Rect panel{1320, 200, 500, 710};
+ c.fillRect(panel, rgba(255, 255, 255, 14), 16);
+ c.strokeRect(panel, rgba(255, 255, 255, 30), 1, 16);
+
+ int py = panel.y + 26;
+ fonts_.bold.draw(c, tr(Str::WebControlTitle), panel.x + 28, py, 30, kWhite);
+ py += 40;
+ fonts_.semibold.draw(c, tr(Str::WebControlSubtitle), panel.x + 28, py, 22, rgba(16, 180, 80));
+ py += 34;
+
+ auto descLines = fonts_.regular.wrap(tr(Str::WebControlDesc), 20, panel.w - 56, 3);
+ for (const auto& l : descLines) {
+ fonts_.regular.draw(c, l, panel.x + 28, py, 20, kGray);
+ py += 26;
+ }
+ py += 18;
+
+ int qrTarget = 300;
+ int qrRight = panel.x + panel.w - (panel.w - (qrTarget + 40)) / 2;
+ Rect qrBox = drawQr(c, qrUrl, qrRight, py, qrTarget, qrcodegen_Ecc_LOW);
+ if (qrBox.h > 0) py += qrBox.h + 20;
+ else py += 340;
+
+ int urlW = fonts_.semibold.measure(qrUrl, 22);
+ int urlX = panel.x + (panel.w - urlW) / 2;
+ fonts_.semibold.draw(c, qrUrl, urlX, py, 22, kWhite);
}
if (pickerOpen_) {
@@ -4346,6 +4723,8 @@ void AppUi::drawSettings(Canvas& c) {
} else {
if (settingsRow_ == 16) {
drawHints(c, {{kIconCross, tr(Str::Change)}, {kIconSquare, tr(Str::TestSound)}, {kIconTriangle, tr(Str::ReportProblem)}, {kIconCircle, tr(Str::Back)}});
+ } else if (settingsRow_ == 10) {
+ drawHints(c, {{kIconDpadLR, tr(Str::Adjust)}, {kIconTriangle, tr(Str::ReportProblem)}, {kIconCircle, tr(Str::Back)}});
} else {
drawHints(c, {{kIconCross, tr(Str::Change)}, {kIconTriangle, tr(Str::ReportProblem)}, {kIconCircle, tr(Str::Back)}});
}
@@ -4437,7 +4816,7 @@ void AppUi::drawQuitPrompt(Canvas& c) {
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;
+ constexpr int kPanelW = 960, kPanelH = 340, kButtonW = 260, kButtonH = 72;
Rect panel{(kW - kPanelW) / 2, (kH - kPanelH) / 2 - 40, kPanelW, kPanelH};
c.fillRect({panel.x + 8, panel.y + 12, panel.w, panel.h}, rgba(0, 0, 0, 120), 26); // shadow
c.fillRect(panel, kPanel, 24);
@@ -4446,18 +4825,143 @@ void AppUi::drawUpdatePrompt(Canvas& c) {
auto lines = fonts_.regular.wrap(tr(Str::UpdatePrompt), 26, kPanelW - 112, 2);
for (size_t i = 0; i < lines.size(); ++i)
fonts_.regular.draw(c, lines[i], panel.x + 56, panel.y + 124 + static_cast<int>(i) * 36, 26, kGray);
- const char* labels[2] = {tr(Str::UpdateNow), tr(Str::NotNow)};
- for (int i = 0; i < 2; ++i) {
- Rect b{panel.x + 56 + i * (kButtonW + 24), panel.y + panel.h - kButtonH - 44, kButtonW, kButtonH};
+
+ // 3 buttons: Update now (0), What's new (1), Not now (2)
+ const char* labels[3] = {tr(Str::UpdateNow), tr(Str::WhatsNew), tr(Str::NotNow)};
+ constexpr int kGap = (kPanelW - 112 - 3 * kButtonW) / 2;
+ for (int i = 0; i < 3; ++i) {
+ Rect b{panel.x + 56 + i * (kButtonW + kGap), 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,
+ int tw = fonts_.semibold.measure(labels[i], 24);
+ fonts_.semibold.draw(c, labels[i], b.x + (b.w - tw) / 2, fonts_.semibold.centeredY(b.y, b.h, 24), 24,
on ? kBg : kWhite);
}
c.fillRect({0, kH - 80, kW, 80}, kBg); // the home screen's hints, under the pop-up's
drawPads(c);
- drawHints(c, {{kIconCross, tr(Str::Select)}, {kIconCircle, tr(Str::NotNow)}});
+ drawHints(c, {
+ {kIconCross, tr(Str::Select)},
+ {kIconSquare, tr(Str::WhatsNew)},
+ {kIconCircle, tr(Str::NotNow)}
+ });
+}
+
+void AppUi::formatUpdateNotes() {
+ updateNotesLines_.clear();
+ std::string lang = languageCode(language());
+ updateNotesLang_ = lang;
+ std::string raw = xc::app::filterReleaseNotes(updateNotes_, lang);
+ if (raw.empty()) raw = updateNotes_;
+ if (raw.empty()) raw = "No release notes provided.";
+
+ constexpr int kModalW = 1200, kModalH = 740;
+ int textW = kModalW - 128 - 28;
+ int textH = kModalH - 175;
+
+ size_t pos = 0;
+ while (pos < raw.size()) {
+ size_t next = raw.find('\n', pos);
+ std::string rawLine = raw.substr(pos, next == std::string::npos ? std::string::npos : next - pos);
+ if (!rawLine.empty() && rawLine.back() == '\r') rawLine.pop_back();
+
+ if (rawLine.rfind("### ", 0) == 0) {
+ std::string sub = rawLine.substr(4);
+ auto wrapped = fonts_.semibold.wrap(sub, 22, textW, 4);
+ for (const auto& w : wrapped) updateNotesLines_.push_back({w, false, true, false, false});
+ } else if (rawLine.rfind("## ", 0) == 0) {
+ std::string hdr = rawLine.substr(3);
+ auto wrapped = fonts_.bold.wrap(hdr, 26, textW, 4);
+ for (const auto& w : wrapped) updateNotesLines_.push_back({w, true, false, false, false});
+ } else if (rawLine.rfind("# ", 0) == 0) {
+ std::string hdr = rawLine.substr(2);
+ auto wrapped = fonts_.bold.wrap(hdr, 28, textW, 4);
+ for (const auto& w : wrapped) updateNotesLines_.push_back({w, true, false, false, false});
+ } else if (rawLine.rfind("- ", 0) == 0 || rawLine.rfind("* ", 0) == 0) {
+ std::string bullet = "• " + rawLine.substr(2);
+ auto wrapped = fonts_.regular.wrap(bullet, 22, textW, 6);
+ for (size_t wi = 0; wi < wrapped.size(); ++wi) {
+ updateNotesLines_.push_back({wrapped[wi], false, false, wi == 0, wi > 0});
+ }
+ } else if (!rawLine.empty()) {
+ auto wrapped = fonts_.regular.wrap(rawLine, 22, textW, 8);
+ for (const auto& w : wrapped) updateNotesLines_.push_back({w, false, false, false, false});
+ } else {
+ updateNotesLines_.push_back({"", false, false, false, false});
+ }
+
+ if (next == std::string::npos) break;
+ pos = next + 1;
+ }
+
+ constexpr int kLineH = 32;
+ int visibleLines = textH / kLineH;
+ int totalLines = static_cast<int>(updateNotesLines_.size());
+ updateNotesMaxScroll_ = std::max(0, totalLines - visibleLines);
+ updateNotesScroll_ = std::clamp(updateNotesScroll_, 0, updateNotesMaxScroll_);
+}
+
+void AppUi::drawUpdateNotesModal(Canvas& c) {
+ std::string currentLang = languageCode(language());
+ if (updateNotesLines_.empty() || updateNotesLang_ != currentLang) {
+ formatUpdateNotes();
+ }
+
+ std::string title = tr(Str::WhatsNewTitle);
+ if (!updateAvailable_.empty()) {
+ title += " - " + updateAvailable_;
+ }
+ constexpr int kModalW = 1200, kModalH = 740;
+ Rect panel = drawModal(c, kModalW, kModalH, title);
+
+ int textX = panel.x + 64;
+ int textY = panel.y + 115;
+ int textH = panel.h - 175;
+
+ constexpr int kLineH = 32;
+ int visibleLines = textH / kLineH;
+ int totalLines = static_cast<int>(updateNotesLines_.size());
+ updateNotesScroll_ = std::clamp(updateNotesScroll_, 0, updateNotesMaxScroll_);
+
+ c.fillRect({panel.x + 44, textY - 12, panel.w - 88, textH + 24}, rgba(18, 18, 18, 220), 12);
+ c.strokeRect({panel.x + 44, textY - 12, panel.w - 88, textH + 24}, rgba(255, 255, 255, 25), 1, 12);
+
+ int curY = textY;
+ int endIdx = std::min(totalLines, updateNotesScroll_ + visibleLines);
+ for (int i = updateNotesScroll_; i < endIdx; ++i) {
+ const auto& fl = updateNotesLines_[static_cast<size_t>(i)];
+ if (!fl.text.empty()) {
+ if (fl.isHeader) {
+ fonts_.bold.draw(c, fl.text, textX, curY, 26, kWhite);
+ } else if (fl.isSubHeader) {
+ fonts_.semibold.draw(c, fl.text, textX, curY, 22, rgba(120, 220, 120));
+ } else if (fl.isBullet) {
+ fonts_.regular.draw(c, fl.text, textX + 6, curY, 22, rgba(235, 235, 235));
+ } else if (fl.isBulletContinuation) {
+ fonts_.regular.draw(c, fl.text, textX + 28, curY, 22, rgba(235, 235, 235));
+ } else {
+ fonts_.regular.draw(c, fl.text, textX, curY, 22, kGray);
+ }
+ }
+ curY += kLineH;
+ }
+
+ if (totalLines > visibleLines) {
+ int barTrackX = panel.x + panel.w - 60;
+ int barTrackY = textY - 4;
+ int barTrackH = textH + 8;
+ c.fillRect({barTrackX, barTrackY, 6, barTrackH}, rgba(255, 255, 255, 30), 3);
+ float ratio = static_cast<float>(visibleLines) / totalLines;
+ int thumbH = std::max(32, static_cast<int>(barTrackH * ratio));
+ float scrollPct = updateNotesMaxScroll_ > 0 ? static_cast<float>(updateNotesScroll_) / updateNotesMaxScroll_ : 0.0f;
+ int thumbY = barTrackY + static_cast<int>((barTrackH - thumbH) * scrollPct);
+ c.fillRect({barTrackX, thumbY, 6, thumbH}, kWhite, 3);
+ }
+
+ c.fillRect({0, kH - 80, kW, 80}, kBg);
+ drawPads(c);
+ drawHints(c, {
+ {kIconCircle, tr(Str::Back)}
+ });
}
Rect AppUi::drawModal(Canvas& c, int w, int h, const std::string& title) {
@@ -5266,7 +5770,10 @@ void AppUi::render(Canvas& c, uint64_t nowMs) {
case Screen::Updating: drawUpdating(c, nowMs); break;
case Screen::Streaming: break;
}
- if (screen_ == Screen::Home && updatePrompt_) drawUpdatePrompt(c);
+ if (screen_ == Screen::Home && updatePrompt_) {
+ if (showingUpdateNotes_) drawUpdateNotesModal(c);
+ else drawUpdatePrompt(c);
+ }
if (screen_ == Screen::Home && quitPrompt_) drawQuitPrompt(c);
if (screen_ == Screen::Error && countryPickerOpen_) drawCountryPicker(c);
if (reportOpen_) drawReport(c);
diff --git a/src/ui/app_ui.h b/src/ui/app_ui.h
index d5e049a..b8b0a5d 100644
--- a/src/ui/app_ui.h
+++ b/src/ui/app_ui.h
@@ -61,6 +61,10 @@ struct GameTile {
uint32_t modes = 0;
uint8_t languages = 0;
uint8_t plan = 0; // xcloud::kPlanEssential..kPlanUltimate (0 for free-to-play or unknown)
+ // Age rating & content descriptors (ClassInd, ESRB, PEGI)
+ std::string ratingAge;
+ std::string ratingSystem;
+ std::vector<std::string> ratingDescriptors;
// Active friends playing this game now
std::vector<FriendPlaying> friends;
};
@@ -125,7 +129,7 @@ struct SettingsChoice {
int deband = 3;
int upscaler = 2;
bool highRefresh = false; // 120 Hz output while a game streams
- int maxBitrateMbps = 0; // 0 automatic, else 30 / 25 / 22 / 20 / 15 / 10 / 5
+ int maxBitrateMbps = 0; // 0 automatic, else 5 / 10 / 15 / 20 / 25 / 30 / 35 / 40 / 45 / 50
int gameVolume = 100; // percent: 25 / 50 / 75 / 100 / 150
bool queueReadyAlert = true; // Queue-ready chime and rumble alert
input::KeyMap keyMap = input::defaultKeyMap(); // the keyboard as a player's controller
@@ -364,6 +368,17 @@ public:
void setFullscreen(bool on);
SettingsChoice settings() const; // what Settings holds now (the autoplay tests put it back)
int settingsFocus() const; // the Settings row focused (its id), for the autoplay tests' checks
+ void setWebUrl(const std::string& url);
+ std::string webUrl() const;
+ void setSearchQuery(const std::string& query);
+ std::string searchQuery() const;
+ enum class Filter { Plan, Free, Cheapest, Console, Mode, Genre, Publisher, Language, MouseKeyboard, Wishlist };
+ void setSearchTab(Tab t);
+ Tab searchTab() const;
+ void setSearchState(const std::string* query, const Tab* tab,
+ const std::vector<std::pair<Filter, int>>* filters);
+ int filterSelectedPublic(Filter f) const;
+ bool filterOnPublic(Filter f) const;
// Per-game settings
void setPerGameSettings(const std::map<std::string, app::GameProfile>& perGame);
// The general gyro aiming (set from the in-game menu): what a game
@@ -402,14 +417,17 @@ public:
void setRegions(std::vector<std::string> regions, const std::string& defaultRegion);
// Updates: this version, and the newer one (empty: up to date);
// `checking` while it is being asked (Settings shows it).
- void setUpdateState(const std::string& current, const std::string& available, bool checking);
+ void setUpdateState(const std::string& current, const std::string& available, bool checking, const std::string& notes = "");
+ void setUpdateNotes(const std::string& notes);
void setSignInCheckState(const SignInCheckState& state);
SignInCheckState signInCheckState() const;
void setNetworkTestState(const NetworkTestState& state);
NetworkTestState networkTestState() const;
// The pop-up offering the newer version, over the home screen.
- void offerUpdate();
+ void offerUpdate(const std::string& notes = "");
bool updateOffered() const;
+ bool showingUpdateNotes() const;
+ void showUpdateNotes(bool show);
// The screen while it updates: `status` and, 0..1, how far (-1: a spinner).
void showUpdating(const std::string& version);
void setUpdateStatus(const std::string& status, float fraction);
@@ -424,8 +442,10 @@ public:
// The search keyboard's focus (row, column), for the tests.
std::pair<int, int> searchKeyFocus() const;
std::vector<std::pair<std::string, PriceInfo>> searchResults(size_t max) const;
- enum class Filter { Plan, Free, Cheapest, Console, Mode, Genre, Publisher, Language, MouseKeyboard, Wishlist };
void chooseFilter(Filter f, int index);
+ std::vector<Filter> filterRow(int row) const;
+ bool isAcquired(const GameTile& t) const;
+ bool isFreeGame(const GameTile& t) const;
// Autoplay tests: where the focus is ("Game Pass row 2 card 6", ...).
std::string focusDescription() const;
void invalidate();
@@ -505,14 +525,12 @@ private:
// The filter buttons of the current tab's search.
// The search's filters, in two rows: Free, Lowest price (in "Your games"
// only) and Console; then Mode, Genre, Publisher and Language. The lists open a
- // drop-down; Free and Lowest price turn on and off.
- std::vector<Filter> filterRow(int row) const;
bool isList(Filter f) const { return f != Filter::Free && f != Filter::Cheapest && f != Filter::MouseKeyboard && f != Filter::Wishlist; }
- bool isAcquired(const GameTile& t) const;
std::string filterText(Filter f) const; // the chip's label: its choice when one is made
bool filterOn(Filter f) const;
std::vector<std::string> filterOptions(Filter f) const;
int filterSelected(Filter f) const;
+ void applyFilterLocked(Filter f, int index);
void chooseFilterLocked(Filter f, int index);
void pressFilter(Filter f);
std::vector<std::string> poolGenres() const; // the genres of the tab's games, most common first
@@ -531,6 +549,8 @@ private:
void drawError(Canvas& c);
void drawSettings(Canvas& c);
void drawUpdatePrompt(Canvas& c);
+ void drawUpdateNotesModal(Canvas& c);
+ void formatUpdateNotes();
void drawQuitPrompt(Canvas& c);
void drawReport(Canvas& c);
void drawCountryPicker(Canvas& c);
@@ -649,7 +669,7 @@ private:
std::vector<std::string> categories;
};
std::map<std::string, DetailInfo> detailInfo_; // fetched on demand, by product id
- std::string updateCurrent_, updateAvailable_;
+ std::string updateCurrent_, updateAvailable_, updateNotes_;
bool updateChecking_ = false;
SignInCheckState signInCheck_;
NetworkTestState networkTest_;
@@ -661,8 +681,20 @@ private:
std::string settingsCountry_; // the sign-in country when Settings opened
std::string reportUrl_, reportHeading_, reportDetail_;
bool updatePrompt_ = false; // the pop-up is up (on the home screen)
+ bool showingUpdateNotes_ = false;
+ int updateNotesScroll_ = 0;
+ int updateNotesMaxScroll_ = 0;
+ std::string updateNotesLang_;
+ struct FormattedNoteLine {
+ std::string text;
+ bool isHeader = false;
+ bool isSubHeader = false;
+ bool isBullet = false;
+ bool isBulletContinuation = false;
+ };
+ std::vector<FormattedNoteLine> updateNotesLines_;
bool quitPrompt_ = false; // desktop: "Close PSBox?" is up (Circle / Esc on the home screen)
- int promptFocus_ = 0; // 0 Update now, 1 Not now
+ int promptFocus_ = 0; // 0 Update now, 1 Whats new, 2 Not now
std::string updatingTo_, updateStatus_;
float updateFraction_ = -1;
Tester tester_ = Tester::None;
@@ -719,6 +751,7 @@ private:
bool achievementsOpen_ = false;
int achScroll_ = 0;
int detailButtonFocus_ = 0; // 0 = Play / Claim, 1 = Achievements
+ std::string webUrl_;
};
} // namespace xc::ui
diff --git a/src/ui/input_mode.h b/src/ui/input_mode.h
index 6dab755..4d3faa9 100644
--- a/src/ui/input_mode.h
+++ b/src/ui/input_mode.h
@@ -13,9 +13,9 @@ inline std::atomic<bool> g_keyboardHints{false};
// The key each controller glyph stands for, as the hints show it.
inline const char* keyLabel(int icon) {
- // As app_ui.cpp's Icon: Cross, Circle, Options, Triangle, Touchpad, Square, R3, L2 R2.
- static const char* const kLabels[] = {"Enter", "Esc", "Tab", "F", "Del", "H", "R", "Z C"};
- return icon >= 0 && icon < 8 ? kLabels[icon] : "";
+ // As app_ui.cpp's Icon: Cross, Circle, Options, Triangle, Touchpad, Square, R3, L3, L2 R2, DpadLR.
+ static const char* const kLabels[] = {"Enter", "Esc", "Tab", "F", "Del", "H", "R", "Shift", "Z C", "<- ->"};
+ return icon >= 0 && icon < 10 ? kLabels[icon] : "";
}
} // namespace xc::ui
diff --git a/src/ui/stream_menu.cpp b/src/ui/stream_menu.cpp
index 541f1f0..425d909 100644
--- a/src/ui/stream_menu.cpp
+++ b/src/ui/stream_menu.cpp
@@ -41,6 +41,7 @@ bool StreamMenu::itemShown(int item) const {
case Triggers: return caps_.triggerRumble || caps_.adaptiveTriggers;
case GyroItem:
case GyroLevelItem: return caps_.gyro;
+ case PadSpeakerVolumeItem: return caps_.triggerRumble || caps_.adaptiveTriggers;
default: return true;
}
}
@@ -65,7 +66,7 @@ void StreamMenu::setProfileValues(int resolution, int sharpness, int deband, int
void StreamMenu::open(int resolution, bool stats, int sharpness, int deband, int upscaler, bool homeConsole,
bool allow1440, bool hasCustomProfile, int triggerStrength, int deadzone,
- bool circleConfirms, float micLevel, bool micMuted) {
+ bool circleConfirms, float micLevel, bool micMuted, int padSpeakerVolume) {
open_ = true;
homeConsole_ = homeConsole;
allow1440_ = allow1440;
@@ -79,6 +80,7 @@ void StreamMenu::open(int resolution, bool stats, int sharpness, int deband, int
circleConfirms_ = circleConfirms;
micLevel_ = micLevel;
micMuted_ = micMuted;
+ padSpeakerVolume_ = std::clamp(padSpeakerVolume, 0, 100);
selected_ = XboxButton;
resolution_ = applied_ = resolution;
resolutionAsked_ = false;
@@ -171,6 +173,12 @@ MenuAction StreamMenu::handle(const NavInput& in) {
gyroLevel_ = level;
return MenuAction::Gyro;
}
+ if (selected_ == PadSpeakerVolumeItem && (in.left || in.right)) {
+ int newVol = std::clamp(padSpeakerVolume_ + (in.right ? 5 : -5), 0, 100);
+ if (newVol == padSpeakerVolume_) return MenuAction::None;
+ padSpeakerVolume_ = newVol;
+ return MenuAction::PadSpeakerVolume;
+ }
if (selected_ == Stats && (in.left || in.right)) {
stats_ = !stats_;
return MenuAction::Stats;
@@ -304,6 +312,7 @@ Canvas StreamMenu::renderMenu(const StreamInfo& info) const {
: i == ConfirmItem ? tr(Str::ConfirmButton)
: i == GyroItem ? tr(Str::Gyro)
: i == GyroLevelItem ? tr(Str::GyroIntensity)
+ : i == PadSpeakerVolumeItem ? tr(Str::PadSpeakerVolume)
: homeConsole_ ? tr(Str::MenuEndStream)
: tr(Str::MenuLeave);
fonts_.semibold.draw(c, label, row.x + 16, ty, kPx, fg);
@@ -356,6 +365,10 @@ Canvas StreamMenu::renderMenu(const StreamInfo& info) const {
value = std::to_string(gyroLevel_) + " / 10";
if (sel) value = "< " + value + " >";
}
+ if (i == PadSpeakerVolumeItem) {
+ value = padSpeakerVolume_ == 0 ? tr(Str::Mute) : std::to_string(padSpeakerVolume_) + " %";
+ if (sel) value = "< " + value + " >";
+ }
if (i == ConfirmItem) {
value = circleConfirms_ ? "○" : "×";
if (sel) value = "< " + value + " >";
diff --git a/src/ui/stream_menu.h b/src/ui/stream_menu.h
index 506eee6..b49f890 100644
--- a/src/ui/stream_menu.h
+++ b/src/ui/stream_menu.h
@@ -43,7 +43,7 @@ enum StatsIndicator : uint32_t {
// Close: the menu went away (Circle, OPTIONS, or the Xbox button): a fresh key frame is asked for.
enum class MenuAction {
None, Close, Leave, Resolution, Stats, Sharpness, Deband, Upscaler, XboxButton,
- ProfileToggle, Triggers, Deadzone, ConfirmButton, MicToggle, Gyro
+ ProfileToggle, Triggers, Deadzone, ConfirmButton, MicToggle, Gyro, PadSpeakerVolume
};
class StreamMenu {
@@ -64,7 +64,7 @@ public:
// `allow1440`: offered only once a stream delivered it.
void open(int resolution, bool stats, int sharpness = 0, int deband = 1, int upscaler = 0, bool homeConsole = false,
bool allow1440 = true, bool hasCustomProfile = false, int triggerStrength = 2, int deadzone = 15,
- bool circleConfirms = false, float micLevel = 0.0f, bool micMuted = false);
+ bool circleConfirms = false, float micLevel = 0.0f, bool micMuted = false, int padSpeakerVolume = 100);
void close() { open_ = false; }
bool isOpen() const { return open_; }
MenuAction handle(const NavInput& in);
@@ -85,6 +85,8 @@ public:
void setDeadzone(int deadzone) { deadzone_ = deadzone; }
bool circleConfirms() const { return circleConfirms_; }
void setCircleConfirms(bool cc) { circleConfirms_ = cc; }
+ int padSpeakerVolume() const { return padSpeakerVolume_; }
+ void setPadSpeakerVolume(int vol) { padSpeakerVolume_ = vol; }
// Gyro aiming: mode (input::GyroMode) and intensity 1..input::kGyroLevels.
int gyroMode() const { return gyroMode_; }
int gyroLevel() const { return gyroLevel_; }
@@ -129,6 +131,7 @@ private:
ConfirmItem,
GyroItem,
GyroLevelItem,
+ PadSpeakerVolumeItem,
Leave,
ItemCount
};
@@ -154,6 +157,7 @@ private:
int gyroMode_ = 0, gyroLevel_ = 5;
bool micMuted_ = false;
float micLevel_ = 0.0f;
+ int padSpeakerVolume_ = 100;
PadSlots pads_{};
mutable std::vector<float> frametimes_;
};
diff --git a/src/ui/strings.cpp b/src/ui/strings.cpp
index 04608c4..a42346a 100644
--- a/src/ui/strings.cpp
+++ b/src/ui/strings.cpp
@@ -70,6 +70,7 @@ constexpr Column kEnglish = {
"Best (Auto)", // ResBest
"Resolution and region apply to the next game you start.", // SettingsNote
"Change", // Change
+ "Adjust", // Adjust
"Hold to sign out", // HoldSignOut
"Keep holding to sign out (%s)", // SigningOutIn
"Sign-in failed: %s", // SignInFailed
@@ -373,6 +374,43 @@ constexpr Column kEnglish = {
"Scan with your phone to support", // ScanToDonate
"Test sound", // TestSound
"Wishlist is empty", // WishlistEmpty
+ // Loading tips
+ "Touchpad gestures or L2 + R2 + Touchpad open the in-game menu and Xbox guide", // TipTouchpadMenu
+ "USB keyboard and mouse plugged into the console are supported in enabled cloud games", // TipKeyboardMouse
+ "Claim free games, trials, and discover store promotions directly from the app library", // TipFreeStore
+ "Encountered an issue? Open Bug Report to scan a QR code with auto-attached console logs", // TipBugReportQr
+ "Enjoying the project? Support future development via Ko-fi in the Settings tab!", // TipSupportKofi
+ "Enable 120 Hz display output in Settings for reduced frame latency and smoother response", // Tip120HzVideo
+ "Calibrate DualSense stick dead zones in Settings to eliminate stick drift and improve precision", // TipAnalogDeadzone
+ "Use the DualSense built-in microphone for party and multiplayer game voice chat", // TipDualSenseMic
+ // Settings descriptions
+ "Changes the language of the application interface and the preferred audio and subtitles in cloud games", // SettingDescLanguage
+ "Sets the maximum streaming video resolution (1080p, 720p, or Best available). Takes effect on the next launch", // SettingDescResolution
+ "Selects the Microsoft datacenter region for streaming (Automatic or specific regions). Takes effect on the next launch", // SettingDescRegion
+ "Adjusts the inner dead zone of DualSense analog sticks to prevent stick drift and unintended movement", // SettingDescDeadzone
+ "Enables or disables impulse trigger vibration emulation on DualSense L2 and R2 adaptive triggers", // SettingDescTriggerRumble
+ "Toggles the confirm and back button layout between Cross (Western style) and Circle (Japanese style)", // SettingDescConfirmButton
+ "Configures the light bar color and behavior of your DualSense controller during browsing and gameplay", // SettingDescLightBar
+ "Checks for and automatically installs official app updates directly on your console without needing a PC", // SettingDescUpdates
+ "Allows signing in to your Xbox account via a different geographic region to access alternative catalogs", // SettingDescLoginCountry
+ "Enables 120 Hz video output on your console for lower display lag and reduced input latency", // SettingDescHighRefresh
+ "Sets the maximum bandwidth limit for video streaming, ensuring higher visual fidelity or saving network data", // SettingDescBitrateCap
+ "Adjusts the master audio volume level played during game streaming sessions", // SettingDescGameVolume
+ "Maps USB or Bluetooth keyboard keys to the corresponding Xbox controller buttons during gameplay", // SettingDescKeyboardKeys
+ "Toggles between windowed and fullscreen display mode on supported desktop platforms", // SettingDescDisplayMode
+ "Opens the response test and calibration screen for all buttons and axes on your connected controller", // SettingDescControllerButtons
+ "Enables DualSense motion sensors to assist with analog aiming in shooter and action games", // SettingDescGyro
+ "Plays a distinctive chime when your wait in the xCloud queue finishes and your game is ready", // SettingDescQueueReady
+ "Runs a complete diagnostic on your Xbox Live sign-in, validating access tokens, profile, and subscriptions", // SettingDescCheckSignIn
+ "Measures ping (RTT) and jitter to cloud gaming datacenters across multiple global regions", // SettingDescNetworkTest
+ "Displays a QR Code to support the developer via Ko-fi and help keep the project actively maintained", // SettingDescSupportProject
+ "What's New", // WhatsNew
+ "What's New", // WhatsNewTitle
+ "Controller speaker", // PadSpeakerVolume
+ "Mute", // Mute
+ "Web Control", // WebControlTitle
+ "Connect from your phone", // WebControlSubtitle
+ "Connect to the same Wi-Fi to type search, remap buttons or download logs.", // WebControlDesc
};
constexpr Column kPortugueseBR = {
@@ -413,6 +451,7 @@ constexpr Column kPortugueseBR = {
"Melhor (Auto)",
"A resolução e a região valem a partir do próximo jogo.",
"Alterar",
+ "Ajustar",
"Segure para sair da conta",
"Continue segurando para sair da conta (%s)",
"Falha ao entrar: %s",
@@ -716,6 +755,43 @@ constexpr Column kPortugueseBR = {
"Aponte a câmera do seu celular", // ScanToDonate
"Testar som", // TestSound
"A lista de desejos está vazia", // WishlistEmpty
+ // Loading tips
+ "Gestos no Touchpad ou L2 + R2 + Touchpad abrem o menu do jogo e o guia do Xbox", // TipTouchpadMenu
+ "Teclado e mouse USB conectados ao console são suportados em jogos compatíveis da nuvem", // TipKeyboardMouse
+ "Adquira jogos gratuitos, demonstrações e confira promoções da loja direto pelo aplicativo", // TipFreeStore
+ "Encontrou um problema? Abra Relatar Problema para escanear um QR code com logs do console", // TipBugReportQr
+ "Gostando do app? Apoie o desenvolvimento contínuo via Ko-fi na aba de Configurações!", // TipSupportKofi
+ "Ative a saída de vídeo em 120 Hz nas Configurações para menor latência e resposta mais rápida", // Tip120HzVideo
+ "Ajuste a zona morta dos analógicos do DualSense nas Configurações para eliminar drift", // TipAnalogDeadzone
+ "Use o microfone integrado do DualSense para bate-papo de voz em grupos e jogos multijogador", // TipDualSenseMic
+ // Settings descriptions
+ "Altera o idioma da interface do aplicativo e a preferência de áudio e legendas nos jogos da nuvem", // SettingDescLanguage
+ "Define a resolução máxima do fluxo de vídeo transmitido (1080p, 720p ou Melhor). Vale a partir do próximo jogo", // SettingDescResolution
+ "Seleciona a região de servidores Microsoft para streaming (Automático ou regiões específicas). Vale a partir do próximo jogo", // SettingDescRegion
+ "Ajusta a sensibilidade inicial dos analógicos do DualSense para evitar drift ou comandos involuntários", // SettingDescDeadzone
+ "Ativa ou desativa a simulação dos motores de vibração nos gatilhos adaptáveis L2 e R2 em jogos compatíveis", // SettingDescTriggerRumble
+ "Alterna a função de confirmar e voltar entre Cruz (padrão ocidental) e Círculo (padrão japonês)", // SettingDescConfirmButton
+ "Configura a cor e o comportamento da barra de luz do DualSense durante a navegação e a jogatina", // SettingDescLightBar
+ "Verifica e instala automaticamente novas versões lançadas do aplicativo diretamente pelo console sem PC", // SettingDescUpdates
+ "Permite autenticar sua conta Xbox através de outra região geográfica para acessar catálogos alternativos", // SettingDescLoginCountry
+ "Ativa saída de vídeo em 120 Hz no console para menor atraso de exibição e redução da latência de comando", // SettingDescHighRefresh
+ "Define o limite máximo de bitrate para o stream de vídeo, garantindo fidelidade visual ou economizando rede", // SettingDescBitrateCap
+ "Ajusta o nível geral do volume de áudio reproduzido durante as sessões de streaming dos jogos", // SettingDescGameVolume
+ "Mapeia as teclas do teclado USB ou Bluetooth para os botões correspondentes do controle Xbox no jogo", // SettingDescKeyboardKeys
+ "Alterna entre modo de janela ou tela cheia em plataformas desktop suportadas", // SettingDescDisplayMode
+ "Abre o painel de teste de resposta e calibração de todos os botões e eixos do controle conectado", // SettingDescControllerButtons
+ "Permite usar os sensores de movimento do DualSense para auxiliar na mira em jogos de tiro e ação", // SettingDescGyro
+ "Toca um aviso sonoro característico quando o tempo de espera na fila do xCloud terminar e o jogo iniciar", // SettingDescQueueReady
+ "Realiza um diagnóstico completo da autenticação Xbox Live, validando tokens de acesso, perfil e assinaturas", // SettingDescCheckSignIn
+ "Mede o ping (RTT) e a variação (jitter) para servidores de jogos em nuvem de várias regiões globais", // SettingDescNetworkTest
+ "Exibe um QR Code para você apoiar o desenvolvedor via Ko-fi e ajudar a manter o projeto ativo e atualizado", // SettingDescSupportProject
+ "Novidades", // WhatsNew
+ "Novidades", // WhatsNewTitle
+ "Alto-falante do controle", // PadSpeakerVolume
+ "Mudo", // Mute
+ "Configuração Web", // WebControlTitle
+ "Acesse pelo celular", // WebControlSubtitle
+ "Conecte no mesmo Wi-Fi para pesquisar, remapear botões ou baixar logs.", // WebControlDesc
};
constexpr Column kSpanish = {
@@ -756,6 +832,7 @@ constexpr Column kSpanish = {
"Mejor (Auto)",
"La resolución y la región se aplican al próximo juego que inicies.",
"Cambiar",
+ "Ajustar",
"Mantén para cerrar sesión",
"Sigue manteniendo para cerrar sesión (%s)",
"Error al iniciar sesión: %s",
@@ -1059,6 +1136,43 @@ constexpr Column kSpanish = {
"Escanea con tu teléfono para donar", // ScanToDonate
"Probar sonido", // TestSound
"La lista de deseos está vacía", // WishlistEmpty
+ // Loading tips
+ "Gestos en el Touchpad o L2 + R2 + Touchpad abren el menú del juego y la guía de Xbox", // TipTouchpadMenu
+ "Teclado y ratón USB conectados a la consola son compatibles con juegos de la nube habilitados", // TipKeyboardMouse
+ "Reclama juegos gratis, demos y descubre promociones de la tienda directamente desde la aplicación", // TipFreeStore
+ "¿Encontraste un problema? Abre Notificar problema para escanear un QR con registros de la consola", // TipBugReportQr
+ "¿Disfrutas del proyecto? ¡Apoya su desarrollo futuro a través de Ko-fi en Configuración!", // TipSupportKofi
+ "Activa salida de vídeo a 120 Hz en Configuración para menor latencia y respuesta más fluida", // Tip120HzVideo
+ "Calibra la zona muerta de los sticks en Configuración para eliminar deriva y mejorar la precisión", // TipAnalogDeadzone
+ "Usa el micrófono integrado del DualSense para chat de voz en grupos y partidas multijugador", // TipDualSenseMic
+ // Settings descriptions
+ "Cambia el idioma de la interfaz de la aplicación y la preferencia de audio y subtítulos en juegos en la nube", // SettingDescLanguage
+ "Establece la resolución máxima del stream de vídeo (1080p, 720p o Mejor disponible). Se aplica en el próximo juego", // SettingDescResolution
+ "Selecciona la región de servidores de Microsoft para streaming (Automático o regiones específicas). Se aplica en el próximo juego", // SettingDescRegion
+ "Ajusta la zona muerta interna de los sticks analógicos para evitar deriva y movimientos no deseados", // SettingDescDeadzone
+ "Activa o desactiva la vibración de gatillos adaptativos L2 y R2 en juegos compatibles", // SettingDescTriggerRumble
+ "Alterna la función de confirmar y volver entre Cruz (estilo occidental) y Círculo (estilo japonés)", // SettingDescConfirmButton
+ "Configura el color y comportamiento de la barra luminosa del DualSense en menús y durante el juego", // SettingDescLightBar
+ "Comprueba e instala automáticamente actualizaciones oficiales de la aplicación directamente en la consola", // SettingDescUpdates
+ "Permite iniciar sesión en tu cuenta de Xbox mediante otra región geográfica para acceder a catálogos alternativos", // SettingDescLoginCountry
+ "Activa salida de vídeo a 120 Hz en tu consola para reducir el retardo de pantalla y la latencia de entrada", // SettingDescHighRefresh
+ "Define el límite máximo de tasa de bits para streaming de vídeo, asegurando calidad visual o ahorrando red", // SettingDescBitrateCap
+ "Ajusta el volumen general del audio reproducido durante las sesiones de juego en la nube", // SettingDescGameVolume
+ "Asigna teclas del teclado USB o Bluetooth a los botones correspondientes del mando de Xbox durante el juego", // SettingDescKeyboardKeys
+ "Alterna entre modo ventana y pantalla completa en plataformas de escritorio compatibles", // SettingDescDisplayMode
+ "Abre la pantalla de prueba de respuesta y calibración de todos los botones y ejes del mando conectado", // SettingDescControllerButtons
+ "Permite que los sensores de movimiento del DualSense asistan al apuntado analógico en juegos de disparos", // SettingDescGyro
+ "Reproduce un aviso sonoro cuando termina la espera en cola de xCloud y el juego está listo", // SettingDescQueueReady
+ "Ejecuta un diagnóstico completo del inicio de sesión de Xbox Live, validando tokens, perfil y suscripciones", // SettingDescCheckSignIn
+ "Mide el ping (RTT) y la fluctuación (jitter) a centros de datos de juegos en la nube en múltiples regiones", // SettingDescNetworkTest
+ "Muestra un código QR para apoyar al desarrollador mediante Ko-fi y mantener el proyecto activo", // SettingDescSupportProject
+ "Novedades", // WhatsNew
+ "Novedades", // WhatsNewTitle
+ "Altavoz del mando", // PadSpeakerVolume
+ "Silenciado", // Mute
+ "Control Web", // WebControlTitle
+ "Conectar desde el móvil", // WebControlSubtitle
+ "Conéctate al mismo Wi-Fi para buscar, reasignar botones o descargar registros.", // WebControlDesc
};
constexpr Column kFrench = {
@@ -1099,6 +1213,7 @@ constexpr Column kFrench = {
"Meilleure (Auto)",
"La résolution et la région s'appliquent au prochain jeu lancé.",
"Modifier",
+ "Ajuster",
"Maintenez pour vous déconnecter",
"Continuez à maintenir pour vous déconnecter (%s)",
"Échec de la connexion : %s",
@@ -1402,6 +1517,43 @@ constexpr Column kFrench = {
"Scannez avec votre téléphone", // ScanToDonate
"Tester le son", // TestSound
"La liste de souhaits est vide", // WishlistEmpty
+ // Loading tips
+ "Gestes sur le pavé tactile ou L2 + R2 + Pavé tactile ouvrent le menu du jeu et le guide Xbox", // TipTouchpadMenu
+ "Clavier et souris USB branchés sur la console sont pris en charge dans les jeux du cloud compatibles", // TipKeyboardMouse
+ "Obtenez des jeux gratuits, démos et promotions du magasin directement depuis l'application", // TipFreeStore
+ "Un problème ? Ouvrez Signaler un problème pour scanner un code QR avec les journaux de la console", // TipBugReportQr
+ "Vous appréciez le projet ? Soutenez son développement via Ko-fi dans les Paramètres !", // TipSupportKofi
+ "Activez la sortie vidéo 120 Hz dans les Paramètres pour réduire la latence d'affichage et de contrôle", // Tip120HzVideo
+ "Calibrez la zone morte des sticks dans les Paramètres pour éliminer le drift et améliorer la précision", // TipAnalogDeadzone
+ "Utilisez le microphone intégré de la DualSense pour le chat vocal dans les groupes et jeux multijoueurs", // TipDualSenseMic
+ // Settings descriptions
+ "Modifie la langue de l'interface de l'application et les préférences audio et sous-titres dans les jeux du cloud", // SettingDescLanguage
+ "Définit la résolution vidéo maximale (1080p, 720p ou Meilleure disponible). Prend effet au prochain lancement", // SettingDescResolution
+ "Sélectionne la région des serveurs Microsoft pour le streaming (Automatique ou spécifique). Prend effet au prochain lancement", // SettingDescRegion
+ "Ajuste la zone morte intérieure des sticks analogiques DualSense pour éviter le drift et les mouvements involontaires", // SettingDescDeadzone
+ "Active ou désactive l'émulation des vibrations sur les gâchettes adaptatives L2 et R2 dans les jeux compatibles", // SettingDescTriggerRumble
+ "Bascule la disposition des boutons de confirmation et retour entre Croix (occidental) et Rond (japonais)", // SettingDescConfirmButton
+ "Configure la couleur et le comportement de la barre lumineuse de votre manette DualSense", // SettingDescLightBar
+ "Vérifie et installe automatiquement les mises à jour officielles de l'application directement sur votre console", // SettingDescUpdates
+ "Permet de vous connecter à votre compte Xbox via une autre région pour accéder à d'autres catalogues", // SettingDescLoginCountry
+ "Active la sortie vidéo 120 Hz sur votre console pour une réactivité accrue et une latence réduite", // SettingDescHighRefresh
+ "Définit la limite maximale de débit binaire pour le streaming vidéo, optimisant la qualité ou préservant le réseau", // SettingDescBitrateCap
+ "Ajuste le niveau du volume audio principal pendant les sessions de jeu en streaming", // SettingDescGameVolume
+ "Associe les touches du clavier USB ou Bluetooth aux boutons correspondants de la manette Xbox en jeu", // SettingDescKeyboardKeys
+ "Bascule entre mode fenêtré et plein écran sur les plates-formes de bureau compatibles", // SettingDescDisplayMode
+ "Ouvre l'écran de test de réponse et de calibrage de tous les boutons et axes de votre manette connectée", // SettingDescControllerButtons
+ "Active les capteurs de mouvement DualSense pour assister la visée analogique dans les jeux de tir", // SettingDescGyro
+ "Joue un signal sonore distinctif lorsque l'attente dans la file xCloud est terminée et que le jeu est prêt", // SettingDescQueueReady
+ "Exécute un diagnostic complet de la connexion Xbox Live, validant jetons d'accès, profil et abonnements", // SettingDescCheckSignIn
+ "Mesure le ping (RTT) et la gigue (jitter) vers les centres de données de jeux en nuage de plusieurs régions", // SettingDescNetworkTest
+ "Affiche un code QR pour soutenir le développeur via Ko-fi et contribuer à la maintenance active du projet", // SettingDescSupportProject
+ "Nouveautés", // WhatsNew
+ "Nouveautés", // WhatsNewTitle
+ "Haut-parleur de la manette", // PadSpeakerVolume
+ "Muet", // Mute
+ "Contrôle Web", // WebControlTitle
+ "Connexion mobile", // WebControlSubtitle
+ "Connectez-vous au même Wi-Fi pour la recherche, remapper ou télécharger les logs.", // WebControlDesc
};
constexpr Column kGerman = {
@@ -1442,6 +1594,7 @@ constexpr Column kGerman = {
"Beste (Auto)",
"Auflösung und Region gelten ab dem nächsten gestarteten Spiel.",
"Ändern",
+ "Anpassen",
"Halten zum Abmelden",
"Weiter halten zum Abmelden (%s)",
"Anmeldung fehlgeschlagen: %s",
@@ -1745,6 +1898,43 @@ constexpr Column kGerman = {
"Mit dem Smartphone scannen", // ScanToDonate
"Ton testen", // TestSound
"Wunschliste ist leer", // WishlistEmpty
+ // Loading tips
+ "Touchpad-Gesten oder L2 + R2 + Touchpad öffnen das Spielmenü und den Xbox-Guide", // TipTouchpadMenu
+ "USB-Tastatur und -Maus an der Konsole werden in unterstützten Cloud-Spielen unterstützt", // TipKeyboardMouse
+ "Kostenlose Spiele, Demos und Store-Angebote direkt in der App-Bibliothek sichern", // TipFreeStore
+ "Problem aufgetreten? Öffnen Sie 'Problem melden', um einen QR-Code mit Konsolenprotokollen zu scannen", // TipBugReportQr
+ "Gefällt Ihnen das Projekt? Unterstützen Sie die Weiterentwicklung via Ko-fi in den Einstellungen!", // TipSupportKofi
+ "120-Hz-Videoausgabe in den Einstellungen für geringere Anzeigelatenz und flüssigere Steuerung aktivieren", // Tip120HzVideo
+ "Stick-Totzone in den Einstellungen kalibrieren, um Stick-Drift zu verhindern und Präzision zu verbessern", // TipAnalogDeadzone
+ "Integriertes DualSense-Mikrofon für Party- und Multiplayer-Sprachchat verwenden", // TipDualSenseMic
+ // Settings descriptions
+ "Ändert die Sprache der Benutzeroberfläche sowie die bevorzugte Audio- und Untertitelsprache in Cloud-Spielen", // SettingDescLanguage
+ "Legt die maximale Streaming-Auflösung fest (1080p, 720p oder Beste). Wird beim nächsten Spielstart wirksam", // SettingDescResolution
+ "Wählt die Microsoft-Rechenzentrumsregion für das Streaming aus (Automatisch oder bestimmte Regionen)", // SettingDescRegion
+ "Passt die innere Totzone der DualSense-Analogsticks an, um Drift und unbeabsichtigte Bewegungen zu vermeiden", // SettingDescDeadzone
+ "Aktiviert oder deaktiviert die Impuls-Trigger-Vibration an den adaptiven DualSense-Triggern L2 und R2", // SettingDescTriggerRumble
+ "Wechselt die Tastenbelegung für Bestätigen und Zurück zwischen Kreuz (westlich) und Kreis (japanisch)", // SettingDescConfirmButton
+ "Konfiguriert Farbe und Verhalten der Lichtleiste des DualSense-Controllers beim Navigieren und Spielen", // SettingDescLightBar
+ "Prüft und installiert offizielle App-Updates automatisch direkt auf der Konsole ohne PC", // SettingDescUpdates
+ "Ermöglicht die Xbox-Konto-Anmeldung über eine andere Region für alternative Spielkataloge", // SettingDescLoginCountry
+ "Aktiviert 120-Hz-Videoausgabe auf Ihrer Konsole für minimale Eingabelatenz und höhere Bildwiederholrate", // SettingDescHighRefresh
+ "Legt die maximale Bitrate für das Videostreaming fest, um Bildqualität zu optimieren oder Daten zu sparen", // SettingDescBitrateCap
+ "Regelt die Gesamtlautstärke während der Spielsitzungen im Cloud-Streaming", // SettingDescGameVolume
+ "Weist Tasten der USB- oder Bluetooth-Tastatur den entsprechenden Xbox-Controller-Tasten beim Spielen zu", // SettingDescKeyboardKeys
+ "Wechselt zwischen Fenster- und Vollbildmodus auf unterstützten Desktop-Plattformen", // SettingDescDisplayMode
+ "Öffnet den Test- und Kalibrierungsbildschirm für alle Tasten und Achsen des angeschlossenen Controllers", // SettingDescControllerButtons
+ "Nutzt die DualSense-Bewegungssensoren zur Unterstützung des analogen Zielens in Shooter- und Actionspielen", // SettingDescGyro
+ "Spielt einen Signalton ab, wenn die Wartezeit in der xCloud-Warteschlange endet und das Spiel bereit ist", // SettingDescQueueReady
+ "Führt eine Diagnose der Xbox Live-Anmeldung durch und prüft Zugriffstoken, Profil und Abonnements", // SettingDescCheckSignIn
+ "Misst Ping (RTT) und Jitter zu Cloud-Gaming-Rechenzentren in mehreren weltweiten Regionen", // SettingDescNetworkTest
+ "Zeigt einen QR-Code, um den Entwickler via Ko-fi zu unterstützen und die Pflege des Projekts zu sichern", // SettingDescSupportProject
+ "Neuigkeiten", // WhatsNew
+ "Neuigkeiten", // WhatsNewTitle
+ "Controller-Lautsprecher", // PadSpeakerVolume
+ "Stumm", // Mute
+ "Web-Steuerung", // WebControlTitle
+ "Über Smartphone verbinden", // WebControlSubtitle
+ "Mit demselben WLAN verbinden, um zu suchen, Tasten zu belegen oder Logs zu laden.", // WebControlDesc
};
constexpr Column kItalian = {
@@ -1785,6 +1975,7 @@ constexpr Column kItalian = {
"Migliore (Auto)",
"Risoluzione e regione valgono dal prossimo gioco avviato.",
"Cambia",
+ "Regola",
"Tieni premuto per uscire",
"Continua a tenere premuto per uscire (%s)",
"Accesso non riuscito: %s",
@@ -2088,6 +2279,43 @@ constexpr Column kItalian = {
"Inquadra con lo smartphone", // ScanToDonate
"Prova suono", // TestSound
"La lista dei desideri è vuota", // WishlistEmpty
+ // Loading tips
+ "Gesti sul touchpad o L2 + R2 + Touchpad aprono il menu di gioco e la guida Xbox", // TipTouchpadMenu
+ "Tastiera e mouse USB collegati alla console sono supportati nei giochi cloud compatibili", // TipKeyboardMouse
+ "Ottieni giochi gratuiti, demo e promozioni del negozio direttamente dalla libreria dell'app", // TipFreeStore
+ "Hai riscontrato un problema? Apri Segnala problema per scansionare un QR code con i log della console", // TipBugReportQr
+ "Ti piace il progetto? Sostieni lo sviluppo futuro tramite Ko-fi nella scheda Impostazioni!", // TipSupportKofi
+ "Abilita l'uscita video a 120 Hz nelle Impostazioni per una latenza di visualizzazione ridotta", // Tip120HzVideo
+ "Calibra la zona morta delle levette nelle Impostazioni per eliminare il drift e migliorare la precisione", // TipAnalogDeadzone
+ "Usa il microfono integrato del DualSense per la chat vocale nei gruppi e nelle partite multigiocatore", // TipDualSenseMic
+ // Settings descriptions
+ "Modifica la lingua dell'interfaccia dell'applicazione e le preferenze di audio e sottotitoli nei giochi cloud", // SettingDescLanguage
+ "Imposta la risoluzione video massima (1080p, 720p o Migliore disponibile). Ha effetto al prossimo avvio", // SettingDescResolution
+ "Seleziona la regione dei server Microsoft per lo streaming (Automatica o specifica). Ha effetto al prossimo avvio", // SettingDescRegion
+ "Regola la zona morta interna delle levette analogiche DualSense per evitare drift e movimenti involontari", // SettingDescDeadzone
+ "Abilita o disabilita l'emulazione della vibrazione sui grilletti adattivi L2 e R2 nei giochi compatibili", // SettingDescTriggerRumble
+ "Alterna la configurazione dei tasti conferma e indietro tra Croce (occidentale) e Cerchio (giapponese)", // SettingDescConfirmButton
+ "Configura il colore e il comportamento della barra luminosa del DualSense nei menu e durante il gioco", // SettingDescLightBar
+ "Verifica e installa automaticamente gli aggiornamenti ufficiali dell'app direttamente sulla console", // SettingDescUpdates
+ "Consente di accedere al proprio account Xbox tramite un'altra regione per accedere a cataloghi alternativi", // SettingDescLoginCountry
+ "Abilita l'uscita video a 120 Hz sulla console per un ritardo di visualizzazione e latenza di input ridotti", // SettingDescHighRefresh
+ "Imposta il limite massimo di bitrate per lo streaming video, garantendo alta fedeltà o risparmio dati", // SettingDescBitrateCap
+ "Regola il livello del volume audio principale durante le sessioni di gioco in streaming", // SettingDescGameVolume
+ "Mappa i tasti della tastiera USB o Bluetooth sui pulsanti corrispondenti del controller Xbox durante il gioco", // SettingDescKeyboardKeys
+ "Alterna tra modalità finestra e schermo intero sulle piattaforme desktop supportate", // SettingDescDisplayMode
+ "Apre la schermata di test e calibrazione di tutti i pulsanti e gli assi del controller collegato", // SettingDescControllerButtons
+ "Abilita i sensori di movimento DualSense per assistere la mira analogica negli sparatutto e giochi d'azione", // SettingDescGyro
+ "Riproduce un segnale sonoro caratteristico quando l'attesa nella coda di xCloud termina e il gioco è pronto", // SettingDescQueueReady
+ "Esegue una diagnostica completa dell'accesso a Xbox Live, convalidando token di accesso, profilo e abbonamenti", // SettingDescCheckSignIn
+ "Misura il ping (RTT) e il jitter verso i data center di gioco in cloud in diverse regioni globali", // SettingDescNetworkTest
+ "Mostra un codice QR per supportare lo sviluppatore tramite Ko-fi e contribuire a mantenere il progetto attivo", // SettingDescSupportProject
+ "Novità", // WhatsNew
+ "Novità", // WhatsNewTitle
+ "Altoparlante del controller", // PadSpeakerVolume
+ "Muto", // Mute
+ "Controllo Web", // WebControlTitle
+ "Connetti dallo smartphone", // WebControlSubtitle
+ "Connettiti allo stesso Wi-Fi per cercare, rimappare i pulsanti o scaricare i log.", // WebControlDesc
};
constexpr std::array<const Column*, kLangs> kTable = {&kEnglish, &kPortugueseBR, &kSpanish,
diff --git a/src/ui/strings.h b/src/ui/strings.h
index 2f8fe4b..541e9d7 100644
--- a/src/ui/strings.h
+++ b/src/ui/strings.h
@@ -47,6 +47,7 @@ enum class Str {
ResBest,
SettingsNote,
Change,
+ Adjust,
HoldSignOut,
SigningOutIn, // "%s" = seconds left
SignInFailed, // "%s" = technical detail
@@ -350,6 +351,43 @@ enum class Str {
ScanToDonate, // modal subtitle below QR: "Scan with your phone to donate"
TestSound, // "Test sound" / "Testar som"
WishlistEmpty, // "Wishlist is empty"
+ // Loading tips
+ TipTouchpadMenu,
+ TipKeyboardMouse,
+ TipFreeStore,
+ TipBugReportQr,
+ TipSupportKofi,
+ Tip120HzVideo,
+ TipAnalogDeadzone,
+ TipDualSenseMic,
+ // Settings descriptions
+ SettingDescLanguage,
+ SettingDescResolution,
+ SettingDescRegion,
+ SettingDescDeadzone,
+ SettingDescTriggerRumble,
+ SettingDescConfirmButton,
+ SettingDescLightBar,
+ SettingDescUpdates,
+ SettingDescLoginCountry,
+ SettingDescHighRefresh,
+ SettingDescBitrateCap,
+ SettingDescGameVolume,
+ SettingDescKeyboardKeys,
+ SettingDescDisplayMode,
+ SettingDescControllerButtons,
+ SettingDescGyro,
+ SettingDescQueueReady,
+ SettingDescCheckSignIn,
+ SettingDescNetworkTest,
+ SettingDescSupportProject,
+ WhatsNew,
+ WhatsNewTitle,
+ PadSpeakerVolume,
+ Mute,
+ WebControlTitle,
+ WebControlSubtitle,
+ WebControlDesc,
Count
};
diff --git a/src/xcloud/catalog.cpp b/src/xcloud/catalog.cpp
index d9362ee..9020847 100644
--- a/src/xcloud/catalog.cpp
+++ b/src/xcloud/catalog.cpp
@@ -110,6 +110,7 @@ bool fetchProducts(const std::vector<std::string>& ids, const std::string& marke
prod.heroUrl = imageUrl(p["Image_Hero"]);
if (prod.heroUrl.empty()) prod.heroUrl = imageUrl(p["Image_TitledHero"]);
for (const auto& c : p["LocalizedCategories"].items()) prod.categories.push_back(categoryName(c.str()));
+ parseContentRatings(p, market, prod.ratingAge, prod.ratingSystem, prod.ratingDescriptors);
if (full) {
// How it can be played, from the store's attributes, and the
// lowest Game Pass plan that includes it.
@@ -189,4 +190,143 @@ bool isNonGameAddon(const std::string& titleId, const std::string& titleName) {
return false;
}
+void parseContentRatings(const json::Value& p, const std::string& market,
+ std::string& outAge, std::string& outSystem,
+ std::vector<std::string>& outDescriptors) {
+ outAge.clear();
+ outSystem.clear();
+ outDescriptors.clear();
+
+ const json::Value* ratingsArray = nullptr;
+ if (p.has("ContentRatings") && p["ContentRatings"].isArray()) {
+ ratingsArray = &p["ContentRatings"];
+ } else if (p.has("MarketProperties") && p["MarketProperties"].isArray() && p["MarketProperties"].size() > 0) {
+ const auto& mp0 = p["MarketProperties"][0];
+ if (mp0.has("ContentRatings") && mp0["ContentRatings"].isArray()) {
+ ratingsArray = &mp0["ContentRatings"];
+ }
+ } else if (p.has("LocalizedProperties") && p["LocalizedProperties"].isArray() && p["LocalizedProperties"].size() > 0) {
+ const auto& lp0 = p["LocalizedProperties"][0];
+ if (lp0.has("ContentRatings") && lp0["ContentRatings"].isArray()) {
+ ratingsArray = &lp0["ContentRatings"];
+ }
+ }
+
+ if (!ratingsArray || ratingsArray->items().empty()) return;
+
+ struct Candidate {
+ std::string system;
+ std::string rawId;
+ std::vector<std::string> descriptors;
+ };
+ std::vector<Candidate> candidates;
+
+ for (const auto& item : ratingsArray->items()) {
+ Candidate c;
+ c.system = item["RatingSystem"].str();
+ if (c.system.empty()) c.system = item["ratingSystem"].str();
+ if (c.system.empty()) c.system = item["RatingSystemId"].str();
+
+ c.rawId = item["RatingId"].str();
+ if (c.rawId.empty()) c.rawId = item["ratingId"].str();
+ if (c.rawId.empty()) c.rawId = item["RatingName"].str();
+ if (c.rawId.empty()) c.rawId = item["ratingName"].str();
+
+ auto descVal = item.has("RatingDescriptors") ? item["RatingDescriptors"] : item["ratingDescriptors"];
+ if (descVal.isArray()) {
+ for (const auto& d : descVal.items()) {
+ if (d.isString()) {
+ if (!d.str().empty()) c.descriptors.push_back(d.str());
+ } else if (d.isObject()) {
+ std::string s = d["Name"].str();
+ if (s.empty()) s = d["Descriptor"].str();
+ if (!s.empty()) c.descriptors.push_back(s);
+ }
+ }
+ } else if (descVal.isString() && !descVal.str().empty()) {
+ c.descriptors.push_back(descVal.str());
+ } else if (item.has("RatingDescriptor") && item["RatingDescriptor"].isString()) {
+ c.descriptors.push_back(item["RatingDescriptor"].str());
+ }
+
+ if (!c.rawId.empty()) candidates.push_back(std::move(c));
+ }
+
+ if (candidates.empty()) return;
+
+ std::string mkt = market;
+ for (char& ch : mkt) ch = static_cast<char>(std::toupper(static_cast<unsigned char>(ch)));
+
+ const Candidate* selected = nullptr;
+ auto matchSystem = [&](const std::string& sysName) -> const Candidate* {
+ for (const auto& c : candidates) {
+ std::string sysLower;
+ for (char ch : c.system) sysLower += static_cast<char>(std::tolower(static_cast<unsigned char>(ch)));
+ std::string targetLower;
+ for (char ch : sysName) targetLower += static_cast<char>(std::tolower(static_cast<unsigned char>(ch)));
+ if (sysLower.find(targetLower) != std::string::npos) return &c;
+ }
+ return nullptr;
+ };
+
+ if (mkt == "BR" || mkt == "PT") {
+ selected = matchSystem("classind");
+ if (!selected) selected = matchSystem("djctq");
+ } else if (mkt == "US" || mkt == "CA") {
+ selected = matchSystem("esrb");
+ } else if (mkt == "DE") {
+ selected = matchSystem("usk");
+ if (!selected) selected = matchSystem("pegi");
+ } else if (mkt == "GB" || mkt == "UK" || mkt == "FR" || mkt == "ES" || mkt == "IT") {
+ selected = matchSystem("pegi");
+ }
+
+ if (!selected) {
+ if (mkt == "BR") selected = matchSystem("classind");
+ if (!selected) selected = matchSystem("esrb");
+ if (!selected) selected = matchSystem("pegi");
+ if (!selected) selected = &candidates[0];
+ }
+
+ outSystem = selected->system;
+ outDescriptors = selected->descriptors;
+
+ std::string raw = selected->rawId;
+ std::string rawLower;
+ for (char ch : raw) rawLower += static_cast<char>(std::tolower(static_cast<unsigned char>(ch)));
+
+ std::string sysLower;
+ for (char ch : selected->system) sysLower += static_cast<char>(std::tolower(static_cast<unsigned char>(ch)));
+
+ if (sysLower.find("classind") != std::string::npos || sysLower.find("djctq") != std::string::npos) {
+ outSystem = "ClassInd";
+ if (rawLower.find("livre") != std::string::npos || rawLower == "l" || rawLower == "0" || rawLower == "general") outAge = "Livre";
+ else if (rawLower.find("10") != std::string::npos || rawLower == "ten") outAge = "10+";
+ else if (rawLower.find("12") != std::string::npos || rawLower == "twelve") outAge = "12+";
+ else if (rawLower.find("14") != std::string::npos || rawLower == "fourteen") outAge = "14+";
+ else if (rawLower.find("16") != std::string::npos || rawLower == "sixteen") outAge = "16+";
+ else if (rawLower.find("18") != std::string::npos || rawLower == "eighteen") outAge = "18+";
+ else outAge = raw;
+ } else if (sysLower.find("esrb") != std::string::npos) {
+ outSystem = "ESRB";
+ if (rawLower.find("everyone 10") != std::string::npos || rawLower == "e10" || rawLower == "e10+" || rawLower == "everyone10plus") outAge = "E10+";
+ else if (rawLower.find("everyone") != std::string::npos || rawLower == "e") outAge = "E";
+ else if (rawLower.find("teen") != std::string::npos || rawLower == "t") outAge = "T";
+ else if (rawLower.find("mature") != std::string::npos || rawLower == "m" || rawLower == "mature 17+") outAge = "M";
+ else if (rawLower.find("adult") != std::string::npos || rawLower == "ao") outAge = "AO";
+ else if (rawLower.find("pending") != std::string::npos || rawLower == "rp") outAge = "RP";
+ else outAge = raw;
+ } else if (sysLower.find("pegi") != std::string::npos) {
+ outSystem = "PEGI";
+ if (rawLower.find("3") != std::string::npos) outAge = "3+";
+ else if (rawLower.find("7") != std::string::npos) outAge = "7+";
+ else if (rawLower.find("12") != std::string::npos) outAge = "12+";
+ else if (rawLower.find("16") != std::string::npos) outAge = "16+";
+ else if (rawLower.find("18") != std::string::npos) outAge = "18+";
+ else outAge = raw;
+ } else {
+ outAge = raw;
+ }
+}
+
} // namespace xc::xcloud
diff --git a/src/xcloud/catalog.h b/src/xcloud/catalog.h
index fb1fda3..55425c3 100644
--- a/src/xcloud/catalog.h
+++ b/src/xcloud/catalog.h
@@ -11,6 +11,10 @@
#include <string>
#include <vector>
+namespace xc::json {
+class Value;
+}
+
namespace xc::xcloud {
struct Product {
@@ -31,6 +35,9 @@ struct Product {
int64_t detailedAt = 0; // when the full details were fetched (unix s)
uint32_t modes = 0;
uint8_t plan = 0; // kPlanEssential..kPlanUltimate from PassMetadataByPassProductId
+ std::string ratingAge;
+ std::string ratingSystem;
+ std::vector<std::string> ratingDescriptors;
std::map<std::string, uint8_t> languages;
};
@@ -87,4 +94,10 @@ bool fetchList(const std::string& siglId, const std::string& market, const std::
bool fetchProducts(const std::vector<std::string>& ids, const std::string& market, const std::string& language,
std::map<std::string, Product>& out, std::string& err, bool full = true);
+// Parses official age classification and content descriptors from catalog JSON
+// (preferring ClassInd for BR, ESRB for US, PEGI for EU).
+void parseContentRatings(const json::Value& productJson, const std::string& market,
+ std::string& outAge, std::string& outSystem,
+ std::vector<std::string>& outDescriptors);
+
} // namespace xc::xcloud
diff --git a/src/xcloud/prices.cpp b/src/xcloud/prices.cpp
index dc0979b..4a3a653 100644
--- a/src/xcloud/prices.cpp
+++ b/src/xcloud/prices.cpp
@@ -31,7 +31,10 @@ bool fetchPrices(const std::vector<std::string>& productIds, const std::string&
bool found = false;
for (const auto& av : dsa["Availabilities"].items()) {
bool purchase = false;
- for (const auto& a : av["Actions"].items()) purchase |= a.str() == "Purchase";
+ for (const auto& a : av["Actions"].items()) {
+ const auto act = a.str();
+ purchase |= (act == "Purchase" || act == "Browse" || act == "Fulfill" || act == "License");
+ }
const auto& price = av["OrderManagementData"]["Price"];
if (!purchase || !price.isObject()) continue;
Price pr;
diff --git a/src/xcloud/purchase.cpp b/src/xcloud/purchase.cpp
index 51165fd..d07ed1f 100644
--- a/src/xcloud/purchase.cpp
+++ b/src/xcloud/purchase.cpp
@@ -47,7 +47,10 @@ bool fetchPurchaseOffer(const std::string& productId, const std::string& market,
std::string skuId = dsa["Sku"]["SkuId"].str();
for (const auto& av : dsa["Availabilities"].items()) {
bool purchase = false;
- for (const auto& a : av["Actions"].items()) purchase |= (a.str() == "Purchase");
+ for (const auto& a : av["Actions"].items()) {
+ const auto act = a.str();
+ purchase |= (act == "Purchase" || act == "Browse" || act == "Fulfill" || act == "License");
+ }
const auto& price = av["OrderManagementData"]["Price"];
if (!purchase || !price.isObject()) continue;
diff --git a/tests/test_main.cpp b/tests/test_main.cpp
index 70ddebe..3d5f4ae 100644
--- a/tests/test_main.cpp
+++ b/tests/test_main.cpp
@@ -6,6 +6,7 @@
#include "app/settings.h"
#include "app/update_check.h"
#include "app/updater.h"
+#include "app/web_server.h"
#include "app/crash_guard.h"
#include "app/report.h"
#include "display/display.h"
@@ -27,6 +28,7 @@
#include "ui/app_ui.h"
#include "ui/accent_color.h"
#include "ui/pad_glyphs.h"
+#include "ui/input_mode.h"
#include "ui/stream_menu.h"
#include "ui/strings.h"
#include "util/json.h"
@@ -639,6 +641,8 @@ static void testStreamMenu() {
CHECK(press([](xc::ui::NavInput& n) { n.right = true; }) == MenuAction::Gyro && menu.gyroMode() == 2);
press([](xc::ui::NavInput& n) { n.down = true; }); // its intensity, 1..10
CHECK(press([](xc::ui::NavInput& n) { n.left = true; }) == MenuAction::Gyro && menu.gyroLevel() == 4);
+ press([](xc::ui::NavInput& n) { n.down = true; }); // DualSense speaker volume
+ CHECK(press([](xc::ui::NavInput& n) { n.left = true; }) == MenuAction::PadSpeakerVolume && menu.padSpeakerVolume() == 95);
press([](xc::ui::NavInput& n) { n.down = true; }); // "Leave game", last
CHECK(press([](xc::ui::NavInput& n) { n.accept = true; }) == MenuAction::Leave);
CHECK(!menu.isOpen());
@@ -901,6 +905,24 @@ static void testPrivacyAndRobustness() {
app::report::Info info{"t", std::string("a\0b", 3), "1", "13.00", ""};
CHECK(app::report::issueUrl(info).find("a%00b") != std::string::npos);
+ // Platform in report URL and immutable platform header in log
+ app::report::Info infoPlat{"t", "what", "1.4.0", "13.00", "[Platform: PlayStation 5 (PPSA99810)]\nlog line 1\n", "", "PlayStation 5 (PPSA99810)"};
+ std::string urlPlat = app::report::issueUrl(infoPlat);
+ CHECK(urlPlat.find("&platform=PlayStation+5+(PPSA99810)") != std::string::npos);
+ CHECK(urlPlat.find("%5BPlatform:+PlayStation+5+(PPSA99810)%5D") != std::string::npos);
+
+ // Platform header automatically injected if missing from log
+ app::report::Info infoNoHdr{"t", "what", "1.4.0", "13.00", "raw log line\n", "", "PlayStation 5 (PPSA99810)"};
+ std::string urlNoHdr = app::report::issueUrl(infoNoHdr);
+ CHECK(urlNoHdr.find("%5BPlatform:+PlayStation+5+(PPSA99810)%5D") != std::string::npos);
+
+ // Truncation preserves [Platform: ...]
+ std::string bigLog = "[Platform: PlayStation 5 (PPSA99810)]\n";
+ for (int i = 0; i < 50; ++i) bigLog += "lots of long log lines to trigger shortening " + std::to_string(i) + "\n";
+ app::report::Info infoTrunc{"t", "what", "1.4.0", "13.00", bigLog, "", "PlayStation 5 (PPSA99810)"};
+ std::string urlTrunc = app::report::issueUrl(infoTrunc, 350);
+ CHECK(urlTrunc.find("%5BPlatform:+PlayStation+5+(PPSA99810)%5D") != std::string::npos);
+
// Sign-in: the service busy or throttling keeps the code polling and
// the stored sign-in; only a refused token drops it.
int status = 0;
@@ -2562,6 +2584,32 @@ static void testPurchase() {
CHECK(directOffer.isFree);
CHECK(directOffer.availabilityId == "AVAIL_DIRECT_FREE");
+ // 9. fetchPurchaseOffer accepts actions like "Browse" or "License" for zero-priced games
+ net::setTestTransport([](const net::Request&) {
+ net::Response r;
+ r.status = 200;
+ r.body = R"({
+ "Products": [{
+ "ProductId": "JUSTDANCE",
+ "DisplaySkuAvailabilities": [{
+ "Sku": { "SkuId": "0001" },
+ "Availabilities": [{
+ "AvailabilityId": "AVAIL_JUSTDANCE",
+ "Actions": ["Browse", "License"],
+ "OrderManagementData": {
+ "Price": { "ListPrice": 0.0, "MSRP": 0.0, "CurrencyCode": "BRL" }
+ }
+ }]
+ }]
+ }]
+ })";
+ return r;
+ });
+ PurchaseOffer trialOffer;
+ CHECK(fetchPurchaseOffer("JUSTDANCE", "BR", "pt-br", trialOffer, err));
+ CHECK(trialOffer.isFree);
+ CHECK(trialOffer.availabilityId == "AVAIL_JUSTDANCE");
+
net::setTestTransport({});
}
@@ -2704,6 +2752,76 @@ static void testWishlist() {
std::string(ui::tr(ui::Str::WishlistEmpty)).find("empty") != std::string::npos);
}
+static void testBlock1Features() {
+ using namespace xc;
+ ui::Fonts fonts;
+ ui::ImageCache images([] {});
+ ui::AppUi app(fonts, images);
+
+ // 1. 3x3 filter grid verification
+ app.showFilteredSearch(ui::Tab::Library, false, 0, "", 0, -1);
+ CHECK(app.filterRow(0).size() == 3); // Wishlist, Free, Cheapest
+ CHECK(app.filterRow(1).size() == 3); // Mode, Genre, Publisher
+ CHECK(app.filterRow(2).size() == 3); // Console, Language, MouseKeyboard
+ CHECK(app.filterRow(3).empty());
+
+ app.showFilteredSearch(ui::Tab::GamePass, false, 0, "", 0, -1);
+ CHECK(app.filterRow(0).size() == 3); // Plan, Console, MouseKeyboard
+ CHECK(app.filterRow(1).size() == 3); // Mode, Genre, Publisher
+ CHECK(app.filterRow(2).size() == 1); // Language
+ CHECK(app.filterRow(3).empty());
+
+ // 2. isFreeGame and ClaimFreeGame for zero-priced games
+ ui::GameTile trialGame;
+ trialGame.productId = "9P0LHV4DV2BG";
+ trialGame.titleId = "TITLE_JUSTDANCE";
+ trialGame.name = "Just Dance Trial";
+ trialGame.purchasable = false; // Test that even when purchasable is false, zero price enables claiming
+ trialGame.playable = false;
+ trialGame.freeInStore = false; // Microsoft doesn't set freeInStore for trials
+
+ // Before prices are loaded, not free
+ CHECK(!app.isFreeGame(trialGame));
+
+ // When prices.json returns list=0 and msrp=0
+ ui::PriceInfo zeroPrice;
+ zeroPrice.list = 0.0;
+ zeroPrice.msrp = 0.0;
+ zeroPrice.now = "Grátis";
+ app.setPrices({{"9P0LHV4DV2BG", zeroPrice}});
+
+ CHECK(app.isFreeGame(trialGame));
+
+ // Opening details and pressing accept should produce Action::ClaimFreeGame
+ app.showDetails(trialGame);
+ ui::NavInput acceptPress;
+ acceptPress.accept = true;
+ auto ev = app.handle(acceptPress);
+ CHECK(ev.action == ui::Action::ClaimFreeGame);
+ CHECK(ev.game.productId == "9P0LHV4DV2BG");
+ CHECK(ev.game.freeInStore == true);
+
+ // After acquiring the game, it becomes owned/playable: pressing accept produces Action::Play
+ app.markTileOwned("9P0LHV4DV2BG", "TITLE_JUSTDANCE");
+ ev = app.handle(acceptPress);
+ CHECK(ev.action == ui::Action::Play);
+
+ // 3. Search filter navigation across 3x3 grid
+ app.showFilteredSearch(ui::Tab::Library, false, 0, "", 0, -1);
+ // Move down from wide keys to filter row 0, 1, 2
+ ui::NavInput navDown;
+ navDown.down = true;
+ app.handle(navDown);
+ app.handle(navDown);
+ // Move left and right
+ ui::NavInput navRight;
+ navRight.right = true;
+ app.handle(navRight);
+ ui::NavInput navLeft;
+ navLeft.left = true;
+ app.handle(navLeft);
+}
+
static void testAchievements() {
using namespace xc::xcloud;
TitleAchievements ach;
@@ -2714,9 +2832,623 @@ static void testAchievements() {
CHECK(err == "xboxTitleId empty");
}
+static void testBlock2Features() {
+ // 1. Parsing of bilingual release notes
+ std::string notes =
+ "<!-- LANG:PT -->\n"
+ "## Novidades 1.3.4\n"
+ "- Alto-falante no menu\n"
+ "- Novos tetos de bitrate\n"
+ "<!-- LANG:EN -->\n"
+ "## What's new 1.3.4\n"
+ "- Speaker in menu\n"
+ "- New bitrate caps\n";
+ std::string pt = app::filterReleaseNotes(notes, "pt-BR");
+ CHECK(pt.find("Novidades 1.3.4") != std::string::npos);
+ CHECK(pt.find("What's new") == std::string::npos);
+
+ std::string en = app::filterReleaseNotes(notes, "en");
+ CHECK(en.find("What's new 1.3.4") != std::string::npos);
+ CHECK(en.find("Novidades 1.3.4") == std::string::npos);
+
+ // Fallback to EN when lang tag is not found
+ std::string es = app::filterReleaseNotes(notes, "es");
+ CHECK(es.find("What's new 1.3.4") != std::string::npos);
+
+ // No tags: returns whole text
+ std::string plain = "Simple release notes without tags.";
+ CHECK(app::filterReleaseNotes(plain, "pt-BR") == plain);
+
+ // Test tag spacing and casing variations
+ std::string noSpaceNotes = "<!--LANG:PT-->\nNotas compactas\n<!--LANG:EN-->\nCompact notes";
+ CHECK(app::filterReleaseNotes(noSpaceNotes, "pt-BR") == "Notas compactas");
+ CHECK(app::filterReleaseNotes(noSpaceNotes, "en") == "Compact notes");
+
+ std::string spaceColonNotes = "<!-- LANG: PT -->\nNotas com espaco\n<!-- LANG: EN -->\nSpaced notes";
+ CHECK(app::filterReleaseNotes(spaceColonNotes, "pt-BR") == "Notas com espaco");
+ CHECK(app::filterReleaseNotes(spaceColonNotes, "en") == "Spaced notes");
+
+ std::string lowerNotes = "<!-- lang: pt-br -->\nNotas minusculas\n<!-- lang: en-us -->\nLowercase notes";
+ CHECK(app::filterReleaseNotes(lowerNotes, "pt-BR") == "Notas minusculas");
+ CHECK(app::filterReleaseNotes(lowerNotes, "en") == "Lowercase notes");
+
+ // Ensure delimiter tags do not leak into output
+ CHECK(app::filterReleaseNotes(notes, "pt-BR").find("<!--") == std::string::npos);
+ CHECK(app::filterReleaseNotes(notes, "en").find("<!--") == std::string::npos);
+
+ // 2. Settings serialization of padSpeakerVolume
+ app::Settings s;
+ CHECK(s.padSpeakerVolume == 100);
+ s.padSpeakerVolume = 75;
+ std::string tmpPath = "/tmp/test_settings_block2.json";
+ CHECK(s.save(tmpPath));
+
+ app::Settings loaded;
+ CHECK(loaded.load(tmpPath));
+ CHECK(loaded.padSpeakerVolume == 75);
+ std::remove(tmpPath.c_str());
+
+ // Test media::setPadSpeakerVolume and padSpeakerVolume
+ media::setPadSpeakerVolume(60);
+ CHECK(media::padSpeakerVolume() == 60);
+ media::setPadSpeakerVolume(-10);
+ CHECK(media::padSpeakerVolume() == 0);
+ media::setPadSpeakerVolume(150);
+ CHECK(media::padSpeakerVolume() == 100);
+
+ // 3. Bitrate caps in UI
+ ui::Fonts dummyFonts{};
+ ui::ImageCache images([] {});
+ ui::AppUi app(dummyFonts, images);
+
+ app::Settings bs;
+ bs.maxBitrateMbps = 50;
+ ui::SettingsChoice bc = ui::choiceFromSettings(bs);
+ CHECK(bc.maxBitrateMbps == 50);
+ app::Settings bsBack;
+ ui::applyChoice(bc, bsBack);
+ CHECK(bsBack.maxBitrateMbps == 50);
+
+ bs.maxBitrateMbps = 45;
+ bc = ui::choiceFromSettings(bs);
+ CHECK(bc.maxBitrateMbps == 45);
+ ui::applyChoice(bc, bsBack);
+ CHECK(bsBack.maxBitrateMbps == 45);
+
+ // Test settings navigation in AppUi
+ app.showHome();
+ ui::NavInput openOpt;
+ openOpt.options = true;
+ app.handle(openOpt);
+ CHECK(app.screen() == ui::Screen::Settings);
+
+ // Navigate down to BitrateCap row (row 10)
+ ui::NavInput navDownRow;
+ navDownRow.down = true;
+ while (app.settingsFocus() != 10) {
+ app.handle(navDownRow);
+ }
+ CHECK(app.settingsFocus() == 10);
+
+ // Test inline slider navigation on BitrateCap (row 10)
+ CHECK(app.settings().maxBitrateMbps == 0);
+
+ // Pressing left at 0 (Automatic) should clamp at 0
+ ui::NavInput navLeft;
+ navLeft.left = true;
+ app.handle(navLeft);
+ CHECK(app.settings().maxBitrateMbps == 0);
+
+ // Pressing right increases the bitrate in 5 Mbps increments up to 50 Mbps
+ ui::NavInput navRight;
+ navRight.right = true;
+ const int expectedMbps[] = {5, 10, 15, 20, 25, 30, 35, 40, 45, 50};
+ for (int exp : expectedMbps) {
+ app.handle(navRight);
+ CHECK(app.settings().maxBitrateMbps == exp);
+ }
+
+ // Pressing right at 50 Mbps should clamp at 50 Mbps
+ app.handle(navRight);
+ CHECK(app.settings().maxBitrateMbps == 50);
+
+ // Pressing left reduces the bitrate from 50 to 45 Mbps
+ app.handle(navLeft);
+ CHECK(app.settings().maxBitrateMbps == 45);
+
+ // Pressing accept (Cross) on row 10 cycles/alternates to next option (no dropdown opened)
+ ui::NavInput acc;
+ acc.accept = true;
+ app.handle(acc);
+ CHECK(app.settings().maxBitrateMbps == 50);
+ app.handle(acc);
+ CHECK(app.settings().maxBitrateMbps == 0); // wrapped to Automatic
+ app.handle(acc);
+ CHECK(app.settings().maxBitrateMbps == 5);
+
+ // Non-exact bitrate snapping test:
+ // If a legacy or custom setting such as 22 Mbps is loaded, it should snap to nearest option (20 Mbps)
+ auto st = app.settings();
+ st.maxBitrateMbps = 22;
+ app.setSettings(st);
+ app.handle(navRight); // from snapped 20 Mbps -> 25 Mbps
+ CHECK(app.settings().maxBitrateMbps == 25);
+ app.handle(navLeft); // 25 -> 20 Mbps
+ CHECK(app.settings().maxBitrateMbps == 20);
+ app.handle(navLeft); // 20 -> 15 Mbps
+ CHECK(app.settings().maxBitrateMbps == 15);
+
+ // Test rendering on row 10 with controller and keyboard hints
+ ui::Canvas canvas(1920, 1080);
+ ui::g_keyboardHints = false;
+ app.render(canvas, 1000);
+ ui::g_keyboardHints = true;
+ app.render(canvas, 1000);
+ ui::g_keyboardHints = false;
+
+ // Test keyLabel icon index alignment
+ CHECK(std::string(ui::keyLabel(0)) == "Enter");
+ CHECK(std::string(ui::keyLabel(1)) == "Esc");
+ CHECK(std::string(ui::keyLabel(2)) == "Tab");
+ CHECK(std::string(ui::keyLabel(3)) == "F");
+ CHECK(std::string(ui::keyLabel(4)) == "Del");
+ CHECK(std::string(ui::keyLabel(5)) == "H");
+ CHECK(std::string(ui::keyLabel(6)) == "R");
+ CHECK(std::string(ui::keyLabel(7)) == "Shift");
+ CHECK(std::string(ui::keyLabel(8)) == "Z C");
+ CHECK(std::string(ui::keyLabel(9)) == "<- ->");
+ CHECK(std::string(ui::keyLabel(10)) == "");
+ CHECK(std::string(ui::keyLabel(-1)) == "");
+
+ // Close Settings
+ ui::NavInput navBack;
+ navBack.back = true;
+ app.handle(navBack);
+ CHECK(app.screen() == ui::Screen::Home);
+
+ // 4. StreamMenu with PadSpeakerVolumeItem
+ ui::StreamMenu menu(dummyFonts);
+ menu.open(0, false, 0, 1, 0, false, true, false, 2, 15, false, 0.0f, false, 100);
+ CHECK(menu.padSpeakerVolume() == 100);
+
+ // When at 100%, right should not trigger PadSpeakerVolume action
+ ui::NavInput down;
+ down.down = true;
+ for (int i = 0; i < 12; ++i) menu.handle(down);
+
+ ui::NavInput right;
+ right.right = true;
+ auto actAt100 = menu.handle(right);
+ CHECK(actAt100 == ui::MenuAction::None);
+ CHECK(menu.padSpeakerVolume() == 100);
+
+ // Left should decrease volume by 5%
+ ui::NavInput left;
+ left.left = true;
+ auto act = menu.handle(left);
+ CHECK(act == ui::MenuAction::PadSpeakerVolume);
+ CHECK(menu.padSpeakerVolume() == 95);
+
+ // Test decreasing down to 0%
+ for (int i = 0; i < 20; ++i) menu.handle(left);
+ CHECK(menu.padSpeakerVolume() == 0);
+
+ // When at 0%, left should not trigger PadSpeakerVolume action
+ auto actAt0 = menu.handle(left);
+ CHECK(actAt0 == ui::MenuAction::None);
+ CHECK(menu.padSpeakerVolume() == 0);
+
+ // Rendering at 0% should render valid canvas
+ ui::StreamInfo sinfo;
+ auto cMute = menu.renderMenu(sinfo);
+ CHECK(cMute.width() == ui::StreamMenu::kMenuW);
+
+ // Right should increase by 5%
+ act = menu.handle(right);
+ CHECK(act == ui::MenuAction::PadSpeakerVolume);
+ CHECK(menu.padSpeakerVolume() == 5);
+
+ // 5. Update prompt with 3 buttons and Square shortcut
+ app.showHome();
+ app.setUpdateState("v1.3.3", "v1.3.4", false, notes);
+ app.offerUpdate(notes);
+ CHECK(app.updateOffered());
+ CHECK(!app.showingUpdateNotes());
+
+ // Navigation between 3 buttons: left wraps from 0 to 2
+ ui::NavInput navL;
+ navL.left = true;
+ app.handle(navL); // promptFocus_ becomes 2 (Not now)
+ ui::NavInput navR;
+ navR.right = true;
+ app.handle(navR); // promptFocus_ wraps to 0 (Update now)
+ app.handle(navR); // promptFocus_ is 1 (What's new)
+
+ // Press accept on What's new -> opens notes modal
+ ui::NavInput accept;
+ accept.accept = true;
+ auto ev = app.handle(accept);
+ CHECK(ev.action == ui::Action::None);
+ CHECK(app.showingUpdateNotes());
+
+ // Up / Down scroll in notes modal
+ ui::NavInput navDown;
+ navDown.down = true;
+ app.handle(navDown);
+ ui::NavInput navUp;
+ navUp.up = true;
+ app.handle(navUp);
+
+ // Shoulder buttons page scrolling (L1/R1)
+ ui::NavInput navR1;
+ navR1.r1 = true;
+ app.handle(navR1);
+ ui::NavInput navL1;
+ navL1.l1 = true;
+ app.handle(navL1);
+
+ // Right stick smooth scrolling
+ ui::NavInput stickScroll;
+ stickScroll.scrollRows = 2;
+ app.handle(stickScroll);
+ stickScroll.scrollRows = -2;
+ app.handle(stickScroll);
+
+ // Back closes notes modal
+ ui::NavInput back;
+ back.back = true;
+ app.handle(back);
+ CHECK(!app.showingUpdateNotes());
+ CHECK(app.updateOffered());
+
+ // Square shortcut opens notes modal directly
+ ui::NavInput sq;
+ sq.square = true;
+ app.handle(sq);
+ CHECK(app.showingUpdateNotes());
+ app.handle(back);
+ CHECK(!app.showingUpdateNotes());
+}
+
+static void testBlock3Features() {
+ using namespace xc;
+
+ // 1. Content ratings parsing
+ {
+ // ClassInd for BR
+ auto jBr = json::parse(R"({
+ "ContentRatings": [
+ {
+ "RatingSystem": "ClassInd",
+ "RatingId": "14",
+ "RatingDescriptors": ["Violência", "Drogas Lícitas"]
+ },
+ {
+ "RatingSystem": "ESRB",
+ "RatingId": "Teen",
+ "RatingDescriptors": ["Violence", "Blood"]
+ }
+ ]
+ })");
+ CHECK(jBr.has_value());
+ std::string age, sys;
+ std::vector<std::string> desc;
+ xcloud::parseContentRatings(*jBr, "BR", age, sys, desc);
+ CHECK(sys == "ClassInd");
+ CHECK(age == "14+");
+ CHECK(desc.size() == 2 && desc[0] == "Violência");
+
+ // ESRB for US
+ std::string ageUs, sysUs;
+ std::vector<std::string> descUs;
+ xcloud::parseContentRatings(*jBr, "US", ageUs, sysUs, descUs);
+ CHECK(sysUs == "ESRB");
+ CHECK(ageUs == "T");
+ CHECK(descUs.size() == 2 && descUs[0] == "Violence");
+
+ // ESRB Mature
+ auto jMature = json::parse(R"({
+ "MarketProperties": [
+ {
+ "ContentRatings": [
+ {
+ "ratingSystem": "ESRB",
+ "ratingId": "Mature 17+",
+ "ratingDescriptors": ["Blood and Gore", "Intense Violence"]
+ }
+ ]
+ }
+ ]
+ })");
+ CHECK(jMature.has_value());
+ xcloud::parseContentRatings(*jMature, "US", ageUs, sysUs, descUs);
+ CHECK(sysUs == "ESRB");
+ CHECK(ageUs == "M");
+ CHECK(descUs.size() == 2);
+
+ // PEGI for GB / UK
+ auto jPegi = json::parse(R"({
+ "LocalizedProperties": [
+ {
+ "ContentRatings": [
+ {
+ "RatingSystemId": "PEGI",
+ "RatingName": "18",
+ "RatingDescriptor": "Bad Language"
+ }
+ ]
+ }
+ ]
+ })");
+ CHECK(jPegi.has_value());
+ std::string ageEu, sysEu;
+ std::vector<std::string> descEu;
+ xcloud::parseContentRatings(*jPegi, "GB", ageEu, sysEu, descEu);
+ CHECK(sysEu == "PEGI");
+ CHECK(ageEu == "18+");
+ CHECK(descEu.size() == 1 && descEu[0] == "Bad Language");
+
+ // Fallback when ClassInd not present in BR market -> falls back to ESRB
+ std::string ageFb, sysFb;
+ std::vector<std::string> descFb;
+ xcloud::parseContentRatings(*jMature, "BR", ageFb, sysFb, descFb);
+ CHECK(sysFb == "ESRB");
+ CHECK(ageFb == "M");
+ }
+
+ // 2. Local Web Micro-Server
+ {
+ app::WebServer ws;
+ CHECK(!ws.isRunning());
+ std::string ip = ws.localIp();
+ CHECK(!ip.empty());
+ std::string url = ws.url();
+ CHECK(url.find(":8080") != std::string::npos);
+
+ // Test OPTIONS (CORS preflight)
+ auto optRes = ws.handleRequest("OPTIONS", "/api/search", "");
+ CHECK(optRes.status == 204);
+
+ // Test GET / (HTML index)
+ auto htmlRes = ws.handleRequest("GET", "/", "");
+ CHECK(htmlRes.status == 200);
+ CHECK(htmlRes.contentType.find("text/html") != std::string::npos);
+ CHECK(htmlRes.body.find("PSBOX CLOUD GAMING") != std::string::npos);
+ CHECK(htmlRes.body.find("logo-icon") != std::string::npos);
+ CHECK(htmlRes.body.find("#107C41") != std::string::npos);
+ CHECK(htmlRes.body.find("tabBtnGamePass") != std::string::npos);
+ CHECK(htmlRes.body.find("tabBtnLibrary") != std::string::npos);
+ CHECK(htmlRes.body.find("filtersGamePass") != std::string::npos);
+ CHECK(htmlRes.body.find("filtersLibrary") != std::string::npos);
+ CHECK(htmlRes.body.find("chipWishlist") != std::string::npos);
+ CHECK(htmlRes.body.find("chipFree") != std::string::npos);
+ CHECK(htmlRes.body.find("chipCheapest") != std::string::npos);
+ CHECK(htmlRes.body.find("filterPlan") != std::string::npos);
+ CHECK(htmlRes.body.find("filterConsoleGP") != std::string::npos);
+ CHECK(htmlRes.body.find("chipMouseGP") != std::string::npos);
+ CHECK(htmlRes.body.find("Teclado Remoto para Busca") != std::string::npos);
+ CHECK(htmlRes.body.find("Remapeamento de Botões") != std::string::npos);
+ CHECK(htmlRes.body.find("Remapeamento de Teclado") != std::string::npos);
+ CHECK(htmlRes.body.find("subRemapKey") != std::string::npos);
+
+ CHECK(htmlRes.body.find("navTab-search") != std::string::npos);
+ CHECK(htmlRes.body.find("navTab-remap") != std::string::npos);
+ CHECK(htmlRes.body.find("navTab-logs") != std::string::npos);
+ CHECK(htmlRes.body.find("clamp(") != std::string::npos);
+ CHECK(htmlRes.body.find("chipSelectModeGP") != std::string::npos);
+ CHECK(htmlRes.body.find("chipSelectLangGP") != std::string::npos);
+ CHECK(htmlRes.body.find("chipSelectModeLib") != std::string::npos);
+ CHECK(htmlRes.body.find("chipSelectLangLib") != std::string::npos);
+
+ // Test GET /api/settings
+ auto getSetRes = ws.handleRequest("GET", "/api/settings", "");
+ CHECK(getSetRes.status == 200);
+ CHECK(getSetRes.contentType.find("application/json") != std::string::npos);
+ auto jSet = json::parse(getSetRes.body);
+ CHECK(jSet.has_value() && (*jSet)["ok"].asBool());
+ CHECK((*jSet).has("keyMap") && (*jSet)["keyMap"].isArray());
+ CHECK((*jSet).has("tab") && (*jSet)["tab"].isString());
+ CHECK((*jSet).has("filters") && (*jSet)["filters"].isObject());
+
+ // Test POST /api/search with query only
+ auto searchRes = ws.handleRequest("POST", "/api/search", R"({"query":"Gears of War"})");
+ CHECK(searchRes.status == 200);
+ auto jSearch = json::parse(searchRes.body);
+ CHECK(jSearch.has_value() && (*jSearch)["ok"].asBool());
+ CHECK((*jSearch)["query"].str() == "Gears of War");
+
+ // Test POST /api/search with tab and interactive filters (Game Pass)
+ auto searchGPRes = ws.handleRequest("POST", "/api/search", R"({
+ "query": "Halo",
+ "tab": "gamepass",
+ "filters": {
+ "plan": 1,
+ "console": 2,
+ "mode": 1,
+ "language": 2,
+ "mouseKeyboard": true
+ }
+ })");
+ CHECK(searchGPRes.status == 200);
+ auto jSearchGP = json::parse(searchGPRes.body);
+ CHECK(jSearchGP.has_value() && (*jSearchGP)["ok"].asBool());
+ CHECK((*jSearchGP)["query"].str() == "Halo");
+ CHECK((*jSearchGP)["tab"].str() == "gamepass");
+ CHECK((*jSearchGP)["filters"]["plan"].asInt() == 1);
+ CHECK((*jSearchGP)["filters"]["console"].asInt() == 2);
+ CHECK((*jSearchGP)["filters"]["mode"].asInt() == 1);
+ CHECK((*jSearchGP)["filters"]["language"].asInt() == 2);
+ CHECK((*jSearchGP)["filters"]["mouseKeyboard"].asBool() == true);
+
+ // Test POST /api/search with tab and interactive filters (Library / Meus jogos)
+ auto searchLibRes = ws.handleRequest("POST", "/api/search", R"({
+ "query": "Forza",
+ "tab": "library",
+ "filters": {
+ "wishlist": true,
+ "free": true,
+ "cheapest": false,
+ "mode": 3,
+ "language": 1
+ }
+ })");
+ CHECK(searchLibRes.status == 200);
+ auto jSearchLib = json::parse(searchLibRes.body);
+ CHECK(jSearchLib.has_value() && (*jSearchLib)["ok"].asBool());
+ CHECK((*jSearchLib)["query"].str() == "Forza");
+ CHECK((*jSearchLib)["tab"].str() == "library");
+ CHECK((*jSearchLib)["filters"]["wishlist"].asBool() == true);
+ CHECK((*jSearchLib)["filters"]["free"].asBool() == true);
+ CHECK((*jSearchLib)["filters"]["cheapest"].asBool() == false);
+ CHECK((*jSearchLib)["filters"]["mode"].asInt() == 3);
+ CHECK((*jSearchLib)["filters"]["language"].asInt() == 1);
+
+ // Test setSearchParams / getSearchParams hooks integration
+ {
+ std::string hookedQ;
+ std::string hookedTab;
+ json::Value hookedFilters = json::Value::object();
+ app::setWebServerHooks({
+ /*getSettings=*/nullptr,
+ /*updateSettings=*/nullptr,
+ /*getSearchQuery=*/nullptr,
+ /*setSearchQuery=*/nullptr,
+ /*setSearchParams=*/[&](const std::string* q, const std::string* tab, const json::Value* f) {
+ if (q) hookedQ = *q;
+ if (tab) hookedTab = *tab;
+ if (f && f->isObject()) hookedFilters = *f;
+ },
+ /*getSearchParams=*/[&](std::string& outQ, std::string& outTab, json::Value& outF) {
+ outQ = hookedQ;
+ outTab = hookedTab.empty() ? "gamepass" : hookedTab;
+ outF = hookedFilters;
+ }
+ });
+
+ ws.handleRequest("POST", "/api/search", R"({"query":"Starfield","tab":"library","filters":{"wishlist":true,"console":1,"mode":2}})");
+ CHECK(hookedQ == "Starfield");
+ CHECK(hookedTab == "library");
+ CHECK(hookedFilters["wishlist"].asBool() == true);
+ CHECK(hookedFilters["console"].asInt() == 1);
+ CHECK(hookedFilters["mode"].asInt() == 2);
+
+ auto hookGetRes = ws.handleRequest("GET", "/api/settings", "");
+ auto jHookGet = json::parse(hookGetRes.body);
+ CHECK(jHookGet.has_value() && (*jHookGet)["query"].str() == "Starfield");
+ CHECK((*jHookGet)["tab"].str() == "library");
+ CHECK((*jHookGet)["filters"]["wishlist"].asBool() == true);
+ CHECK((*jHookGet)["filters"]["mode"].asInt() == 2);
+
+ // Test POST without tab: should resolve current tab from hooks
+ auto noTabRes = ws.handleRequest("POST", "/api/search", R"({"query":"Flight Simulator"})");
+ auto jNoTab = json::parse(noTabRes.body);
+ CHECK(jNoTab.has_value() && (*jNoTab)["ok"].asBool());
+ CHECK((*jNoTab)["tab"].str() == "library"); // resolved from hookedTab
+
+ // Clean up hooks
+ app::setWebServerHooks({});
+ }
+
+ // Test POST /api/settings (bad json, padMap only, and padMap + keyMap)
+ auto badSetRes = ws.handleRequest("POST", "/api/settings", "not-a-json");
+ CHECK(badSetRes.status == 400);
+
+ auto goodSetRes = ws.handleRequest("POST", "/api/settings", R"({"padMap":{"version":1,"map":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]}})");
+ CHECK(goodSetRes.status == 200);
+
+ auto fullSetRes = ws.handleRequest("POST", "/api/settings", R"({
+ "padMap": [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15],
+ "keyMap": [87,0,83,0,65,0,68,0,38,0,40,0,37,0,39,0,32,0,67,0,82,0,69,0,81,0,70,0,242,0,241,0,16,0,86,243,9,0,27,0]
+ })");
+ CHECK(fullSetRes.status == 200);
+
+ // Test GET /api/log
+ auto logRes = ws.handleRequest("GET", "/api/log", "");
+ CHECK(logRes.status == 200);
+ CHECK(logRes.contentType.find("text/plain") != std::string::npos);
+ CHECK(logRes.extraHeaders.find("Content-Disposition") != std::string::npos);
+
+ // Test 404
+ auto notFoundRes = ws.handleRequest("GET", "/api/unknown_endpoint", "");
+ CHECK(notFoundRes.status == 404);
+
+ // Test start/stop on a high ephemeral port (e.g. 18088)
+ CHECK(ws.start(18088));
+ CHECK(ws.isRunning());
+ CHECK(ws.port() == 18088);
+ ws.stop();
+ CHECK(!ws.isRunning());
+ }
+
+ // 3. UI Integration: Web QR & Remote Search & Rating Badges
+ {
+ ui::Fonts dummyFonts{};
+ ui::ImageCache images([] {});
+ ui::AppUi app(dummyFonts, images);
+
+ app.setWebUrl("http://192.168.1.100:8080");
+ CHECK(app.webUrl() == "http://192.168.1.100:8080");
+
+ app.setSearchQuery("Halo");
+ CHECK(app.searchQuery() == "Halo");
+
+ // Edge case: setSearchQuery while in streaming or modal mode should NOT yank out of screen
+ app.showStreaming();
+ CHECK(app.screen() == ui::Screen::Streaming);
+ app.setSearchQuery("Forza");
+ CHECK(app.screen() == ui::Screen::Streaming); // Must remain streaming!
+ CHECK(app.searchQuery() == "Forza");
+
+ // Test Game Details with rating badge rendering and long descriptors line
+ ui::GameTile tile;
+ tile.name = "Forza Horizon 5";
+ tile.publisher = "Xbox Game Studios";
+ tile.description = "Your Ultimate Horizon Adventure awaits!";
+ tile.ratingAge = "Livre";
+ tile.ratingSystem = "ClassInd";
+ tile.ratingDescriptors = {
+ "Violência Fantasiosa", "Compras no Jogo", "Interação de Usuários",
+ "Linguagem Apropriada", "Elementos Online Adicionais"
+ };
+ tile.categories = {"Corrida", "Mundo Aberto"};
+ tile.playable = true;
+
+ app.showDetails(tile);
+ ui::Canvas c(1920, 1080);
+ app.render(c, 1000);
+ CHECK(c.width() == 1920 && c.height() == 1080);
+
+ // Test other rating badge colors (12+, 14+, 16+, 18+)
+ tile.ratingAge = "14+";
+ app.showDetails(tile);
+ app.render(c, 1000);
+
+ tile.ratingAge = "18+";
+ app.showDetails(tile);
+ app.render(c, 1000);
+
+ // Test Settings screen rendering with QR Panel
+ app.showHome();
+ ui::NavInput openOpt;
+ openOpt.options = true;
+ app.handle(openOpt);
+ CHECK(app.screen() == ui::Screen::Settings);
+ app.render(c, 1000);
+ CHECK(c.width() == 1920);
+
+ // Close Settings
+ ui::NavInput back;
+ back.back = true;
+ app.handle(back);
+ CHECK(app.screen() == ui::Screen::Home);
+ }
+}
+
int main() {
+ testBlock3Features();
testWishlist();
testAchievements();
+ testBlock2Features();
testPurchase();
testNullBackends();
testPadGlyphs();
@@ -2776,6 +3508,7 @@ int main() {
testKeyMap();
testPadMap();
testTeredo();
+ testBlock1Features();
if (g_failures) {
std::fprintf(stderr, "%d failure(s)\n", g_failures);
return 1;
diff --git a/tools/desktop/package-appimage.sh b/tools/desktop/package-appimage.sh
new file mode 100755
index 0000000..342c8e2
--- /dev/null
+++ b/tools/desktop/package-appimage.sh
@@ -0,0 +1,143 @@
+#!/usr/bin/env bash
+# SPDX-License-Identifier: GPL-3.0-or-later
+# Copyright (C) 2026 RafaelNGP
+# Packages PSBox Cloud Gaming as a standalone universal AppImage for Linux and Steam Deck.
+#
+# tools/desktop/package-appimage.sh <build-dir> [out-dir]
+# -> <out-dir>/PSBox-<version>-x86_64.AppImage
+#
+set -euo pipefail
+
+build=${1:?usage: package-appimage.sh <build-dir> [out-dir]}
+root=$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)
+mkdir -p "$build"
+build=$(cd "$build" && pwd)
+out=${2:-$build/pkg}
+mkdir -p "$out"
+out=$(cd "$out" && pwd)
+
+fail() { echo "package-appimage: $*" >&2; exit 1; }
+ok() { echo " ok $*"; }
+
+project=$(sed -n 's/^project(xcloud_ps5 VERSION \([0-9.]*\) .*/\1/p' "$root/CMakeLists.txt")
+version=${XC_VERSION:-v$project}
+name=PSBox-$version-x86_64
+appimage_target=$out/$name.AppImage
+
+echo "== configure and build ($build)"
+args=(-DXCLOUD_DESKTOP_APP=ON "-DXC_PACKAGE_VERSION=$version")
+[[ -n ${CMAKE_PREFIX_PATH:-} ]] && args+=("-DCMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH")
+if [[ ! -f $build/CMakeCache.txt ]]; then
+ args+=(-G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo)
+ if [[ -z ${CC:-} ]] && command -v clang >/dev/null && command -v clang++ >/dev/null; then
+ args+=(-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++)
+ fi
+fi
+cmake -S "$root" -B "$build" "${args[@]}" >/dev/null
+cmake --build "$build" --target psbox -j"$(nproc)"
+ok "built psbox ($version)"
+
+# Render icon if needed
+if [[ ! -f "$build/psbox.png" ]]; then
+ cmake --build "$build" --target xcloud-cli -j"$(nproc)" >/dev/null
+ "$build/xcloud-cli" render-icon "$build/psbox.png"
+fi
+
+appdir=$(mktemp -d /tmp/psbox-appdir-XXXXXX)
+trap 'rm -rf "$appdir"' EXIT
+
+echo "== prepare AppDir structure"
+mkdir -p "$appdir/usr/bin"
+mkdir -p "$appdir/usr/lib"
+mkdir -p "$appdir/usr/share/psbox/assets/fonts"
+mkdir -p "$appdir/usr/share/applications"
+mkdir -p "$appdir/usr/share/icons/hicolor/256x256/apps"
+mkdir -p "$appdir/usr/share/licenses/psbox"
+
+# Copy binary
+cp "$build/psbox" "$appdir/usr/bin/psbox"
+strip --strip-unneeded "$appdir/usr/bin/psbox" 2>/dev/null || true
+
+# Copy bundled SDL3
+sdl_lib=$(ldd "$build/psbox" | awk '/libSDL3\.so/ {print $3}' | head -n 1)
+if [[ -n "$sdl_lib" && -f "$sdl_lib" ]]; then
+ cp -L "$sdl_lib" "$appdir/usr/lib/libSDL3.so.0"
+ (cd "$appdir/usr/lib" && ln -sf libSDL3.so.0 libSDL3.so)
+fi
+
+# Assets
+cp "$root/assets/cacert.pem" "$appdir/usr/share/psbox/assets/"
+cp "$root/assets/fonts/Inter-Regular.ttf" "$appdir/usr/share/psbox/assets/fonts/"
+[[ -f "$root/assets/fonts/Inter-SemiBold.ttf" ]] && cp "$root/assets/fonts/Inter-SemiBold.ttf" "$appdir/usr/share/psbox/assets/fonts/"
+[[ -f "$root/assets/fonts/Inter-Bold.ttf" ]] && cp "$root/assets/fonts/Inter-Bold.ttf" "$appdir/usr/share/psbox/assets/fonts/"
+
+# Metadata & desktop integration
+cp "$root/linux/psbox.desktop" "$appdir/psbox.desktop"
+cp "$root/linux/psbox.desktop" "$appdir/usr/share/applications/psbox.desktop"
+cp "$build/psbox.png" "$appdir/psbox.png"
+cp "$build/psbox.png" "$appdir/.DirIcon"
+cp "$build/psbox.png" "$appdir/usr/share/icons/hicolor/256x256/apps/psbox.png"
+
+# Licenses
+cp "$root/LICENSE" "$appdir/usr/share/licenses/psbox/"
+cp "$root/THIRD_PARTY_NOTICES.md" "$appdir/usr/share/licenses/psbox/"
+
+# AppRun script (Steam Deck / Gamescope / Linux universal launcher)
+cat << 'EOF' > "$appdir/AppRun"
+#!/usr/bin/env bash
+set -e
+
+# Resolve AppDir directory
+HERE="$(dirname "$(readlink -f "${0}")")"
+
+export PATH="${HERE}/usr/bin:${PATH}"
+export LD_LIBRARY_PATH="${HERE}/usr/lib:${HERE}/lib:${LD_LIBRARY_PATH:-}"
+export XCLOUD_ASSETS="${HERE}/usr/share/psbox/assets"
+
+# Support Steam Deck / SteamOS Game Mode
+if [ -z "${XDG_DATA_HOME:-}" ]; then
+ export XDG_DATA_HOME="${HOME}/.local/share"
+fi
+
+# Pass arguments directly to psbox
+exec "${HERE}/usr/bin/psbox" "$@"
+EOF
+chmod +x "$appdir/AppRun"
+ok "AppDir populated at $appdir"
+
+echo "== obtain appimagetool"
+TOOL_DIR="$HOME/.cache/psbox-tool"
+mkdir -p "$TOOL_DIR"
+APPIMAGETOOL=""
+if command -v appimagetool >/dev/null 2>&1; then
+ APPIMAGETOOL=$(command -v appimagetool)
+elif [[ -x "$TOOL_DIR/appimagetool" ]]; then
+ APPIMAGETOOL="$TOOL_DIR/appimagetool"
+else
+ echo " downloading appimagetool..."
+ curl -sL -o "$TOOL_DIR/appimagetool" https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage
+ chmod +x "$TOOL_DIR/appimagetool"
+ APPIMAGETOOL="$TOOL_DIR/appimagetool"
+fi
+
+echo "== package AppImage ($appimage_target)"
+rm -f "$appimage_target"
+(
+ export ARCH=x86_64
+ export APPIMAGE_EXTRACT_AND_RUN=1
+ "$APPIMAGETOOL" "$appdir" "$appimage_target" >/dev/null
+)
+
+[[ -s "$appimage_target" ]] || fail "Failed to generate $appimage_target"
+chmod +x "$appimage_target"
+ok "$appimage_target ($(du -h "$appimage_target" | cut -f1))"
+
+echo "== verify AppImage execution"
+mkdir -p "$build/appimage-test-data"
+if ! env -u LD_LIBRARY_PATH APPIMAGE_EXTRACT_AND_RUN=1 SDL_VIDEO_DRIVER=offscreen SDL_AUDIO_DRIVER=dummy \
+ XCLOUD_DATA_DIR="$build/appimage-test-data" "$appimage_target" --help >/dev/null 2>&1; then
+ fail "AppImage execution failed test verification"
+fi
+ok "AppImage starts and responds correctly"
+
+echo "$appimage_target"
diff --git a/tools/ps5/package.sh b/tools/ps5/package.sh
index d77a113..48db0f0 100755
--- a/tools/ps5/package.sh
+++ b/tools/ps5/package.sh
@@ -22,8 +22,8 @@ mkdir -p "$app/sce_sys" "$app/sce_module" "$app/assets"
cp "$build/eboot.bin" "$app/eboot.bin"
cp "$param" "$app/sce_sys/param.json"
cp "$root/ps5/sce_sys/icon0.png" "$app/sce_sys/icon0.png"
-# Home-screen backgrounds (tools/ps5/home-art.sh).
-for f in pic0.dds pic1.dds; do
+# Home-screen backgrounds and audio (tools/ps5/home-art.sh, snd0.at9).
+for f in pic0.dds pic1.dds snd0.at9; do
[[ -f "$root/ps5/sce_sys/$f" ]] && cp "$root/ps5/sce_sys/$f" "$app/sce_sys/$f"
done
cp "$vk/runtime/libc.prx" "$app/sce_module/libc.prx"
diff --git a/tools/ps5/ps5_dev.py b/tools/ps5/ps5_dev.py
index 888adcf..d8d83ff 100755
--- a/tools/ps5/ps5_dev.py
+++ b/tools/ps5/ps5_dev.py
@@ -184,7 +184,8 @@ def cmd_test(args):
"padmaptest", "detailtest", "gridtest", "crashtest", "searchtest",
"tunetest", "confirmtest", "pickertest", "menutest", "regiontest",
"friendstest", "publishertest", "scrolltest", "quicktest", "tlscheck",
- "padspktest", "queuetest", "queueuitest", "wishlisttest",
+ "padspktest", "queuetest", "queueuitest", "wishlisttest", "block1test",
+ "block2test", "block3test", "bitratetest",
}
bitrate_opt = f" bitrate={args.bitrate}" if getattr(args, "bitrate", 0) > 0 else ""
if target.startswith("AUTOTEST") or target.startswith("BENCH") or " " in target:
@@ -206,7 +207,9 @@ def cmd_test(args):
old_file.unlink(missing_ok=True)
(out_dir / "xcloud.log").unlink(missing_ok=True)
- print(" 2. Packaging fresh build...")
+ print(" 2. Building, linking and packaging fresh build...")
+ run_cmd("ninja -C build-ps5 xcloud_app", cwd=ROOT)
+ run_cmd("bash tools/ps5/link.sh build-ps5", cwd=ROOT)
run_cmd("XC_INCLUDE_ACCOUNT=1 bash tools/ps5/package.sh build-ps5", cwd=ROOT)
run_cmd(f"PS5_HOST={host} ./tools/ps5/deploy.sh build-ps5", cwd=ROOT)
@@ -221,7 +224,11 @@ def cmd_test(args):
# Delete old artifacts on PS5
for name in ("xcloud.log", "frame.ppm", "frame2.ppm", "frame3.ppm", "frame4.ppm", "screen.ppm", "ui.ppm", "launch.ppm", "detail.ppm",
"detail_after.ppm", "settings.ppm", "game_settings.ppm", "game_settings_custom.ppm", "library.ppm",
- "wishlist_empty.ppm", "wishlist_active.ppm", "confirm2.ppm", "home.ppm"):
+ "wishlist_empty.ppm", "wishlist_active.ppm", "confirm2.ppm", "home.ppm",
+ "search_grid3x3.ppm", "settings_desc_row0.ppm", "settings_desc_row1.ppm", "detail_free.ppm",
+ "launch_tip1.ppm", "launch_tip2.ppm",
+ "update_prompt_3buttons.ppm", "update_notes_modal.ppm", "stream_menu_spk100.ppm", "stream_menu_spk50.ppm",
+ "settings_bitrate_caps.ppm", "settings_web_qr.ppm", "game_details_rating.ppm"):
try:
ftp.sendcmd(f"DELE {name}")
except (error_perm, error_reply):
@@ -257,7 +264,11 @@ def cmd_test(args):
# Fetch all PPMs and log
ppm_names = ["ui.ppm", "launch.ppm", "frame.ppm", "frame2.ppm", "frame3.ppm", "frame4.ppm", "screen.ppm", "detail.ppm",
"detail_after.ppm", "settings.ppm", "game_settings.ppm", "game_settings_custom.ppm",
- "library.ppm", "wishlist_empty.ppm", "wishlist_active.ppm", "error.ppm", "confirm2.ppm", "home.ppm"]
+ "library.ppm", "wishlist_empty.ppm", "wishlist_active.ppm", "error.ppm", "confirm2.ppm", "home.ppm",
+ "search_grid3x3.ppm", "settings_desc_row0.ppm", "settings_desc_row1.ppm", "detail_free.ppm",
+ "launch_tip1.ppm", "launch_tip2.ppm",
+ "update_prompt_3buttons.ppm", "update_notes_modal.ppm", "stream_menu_spk100.ppm", "stream_menu_spk50.ppm",
+ "settings_bitrate_caps.ppm", "settings_web_qr.ppm", "game_details_rating.ppm"]
ftp = get_ftp(host, port)
ftp.cwd("/data/psbox")
for name in ppm_names + ["xcloud.log"]: