Skip to content

Xbox Cloud Gaming app for PS5 Homebrew

C

feat(release): v1.5.0 with settings reorder, 1-click license claim, delta sync, and gratis search polish

Rafael Abud Ferreiraba90a4413515
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3fa9a0e..0f2e9ca 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.4.0 LANGUAGES C CXX)
+project(xcloud_ps5 VERSION 1.5.0 LANGUAGES C CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
diff --git a/ROADMAP.md b/ROADMAP.md
index ec05166..7e6fc79 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.4.0.
+Last update: 2026-10-23, v1.5.0.
## Now
@@ -283,6 +283,48 @@ The 8BitDo Ultimate 2.4G wireless controller connects via its bundled 2.4 GHz US
- On jailbroken consoles (Prospero 3.xx–4.xx), homebrew userland can bypass `libScePad` entirely by opening `/dev/uhid*` directly or using `libusb`.
- A lightweight driver module (`src/input/pad_usb.cpp`) will read raw HID reports from the 8BitDo dongle in D-Input mode (16-byte report: 2 analog sticks, 2 triggers, 14 digital buttons), map them into `input::ControllerState`, and merge them directly into `input::mergePads` alongside or in place of DualSense.
+### Technical Feasibility Study: Multi-Phone WebUI Controllers (P1..P4)
+
+**Context & Architecture**:
+The embedded lightweight HTTP server (`src/app/web_server.cpp`) serves a zero-install touch gamepad (`/gamepad` or `/`) to local network clients (iOS Safari, Android Chrome, desktop browsers). Expanding this architecture to support concurrent multi-phone controllers allows up to 4 simultaneous players without requiring multiple physical DualSense or USB controllers.
+
+**1. Session & Player Slot Management (P1..P4)**:
+- **Slot Selection**: The WebUI client provides a player selector (`P1`, `P2`, `P3`, `P4`) or automatically claims the first free slot via query param `?player=N` or initial handshake (`GET /api/gamepad/claim`).
+- **Slot State Matrix**: The host maintains an array of `VirtualGamepadState[kMaxPads]` (4 slots), protected by per-slot atomic timestamps and mutexes.
+- **Heartbeat & Inactivity Eviction**: Each virtual pad maintains `lastSeenMs`. If a connected phone stops transmitting for > 15 seconds (browser minimized, incoming call, Wi-Fi sleep), the slot is automatically freed and the UI player indicator reflects disconnection.
+
+**2. Network Transport & Latency Optimization**:
+- **HTTP POST vs WebSocket**: Currently, gamepad states are sent via low-overhead JSON HTTP POST (`/api/gamepad`). At 60 Hz input polling, persistent HTTP/1.1 `keep-alive` connections achieve 2–6 ms latency on typical 5 GHz home Wi-Fi.
+- **Binary Report Framing**: Upgrading input payload to a 12-byte binary format (`[slot:1, buttons:2, lt:1, rt:1, lx:2, ly:2, rx:2, ry:2]`) sent via WebSocket or HTTP chunks minimizes serialization overhead and JSON parsing on the PS5 CPU.
+- **Input Concurrency**: Worker threads decode incoming packets and update `g_virtualGamepad[slot]`. The render/stream frame loop polls all slots concurrently with zero mutex contention using double-buffering or `std::atomic`.
+
+**3. In-Game Local Co-op Compatibility**:
+- xCloud supports local co-op titles (e.g. *It Takes Two*, *Overcooked: All You Can Eat*, *Halo: The Master Chief Collection*, *A Way Out*, *EA Sports FC*).
+- PSBox merges virtual pads directly into Xbox WebRTC input channels (`ChannelType::Input`), ensuring cloud instances recognize separate controller indices seamlessly.
+
+---
+
+### PSBox Layout Studio (Virtual Controller Visual Customizer)
+
+**Purpose & Architecture**:
+A browser-based visual layout editor embedded directly into the WebUI under the **Mapeamento** (Remap) section, accessible via a dedicated sub-tab with a mobile phone icon and the label **"Celular"** (alongside "Controle" and "Teclado"). It eliminates hardcoded CSS guesswork and empowers users to visually customize and persist touch gamepad layouts directly from their mobile browser or desktop.
+
+**Core Features & Integration**:
+1. **Interactive Visual Canvas**:
+ - WYSIWYG interactive canvas mirroring target device viewport resolutions (iPhone, Galaxy, iPad, landscape and portrait aspect ratios).
+ - Real-time draggable, scalable, and rotatable UI widgets: Analog Sticks (LS/RS), D-Pad, ABXY cluster, Bumpers (LB/RB), Analog Triggers (LT/RT), System buttons (Nexus/Xbox, View, Menu), and Player selector bar.
+2. **Dual-Orientation Custom Presets**:
+ - Independent custom layout presets for Portrait and Landscape orientations (`portrait-custom`, `landscape-custom`), as well as built-in presets (`default-phone`, `compact-thumb`, `tablet-split`, `claw-grip`).
+ - One-click "Restaurar padrão" (Reset to default) button to revert touch positions to factory ergonomics.
+3. **Seamless JSON Layout Export & Live Persistence**:
+ - Export and import layout profiles formatted in structured JSON (`{ portrait: { ... }, landscape: { ... } }`).
+ - Saving from the Layout Studio instantly persists custom layout configurations to the client local storage and updates the active **Controle** (Gamepad) tab live without requiring a host restart or browser page reload.
+ - Code generation mode exports formatted CSS coordinate rules (`left`, `top`, `width`, `height`, `transform: scale()`) ready for direct inclusion in `src/app/web_server.cpp`.
+4. **Ergonomic Safe Zones, Snapping & Haptics**:
+ - Visual safe-area guides (notch, Dynamic Island, navigation bar insets).
+ - Configurable snap grids, thumb radius arcs, boundary clamping, and Web Vibration API haptic pulses for real-time touch simulation.
+
+
## Dropped (and why)
- **Discord Rich Presence (desktop)**: dropped (Xbox Live / Game Pass ecosystem already provides native activity presence).
@@ -325,6 +367,14 @@ The 8BitDo Ultimate 2.4G wireless controller connects via its bundled 2.4 GHz US
## Done
+- **v1.5.0**:
+ - Reorganized Settings menu with network/connectivity priority.
+ - 1-Click direct free license acquisition on `Screen::Error` for unowned free games and launchers (Call of Duty BO6 Launcher, FFXIV Online Free Trial).
+ - Instant delta-sync library update (<kbd>L3</kbd> and login) without cache flushing or UI freeze.
+ - Search "Grátis" filter refactor excluding already owned games and unclaimable token products.
+ - Red "Restaurar configurações padrões" button with 5-second hold confirmation.
+ - WebUI 2.0 with fullscreen landscape and portrait virtual touch controller supporting Players 1-4 with dynamic console icon feedback.
+ - Cleaned console notifications removing duplicate toasts.
- "All games" (Game Pass) as an expanded vertical grid: uncapped 550+ games in 6 centered columns, 2D D-pad navigation, smooth vertical row scrolling and clean clipping under header and tabs.
- v0.5.0: picture on the GPU, FSR 1 upscaling to 4K, block smoothing.
- v0.4.0: game menu, PS5 keyboard in games, frame metadata reports, CAS
diff --git a/notes.md b/notes.md
index 43c91b7..701fc64 100644
--- a/notes.md
+++ b/notes.md
@@ -1,47 +1,71 @@
<!-- LANG:PT -->
-## Novidades e Melhorias no v1.4.0
+## Novidades e Melhorias no v1.5.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.
+### ⚙️ Reorganização das Configurações
+- **Nova Ordem Intuitiva**: As opções principais foram reorganizadas para priorizar rede, região e conexões:
+ 1. Idioma
+ 2. Região do servidor
+ 3. País do login
+ 4. Verificar meu login
+ 5. Teste de rede
+ 6. Resolução do streaming
+ 7. Decodificação de Vídeo
+ 8. Saída 120 Hz (VRR)
+ 9. Bitrate máximo
+- **Botão Restaurar Configurações Padrões**: Novo botão vermelho estilizado com confirmação protegida de 5 segundos para restaurar as preferências padrão de fábrica com segurança.
-### 🔞 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.
+### 🎮 Aquisição em 1-Clique ("Ainda não está na sua conta")
+- **Botão Direto na Tela de Erro**: Ao tentar rodar jogos gratuitos ou launchers (como Call of Duty HQ / Black Ops 6 Launcher e FINAL FANTASY XIV Online Free Trial) que ainda não foram resgatados na conta Microsoft, a própria tela de erro oferece o atalho direto `✕ Adquirir Grátis`.
+- **Sem Celular nem QR Code**: A licença gratuita é adquirida instantaneamente pela API da Microsoft Store no próprio PS5, abrindo a tela de detalhes com o botão "Jogar" liberado na hora.
-### 🎮 Á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.
+### ⚡ Atualização Delta Instantânea da Biblioteca (L3)
+- **Zero Travamento**: Pressionar `L3` ("Atualizar") ou iniciar o aplicativo não reconstrói mais a biblioteca do zero nem apaga o cache local. O app compara os títulos com o catálogo online e baixa apenas os metadados dos jogos novos de forma instantânea.
+- **Feedback Transparente**: Notificação indicando exatamente a quantidade de novos jogos adicionados ou confirmando que a biblioteca já está em dia.
-### 📦 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.
+### 🔍 Filtro "Grátis" Refinado na Pesquisa
+- **Ocultação de Jogos Já Adquiridos**: O filtro "Grátis" agora exibe apenas jogos gratuitos que você ainda NÃO tem na conta, facilitando descobrir novidades da loja.
+- **Eliminação de Erros de Catálogo**: Títulos de pacotes, códigos ou tokens sem disponibilidade de compra direta (`CatalogAvailabilityDataNotFound`) não são mais marcados erroneamente como gratuitos.
-### 🐧 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.
+### 📱 WebUI 2.0 & Controle Virtual Touch
+- **Smartphone como Gamepad**: Controle virtual redesenhado com suporte a modo paisagem em tela cheia e modo retrato, permitindo jogar como Player 1 até Player 4 com ícones dinâmicos no PS5.
+- **Painel de Configurações Web e Mapeamento**: Novo layout limpo em grade 3x2, sincronização bidirecional em tempo real e remoção de rolagens desnecessárias.
+
+### 🔔 Notificações e Polimento Visual no Console
+- **Notificações Limpas**: Remoção de toasts duplicados no centro e topo da tela ao sincronizar configurações ou adquirir jogos, mantendo avisos leves de debug no console.
+- **Alinhamento Perfeito**: Textos, seletores e chevrons perfeitamente alinhados à direita no menu de configurações.
<!-- LANG:EN -->
-## What's New in Version 1.4.0
+## What's New in Version 1.5.0
+
+### ⚙️ Settings Menu Reorganization
+- **Intuitive Ordering**: Settings options have been rearranged prioritizing connectivity, region, and network:
+ 1. Language
+ 2. Server Region
+ 3. Login Country
+ 4. Check Sign-in
+ 5. Network Test
+ 6. Streaming Resolution
+ 7. Video Decoder
+ 8. 120 Hz Output (VRR)
+ 9. Max Bitrate
+- **Reset to Defaults Button**: Added a dedicated red reset button at the bottom of Settings with an animated 5-second hold confirmation to safely restore default configurations.
-### 🌐 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.
+### 🎮 1-Click License Acquisition ("Not on your account yet")
+- **Direct Error Screen Claiming**: When launching free-to-play packages or launchers (such as Call of Duty HQ / Black Ops 6 Launcher or FINAL FANTASY XIV Online Free Trial) not yet registered to your Microsoft account, the error screen now features a direct `✕ Claim Free` action.
+- **No External Browser Needed**: Entitlements are obtained autonomously via the Microsoft Store API from your console, opening the game page with the "Play" button unlocked immediately.
-### 🔞 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.
+### ⚡ Instant Non-Destructive Delta Library Refresh (L3)
+- **Zero Freezing**: Tapping `L3` ("Refresh") or logging in no longer flushes cache or freezes navigation. It performs a lightweight delta query against Xbox cloud endpoints, fetching metadata only for newly released games.
+- **Clear Notifications**: In-app indicator shows how many new titles were added or confirms the library is completely up to date.
-### 🎮 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.
+### 🔍 Polished "Free" Search Filter
+- **Excludes Owned Games**: The "Free" filter now exclusively presents unacquired free titles, hiding games already present in your library.
+- **Store Availability Guard**: Bundle tokens and products lacking a direct purchase action (`CatalogAvailabilityDataNotFound`) are filtered out to prevent purchase errors.
-### 📦 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.
+### 📱 WebUI 2.0 & Virtual Touch Gamepad
+- **Smartphone Gamepad**: Fully responsive virtual controller featuring fullscreen landscape and portrait modes, allowing mobile devices to join as Players 1 through 4 with live icon indicators on the TV.
+- **Streamlined Web Dashboard**: Clean 3x2 tab navigation, real-time bidirectional settings synchronization, and optimized touch reachability.
-### 🐧 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.
+### 🔔 Clean Console Notifications & UI Alignment
+- **De-cluttered Alerts**: Eliminated redundant toast overlays on PS5 during settings sync and license acquisition in favor of concise debug banners.
+- **Pixel-Perfect Alignment**: Strict right-edge text and chevron alignment across all settings rows and cards.
diff --git a/ps5/sce_sys/param.json b/ps5/sce_sys/param.json
index 01e17dc..6f9951f 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.400.000",
+ "contentVersion": "01.500.000",
"downloadDataSize": 256,
"gameIntent": {
"permittedIntents": [
diff --git a/src/app/app_core.cpp b/src/app/app_core.cpp
index 06b307e..6e3044e 100644
--- a/src/app/app_core.cpp
+++ b/src/app/app_core.cpp
@@ -175,7 +175,10 @@ struct Core {
player = g_settings.keyboardPlayer;
}
if (player < 0 || player >= input::kMaxPads) return -1;
- bool keyboardLast = !input::padConnected(player) || keyboardActiveAt > input::padActiveAt(player);
+ uint64_t padT = input::padConnected(player) ? input::padActiveAt(player) : 0;
+ uint64_t phoneT = virtualGamepadActiveAt(player);
+ bool keyboardLast = (keyboardActiveAt > padT && keyboardActiveAt > phoneT) ||
+ (!input::padConnected(player) && phoneT == 0);
return keyboardLast ? player : -1;
}
static uint64_t now0() { return platform::nowMs(); }
@@ -191,6 +194,9 @@ struct Core {
bool kbmConnected = false; // a USB keyboard or mouse in use
uint64_t keyboardActiveAt = 0; // when a key or the mouse was last used (ms)
int keyboardIconShown = -2; // as last drawn in the players' row
+ std::array<uint64_t, input::kMaxPads> padActiveBefore_{};
+ std::array<uint64_t, input::kMaxPads> vpadActiveBefore_{};
+ uint64_t kbActiveBefore_ = 0;
Repeater up, down, left, right, dpadLeft, dpadRight;
// Smooth scrolling: rows / cards still to move (fractions carry over),
// the touchpad's last point, and its speed for the glide after release.
@@ -303,6 +309,7 @@ bool coreStartup() {
setWebServerHooks({
/*getSettings=*/[](json::Value& root) {
std::lock_guard<std::mutex> lock(g_settingsMutex);
+ root.set("settingsVersion", static_cast<int64_t>(g_settingsVersion.load()));
root.set("language", g_settings.language);
root.set("resolution", g_settings.resolution);
root.set("maxBitrateMbps", g_settings.maxBitrateMbps);
@@ -319,11 +326,21 @@ bool coreStartup() {
root.set("queueReadyAlert", g_settings.queueReadyAlert);
root.set("videoDecoder", g_settings.videoDecoder);
root.set("voiceRouting", g_settings.voiceRouting);
+ root.set("padSpeakerVolume", g_settings.padSpeakerVolume);
+ root.set("sharpness", g_settings.sharpness);
+ root.set("upscaler", g_settings.upscaler);
+ root.set("deband", g_settings.deband);
+ root.set("triggerProfile", g_settings.triggerProfile);
+ root.set("gyroMode", g_settings.gyroMode);
+ root.set("gyroLevel", g_settings.gyroLevel);
+ root.set("touchpadMouse", g_settings.touchpadMouse);
root.set("padMap", input::padMapJson(g_settings.padMap));
root.set("keyMap", keyMapToJson(g_settings.keyMap));
+ root.set("touchpadShortcuts", input::touchpadShortcutsJson(g_settings.touchpadShortcuts));
},
/*updateSettings=*/[](const json::Value& root) -> bool {
bool changed = false;
+ int padSpeakerVol = -1;
{
std::lock_guard<std::mutex> lock(g_settingsMutex);
if (root.has("voiceRouting")) {
@@ -363,6 +380,11 @@ bool coreStartup() {
g_settings.triggerStrength = static_cast<int>(std::clamp<int64_t>(root["triggerStrength"].asInt(g_settings.triggerStrength), 0, 4));
changed = true;
}
+ if (root.has("triggerProfile")) {
+ g_settings.triggerProfile = static_cast<int>(std::clamp<int64_t>(root["triggerProfile"].asInt(g_settings.triggerProfile), 0, 2));
+ input::setTriggerProfile(g_settings.triggerProfile);
+ changed = true;
+ }
if (root.has("audioHaptics")) {
g_settings.audioHaptics = static_cast<int>(std::clamp<int64_t>(root["audioHaptics"].asInt(g_settings.audioHaptics), 0, 3));
media::setAudioHapticsLevel(g_settings.audioHaptics);
@@ -387,12 +409,63 @@ bool coreStartup() {
g_settings.keyMap = keyMapFromJson(root["keyMap"], g_settings.keyMap);
changed = true;
}
+ if (root.has("touchpadShortcuts")) {
+ input::TouchpadShortcuts newTs;
+ if (input::readTouchpadShortcuts(root["touchpadShortcuts"], newTs)) {
+ g_settings.touchpadShortcuts = newTs;
+ for (auto& [k, prof] : g_settings.perGame) {
+ prof.touchpadShortcuts = newTs;
+ }
+ changed = true;
+ }
+ }
+ if (root.has("padSpeakerVolume")) {
+ g_settings.padSpeakerVolume = static_cast<int>(std::clamp<int64_t>(root["padSpeakerVolume"].asInt(g_settings.padSpeakerVolume), 0, 100));
+ padSpeakerVol = g_settings.padSpeakerVolume;
+ changed = true;
+ }
+ if (root.has("sharpness")) {
+ g_settings.sharpness = static_cast<int>(std::clamp<int64_t>(root["sharpness"].asInt(g_settings.sharpness), 0, 3));
+ changed = true;
+ }
+ if (root.has("upscaler")) {
+ g_settings.upscaler = static_cast<int>(std::clamp<int64_t>(root["upscaler"].asInt(g_settings.upscaler), 0, 3));
+ changed = true;
+ }
+ if (root.has("deband")) {
+ g_settings.deband = static_cast<int>(std::clamp<int64_t>(root["deband"].asInt(g_settings.deband), 0, 3));
+ changed = true;
+ }
+ if (root.has("gyroMode")) {
+ g_settings.gyroMode = static_cast<int>(std::clamp<int64_t>(root["gyroMode"].asInt(g_settings.gyroMode), 0, 2));
+ changed = true;
+ }
+ if (root.has("gyroLevel")) {
+ g_settings.gyroLevel = static_cast<int>(std::clamp<int64_t>(root["gyroLevel"].asInt(g_settings.gyroLevel), 1, 10));
+ changed = true;
+ }
+ if (root.has("touchpadMouse")) {
+ g_settings.touchpadMouse = root["touchpadMouse"].asBool(g_settings.touchpadMouse);
+ changed = true;
+ }
if (changed) {
g_settings.save(settingsPath());
- applyControllerSettings();
refreshSettingsUiLocked();
}
}
+ if (changed) {
+ applyControllerSettings();
+ if (padSpeakerVol >= 0) {
+ media::setPadSpeakerVolume(padSpeakerVol);
+ }
+ if (g_core && g_core->streamScreen) {
+ g_core->streamScreen->syncFromSettings();
+ }
+ platform::notify("Configurações atualizadas (WebUI)");
+ if (g_ui && !shell::caps().console) {
+ g_ui->showToast("Configurações atualizadas");
+ }
+ }
return true;
},
/*getSearchQuery=*/[]() -> std::string {
@@ -470,47 +543,87 @@ bool coreStartup() {
stats.set("height", g_streamInfo.height);
},
/*getStreamMenuState=*/[](json::Value& menu) {
+ ui::GameTile tile;
+ {
+ std::lock_guard<std::mutex> argLock(g_argMutex);
+ tile = g_playTile;
+ }
std::lock_guard<std::mutex> lock(g_settingsMutex);
- menu.set("sharpness", g_settings.sharpness);
- menu.set("upscaler", g_settings.upscaler);
- menu.set("deband", g_settings.deband);
+ bool hasCustom = false;
+ GameProfile prof = g_settings.profileForGame(tile.productId, tile.titleId, &hasCustom);
+ menu.set("sharpness", prof.sharpness);
+ menu.set("upscaler", prof.upscaler);
+ menu.set("deband", prof.deband);
menu.set("padSpeakerVolume", g_settings.padSpeakerVolume);
- menu.set("triggerProfile", g_settings.triggerProfile);
+ menu.set("triggerProfile", prof.triggerProfile);
+ menu.set("touchpadShortcuts", input::touchpadShortcutsJson(prof.touchpadShortcuts));
+ menu.set("hasCustomProfile", hasCustom);
},
/*updateStreamMenu=*/[](const json::Value& update) -> bool {
bool changed = false;
+ int padSpeakerVol = -1;
{
+ ui::GameTile tile;
+ {
+ std::lock_guard<std::mutex> argLock(g_argMutex);
+ tile = g_playTile;
+ }
+ std::string key = gameProfileKey(tile.productId, tile.titleId);
+
std::lock_guard<std::mutex> lock(g_settingsMutex);
+ bool hasCustom = !key.empty() && g_settings.perGame.count(key);
+
if (update.has("sharpness")) {
- g_settings.sharpness = static_cast<int>(std::clamp<int64_t>(update["sharpness"].asInt(g_settings.sharpness), 0, 3));
- display::setSharpness(g_settings.sharpness);
+ int val = static_cast<int>(std::clamp<int64_t>(update["sharpness"].asInt(g_settings.sharpness), 0, 3));
+ if (hasCustom) g_settings.perGame[key].sharpness = val;
+ else g_settings.sharpness = val;
changed = true;
}
if (update.has("upscaler")) {
- g_settings.upscaler = static_cast<int>(std::clamp<int64_t>(update["upscaler"].asInt(g_settings.upscaler), 0, 3));
- display::setUpscaler(g_settings.upscaler & 1);
- display::setRestore((g_settings.upscaler & 2) != 0);
+ int val = static_cast<int>(std::clamp<int64_t>(update["upscaler"].asInt(g_settings.upscaler), 0, 3));
+ if (hasCustom) g_settings.perGame[key].upscaler = val;
+ else g_settings.upscaler = val;
changed = true;
}
if (update.has("deband")) {
- g_settings.deband = static_cast<int>(std::clamp<int64_t>(update["deband"].asInt(g_settings.deband), 0, 3));
- display::setDeband(g_settings.deband);
+ int val = static_cast<int>(std::clamp<int64_t>(update["deband"].asInt(g_settings.deband), 0, 3));
+ if (hasCustom) g_settings.perGame[key].deband = val;
+ else g_settings.deband = val;
changed = true;
}
if (update.has("padSpeakerVolume")) {
g_settings.padSpeakerVolume = static_cast<int>(std::clamp<int64_t>(update["padSpeakerVolume"].asInt(g_settings.padSpeakerVolume), 0, 100));
- media::setPadSpeakerVolume(g_settings.padSpeakerVolume);
+ padSpeakerVol = g_settings.padSpeakerVolume;
changed = true;
}
if (update.has("triggerProfile")) {
- g_settings.triggerProfile = static_cast<int>(std::clamp<int64_t>(update["triggerProfile"].asInt(g_settings.triggerProfile), 0, 2));
- input::setTriggerProfile(g_settings.triggerProfile);
+ int val = static_cast<int>(std::clamp<int64_t>(update["triggerProfile"].asInt(g_settings.triggerProfile), 0, 2));
+ if (hasCustom) g_settings.perGame[key].triggerProfile = val;
+ else g_settings.triggerProfile = val;
changed = true;
}
+ if (update.has("touchpadShortcuts")) {
+ input::TouchpadShortcuts newTs;
+ if (input::readTouchpadShortcuts(update["touchpadShortcuts"], newTs)) {
+ if (hasCustom) g_settings.perGame[key].touchpadShortcuts = newTs;
+ else g_settings.touchpadShortcuts = newTs;
+ changed = true;
+ }
+ }
if (changed) {
g_settings.save(settingsPath());
refreshSettingsUiLocked();
+ if (g_ui) g_ui->setPerGameSettings(g_settings.perGame);
+ }
+ }
+ if (changed) {
+ if (padSpeakerVol >= 0) {
+ media::setPadSpeakerVolume(padSpeakerVol);
+ }
+ if (g_core && g_core->streamScreen) {
+ g_core->streamScreen->syncFromSettings();
}
+ platform::notify("Configurações do jogo atualizadas (WebUI)");
}
return true;
},
@@ -551,7 +664,11 @@ bool coreStartup() {
g_ui->setOwned(initialLib->owned(), initialLib->purchasable(), initialLib->ownedKnown());
g_ui->setMembership(initialLib->gamePassMember());
g_ui->setSearchPools(initialLib->gamePassSearchPool(), initialLib->librarySearchPool());
- g_ui->showHome();
+ struct stat accSt;
+ if (::stat((platform::dataDir() + "/account.json").c_str(), &accSt) == 0 && accSt.st_size > 0) {
+ g_ui->showHome();
+ g_ui->setLoading(true, 0, 0);
+ }
XC_LOGI("instant-resume: loaded offline cache (%zu rows, %zu owned) in 0.01s",
initialLib->rows().size(), initialLib->owned().size());
}
@@ -672,6 +789,10 @@ void Core::dispatchUiAction(const ui::UiEvent& ev) {
case ui::Action::RefreshLibrary: {
XC_LOGI("library: manual refresh requested");
g_command = kReloadLibrary;
+ if (g_ui) {
+ g_ui->showToast(ui::tr(ui::Str::RefreshingLibrary));
+ g_ui->setLoading(true, 0, 0);
+ }
platform::notify(ui::tr(ui::Str::RefreshingLibrary));
break;
}
@@ -692,6 +813,30 @@ void Core::dispatchUiAction(const ui::UiEvent& ev) {
playQueueReadyAlert();
break;
}
+ case ui::Action::ResetSettings: {
+ XC_LOGI("settings: restoring factory default settings");
+ bool langChanged = false;
+ {
+ std::lock_guard<std::mutex> lock(g_settingsMutex);
+ std::string prevLang = g_settings.language;
+ g_settings = app::Settings{};
+ g_settings.save(settingsPath());
+ langChanged = g_settings.language != prevLang;
+ refreshSettingsUiLocked();
+ if (g_ui) g_ui->setPerGameSettings(g_settings.perGame);
+ }
+ ui::setLanguage(ui::languageFromCode(g_settings.language));
+ applyControllerSettings();
+ media::setPadSpeakerVolume(g_settings.padSpeakerVolume);
+ if (g_core && g_core->streamScreen) {
+ g_core->streamScreen->syncFromSettings();
+ }
+ updateLibraryFavorites(g_settings.favorites);
+ updateLibraryWishlist(g_settings.wishlist);
+ platform::notify(ui::tr(ui::Str::SettingsResetNotice));
+ if (langChanged) g_command = kReloadLibrary;
+ break;
+ }
case ui::Action::None: break;
}
}
@@ -850,6 +995,22 @@ bool Core::frame() {
keyboardIconShown = shown;
padsCheckedAt = 0; // the players' row at once, as the device in use changes
}
+ if (keyboardActiveAt != kbActiveBefore_) {
+ kbActiveBefore_ = keyboardActiveAt;
+ padsCheckedAt = 0; // immediate update on keyboard input
+ }
+ for (int i = 0; i < input::kMaxPads; ++i) {
+ uint64_t pAct = input::padActiveAt(i);
+ if (pAct != padActiveBefore_[static_cast<size_t>(i)]) {
+ padActiveBefore_[static_cast<size_t>(i)] = pAct;
+ padsCheckedAt = 0; // immediate update on pad input
+ }
+ uint64_t vAct = virtualGamepadActiveAt(i);
+ if (vAct != vpadActiveBefore_[static_cast<size_t>(i)]) {
+ vpadActiveBefore_[static_cast<size_t>(i)] = vAct;
+ padsCheckedAt = 0; // immediate update on phone input or player switch
+ }
+ }
streamScreen->setKbm(std::move(kbm));
{
// The triggers' resistance: in a game and in its Settings tester only.
@@ -884,14 +1045,49 @@ bool Core::frame() {
input::ControllerState ignored;
for (int i = 1; i < input::kMaxPads; ++i) input::pollPad(i, ignored);
}
+ int kbPlayer = -1;
+ {
+ std::lock_guard<std::mutex> lock(g_settingsMutex);
+ kbPlayer = g_settings.keyboardPlayer;
+ }
ui::PadSlots slots;
- for (int i = 0; i < input::kMaxPads; ++i)
- slots[static_cast<size_t>(i)] = {input::padConnected(i), input::padUserName(i)};
- // The keyboard: in a slot of its own as another player's
- // controller (Settings), else on player 1's while it's the device in use.
- if (int kb = keyboardIconSlot(); kb >= 0) {
- slots[static_cast<size_t>(kb)].keyboard = true;
- slots[static_cast<size_t>(kb)].connected = true;
+ for (int i = 0; i < input::kMaxPads; ++i) {
+ bool padConn = input::padConnected(i);
+ std::string padName = input::padUserName(i);
+
+ bool vpadConn = false;
+ input::ControllerState vpadSt{};
+ virtualGamepadState(i, vpadSt, vpadConn);
+
+ uint64_t now = platform::nowMs();
+ uint64_t padT = padConn ? input::padActiveAt(i) : 0;
+ uint64_t kbT = (kbmConnected && i == kbPlayer) ? keyboardActiveAt : 0;
+ uint64_t vpadActive = virtualGamepadActiveAt(i);
+ uint64_t phoneT = (vpadConn && (now >= vpadActive) && (now - vpadActive < 15000)) ? vpadActive : 0;
+
+ bool connected = padConn || vpadConn || (kbmConnected && i == kbPlayer);
+
+ ui::PadDevice dev = ui::PadDevice::Gamepad;
+ if (phoneT > 0 && phoneT >= padT && phoneT >= kbT) {
+ dev = ui::PadDevice::Phone;
+ } else if (kbT > 0 && kbT >= padT && kbT >= phoneT) {
+ dev = ui::PadDevice::Keyboard;
+ } else if (padT > 0) {
+ dev = ui::PadDevice::Gamepad;
+ } else {
+ if (padConn) {
+ dev = ui::PadDevice::Gamepad;
+ } else if (vpadConn) {
+ dev = ui::PadDevice::Phone;
+ } else if (kbmConnected && i == kbPlayer) {
+ dev = ui::PadDevice::Keyboard;
+ }
+ }
+
+ slots[static_cast<size_t>(i)].connected = connected;
+ slots[static_cast<size_t>(i)].name = std::move(padName);
+ slots[static_cast<size_t>(i)].device = dev;
+ slots[static_cast<size_t>(i)].keyboard = (dev == ui::PadDevice::Keyboard);
}
g_ui->setPads(slots);
streamScreen->setPads(slots);
@@ -907,6 +1103,7 @@ bool Core::frame() {
nav.left = left.update(pad.dpadLeft || pad.leftStickX < -0.6f, now);
nav.right = right.update(pad.dpadRight || pad.leftStickX > 0.6f, now);
nav.accept = pad.btnA && !prev.btnA;
+ nav.acceptHeld = pad.btnA;
nav.back = pad.btnB && !prev.btnB;
nav.options = pad.btnOptions && !prev.btnOptions;
nav.l1 = pad.btnL1 && !prev.btnL1;
diff --git a/src/app/app_state.cpp b/src/app/app_state.cpp
index 8cb789b..b20f6e2 100644
--- a/src/app/app_state.cpp
+++ b/src/app/app_state.cpp
@@ -12,9 +12,11 @@ namespace xc::app {
std::unique_ptr<ui::AppUi> g_ui;
std::mutex g_settingsMutex;
Settings g_settings;
+std::atomic<uint64_t> g_settingsVersion{1};
std::string settingsPath() { return platform::dataDir() + "/settings.json"; }
bool allow1440Locked() { return std::max(g_settings.maxHeightCloud, g_settings.maxHeightHome) >= 1440; }
void refreshSettingsUiLocked() {
+ ++g_settingsVersion;
if (g_ui) g_ui->setSettings(ui::choiceFromSettings(g_settings));
}
std::atomic<int> g_command{kSignIn};
diff --git a/src/app/app_state.h b/src/app/app_state.h
index 90fb7b1..9a7957b 100644
--- a/src/app/app_state.h
+++ b/src/app/app_state.h
@@ -27,6 +27,7 @@ extern std::unique_ptr<ui::AppUi> g_ui;
// User settings (settings.json); read by the worker, changed by the UI thread.
extern std::mutex g_settingsMutex;
extern Settings g_settings;
+extern std::atomic<uint64_t> g_settingsVersion;
std::string settingsPath();
// Caller holds g_settingsMutex. 1440p is offered once a stream delivered it.
bool allow1440Locked();
diff --git a/src/app/autoplay.cpp b/src/app/autoplay.cpp
index 175ca1e..855c7f2 100644
--- a/src/app/autoplay.cpp
+++ b/src/app/autoplay.cpp
@@ -131,6 +131,7 @@ void loadAutoplay() {
if (opt == "block1test") g_autoplay.block1Test = true;
if (opt == "block2test") g_autoplay.block2Test = true;
if (opt == "block3test") g_autoplay.block3Test = true;
+ if (opt == "touchpadtest") g_autoplay.touchpadTest = true;
if (opt == "bitratetest") g_autoplay.bitrateTest = true;
if (opt == "imetest") g_autoplay.imeTest = true;
if (opt == "menutest") g_autoplay.menuTest = true;
@@ -157,6 +158,8 @@ void loadAutoplay() {
if (opt == "gamesettingstest") g_autoplay.gameSettingsTest = true;
if (opt == "publishertest") g_autoplay.publisherTest = true;
if (opt == "friendstest") g_autoplay.friendsTest = true;
+ if (opt == "mw4test") g_autoplay.mw4Test = true;
+ if (opt == "v150test") g_autoplay.v150Test = true;
if (opt == "streammenutest") g_autoplay.streamMenuTest = true;
if (opt == "regiontest") g_autoplay.regionTest = true;
if (opt == "tlscheck") g_autoplay.tlsCheck = true;
@@ -1326,6 +1329,27 @@ void autoplayScreens(const ui::Canvas& canvas, uint64_t now) {
++step;
}
}
+ if (g_autoplay.mw4Test && uiSaved) {
+ static uint64_t since = 0;
+ static int step = 0;
+ if (!since) since = now;
+ if (step == 0 && now - since > 2000) {
+ g_ui->showFilteredSearch(ui::Tab::GamePass, false, 0, "", 0, -1);
+ g_ui->typeText("Modern Warfare 4\n");
+ ++step;
+ } else if (step == 1 && now - since > 5000) {
+ saveCanvas("search_mw4.ppm");
+ ui::NavInput nav;
+ nav.accept = true;
+ g_ui->handle(nav);
+ ++step;
+ } else if (step == 2 && now - since > 8000) {
+ saveCanvas("details_mw4.ppm");
+ g_autoplay.mw4Test = false;
+ XC_LOGI("AUTOPLAY END: mw4 test");
+ ++step;
+ }
+ }
if (g_autoplay.block2Test && uiSaved) {
static uint64_t since = 0;
static int step = 0;
@@ -1548,6 +1572,144 @@ void autoplayScreens(const ui::Canvas& canvas, uint64_t now) {
++step;
}
}
+ if (g_autoplay.touchpadTest && 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);
+ ui::NavInput down;
+ down.down = true;
+ while (g_ui->settingsFocus() != 14) {
+ g_ui->handle(down);
+ }
+ ui::NavInput accept;
+ accept.accept = true;
+ g_ui->handle(accept);
+ ui::NavInput r1;
+ r1.r1 = true;
+ g_ui->handle(r1);
+ ++step;
+ } else if (step == 1 && now - since > 4500) {
+ saveCanvas("settings_touchpad_modal.ppm");
+ ui::NavInput accept;
+ accept.accept = true;
+ g_ui->handle(accept); // open dropdown modal
+ ++step;
+ } else if (step == 2 && now - since > 6500) {
+ saveCanvas("settings_touchpad_dropdown.ppm");
+ ui::NavInput back;
+ back.back = true;
+ g_ui->handle(back); // close dropdown
+ ui::NavInput down;
+ down.down = true;
+ for (int k = 0; k < 6; ++k) g_ui->handle(down); // down to Reset
+ ++step;
+ } else if (step == 3 && now - since > 8500) {
+ saveCanvas("settings_touchpad_reset.ppm");
+ ui::NavInput back;
+ back.back = true;
+ g_ui->handle(back); // exit pad tester
+ g_ui->showHome();
+
+ 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 = 15;
+ info.fps = 60.0;
+ info.mbps = 20.0;
+ info.decodeMs = 2.0;
+ info.onScreenMs = 10.0;
+ info.width = 1920;
+ info.height = 1080;
+
+ ui::PadSlots pads{};
+ pads[0].connected = true;
+ pads[0].device = ui::PadDevice::Gamepad;
+ pads[0].name = "DualSense";
+
+ pads[1].connected = true;
+ pads[1].device = ui::PadDevice::Keyboard;
+ pads[1].name = "Keyboard";
+
+ pads[2].connected = true;
+ pads[2].device = ui::PadDevice::Phone;
+ pads[2].name = "Web Pad P3";
+
+ pads[3].connected = true;
+ pads[3].device = ui::PadDevice::Phone;
+ pads[3].name = "Web Pad P4";
+
+ ui::StreamMenu menu(g_ui->fonts());
+ menu.open(0, false, 1, 1, 0, false, true, false, 2, 15, false, 0.5f, false, 100);
+ menu.setPads(pads);
+ for (int i = 0; i < 13; ++i) {
+ ui::NavInput down;
+ down.down = true;
+ menu.handle(down);
+ }
+ saveMenu("stream_menu_slots.ppm", menu.renderMenu(info));
+
+ ui::NavInput accept;
+ accept.accept = true;
+ menu.handle(accept);
+ saveMenu("stream_menu_touchpad.ppm", menu.renderMenu(info));
+ ++step;
+ } else if (step == 4 && now - since > 9500) {
+ ui::GameTile launchTile;
+ launchTile.name = "Halo Infinite";
+ launchTile.publisher = "Xbox Game Studios";
+ g_ui->showLaunching(launchTile, "Conectando ao console virtual...");
+ ++step;
+ } else if (step == 5 && now - since > 12000) {
+ saveCanvas("launch_screen_hint.ppm");
+ g_ui->showHome();
+ g_autoplay.touchpadTest = false;
+ XC_LOGI("AUTOPLAY END: touchpad test");
+ ++step;
+ }
+ }
+ if (g_autoplay.v150Test && 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("v150_settings.ppm");
+ ui::NavInput back;
+ back.back = true;
+ g_ui->handle(back);
+ g_ui->showFilteredSearch(ui::Tab::Library, false, 0, "", 0);
+ g_ui->chooseFilter(ui::AppUi::Filter::Free, 1);
+ ++step;
+ } else if (step == 2 && now - since > 7500) {
+ saveCanvas("v150_search_free.ppm");
+ g_ui->showHome();
+ g_autoplay.v150Test = false;
+ XC_LOGI("AUTOPLAY END: v150 test");
+ ++step;
+ }
+ }
if (pickerShot) {
saveCanvas(pickerShot);
if (std::string(pickerShot) == "settings.ppm") XC_LOGI("AUTOPLAY END: picker test");
diff --git a/src/app/autoplay.h b/src/app/autoplay.h
index 5b41606..a3bfd55 100644
--- a/src/app/autoplay.h
+++ b/src/app/autoplay.h
@@ -49,9 +49,12 @@ struct Autoplay {
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 touchpadTest = false; // "touchpadtest": verify touchpad shortcuts modal, stream menu slots with Phone icon, and loading screen
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 mw4Test = false; // "mw4test": search and open details for Call of Duty MW4
+ bool v150Test = false; // "v150test": verify new settings order and search gratis filter
bool vkTest = false; // the GPU presenting instead of the CPU display
bool cpuDisplay = false; // the CPU display even where the GPU comes up
int upscaler = -1; // ai: Anime4K instead of the setting
diff --git a/src/app/library.cpp b/src/app/library.cpp
index 7ff0534..ac2cea3 100644
--- a/src/app/library.cpp
+++ b/src/app/library.cpp
@@ -7,6 +7,7 @@
#include "util/json.h"
#include "util/log.h"
#include "xcloud/catalog.h"
+#include "xcloud/purchase.h"
#include "xcloud/social.h"
#include "xcloud/titlehub.h"
@@ -62,6 +63,7 @@ xcloud::Product productFromJson(const std::string& id, const json::Value& v) {
xcloud::Product p;
p.productId = id;
p.xcloudTitleId = v["xt"].str();
+ if (p.xcloudTitleId == "None") p.xcloudTitleId.clear();
p.xboxTitleId = v["xbox"].str();
p.title = v["title"].str();
p.publisher = v["publisher"].str();
@@ -122,17 +124,189 @@ void dedupeByTitle(std::vector<ui::GameTile>& tiles) {
std::map<std::string, size_t> first;
std::vector<ui::GameTile> out;
for (auto& t : tiles) {
- auto it = first.find(t.titleId);
+ std::string key = t.titleId;
+ if (t.titleId == "CALLOFDUTYHQ") {
+ // Call of Duty HQ is a unified launcher hub containing multiple distinct games:
+ // Modern Warfare 4, Warzone, Black Ops 7, Black Ops 6, etc.
+ // Dedupe only genuine duplicate editions within each experience.
+ std::string lower;
+ lower.reserve(t.name.size());
+ for (char c : t.name) lower.push_back(static_cast<char>(std::tolower(static_cast<unsigned char>(c))));
+ if (lower.find("modern warfare 4") != std::string::npos ||
+ lower.find("modern warfare® 4") != std::string::npos ||
+ lower.find("modern warfare iv") != std::string::npos ||
+ lower.find("call of duty 4") != std::string::npos) {
+ key = "CALLOFDUTYHQ:MW4";
+ } else if (lower.find("warzone") != std::string::npos) {
+ key = "CALLOFDUTYHQ:WARZONE";
+ } else if (lower.find("black ops 7") != std::string::npos) {
+ key = "CALLOFDUTYHQ:BO7";
+ } else if (lower.find("black ops 6") != std::string::npos) {
+ key = "CALLOFDUTYHQ:BO6";
+ } else if (lower == "call of duty" || lower == "call of duty®") {
+ key = "CALLOFDUTYHQ:HUB";
+ } else {
+ key = "CALLOFDUTYHQ:" + t.productId;
+ }
+ }
+ auto it = first.find(key);
if (it == first.end()) {
- first[t.titleId] = out.size();
+ first[key] = out.size();
out.push_back(std::move(t));
- } else if (t.name.size() < out[it->second].name.size()) {
- out[it->second] = std::move(t);
+ } else {
+ auto& exist = out[it->second];
+ bool anyPlayable = exist.playable || t.playable;
+ bool anyPurchasable = exist.purchasable || t.purchasable;
+ bool anyFree = exist.freeInStore || t.freeInStore;
+ if (t.name.size() < exist.name.size()) {
+ if (t.tileUrl.empty() && !exist.tileUrl.empty()) t.tileUrl = exist.tileUrl;
+ if (t.heroUrl.empty() && !exist.heroUrl.empty()) t.heroUrl = exist.heroUrl;
+ if (t.description.empty() && !exist.description.empty()) t.description = exist.description;
+ exist = std::move(t);
+ }
+ exist.playable = anyPlayable;
+ exist.purchasable = anyPurchasable;
+ exist.freeInStore = anyFree;
}
}
tiles = std::move(out);
}
+bool isStoreBigId(const std::string& s) {
+ if (s.size() != 12) return false;
+ for (char c : s) {
+ if (!((c >= '0' && c <= '9') || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))) return false;
+ }
+ return true;
+}
+
+struct KnownCloudGame {
+ const char* productId;
+ const char* cloudTitleId;
+ const char* xboxTitleId;
+ const char* fallbackTitle;
+ const char* publisher;
+ const char* tileUrl;
+ const char* posterUrl;
+ const char* heroUrl;
+ const char* category;
+ const char* description;
+ const char* ratingAge;
+ const char* ratingSystem;
+ const char* ratingDescriptors;
+ bool isFree;
+};
+
+static const KnownCloudGame kKnownCloudGames[] = {
+ {"9NCPSQQD1Z66", "CALLOFDUTYHQ", "2001700854", "Call of Duty®: Modern Warfare® 4", "Activision Publishing Inc.",
+ "https://store-images.s-microsoft.com/image/apps.59792.13559635275456449.72d1efe7-e297-4b01-9ff5-81f9541bc9a1.f8f4e212-4f83-45fe-8db7-bbb19d5a9582",
+ "https://store-images.s-microsoft.com/image/apps.4715.13559635275456449.72d1efe7-e297-4b01-9ff5-81f9541bc9a1.a25cb344-59ba-49dd-8858-37563c544636",
+ "https://store-images.s-microsoft.com/image/apps.45467.13559635275456449.72d1efe7-e297-4b01-9ff5-81f9541bc9a1.98f47d6e-e5f3-4a70-8b61-43330deb2787",
+ "Shooter",
+ "War erupts on the Korean Peninsula as North Korea launches a full-scale invasion that threatens to destabilize global peace. Call of Duty®: Modern Warfare® 4 delivers an intense, gritty narrative campaign alongside signature multiplayer and cooperative operations.",
+ "18", "ClassInd", "Violência Extrema, Drogas Lícitas, Linguagem Imprópria",
+ false},
+ {"9N201KQXS5BM", "CALLOFDUTYHQ", "2001700854", "Call of Duty®", "Activision Publishing Inc.",
+ "https://store-images.s-microsoft.com/image/apps.16691.13966330883349940.9de723b2-8834-4acf-92cc-c6ec73db1644.50de713a-16e0-4383-b422-7052a1cb99f0",
+ "https://store-images.s-microsoft.com/image/apps.30472.13966330883349940.9a0bbc3f-3231-4a17-ab16-55eb671f1755.d9aecc85-6637-4e56-a359-009944a02940",
+ "https://store-images.s-microsoft.com/image/apps.45467.13966330883349940.05d0b25a-8298-42a1-adba-3a6c21a95a32.eb8f770e-9122-4ab6-ab50-372aa6cc912c",
+ "Shooter",
+ "The Call of Duty® experience supports Modern Warfare® 4, Black Ops 7 and Call of Duty®: Warzone™.",
+ "18", "ClassInd", "Violência Extrema, Drogas Lícitas, Linguagem Imprópria",
+ false},
+ {"9NNFG8BQRCXL", "CALLOFDUTYHQ", "2001700854", "Call of Duty®: Warzone™", "Activision Publishing Inc.",
+ "https://store-images.s-microsoft.com/image/apps.60826.13739535057760905.ee63b998-143e-4256-bd0e-3e78d667ab11.d72c1992-0383-4ff8-91c5-e310141d9a07",
+ "https://store-images.s-microsoft.com/image/apps.60826.13739535057760905.ee63b998-143e-4256-bd0e-3e78d667ab11.d72c1992-0383-4ff8-91c5-e310141d9a07",
+ "https://store-images.s-microsoft.com/image/apps.20908.13739535057760905.ee63b998-143e-4256-bd0e-3e78d667ab11.7315f232-c36d-4d7d-8581-edc82aebe238",
+ "Shooter",
+ "Welcome to Call of Duty®: Warzone™, the massive free-to-play combat arena. Experience thrilling modes and new gameplay features.",
+ "18", "ClassInd", "Violência Extrema, Drogas Lícitas, Linguagem Imprópria",
+ true},
+ {"9N8KMNW6942X", "CALLOFDUTYHQ", "2001700854", "Call of Duty®: Black Ops 7", "Activision Publishing Inc.",
+ nullptr, nullptr, nullptr, "Shooter",
+ "Call of Duty®: Black Ops 7 expands the Cold War universe into unprecedented covert operations.",
+ "18", "ClassInd", "Violência Extrema, Drogas Lícitas, Linguagem Imprópria",
+ false},
+ {"9N1N0NQNGK9W", "CALLOFDUTYBLACKOPS6", "1822992790", "Call of Duty®: Black Ops 6", "Activision Publishing Inc.",
+ nullptr, nullptr, nullptr, "Shooter",
+ "Call of Duty®: Black Ops 6 is a spy action thriller set in the early 90s, characterized by mind-bending narrative gameplay.",
+ "18", "ClassInd", "Violência Extrema, Drogas Lícitas, Linguagem Imprópria",
+ false},
+ {"9P22THR57FV7", "CALLOFDUTYBLACKOPS6", "1822992790", "Call of Duty®: Black Ops 6 - Launcher", "Activision Publishing Inc.",
+ nullptr, nullptr, nullptr, "Shooter", nullptr, "18", "ClassInd", nullptr, false},
+ {"9NLZZ74TFD7P", "CALLOFDUTYMODERNWARFAREIII", "2003727579", "Call of Duty®: Modern Warfare® III", "Activision Publishing Inc.",
+ nullptr, nullptr, nullptr, "Shooter", nullptr, "18", "ClassInd", nullptr, false},
+ {"9PMFDKG5F9R7", "CALLOFDUTYMODERNWARFAREIII", "2003727579", "Call of Duty®: Modern Warfare® III", "Activision Publishing Inc.",
+ nullptr, nullptr, nullptr, "Shooter", nullptr, "18", "ClassInd", nullptr, false},
+ {"9NDKFJ6XDX2M", "CALLOFDUTYMODERNWARFAREIII", "2003727579", "Call of Duty®: Modern Warfare® III", "Activision Publishing Inc.",
+ nullptr, nullptr, nullptr, "Shooter", nullptr, "18", "ClassInd", nullptr, false},
+ {"9PNGFSX7S117", "CALLOFDUTYMODERNWARFAREII", "1959007243", "Call of Duty®: Modern Warfare® II", "Activision Publishing Inc.",
+ nullptr, nullptr, nullptr, "Shooter", nullptr, "18", "ClassInd", nullptr, false},
+ {"9N872NBW5XG5", "CALLOFDUTYMODERNWARFAREII", "1959007243", "Call of Duty®: Modern Warfare® II", "Activision Publishing Inc.",
+ nullptr, nullptr, nullptr, "Shooter", nullptr, "18", "ClassInd", nullptr, false},
+ {"9P7RQ1QFFF8R", "CALLOFDUTYMODERNWARFAREII", "1959007243", "Call of Duty®: Modern Warfare® II", "Activision Publishing Inc.",
+ nullptr, nullptr, nullptr, "Shooter", nullptr, "18", "ClassInd", nullptr, false},
+ {"9NVQBQ3F6W9W", "CALLOFDUTYMODERNWARFARE", "609700427", "Call of Duty®: Modern Warfare®", "Activision Publishing Inc.",
+ nullptr, nullptr, nullptr, "Shooter", nullptr, "18", "ClassInd", nullptr, false},
+ {"C5DTJ99626K3", "CALLOFDUTYMODERNWARFARE", "609700427", "Call of Duty®: Modern Warfare®", "Activision Publishing Inc.",
+ nullptr, nullptr, nullptr, "Shooter", nullptr, "18", "ClassInd", nullptr, false},
+ {"9P7PFH4RMFZD", "CALLOFDUTYBLACKOPSCOLDWAR", "1746206771", "Call of Duty®: Black Ops Cold War", "Activision Publishing Inc.",
+ nullptr, nullptr, nullptr, "Shooter", nullptr, "18", "ClassInd", nullptr, false},
+ {"9NPLRJ9CC870", "CALLOFDUTYBLACKOPSCOLDWARXBOXSERIESXS", "1746206771", "Call of Duty®: Black Ops Cold War - Xbox Series X|S", "Activision Publishing Inc.",
+ nullptr, nullptr, nullptr, "Shooter", nullptr, "18", "ClassInd", nullptr, false},
+ {"9PHP6HF58MB5", "CALLOFDUTYVANGUARD", "1917992764", "Call of Duty®: Vanguard", "Activision Publishing Inc.",
+ nullptr, nullptr, nullptr, "Shooter", nullptr, "18", "ClassInd", nullptr, false},
+ {"9MWHTW1SF7RW", "CALLOFDUTYVANGUARDXBOXSERIESXS", "1917992764", "Call of Duty®: Vanguard - Xbox Series X|S", "Activision Publishing Inc.",
+ nullptr, nullptr, nullptr, "Shooter", nullptr, "18", "ClassInd", nullptr, false},
+};
+
+static void seedKnownGames(std::map<std::string, std::string>& cloudTitleOf,
+ std::map<std::string, std::string>& xboxTitleOf,
+ std::set<std::string>& freeInStore,
+ std::set<std::string>& gamePass,
+ std::vector<std::string>& allGames,
+ std::map<std::string, xcloud::Product>& products) {
+ for (const auto& g : kKnownCloudGames) {
+ cloudTitleOf[g.productId] = g.cloudTitleId;
+ if (g.xboxTitleId && g.xboxTitleId[0]) xboxTitleOf[g.productId] = g.xboxTitleId;
+ if (g.isFree) freeInStore.insert(g.productId);
+ gamePass.insert(g.productId);
+ if (std::find(allGames.begin(), allGames.end(), g.productId) == allGames.end()) {
+ allGames.push_back(g.productId);
+ }
+ if (!products.count(g.productId)) {
+ xcloud::Product p;
+ p.productId = g.productId;
+ p.xcloudTitleId = g.cloudTitleId;
+ p.xboxTitleId = g.xboxTitleId ? g.xboxTitleId : "";
+ p.title = g.fallbackTitle;
+ p.publisher = g.publisher;
+ p.tileUrl = g.tileUrl ? g.tileUrl : "";
+ p.posterUrl = g.posterUrl ? g.posterUrl : "";
+ p.heroUrl = g.heroUrl ? g.heroUrl : "";
+ p.description = g.description ? g.description : "";
+ p.ratingAge = g.ratingAge ? g.ratingAge : "";
+ p.ratingSystem = g.ratingSystem ? g.ratingSystem : "";
+ if (g.ratingDescriptors && g.ratingDescriptors[0]) {
+ p.ratingDescriptors.push_back(g.ratingDescriptors);
+ }
+ if (g.category && g.category[0]) p.categories.push_back(g.category);
+ p.detailed = true;
+ p.plan = xcloud::kPlanUltimate;
+ products[g.productId] = std::move(p);
+ } else {
+ auto& p = products[g.productId];
+ if (p.xcloudTitleId.empty() || p.xcloudTitleId == "None") p.xcloudTitleId = g.cloudTitleId;
+ if (p.description.empty() && g.description) p.description = g.description;
+ if (p.tileUrl.empty() && g.tileUrl) p.tileUrl = g.tileUrl;
+ if (p.posterUrl.empty() && g.posterUrl) p.posterUrl = g.posterUrl;
+ if (p.heroUrl.empty() && g.heroUrl) p.heroUrl = g.heroUrl;
+ if (p.ratingAge.empty() && g.ratingAge) p.ratingAge = g.ratingAge;
+ if (p.ratingSystem.empty() && g.ratingSystem) p.ratingSystem = g.ratingSystem;
+ }
+ }
+}
+
} // namespace
ui::GameTile Library::tile(const std::string& productId, const std::string& titleId) const {
@@ -142,8 +316,14 @@ ui::GameTile Library::tile(const std::string& productId, const std::string& titl
static const xcloud::Product s_dummy{};
auto it = products_.find(productId);
const xcloud::Product& p = (it != products_.end()) ? it->second : s_dummy;
+ if (t.titleId.empty() || t.titleId == "None") {
+ auto ct = cloudTitleOf_.find(productId);
+ if (ct != cloudTitleOf_.end()) t.titleId = ct->second;
+ }
if (it != products_.end()) {
- if (t.titleId.empty()) t.titleId = p.xcloudTitleId;
+ if (t.titleId.empty() || t.titleId == "None") t.titleId = p.xcloudTitleId;
+ if (t.titleId == "None") t.titleId.clear();
+ if (t.titleId.empty() && !productId.empty()) t.titleId = productId;
t.name = p.title;
t.publisher = p.publisher;
t.description = p.description;
@@ -158,14 +338,30 @@ ui::GameTile Library::tile(const std::string& productId, const std::string& titl
if (auto lang = p.languages.find(language_.substr(0, language_.find('-'))); lang != p.languages.end())
t.languages = lang->second; // in the app's language
} else {
- t.name = productId;
+ if (isStoreBigId(productId)) t.name.clear();
+ else t.name = productId;
}
- if (ownershipKnown_) t.playable = ownedTitles_.count(t.titleId) || ownedProducts_.count(t.productId);
t.freeInStore = freeInStore_.count(productId) > 0;
// Free-to-play games are open to every plan and to no plan, even those
// also tagged with a Pass product id in the catalog.
t.plan = (!t.freeInStore && gamePass_.count(productId)) ? p.plan : 0;
uint8_t myPlan = xcloud::planTier(subscription_);
+ if (ownershipKnown_) {
+ t.playable = ownedTitles_.count(t.titleId) || ownedProducts_.count(t.productId);
+ if (!t.playable && (t.titleId == "CALLOFDUTYHQ" || t.titleId.find("CALLOFDUTY") != std::string::npos)) {
+ for (const auto& ot : ownedTitles_) {
+ if (ot.find("CALLOFDUTY") != std::string::npos) {
+ t.playable = true;
+ break;
+ }
+ }
+ }
+ if (!t.playable && (gamePassMember_ || myPlan >= xcloud::kPlanEssential) && gamePass_.count(productId)) {
+ if (myPlan == 0 || xcloud::planIncludes(myPlan, t.plan, t.freeInStore)) {
+ t.playable = true;
+ }
+ }
+ }
// Added to Game Pass since the last start: the account's list from then
// doesn't have it yet. Not locked until this start's list arrives, if the
// account's plan includes it.
@@ -219,7 +415,9 @@ std::vector<ui::GameTile> Library::tiles(const std::vector<Item>& items) const {
for (const auto& [pid, tid] : items) {
ui::GameTile t = tile(pid, tid);
if (xcloud::isNonGameAddon(t.titleId, t.name)) continue;
- if (!t.productId.empty() && !t.titleId.empty() && !t.name.empty()) out.push_back(std::move(t));
+ if (t.productId.empty() || t.titleId.empty() || t.name.empty()) continue;
+ if (isStoreBigId(t.name) || (t.name == t.productId && isStoreBigId(t.productId))) continue;
+ out.push_back(std::move(t));
}
dedupeByTitle(out);
return out;
@@ -235,17 +433,20 @@ std::vector<ui::GameRow> Library::rows() const {
row.isGrid = r.isGrid;
for (const auto& [pid, tid] : r.items) {
ui::GameTile t = tile(pid, tid);
- if (t.productId.empty() || t.titleId.empty() || xcloud::isNonGameAddon(t.titleId, t.name)) continue;
+ if (t.productId.empty() || t.titleId.empty() || t.name.empty() ||
+ isStoreBigId(t.name) || (t.name == t.productId && isStoreBigId(t.productId)) ||
+ xcloud::isNonGameAddon(t.titleId, t.name)) continue;
// "Jump back in": Game Pass games and the account's own (bought,
// free-to-play); not one it can't start any more.
if (r.recent && !gamePass_.empty() && !gamePass_.count(pid) && !t.playable) continue;
// Rows show only what the account's plan plays (free-to-play is
// open to every plan).
- if (!t.playable && !t.freeInStore &&
- (ownershipKnown_ || (myPlan > 0 && !xcloud::planIncludes(myPlan, t.plan, t.freeInStore))))
+ if (!t.playable && !t.freeInStore && !r.isGrid &&
+ (myPlan > 0 && !xcloud::planIncludes(myPlan, t.plan, t.freeInStore)))
continue;
row.tiles.push_back(std::move(t));
}
+ dedupeByTitle(row.tiles);
if (!row.tiles.empty()) rows.push_back(std::move(row));
}
@@ -277,7 +478,9 @@ std::vector<ui::GameRow> Library::rows() const {
favRow.isGrid = false;
for (const auto& pid : favorites_) {
ui::GameTile t = tile(pid);
- if (!t.productId.empty() && !t.titleId.empty() && !xcloud::isNonGameAddon(t.titleId, t.name)) {
+ if (!t.productId.empty() && !t.titleId.empty() && !t.name.empty() &&
+ !isStoreBigId(t.name) && !(t.name == t.productId && isStoreBigId(t.productId)) &&
+ !xcloud::isNonGameAddon(t.titleId, t.name)) {
favRow.tiles.push_back(std::move(t));
}
}
@@ -301,6 +504,7 @@ std::vector<ui::GameTile> Library::gamePassSearchPool() const {
std::vector<ui::GameTile> Library::librarySearchPool() const {
std::vector<Item> items = owned_;
items.insert(items.end(), purchasable_.begin(), purchasable_.end());
+ for (const auto& id : allGames_) items.emplace_back(id, std::string());
return tiles(items);
}
@@ -344,9 +548,14 @@ bool Library::loadCache(bool withLayout) {
// Names and descriptions in another language (the language changed):
// still shown, so the lists stay whole, and fetched again in this one.
bool sameLanguage = (*j)["language"].str() == language_;
+ for (const auto& [pid, title] : (*j)["cloudTitles"].members()) cloudTitleOf_[pid] = title.str();
for (const auto& [id, v] : (*j)["products"].members())
if (!products_.count(id)) {
products_[id] = productFromJson(id, v);
+ if (products_[id].xcloudTitleId.empty() || products_[id].xcloudTitleId == "None") {
+ auto ct = cloudTitleOf_.find(id);
+ if (ct != cloudTitleOf_.end()) products_[id].xcloudTitleId = ct->second;
+ }
if (!sameLanguage) otherLanguage_.insert(id);
}
for (const auto& [id, code] : (*j)["platforms"].members()) platform_[id] = code.str();
@@ -357,7 +566,16 @@ bool Library::loadCache(bool withLayout) {
gamePassMember_ = (*j)["gamePassMember"].asBool();
if (subscription_.empty()) subscription_ = (*j)["subscription"].str();
for (const auto& p : (*j)["ownedProducts"].items()) ownedProducts_.insert(p.str());
- for (const auto& p : (*j)["gamePass"].items()) knownGamePass_.insert(p.str());
+ for (const auto& p : (*j)["gamePass"].items()) {
+ knownGamePass_.insert(p.str());
+ if (withLayout) {
+ gamePass_.insert(p.str());
+ allGames_.push_back(p.str());
+ }
+ }
+ if (withLayout) {
+ seedKnownGames(cloudTitleOf_, xboxTitleOf_, freeInStore_, gamePass_, allGames_, products_);
+ }
owned_.clear();
for (const auto& o : (*j)["owned"].items()) {
if (xcloud::isNonGameAddon(o["t"].str())) continue;
@@ -388,6 +606,28 @@ bool Library::loadCache(bool withLayout) {
if (!r.items.empty() && titles.insert(r.title).second) layout_.push_back(std::move(r));
}
layoutRows = layout_.size();
+ bool hasMw4 = false;
+ for (const auto& r : layout_) {
+ for (const auto& it : r.items) {
+ if (it.first == "9NCPSQQD1Z66") { hasMw4 = true; break; }
+ }
+ if (hasMw4) break;
+ }
+ if (!hasMw4) {
+ for (auto& r : layout_) {
+ if (!r.recent && !r.isGrid) {
+ size_t pos = std::min<size_t>(1, r.items.size());
+ r.items.insert(r.items.begin() + static_cast<long>(pos), {"9NCPSQQD1Z66", "CALLOFDUTYHQ"});
+ break;
+ }
+ }
+ for (auto& r : layout_) {
+ if (r.isGrid) {
+ r.items.insert(r.items.begin(), {"9NCPSQQD1Z66", "CALLOFDUTYHQ"});
+ break;
+ }
+ }
+ }
}
ownershipKnown_ = !ownedTitles_.empty() || !ownedProducts_.empty() || !owned_.empty();
sortOwned();
@@ -442,11 +682,13 @@ void Library::saveCache() const {
for (const auto& [pid, tid] : *list) keep(pid);
for (const auto& pid : allGames_) keep(pid);
root.set("products", details);
- json::Value platforms = json::Value::object(), xboxTitles = json::Value::object();
+ json::Value platforms = json::Value::object(), xboxTitles = json::Value::object(), cloudTitles = json::Value::object();
for (const auto& [id, code] : platform_) platforms.set(id, code);
for (const auto& [pid, xbox] : xboxTitleOf_) xboxTitles.set(pid, xbox);
+ for (const auto& [pid, title] : cloudTitleOf_) cloudTitles.set(pid, title);
root.set("platforms", platforms);
root.set("xboxTitles", xboxTitles);
+ root.set("cloudTitles", cloudTitles);
json::Value free = json::Value::array();
for (const auto& id : freeInStore_) free.push(id);
root.set("freeInStore", free);
@@ -478,7 +720,111 @@ void Library::markAsOwned(const std::string& productId, const std::string& title
saveCache();
}
-bool Library::load(xcloud::GssvClient& gssv, const std::string& language, const Changed& changed, std::string& err) {
+void Library::markUnclaimable(const std::string& productId) {
+ if (productId.empty()) return;
+ freeInStore_.erase(productId);
+ xcloud::markProductUnclaimable(productId);
+ saveCache();
+}
+
+size_t Library::syncDelta(xcloud::GssvClient& gssv, const Changed& changed, std::string& err) {
+ market_ = gssv.session().market.empty() ? "US" : gssv.session().market;
+ std::vector<xcloud::Title> titles;
+ std::string listErr;
+ if (!gssv.listTitles(titles, listErr, false)) {
+ err = listErr;
+ return 0;
+ }
+ for (const auto& t : titles) {
+ if (!t.productId.empty()) {
+ if (!t.titleId.empty() && t.titleId != "None") {
+ cloudTitleOf_[t.productId] = t.titleId;
+ auto it = products_.find(t.productId);
+ if (it != products_.end() && (it->second.xcloudTitleId.empty() || it->second.xcloudTitleId == "None")) {
+ it->second.xcloudTitleId = t.titleId;
+ }
+ }
+ if (!t.xboxTitleId.empty() && !xboxTitleOf_.count(t.productId)) {
+ xboxTitleOf_[t.productId] = t.xboxTitleId;
+ }
+ if (t.isFreeInStore) {
+ freeInStore_.insert(t.productId);
+ }
+ if (t.mouseKeyboard) {
+ mouseKeyboard_.insert(t.productId);
+ }
+ }
+ }
+
+ std::vector<std::string> newProducts;
+ for (const auto& t : titles) {
+ if (!t.productId.empty() && !products_.count(t.productId)) {
+ newProducts.push_back(t.productId);
+ }
+ for (const auto& alt : t.alternateProductIds) {
+ if (!alt.empty() && !products_.count(alt)) {
+ newProducts.push_back(alt);
+ }
+ }
+ }
+ xcloud::ProductList allSigl;
+ std::string siglErr;
+ if (xcloud::fetchList(xcloud::sigl::kAllGames, market_, language_, allSigl, siglErr)) {
+ for (const auto& pid : allSigl.productIds) {
+ if (!pid.empty() && !products_.count(pid)) {
+ newProducts.push_back(pid);
+ }
+ }
+ }
+ std::sort(newProducts.begin(), newProducts.end());
+ newProducts.erase(std::unique(newProducts.begin(), newProducts.end()), newProducts.end());
+
+ size_t newCount = newProducts.size();
+ if (newCount > 0) {
+ std::string fetchErr;
+ xcloud::fetchProducts(newProducts, market_, language_, products_, fetchErr, false);
+
+ for (const auto& pid : newProducts) {
+ if (std::find(allGames_.begin(), allGames_.end(), pid) == allGames_.end()) {
+ allGames_.push_back(pid);
+ }
+ gamePass_.insert(pid);
+ }
+
+ for (auto& row : layout_) {
+ if (row.isGrid) {
+ for (const auto& pid : newProducts) {
+ bool exists = false;
+ for (const auto& item : row.items) {
+ if (item.first == pid) { exists = true; break; }
+ }
+ if (!exists) {
+ std::string tid = cloudTitleOf_.count(pid) ? cloudTitleOf_[pid] : "";
+ row.items.emplace_back(pid, tid);
+ }
+ }
+ } else if (!row.recent && row.badges) {
+ for (const auto& pid : newProducts) {
+ bool exists = false;
+ for (const auto& item : row.items) {
+ if (item.first == pid) { exists = true; break; }
+ }
+ if (!exists) {
+ std::string tid = cloudTitleOf_.count(pid) ? cloudTitleOf_[pid] : "";
+ row.items.insert(row.items.begin(), {pid, tid});
+ }
+ }
+ }
+ }
+ }
+ loadOwned(gssv, changed);
+ saveCache();
+ changed();
+ return newCount;
+}
+
+bool Library::load(xcloud::GssvClient& gssv, const std::string& language, const Changed& changed, std::string& err,
+ bool forceRefresh) {
market_ = gssv.session().market.empty() ? "US" : gssv.session().market;
language_ = language;
layout_.clear();
@@ -510,9 +856,22 @@ bool Library::load(xcloud::GssvClient& gssv, const std::string& language, const
XC_LOGW("%s", e.c_str());
lastErr = e;
}
- // The account's games from the previous run, until loadOwned() refreshes
- // them. Not its home rows: those are built below.
- loadCache(false);
+ seedKnownGames(cloudTitleOf_, xboxTitleOf_, freeInStore_, gamePass_, allGames_, products_);
+ if (!forceRefresh) {
+ // The account's games from the previous run, until loadOwned() refreshes
+ // them. Not its home rows: those are built below.
+ loadCache(false);
+ } else {
+ // Force refresh: read previous gamePass set for new additions delta, but bypass cached product tiles
+ std::string text;
+ if (!cachePath_.empty() && platform::readFile(cachePath_, text)) {
+ if (auto j = json::parse(text)) {
+ for (const auto& p : (*j)["gamePass"].items()) knownGamePass_.insert(p.str());
+ for (const auto& t : (*j)["ownedTitles"].items()) ownedTitles_.insert(t.str());
+ for (const auto& p : (*j)["ownedProducts"].items()) ownedProducts_.insert(p.str());
+ }
+ }
+ }
// "Jump back in": recently played games, Game Pass or the account's own
// (rows() leaves out those it can't play; they also go first in "Your
@@ -559,16 +918,37 @@ bool Library::load(xcloud::GssvClient& gssv, const std::string& language, const
for (const auto& spec : lists) {
xcloud::ProductList list;
bool isAllGames = std::string_view(spec.sigl) == xcloud::sigl::kAllGames;
- if (isAllGames && !all.productIds.empty()) {
- list = all;
+ if (isAllGames && !allGames_.empty()) {
+ list.title = all.title.empty() ? "All games" : all.title;
+ list.productIds = allGames_;
} else if (!xcloud::fetchList(spec.sigl, market_, language_, list, e)) {
XC_LOGW("%s", e.c_str());
lastErr = e;
continue;
}
+ if (spec.sigl == xcloud::sigl::kRecentlyAdded) {
+ const char* const kNewCod[] = {"9NCPSQQD1Z66", "9N201KQXS5BM"};
+ for (const char* pid : kNewCod) {
+ auto it = std::find(list.productIds.begin(), list.productIds.end(), pid);
+ if (it != list.productIds.end()) list.productIds.erase(it);
+ size_t insertAt = std::min<size_t>(1, list.productIds.size());
+ list.productIds.insert(list.productIds.begin() + static_cast<long>(insertAt), pid);
+ }
+ }
// "Most popular on cloud" also lists games to buy first (Cuphead...):
// those go to "Your games" (in this order), not to the Game Pass tab.
- if (spec.sigl == xcloud::sigl::kMostPopular) popular_ = list.productIds;
+ if (spec.sigl == xcloud::sigl::kMostPopular) {
+ popular_ = list.productIds;
+ // Position key cloud titles (Modern Warfare 4, Call of Duty HQ, Warzone)
+ // within the visible most popular shelf
+ const char* const kTopCod[] = {"9NCPSQQD1Z66", "9N201KQXS5BM", "9NNFG8BQRCXL"};
+ for (const char* pid : kTopCod) {
+ auto it = std::find(list.productIds.begin(), list.productIds.end(), pid);
+ if (it != list.productIds.end()) list.productIds.erase(it);
+ size_t insertAt = std::min<size_t>(2, list.productIds.size());
+ list.productIds.insert(list.productIds.begin() + static_cast<long>(insertAt), pid);
+ }
+ }
// Free-to-play: no Game Pass needed, so not filtered; each one the
// account hasn't got yet shows as free to get (tile()).
bool freeToPlay = spec.sigl == xcloud::sigl::kFreeToPlay;
@@ -597,12 +977,14 @@ bool Library::load(xcloud::GssvClient& gssv, const std::string& language, const
}
if (spec.limit > 0 && list.productIds.size() > spec.limit) list.productIds.resize(spec.limit);
std::vector<std::string> missing;
- for (const auto& id : list.productIds)
- if (!products_.count(id)) missing.push_back(id);
+ for (const auto& id : list.productIds) {
+ auto it = products_.find(id);
+ if (it == products_.end() || it->second.tileUrl.empty() || otherLanguage_.count(id))
+ missing.push_back(id);
+ }
if (!missing.empty() && !xcloud::fetchProducts(missing, market_, language_, products_, e, false)) {
XC_LOGW("%s", e.c_str());
lastErr = e;
- continue;
}
RowIds r{list.title, !freeToPlay, isAllGames, {}};
for (const auto& id : list.productIds) r.items.emplace_back(id, std::string());
@@ -630,21 +1012,68 @@ void Library::loadOwned(xcloud::GssvClient gssv, const Changed& changed, const s
std::vector<Item> mine;
std::map<std::string, std::string> toBuy; // productId -> titleId
bool member = false;
+ auto registerTitle = [&](const std::string& pid, const xcloud::Title& t, bool entitled, bool sub) {
+ if (pid.empty()) return;
+ if (!t.titleId.empty() && t.titleId != "None") {
+ cloudTitleOf_[pid] = t.titleId;
+ auto it = products_.find(pid);
+ if (it != products_.end() && (it->second.xcloudTitleId.empty() || it->second.xcloudTitleId == "None")) {
+ it->second.xcloudTitleId = t.titleId;
+ }
+ }
+ if (!t.xboxTitleId.empty() && !xboxTitleOf_.count(pid)) xboxTitleOf_[pid] = t.xboxTitleId;
+ if (t.isFreeInStore) freeInStore_.insert(pid);
+ if (t.mouseKeyboard) mouseKeyboard_.insert(pid);
+
+ if (entitled) {
+ ownedProducts.insert(pid);
+ if (!gamePass_.count(pid) || !sub || t.titleId.find("CALLOFDUTY") != std::string::npos) {
+ mine.emplace_back(pid, t.titleId);
+ }
+ } else if (!gamePass_.count(pid) || t.titleId.find("CALLOFDUTY") != std::string::npos) {
+ toBuy[pid] = t.titleId;
+ }
+
+ if (sub) {
+ gamePass_.insert(pid);
+ if (std::find(allGames_.begin(), allGames_.end(), pid) == allGames_.end()) {
+ allGames_.push_back(pid);
+ }
+ }
+ };
+
for (const auto& t : titles) {
member |= t.hasEntitlement && t.viaSubscription;
if (xcloud::isNonGameAddon(t.titleId)) continue;
- if (!t.productId.empty() && !t.xboxTitleId.empty()) xboxTitleOf_[t.productId] = t.xboxTitleId;
- if (t.isFreeInStore && !t.productId.empty()) freeInStore_.insert(t.productId);
- if (t.mouseKeyboard && !t.productId.empty()) mouseKeyboard_.insert(t.productId);
- if (t.hasEntitlement) {
- ownedTitles.insert(t.titleId);
- if (t.productId.empty()) continue;
- ownedProducts.insert(t.productId);
- // Game Pass games the account owns itself (free-to-play ones
- // like Fortnite, without the subscription) are its games too.
- if (!gamePass_.count(t.productId) || !t.viaSubscription) mine.emplace_back(t.productId, t.titleId);
- } else if (!t.productId.empty() && !gamePass_.count(t.productId)) {
- toBuy[t.productId] = t.titleId;
+ if (t.hasEntitlement) ownedTitles.insert(t.titleId);
+
+ registerTitle(t.productId, t, t.hasEntitlement, t.viaSubscription);
+ for (const auto& alt : t.alternateProductIds) {
+ registerTitle(alt, t, t.hasEntitlement, t.viaSubscription);
+ }
+ if (t.titleId == "CALLOFDUTYHQ" || t.titleId.find("CALLOFDUTY") != std::string::npos) {
+ for (const auto& g : kKnownCloudGames) {
+ if (std::string_view(g.cloudTitleId) == t.titleId ||
+ (t.titleId == "CALLOFDUTYHQ" && std::string_view(g.cloudTitleId) == "CALLOFDUTYHQ")) {
+ registerTitle(g.productId, t, t.hasEntitlement, t.viaSubscription);
+ }
+ }
+ }
+ }
+ if (member) {
+ ownedTitles.insert("CALLOFDUTYHQ");
+ ownedTitles.insert("CALLOFDUTYBLACKOPS6");
+ ownedTitles.insert("CALLOFDUTYMODERNWARFAREIII");
+ xcloud::Title gpCod;
+ gpCod.titleId = "CALLOFDUTYHQ";
+ gpCod.hasEntitlement = true;
+ gpCod.viaSubscription = true;
+ for (const auto& g : kKnownCloudGames) {
+ if (std::string_view(g.cloudTitleId) == "CALLOFDUTYHQ" ||
+ std::string_view(g.cloudTitleId) == "CALLOFDUTYBLACKOPS6" ||
+ std::string_view(g.cloudTitleId) == "CALLOFDUTYMODERNWARFAREIII") {
+ registerTitle(g.productId, gpCod, true, true);
+ }
}
}
// Games to buy: the most popular in the cloud first, then the rest.
@@ -660,6 +1089,8 @@ void Library::loadOwned(xcloud::GssvClient gssv, const Changed& changed, const s
std::vector<std::string> missing;
for (const auto& m : mine)
if (!products_.count(m.first)) missing.push_back(m.first);
+ for (const auto& [pid, _] : toBuy)
+ if (!products_.count(pid)) missing.push_back(pid);
if (!missing.empty() && !xcloud::fetchProducts(missing, market_, language_, products_, err, false))
XC_LOGW("%s", err.c_str());
if (stop && *stop) return;
@@ -686,7 +1117,12 @@ void Library::loadCatalogNames(const Changed& changed, const std::atomic<bool>*
std::vector<std::string> missing;
std::set<std::string> queued;
auto want = [&](const std::string& id) {
- if ((!products_.count(id) || otherLanguage_.count(id)) && queued.insert(id).second) missing.push_back(id);
+ auto it = products_.find(id);
+ bool needs = (it == products_.end()) ||
+ it->second.title.empty() ||
+ (it->second.xcloudTitleId.empty() || it->second.xcloudTitleId == "None") ||
+ otherLanguage_.count(id);
+ if (needs && queued.insert(id).second) missing.push_back(id);
};
for (const auto* list : {&owned_, &purchasable_})
for (const auto& item : *list) want(item.first);
@@ -705,12 +1141,18 @@ void Library::loadCatalogNames(const Changed& changed, const std::atomic<bool>*
break;
}
for (auto& [id, p] : fetched) {
+ auto ct = cloudTitleOf_.find(id);
+ if (p.xcloudTitleId.empty() || p.xcloudTitleId == "None") {
+ if (ct != cloudTitleOf_.end()) p.xcloudTitleId = ct->second;
+ }
+ if (p.xcloudTitleId == "None") p.xcloudTitleId.clear();
// Keep the hero art and description already known, until they
// come in the new language (hydrate()).
auto old = products_.find(id);
if (old != products_.end()) {
if (p.heroUrl.empty()) p.heroUrl = old->second.heroUrl;
if (p.description.empty() && !otherLanguage_.count(id)) p.description = old->second.description;
+ if (p.xcloudTitleId.empty()) p.xcloudTitleId = old->second.xcloudTitleId;
if (!p.detailed && old->second.detailed) { // modes, languages and plan don't change with the language
p.detailed = true;
p.detailedAt = old->second.detailedAt;
diff --git a/src/app/library.h b/src/app/library.h
index d969e22..fcd3be6 100644
--- a/src/app/library.h
+++ b/src/app/library.h
@@ -51,7 +51,8 @@ public:
void setWishlist(std::vector<std::string> wish) { wishlist_ = std::move(wish); }
// Calls `changed` after each row arrives; false only when nothing loaded.
- bool load(xcloud::GssvClient& gssv, const std::string& language, const Changed& changed, std::string& err);
+ bool load(xcloud::GssvClient& gssv, const std::string& language, const Changed& changed, std::string& err,
+ bool forceRefresh = false);
// The first screen, before anything else: hero art, descriptions and
// console badges of the first cards of every row and of "Your games".
void loadFirstScreen(const std::string& xblAuth, const Changed& changed, const std::atomic<bool>* stop = nullptr);
@@ -96,6 +97,9 @@ public:
void saveCache() const;
// Marks a product/title as owned immediately upon successful purchase/claim.
void markAsOwned(const std::string& productId, const std::string& titleId = {});
+ // Delta-sync: discovers new/updated titles, only fetches missing metadata, updates rows in-place.
+ size_t syncDelta(xcloud::GssvClient& gssv, const Changed& changed, std::string& err);
+ void markUnclaimable(const std::string& productId);
private:
using Item = std::pair<std::string, std::string>; // productId, titleId
@@ -139,6 +143,7 @@ private:
// Details from a cache in another language: shown until replaced.
std::set<std::string> otherLanguage_;
Progress progress_;
+ std::map<std::string, std::string> cloudTitleOf_; // productId -> cloud titleId
std::map<std::string, std::string> xboxTitleOf_; // productId -> Xbox title id
std::map<std::string, std::string> platform_; // Xbox title id -> platform code
// Xbox title ids that have a "... - Xbox Series X|S" product, rebuilt
diff --git a/src/app/price_loop.cpp b/src/app/price_loop.cpp
index f2ddd80..f842ffe 100644
--- a/src/app/price_loop.cpp
+++ b/src/app/price_loop.cpp
@@ -96,8 +96,9 @@ void priceLoop() {
json::Value kept = json::Value::object();
for (const auto& [id, v] : cache.members()) {
if (now - v["t"].asInt() > kPriceTtlSeconds) continue;
- kept.set(id, v);
xcloud::Price p{v["list"].asNumber(), v["msrp"].asNumber(), v["cur"].str()};
+ if (p.list < 0.005) continue;
+ kept.set(id, v);
shown[id] = priceTexts(p);
}
cache = kept;
diff --git a/src/app/settings.cpp b/src/app/settings.cpp
index 098923b..ffe3d51 100644
--- a/src/app/settings.cpp
+++ b/src/app/settings.cpp
@@ -39,6 +39,13 @@ input::PadMap readPadMapOr(const json::Value& v, const input::PadMap& fallback,
return m;
}
+input::TouchpadShortcuts readTouchpadShortcutsOr(const json::Value& v, const input::TouchpadShortcuts& fallback) {
+ if (v.isNull()) return fallback;
+ input::TouchpadShortcuts ts = fallback;
+ input::readTouchpadShortcuts(v, ts);
+ return ts;
+}
+
} // namespace
bool Settings::load(const std::string& path) {
@@ -99,6 +106,7 @@ bool Settings::load(const std::string& path) {
gyroMode = static_cast<int>(std::clamp<int64_t>((*j)["gyroMode"].asInt(gyroMode), 0, 2));
gyroLevel = static_cast<int>(std::clamp<int64_t>((*j)["gyroLevel"].asInt(gyroLevel), 1, 10));
touchpadMouse = (*j)["touchpadMouse"].asBool(touchpadMouse);
+ touchpadShortcuts = readTouchpadShortcutsOr((*j)["touchpadShortcuts"], input::defaultTouchpadShortcuts());
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));
voiceRouting = static_cast<int>(std::clamp<int64_t>((*j)["voiceRouting"].asInt(voiceRouting), 0, 1));
@@ -151,6 +159,7 @@ bool Settings::load(const std::string& path) {
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));
p.touchpadMouse = obj["touchpadMouse"].asBool(touchpadMouse);
+ p.touchpadShortcuts = readTouchpadShortcutsOr(obj["touchpadShortcuts"], touchpadShortcuts);
p.locale = obj["locale"].str();
perGame[id] = p;
}
@@ -184,6 +193,7 @@ GameProfile Settings::defaultProfile() const {
p.gyroMode = gyroMode;
p.gyroLevel = gyroLevel;
p.touchpadMouse = touchpadMouse;
+ p.touchpadShortcuts = touchpadShortcuts;
return p;
}
@@ -257,6 +267,7 @@ bool Settings::save(const std::string& path) const {
v.set("gyroMode", gyroMode);
v.set("gyroLevel", gyroLevel);
v.set("touchpadMouse", touchpadMouse);
+ v.set("touchpadShortcuts", input::touchpadShortcutsJson(touchpadShortcuts));
v.set("micGain", micGain);
v.set("audioRoute", audioRoute);
v.set("voiceRouting", voiceRouting);
@@ -294,6 +305,7 @@ bool Settings::save(const std::string& path) const {
obj.set("gyroMode", p.gyroMode);
obj.set("gyroLevel", p.gyroLevel);
obj.set("touchpadMouse", p.touchpadMouse);
+ obj.set("touchpadShortcuts", input::touchpadShortcutsJson(p.touchpadShortcuts));
if (!p.locale.empty()) obj.set("locale", p.locale);
pg.set(id, obj);
}
diff --git a/src/app/settings.h b/src/app/settings.h
index 6d4848d..8b6f234 100644
--- a/src/app/settings.h
+++ b/src/app/settings.h
@@ -47,6 +47,8 @@ struct GameProfile {
int gyroLevel = 5;
// Touchpad as mouse in games with native MKB support (OFF by default)
bool touchpadMouse = false;
+ // Configurable DualSense touchpad gestures and left/right click actions
+ input::TouchpadShortcuts touchpadShortcuts = input::defaultTouchpadShortcuts();
// Per-game audio/subtitle language: "" = system default, else e.g. "en-US", "pt-BR"
std::string locale;
};
@@ -112,6 +114,7 @@ struct Settings {
int gyroMode = 0; // gyro aiming (input/gyro.h): 0 off, 1 always, 2 while L2 is held
int gyroLevel = 5; // its intensity, 1..10
bool touchpadMouse = false; // touchpad as mouse in games with native MKB support
+ input::TouchpadShortcuts touchpadShortcuts = input::defaultTouchpadShortcuts();
int micGain = 1; // 0: 50%, 1: 100%, 2: 150%
int audioRoute = 0; // 0: TV/HDMI (Main), 1: DualSense Speaker / Headset (Pad)
int voiceRouting = 0; // 0: Auto (DualSense Speaker if available), 1: Always TV/Headset
diff --git a/src/app/stream_screen.cpp b/src/app/stream_screen.cpp
index 2c25860..ed548f6 100644
--- a/src/app/stream_screen.cpp
+++ b/src/app/stream_screen.cpp
@@ -99,6 +99,151 @@ void StreamScreen::setMouseCaptured_(bool captured) {
void StreamScreen::applyDeband_() { display::setDeband(deband_ == 3 ? autoDeband_.level() : deband_); }
+void StreamScreen::syncFromSettings() {
+ if (!wasStreaming_) return;
+ ui::GameTile tile;
+ {
+ std::lock_guard<std::mutex> argLock(g_argMutex);
+ tile = g_playTile;
+ }
+ std::lock_guard<std::mutex> settingsLock(g_settingsMutex);
+ bool hasCustom = false;
+ GameProfile prof = g_settings.profileForGame(tile.productId, tile.titleId, &hasCustom);
+ hasCustomProfile_ = hasCustom;
+ touchpadMouse_ = prof.touchpadMouse;
+
+ streamResolution_ = prof.resolution;
+ showStats_ = g_settings.streamStats;
+ menu_.setStatsOn(showStats_);
+ menu_.setStatsMask(g_settings.statsMask);
+ sharpness_ = g_autoplay.sharpness >= 0 ? g_autoplay.sharpness : prof.sharpness;
+ display::setSharpness(kSharpAmount[std::clamp(sharpness_, 0, 3)]);
+ deband_ = g_autoplay.deband >= 0 ? g_autoplay.deband : prof.deband;
+ applyDeband_();
+ upscaler_ = g_autoplay.upscaler >= 0 ? g_autoplay.upscaler : prof.upscaler;
+ if (g_autoplay.restore) upscaler_ = (upscaler_ & 1) | 2;
+ applyUpscaler(upscaler_);
+
+ triggerStrength_ = prof.triggerStrength;
+ triggerProfile_ = prof.triggerProfile;
+ deadzone_ = prof.deadzoneLeft;
+ circleConfirms_ = prof.circleConfirms;
+ keyMap_ = prof.keyMap;
+ padMap_ = prof.padMap;
+ touchpadShortcuts_ = prof.touchpadShortcuts;
+ gyroMode_ = prof.gyroMode;
+ gyroLevel_ = prof.gyroLevel;
+ input::setGyro(gyroMode_, gyroLevel_);
+ input::setDeadzone(prof.deadzoneLeft / 100.0f, prof.deadzoneRight / 100.0f);
+ input::setTriggerFeel(prof.triggerStrength, prof.triggerHz, prof.triggerResistance, prof.triggerPulses, triggerProfile_);
+ input::setCircleConfirms(prof.circleConfirms);
+ if (g_ui) g_ui->setCircleConfirms(prof.circleConfirms);
+
+ media::audioSetRoute(static_cast<media::AudioRoute>(g_settings.audioRoute));
+ media::audioSetVoiceRouting(g_settings.voiceRouting);
+ media::setPadSpeakerVolume(g_settings.padSpeakerVolume);
+ if (g_player) {
+ g_player->setMicGain(g_settings.micGainFactor());
+ }
+
+ menu_.setProfileValues(streamResolution_, sharpness_, deband_, upscaler_,
+ triggerStrength_, deadzone_, circleConfirms_, hasCustomProfile_);
+ menu_.setGyro(gyroMode_, gyroLevel_);
+ menu_.setTouchpadShortcuts(touchpadShortcuts_);
+ menu_.setPadSpeakerVolume(g_settings.padSpeakerVolume);
+ overlaySeq_ = 0;
+}
+
+void StreamScreen::executeTouchpadAction_(input::TouchpadAction act, const char* triggerName) {
+ switch (act) {
+ case input::TouchpadAction::None:
+ break;
+ case input::TouchpadAction::GameMenu:
+ swipeMenu_ = true;
+ XC_LOGI("touchpad %s: game menu", triggerName);
+ break;
+ case input::TouchpadAction::XboxButton:
+ if (!menu_.isOpen()) {
+ g_xboxButtonUntil = platform::nowMs() + 250;
+ XC_LOGI("touchpad %s: Xbox button", triggerName);
+ }
+ break;
+ case input::TouchpadAction::ToggleStats:
+ showStats_ = !showStats_;
+ menu_.setStatsOn(showStats_);
+ {
+ std::lock_guard<std::mutex> settingsLock(g_settingsMutex);
+ g_settings.streamStats = showStats_;
+ g_settings.save(settingsPath());
+ refreshSettingsUiLocked();
+ }
+ overlaySeq_ = 0;
+ platform::notify(showStats_ ? "Telemetria ativada" : "Telemetria desativada",
+ showStats_ ? "stats on" : "stats off");
+ XC_LOGI("touchpad %s: toggle stats -> %d", triggerName, showStats_ ? 1 : 0);
+ break;
+ case input::TouchpadAction::ToggleMicMute:
+ if (g_player) {
+ bool muted = !g_player->micMuted();
+ g_player->setMicMuted(muted);
+ menu_.setMicMuted(muted || g_player->isMicHardwareMuted());
+ overlaySeq_ = 0;
+ platform::notify(muted ? "Microfone silenciado" : "Microfone ativado",
+ muted ? "mic muted" : "mic unmuted");
+ XC_LOGI("touchpad %s: toggle mic mute -> %d", triggerName, muted ? 1 : 0);
+ }
+ break;
+ case input::TouchpadAction::CycleGyro:
+ gyroMode_ = (gyroMode_ + 1) % 3;
+ input::setGyro(gyroMode_, gyroLevel_);
+ menu_.setGyro(gyroMode_, gyroLevel_);
+ {
+ std::lock_guard<std::mutex> settingsLock(g_settingsMutex);
+ if (hasCustomProfile_) g_settings.perGame[gameKey_].gyroMode = gyroMode_;
+ else g_settings.gyroMode = gyroMode_;
+ g_settings.save(settingsPath());
+ refreshSettingsUiLocked();
+ if (g_ui) g_ui->setPerGameSettings(g_settings.perGame);
+ }
+ overlaySeq_ = 0;
+ {
+ const char* gyroName = gyroMode_ == 1 ? ui::tr(ui::Str::GyroAlways)
+ : gyroMode_ == 2 ? ui::tr(ui::Str::GyroAiming)
+ : ui::tr(ui::Str::Off);
+ platform::notify(std::string(ui::tr(ui::Str::Gyro)) + ": " + gyroName, "cycle gyro");
+ }
+ XC_LOGI("touchpad %s: cycle gyro -> %d", triggerName, gyroMode_);
+ break;
+ case input::TouchpadAction::CycleTriggerProfile:
+ triggerProfile_ = (triggerProfile_ + 1) % 3;
+ {
+ std::lock_guard<std::mutex> settingsLock(g_settingsMutex);
+ input::setTriggerFeel(triggerStrength_, g_settings.triggerHz, g_settings.triggerResistance, g_settings.triggerPulses, triggerProfile_);
+ if (hasCustomProfile_) g_settings.perGame[gameKey_].triggerProfile = triggerProfile_;
+ else g_settings.triggerProfile = triggerProfile_;
+ g_settings.save(settingsPath());
+ refreshSettingsUiLocked();
+ if (g_ui) g_ui->setPerGameSettings(g_settings.perGame);
+ }
+ overlaySeq_ = 0;
+ {
+ const char* profName = triggerProfile_ == 1 ? ui::tr(ui::Str::TriggerProfileShooter)
+ : triggerProfile_ == 2 ? ui::tr(ui::Str::TriggerProfileRacing)
+ : ui::tr(ui::Str::TriggerProfileStd);
+ platform::notify(std::string(ui::tr(ui::Str::TriggerProfile)) + ": " + profName, "cycle trigger profile");
+ }
+ XC_LOGI("touchpad %s: cycle trigger profile -> %d", triggerName, triggerProfile_);
+ break;
+ default:
+ if (!menu_.isOpen() && input::isTouchpadButtonAction(act)) {
+ shortcutPulseAction_ = act;
+ shortcutPulseUntilMs_ = platform::nowMs() + 200;
+ XC_LOGI("touchpad %s: button %s", triggerName, ui::touchpadActionLabel(static_cast<int>(act)).c_str());
+ }
+ break;
+ }
+}
+
void StreamScreen::update(const input::ControllerState& pad, ui::NavInput nav, bool menuCombo) {
std::lock_guard<std::mutex> lock(g_playerMutex);
if (g_player != overlayPlayer_ || (g_player && g_player->reconnects() != playerReconnects_)) {
@@ -145,6 +290,8 @@ void StreamScreen::update(const input::ControllerState& pad, ui::NavInput nav, b
circleConfirms_ = prof.circleConfirms;
keyMap_ = prof.keyMap;
padMap_ = prof.padMap;
+ touchpadShortcuts_ = prof.touchpadShortcuts;
+ menu_.setTouchpadShortcuts(touchpadShortcuts_);
gyroMode_ = prof.gyroMode;
gyroLevel_ = prof.gyroLevel;
input::setGyro(gyroMode_, gyroLevel_);
@@ -167,14 +314,18 @@ void StreamScreen::update(const input::ControllerState& pad, ui::NavInput nav, b
}
if (g_player) {
updateTextInput(g_player);
+ if (pad.touching) touchLastX_ = pad.touchX;
+
// L3 + R3 simultaneous press toggles HUD statistics overlay
bool l3r3 = pad.btnL3 && pad.btnR3;
if (l3r3 && !prevL3R3_ && !menu_.isOpen()) {
showStats_ = !showStats_;
+ menu_.setStatsOn(showStats_);
{
std::lock_guard<std::mutex> settingsLock(g_settingsMutex);
g_settings.streamStats = showStats_;
g_settings.save(settingsPath());
+ refreshSettingsUiLocked();
}
overlaySeq_ = 0;
platform::notify(showStats_ ? "Telemetria ativada" : "Telemetria desativada",
@@ -196,6 +347,7 @@ void StreamScreen::update(const input::ControllerState& pad, ui::NavInput nav, b
bool micMuted = g_player ? (g_player->micMuted() || g_player->isMicHardwareMuted()) : false;
menu_.setDebandInUse(autoDeband_.level());
menu_.setGyro(gyroMode_, gyroLevel_);
+ menu_.setTouchpadShortcuts(touchpadShortcuts_);
menu_.setStatsMask(g_settings.statsMask);
int padVol = 100;
{
@@ -226,6 +378,7 @@ void StreamScreen::update(const input::ControllerState& pad, ui::NavInput nav, b
std::lock_guard<std::mutex> settingsLock(g_settingsMutex);
g_settings.padSpeakerVolume = vol;
g_settings.save(settingsPath());
+ refreshSettingsUiLocked();
break;
}
case ui::MenuAction::Close: g_player->requestKeyframe(); break; // a clean picture back in the game
@@ -242,6 +395,7 @@ void StreamScreen::update(const input::ControllerState& pad, ui::NavInput nav, b
g_settings.perGame[gameKey_].resolution = streamResolution_;
g_settings.save(settingsPath());
}
+ ++g_settingsVersion;
}
break;
case ui::MenuAction::ProfileToggle: {
@@ -265,6 +419,8 @@ void StreamScreen::update(const input::ControllerState& pad, ui::NavInput nav, b
p.highRefresh = had != g_settings.perGame.end() ? had->second.highRefresh : g_settings.highRefresh;
p.keyMap = had != g_settings.perGame.end() ? had->second.keyMap : g_settings.keyMap;
p.padMap = had != g_settings.perGame.end() ? had->second.padMap : g_settings.padMap;
+ p.touchpadShortcuts = touchpadShortcuts_;
+ p.touchpadMouse = touchpadMouse_;
p.gyroMode = gyroMode_;
p.gyroLevel = gyroLevel_;
g_settings.perGame[gameKey_] = p;
@@ -280,11 +436,14 @@ void StreamScreen::update(const input::ControllerState& pad, ui::NavInput nav, b
triggerProfile_ = def.triggerProfile;
keyMap_ = def.keyMap;
padMap_ = def.padMap;
+ touchpadShortcuts_ = def.touchpadShortcuts;
+ touchpadMouse_ = def.touchpadMouse;
circleConfirms_ = def.circleConfirms;
gyroMode_ = def.gyroMode;
gyroLevel_ = def.gyroLevel;
input::setGyro(gyroMode_, gyroLevel_);
menu_.setGyro(gyroMode_, gyroLevel_);
+ menu_.setTouchpadShortcuts(touchpadShortcuts_);
display::setSharpness(kSharpAmount[sharpness_]);
applyDeband_();
applyUpscaler(upscaler_);
@@ -295,6 +454,7 @@ void StreamScreen::update(const input::ControllerState& pad, ui::NavInput nav, b
triggerStrength_, deadzone_, circleConfirms_, false);
}
g_settings.save(settingsPath());
+ refreshSettingsUiLocked();
if (g_ui) g_ui->setPerGameSettings(g_settings.perGame);
break;
}
@@ -393,6 +553,17 @@ void StreamScreen::update(const input::ControllerState& pad, ui::NavInput nav, b
g_settings.streamStats = showStats_;
g_settings.statsMask = menu_.statsMask();
g_settings.save(settingsPath());
+ refreshSettingsUiLocked();
+ break;
+ }
+ case ui::MenuAction::TouchpadShortcuts: {
+ touchpadShortcuts_ = menu_.touchpadShortcuts();
+ std::lock_guard<std::mutex> settingsLock(g_settingsMutex);
+ if (hasCustomProfile_) g_settings.perGame[gameKey_].touchpadShortcuts = touchpadShortcuts_;
+ else g_settings.touchpadShortcuts = touchpadShortcuts_;
+ g_settings.save(settingsPath());
+ refreshSettingsUiLocked();
+ if (g_ui) g_ui->setPerGameSettings(g_settings.perGame);
break;
}
default: break;
@@ -407,11 +578,28 @@ void StreamScreen::update(const input::ControllerState& pad, ui::NavInput nav, b
if (touchMouse_.prevButtons != 0) touchKbm.moved = true; // let go of any held touchpad mouse button
touchMouse_ = {};
}
+ // Touchpad click left / click right action resolution
+ input::TouchpadAction clickAct = (touchLastX_ >= 0.5f) ? touchpadShortcuts_.clickRight : touchpadShortcuts_.clickLeft;
+ const char* clickSide = (touchLastX_ >= 0.5f) ? "click right" : "click left";
+ if (pad.btnTouchpad && !prevTouchpad_ && !menuCombo && !touchDrag && g_keyboardFor.empty()) {
+ if (menu_.isOpen()) {
+ if (clickAct == input::TouchpadAction::GameMenu) {
+ swipeMenu_ = true;
+ XC_LOGI("touchpad %s: game menu", clickSide);
+ }
+ } else if (!input::isTouchpadButtonAction(clickAct) && clickAct != input::TouchpadAction::None) {
+ executeTouchpadAction_(clickAct, clickSide);
+ }
+ }
+ prevTouchpad_ = pad.btnTouchpad;
+
// The game gets the buttons through this game's map (Settings >
// Controller buttons); everything above (the menu's combo, the
// menu itself) read them as they are.
input::ControllerState padIn = pad;
- if (touchDrag) padIn.btnTouchpad = false; // held as a mouse button after moving the cursor, not View
+ if (touchDrag || clickAct != input::TouchpadAction::View) {
+ padIn.btnTouchpad = false; // held as a mouse button or mapped to a custom touchpad click action
+ }
input::ControllerState sent = input::applyPadMap(padIn, padMap_);
if (g_syntheticA) sent.btnA = true;
// While another window has the focus on the cloud console (a
@@ -430,23 +618,41 @@ void StreamScreen::update(const input::ControllerState& pad, ui::NavInput nav, b
if (menu_.isOpen() || !g_keyboardFor.empty()) padReleased_ = false;
else if (!held) padReleased_ = true;
if (!padReleased_ || menuCombo) sent = input::ControllerState{};
- // Swiping up or right on the touchpad is the Xbox button (once
- // per swipe; the games never see the touchpad's touches). In MKB
- // games the touchpad moves the mouse while the menu is closed.
+ else if (!menu_.isOpen() && !touchDrag) {
+ if (pad.btnTouchpad && input::isTouchpadButtonAction(clickAct) && clickAct != input::TouchpadAction::View) {
+ input::applyTouchpadButtonAction(sent, clickAct);
+ }
+ if (platform::nowMs() < shortcutPulseUntilMs_) {
+ input::applyTouchpadButtonAction(sent, shortcutPulseAction_);
+ }
+ }
+ // Touchpad swipe gestures (once per swipe; the games never see the
+ // touchpad's touches). In MKB games the touchpad moves the mouse while the menu is closed.
bool swipeOn = (!mouseKeyboard_ || !touchpadMouse_) || menu_.isOpen();
if (swipeOn && pad.touching && !pad.btnTouchpad && g_keyboardFor.empty()) {
if (!swipe_.active) swipe_ = {true, false, pad.touchX, pad.touchY};
float dx = pad.touchX - swipe_.x, dy = swipe_.y - pad.touchY; // dy > 0: up
bool right = dx > 0.30f && std::abs(dy) < 0.30f, up = dy > 0.40f && std::abs(dx) < 0.30f;
bool left = dx < -0.30f && std::abs(dy) < 0.30f, down = dy < -0.40f && std::abs(dx) < 0.30f;
- if (!swipe_.fired && (right || up) && !menu_.isOpen()) {
- swipe_.fired = true;
- g_xboxButtonUntil = platform::nowMs() + 250;
- XC_LOGI("touchpad swipe %s: Xbox button", right ? "right" : "up");
- } else if (!swipe_.fired && (left || down)) {
- swipe_.fired = true;
- swipeMenu_ = true; // opened on the next pass, as by OPTIONS + TOUCHPAD
- XC_LOGI("touchpad swipe %s: game menu", left ? "left" : "down");
+ if (!swipe_.fired && (up || down || left || right)) {
+ input::TouchpadAction act = up ? touchpadShortcuts_.swipeUp
+ : down ? touchpadShortcuts_.swipeDown
+ : left ? touchpadShortcuts_.swipeLeft
+ : touchpadShortcuts_.swipeRight;
+ const char* dirName = up ? "swipe up" : down ? "swipe down" : left ? "swipe left" : "swipe right";
+ if (menu_.isOpen()) {
+ if (act == input::TouchpadAction::GameMenu) {
+ swipe_.fired = true;
+ swipeMenu_ = true;
+ XC_LOGI("touchpad %s: game menu", dirName);
+ }
+ } else if (act != input::TouchpadAction::None) {
+ swipe_.fired = true;
+ executeTouchpadAction_(act, dirName);
+ if (platform::nowMs() < shortcutPulseUntilMs_ && padReleased_ && !menuCombo) {
+ input::applyTouchpadButtonAction(sent, shortcutPulseAction_);
+ }
+ }
}
} else {
swipe_.active = false;
diff --git a/src/app/stream_screen.h b/src/app/stream_screen.h
index ff35fae..d585c82 100644
--- a/src/app/stream_screen.h
+++ b/src/app/stream_screen.h
@@ -42,12 +42,15 @@ public:
void redrawMenu();
// What the display and the pads can do: the game menu hides the rest.
void setCaps(const ui::UiCaps& caps);
+ // Live-reload settings into the active stream session (e.g. from WebUI).
+ void syncFromSettings();
// Each pass on any other screen: what the stream left is cleared, and a
// console keyboard still up is closed.
void idle();
private:
void applyDeband_();
+ void executeTouchpadAction_(input::TouchpadAction act, const char* triggerName);
// The mouse held by the window (input::kbmSetCaptured) while it should
// be: a game has the keyboard and mouse, its menu closed, the window focused.
void setMouseCaptured_(bool captured);
@@ -80,6 +83,11 @@ private:
bool circleConfirms_ = false;
input::KeyMap keyMap_ = input::defaultKeyMap(); // this game's keys (the keyboard as a controller)
input::PadMap padMap_ = input::defaultPadMap(); // this game's controller buttons, toward the game only
+ input::TouchpadShortcuts touchpadShortcuts_ = input::defaultTouchpadShortcuts();
+ float touchLastX_ = 0.25f;
+ bool prevTouchpad_ = false;
+ input::TouchpadAction shortcutPulseAction_ = input::TouchpadAction::None;
+ uint64_t shortcutPulseUntilMs_ = 0;
int gyroMode_ = 0, gyroLevel_ = 5; // gyro aiming (input/gyro.h), this game's
bool highRefresh_ = false; // 120 Hz turned on for this stream
bool mouseKeyboard_ = false; // the game takes native mouse and keyboard
diff --git a/src/app/web_server.cpp b/src/app/web_server.cpp
index 21e8ecf..cca8ba7 100644
--- a/src/app/web_server.cpp
+++ b/src/app/web_server.cpp
@@ -13,6 +13,7 @@
#include <algorithm>
#include <arpa/inet.h>
#include <cerrno>
+#include <csignal>
#include <cstring>
#include <fcntl.h>
#include <mbedtls/base64.h>
@@ -40,6 +41,22 @@ const char* kIndexHtml = R"html(<!DOCTYPE html>
<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>
+<script>
+(function() {
+ function applyInitScale() {
+ var w = window.innerWidth || (document.documentElement ? document.documentElement.clientWidth : 360);
+ var h = window.innerHeight || (document.documentElement ? document.documentElement.clientHeight : 640);
+ var isLand = w > h;
+ var pScale = Math.min(1, Math.max(0.4, (w - 28) / 412));
+ var lsScale = Math.min(1, Math.max(0.35, Math.min((w - 24) / 915, (h - 78) / 412)));
+ var fsScale = Math.min(1.2, Math.max(0.4, Math.min((w - 28) / 915, (h - 20) / 412)));
+ document.documentElement.style.setProperty('--gp-scale', (isLand ? lsScale : pScale).toFixed(3));
+ document.documentElement.style.setProperty('--gp-fs-scale', fsScale.toFixed(3));
+ }
+ applyInitScale();
+ window.addEventListener('resize', applyInitScale);
+})();
+</script>
<style>
:root {
--bg: #0b0d13;
@@ -54,22 +71,26 @@ const char* kIndexHtml = R"html(<!DOCTYPE html>
--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; overscroll-behavior: none; }
-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; }
+html { width: 100%; max-width: 100%; background: var(--bg); }
+body { width: 100%; max-width: 100%; margin: 0; padding: 0; overflow-x: hidden; overflow-y: auto; background: var(--bg); color: var(--text); -webkit-overflow-scrolling: touch; overscroll-behavior-y: none; }
+header { box-sizing: border-box; background: var(--surface); border-bottom: 1px solid var(--border); padding-top: max(18px, env(safe-area-inset-top, 18px)); padding-bottom: 12px; padding-left: max(16px, env(safe-area-inset-left, 16px)); padding-right: max(16px, env(safe-area-inset-right, 16px)); 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-tabs { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface); border-bottom: 1px solid var(--border); width: 100%; max-width: 100%; overflow: hidden; }
+.nav-tab { min-width: 0; text-align: center; padding: 11px 4px; min-height: 44px; display: flex; align-items: center; justify-content: center; font-size: clamp(0.74rem, 2.8vw, 0.86rem); font-weight: 600; color: var(--text-dim); border-bottom: 2px solid transparent; border-right: 1px solid rgba(40, 47, 68, 0.45); border-top: 1px solid rgba(40, 47, 68, 0.45); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; user-select: none; -webkit-user-select: none; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.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; }
+.tab-pane { display: none !important; height: 0 !important; max-height: 0 !important; overflow: hidden !important; width: 100%; }
+.tab-pane.active { display: block !important; height: auto !important; max-height: none !important; overflow: visible !important; }
+.content { max-width: 680px; width: 100%; margin: 12px auto 0 auto; padding: 0 12px 20px 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:last-child { margin-bottom: 0 !important; }
.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; }
@@ -92,7 +113,7 @@ header .badge { background: var(--primary); color: #fff; font-size: 0.70rem; pad
.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 { 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 14px; min-height: 44px; font-size: 0.86rem; font-weight: 600; cursor: pointer; text-decoration: none; transition: background 0.15s, border-color 0.15s; max-width: 100%; white-space: normal; text-align: center; touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
.btn:hover { background: var(--border); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
@@ -111,7 +132,7 @@ select { background: var(--surface); color: #fff; border: 1px solid var(--border
.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 { 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: 10000; max-width: 90%; text-align: center; }
.toast.show { opacity: 1; }
/* Telemetry & interactive controls */
@@ -133,7 +154,7 @@ input:checked + .slider-sw { background-color: var(--primary); border-color: var
input:checked + .slider-sw:before { transform: translateX(20px); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #b82626; }
-
+.section-sub { font-size: 0.86rem; font-weight: 700; color: #4ade80; margin: 14px 0 6px 0; display: flex; align-items: center; justify-content: space-between; }
/* Search overlay when streaming */
.search-disabled-overlay {
@@ -167,6 +188,14 @@ input:checked + .slider-sw:before { transform: translateX(20px); }
}
/* Virtual Gamepad */
+.gamepad-toolbar {
+ display: flex;
+ gap: 8px;
+ align-items: center;
+ justify-content: flex-end;
+ flex-wrap: wrap;
+ margin-bottom: 8px;
+}
.gamepad-container {
user-select: none;
-webkit-user-select: none;
@@ -178,23 +207,31 @@ input:checked + .slider-sw:before { transform: translateX(20px); }
gap: 12px;
}
.player-select-row {
- display: flex;
- gap: 8px;
+ display: grid;
+ grid-template-columns: repeat(4, 1fr);
+ gap: 6px;
width: 100%;
margin-bottom: 6px;
}
.player-btn {
- flex: 1 1 0;
- padding: 10px 8px;
+ padding: 8px 6px;
+ min-height: 42px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
border-radius: 10px;
border: 1px solid var(--border);
background: var(--surface-alt);
color: var(--text-dim);
- font-size: clamp(0.78rem, 3.2vw, 0.88rem);
+ font-size: clamp(0.74rem, 2.8vw, 0.84rem);
font-weight: 700;
cursor: pointer;
text-align: center;
- transition: all 0.2s;
+ transition: all 0.15s;
+ touch-action: manipulation;
+ user-select: none;
+ -webkit-user-select: none;
+ -webkit-tap-highlight-color: transparent;
}
.player-btn.active {
background: var(--primary);
@@ -202,147 +239,447 @@ input:checked + .slider-sw:before { transform: translateX(20px); }
color: #fff;
box-shadow: 0 2px 8px rgba(16, 124, 65, 0.4);
}
-.pad-top-row {
+/* Virtual Gamepad Viewport & Modules (Exact Layout Studio Match) */
+:root {
+ --gp-scale: 1;
+ --gp-fs-scale: 1;
+}
+#tab-gamepad #gamepadCard {
+ padding-left: 4px;
+ padding-right: 4px;
+}
+
+.gamepad-viewport-wrapper {
+ width: 100%;
+ display: flex;
+ justify-content: center;
+ align-items: flex-start;
+ overflow: hidden;
+}
+.gamepad-container {
+ position: relative;
+ background: transparent;
+ user-select: none;
+ -webkit-user-select: none;
+ touch-action: none !important;
+}
+.gamepad-module {
+ position: absolute;
+ transform-origin: center center;
display: flex;
- justify-content: space-between;
align-items: center;
- gap: 8px;
- width: 100%;
+ justify-content: center;
+ touch-action: none !important;
+ box-sizing: border-box;
}
-.pad-bumper-group {
+
+/* Stick Styling (Matching Layout Studio) */
+.stick-base {
+ position: relative;
+ width: 146px;
+ height: 146px;
+ border-radius: 50%;
+ background: radial-gradient(circle at 50% 50%, #1a2233 0%, #0d121c 100%);
+ border: 2px solid #334155;
+ box-shadow: inset 0 3px 10px rgba(0,0,0,0.8), 0 3px 8px rgba(0,0,0,0.5);
display: flex;
- flex-direction: column;
- gap: 6px;
+ align-items: center;
+ justify-content: center;
+ touch-action: none;
+}
+.stick-head {
+ width: 62px;
+ height: 62px;
+ border-radius: 50%;
+ background: radial-gradient(circle at 35% 35%, #475569, #1e293b);
+ border: 2px solid #64748b;
+ box-shadow: 0 4px 12px rgba(0,0,0,0.7);
+ pointer-events: none;
+ transform: translate(0px, 0px);
+ display: flex;
+ align-items: center;
+ justify-content: center;
+}
+.stick-head::after {
+ content: '';
+ width: 45%;
+ height: 45%;
+ border-radius: 50%;
+ border: 1.5px solid rgba(255, 255, 255, 0.2);
+ background: radial-gradient(circle, #1e293b 0%, #334155 100%);
+ box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.7);
}
+
+/* D-Pad Styling (Matching Layout Studio) */
+.dpad-container {
+ position: relative;
+ width: 150px;
+ height: 150px;
+}
+.dpad-arm {
+ position: absolute;
+ border-radius: 10px;
+ background: #1e2538;
+ border: 1.5px solid #3e4d70;
+ color: #94a3b8;
+ font-weight: 900;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ box-shadow: 0 3px 6px rgba(0,0,0,0.4);
+ transition: transform 0.06s, background 0.06s;
+ cursor: pointer;
+ touch-action: none;
+ user-select: none;
+}
+.dpad-arm:active, .dpad-arm.pressed {
+ transform: scale(0.92);
+ background: #107c41 !important;
+ color: #fff !important;
+ border-color: #4ade80 !important;
+ box-shadow: 0 0 12px rgba(16, 124, 65, 0.8) !important;
+}
+.dpad-arm-up { top: 0; left: 33.33%; width: 33.33%; height: 35%; }
+.dpad-arm-down { bottom: 0; left: 33.33%; width: 33.33%; height: 35%; }
+.dpad-arm-left { top: 33.33%; left: 0; width: 35%; height: 33.33%; }
+.dpad-arm-right { top: 33.33%; right: 0; width: 35%; height: 33.33%; }
+.dpad-mid {
+ position: absolute;
+ top: 33.33%; left: 33.33%;
+ width: 33.33%; height: 33.33%;
+ background: #151a27;
+ border-radius: 4px;
+ pointer-events: none;
+}
+
+/* ABXY Styling (Matching Layout Studio) */
+.abxy-container {
+ position: relative;
+ width: 156px;
+ height: 156px;
+}
+.abxy-key {
+ position: absolute;
+ width: 52px;
+ height: 52px;
+ border-radius: 50%;
+ font-weight: 900;
+ font-size: 1.3rem;
+ color: #fff;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ border-width: 2px;
+ box-shadow: 0 3px 8px rgba(0,0,0,0.5);
+ transition: transform 0.06s;
+ cursor: pointer;
+ touch-action: none;
+ user-select: none;
+}
+.abxy-key:active, .abxy-key.pressed {
+ transform: scale(0.90) !important;
+ box-shadow: 0 0 16px rgba(255,255,255,0.8) !important;
+ filter: brightness(1.3);
+}
+.btn-y { top: 0; left: 50%; transform: translateX(-50%); background: #c68900; border-color: #ffd000; }
+.btn-a { bottom: 0; left: 50%; transform: translateX(-50%); background: #0e6b37; border-color: #22c55e; }
+.btn-x { top: 50%; left: 0; transform: translateY(-50%); background: #006eb8; border-color: #38bdf8; }
+.btn-b { top: 50%; right: 0; transform: translateY(-50%); background: #b80d1b; border-color: #f87171; }
+
+/* Buttons & System Styling */
.pad-btn {
display: inline-flex;
align-items: center;
justify-content: center;
- background: var(--surface-alt);
- border: 1px solid var(--border);
+ background: #1e2538;
+ border: 1.5px solid #3e4d70;
border-radius: 10px;
color: #fff;
font-weight: 700;
+ box-shadow: 0 2px 6px rgba(0,0,0,0.3);
+ transition: transform 0.06s, background 0.06s;
cursor: pointer;
touch-action: none;
user-select: none;
- -webkit-user-select: none;
- transition: transform 0.08s, background 0.08s, border-color 0.08s;
- box-shadow: 0 2px 5px rgba(0,0,0,0.3);
+ width: 100%;
+ height: 100%;
}
.pad-btn:active, .pad-btn.pressed {
transform: scale(0.92);
- background: var(--primary) !important;
+ background: #107c41 !important;
border-color: #4ade80 !important;
- box-shadow: 0 0 10px rgba(16, 124, 65, 0.6) !important;
+ box-shadow: 0 0 12px rgba(16, 124, 65, 0.7) !important;
}
-.pad-btn-sm {
- width: 68px;
- height: 38px;
- font-size: 0.80rem;
+.pad-btn-trigger {
+ font-weight: 800;
+ font-size: 1.05rem;
+ background: linear-gradient(180deg, #2e3a54, #182030);
+ border: 1.5px solid #4a5c82;
+ border-radius: 12px;
}
-.pad-center-group {
- display: flex;
- gap: 6px;
- align-items: center;
+.pad-btn-bumper {
+ font-weight: 700;
+ font-size: 0.92rem;
+ border-radius: 10px;
}
-.pad-btn-center {
- padding: 8px 12px;
- font-size: 0.72rem;
+.pad-btn-stick-click {
+ font-size: 0.82rem;
+ color: #94a3b8;
border-radius: 8px;
- background: #1e2433;
-}
-.pad-btn-nexus {
- width: 44px;
- height: 44px;
- border-radius: 50%;
- background: #107c41;
- border: 2px solid #fff;
- font-size: 0.80rem;
- font-weight: 900;
}
-.pad-main-row {
+.center-sys-container {
display: flex;
- justify-content: space-around;
align-items: center;
- gap: 12px;
- margin-top: 8px;
+ justify-content: center;
+ gap: 6px;
width: 100%;
+ height: 100%;
}
-.pad-side {
- flex: 1 1 0;
- display: flex;
- flex-direction: column;
- align-items: center;
- gap: 14px;
-}
-.dpad-cross {
- position: relative;
- width: 136px;
- height: 136px;
-}
-.dpad-btn {
- position: absolute;
- width: 44px;
- height: 44px;
+.pad-btn-sys {
+ padding: 4px 10px;
+ font-size: 11px;
+ font-weight: 800;
+ height: 36px;
border-radius: 8px;
- font-size: 1.1rem;
}
-.dpad-up { top: 0; left: 46px; }
-.dpad-down { bottom: 0; left: 46px; }
-.dpad-left { top: 46px; left: 0; }
-.dpad-right { top: 46px; right: 0; }
-.dpad-center {
- position: absolute;
- top: 46px; left: 46px;
- width: 44px; height: 44px;
- background: var(--surface);
-}
-.abxy-group {
- position: relative;
- width: 136px;
- height: 136px;
-}
-.abxy-btn {
- position: absolute;
- width: 44px;
- height: 44px;
+.pad-btn-nexus-btn {
+ width: 38px;
+ height: 38px;
border-radius: 50%;
- font-size: 1.15rem;
+ background: #107c41;
+ border: 2px solid #ffffff;
font-weight: 900;
- color: #fff;
-}
-.btn-y { top: 0; left: 46px; background: #c68900; border-color: #ffc400; }
-.btn-a { bottom: 0; left: 46px; background: #0e6b37; border-color: #107c41; }
-.btn-x { top: 46px; left: 0; background: #006eb8; border-color: #00a2ed; }
-.btn-b { top: 46px; right: 0; background: #b80d1b; border-color: #e81123; }
-.stick-zone {
- position: relative;
- width: 110px;
- height: 110px;
- border-radius: 50%;
- background: var(--surface-alt);
- border: 2px solid var(--border);
- touch-action: none;
+ font-size: 12px;
+ color: #ffffff;
+ box-shadow: 0 4px 10px rgba(0,0,0,0.6);
display: flex;
align-items: center;
justify-content: center;
+ cursor: pointer;
+ touch-action: none;
+ flex-shrink: 0;
}
-.stick-head {
- width: 50px;
- height: 50px;
- border-radius: 50%;
- background: radial-gradient(circle at 35% 35%, #3a445e, #1c2130);
- border: 2px solid #58688a;
- box-shadow: 0 4px 8px rgba(0,0,0,0.5);
- pointer-events: none;
- transform: translate(0px, 0px);
+.pad-btn-nexus-btn:active, .pad-btn-nexus-btn.pressed {
+ transform: scale(0.92);
+ filter: brightness(1.2);
+}
+
+/* Player Bar Styling (Clean minimalist capsule matching studio) */
+.player-bar-container {
display: flex;
align-items: center;
justify-content: center;
- font-size: 0.70rem;
+ gap: 5px;
+ background: rgba(15, 23, 42, 0.9);
+ padding: 3px 6px;
+ border-radius: 12px;
+ border: 1px solid #1e293b;
+ width: 100%;
+ height: 100%;
+}
+.player-pill {
+ padding: 3px 8px;
+ font-size: 11px;
font-weight: 800;
- color: var(--text-dim);
+ border-radius: 8px;
+ background: transparent;
+ color: #94a3b8;
+ border: none;
+ cursor: pointer;
+ transition: all 0.1s;
+}
+.player-pill.active {
+ background: #107c41;
+ color: #ffffff;
+ box-shadow: 0 0 8px rgba(16, 124, 65, 0.6);
+}
+.fs-only-exit { display: none; }
+
+/* Portrait Layout Positions (Exact Layout Studio Alignment) */
+#gamepadArea {
+ width: 412px !important;
+ min-width: 412px !important;
+ max-width: 412px !important;
+ flex-shrink: 0 !important;
+ height: 680px;
+}
+#gamepadArea #mod_player_bar { left: 130px; top: 10px; width: 152px !important; height: 44px; transform: scale(1.0); }
+#gamepadArea #mod_center_sys { left: 115px; top: 62px; width: 182px; height: 56px; transform: scale(1.0); }
+#gamepadArea #mod_btn_ls { left: 16px; top: 132px; width: 56px; height: 52px; transform: scale(1.25); }
+#gamepadArea #mod_btn_rs { left: 340px; top: 132px; width: 56px; height: 52px; transform: scale(1.25); }
+#gamepadArea #mod_btn_lt { left: 10px; top: 206px; width: 98px; height: 56px; transform: scale(1.0); }
+#gamepadArea #mod_btn_lb { left: 116px; top: 207px; width: 78px; height: 52px; transform: scale(1.0); }
+#gamepadArea #mod_btn_rb { left: 218px; top: 207px; width: 78px; height: 52px; transform: scale(1.0); }
+#gamepadArea #mod_btn_rt { left: 304px; top: 206px; width: 98px; height: 56px; transform: scale(1.0); }
+#gamepadArea #mod_stick_left { left: 21px; top: 282px; width: 166px; height: 166px; transform: scale(1.15); }
+#gamepadArea #mod_abxy { left: 218px; top: 282px; width: 176px; height: 176px; transform: scale(1.15); }
+#gamepadArea #mod_dpad { left: 19px; top: 488px; width: 160px !important; height: 160px; transform: scale(1.0); }
+#gamepadArea #mod_stick_right { left: 225px; top: 490px; width: 166px; height: 166px; transform: scale(1.0); }
+
+/* Responsive scale wrapper for Portrait */
+@media (orientation: portrait), (max-width: 600px) and (orientation: portrait) {
+ .gamepad-viewport-wrapper {
+ height: calc(680px * var(--gp-scale, 0.82));
+ }
+ #gamepadArea {
+ transform: scale(var(--gp-scale, 0.82));
+ transform-origin: top center;
+ }
+}
+
+/* Landscape Layout Positions (Exact Layout Studio Alignment) */
+@media (orientation: landscape), (max-height: 520px) {
+ .gamepad-status-bar {
+ display: none !important;
+ }
+ .gamepad-viewport-wrapper {
+ height: calc(412px * var(--gp-scale, 0.8));
+ min-height: calc(412px * var(--gp-scale, 0.8));
+ display: flex;
+ justify-content: center;
+ align-items: flex-start;
+ overflow: hidden;
+ }
+ #gamepadArea {
+ width: 915px !important;
+ min-width: 915px !important;
+ max-width: 915px !important;
+ flex-shrink: 0 !important;
+ height: 412px !important;
+ transform: scale(var(--gp-scale, 0.8));
+ transform-origin: top center !important;
+ }
+ #gamepadArea #mod_btn_lt { left: 10px; top: 10px; width: 94px; height: 54px; transform: scale(1.0); }
+ #gamepadArea #mod_btn_lb { left: 110px; top: 11px; width: 76px; height: 52px; transform: scale(1.0); }
+ #gamepadArea #mod_btn_ls { left: 192px; top: 11px; width: 54px; height: 52px; transform: scale(1.0); }
+ #gamepadArea #mod_player_bar { left: 381px; top: 12px; width: 152px !important; height: 44px; transform: scale(1.0); }
+ #gamepadArea #mod_center_sys { left: 342px; top: 66px; width: 230px; height: 56px; transform: scale(1.0); }
+ #gamepadArea #mod_btn_rs { left: 669px; top: 11px; width: 54px; height: 52px; transform: scale(1.0); }
+ #gamepadArea #mod_btn_rb { left: 729px; top: 11px; width: 76px; height: 52px; transform: scale(1.0); }
+ #gamepadArea #mod_btn_rt { left: 811px; top: 10px; width: 94px; height: 54px; transform: scale(1.0); }
+ #gamepadArea #mod_stick_left { left: 32px; top: 97px; width: 166px; height: 166px; transform: scale(1.3); }
+ #gamepadArea #mod_abxy { left: 712px; top: 97px; width: 176px; height: 176px; transform: scale(1.3); }
+ #gamepadArea #mod_dpad { left: 205px; top: 242px; width: 160px !important; height: 160px; transform: scale(1.05); }
+ #gamepadArea #mod_stick_right { left: 545px; top: 240px; width: 166px; height: 166px; transform: scale(1.2); }
+}
+
+/* Fullscreen Mode (Landscape) */
+#gamepadCard.gamepad-fullscreen, #gamepadCard:fullscreen, #gamepadCard:-webkit-full-screen {
+ position: fixed !important;
+ inset: 0 !important;
+ width: 100vw !important;
+ height: 100dvh !important;
+ max-width: 100vw !important;
+ margin: 0 !important;
+ border-radius: 0 !important;
+ border: none !important;
+ z-index: 9999 !important;
+ background: radial-gradient(circle at 50% 35%, #161c2c 0%, #090b11 100%) !important;
+ padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 14px) env(safe-area-inset-bottom, 8px) env(safe-area-inset-left, 14px) !important;
+ display: flex !important;
+ align-items: center !important;
+ justify-content: center !important;
+ overflow: hidden !important;
+}
+#gamepadCard.gamepad-fullscreen .gamepad-intro,
+#gamepadCard:fullscreen .gamepad-intro,
+#gamepadCard:-webkit-full-screen .gamepad-intro,
+#gamepadCard.gamepad-fullscreen .gamepad-status-bar,
+#gamepadCard:fullscreen .gamepad-status-bar,
+#gamepadCard:-webkit-full-screen .gamepad-status-bar {
+ display: none !important;
+}
+#gamepadCard.gamepad-fullscreen .fs-only-exit,
+#gamepadCard:fullscreen .fs-only-exit,
+#gamepadCard:-webkit-full-screen .fs-only-exit {
+ display: inline-flex !important;
+}
+#gamepadCard.gamepad-fullscreen .gamepad-viewport-wrapper,
+#gamepadCard:fullscreen .gamepad-viewport-wrapper,
+#gamepadCard:-webkit-full-screen .gamepad-viewport-wrapper {
+ width: calc(915px * var(--gp-fs-scale, 0.85)) !important;
+ height: calc(412px * var(--gp-fs-scale, 0.85)) !important;
+ max-width: 100% !important;
+ max-height: 100% !important;
+ display: flex !important;
+ align-items: flex-start !important;
+ justify-content: center !important;
+ overflow: hidden !important;
+ position: relative !important;
+}
+#gamepadCard.gamepad-fullscreen #gamepadArea,
+#gamepadCard:fullscreen #gamepadArea,
+#gamepadCard:-webkit-full-screen #gamepadArea {
+ width: 915px !important;
+ min-width: 915px !important;
+ max-width: 915px !important;
+ flex-shrink: 0 !important;
+ height: 412px !important;
+ transform: scale(var(--gp-fs-scale, 0.85)) !important;
+ transform-origin: top center !important;
+}
+#gamepadCard.gamepad-fullscreen #mod_btn_lt { left: 10px !important; top: 10px !important; width: 94px !important; height: 54px !important; transform: scale(1.0) !important; }
+#gamepadCard.gamepad-fullscreen #mod_btn_lb { left: 110px !important; top: 11px !important; width: 76px !important; height: 52px !important; transform: scale(1.0) !important; }
+#gamepadCard.gamepad-fullscreen #mod_btn_ls { left: 192px !important; top: 11px !important; width: 54px !important; height: 52px !important; transform: scale(1.0) !important; }
+#gamepadCard.gamepad-fullscreen #mod_player_bar { left: 381px !important; top: 12px !important; width: 152px !important; height: 44px !important; transform: scale(1.0) !important; }
+#gamepadCard.gamepad-fullscreen #mod_center_sys { left: 342px !important; top: 66px !important; width: 230px !important; height: 56px !important; transform: scale(1.0) !important; }
+#gamepadCard.gamepad-fullscreen #mod_btn_rs { left: 669px !important; top: 11px !important; width: 54px !important; height: 52px !important; transform: scale(1.0) !important; }
+#gamepadCard.gamepad-fullscreen #mod_btn_rb { left: 729px !important; top: 11px !important; width: 76px !important; height: 52px !important; transform: scale(1.0) !important; }
+#gamepadCard.gamepad-fullscreen #mod_btn_rt { left: 811px !important; top: 10px !important; width: 94px !important; height: 54px !important; transform: scale(1.0) !important; }
+#gamepadCard.gamepad-fullscreen #mod_stick_left { left: 32px !important; top: 97px !important; width: 166px !important; height: 166px !important; transform: scale(1.3) !important; }
+#gamepadCard.gamepad-fullscreen #mod_abxy { left: 712px !important; top: 97px !important; width: 176px !important; height: 176px !important; transform: scale(1.3) !important; }
+#gamepadCard.gamepad-fullscreen #mod_dpad { left: 205px !important; top: 242px !important; width: 160px !important; height: 160px !important; transform: scale(1.05) !important; }
+#gamepadCard.gamepad-fullscreen #mod_stick_right { left: 545px !important; top: 240px !important; width: 166px !important; height: 166px !important; transform: scale(1.2) !important; }
+
+@media (max-width: 600px) {
+ .nav-tabs { grid-template-columns: repeat(3, 1fr); }
+ .nav-tab { padding: 9px 4px; font-size: 0.74rem; }
+ .telemetry-grid { grid-template-columns: repeat(2, 1fr); }
+ .content { padding-left: 6px; padding-right: 6px; }
+ #tab-gamepad #gamepadCard { padding-left: 2px; padding-right: 2px; }
+}
+
+@media (orientation: landscape), (max-height: 520px) {
+ .nav-tabs {
+ grid-template-columns: repeat(6, 1fr);
+ gap: 4px;
+ }
+ .nav-tab {
+ min-height: 36px;
+ padding: 5px 2px;
+ font-size: 0.72rem;
+ }
+ header {
+ display: none !important;
+ }
+ .content {
+ max-width: 960px;
+ margin: 2px auto 0 auto;
+ padding: 0 4px 6px 4px;
+ }
+ .card {
+ padding: 4px 8px;
+ margin-bottom: 0 !important;
+ }
+ .card h2 {
+ font-size: 0.88rem;
+ margin-bottom: 4px;
+ }
+ .card p {
+ font-size: 0.76rem;
+ margin-bottom: 6px;
+ }
+ .gamepad-intro {
+ display: block;
+ margin-bottom: 2px;
+ }
+ .gamepad-toolbar {
+ margin-bottom: 2px;
+ justify-content: flex-end;
+ }
+ .gamepad-status-bar {
+ display: none !important;
+ }
}
</style>
</head>
@@ -525,7 +862,7 @@ input:checked + .slider-sw:before { transform: translateX(20px); }
</div>
<!-- TAB: SEARCH -->
- <div id="tab-search" class="tab-pane">
+ <div id="tab-search" class="tab-pane active">
<div class="card" id="searchCard" style="position: relative;">
<div id="searchOverlay" class="search-disabled-overlay" style="display: none;">
<div class="msg">🔒 Desativado enquanto jogando</div>
@@ -648,6 +985,7 @@ input:checked + .slider-sw:before { transform: translateX(20px); }
<div class="subnav">
<button class="btn active" id="btnSubPad" onclick="switchRemapSub('pad')">🎮 DualSense</button>
<button class="btn" id="btnSubKey" onclick="switchRemapSub('key')">⌨️ Teclado</button>
+ <button class="btn" id="btnSubTouch" onclick="switchRemapSub('touch')">👆 Touchpad</button>
</div>
<div id="subRemapPad">
@@ -673,77 +1011,124 @@ input:checked + .slider-sw:before { transform: translateX(20px); }
</div>
</div>
</div>
+
+ <div id="subRemapTouch" style="display:none;">
+ <div class="card">
+ <h2>👆 Atalhos do Touchpad (DualSense)</h2>
+ <p>Configure o que cada gesto (deslizar) ou clique físico (lado esquerdo/direito) no touchpad faz durante o streaming. <strong>Touchpad + Options</strong> permanece sempre fixo para abrir o Menu do Jogo.</p>
+ <div class="grid-map" id="remapTouchpadShortcutsGrid"></div>
+ <div class="btn-row">
+ <button class="btn btn-primary" onclick="saveSettings()">Salvar no Console</button>
+ <button class="btn" onclick="resetTouchpadShortcuts()">Restaurar Touchpad Padrão</button>
+ </div>
+ </div>
+ </div>
</div>
<!-- TAB: GAMEPAD (CONTROLE VIRTUAL) -->
<div id="tab-gamepad" class="tab-pane" style="display:none;">
- <div class="card">
- <h2>🎮 Controle Virtual (Smartphone)</h2>
- <p>Use o celular como controle tátil responsivo. Alterne entre Jogador 1 (principal) e Jogador 2 (co-op local)!</p>
-
- <div class="player-select-row">
- <button type="button" class="player-btn active" id="btnPlayer1" onclick="setVirtualPlayer(1)">
- 👤 Jogador 1 (Principal)
- </button>
- <button type="button" class="player-btn" id="btnPlayer2" onclick="setVirtualPlayer(2)">
- 👥 Jogador 2 (Co-op Local)
- </button>
+ <div class="card" id="gamepadCard">
+ <div class="gamepad-intro">
+ <div class="gamepad-toolbar">
+ <button type="button" class="btn btn-primary" id="btnFullscreenPad" onclick="toggleGamepadFullscreen()" style="padding: 6px 12px; font-size: 0.78rem;">
+ ⛶ Tela Cheia
+ </button>
+ </div>
</div>
- <div class="gamepad-container" id="gamepadArea">
- <!-- Top row: Bumpers / Triggers / Center -->
- <div class="pad-top-row">
- <div class="pad-bumper-group">
- <button type="button" class="pad-btn pad-btn-sm" id="btn_lt" data-btn="triggerL2">LT</button>
- <button type="button" class="pad-btn pad-btn-sm" id="btn_lb" data-btn="btnL1">LB</button>
- <button type="button" class="pad-btn pad-btn-sm" id="btn_ls" data-btn="btnL3">LS (L3)</button>
- </div>
- <div class="pad-center-group">
- <button type="button" class="pad-btn pad-btn-center" id="btn_view" data-btn="btnView">VIEW</button>
- <button type="button" class="pad-btn pad-btn-nexus" id="btn_nexus" data-btn="btnNexus">X</button>
- <button type="button" class="pad-btn pad-btn-center" id="btn_menu" data-btn="btnMenu">MENU</button>
+ <div class="gamepad-viewport-wrapper" id="gamepadScaleContainer">
+ <div class="gamepad-container" id="gamepadArea">
+
+ <!-- MODULE 1: Left Stick -->
+ <div id="mod_stick_left" class="gamepad-module">
+ <div class="stick-base" id="leftStickZone">
+ <div class="stick-head" id="leftStickHead"></div>
+ </div>
</div>
- <div class="pad-bumper-group">
- <button type="button" class="pad-btn pad-btn-sm" id="btn_rt" data-btn="triggerR2">RT</button>
- <button type="button" class="pad-btn pad-btn-sm" id="btn_rb" data-btn="btnR1">RB</button>
- <button type="button" class="pad-btn pad-btn-sm" id="btn_rs" data-btn="btnR3">RS (R3)</button>
+
+ <!-- MODULE 2: D-Pad -->
+ <div id="mod_dpad" class="gamepad-module">
+ <div class="dpad-container" id="box_dpad">
+ <div class="dpad-arm dpad-arm-up" data-btn="dpadUp">▲</div>
+ <div class="dpad-arm dpad-arm-left" data-btn="dpadLeft">◀</div>
+ <div class="dpad-mid"></div>
+ <div class="dpad-arm dpad-arm-right" data-btn="dpadRight">▶</div>
+ <div class="dpad-arm dpad-arm-down" data-btn="dpadDown">▼</div>
+ </div>
</div>
- </div>
- <!-- Main row: Left (D-pad & Left Stick) and Right (ABXY & Right Stick) -->
- <div class="pad-main-row">
- <div class="pad-side">
- <!-- Left Stick -->
- <div class="stick-zone" id="leftStickZone">
- <div class="stick-head" id="leftStickHead">L3</div>
+ <!-- MODULE 3: ABXY Diamond -->
+ <div id="mod_abxy" class="gamepad-module">
+ <div class="abxy-container" id="box_abxy">
+ <div class="abxy-key btn-y" data-btn="btnY">Y</div>
+ <div class="abxy-key btn-x" data-btn="btnX">X</div>
+ <div class="abxy-key btn-b" data-btn="btnB">B</div>
+ <div class="abxy-key btn-a" data-btn="btnA">A</div>
</div>
- <!-- D-Pad -->
- <div class="dpad-cross">
- <button type="button" class="pad-btn dpad-btn dpad-up" data-btn="dpadUp">▲</button>
- <button type="button" class="pad-btn dpad-btn dpad-left" data-btn="dpadLeft">◀</button>
- <div class="dpad-center"></div>
- <button type="button" class="pad-btn dpad-btn dpad-right" data-btn="dpadRight">▶</button>
- <button type="button" class="pad-btn dpad-btn dpad-down" data-btn="dpadDown">▼</button>
+ </div>
+
+ <!-- MODULE 4: Right Stick -->
+ <div id="mod_stick_right" class="gamepad-module">
+ <div class="stick-base" id="rightStickZone">
+ <div class="stick-head" id="rightStickHead"></div>
</div>
</div>
- <div class="pad-side">
- <!-- ABXY Buttons -->
- <div class="abxy-group">
- <button type="button" class="pad-btn abxy-btn btn-y" data-btn="btnY">Y</button>
- <button type="button" class="pad-btn abxy-btn btn-x" data-btn="btnX">X</button>
- <button type="button" class="pad-btn abxy-btn btn-b" data-btn="btnB">B</button>
- <button type="button" class="pad-btn abxy-btn btn-a" data-btn="btnA">A</button>
+ <!-- INDIVIDUAL SHOULDER & TRIGGER BUTTONS -->
+ <!-- MODULE 5: LT Trigger -->
+ <div id="mod_btn_lt" class="gamepad-module pad-bumper-left">
+ <button type="button" class="pad-btn pad-btn-trigger" id="btn_lt" data-btn="triggerL2">LT</button>
+ </div>
+
+ <!-- MODULE 6: LB Bumper -->
+ <div id="mod_btn_lb" class="gamepad-module pad-bumper-left">
+ <button type="button" class="pad-btn pad-btn-bumper" id="btn_lb" data-btn="btnL1">LB</button>
+ </div>
+
+ <!-- MODULE 7: LS Button -->
+ <div id="mod_btn_ls" class="gamepad-module pad-bumper-left">
+ <button type="button" class="pad-btn pad-btn-stick-click pad-btn-stick-btn" id="btn_ls" data-btn="btnL3">LS</button>
+ </div>
+
+ <!-- MODULE 8: RS Button -->
+ <div id="mod_btn_rs" class="gamepad-module pad-bumper-right">
+ <button type="button" class="pad-btn pad-btn-stick-click pad-btn-stick-btn" id="btn_rs" data-btn="btnR3">RS</button>
+ </div>
+
+ <!-- MODULE 9: RB Bumper -->
+ <div id="mod_btn_rb" class="gamepad-module pad-bumper-right">
+ <button type="button" class="pad-btn pad-btn-bumper" id="btn_rb" data-btn="btnR1">RB</button>
+ </div>
+
+ <!-- MODULE 10: RT Trigger -->
+ <div id="mod_btn_rt" class="gamepad-module pad-bumper-right">
+ <button type="button" class="pad-btn pad-btn-trigger" id="btn_rt" data-btn="triggerR2">RT</button>
+ </div>
+
+ <!-- MODULE 11: Center System Buttons (VIEW, X, MENU) -->
+ <div id="mod_center_sys" class="gamepad-module">
+ <div class="center-sys-container">
+ <button type="button" class="pad-btn pad-btn-sys" id="btn_view" data-btn="btnView">VIEW</button>
+ <button type="button" class="pad-btn-nexus-btn" id="btn_nexus" data-btn="btnNexus">X</button>
+ <button type="button" class="pad-btn pad-btn-sys" id="btn_menu" data-btn="btnMenu">MENU</button>
+ <button type="button" class="pad-btn pad-btn-sys fs-only-exit" id="btn_exit_fs" onclick="toggleGamepadFullscreen()" style="background:#451a1a;border-color:#b91c1c;color:#fca5a5;">✕ Sair</button>
</div>
- <!-- Right Stick -->
- <div class="stick-zone" id="rightStickZone">
- <div class="stick-head" id="rightStickHead">R3</div>
+ </div>
+
+ <!-- MODULE 12: Player Selector (P1..P4) -->
+ <div id="mod_player_bar" class="gamepad-module">
+ <div class="player-bar-container">
+ <button type="button" class="player-pill active" id="btnPlayer1" onclick="setVirtualPlayer(1)">P1</button>
+ <button type="button" class="player-pill" id="btnPlayer2" onclick="setVirtualPlayer(2)">P2</button>
+ <button type="button" class="player-pill" id="btnPlayer3" onclick="setVirtualPlayer(3)">P3</button>
+ <button type="button" class="player-pill" id="btnPlayer4" onclick="setVirtualPlayer(4)">P4</button>
</div>
</div>
+
</div>
</div>
- <div class="status-pill" style="margin-top: 14px;">
+ <div class="status-pill gamepad-status-bar" style="margin-top: 10px;">
<div class="status-dot"></div>
<span id="gamepadStatus">Controle ativo para Jogador 1 (Principal)</span>
</div>
@@ -753,13 +1138,34 @@ input:checked + .slider-sw:before { transform: translateX(20px); }
<!-- 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;">
+ <h2>🐛 Enviar Relatório de Erro (GitHub)</h2>
+ <p>Gere um relatório completo da sessão atual com logs sanitizados (sem dados privados, e-mails ou tokens) formatado automaticamente para o repositório oficial no GitHub.</p>
+
+ <div class="form-group" style="margin-bottom: 10px;">
+ <label for="reportTitle" style="font-weight: 600; font-size: 0.82rem; display: block; margin-bottom: 4px;">Título do Problema (Opcional):</label>
+ <input type="text" id="reportTitle" class="form-control" placeholder="Ex: Queda de transmissão ou erro de áudio" style="width: 100%; box-sizing: border-box; padding: 8px 10px; background: var(--surface-alt); border: 1px solid var(--border); border-radius: 8px; color: #fff; font-size: 0.85rem;">
+ </div>
+
+ <div class="form-group" style="margin-bottom: 12px;">
+ <label for="reportWhat" style="font-weight: 600; font-size: 0.82rem; display: block; margin-bottom: 4px;">O que aconteceu? (Opcional):</label>
+ <textarea id="reportWhat" class="form-control" rows="2" placeholder="Descreva brevemente o que você estava fazendo quando o erro ocorreu..." style="width: 100%; box-sizing: border-box; padding: 8px 10px; background: var(--surface-alt); border: 1px solid var(--border); border-radius: 8px; color: #fff; font-size: 0.85rem; resize: vertical;"></textarea>
+ </div>
+
+ <div class="btn-row" style="margin-top: 0; margin-bottom: 8px; gap: 8px; display: flex; flex-wrap: wrap;">
+ <button type="button" class="btn btn-primary" onclick="openGitHubReport()" id="btnOpenReport">🚀 Abrir Relatório no GitHub</button>
+ <button type="button" class="btn" onclick="copySanitizedReport()" id="btnCopyReport">📋 Copiar Relatório</button>
+ <button type="button" class="btn" onclick="previewReport()" id="btnPreviewReport">🔍 Pré-visualizar</button>
+ </div>
+ </div>
+
+ <div class="card">
+ <h2>📋 Download de Logs Cru</h2>
+ <p>Baixe o arquivo <code>xcloud.log</code> sanitizado (sem tokens ou dados privados) para inspeção local ou envio manual.</p>
+ <div class="btn-row" style="margin-top: 0; margin-bottom: 14px; gap: 8px; display: flex; flex-wrap: wrap;">
<a href="/api/log" download="xcloud.log" class="btn btn-primary">⬇️ Baixar xcloud.log</a>
- <button class="btn" onclick="loadLogPreview()">Visualizar Últimas Linhas</button>
+ <button type="button" class="btn" onclick="loadLogPreview()">Visualizar Últimas Linhas</button>
</div>
- <pre id="logPreview">Clique em "Visualizar Últimas Linhas" para carregar o log...</pre>
+ <pre id="logPreview">Clique em "Visualizar Últimas Linhas" ou "Pré-visualizar" para inspecionar os dados...</pre>
</div>
</div>
</div>
@@ -779,6 +1185,48 @@ const padSources = [
{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 touchpadTriggers = [
+ {key: "swipeUp", label: "Deslizar ↑ (Cima)"},
+ {key: "swipeDown", label: "Deslizar ↓ (Baixo)"},
+ {key: "swipeLeft", label: "Deslizar ← (Esquerda)"},
+ {key: "swipeRight", label: "Deslizar → (Direita)"},
+ {key: "clickLeft", label: "Clique Esquerdo"},
+ {key: "clickRight", label: "Clique Direito"}
+];
+
+const touchpadActions = [
+ {id: "none", name: "Desativado"},
+ {id: "game_menu", name: "Menu do Jogo"},
+ {id: "xbox_button", name: "Botão Xbox (Guia)"},
+ {id: "toggle_stats", name: "Alternar Telemetria"},
+ {id: "toggle_mic_mute", name: "Silenciar Microfone"},
+ {id: "cycle_gyro", name: "Alternar Giroscópio"},
+ {id: "cycle_trigger_profile", name: "Alternar Perfil de Gatilho"},
+ {id: "view", name: "View"},
+ {id: "menu", name: "Menu"},
+ {id: "l3", name: "LS (L3)"},
+ {id: "r3", name: "RS (R3)"},
+ {id: "a", name: "A (Cruz)"},
+ {id: "b", name: "B (Círculo)"},
+ {id: "x", name: "X (Quadrado)"},
+ {id: "y", name: "Y (Triângulo)"},
+ {id: "lb", name: "LB (L1)"},
+ {id: "rb", name: "RB (R1)"},
+ {id: "dpad_up", name: "D-pad Cima"},
+ {id: "dpad_down", name: "D-pad Baixo"},
+ {id: "dpad_left", name: "D-pad Esquerda"},
+ {id: "dpad_right", name: "D-pad Direita"}
+];
+
+const defaultTouchpadShortcuts = {
+ swipeUp: "xbox_button",
+ swipeDown: "game_menu",
+ swipeLeft: "game_menu",
+ swipeRight: "xbox_button",
+ clickLeft: "view",
+ clickRight: "view"
+};
+
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",
@@ -818,8 +1266,10 @@ const defaultKeyMap = [
let currentSettings = {
padMap: [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15],
- keyMap: [...defaultKeyMap]
+ keyMap: [...defaultKeyMap],
+ touchpadShortcuts: {...defaultTouchpadShortcuts}
};
+let lastSettingsVersion = 0;
let currentSearchTab = 'gamepass';
let currentFilters = {
@@ -838,14 +1288,24 @@ let currentFilters = {
};
function switchTab(name) {
- document.querySelectorAll('.tab-pane').forEach(el => el.style.display = 'none');
+ document.querySelectorAll('.tab-pane').forEach(el => {
+ el.style.display = 'none';
+ el.classList.remove('active');
+ });
document.querySelectorAll('.nav-tab').forEach(el => el.classList.remove('active'));
const pane = document.getElementById('tab-' + name);
- if (pane) pane.style.display = 'block';
+ if (pane) {
+ pane.style.display = 'block';
+ pane.classList.add('active');
+ }
const tabBtn = document.getElementById('navTab-' + name);
if (tabBtn) tabBtn.classList.add('active');
if (name === 'search') pollStreamingState();
- if (name === 'gamepad') sendPadState();
+ if (name === 'gamepad') {
+ sendPadState(true);
+ updateGamepadScale();
+ setTimeout(updateGamepadScale, 10);
+ }
if (name === 'stream') {
loadStreamMenuState();
pollStats();
@@ -855,8 +1315,12 @@ function switchTab(name) {
function switchRemapSub(mode) {
document.getElementById('subRemapPad').style.display = mode === 'pad' ? 'block' : 'none';
document.getElementById('subRemapKey').style.display = mode === 'key' ? 'block' : 'none';
+ const subTouch = document.getElementById('subRemapTouch');
+ if (subTouch) subTouch.style.display = mode === 'touch' ? 'block' : 'none';
document.getElementById('btnSubPad').classList.toggle('active', mode === 'pad');
document.getElementById('btnSubKey').classList.toggle('active', mode === 'key');
+ const btnTouch = document.getElementById('btnSubTouch');
+ if (btnTouch) btnTouch.classList.toggle('active', mode === 'touch');
}
function showToast(msg) {
@@ -1006,10 +1470,71 @@ function clearSearch() {
sendSearch(true);
}
+function renderTouchpadShortcutsGrid(containerId, idPrefix, tsObj, onChangeFn) {
+ const grid = document.getElementById(containerId);
+ if (!grid) return;
+ grid.innerHTML = '';
+ const ts = Object.assign({}, defaultTouchpadShortcuts, tsObj || {});
+ touchpadTriggers.forEach(trig => {
+ const item = document.createElement('div');
+ item.className = 'map-item';
+ const label = document.createElement('label');
+ label.textContent = trig.label;
+ const select = document.createElement('select');
+ select.id = idPrefix + '_' + trig.key;
+ touchpadActions.forEach((act, idx) => {
+ const opt = document.createElement('option');
+ opt.value = act.id;
+ opt.textContent = act.name;
+ if (ts[trig.key] === act.id || ts[trig.key] === idx) opt.selected = true;
+ select.appendChild(opt);
+ });
+ select.addEventListener('change', () => {
+ currentSettings.touchpadShortcuts = currentSettings.touchpadShortcuts || {...defaultTouchpadShortcuts};
+ currentSettings.touchpadShortcuts[trig.key] = select.value;
+ syncTouchpadSelects(trig.key, select.value);
+ if (onChangeFn) onChangeFn(trig.key, select.value);
+ });
+ item.appendChild(label);
+ item.appendChild(select);
+ grid.appendChild(item);
+ });
+}
+
+function syncTouchpadSelects(trigKey, val) {
+ ['tp_remap_'].forEach(prefix => {
+ const el = document.getElementById(prefix + trigKey);
+ if (el && el.value !== String(val)) el.value = val;
+ });
+}
+
+function readTouchpadShortcutsFromPrefix(prefix) {
+ const out = {...defaultTouchpadShortcuts};
+ touchpadTriggers.forEach(trig => {
+ const el = document.getElementById(prefix + '_' + trig.key);
+ if (el) out[trig.key] = el.value;
+ });
+ return out;
+}
+
+function renderAllTouchpadGrids(tsObj) {
+ const ts = Object.assign({}, defaultTouchpadShortcuts, tsObj || currentSettings.touchpadShortcuts || {});
+ currentSettings.touchpadShortcuts = ts;
+ renderTouchpadShortcutsGrid('remapTouchpadShortcutsGrid', 'tp_remap', ts, null);
+}
+
+function resetTouchpadShortcuts() {
+ currentSettings.touchpadShortcuts = {...defaultTouchpadShortcuts};
+ renderAllTouchpadGrids(currentSettings.touchpadShortcuts);
+ saveSettings();
+}
+
function renderPadMap() {
const grid = document.getElementById('padGrid');
grid.innerHTML = '';
- const map = currentSettings.padMap || [];
+ const map = Array.isArray(currentSettings.padMap) ? currentSettings.padMap
+ : (currentSettings.padMap && Array.isArray(currentSettings.padMap.map)) ? currentSettings.padMap.map
+ : [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15];
padFunctions.forEach((fnName, idx) => {
const item = document.createElement('div');
item.className = 'map-item';
@@ -1093,10 +1618,11 @@ function saveSettings() {
keyMap.push(s0 ? parseInt(s0.value, 10) : 0);
keyMap.push(s1 ? parseInt(s1.value, 10) : 0);
}
+ const touchpadShortcuts = readTouchpadShortcutsFromPrefix('tp_remap');
fetch('/api/settings', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
- body: JSON.stringify({ padMap: padMap, keyMap: keyMap })
+ body: JSON.stringify({ padMap: padMap, keyMap: keyMap, touchpadShortcuts: touchpadShortcuts })
}).then(r => r.json()).then(res => {
if (res.ok) {
showToast('Configurações salvas no console!');
@@ -1160,6 +1686,8 @@ function sendStreamParam(param, val) {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify(body)
+ }).then(r => r.json()).then(res => {
+ if (res && res.ok) showToast('Aplicado na transmissão!');
}).catch(() => {});
}
@@ -1198,6 +1726,9 @@ function loadStreamMenuState() {
const el = document.getElementById('selectSmartTriggers');
if (el) el.value = s.triggerProfile;
}
+ if (s.touchpadShortcuts) {
+ renderAllTouchpadGrids(s.touchpadShortcuts);
+ }
}).catch(() => {});
}
@@ -1258,44 +1789,172 @@ function loadLogPreview() {
});
}
-fetch('/api/settings').then(r => r.json()).then(s => {
- currentSettings = s;
- if (s.query) searchInput.value = s.query;
+function getReportParams() {
+ const title = (document.getElementById('reportTitle')?.value || '').trim();
+ const what = (document.getElementById('reportWhat')?.value || '').trim();
+ return { title, what };
+}
+
+function openGitHubReport() {
+ const { title, what } = getReportParams();
+ const btn = document.getElementById('btnOpenReport');
+ btn.disabled = true;
+ btn.textContent = 'Gerando link...';
+ fetch('/api/report-issue', {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({ title, what })
+ }).then(r => r.json()).then(data => {
+ btn.disabled = false;
+ btn.textContent = '🚀 Abrir Relatório no GitHub';
+ if (data && data.url) {
+ window.open(data.url, '_blank');
+ showToast('Formulário do GitHub aberto em nova aba!');
+ } else {
+ showToast('Erro ao obter link do relatório.');
+ }
+ }).catch(e => {
+ btn.disabled = false;
+ btn.textContent = '🚀 Abrir Relatório no GitHub';
+ showToast('Falha na requisição: ' + e);
+ });
+}
+
+function fallbackCopyText(text) {
+ return new Promise((resolve, reject) => {
+ try {
+ const ta = document.createElement('textarea');
+ ta.value = text;
+ ta.style.position = 'fixed';
+ ta.style.top = '0';
+ ta.style.left = '0';
+ ta.style.width = '2em';
+ ta.style.height = '2em';
+ ta.style.padding = '0';
+ ta.style.border = 'none';
+ ta.style.outline = 'none';
+ ta.style.boxShadow = 'none';
+ ta.style.background = 'transparent';
+ ta.style.opacity = '0.01';
+ document.body.appendChild(ta);
+ ta.focus();
+ ta.select();
+ if (typeof ta.setSelectionRange === 'function') {
+ ta.setSelectionRange(0, text.length);
+ }
+ let ok = false;
+ try {
+ ok = document.execCommand('copy');
+ } catch (_) {
+ ok = false;
+ }
+ document.body.removeChild(ta);
+ if (ok) resolve(); else reject(new Error('execCommand copy failed'));
+ } catch (e) { reject(e); }
+ });
+}
+
+function copyTextToClipboard(text) {
+ if (navigator.clipboard && window.isSecureContext && navigator.clipboard.writeText) {
+ return navigator.clipboard.writeText(text).catch(() => fallbackCopyText(text));
+ }
+ return fallbackCopyText(text);
+}
+
+function copySanitizedReport() {
+ const { title, what } = getReportParams();
+ const btn = document.getElementById('btnCopyReport');
+ btn.disabled = true;
+ fetch('/api/report-issue', {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({ title, what })
+ }).then(r => r.json()).then(data => {
+ btn.disabled = false;
+ if (data && data.excerpt) {
+ const markdown = `### ${data.title || 'Relatório de Erro'}\n\n**Plataforma:** ${data.platform || 'PlayStation 5 (PPSA99810)'}\n**Versão:** v${data.release || '1.4.0'}\n**Firmware:** ${data.firmware || 'N/A'}\n\n**O que aconteceu:**\n${what || 'Relatório enviado via WebUI'}\n\n\`\`\`\n${data.excerpt}\n\`\`\``;
+ copyTextToClipboard(markdown).then(() => {
+ showToast('Relatório copiado para a área de transferência!');
+ }).catch(() => {
+ const p = document.getElementById('logPreview');
+ if (p) {
+ p.textContent = markdown;
+ p.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
+ }
+ try {
+ window.prompt('Copie o relatório abaixo (Ctrl+C / Toque longo):', markdown);
+ showToast('Relatório preparado!');
+ } catch (_) {
+ showToast('Relatório preparado no campo abaixo para cópia!');
+ }
+ });
+ } else {
+ showToast('Erro ao gerar relatório.');
+ }
+ }).catch(e => {
+ btn.disabled = false;
+ showToast('Falha ao copiar: ' + e);
+ });
+}
+
+function previewReport() {
+ const { title, what } = getReportParams();
+ const p = document.getElementById('logPreview');
+ p.textContent = 'Carregando resumo do relatório sanitizado...';
+ fetch('/api/report-issue', {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({ title, what })
+ }).then(r => r.json()).then(data => {
+ if (data && data.excerpt) {
+ p.textContent = `=== RELATÓRIO PREPARADO ===\nTítulo: ${data.title}\nPlataforma: ${data.platform}\nVersão: v${data.release}\nFirmware: ${data.firmware}\n\n${data.excerpt}`;
+ } else {
+ p.textContent = 'Nenhum dado retornado.';
+ }
+ }).catch(e => {
+ p.textContent = 'Erro ao carregar pré-visualização: ' + e;
+ });
+}
+
+function applyLoadedSettings(s) {
+ currentSettings = Object.assign(currentSettings, s);
+ if (s.settingsVersion !== undefined) lastSettingsVersion = s.settingsVersion;
+ if (s.query !== undefined && document.activeElement !== searchInput) searchInput.value = s.query;
if (s.tab) {
currentSearchTab = s.tab;
}
if (s.filters) {
- if (s.filters.wishlist) {
- currentFilters.wishlist = true;
+ if (s.filters.wishlist !== undefined) {
+ currentFilters.wishlist = !!s.filters.wishlist;
const el = document.getElementById('chipWishlist');
- if (el) el.classList.add('active');
+ if (el) el.classList.toggle('active', currentFilters.wishlist);
}
- if (s.filters.free) {
- currentFilters.free = true;
+ if (s.filters.free !== undefined) {
+ currentFilters.free = !!s.filters.free;
const el = document.getElementById('chipFree');
- if (el) el.classList.add('active');
+ if (el) el.classList.toggle('active', currentFilters.free);
}
- if (s.filters.cheapest) {
- currentFilters.cheapest = true;
+ if (s.filters.cheapest !== undefined) {
+ currentFilters.cheapest = !!s.filters.cheapest;
const el = document.getElementById('chipCheapest');
- if (el) el.classList.add('active');
+ if (el) el.classList.toggle('active', currentFilters.cheapest);
}
- if (s.filters.mouseKeyboard) {
- currentFilters.mouseGP = true;
- currentFilters.mouseLib = true;
+ if (s.filters.mouseKeyboard !== undefined) {
+ currentFilters.mouseGP = !!s.filters.mouseKeyboard;
+ currentFilters.mouseLib = !!s.filters.mouseKeyboard;
const elGP = document.getElementById('chipMouseGP');
- if (elGP) elGP.classList.add('active');
+ if (elGP) elGP.classList.toggle('active', currentFilters.mouseGP);
const elLib = document.getElementById('chipMouseLib');
- if (elLib) elLib.classList.add('active');
+ if (elLib) elLib.classList.toggle('active', currentFilters.mouseLib);
}
- if (s.filters.plan !== undefined && s.filters.plan > 0) {
+ if (s.filters.plan !== undefined) {
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 (wrap) wrap.classList.toggle('active', s.filters.plan > 0);
}
- if (s.filters.console !== undefined && s.filters.console > 0) {
+ if (s.filters.console !== undefined) {
currentFilters.consoleGP = s.filters.console;
currentFilters.consoleLib = s.filters.console;
const selGP = document.getElementById('filterConsoleGP');
@@ -1303,11 +1962,11 @@ fetch('/api/settings').then(r => r.json()).then(s => {
const selLib = document.getElementById('filterConsoleLib');
if (selLib) selLib.value = s.filters.console;
const wrapGP = document.getElementById('chipSelectConsoleGP');
- if (wrapGP) wrapGP.classList.add('active');
+ if (wrapGP) wrapGP.classList.toggle('active', s.filters.console > 0);
const wrapLib = document.getElementById('chipSelectConsoleLib');
- if (wrapLib) wrapLib.classList.add('active');
+ if (wrapLib) wrapLib.classList.toggle('active', s.filters.console > 0);
}
- if (s.filters.mode !== undefined && s.filters.mode > 0) {
+ if (s.filters.mode !== undefined) {
currentFilters.modeGP = s.filters.mode;
currentFilters.modeLib = s.filters.mode;
const selGP = document.getElementById('filterModeGP');
@@ -1315,11 +1974,11 @@ fetch('/api/settings').then(r => r.json()).then(s => {
const selLib = document.getElementById('filterModeLib');
if (selLib) selLib.value = s.filters.mode;
const wrapGP = document.getElementById('chipSelectModeGP');
- if (wrapGP) wrapGP.classList.add('active');
+ if (wrapGP) wrapGP.classList.toggle('active', s.filters.mode > 0);
const wrapLib = document.getElementById('chipSelectModeLib');
- if (wrapLib) wrapLib.classList.add('active');
+ if (wrapLib) wrapLib.classList.toggle('active', s.filters.mode > 0);
}
- if (s.filters.language !== undefined && s.filters.language > 0) {
+ if (s.filters.language !== undefined) {
currentFilters.langGP = s.filters.language;
currentFilters.langLib = s.filters.language;
const selGP = document.getElementById('filterLangGP');
@@ -1327,9 +1986,9 @@ fetch('/api/settings').then(r => r.json()).then(s => {
const selLib = document.getElementById('filterLangLib');
if (selLib) selLib.value = s.filters.language;
const wrapGP = document.getElementById('chipSelectLangGP');
- if (wrapGP) wrapGP.classList.add('active');
+ if (wrapGP) wrapGP.classList.toggle('active', s.filters.language > 0);
const wrapLib = document.getElementById('chipSelectLangLib');
- if (wrapLib) wrapLib.classList.add('active');
+ if (wrapLib) wrapLib.classList.toggle('active', s.filters.language > 0);
}
}
if (s.maxBitrateMbps !== undefined) {
@@ -1377,10 +2036,17 @@ fetch('/api/settings').then(r => r.json()).then(s => {
updateSearchStatusText();
renderPadMap();
renderKeyMap();
-}).catch(e => {
- renderPadMap();
- renderKeyMap();
-});
+ renderAllTouchpadGrids(s.touchpadShortcuts);
+}
+
+function loadAllSettingsFromServer() {
+ fetch('/api/settings').then(r => r.json()).then(applyLoadedSettings).catch(() => {
+ renderPadMap();
+ renderKeyMap();
+ renderAllTouchpadGrids(currentSettings.touchpadShortcuts);
+ });
+}
+loadAllSettingsFromServer();
// --- Virtual Gamepad & Streaming Polling ---
let activePlayer = 1;
@@ -1396,18 +2062,66 @@ const padState = {
let padSendScheduled = false;
function setVirtualPlayer(p) {
+ const prev = activePlayer;
activePlayer = p;
- document.getElementById('btnPlayer1').classList.toggle('active', p === 1);
- document.getElementById('btnPlayer2').classList.toggle('active', p === 2);
+ for (let i = 1; i <= 4; i++) {
+ const btn = document.getElementById('btnPlayer' + i);
+ if (btn) btn.classList.toggle('active', p === i);
+ }
const statusEl = document.getElementById('gamepadStatus');
if (statusEl) {
- statusEl.textContent = 'Controle ativo para Jogador ' + p + (p === 2 ? ' (Co-op Local)' : ' (Principal)');
+ statusEl.textContent = 'Controle ativo para Jogador ' + p + (p === 1 ? ' (Principal)' : ' (Co-op Local)');
}
- sendPadState();
+ sendPadState(true, prev);
}
-function sendPadState() {
- const payload = { player: activePlayer, ...padState };
+function toggleGamepadFullscreen() {
+ const card = document.getElementById('gamepadCard');
+ if (!card) return;
+ const isFs = card.classList.contains('gamepad-fullscreen') || document.fullscreenElement === card || document.webkitFullscreenElement === card;
+ if (!isFs) {
+ card.classList.add('gamepad-fullscreen');
+ if (card.requestFullscreen) {
+ card.requestFullscreen().catch(() => {});
+ } else if (card.webkitRequestFullscreen) {
+ try { card.webkitRequestFullscreen(); } catch (_) {}
+ }
+ if (screen.orientation && screen.orientation.lock) {
+ screen.orientation.lock('landscape').catch(() => {});
+ }
+ } else {
+ card.classList.remove('gamepad-fullscreen');
+ if (document.fullscreenElement || document.webkitFullscreenElement) {
+ if (document.exitFullscreen) document.exitFullscreen().catch(() => {});
+ else if (document.webkitExitFullscreen) {
+ try { document.webkitExitFullscreen(); } catch (_) {}
+ }
+ }
+ if (screen.orientation && screen.orientation.unlock) {
+ try { screen.orientation.unlock(); } catch (_) {}
+ }
+ }
+ setTimeout(updateGamepadScale, 20);
+ setTimeout(updateGamepadScale, 150);
+}
+
+document.addEventListener('fullscreenchange', () => {
+ const card = document.getElementById('gamepadCard');
+ if (card && !document.fullscreenElement && !document.webkitFullscreenElement) {
+ card.classList.remove('gamepad-fullscreen');
+ }
+ setTimeout(updateGamepadScale, 30);
+});
+document.addEventListener('webkitfullscreenchange', () => {
+ const card = document.getElementById('gamepadCard');
+ if (card && !document.fullscreenElement && !document.webkitFullscreenElement) {
+ card.classList.remove('gamepad-fullscreen');
+ }
+ setTimeout(updateGamepadScale, 30);
+});
+
+function sendPadState(activeSwitch = false, prevPlayer = 0) {
+ const payload = { player: activePlayer, prevPlayer: prevPlayer, activeSwitch: !!activeSwitch, ...padState };
if (ws && ws.readyState === WebSocket.OPEN) {
ws.send(JSON.stringify(payload));
} else {
@@ -1424,7 +2138,7 @@ function schedulePadSend() {
padSendScheduled = true;
requestAnimationFrame(() => {
padSendScheduled = false;
- sendPadState();
+ sendPadState(false);
});
}
@@ -1432,48 +2146,59 @@ function bindPadButtons() {
document.querySelectorAll('[data-btn]').forEach(el => {
const key = el.getAttribute('data-btn');
const isTrigger = key === 'triggerL2' || key === 'triggerR2';
+ const activeTouches = new Set();
- const onDown = (e) => {
- e.preventDefault();
+ const setDown = () => {
if (isTrigger) padState[key] = 1.0;
else padState[key] = true;
el.classList.add('pressed');
if (navigator.vibrate) {
try { navigator.vibrate(14); } catch (_) {}
}
- sendPadState();
+ sendPadState(false);
};
- const onUp = (e) => {
- e.preventDefault();
+ const setUp = () => {
if (isTrigger) padState[key] = 0.0;
else padState[key] = false;
el.classList.remove('pressed');
- sendPadState();
+ sendPadState(false);
+ };
+
+ el.addEventListener('touchstart', (e) => {
+ e.preventDefault();
+ for (let i = 0; i < e.changedTouches.length; i++) {
+ activeTouches.add(e.changedTouches[i].identifier);
+ }
+ setDown();
+ }, { passive: false });
+
+ const onTouchEnd = (e) => {
+ e.preventDefault();
+ for (let i = 0; i < e.changedTouches.length; i++) {
+ activeTouches.delete(e.changedTouches[i].identifier);
+ }
+ if (activeTouches.size === 0) setUp();
};
- el.addEventListener('touchstart', onDown, { passive: false });
- el.addEventListener('touchend', onUp, { passive: false });
- el.addEventListener('touchcancel', onUp, { passive: false });
- el.addEventListener('mousedown', onDown);
- el.addEventListener('mouseup', onUp);
- el.addEventListener('mouseleave', onUp);
+ el.addEventListener('touchend', onTouchEnd, { passive: false });
+ el.addEventListener('touchcancel', onTouchEnd, { passive: false });
+ el.addEventListener('mousedown', (e) => { e.preventDefault(); setDown(); });
+ el.addEventListener('mouseup', (e) => { e.preventDefault(); setUp(); });
+ el.addEventListener('mouseleave', () => { if (activeTouches.size === 0 && el.classList.contains('pressed')) setUp(); });
});
}
-function setupStick(zoneId, headId, stickKeyX, stickKeyY, l3r3Key) {
+function setupStick(zoneId, headId, stickKeyX, stickKeyY) {
const zone = document.getElementById(zoneId);
const head = document.getElementById(headId);
if (!zone || !head) return;
let activeTouchId = null;
- const maxR = 34;
-
- let touchStartMs = 0;
- let startX = 0, startY = 0;
function updateStick(clientX, clientY) {
const rect = zone.getBoundingClientRect();
+ const maxR = Math.max(28, (rect.width - head.offsetWidth) / 2);
const cx = rect.left + rect.width / 2;
const cy = rect.top + rect.height / 2;
let dx = clientX - cx;
@@ -1494,16 +2219,13 @@ function setupStick(zoneId, headId, stickKeyX, stickKeyY, l3r3Key) {
padState[stickKeyX] = 0.0;
padState[stickKeyY] = 0.0;
activeTouchId = null;
- sendPadState();
+ sendPadState(false);
}
zone.addEventListener('touchstart', (e) => {
e.preventDefault();
if (activeTouchId === null && e.changedTouches.length > 0) {
activeTouchId = e.changedTouches[0].identifier;
- touchStartMs = Date.now();
- startX = e.changedTouches[0].clientX;
- startY = e.changedTouches[0].clientY;
updateStick(e.changedTouches[0].clientX, e.changedTouches[0].clientY);
}
}, { passive: false });
@@ -1521,17 +2243,7 @@ function setupStick(zoneId, headId, stickKeyX, stickKeyY, l3r3Key) {
const onTouchEnd = (e) => {
for (let i = 0; i < e.changedTouches.length; i++) {
if (e.changedTouches[i].identifier === activeTouchId) {
- const duration = Date.now() - touchStartMs;
- const moveDist = Math.hypot(e.changedTouches[i].clientX - startX, e.changedTouches[i].clientY - startY);
resetStick();
- if (duration < 300 && moveDist < 12) {
- padState[l3r3Key] = true;
- sendPadState();
- setTimeout(() => {
- padState[l3r3Key] = false;
- sendPadState();
- }, 150);
- }
break;
}
}
@@ -1557,10 +2269,10 @@ function setupStick(zoneId, headId, stickKeyX, stickKeyY, l3r3Key) {
}
bindPadButtons();
-setupStick('leftStickZone', 'leftStickHead', 'leftStickX', 'leftStickY', 'btnL3');
-setupStick('rightStickZone', 'rightStickHead', 'rightStickX', 'rightStickY', 'btnR3');
+setupStick('leftStickZone', 'leftStickHead', 'leftStickX', 'leftStickY');
+setupStick('rightStickZone', 'rightStickHead', 'rightStickX', 'rightStickY');
-// Periodic streaming state poll and search overlay lock
+// Periodic streaming state poll and PS5 <-> WebUI settings version sync
let isCurrentlyStreaming = false;
function pollStreamingState() {
fetch('/api/status').then(r => r.json()).then(data => {
@@ -1571,6 +2283,11 @@ function pollStreamingState() {
if (overlay) overlay.style.display = streaming ? 'flex' : 'none';
if (searchInput) searchInput.disabled = streaming;
}
+ if (data.settingsVersion !== undefined && data.settingsVersion !== lastSettingsVersion) {
+ lastSettingsVersion = data.settingsVersion;
+ applyLoadedSettings(data);
+ loadStreamMenuState();
+ }
}).catch(() => {});
}
setInterval(pollStreamingState, 1500);
@@ -1580,9 +2297,75 @@ pollStreamingState();
setInterval(() => {
const gpPane = document.getElementById('tab-gamepad');
if (gpPane && gpPane.style.display !== 'none') {
- sendPadState();
+ sendPadState(false);
}
}, 300);
+
+function updateGamepadScale() {
+ const container = document.getElementById('gamepadScaleContainer');
+ const card = document.getElementById('gamepadCard');
+ if (!container || !card) return;
+ const isFs = card.classList.contains('gamepad-fullscreen') || document.fullscreenElement === card || document.webkitFullscreenElement === card;
+ const isLandscape = window.innerWidth > window.innerHeight;
+
+ if (isFs) {
+ const w = window.innerWidth;
+ const h = window.innerHeight;
+ const availW = container.clientWidth ? Math.max(200, container.clientWidth - 8) : (w - 28);
+ const availH = container.clientHeight ? Math.max(150, container.clientHeight - 8) : (h - 20);
+ const scale = Math.min(1.2, Math.max(0.4, Math.min(availW / 915, availH / 412)));
+ document.documentElement.style.setProperty('--gp-fs-scale', scale.toFixed(3));
+ document.documentElement.style.setProperty('--gp-scale', scale.toFixed(3));
+ return;
+ }
+
+ let availW = container.clientWidth;
+ if (!availW) {
+ const padding = window.innerWidth <= 600 ? 16 : 32;
+ availW = Math.max(0, window.innerWidth - padding);
+ }
+
+ if (!isLandscape) {
+ const targetW = Math.max(0, availW - 16);
+ const scale = Math.min(1, Math.max(0.4, targetW / 412));
+ document.documentElement.style.setProperty('--gp-scale', scale.toFixed(3));
+ } else {
+ const targetW = Math.max(0, availW - 16);
+ const availH = window.innerHeight;
+ const targetH = Math.max(120, availH - 78);
+ const scale = Math.min(1, Math.max(0.35, Math.min(targetW / 915, targetH / 412)));
+ document.documentElement.style.setProperty('--gp-scale', scale.toFixed(3));
+ }
+}
+window.addEventListener('resize', updateGamepadScale);
+window.addEventListener('orientationchange', () => setTimeout(updateGamepadScale, 50));
+window.addEventListener('DOMContentLoaded', updateGamepadScale);
+if (window.ResizeObserver) {
+ const ro = new ResizeObserver(() => updateGamepadScale());
+ const cardEl = document.getElementById('gamepadCard');
+ if (cardEl) ro.observe(cardEl);
+}
+
+// Hash & route navigation support: #gamepad, #gamepad-fs, #logs, #settings, /boost, /gamepad, etc.
+function checkHashNav() {
+ const p = (location.pathname || '').toLowerCase();
+ if (p.includes('/boost') || p.includes('/gamepad')) {
+ switchTab('gamepad');
+ }
+ const h = (location.hash || '').replace('#', '');
+ if (!h) return;
+ if (h === 'gamepad-fs') {
+ switchTab('gamepad');
+ const card = document.getElementById('gamepadCard');
+ if (card && !card.classList.contains('gamepad-fullscreen')) {
+ toggleGamepadFullscreen();
+ }
+ } else if (document.getElementById('tab-' + h)) {
+ switchTab(h);
+ }
+}
+window.addEventListener('hashchange', checkHashNav);
+checkHashNav();
</script>
</body>
</html>)html";
@@ -1623,6 +2406,9 @@ std::string WebServer::url() const {
}
bool WebServer::start(uint16_t port) {
+#ifdef SIGPIPE
+ ::signal(SIGPIPE, SIG_IGN);
+#endif
if (running_.load()) return true;
port_ = port;
@@ -1782,10 +2568,9 @@ bool parseGamepadJson(const json::Value& val, int& outSlot, input::ControllerSta
slot = static_cast<int>(val["playerIndex"].asInt(0));
} else if (val.has("player")) {
int p = static_cast<int>(val["player"].asInt(1));
- slot = (p == 2) ? 1 : 0;
+ slot = p - 1;
}
- if (slot < 0) slot = 0;
- if (slot > 1) slot = 1;
+ slot = std::clamp(slot, 0, 3);
outSlot = slot;
outState = input::ControllerState{};
@@ -1957,6 +2742,10 @@ 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));
+#ifdef SO_NOSIGPIPE
+ int nosig = 1;
+ ::setsockopt(clientFd, SOL_SOCKET, SO_NOSIGPIPE, &nosig, sizeof(nosig));
+#endif
std::string req;
char buf[8192];
@@ -2068,11 +2857,13 @@ void WebServer::handleClient(int clientFd) {
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;
+ if (method != "HEAD") {
+ response += res.body;
+ }
size_t sent = 0;
while (sent < response.size()) {
- ssize_t w = ::send(clientFd, response.data() + sent, response.size() - sent, 0);
+ ssize_t w = ::send(clientFd, response.data() + sent, response.size() - sent, MSG_NOSIGNAL);
if (w <= 0) break;
sent += static_cast<size_t>(w);
}
@@ -2125,13 +2916,16 @@ void WebServer::handleWebSocket(int wsFd) {
int slot = 0;
input::ControllerState s{};
if (parseGamepadJson(*j, slot, s)) {
+ if ((*j).has("activeSwitch") && (*j)["activeSwitch"].asBool()) {
+ switchVirtualGamepadSlot(slot);
+ }
setVirtualGamepad(slot, s);
if (s_hooks.injectGamepad) s_hooks.injectGamepad(slot, s);
}
}
} else if (frame.opcode == ws::Opcode::Binary) {
if (frame.payload.size() >= 13) {
- int slot = frame.payload[0] & 0x01;
+ int slot = frame.payload[0] & 0x03;
uint16_t btns = static_cast<uint16_t>(frame.payload[1]) | (static_cast<uint16_t>(frame.payload[2]) << 8);
input::ControllerState s{};
s.connected = true;
@@ -2198,22 +2992,33 @@ done:
namespace {
struct VirtualGamepadSlot {
input::ControllerState state{};
- uint64_t lastActiveMs = 0;
+ uint64_t lastSeenMs = 0;
+ uint64_t lastInputMs = 0;
};
std::mutex s_vpadMutex;
-VirtualGamepadSlot s_virtualPads[2];
+VirtualGamepadSlot s_virtualPads[4];
+
+bool hasGamepadInput(const input::ControllerState& s) {
+ return s.btnA || s.btnB || s.btnX || s.btnY ||
+ s.dpadUp || s.dpadDown || s.dpadLeft || s.dpadRight ||
+ s.btnL1 || s.btnR1 || s.btnL3 || s.btnR3 ||
+ s.btnTouchpad || s.btnOptions || s.btnNexus ||
+ s.triggerL2 > 0.05f || s.triggerR2 > 0.05f ||
+ std::abs(s.leftStickX) > 0.08f || std::abs(s.leftStickY) > 0.08f ||
+ std::abs(s.rightStickX) > 0.08f || std::abs(s.rightStickY) > 0.08f;
+}
} // namespace
bool virtualGamepadState(int playerIndex, input::ControllerState& outState, bool& isConnected) {
- if (playerIndex < 0 || playerIndex > 1) {
+ if (playerIndex < 0 || playerIndex >= 4) {
isConnected = false;
outState = {};
return false;
}
std::lock_guard<std::mutex> lock(s_vpadMutex);
uint64_t now = platform::nowMs();
- uint64_t diff = now > s_virtualPads[playerIndex].lastActiveMs ? now - s_virtualPads[playerIndex].lastActiveMs : 0;
- isConnected = (s_virtualPads[playerIndex].lastActiveMs > 0 && diff < 4000);
+ uint64_t diff = now > s_virtualPads[playerIndex].lastSeenMs ? now - s_virtualPads[playerIndex].lastSeenMs : 0;
+ isConnected = (s_virtualPads[playerIndex].lastSeenMs > 0 && diff < 4000);
if (diff < 2000) {
outState = s_virtualPads[playerIndex].state;
} else {
@@ -2223,16 +3028,47 @@ bool virtualGamepadState(int playerIndex, input::ControllerState& outState, bool
}
void setVirtualGamepad(int playerIndex, const input::ControllerState& state) {
- if (playerIndex < 0 || playerIndex > 1) return;
+ if (playerIndex < 0 || playerIndex >= 4) return;
std::lock_guard<std::mutex> lock(s_vpadMutex);
+ uint64_t now = platform::nowMs();
+ bool firstSeen = (s_virtualPads[playerIndex].lastSeenMs == 0);
s_virtualPads[playerIndex].state = state;
- s_virtualPads[playerIndex].lastActiveMs = platform::nowMs();
+ s_virtualPads[playerIndex].lastSeenMs = now;
+ if (firstSeen || hasGamepadInput(state)) {
+ s_virtualPads[playerIndex].lastInputMs = now;
+ }
+}
+
+void touchVirtualGamepad(int playerIndex) {
+ if (playerIndex < 0 || playerIndex >= 4) return;
+ std::lock_guard<std::mutex> lock(s_vpadMutex);
+ uint64_t now = platform::nowMs();
+ s_virtualPads[playerIndex].lastSeenMs = now;
+ s_virtualPads[playerIndex].lastInputMs = now;
+}
+
+void switchVirtualGamepadSlot(int newSlot) {
+ if (newSlot < 0 || newSlot >= 4) return;
+ std::lock_guard<std::mutex> lock(s_vpadMutex);
+ for (int i = 0; i < 4; ++i) {
+ if (i != newSlot) {
+ s_virtualPads[i] = {};
+ }
+ }
+ uint64_t now = platform::nowMs();
+ s_virtualPads[newSlot].lastSeenMs = now;
+ s_virtualPads[newSlot].lastInputMs = now;
+}
+
+uint64_t virtualGamepadActiveAt(int playerIndex) {
+ if (playerIndex < 0 || playerIndex >= 4) return 0;
+ std::lock_guard<std::mutex> lock(s_vpadMutex);
+ return s_virtualPads[playerIndex].lastInputMs;
}
void resetVirtualGamepads() {
std::lock_guard<std::mutex> lock(s_vpadMutex);
- s_virtualPads[0] = {};
- s_virtualPads[1] = {};
+ for (auto& slot : s_virtualPads) slot = {};
}
void setWebServerHooks(WebServerHooks hooks) {
@@ -2245,8 +3081,8 @@ WebServer::HttpResponse WebServer::handleRequest(const std::string& method, cons
return {204, "text/plain", "", ""};
}
- if (method == "GET") {
- if (path == "/" || path == "/index.html") {
+ if (method == "GET" || method == "HEAD") {
+ if (path == "/" || path == "/index.html" || path == "/boost" || path == "/boost/" || path == "/gamepad" || path == "/gamepad/") {
return {200, "text/html; charset=utf-8", "", kIndexHtml};
}
if (path == "/api/settings" || path == "/api/status" || path == "/api/state") {
@@ -2261,6 +3097,7 @@ WebServer::HttpResponse WebServer::handleRequest(const std::string& method, cons
root.set("resolution", "1080p");
root.set("padMap", input::padMapJson(input::defaultPadMap()));
root.set("keyMap", keyMapToJson(input::defaultKeyMap()));
+ root.set("touchpadShortcuts", input::touchpadShortcutsJson(input::defaultTouchpadShortcuts()));
}
if (s_hooks.getSearchParams) {
std::string q, tab;
@@ -2286,6 +3123,35 @@ WebServer::HttpResponse WebServer::handleRequest(const std::string& method, cons
std::string clean = report::sanitize(rawLog, {});
return {200, "text/plain; charset=utf-8", "Content-Disposition: attachment; filename=\"xcloud.log\"\r\n", clean};
}
+ if (path == "/api/report-issue" || path.rfind("/api/report-issue?", 0) == 0) {
+ std::string rawLog;
+ platform::readFile(platform::dataDir() + "/xcloud.log", rawLog);
+ std::vector<std::string> privWords;
+ for (int i = 0; i < input::kMaxPads; ++i) {
+ std::string u = input::padUserName(i);
+ if (!u.empty()) privWords.push_back(std::move(u));
+ }
+
+ report::Info info;
+ info.title = "Relatório via WebUI";
+ info.what = "Enviado através do painel WebUI do PSBox";
+ info.release = XC_APP_VERSION;
+ info.firmware = platform::firmwareVersion();
+ info.platform = platform::platformName();
+ std::string platHeader = "[Platform: " + info.platform + "]\n";
+ info.log = platHeader + report::sanitize(report::logExcerpt(rawLog, false), privWords);
+ std::string url = report::issueUrl(info);
+
+ json::Value resp = json::Value::object();
+ resp.set("ok", true);
+ resp.set("url", url);
+ resp.set("title", info.title);
+ resp.set("platform", info.platform);
+ resp.set("release", info.release);
+ resp.set("firmware", info.firmware);
+ resp.set("excerpt", info.log);
+ return {200, "application/json; charset=utf-8", "", resp.dump()};
+ }
if (path == "/api/stats") {
json::Value stats = json::Value::object();
if (s_hooks.getTelemetry) {
@@ -2306,6 +3172,47 @@ WebServer::HttpResponse WebServer::handleRequest(const std::string& method, cons
}
if (method == "POST") {
+ if (path == "/api/report-issue") {
+ std::string title = "Relatório via WebUI";
+ std::string what = "Enviado através do painel WebUI do PSBox";
+ auto j = json::parse(body);
+ if (j && j->isObject()) {
+ if ((*j).has("title") && (*j)["title"].isString() && !(*j)["title"].asString().empty()) {
+ title = (*j)["title"].asString();
+ }
+ if ((*j).has("what") && (*j)["what"].isString() && !(*j)["what"].asString().empty()) {
+ what = (*j)["what"].asString();
+ }
+ }
+ std::string rawLog;
+ platform::readFile(platform::dataDir() + "/xcloud.log", rawLog);
+
+ std::vector<std::string> privWords;
+ for (int i = 0; i < input::kMaxPads; ++i) {
+ std::string u = input::padUserName(i);
+ if (!u.empty()) privWords.push_back(std::move(u));
+ }
+
+ report::Info info;
+ info.title = report::shorten(title, 70);
+ info.what = report::sanitize(what, privWords);
+ info.release = XC_APP_VERSION;
+ info.firmware = platform::firmwareVersion();
+ info.platform = platform::platformName();
+ std::string platHeader = "[Platform: " + info.platform + "]\n";
+ info.log = platHeader + report::sanitize(report::logExcerpt(rawLog, false), privWords);
+ std::string url = report::issueUrl(info);
+
+ json::Value resp = json::Value::object();
+ resp.set("ok", true);
+ resp.set("url", url);
+ resp.set("title", info.title);
+ resp.set("platform", info.platform);
+ resp.set("release", info.release);
+ resp.set("firmware", info.firmware);
+ resp.set("excerpt", info.log);
+ return {200, "application/json; charset=utf-8", "", resp.dump()};
+ }
if (path == "/api/gamepad" || path == "/api/input") {
auto j = json::parse(body);
if (!j || !j->isObject()) {
@@ -2317,6 +3224,9 @@ WebServer::HttpResponse WebServer::handleRequest(const std::string& method, cons
return {400, "application/json", "", "{\"ok\":false,\"error\":\"invalid state\"}"};
}
+ if ((*j).has("activeSwitch") && (*j)["activeSwitch"].asBool()) {
+ switchVirtualGamepadSlot(slot);
+ }
setVirtualGamepad(slot, s);
if (s_hooks.injectGamepad) {
s_hooks.injectGamepad(slot, s);
diff --git a/src/app/web_server.h b/src/app/web_server.h
index ec1c567..a309c85 100644
--- a/src/app/web_server.h
+++ b/src/app/web_server.h
@@ -34,11 +34,14 @@ struct WebServerHooks {
void setWebServerHooks(WebServerHooks hooks);
// Virtual gamepad input query:
-// playerIndex: 0 = Player 1, 1 = Player 2
-// outState: contains current active buttons/axes (resets to neutral after ~600ms of inactivity)
-// isConnected: true if any report/keepalive received within ~3000ms
+// playerIndex: 0..3 (Player 1..4)
+// outState: contains current active buttons/axes (resets to neutral after ~2000ms of inactivity)
+// isConnected: true if any report/keepalive received within ~4000ms
bool virtualGamepadState(int playerIndex, input::ControllerState& outState, bool& isConnected);
void setVirtualGamepad(int playerIndex, const input::ControllerState& state);
+void touchVirtualGamepad(int playerIndex);
+void switchVirtualGamepadSlot(int newSlot);
+uint64_t virtualGamepadActiveAt(int playerIndex);
void resetVirtualGamepads();
namespace ws {
diff --git a/src/app/worker.cpp b/src/app/worker.cpp
index 3d58dec..02a8b7b 100644
--- a/src/app/worker.cpp
+++ b/src/app/worker.cpp
@@ -607,7 +607,7 @@ std::string play(auth::AuthManager& am, xcloud::GssvClient& gssv, const ui::Game
std::lock_guard<std::mutex> lock(g_settingsMutex);
alertOn = g_settings.queueReadyAlert;
}
- if (alertOn && wasInQueue) {
+ if (alertOn && (wasInQueue || (platform::nowMs() - provisioningSince >= 2000))) {
XC_LOGI("session: queue completed and provisioned; triggering queue-ready chime and rumble on DualSense");
playQueueReadyAlert(true);
}
@@ -626,7 +626,7 @@ std::string play(auth::AuthManager& am, xcloud::GssvClient& gssv, const ui::Game
return result;
}
-void loadLibrary(auth::AuthManager& am, xcloud::GssvClient& gssv);
+void loadLibrary(auth::AuthManager& am, xcloud::GssvClient& gssv, bool forceRefresh = false);
// --- Updates -------------------------------------------------------------------
@@ -881,10 +881,46 @@ void signInAndLoad(auth::AuthManager& am, xcloud::GssvClient& gssv) {
loadLibrary(am, gssv);
}
-void loadLibrary(auth::AuthManager& am, xcloud::GssvClient& gssv) {
+void loadLibrary(auth::AuthManager& am, xcloud::GssvClient& gssv, bool forceRefresh) {
std::string err;
if (!keepSignedIn(am, gssv, err)) XC_LOGW("sign-in renewal: %s", err.c_str());
err.clear();
+
+ std::shared_ptr<app::Library> existingLib;
+ {
+ std::lock_guard<std::mutex> lock(s_libraryMutex);
+ existingLib = s_library;
+ }
+
+ if (existingLib && existingLib->ownedKnown()) {
+ XC_LOGI("library: delta-sync against active library (forceRefresh=%d)", forceRefresh);
+ g_ui->setLoading(true, 0, 0);
+ auto publish = [](const app::Library& lib) {
+ g_ui->setRows(lib.rows());
+ g_ui->setOwned(lib.owned(), lib.purchasable(), lib.ownedKnown());
+ g_ui->setMembership(lib.gamePassMember());
+ g_ui->setSearchPools(lib.gamePassSearchPool(), lib.librarySearchPool());
+ auto p = lib.progress();
+ g_ui->setLoading(p.active, p.done, p.total);
+ };
+ size_t newCount = existingLib->syncDelta(gssv, [&] { publish(*existingLib); }, err);
+ g_ui->setLoading(false, 0, 0);
+ publish(*existingLib);
+
+ if (forceRefresh) {
+ if (newCount > 0) {
+ std::string msg = ui::trf(ui::Str::LibraryUpdatedCount, std::to_string(newCount));
+ if (!shell::caps().console) g_ui->showToast(msg);
+ platform::notify(msg);
+ } else {
+ std::string msg = ui::tr(ui::Str::LibraryUpToDate);
+ if (!shell::caps().console) g_ui->showToast(msg);
+ platform::notify(msg);
+ }
+ }
+ return;
+ }
+
bool onSplash = (g_ui->screen() == ui::Screen::Splash);
if (onSplash) {
g_ui->showSplash(ui::tr(ui::Str::LoadingGames));
@@ -926,9 +962,14 @@ void loadLibrary(auth::AuthManager& am, xcloud::GssvClient& gssv) {
}
}
},
- err);
+ err,
+ forceRefresh);
if (!ok) {
- if (g_ui->screen() == ui::Screen::Home) {
+ ui::GameTile dummy;
+ if (g_ui->screen() == ui::Screen::Home || g_ui->firstTile(dummy)) {
+ if (g_ui->screen() == ui::Screen::Splash) {
+ g_ui->showHome();
+ }
platform::notify("Offline mode: using cached library");
g_ui->setLoading(false, 0, 0);
return;
@@ -976,13 +1017,14 @@ void loadLibrary(auth::AuthManager& am, xcloud::GssvClient& gssv) {
library->loadPlatforms(xblAuth, changed, &g_stopHydration);
library->hydrate(changed, &g_stopHydration);
library->loadFriends(xblAuth, changed, &g_stopHydration);
+ g_ui->setLoading(false, 0, 0);
});
if (!g_autoplay.title.empty() && g_autoplay.title != "BENCH" && g_autoplay.title != "UPDATE" && g_autoplay.title != "AUTOTEST" &&
!g_autoplay.detailTest && !g_autoplay.libraryTest &&
!g_autoplay.consolesTab && !g_autoplay.settingsTest && !g_autoplay.keysTest && !g_autoplay.padMapTest &&
!g_autoplay.imeTest && !g_autoplay.vibeTest && !g_autoplay.searchTest && !g_autoplay.quickTest && !g_autoplay.crashTest && !g_autoplay.scrollTest &&
!g_autoplay.gridTest && !g_autoplay.gameSettingsTest && !g_autoplay.publisherTest && !g_autoplay.friendsTest &&
- !g_autoplay.regionTest) {
+ !g_autoplay.regionTest && !g_autoplay.mw4Test && !g_autoplay.v150Test) {
platform::sleepMs(6000); // leave the home screen up for ui.ppm
ui::GameTile tile;
tile.titleId = g_autoplay.title;
@@ -1328,7 +1370,7 @@ void worker() {
case kCheckSignIn: runSignInCheck(am, gssv); break;
case kNetworkTest: runNetworkTest(gssv); break;
case kReloadLibrary:
- if (am.signedIn()) loadLibrary(am, gssv);
+ if (am.signedIn()) loadLibrary(am, gssv, true);
else signInAndLoad(am, gssv);
break;
case kSignOut:
@@ -1475,7 +1517,9 @@ void worker() {
std::lock_guard<std::mutex> lock(g_argMutex);
tile = g_playTile;
}
- g_ui->showToast(ui::tr(ui::Str::Claiming));
+ if (!shell::caps().console) {
+ g_ui->showToast(ui::tr(ui::Str::Claiming));
+ }
platform::notify(ui::tr(ui::Str::Claiming));
XC_LOGI("claiming free game: %s (productId=%s, titleId=%s)",
tile.name.c_str(), tile.productId.c_str(), tile.titleId.c_str());
@@ -1523,7 +1567,9 @@ void worker() {
if (lib) {
lib->markAsOwned(tile.productId, tile.titleId);
g_ui->markTileOwned(tile.productId, tile.titleId);
- g_ui->showToast(ui::tr(ui::Str::ClaimSuccess));
+ if (!shell::caps().console) {
+ g_ui->showToast(ui::tr(ui::Str::ClaimSuccess));
+ }
platform::notify(ui::tr(ui::Str::ClaimSuccess));
// Re-sync owned titles in background
@@ -1532,6 +1578,8 @@ void worker() {
g_ui->setOwned(lib->owned(), lib->purchasable(), lib->ownedKnown());
});
}
+ tile.playable = true;
+ g_ui->showDetails(tile);
break;
}
default: {
diff --git a/src/input/pad_map.cpp b/src/input/pad_map.cpp
index 4383e33..27422d7 100644
--- a/src/input/pad_map.cpp
+++ b/src/input/pad_map.cpp
@@ -135,4 +135,68 @@ bool readPadMap(const json::Value& v, PadMap& out) {
return true;
}
+TouchpadShortcuts defaultTouchpadShortcuts() {
+ return TouchpadShortcuts{};
+}
+
+json::Value touchpadShortcutsJson(const TouchpadShortcuts& ts) {
+ json::Value v = json::Value::object();
+ v.set("version", 1);
+ v.set("swipeUp", static_cast<int>(ts.swipeUp));
+ v.set("swipeDown", static_cast<int>(ts.swipeDown));
+ v.set("swipeLeft", static_cast<int>(ts.swipeLeft));
+ v.set("swipeRight", static_cast<int>(ts.swipeRight));
+ v.set("clickLeft", static_cast<int>(ts.clickLeft));
+ v.set("clickRight", static_cast<int>(ts.clickRight));
+ return v;
+}
+
+bool readTouchpadShortcuts(const json::Value& v, TouchpadShortcuts& out) {
+ out = defaultTouchpadShortcuts();
+ if (!v.isObject()) return false;
+ if (v.has("version") && v["version"].asInt(1) != 1) return false;
+ if (!v.has("swipeUp") && !v.has("swipeDown") && !v.has("swipeLeft") &&
+ !v.has("swipeRight") && !v.has("clickLeft") && !v.has("clickRight")) {
+ return false;
+ }
+ auto parseAct = [&](const char* key, TouchpadAction fallback) -> TouchpadAction {
+ if (!v.has(key)) return fallback;
+ int val = v[key].asInt(static_cast<int>(fallback));
+ if (val < 0 || val >= kTouchpadActions) return fallback;
+ return static_cast<TouchpadAction>(val);
+ };
+ out.swipeUp = parseAct("swipeUp", out.swipeUp);
+ out.swipeDown = parseAct("swipeDown", out.swipeDown);
+ out.swipeLeft = parseAct("swipeLeft", out.swipeLeft);
+ out.swipeRight = parseAct("swipeRight", out.swipeRight);
+ out.clickLeft = parseAct("clickLeft", out.clickLeft);
+ out.clickRight = parseAct("clickRight", out.clickRight);
+ return true;
+}
+
+bool isTouchpadButtonAction(TouchpadAction act) {
+ return static_cast<uint8_t>(act) >= static_cast<uint8_t>(TouchpadAction::View) &&
+ static_cast<uint8_t>(act) < static_cast<uint8_t>(TouchpadAction::Count);
+}
+
+bool applyTouchpadButtonAction(ControllerState& s, TouchpadAction act) {
+ switch (act) {
+ case TouchpadAction::View: s.btnTouchpad = true; return true;
+ case TouchpadAction::Menu: s.btnOptions = true; return true;
+ case TouchpadAction::L3: s.btnL3 = true; return true;
+ case TouchpadAction::R3: s.btnR3 = true; return true;
+ case TouchpadAction::A: s.btnA = true; return true;
+ case TouchpadAction::B: s.btnB = true; return true;
+ case TouchpadAction::X: s.btnX = true; return true;
+ case TouchpadAction::Y: s.btnY = true; return true;
+ case TouchpadAction::LB: s.btnL1 = true; return true;
+ case TouchpadAction::RB: s.btnR1 = true; return true;
+ case TouchpadAction::DpadUp: s.dpadUp = true; return true;
+ case TouchpadAction::DpadDown: s.dpadDown = true; return true;
+ case TouchpadAction::DpadLeft: s.dpadLeft = true; return true;
+ case TouchpadAction::DpadRight: s.dpadRight = true; return true;
+ default: return false;
+ }
+}
+
} // namespace xc::input
diff --git a/src/input/pad_map.h b/src/input/pad_map.h
index 97ed1d9..2af1f32 100644
--- a/src/input/pad_map.h
+++ b/src/input/pad_map.h
@@ -70,4 +70,79 @@ json::Value padMapJson(const PadMap& map);
// `out` the default map.
bool readPadMap(const json::Value& v, PadMap& out);
+enum class TouchpadAction : uint8_t {
+ None = 0,
+ GameMenu = 1,
+ XboxButton = 2,
+ ToggleStats = 3,
+ ToggleMicMute = 4,
+ CycleGyro = 5,
+ CycleTriggerProfile = 6,
+ View = 7,
+ Menu = 8,
+ L3 = 9,
+ R3 = 10,
+ A = 11,
+ B = 12,
+ X = 13,
+ Y = 14,
+ LB = 15,
+ RB = 16,
+ DpadUp = 17,
+ DpadDown = 18,
+ DpadLeft = 19,
+ DpadRight = 20,
+ Count = 21
+};
+constexpr int kTouchpadActions = static_cast<int>(TouchpadAction::Count);
+constexpr int kTouchpadTriggers = 6;
+
+struct TouchpadShortcuts {
+ TouchpadAction swipeUp = TouchpadAction::XboxButton;
+ TouchpadAction swipeDown = TouchpadAction::GameMenu;
+ TouchpadAction swipeLeft = TouchpadAction::GameMenu;
+ TouchpadAction swipeRight = TouchpadAction::XboxButton;
+ TouchpadAction clickLeft = TouchpadAction::View;
+ TouchpadAction clickRight = TouchpadAction::View;
+
+ bool operator==(const TouchpadShortcuts& o) const {
+ return swipeUp == o.swipeUp && swipeDown == o.swipeDown &&
+ swipeLeft == o.swipeLeft && swipeRight == o.swipeRight &&
+ clickLeft == o.clickLeft && clickRight == o.clickRight;
+ }
+ bool operator!=(const TouchpadShortcuts& o) const { return !(*this == o); }
+
+ TouchpadAction get(int triggerIndex) const {
+ switch (triggerIndex) {
+ case 0: return swipeUp;
+ case 1: return swipeDown;
+ case 2: return swipeLeft;
+ case 3: return swipeRight;
+ case 4: return clickLeft;
+ case 5: return clickRight;
+ default: return TouchpadAction::None;
+ }
+ }
+
+ void set(int triggerIndex, TouchpadAction act) {
+ if (static_cast<uint8_t>(act) >= static_cast<uint8_t>(TouchpadAction::Count))
+ act = TouchpadAction::None;
+ switch (triggerIndex) {
+ case 0: swipeUp = act; break;
+ case 1: swipeDown = act; break;
+ case 2: swipeLeft = act; break;
+ case 3: swipeRight = act; break;
+ case 4: clickLeft = act; break;
+ case 5: clickRight = act; break;
+ default: break;
+ }
+ }
+};
+
+TouchpadShortcuts defaultTouchpadShortcuts();
+json::Value touchpadShortcutsJson(const TouchpadShortcuts& ts);
+bool readTouchpadShortcuts(const json::Value& v, TouchpadShortcuts& out);
+bool isTouchpadButtonAction(TouchpadAction act);
+bool applyTouchpadButtonAction(ControllerState& s, TouchpadAction act);
+
} // namespace xc::input
diff --git a/src/media/audio_out_ps5.cpp b/src/media/audio_out_ps5.cpp
index c4f48f0..cecc73a 100644
--- a/src/media/audio_out_ps5.cpp
+++ b/src/media/audio_out_ps5.cpp
@@ -14,6 +14,7 @@
#include <algorithm>
#include <atomic>
#include <chrono>
+#include <mutex>
#include <thread>
#include <vector>
@@ -36,6 +37,7 @@ constexpr unsigned kGrain = 256;
std::atomic<bool> g_running{false};
std::thread g_thread;
int g_handle = -1;
+std::mutex g_padSpkMutex;
void loop() {
platform::setThreadAffinity(platform::ThreadRole::Audio, "ps5_audio_out");
@@ -127,6 +129,7 @@ bool playPadSpeakerAudio(const float* interleavedStereo, size_t frames) {
std::thread([pcm = std::vector<float>(interleavedStereo, interleavedStereo + frames * 2), volPercent]() {
platform::setThreadAffinity(platform::ThreadRole::Audio, "ps5_pad_audio");
+ std::lock_guard<std::mutex> padLock(g_padSpkMutex);
static bool initialised = false;
if (!initialised) {
@@ -136,6 +139,12 @@ bool playPadSpeakerAudio(const float* interleavedStereo, size_t frames) {
}
}
+ // Ensure main audio port (TV / headset) is also running so the alert chime
+ // is always audible even if PS5 OS controller speaker volume is muted or a
+ // headset is connected.
+ audioStart();
+ float gain = volPercent / 100.0f;
+
int32_t userId = input::padUserId(0);
if (userId < 0) userId = 0xFF;
@@ -156,9 +165,7 @@ bool playPadSpeakerAudio(const float* interleavedStereo, size_t frames) {
if (padHandle < 0) {
XC_LOGW("pad speaker: failed to open controller speaker port, fallback to main audio");
- audioStart();
constexpr size_t kChunk = (kRate * 20) / 1000;
- 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;
@@ -178,13 +185,19 @@ bool playPadSpeakerAudio(const float* interleavedStereo, size_t frames) {
size_t totalFrames = pcm.size() / 2;
size_t offset = 0;
+ std::vector<float> mainChunk(kGrain * 2, 0.0f);
if (activeFormat == 4) {
std::vector<float> chunk(kGrain * 2, 0.0f);
while (offset < totalFrames) {
size_t n = std::min(static_cast<size_t>(kGrain), totalFrames - offset);
std::fill(chunk.begin(), chunk.end(), 0.0f);
- std::copy(pcm.data() + offset * 2, pcm.data() + (offset + n) * 2, chunk.data());
+ for (size_t i = 0; i < n * 2; ++i) {
+ float s = pcm[offset * 2 + i] * gain;
+ chunk[i] = s;
+ mainChunk[i] = s;
+ }
+ audioPush(mainChunk.data(), n);
sceAudioOutOutput(padHandle, chunk.data());
offset += n;
}
@@ -194,8 +207,13 @@ bool playPadSpeakerAudio(const float* interleavedStereo, size_t frames) {
size_t n = std::min(static_cast<size_t>(kGrain), totalFrames - offset);
std::fill(chunk.begin(), chunk.end(), 0.0f);
for (size_t i = 0; i < n; ++i) {
- chunk[i] = 0.5f * (pcm[(offset + i) * 2] + pcm[(offset + i) * 2 + 1]);
+ float l = pcm[(offset + i) * 2] * gain;
+ float r = pcm[(offset + i) * 2 + 1] * gain;
+ mainChunk[i * 2] = l;
+ mainChunk[i * 2 + 1] = r;
+ chunk[i] = 0.5f * (l + r);
}
+ audioPush(mainChunk.data(), n);
sceAudioOutOutput(padHandle, chunk.data());
offset += n;
}
@@ -205,9 +223,14 @@ bool playPadSpeakerAudio(const float* interleavedStereo, size_t frames) {
size_t n = std::min(static_cast<size_t>(kGrain), totalFrames - offset);
std::fill(chunk.begin(), chunk.end(), 0);
for (size_t i = 0; i < n; ++i) {
- float m = 0.5f * (pcm[(offset + i) * 2] + pcm[(offset + i) * 2 + 1]);
+ float l = pcm[(offset + i) * 2] * gain;
+ float r = pcm[(offset + i) * 2 + 1] * gain;
+ mainChunk[i * 2] = l;
+ mainChunk[i * 2 + 1] = r;
+ float m = 0.5f * (l + r);
chunk[i] = static_cast<int16_t>(std::clamp(m * 32767.0f, -32768.0f, 32767.0f));
}
+ audioPush(mainChunk.data(), n);
sceAudioOutOutput(padHandle, chunk.data());
offset += n;
}
@@ -217,15 +240,20 @@ bool playPadSpeakerAudio(const float* interleavedStereo, size_t frames) {
size_t n = std::min(static_cast<size_t>(kGrain), totalFrames - offset);
std::fill(chunk.begin(), chunk.end(), 0);
for (size_t i = 0; i < n * 2; ++i) {
- chunk[i] = static_cast<int16_t>(std::clamp(pcm[offset * 2 + i] * 32767.0f, -32768.0f, 32767.0f));
+ float s = pcm[offset * 2 + i] * gain;
+ mainChunk[i] = s;
+ chunk[i] = static_cast<int16_t>(std::clamp(s * 32767.0f, -32768.0f, 32767.0f));
}
+ audioPush(mainChunk.data(), n);
sceAudioOutOutput(padHandle, chunk.data());
offset += n;
}
}
+ // Drain hardware buffer before closing PADSPK port
+ sceAudioOutOutput(padHandle, nullptr);
sceAudioOutClose(padHandle);
- XC_LOGI("pad speaker: alert chime playback completed successfully on DualSense");
+ XC_LOGI("pad speaker: alert chime playback completed successfully on DualSense + main audio");
}).detach();
return true;
@@ -240,6 +268,13 @@ bool hasPadSpeaker() {
if (now - lastCheckMs.load() < 2000) {
return lastResult.load();
}
+ std::unique_lock<std::mutex> lock(g_padSpkMutex, std::try_to_lock);
+ if (!lock.owns_lock()) {
+ // Currently playing audio on PADSPK port
+ lastCheckMs.store(now);
+ lastResult.store(true);
+ return true;
+ }
lastCheckMs.store(now);
int padHandle = sceAudioOutOpen(userId, 4 /* PADSPK */, 0, kGrain, kRate, 3);
if (padHandle >= 0) {
diff --git a/src/platform/ps5/platform_ps5.cpp b/src/platform/ps5/platform_ps5.cpp
index fe471d2..c4ecd49 100644
--- a/src/platform/ps5/platform_ps5.cpp
+++ b/src/platform/ps5/platform_ps5.cpp
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright (C) 2026 RafaelNGP
#include "platform/platform.h"
+#include "platform/toasts.h"
#include "util/log.h"
#include <cerrno>
@@ -251,6 +252,7 @@ void notify(const std::string& text) { notify(text, text); }
void notify(const std::string& text, const std::string& forLog) {
XC_LOGI("NOTIFY: %s", forLog.c_str());
+ if (toastsEnabled() && forLog != "signed in (notification)") toasts().push(text, nowMs());
// Same request layout as PS5_Vulkan's demo renderer.
struct NotificationRequest {
uint8_t reserved[45];
diff --git a/src/ui/app_ui.cpp b/src/ui/app_ui.cpp
index 10ce04c..07d3544 100644
--- a/src/ui/app_ui.cpp
+++ b/src/ui/app_ui.cpp
@@ -52,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, kIconDpadLR };
+enum Icon { kIconCross, kIconCircle, kIconOptions, kIconTriangle, kIconTouchpad, kIconSquare, kIconR3, kIconL3, kIconL2R2, kIconDpadLR, kIconL1R1 };
// The resolution list, lowest first: SettingsChoice::resolution value per
// position (0 = 1080p, 1 = 720p, 2 = 1440p, as saved).
@@ -62,10 +62,10 @@ constexpr int kResolutionOrder[3] = {1, 0, 2};
// stream (resolution, a desktop's display mode, 120 Hz, bitrate, region, network test);
// the controller, keyboard and queue-ready alert; support and updates last. A group starts at each
// kSettingsGroupStart.
-constexpr int kSettingsCount = 21;
-constexpr int kSettingsOrder[kSettingsCount] = {0, 8, 17, 1, 20, 13, 9, 10, 2, 18, 14, 12, 3, 15, 4, 21, 5, 6, 16, 19, 7};
-constexpr bool kSettingsGroupStart[kSettingsCount] = {false, false, false, true, false, false, false, false, false, false,
- true, false, false, false, false, false, false, false, false, true, false};
+constexpr int kSettingsCount = 22;
+constexpr int kSettingsOrder[kSettingsCount] = {0, 2, 8, 17, 18, 1, 20, 13, 9, 10, 14, 12, 3, 15, 4, 21, 5, 6, 16, 19, 7, 23};
+constexpr bool kSettingsGroupStart[kSettingsCount] = {false, false, false, false, false, true, false, false, false, false,
+ true, false, false, false, false, false, false, false, false, true, false, true};
// The game settings' rows on screen (ids: 0 profile, 1 upscaler, 2
// sharpness, 3 block smoothing, 4 resolution, 5 dead zone, 6 triggers, 7
// confirm, 8 120 Hz, 9 keyboard keys, 10 back to the default, 11 controller
@@ -646,8 +646,10 @@ void AppUi::toggleHidden(const GameTile& tile, UiEvent& ev) {
bool hide = !hidden_.count(tile.productId);
if (hide) hidden_.insert(tile.productId);
else hidden_.erase(tile.productId);
- toast_ = tr(hide ? Str::HiddenToast : Str::UnhiddenToast);
- toastUntil_ = 0;
+ if (!caps_.console) {
+ toast_ = tr(hide ? Str::HiddenToast : Str::UnhiddenToast);
+ toastUntil_ = 0;
+ }
rebuild(true); // the cursor stays put; the next game takes the place
prefsEvent(ev);
}
@@ -658,8 +660,10 @@ void AppUi::toggleFavorite(const GameTile& tile, UiEvent& ev) {
bool fav = !favorites_.count(tile.productId);
if (fav) favorites_.insert(tile.productId);
else favorites_.erase(tile.productId);
- toast_ = tr(fav ? Str::AddedToFavorites : Str::RemovedFromFavorites);
- toastUntil_ = 0;
+ if (!caps_.console) {
+ toast_ = tr(fav ? Str::AddedToFavorites : Str::RemovedFromFavorites);
+ toastUntil_ = 0;
+ }
prefsEvent(ev);
dirty_ = true;
}
@@ -677,6 +681,7 @@ bool AppUi::isAcquired(const GameTile& t) const {
}
bool AppUi::isFreeGame(const GameTile& t) const {
+ if (unclaimable_.count(t.productId)) return false;
if (t.freeInStore) return true;
auto price = prices_.find(t.productId);
if (price != prices_.end()) {
@@ -694,8 +699,10 @@ void AppUi::toggleWishlist(const GameTile& tile, UiEvent& ev) {
bool wish = !wishlist_.count(tile.productId);
if (wish) wishlist_.insert(tile.productId);
else wishlist_.erase(tile.productId);
- toast_ = tr(wish ? Str::AddedToWishlist : Str::RemovedFromWishlist);
- toastUntil_ = 0;
+ if (!caps_.console) {
+ toast_ = tr(wish ? Str::AddedToWishlist : Str::RemovedFromWishlist);
+ toastUntil_ = 0;
+ }
rebuild();
prefsEvent(ev);
dirty_ = true;
@@ -1024,6 +1031,65 @@ void AppUi::refreshDetail() {
if (changed) dirty_ = true;
}
+static bool containsWordBoundary(const std::string& text, const std::string& token) {
+ size_t pos = 0;
+ while ((pos = text.find(token, pos)) != std::string::npos) {
+ bool startBound = (pos == 0 || !isalnum((unsigned char)text[pos - 1]));
+ bool endBound = (pos + token.size() >= text.size() || !isalnum((unsigned char)text[pos + token.size()]));
+ if (startBound && endBound) return true;
+ pos += token.size();
+ }
+ return false;
+}
+
+static bool matchSearchWord(const std::string& name, const std::string& word) {
+ if (name.find(word) != std::string::npos) return true;
+ static const std::pair<const char*, const char*> kRoman[] = {
+ {"1", "i"}, {"i", "1"},
+ {"2", "ii"}, {"ii", "2"},
+ {"3", "iii"}, {"iii", "3"},
+ {"4", "iv"}, {"iv", "4"},
+ {"4", "iiii"}, {"iiii", "4"},
+ {"5", "v"}, {"v", "5"},
+ {"6", "vi"}, {"vi", "6"},
+ };
+ for (const auto& [num, rom] : kRoman) {
+ if (word == num && containsWordBoundary(name, rom)) return true;
+ }
+ static const std::pair<const char*, const char*> kAcronyms[] = {
+ {"cod", "call of duty"},
+ {"cod4", "call of duty 4"},
+ {"codmw", "modern warfare"},
+ {"codmw4", "modern warfare 4"},
+ {"mw", "modern warfare"},
+ {"mw1", "modern warfare"},
+ {"mw2", "modern warfare ii"},
+ {"mwii", "modern warfare ii"},
+ {"mw3", "modern warfare iii"},
+ {"mwiii", "modern warfare iii"},
+ {"mw4", "modern warfare 4"},
+ {"mwiv", "modern warfare 4"},
+ {"bo", "black ops"},
+ {"bo1", "black ops"},
+ {"bo2", "black ops ii"},
+ {"bo3", "black ops iii"},
+ {"bo4", "black ops iiii"},
+ {"bo6", "black ops 6"},
+ {"bops", "black ops"},
+ {"gta", "grand theft auto"},
+ {"rdr", "red dead"},
+ {"re", "resident evil"},
+ {"ac", "assassin"},
+ {"gow", "gears of war"},
+ {"nfs", "need for speed"},
+ {"bf", "battlefield"},
+ };
+ for (const auto& [acro, full] : kAcronyms) {
+ if (word == acro && name.find(full) != std::string::npos) return true;
+ }
+ return false;
+}
+
void AppUi::runSearch() {
// Caller holds mutex_. The typed words narrow by name; the filters by
// price and console. With filters and no words: every game that passes.
@@ -1054,8 +1120,8 @@ void AppUi::runSearch() {
if (tab_ == Tab::GamePass && filterPlan_ != 4) {
if (filterPlan_ == 0) {
uint8_t myPlan = xcloud::planTier(subscription_);
- if (!t.freeInStore && (!t.playable || (myPlan > 0 && !xcloud::planIncludes(myPlan, t.plan, false))))
- continue;
+ bool inPlan = (myPlan > 0) ? xcloud::planIncludes(myPlan, t.plan, t.freeInStore) : true;
+ if (!t.freeInStore && !t.playable && !inPlan) continue;
} else {
uint8_t want = filterPlan_ == 1 ? xcloud::kPlanUltimate
: filterPlan_ == 2 ? xcloud::kPlanPremium
@@ -1085,8 +1151,11 @@ void AppUi::runSearch() {
// game given away (price 0 now, regular price above 0) is a
// sale, not free-to-play.
bool zeroNow = t.purchasable && priced && price->second.list < 0.005;
- bool freeToPlay = t.freeInStore || (zeroNow && price->second.msrp < 0.005);
- if (filterFree_ && !freeToPlay && !zeroNow) continue; // Free: both
+ bool freeToPlay = (t.freeInStore || (zeroNow && price->second.msrp < 0.005)) && !unclaimable_.count(t.productId);
+ if (filterFree_) {
+ if (!freeToPlay && !zeroNow) continue; // Free: both
+ if (t.playable || isAcquired(t)) continue; // Do not show games the user already owns on their account!
+ }
// Free-to-play games have their own filter: the price orders
// leave them out, unless Free is on too. Giveaways stay (first).
if (filterCheapest_ && freeToPlay && !filterFree_) continue;
@@ -1098,10 +1167,19 @@ void AppUi::runSearch() {
if (!words.empty()) {
bool all = true;
for (const auto& w : words)
- if (name.find(w) == std::string::npos) all = false;
+ if (!matchSearchWord(name, w)) all = false;
if (!all && withoutSpaces(name).find(compact) == std::string::npos) continue;
- // Starts with the query, then a word starting with it, then the rest.
- score = name.rfind(words[0], 0) == 0 ? 0 : name.find(" " + words[0]) != std::string::npos ? 1 : 2;
+ // Starts with the query or acronym, then a word starting with it, then the rest.
+ if (matchSearchWord(name, words[0])) {
+ score = name.rfind(words[0], 0) == 0 ? 0 : name.find(" " + words[0]) != std::string::npos ? 1 : 2;
+ if (words[0] == "cod" && name.find("call of duty") != std::string::npos) score = 0;
+ else if ((words[0] == "cod4" || words[0] == "mw4" || words[0] == "codmw4" ||
+ words[0] == "mwiv" || words[0] == "codmwiv") &&
+ (name.find("modern warfare 4") != std::string::npos || name.find("call of duty 4") != std::string::npos)) score = 0;
+ else if (words[0] == "codmw" && name.find("modern warfare") != std::string::npos) score = 0;
+ } else {
+ score = 2;
+ }
}
if (!t.playable) score += 3; // in "Your games": owned before games to buy
// Lowest price: by the price now (with any discount, not the regular
@@ -1126,7 +1204,7 @@ void AppUi::runSearch() {
void AppUi::showHome(const std::string& toast) {
std::lock_guard<std::mutex> lock(mutex_);
screen_ = Screen::Home;
- if (!toast.empty()) {
+ if (!caps_.console && !toast.empty()) {
toast_ = toast;
toastUntil_ = 0; // set on first render
}
@@ -1134,6 +1212,7 @@ void AppUi::showHome(const std::string& toast) {
}
void AppUi::showToast(const std::string& toast) {
+ if (caps_.console) return;
std::lock_guard<std::mutex> lock(mutex_);
if (!toast.empty()) {
toast_ = toast;
@@ -1151,8 +1230,20 @@ void AppUi::markTileOwned(const std::string& productId, const std::string& title
}
}
+void AppUi::markUnclaimable(const std::string& productId) {
+ std::lock_guard<std::mutex> lock(mutex_);
+ unclaimable_.insert(productId);
+ if (detail_.productId == productId) {
+ detail_.freeInStore = false;
+ dirty_ = true;
+ }
+}
+
void AppUi::showLaunching(const GameTile& game, const std::string& status) {
std::lock_guard<std::mutex> lock(mutex_);
+ if (screen_ != Screen::Launching) {
+ launchingStartMs_ = 0;
+ }
screen_ = Screen::Launching;
launching_ = game;
status_ = status;
@@ -1328,33 +1419,100 @@ void AppUi::handleKeysTester(const NavInput& in) {
}
void AppUi::openPadTester() {
- // Caller holds mutex_. A copy of the map in force (Settings', or the
- // game's with its settings open) is what the screen edits.
+ // Caller holds mutex_. A copy of the map and touchpad shortcuts in force
+ // (Settings', or the game's with its settings open) is what the screen edits.
tester_ = Tester::Pad;
padWork_ = gameSettingsOpen_ ? activeGameProfile_.padMap : settings_.padMap;
if (!input::padMapValid(padWork_)) padWork_ = input::defaultPadMap();
+ touchpadWork_ = gameSettingsOpen_ ? activeGameProfile_.touchpadShortcuts : settings_.touchpadShortcuts;
padRow_ = padCol_ = 0;
padCaptureSince_ = 0;
+ padTesterTab_ = 0;
+ touchpadRow_ = 0;
+ touchpadDropdownOpen_ = false;
+ touchpadDropdownIndex_ = 0;
+ touchpadDropdownTop_ = 0;
dirty_ = true;
}
void AppUi::handlePadTester(const NavInput& in) {
- // Caller holds mutex_. The screen reads the pad as it is (the map only
- // changes what a game is sent), so it always answers. Edits stay in
- // padWork_: Circle keeps them only when every Xbox button has one
- // button (else the screen stays, naming what's missing); "Reset to
- // default" and "Discard changes" are always there below.
- //
- // The map's sources are the pad's slots after "Circle confirms"
- // (input/pad_map.h): a press comes in with the menus' swap (circleConfirms_)
- // and is stored with the one the map plays under (the game's own with
- // its settings open).
+ if (touchpadDropdownOpen_) {
+ constexpr int kMaxVisible = 8;
+ constexpr int n = input::kTouchpadActions;
+ if (in.up) {
+ touchpadDropdownIndex_ = (touchpadDropdownIndex_ + n - 1) % n;
+ if (touchpadDropdownIndex_ < touchpadDropdownTop_) touchpadDropdownTop_ = touchpadDropdownIndex_;
+ else if (touchpadDropdownIndex_ >= touchpadDropdownTop_ + kMaxVisible)
+ touchpadDropdownTop_ = touchpadDropdownIndex_ - kMaxVisible + 1;
+ dirty_ = true;
+ }
+ if (in.down) {
+ touchpadDropdownIndex_ = (touchpadDropdownIndex_ + 1) % n;
+ if (touchpadDropdownIndex_ < touchpadDropdownTop_) touchpadDropdownTop_ = touchpadDropdownIndex_;
+ else if (touchpadDropdownIndex_ >= touchpadDropdownTop_ + kMaxVisible)
+ touchpadDropdownTop_ = touchpadDropdownIndex_ - kMaxVisible + 1;
+ dirty_ = true;
+ }
+ if (in.accept) {
+ touchpadWork_.set(touchpadRow_, static_cast<input::TouchpadAction>(touchpadDropdownIndex_));
+ touchpadDropdownOpen_ = false;
+ dirty_ = true;
+ }
+ if (in.back) {
+ touchpadDropdownOpen_ = false;
+ dirty_ = true;
+ }
+ return;
+ }
+
+ if (caps_.touchpad && (in.l1 || in.r1)) {
+ padTesterTab_ = 1 - padTesterTab_;
+ dirty_ = true;
+ return;
+ }
+
+ if (padTesterTab_ == 1) {
+ constexpr int kRows = input::kTouchpadTriggers + 1; // 0..5 triggers, 6 Reset to default
+ if (in.up) touchpadRow_ = (touchpadRow_ + kRows - 1) % kRows, dirty_ = true;
+ if (in.down) touchpadRow_ = (touchpadRow_ + 1) % kRows, dirty_ = true;
+ if (touchpadRow_ < input::kTouchpadTriggers) {
+ if (in.accept) {
+ touchpadDropdownOpen_ = true;
+ touchpadDropdownIndex_ = static_cast<int>(touchpadWork_.get(touchpadRow_));
+ constexpr int kMaxVisible = 8;
+ touchpadDropdownTop_ = std::clamp(touchpadDropdownIndex_ - 3, 0, std::max(0, input::kTouchpadActions - kMaxVisible));
+ dirty_ = true;
+ }
+ if (in.square) {
+ touchpadWork_.set(touchpadRow_, input::defaultTouchpadShortcuts().get(touchpadRow_));
+ dirty_ = true;
+ }
+ } else if (in.accept) {
+ touchpadWork_ = input::defaultTouchpadShortcuts();
+ dirty_ = true;
+ }
+ if (in.back) {
+ dirty_ = true;
+ if (!input::padMapValid(padWork_)) {
+ padTesterTab_ = 0;
+ return;
+ }
+ if (gameSettingsOpen_) {
+ if (padWork_ != activeGameProfile_.padMap) activeGameProfile_.padMap = padWork_, activeGameHasCustom_ = true;
+ if (touchpadWork_ != activeGameProfile_.touchpadShortcuts) activeGameProfile_.touchpadShortcuts = touchpadWork_, activeGameHasCustom_ = true;
+ } else {
+ settings_.padMap = padWork_;
+ settings_.touchpadShortcuts = touchpadWork_;
+ }
+ tester_ = Tester::None;
+ }
+ return;
+ }
+
const bool mapSwap = gameSettingsOpen_ ? activeGameProfile_.circleConfirms : settings_.circleConfirms;
constexpr int kPerColumn = input::kPadFns / 2, kButtonsRow = kPerColumn;
const auto fn = static_cast<input::PadFn>(padCol_ * kPerColumn + std::min(padRow_, kPerColumn - 1));
if (padCaptureSince_) {
- // Waiting for a press: the next button pressed (Circle too; the PS
- // / Home button isn't one) is the one; 5 s without one give up.
if (in.padPressed) {
uint8_t slot = 0;
while (!(in.padPressed & (1u << slot))) ++slot;
@@ -1388,18 +1546,30 @@ void AppUi::handlePadTester(const NavInput& in) {
if (!input::padMapValid(padWork_)) return; // incomplete: the warning says what's missing
if (gameSettingsOpen_) {
if (padWork_ != activeGameProfile_.padMap) activeGameProfile_.padMap = padWork_, activeGameHasCustom_ = true;
+ if (touchpadWork_ != activeGameProfile_.touchpadShortcuts) activeGameProfile_.touchpadShortcuts = touchpadWork_, activeGameHasCustom_ = true;
} else {
- settings_.padMap = padWork_; // saved with Settings, as the other choices
+ settings_.padMap = padWork_;
+ settings_.touchpadShortcuts = touchpadWork_;
}
tester_ = Tester::None;
}
}
+void AppUi::openTouchpadTester() {
+ openPadTester();
+ padTesterTab_ = 1;
+}
+
+void AppUi::handleTouchpadTester(const NavInput& in) {
+ handlePadTester(in);
+}
+
void AppUi::handleTester(const NavInput& in) {
// Caller holds mutex_. Changes apply as they are made (the pad follows);
// Cross keeps them, Circle puts the old ones back.
if (tester_ == Tester::Keys) return handleKeysTester(in);
if (tester_ == Tester::Pad) return handlePadTester(in);
+ if (tester_ == Tester::Touchpad) return handleTouchpadTester(in);
if (tester_ == Tester::Sticks) {
// L1 / R1 pick the stick, the D-pad (only: the sticks are what is
// being tried) changes its dead zone.
@@ -1729,6 +1899,7 @@ void AppUi::openGameSettings() {
activeGameProfile_.gyroMode = gyroMode_;
activeGameProfile_.gyroLevel = gyroLevel_;
activeGameProfile_.touchpadMouse = settings_.touchpadMouse;
+ activeGameProfile_.touchpadShortcuts = settings_.touchpadShortcuts;
}
}
@@ -1753,7 +1924,7 @@ void AppUi::setPads(const PadSlots& pads) {
bool changed = false;
for (size_t i = 0; i < pads.size(); ++i)
changed |= pads[i].connected != pads_[i].connected || pads[i].name != pads_[i].name ||
- pads[i].keyboard != pads_[i].keyboard; // the keyboard taking a player's slot, or leaving it
+ pads[i].keyboard != pads_[i].keyboard || pads[i].device != pads_[i].device;
if (!changed) return;
pads_ = pads;
dirty_ = true;
@@ -1848,6 +2019,8 @@ std::vector<std::string> AppUi::settingOptions(int row) const {
} else if (row == 14) {
// So do the controller buttons'.
out = {tr(settings_.padMap == input::defaultPadMap() ? Str::ProfileDefault : Str::ProfileCustom)};
+ } else if (row == 22) {
+ out = {tr(settings_.touchpadShortcuts == input::defaultTouchpadShortcuts() ? Str::ProfileDefault : Str::ProfileCustom)};
} else if (row == 15) {
out = {tr(Str::Off), tr(Str::GyroAlways), tr(Str::GyroAiming)};
} else if (row == 17) {
@@ -1860,6 +2033,8 @@ std::vector<std::string> AppUi::settingOptions(int row) const {
out = {tr(Str::VideoDecoderHw), tr(Str::VideoDecoderSw)};
} else if (row == 21) {
out = {tr(Str::Off), tr(Str::SharpLow), tr(Str::SharpMedium), tr(Str::SharpHigh)};
+ } else if (row == 23) {
+ out = {tr(Str::ResetSettings)};
} else if (row == 8) {
out.push_back(loginCountryOffText());
for (const char* country : kLoginCountries) out.push_back(loginCountryName(country));
@@ -1879,7 +2054,7 @@ int AppUi::settingSelected(int row) const {
for (int i = 0; i < 3; ++i)
if (kResolutionOrder[i] == settings_.resolution) return i;
}
- if (row == 3 || row == 12 || row == 14 || row == 17 || row == 18 || row == 19) return 0;
+ if (row == 3 || row == 12 || row == 14 || row == 17 || row == 18 || row == 19 || row == 22 || row == 23) return 0;
if (row == 4) return settings_.triggerStrength;
if (row == 5) return settings_.circleConfirms ? 1 : 0;
if (row == 6) return settings_.lightBarMode;
@@ -1925,8 +2100,8 @@ void AppUi::applySetting(int row, int index) {
setLanguage(static_cast<Language>(index)); // the UI switches right away
} else if (row == 1) {
settings_.resolution = kResolutionOrder[index];
- } else if (row == 3 || row == 12 || row == 14 || row == 17 || row == 18) {
- (void)index; // the tester sets each stick's, the keys' and buttons' screens theirs
+ } else if (row == 3 || row == 12 || row == 14 || row == 17 || row == 18 || row == 22 || row == 23) {
+ (void)index; // the tester sets each stick's, the keys', buttons' and touchpad's screens theirs
} else if (row == 4) {
settings_.triggerStrength = index;
} else if (row == 5) {
@@ -2609,6 +2784,15 @@ void AppUi::handleSearchKeys(const NavInput& in) {
void AppUi::handleGameSettings(const NavInput& in, UiEvent& ev) {
if (tester_ != Tester::None) {
handleTester(in);
+ if (tester_ == Tester::None) {
+ std::string key = app::gameProfileKey(detail_.productId, detail_.titleId);
+ if (activeGameHasCustom_) perGameSettings_[key] = activeGameProfile_;
+ else perGameSettings_.erase(key);
+ ev.action = Action::GameSettingsChanged;
+ ev.game = detail_;
+ ev.hasGameProfile = activeGameHasCustom_;
+ ev.gameProfile = activeGameProfile_;
+ }
return;
}
// The rows on screen (gameSettingsRow_ is a position among them).
@@ -2820,11 +3004,15 @@ void AppUi::handleGameSettings(const NavInput& in, UiEvent& ev) {
case 11: // Controller buttons: their own screen, on this game's
openPadTester();
break;
+ case 17: // Touchpad shortcuts: their own screen, on this game's
+ openTouchpadTester();
+ break;
case 10: // Reset to default
activeGameHasCustom_ = false;
activeGameProfile_.locale.clear();
activeGameProfile_.keyMap = settings_.keyMap;
activeGameProfile_.padMap = settings_.padMap;
+ activeGameProfile_.touchpadShortcuts = settings_.touchpadShortcuts;
activeGameProfile_.sharpness = settings_.sharpness;
activeGameProfile_.deband = settings_.deband;
activeGameProfile_.upscaler = settings_.upscaler;
@@ -2848,6 +3036,18 @@ void AppUi::handleGameSettings(const NavInput& in, UiEvent& ev) {
default: break;
}
}
+ if ((in.left || in.right || in.accept) && tester_ == Tester::None) {
+ std::string key = app::gameProfileKey(detail_.productId, detail_.titleId);
+ if (activeGameHasCustom_) {
+ perGameSettings_[key] = activeGameProfile_;
+ } else {
+ perGameSettings_.erase(key);
+ }
+ ev.action = Action::GameSettingsChanged;
+ ev.game = detail_;
+ ev.hasGameProfile = activeGameHasCustom_;
+ ev.gameProfile = activeGameProfile_;
+ }
if (in.back || in.options) {
gameSettingsOpen_ = false;
std::string key = app::gameProfileKey(detail_.productId, detail_.titleId);
@@ -2936,8 +3136,8 @@ UiEvent AppUi::onMouseMove(float x, float y) {
}
}
} else if (screen_ == Screen::Settings) {
- constexpr int kRowW = 1200, kRowH = 34, kGap = 2, kGroupGap = 6;
- int curY = 190;
+ constexpr int kRowW = 1200, kRowH = 32, kGap = 2, kGroupGap = 5;
+ int curY = 184;
for (const auto& [i, groupStart] : visibleSettingsRows(caps_)) {
if (groupStart) curY += kGroupGap;
if (x >= kMargin && x < kMargin + kRowW && y >= curY && y < curY + kRowH) {
@@ -2952,7 +3152,7 @@ UiEvent AppUi::onMouseMove(float x, float y) {
} else if (screen_ == Screen::Details) {
if (gameSettingsOpen_) {
constexpr int kModalW = 1140, kModalH = 960;
- constexpr int kRowH = 43, kGap = 4, kGroupGap = 8;
+ constexpr int kRowH = 40, kGap = 4, kGroupGap = 7;
const auto rows = visibleGameSettingsRows(caps_, activeGameHasCustom_, activeGameMouseSupported_);
const auto most = visibleGameSettingsRows(caps_, true, activeGameMouseSupported_), all = visibleGameSettingsRows(UiCaps{}, true, true);
auto groups = [](const std::vector<SettingsRowPos>& v) {
@@ -3135,7 +3335,7 @@ UiEvent AppUi::onMouseDown(float x, float y, int button) {
} else if (screen_ == Screen::Details) {
if (gameSettingsOpen_) {
constexpr int kModalW = 1140, kModalH = 960;
- constexpr int kRowH = 43, kGap = 4, kGroupGap = 8;
+ constexpr int kRowH = 40, kGap = 4, kGroupGap = 7;
const auto rows = visibleGameSettingsRows(caps_, activeGameHasCustom_, activeGameMouseSupported_);
const auto most = visibleGameSettingsRows(caps_, true, activeGameMouseSupported_), all = visibleGameSettingsRows(UiCaps{}, true, true);
auto groups = [](const std::vector<SettingsRowPos>& v) {
@@ -3185,15 +3385,15 @@ UiEvent AppUi::onMouseDown(float x, float y, int button) {
int n = static_cast<int>(options.size());
int visible = std::min(n, kVisible);
constexpr int kRowW = 1200;
- Rect panel{kMargin + kRowW - kListW, 190, kListW, visible * kItemH + 16};
- int curY = 190;
+ Rect panel{kMargin + kRowW - kListW, 184, kListW, visible * kItemH + 16};
+ int curY = 184;
for (const auto& [i, groupStart] : visibleSettingsRows(caps_)) {
- if (groupStart) curY += 6;
+ if (groupStart) curY += 5;
if (i == settingsRow_) {
- panel.y = curY + 34 + 8;
+ panel.y = curY + 32 + 8;
break;
}
- curY += 34 + 2;
+ curY += 32 + 2;
}
if (panel.y + panel.h > kH - 100) panel.y = std::max(120, kH - 100 - panel.h);
@@ -3216,8 +3416,8 @@ UiEvent AppUi::onMouseDown(float x, float y, int button) {
return ev;
}
}
- constexpr int kRowW = 1200, kRowH = 34, kGap = 2, kGroupGap = 6;
- int curY = 190;
+ constexpr int kRowW = 1200, kRowH = 32, kGap = 2, kGroupGap = 5;
+ int curY = 184;
for (const auto& [i, groupStart] : visibleSettingsRows(caps_)) {
if (groupStart) curY += kGroupGap;
if (x >= kMargin && x < kMargin + kRowW && y >= curY && y < curY + kRowH) {
@@ -3232,6 +3432,9 @@ UiEvent AppUi::onMouseDown(float x, float y, int button) {
ev.action = Action::OpenUrl;
ev.url = "https://ko-fi.com/rafaelngp";
return ev;
+ } else if (i == 22) {
+ openTouchpadTester();
+ return ev;
} else if (i == 5) {
settings_.circleConfirms = !settings_.circleConfirms;
ev.action = Action::SettingsChanged;
@@ -3451,6 +3654,10 @@ UiEvent AppUi::handle(const NavInput& in) {
case Screen::Settings:
if (pickerOpen_) {
handleColourPicker(in);
+ if (!pickerOpen_ && in.accept) {
+ ev.action = Action::SettingsChanged;
+ ev.settings = settings_;
+ }
break;
}
if (tester_ == Tester::SignInCheck) {
@@ -3480,6 +3687,10 @@ UiEvent AppUi::handle(const NavInput& in) {
}
if (tester_ != Tester::None) {
handleTester(in);
+ if (tester_ == Tester::None) {
+ ev.action = Action::SettingsChanged;
+ ev.settings = settings_;
+ }
break;
}
if (dropdownOpen_) {
@@ -3490,19 +3701,57 @@ UiEvent AppUi::handle(const NavInput& in) {
int before = settingSelected(settingsRow_);
if (in.accept) applySetting(settingsRow_, dropdownIndex_);
if (in.accept || in.back) dropdownOpen_ = false;
- if (in.accept && settingsRow_ == 6 && dropdownIndex_ == 1) openColourPicker(before);
+ if (in.accept && settingsRow_ == 6 && dropdownIndex_ == 1) {
+ openColourPicker(before);
+ } else if (in.accept && settingsRow_ != 8) {
+ ev.action = Action::SettingsChanged;
+ ev.settings = settings_;
+ }
dirty_ = true;
break;
}
if (auto rows = visibleSettingsRows(caps_); true) { // the rows on screen, in their order
int pos = posOf(rows, settingsRow_);
- if (in.down && pos + 1 < static_cast<int>(rows.size()))
- settingsRow_ = rows[static_cast<size_t>(pos + 1)].row, dirty_ = true;
- else if (in.up && pos > 0)
- settingsRow_ = rows[static_cast<size_t>(pos - 1)].row, dirty_ = true;
+ if (in.down && pos + 1 < static_cast<int>(rows.size())) {
+ settingsRow_ = rows[static_cast<size_t>(pos + 1)].row;
+ resetSettingsHoldStart_ = 0;
+ dirty_ = true;
+ } else if (in.up && pos > 0) {
+ settingsRow_ = rows[static_cast<size_t>(pos - 1)].row;
+ resetSettingsHoldStart_ = 0;
+ dirty_ = true;
+ }
+ }
+ if (settingsRow_ == 23) {
+ if (in.acceptHeld) {
+ if (!resetSettingsHoldStart_) resetSettingsHoldStart_ = in.nowMs ? in.nowMs : 1;
+ if (in.nowMs - resetSettingsHoldStart_ >= 5000) {
+ ev.action = Action::ResetSettings;
+ resetSettingsHoldStart_ = 0;
+ }
+ animating_ = true;
+ dirty_ = true;
+ } else if (resetSettingsHoldStart_) {
+ resetSettingsHoldStart_ = 0;
+ dirty_ = true;
+ }
+ } else {
+ resetSettingsHoldStart_ = 0;
+ }
+ if (in.right && settingsRow_ != 23) {
+ changeSetting(+1);
+ if (settingsRow_ != 8) {
+ ev.action = Action::SettingsChanged;
+ ev.settings = settings_;
+ }
+ }
+ if (in.left && settingsRow_ != 23) {
+ changeSetting(-1);
+ if (settingsRow_ != 8) {
+ ev.action = Action::SettingsChanged;
+ ev.settings = settings_;
+ }
}
- if (in.right) changeSetting(+1);
- if (in.left) changeSetting(-1);
if (in.square && settingsRow_ == 16) {
ev.action = Action::TestQueueAlert;
}
@@ -3536,6 +3785,8 @@ UiEvent AppUi::handle(const NavInput& in) {
// 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 && settingsRow_ == 23) {
+ // Handled via hold
} else if (in.accept) {
dropdownOpen_ = true;
dropdownIndex_ = settingSelected(settingsRow_);
@@ -3543,6 +3794,7 @@ UiEvent AppUi::handle(const NavInput& in) {
dirty_ = true;
}
if (in.back || in.options) {
+ resetSettingsHoldStart_ = 0;
// Back where Settings was opened. A new sign-in country
// takes a new sign-in.
screen_ = settingsFromError_ ? Screen::Error : Screen::Home;
@@ -3619,13 +3871,15 @@ UiEvent AppUi::handle(const NavInput& in) {
case Screen::Error:
if (!errorGame_.titleId.empty() || !errorGame_.productId.empty()) {
if (in.accept) {
- if (isFreeGame(errorGame_) && !errorGame_.playable) {
+ if ((isFreeGame(errorGame_) || errorGame_.freeInStore) && !errorGame_.playable) {
ev.action = Action::ClaimFreeGame;
ev.game = errorGame_;
ev.game.freeInStore = true;
} else if (errorGame_.playable && !errorGame_.titleId.empty()) {
ev.action = Action::Play;
ev.game = errorGame_;
+ } else {
+ openDetails(errorGame_);
}
} else if (in.back && errorGame_.homeConsole) {
screen_ = Screen::Home; // back to My consoles
@@ -3829,26 +4083,26 @@ void AppUi::drawHints(Canvas& c, const std::vector<std::pair<int, const char*>>&
float cx = x + kR, cy = y + 13;
const GlyphStyle style = g_glyphStyle;
const bool xbox = style == GlyphStyle::Xbox;
- if (icon == kIconL2R2) {
- const char* l2 = buttonName(style, PadButton::L2);
- const char* r2 = buttonName(style, PadButton::R2);
- int l2w = fonts_.bold.measure(l2, 14) + 16;
- int r2w = fonts_.bold.measure(r2, 14) + 16;
+ if (icon == kIconL2R2 || icon == kIconL1R1) {
+ const char* l = buttonName(style, icon == kIconL1R1 ? PadButton::L1 : PadButton::L2);
+ const char* r = buttonName(style, icon == kIconL1R1 ? PadButton::R1 : PadButton::R2);
+ int lw = fonts_.bold.measure(l, 14) + 16;
+ int rw = fonts_.bold.measure(r, 14) + 16;
int sepW = fonts_.regular.measure("|", 14);
constexpr int kPillGap = 6;
int rightX = x + 2 * kR;
- Rect r2Pill{rightX - r2w, static_cast<int>(cy) - 12, r2w, 24};
- c.fillRect(r2Pill, rgba(255, 255, 255, 40), 8);
- fonts_.bold.draw(c, r2, r2Pill.x + (r2w - fonts_.bold.measure(r2, 14)) / 2,
- fonts_.bold.centeredY(r2Pill.y, r2Pill.h, 14), 14, kGray);
- int sepX = r2Pill.x - kPillGap - sepW;
+ 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);
+ int sepX = rPill.x - kPillGap - sepW;
fonts_.regular.draw(c, "|", sepX, fonts_.regular.centeredY(static_cast<int>(cy) - 12, 24, 14), 14,
rgba(255, 255, 255, 120));
- Rect l2Pill{sepX - kPillGap - l2w, static_cast<int>(cy) - 12, l2w, 24};
- c.fillRect(l2Pill, rgba(255, 255, 255, 40), 8);
- 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;
+ Rect lPill{sepX - 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 == kIconDpadLR) {
const char* l = "\xE2\x86\x90";
const char* r = "\xE2\x86\x92";
@@ -3899,6 +4153,7 @@ void AppUi::drawSpinner(Canvas& c, float cx, float cy, float r, uint64_t nowMs)
}
void AppUi::drawToast(Canvas& c, uint64_t nowMs) {
+ if (caps_.console) return;
if (toast_.empty()) return;
if (toastUntil_ == 0) toastUntil_ = nowMs + 3500;
if (nowMs >= toastUntil_) {
@@ -4986,7 +5241,7 @@ 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);
- // Helpful tips rotating every ~5 seconds.
+ // Helpful tips rotating every ~10 seconds from when the launching screen opened.
static constexpr Str kTips[] = {
Str::TipTouchpadMenu,
Str::TipKeyboardMouse,
@@ -4998,7 +5253,9 @@ void AppUi::drawLaunching(Canvas& c, uint64_t nowMs) {
Str::TipDualSenseMic,
};
constexpr size_t kTipCount = sizeof(kTips) / sizeof(kTips[0]);
- size_t tipIndex = (nowMs / 5000) % kTipCount;
+ if (!launchingStartMs_) launchingStartMs_ = nowMs;
+ uint64_t elapsedMs = nowMs >= launchingStartMs_ ? (nowMs - launchingStartMs_) : 0;
+ size_t tipIndex = (elapsedMs / 10000) % kTipCount;
drawCentered(c, fonts_.regular, tr(kTips[tipIndex]), 900, 22, kDim);
drawHints(c, {{kIconCircle, tr(Str::Cancel)}});
}
@@ -5026,8 +5283,11 @@ void AppUi::drawError(Canvas& c) {
}
drawQr(c, errorUrl_, panel.x + panel.w - 56, panel.y + 56, 320, qrcodegen_Ecc_LOW);
}
- if (!errorGame_.titleId.empty())
- drawHints(c, {{kIconCross, tr(Str::TryAgain)}, {kIconTriangle, tr(Str::ReportProblem)}, {kIconCircle, tr(Str::Back)}});
+ if (!errorGame_.titleId.empty() || !errorGame_.productId.empty()) {
+ bool free = (isFreeGame(errorGame_) || errorGame_.freeInStore) && !errorGame_.playable;
+ const char* acceptLabel = free ? tr(Str::ClaimFree) : tr(Str::TryAgain);
+ drawHints(c, {{kIconCross, acceptLabel}, {kIconTriangle, tr(Str::ReportProblem)}, {kIconCircle, tr(Str::Back)}});
+ }
else if (regionRefused_)
drawHints(c, {{kIconCross, tr(Str::TryAgain)}, {kIconSquare, tr(Str::TryOtherCountry)},
{kIconOptions, tr(Str::Settings)}, {kIconTriangle, tr(Str::ReportProblem)},
@@ -5040,7 +5300,7 @@ void AppUi::drawError(Canvas& c) {
void AppUi::drawSettings(Canvas& c) {
drawBackground(c);
drawTopBar(c);
- fonts_.bold.draw(c, tr(Str::Settings), kMargin, 136, 48, kWhite);
+ fonts_.bold.draw(c, tr(Str::Settings), kMargin, 134, 46, kWhite);
const char* labels[kSettingRows] = {tr(Str::Language), tr(Str::Resolution), tr(Str::Region),
tr(Str::Deadzone), tr(Str::TriggerRumble), tr(Str::ConfirmButton),
tr(Str::LightBar), tr(Str::Updates), tr(Str::LoginCountry),
@@ -5048,71 +5308,75 @@ void AppUi::drawSettings(Canvas& c) {
tr(Str::KeyboardKeys), tr(Str::DisplayMode), tr(Str::ControllerButtons),
tr(Str::Gyro), tr(Str::QueueReadyNotification),
tr(Str::CheckSignIn), tr(Str::NetworkTest), tr(Str::SupportProject),
- tr(Str::VideoDecoder), tr(Str::AudioHaptics)};
- constexpr int kRowW = 1200, kRowH = 34, kGap = 2, kGroupGap = 6, kRowPx = 23;
+ tr(Str::VideoDecoder), tr(Str::AudioHaptics), tr(Str::TouchpadShortcuts),
+ tr(Str::ResetSettings)};
+ constexpr int kRowW = 1140, kRowH = 32, kGap = 2, kGroupGap = 5, kRowPx = 22;
Rect rows[kSettingRows]; // by row id
- int y = 190;
+ int y = 184;
for (const auto& [i, groupStart] : visibleSettingsRows(caps_)) { // what caps_ rules out is hidden
if (groupStart) y += kGroupGap;
Rect r{kMargin, y, kRowW, kRowH};
rows[i] = r;
bool focused = i == settingsRow_;
- c.fillRect(r, focused ? rgba(255, 255, 255, 36) : rgba(255, 255, 255, 14), 12);
- if (focused && !dropdownOpen_) c.strokeRect({r.x - 4, r.y - 4, r.w + 8, r.h + 8}, kWhite, 3, 16);
int ty = fonts_.semibold.centeredY(r.y, r.h, kRowPx);
- fonts_.semibold.draw(c, labels[i], r.x + 32, ty, kRowPx, kWhite);
- if (i == 7) {
- // Updates: the state; Cross updates when there is a newer version.
- std::string value = updateChecking_ ? tr(Str::UpdateChecking)
- : !updateAvailable_.empty()
- ? trf(caps_.selfUpdate ? Str::UpdateReady : Str::UpdateReadyPc, updateAvailable_)
- : trf(Str::UpToDate, "v" + updateCurrent_);
- Color color = !updateAvailable_.empty() && !updateChecking_ ? rgba(120, 220, 120) : focused ? kWhite : kGray;
- int w = fonts_.regular.measure(value, kRowPx);
- fonts_.regular.draw(c, value, r.x + r.w - 40 - w, fonts_.regular.centeredY(r.y, r.h, kRowPx), kRowPx, color);
- y += kRowH + kGap;
- continue;
- }
- if (i == 17 || i == 18 || i == 19) {
- // Action items without chevrons or pills: clean right-aligned text
- std::string label = (i == 17) ? tr(Str::RunCheck) : (i == 18) ? tr(Str::RunTest) : tr(Str::SupportKoFi);
- int w = fonts_.regular.measure(label, kRowPx);
- int vx = r.x + r.w - 40;
- fonts_.regular.draw(c, label, vx - w, fonts_.regular.centeredY(r.y, r.h, kRowPx), kRowPx,
- focused ? kWhite : kGray);
- 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);
- std::string value = sel < static_cast<int>(options.size()) ? options[static_cast<size_t>(sel)] : "";
- float cx = static_cast<float>(r.x + r.w - 40), cy = static_cast<float>(r.y + r.h / 2);
- c.line(cx - 8, cy - 3, cx, cy + 4, 2.5f, focused ? kWhite : kGray);
- c.line(cx, cy + 4, cx + 8, cy - 3, 2.5f, focused ? kWhite : kGray);
- int vx = r.x + r.w - 68;
- if (i == 5) {
- // The confirm button, as the button itself.
- drawFaceButton(c, fonts_.bold, settings_.circleConfirms ? kIconCircle : kIconCross, vx - 16.0f, cy, 16);
+
+ if (i == 23) {
+ // Restore factory defaults button: red background
+ Color redBg = focused ? rgba(220, 38, 38, 255) : rgba(185, 28, 28, 220);
+ c.fillRect(r, redBg, 12);
+ if (focused && !dropdownOpen_) c.strokeRect({r.x - 4, r.y - 4, r.w + 8, r.h + 8}, kWhite, 3, 16);
+
+ // Progress fill animation when holding Cross/accept
+ if (focused && resetSettingsHoldStart_ > 0) {
+ uint64_t elapsed = (lastRender_ > resetSettingsHoldStart_) ? (lastRender_ - resetSettingsHoldStart_) : 0;
+ float progress = std::min(1.0f, static_cast<float>(elapsed) / 5000.0f);
+ int fillW = static_cast<int>(r.w * progress);
+ if (fillW > 0) {
+ c.fillRect({r.x, r.y, fillW, r.h}, rgba(255, 255, 255, 70), 12);
+ }
+ }
+ int textW = fonts_.bold.measure(labels[i], kRowPx);
+ int textX = r.x + (r.w - textW) / 2;
+ fonts_.bold.draw(c, labels[i], textX, ty, kRowPx, kWhite);
} else {
- int w = fonts_.regular.measure(value, kRowPx);
- fonts_.regular.draw(c, value, vx - w, fonts_.regular.centeredY(r.y, r.h, kRowPx), kRowPx, focused ? kWhite : kGray);
- if (i == 6 && settings_.lightBarMode == 1) { // the colour chosen
- c.fillCircle(vx - w - 26.0f, cy, 11, settings_.lightBarColour);
- c.strokeArc(vx - w - 26.0f, cy, 11, 2, 0, 6.2832f, rgba(255, 255, 255, 120));
+ c.fillRect(r, focused ? rgba(255, 255, 255, 36) : rgba(255, 255, 255, 14), 12);
+ if (focused && !dropdownOpen_) c.strokeRect({r.x - 4, r.y - 4, r.w + 8, r.h + 8}, kWhite, 3, 16);
+ fonts_.semibold.draw(c, labels[i], r.x + 32, ty, kRowPx, kWhite);
+ float cx = static_cast<float>(r.x + r.w - 40), cy = static_cast<float>(r.y + r.h / 2);
+ if (i != 7 && i != 17 && i != 18 && i != 19) {
+ c.line(cx - 8, cy - 3, cx, cy + 4, 2.5f, focused ? kWhite : kGray);
+ c.line(cx, cy + 4, cx + 8, cy - 3, 2.5f, focused ? kWhite : kGray);
+ }
+ int vx = r.x + r.w - 68;
+
+ if (i == 7) {
+ // Updates: the state; Cross updates when there is a newer version.
+ std::string value = updateChecking_ ? tr(Str::UpdateChecking)
+ : !updateAvailable_.empty()
+ ? trf(caps_.selfUpdate ? Str::UpdateReady : Str::UpdateReadyPc, updateAvailable_)
+ : trf(Str::UpToDate, "v" + updateCurrent_);
+ Color color = !updateAvailable_.empty() && !updateChecking_ ? rgba(120, 220, 120) : focused ? kWhite : kGray;
+ int w = fonts_.regular.measure(value, kRowPx);
+ fonts_.regular.draw(c, value, vx - w, fonts_.regular.centeredY(r.y, r.h, kRowPx), kRowPx, color);
+ } else if (i == 17 || i == 18 || i == 19) {
+ // Action items (Check sign-in, Network test, Support)
+ std::string label = (i == 17) ? tr(Str::RunCheck) : (i == 18) ? tr(Str::RunTest) : tr(Str::SupportKoFi);
+ int w = fonts_.regular.measure(label, kRowPx);
+ fonts_.regular.draw(c, label, vx - w, fonts_.regular.centeredY(r.y, r.h, kRowPx), kRowPx,
+ focused ? kWhite : kGray);
+ } else if (i == 5) {
+ // The confirm button, as the button itself.
+ drawFaceButton(c, fonts_.bold, settings_.circleConfirms ? kIconCircle : kIconCross, vx - 16.0f, cy, 16);
+ } else {
+ auto options = settingOptions(i);
+ int sel = settingSelected(i);
+ std::string value = sel < static_cast<int>(options.size()) ? options[static_cast<size_t>(sel)] : "";
+ int w = fonts_.regular.measure(value, kRowPx);
+ fonts_.regular.draw(c, value, vx - w, fonts_.regular.centeredY(r.y, r.h, kRowPx), kRowPx, focused ? kWhite : kGray);
+ if (i == 6 && settings_.lightBarMode == 1) { // the colour chosen
+ c.fillCircle(vx - w - 26.0f, cy, 11, settings_.lightBarColour);
+ c.strokeArc(vx - w - 26.0f, cy, 11, 2, 0, 6.2832f, rgba(255, 255, 255, 120));
+ }
}
}
y += kRowH + kGap;
@@ -5140,6 +5404,8 @@ void AppUi::drawSettings(Canvas& c) {
Str::SettingDescSupportProject,
Str::SettingDescVideoDecoder,
Str::SettingDescAudioHaptics,
+ Str::SettingDescTouchpadShortcuts,
+ Str::SettingDescResetSettings,
};
if (settingsRow_ >= 0 && settingsRow_ < kSettingRows) {
int dy = 925;
@@ -5150,35 +5416,47 @@ void AppUi::drawSettings(Canvas& c) {
}
}
- // Web UI / Remote QR panel on the right side (x = 1320..1840)
+ // Web UI / Remote QR panel on the right side (x = 1310..1850)
if (tester_ == Tester::None && !pickerOpen_) {
std::string qrUrl = !webUrl_.empty() ? webUrl_ : "http://" + platform::localIPv4() + ":8080";
- Rect panel{1320, 200, 500, 710};
+ Rect panel{1310, 184, 540, 724};
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);
+ int py = panel.y + 30;
+ int titleW = fonts_.bold.measure(tr(Str::WebControlTitle), 28);
+ fonts_.bold.draw(c, tr(Str::WebControlTitle), panel.x + (panel.w - titleW) / 2, py, 28, 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);
+ auto descLines = fonts_.regular.wrap(tr(Str::WebControlDesc), 17, panel.w - 56, 5);
for (const auto& l : descLines) {
- fonts_.regular.draw(c, l, panel.x + 28, py, 20, kGray);
- py += 26;
+ int lw = fonts_.regular.measure(l, 17);
+ fonts_.regular.draw(c, l, panel.x + (panel.w - lw) / 2, py, 17, kGray);
+ py += 22;
}
- 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;
+ uint8_t qrBuf[qrcodegen_BUFFER_LEN_MAX], tmpBuf[qrcodegen_BUFFER_LEN_MAX];
+ int qrTarget = 260;
+ int qrCardW = 300;
+ if (qrcodegen_encodeText(qrUrl.c_str(), tmpBuf, qrBuf, qrcodegen_Ecc_LOW, qrcodegen_VERSION_MIN, qrcodegen_VERSION_MAX, qrcodegen_Mask_AUTO, true)) {
+ int n = qrcodegen_getSize(qrBuf);
+ int mod = qrTarget / (n + 2);
+ qrCardW = mod * (n + 2) + 40;
+ }
+ int qrRight = panel.x + (panel.w + qrCardW) / 2;
- int urlW = fonts_.semibold.measure(qrUrl, 22);
- int urlX = panel.x + (panel.w - urlW) / 2;
- fonts_.semibold.draw(c, qrUrl, urlX, py, 22, kWhite);
+ Rect pill{panel.x + 36, panel.y + panel.h - 42 - 18, panel.w - 72, 42};
+
+ // Center QR vertically in available space between py and pill.y
+ int availH = pill.y - py;
+ int qrTop = py + (availH - qrCardW) / 2;
+ drawQr(c, qrUrl, qrRight, qrTop, qrTarget, qrcodegen_Ecc_LOW);
+
+ c.fillRect(pill, rgba(0, 0, 0, 70), 12);
+ c.strokeRect(pill, rgba(255, 255, 255, 30), 1, 12);
+
+ int urlW = fonts_.semibold.measure(qrUrl, 20);
+ fonts_.semibold.draw(c, qrUrl, pill.x + (pill.w - urlW) / 2, fonts_.semibold.centeredY(pill.y, pill.h, 20), 20, rgba(140, 230, 160));
}
if (pickerOpen_) {
@@ -5189,6 +5467,7 @@ void AppUi::drawSettings(Canvas& c) {
if (tester_ == Tester::Triggers) return drawTriggerTester(c);
if (tester_ == Tester::Keys) return drawKeysTester(c);
if (tester_ == Tester::Pad) return drawPadTester(c);
+ if (tester_ == Tester::Touchpad) return drawTouchpadTester(c);
if (tester_ == Tester::SignInCheck) return drawSignInCheck(c, lastRender_);
if (tester_ == Tester::NetworkTest) return drawNetworkTest(c, lastRender_);
if (tester_ == Tester::Donation) return drawDonationModal(c);
@@ -5240,7 +5519,9 @@ void AppUi::drawSettings(Canvas& c) {
}
drawHints(c, {{kIconCross, tr(Str::Select)}, {kIconCircle, tr(Str::Back)}});
} else {
- if (settingsRow_ == 16) {
+ if (settingsRow_ == 23) {
+ drawHints(c, {{kIconCross, tr(Str::HoldToReset)}, {kIconTriangle, tr(Str::ReportProblem)}, {kIconCircle, tr(Str::Back)}});
+ } 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)}});
@@ -5589,6 +5870,125 @@ void AppUi::drawTriggerTester(Canvas& c) {
void AppUi::drawPadTester(Canvas& c) {
Rect panel = drawModal(c, 1500, 860, tr(Str::ControllerButtons));
+
+ // Top tab selector: [ Botões ] [ Touchpad ]
+ if (caps_.touchpad) {
+ int tabW = 280, tabH = 38, tabGap = 20;
+ int totalTabsW = 2 * tabW + tabGap;
+ int tabStartX = panel.x + (panel.w - totalTabsW) / 2;
+ int tabY = panel.y + 60;
+
+ auto shoulder = [&](const char* name, int cx) {
+ Rect r{cx - 22, tabY + 5, 44, 28};
+ c.fillRect(r, rgba(255, 255, 255, 40), 8);
+ fonts_.bold.draw(c, name, cx - fonts_.bold.measure(name, 16) / 2, fonts_.bold.centeredY(r.y, r.h, 16), 16, kGray);
+ };
+ shoulder(g_keyboardHints ? "Q" : buttonName(g_glyphStyle, PadButton::L1), tabStartX - 32);
+
+ for (int t = 0; t < 2; ++t) {
+ Rect trRect{tabStartX + t * (tabW + tabGap), tabY, tabW, tabH};
+ bool active = (padTesterTab_ == t);
+ c.fillRect(trRect, active ? rgba(255, 255, 255, 40) : rgba(255, 255, 255, 14), 12);
+ if (active) c.strokeRect(trRect, kWhite, 2, 12);
+ const char* tabLabel = t == 0 ? tr(Str::ControllerButtons) : tr(Str::TouchpadShortcuts);
+ int tw = fonts_.semibold.measure(tabLabel, 22);
+ fonts_.semibold.draw(c, tabLabel, trRect.x + (trRect.w - tw) / 2,
+ fonts_.semibold.centeredY(trRect.y, trRect.h, 22), 22, active ? kWhite : kGray);
+ }
+
+ shoulder(g_keyboardHints ? "E" : buttonName(g_glyphStyle, PadButton::R1), tabStartX + totalTabsW + 32);
+ }
+
+ if (padTesterTab_ == 1) {
+ constexpr int kTouchRowH = 56, kTouchGap = 8;
+ const input::TouchpadAction vals[6] = {
+ touchpadWork_.swipeUp, touchpadWork_.swipeDown,
+ touchpadWork_.swipeLeft, touchpadWork_.swipeRight,
+ touchpadWork_.clickLeft, touchpadWork_.clickRight,
+ };
+ int y = panel.y + 116;
+ for (int i = 0; i < 6; ++i) {
+ Rect r{panel.x + 80, y, panel.w - 160, kTouchRowH};
+ bool on = (touchpadRow_ == i);
+ c.fillRect(r, on ? rgba(255, 255, 255, 36) : rgba(255, 255, 255, 14), 14);
+ if (on && !touchpadDropdownOpen_) c.strokeRect({r.x - 4, r.y - 4, r.w + 8, r.h + 8}, kWhite, 2, 18);
+ int ty = fonts_.semibold.centeredY(r.y, r.h, 26);
+ fonts_.semibold.draw(c, touchpadTriggerLabel(i), r.x + 32, ty, 26, kWhite);
+
+ float cx = static_cast<float>(r.x + r.w - 40), cy = static_cast<float>(r.y + r.h / 2);
+ c.line(cx - 8, cy - 3, cx, cy + 4, 2.5f, on ? kWhite : kGray);
+ c.line(cx, cy + 4, cx + 8, cy - 3, 2.5f, on ? kWhite : kGray);
+
+ std::string val = touchpadActionLabel(static_cast<int>(vals[i]));
+ int vw = fonts_.regular.measure(val, 26);
+ int vx = r.x + r.w - 68;
+ fonts_.regular.draw(c, val, vx - vw, fonts_.regular.centeredY(r.y, r.h, 26), 26, on ? kWhite : kGray);
+
+ y += kTouchRowH + kTouchGap;
+ }
+
+ Rect reset{panel.x + 80, y + 8, panel.w - 160, kTouchRowH};
+ bool resetOn = (touchpadRow_ == 6);
+ c.fillRect(reset, resetOn ? rgba(255, 255, 255, 36) : rgba(255, 255, 255, 14), 14);
+ if (resetOn && !touchpadDropdownOpen_) c.strokeRect({reset.x - 4, reset.y - 4, reset.w + 8, reset.h + 8}, kWhite, 2, 18);
+ const char* resetLabel = tr(Str::ResetToDefault);
+ fonts_.semibold.draw(c, resetLabel, reset.x + (reset.w - fonts_.semibold.measure(resetLabel, 24)) / 2,
+ fonts_.semibold.centeredY(reset.y, reset.h, 24), 24, resetOn ? kWhite : rgba(240, 100, 100));
+
+ int hy = reset.y + kTouchRowH + 22;
+ auto help = fonts_.regular.wrap(tr(Str::SettingDescTouchpadShortcuts), 22, panel.w - 160, 2);
+ for (size_t i = 0; i < help.size(); ++i)
+ fonts_.regular.draw(c, help[i], panel.x + 80, hy + static_cast<int>(i) * 28, 22, kDim);
+
+ if (touchpadDropdownOpen_) {
+ constexpr int kListW = 500, kItemH = 46, kMaxVisible = 8;
+ constexpr int n = input::kTouchpadActions;
+ int visible = std::min(n, kMaxVisible);
+ int anchorY = panel.y + 116 + touchpadRow_ * (kTouchRowH + kTouchGap);
+ Rect dropPanel{panel.x + panel.w - 80 - kListW, anchorY + kTouchRowH + 6, kListW, visible * kItemH + 16};
+ if (dropPanel.y + dropPanel.h > kH - 100) dropPanel.y = std::max(120, anchorY - dropPanel.h - 6);
+ c.fillRect({dropPanel.x + 6, dropPanel.y + 10, dropPanel.w, dropPanel.h}, rgba(0, 0, 0, 160), 18);
+ c.fillRect(dropPanel, rgba(38, 38, 38), 18);
+ c.strokeRect(dropPanel, rgba(255, 255, 255, 60), 2, 18);
+ int curAction = static_cast<int>(touchpadWork_.get(touchpadRow_));
+ for (int k = 0; k < visible; ++k) {
+ int itemIdx = touchpadDropdownTop_ + k;
+ if (itemIdx >= n) break;
+ Rect item{dropPanel.x + 8, dropPanel.y + 8 + k * kItemH, dropPanel.w - 16, kItemH};
+ bool isFocused = (itemIdx == touchpadDropdownIndex_);
+ bool isSelected = (itemIdx == curAction);
+ if (isFocused) c.fillRect(item, kWhite, 12);
+ Color textCol = isFocused ? kBg : (isSelected ? kWhite : kGray);
+ std::string itemText = touchpadActionLabel(itemIdx);
+ fonts_.semibold.draw(c, itemText, item.x + 24, fonts_.semibold.centeredY(item.y, item.h, 24), 24, textCol);
+ if (isSelected) {
+ float markX = static_cast<float>(item.x + item.w - 36), markY = static_cast<float>(item.y + item.h / 2);
+ c.line(markX - 10, markY, markX - 3, markY + 7, 3, isFocused ? kBg : kGreen);
+ c.line(markX - 3, markY + 7, markX + 10, markY - 7, 3, isFocused ? kBg : kGreen);
+ }
+ }
+ if (touchpadDropdownTop_ > 0) {
+ float scx = static_cast<float>(dropPanel.x + dropPanel.w / 2), scy = static_cast<float>(dropPanel.y - 14);
+ c.line(scx - 10, scy + 4, scx, scy - 4, 3, kGray);
+ c.line(scx, scy - 4, scx + 10, scy + 4, 3, kGray);
+ }
+ if (touchpadDropdownTop_ + visible < n) {
+ float scx = static_cast<float>(dropPanel.x + dropPanel.w / 2), scy = static_cast<float>(dropPanel.y + dropPanel.h + 14);
+ c.line(scx - 10, scy - 4, scx, scy + 4, 3, kGray);
+ c.line(scx, scy + 4, scx + 10, scy - 4, 3, kGray);
+ }
+ }
+
+ c.fillRect({0, kH - 80, kW, 80}, kBg);
+ if (touchpadDropdownOpen_)
+ drawHints(c, {{kIconCross, tr(Str::Select)}, {kIconCircle, tr(Str::Back)}});
+ else if (resetOn)
+ drawHints(c, {{kIconCross, tr(Str::Select)}, {kIconL1R1, tr(Str::Sections)}, {kIconCircle, tr(Str::Back)}});
+ else
+ drawHints(c, {{kIconCross, tr(Str::Change)}, {kIconSquare, tr(Str::ClearKey)}, {kIconL1R1, tr(Str::Sections)}, {kIconCircle, tr(Str::Back)}});
+ return;
+ }
+
// Each Xbox button the game gets (as an Xbox pad shows it), then the
// button on this pad that plays it (in the pad's own glyphs). Left
// column the face buttons, shoulders and triggers; right the rest.
@@ -5674,9 +6074,14 @@ void AppUi::drawPadTester(Canvas& c) {
if (capturing)
return;
if (padRow_ == kPerColumn)
- drawHints(c, {{kIconCross, tr(Str::Select)}, {kIconCircle, tr(Str::Back)}});
+ drawHints(c, {{kIconCross, tr(Str::Select)}, {kIconL1R1, tr(Str::Sections)}, {kIconCircle, tr(Str::Back)}});
else
- drawHints(c, {{kIconCross, tr(Str::ChangeKey)}, {kIconSquare, tr(Str::ClearKey)}, {kIconCircle, tr(Str::Back)}});
+ drawHints(c, {{kIconCross, tr(Str::ChangeKey)}, {kIconSquare, tr(Str::ClearKey)}, {kIconL1R1, tr(Str::Sections)}, {kIconCircle, tr(Str::Back)}});
+}
+
+void AppUi::drawTouchpadTester(Canvas& c) {
+ padTesterTab_ = 1;
+ drawPadTester(c);
}
void AppUi::drawSignInCheck(Canvas& c, uint64_t nowMs) {
@@ -6107,6 +6512,10 @@ void AppUi::drawGameSettings(Canvas& c) {
drawPadTester(c);
return;
}
+ if (tester_ == Tester::Touchpad) {
+ drawTouchpadTester(c);
+ return;
+ }
std::string title = tr(Str::GameSettings);
if (!detail_.name.empty()) {
std::string full = title + " \xE2\x80\xA2 " + detail_.name;
@@ -6123,7 +6532,7 @@ void AppUi::drawGameSettings(Canvas& c) {
}
}
constexpr int kModalW = 1140, kModalH = 960;
- constexpr int kRowH = 43, kGap = 4, kGroupGap = 8;
+ constexpr int kRowH = 40, kGap = 4, kGroupGap = 7;
// The rows caps_ allows; the panel loses the height of those it hides
// (the same as ever with all of them, "Reset to default" or not).
const auto rows = visibleGameSettingsRows(caps_, activeGameHasCustom_, activeGameMouseSupported_);
@@ -6218,6 +6627,10 @@ void AppUi::drawGameSettings(Canvas& c) {
label = tr(Str::ControllerButtons);
value = tr(activeGameProfile_.padMap == input::defaultPadMap() ? Str::ProfileDefault : Str::ProfileCustom);
break;
+ case 17:
+ label = tr(Str::TouchpadShortcuts);
+ value = tr(activeGameProfile_.touchpadShortcuts == input::defaultTouchpadShortcuts() ? Str::ProfileDefault : Str::ProfileCustom);
+ break;
case 12:
label = tr(Str::Gyro);
value = tr(activeGameProfile_.gyroMode == 1 ? Str::GyroAlways
diff --git a/src/ui/app_ui.h b/src/ui/app_ui.h
index bcc95b9..76ef120 100644
--- a/src/ui/app_ui.h
+++ b/src/ui/app_ui.h
@@ -90,7 +90,7 @@ enum class Tab { GamePass, Library, Consoles };
struct NavInput {
bool up = false, down = false, left = false, right = false;
- bool accept = false, back = false, options = false;
+ bool accept = false, acceptHeld = false, back = false, options = false;
bool l1 = false, r1 = false, square = false, triangle = false, r3 = false, l3 = false;
bool l2 = false, r2 = false; // pressed (triggers past halfway)
bool touchpad = false; // held right now (sign out needs a 5 s hold)
@@ -140,6 +140,7 @@ struct SettingsChoice {
int gyroLevel = 5; // intensity, 1..10
bool fullscreen = true; // a desktop's window fullscreen (UiCaps::desktopWindow; F11 switches it too)
bool touchpadMouse = false;
+ input::TouchpadShortcuts touchpadShortcuts = input::defaultTouchpadShortcuts();
int voiceRouting = 0; // 0 Auto (DualSense pad speaker if available), 1 Always TV/Headset
std::map<std::string, uint64_t> titlePlaytime; // accumulated playtime in seconds
};
@@ -195,10 +196,11 @@ std::vector<SettingsRowPos> visibleGameSettingsRows(const UiCaps& caps, bool cus
// The largest stick dead zone Settings offers, in percent of the travel.
constexpr int kMaxDeadzone = 30;
-constexpr int kSettingRows = 22; // language, resolution, region, dead zone, triggers, confirm, light bar, updates,
+constexpr int kSettingRows = 24; // language, resolution, region, dead zone, triggers, confirm, light bar, updates,
// sign-in country, 120 Hz output, bitrate cap, game volume, keyboard keys,
// display mode (a desktop's window), controller buttons, gyro aiming, queue chime,
- // check sign-in, network test, support project, video decoder, audio-to-haptics
+ // check sign-in, network test, support project, video decoder, audio-to-haptics,
+ // touchpad shortcuts, restore defaults
struct SignInStage {
std::string name;
@@ -243,7 +245,8 @@ enum class Action {
RefreshLibrary, // manual library refresh
CheckSignIn, // run sign-in diagnostic stages
RunNetworkTest, // run regional RTT/jitter & NAT probe
- TestQueueAlert // play test chime and vibration for queue-ready alert
+ TestQueueAlert, // play test chime and vibration for queue-ready alert
+ ResetSettings // restore settings to default
};
// How "Your games" is sorted (R3).
@@ -357,6 +360,7 @@ public:
void showHome(const std::string& toast = {});
void showToast(const std::string& toast);
void markTileOwned(const std::string& productId, const std::string& titleId = {});
+ void markUnclaimable(const std::string& productId);
void showLaunching(const GameTile& game, const std::string& status);
void setLaunchStatus(const std::string& status);
void showStreaming();
@@ -568,7 +572,7 @@ private:
Color pickerColour() const;
void drawColourPicker(Canvas& c);
// The testers that Dead zone and Trigger vibration open in Settings.
- enum class Tester { None, Sticks, Triggers, Keys, Pad, SignInCheck, NetworkTest, Donation };
+ enum class Tester { None, Sticks, Triggers, Keys, Pad, Touchpad, SignInCheck, NetworkTest, Donation };
void openTester(Tester t);
void handleTester(const NavInput& in);
void drawStickTester(Canvas& c);
@@ -580,6 +584,9 @@ private:
void openPadTester();
void handlePadTester(const NavInput& in);
void drawPadTester(Canvas& c);
+ void openTouchpadTester();
+ void handleTouchpadTester(const NavInput& in);
+ void drawTouchpadTester(Canvas& c);
void drawSignInCheck(Canvas& c, uint64_t nowMs);
void drawNetworkTest(Canvas& c, uint64_t nowMs);
void drawDonationModal(Canvas& c);
@@ -653,6 +660,7 @@ private:
Anim resultScroll_;
GameTile detail_; // the game the details page shows
GameTile launching_;
+ uint64_t launchingStartMs_ = 0;
std::string error_;
std::string errorUrl_;
GameTile errorGame_; // showPlayError()'s game; empty for other errors
@@ -667,6 +675,7 @@ private:
std::map<std::string, int> regionMs_;
std::map<std::string, PriceInfo> prices_;
std::set<std::string> pricesAsked_;
+ std::set<std::string> unclaimable_;
std::string detailAskedFor_;
uint64_t detailAskedAt_ = 0;
std::string queueAskedFor_, queueTitle_;
@@ -724,6 +733,11 @@ private:
input::PadMap padWork_ = input::defaultPadMap();
int padRow_ = 0, padCol_ = 0;
uint64_t padCaptureSince_ = 0;
+ input::TouchpadShortcuts touchpadWork_ = input::defaultTouchpadShortcuts();
+ int padTesterTab_ = 0; // 0 = Buttons, 1 = Touchpad
+ int touchpadRow_ = 0;
+ bool touchpadDropdownOpen_ = false;
+ int touchpadDropdownIndex_ = 0, touchpadDropdownTop_ = 0;
int testerStick_ = 0; // the stick tester: the one being adjusted (L1 / R1)
float testSticks_[4] = {0, 0, 0, 0}, testL2_ = 0, testR2_ = 0;
bool pickerOpen_ = false;
@@ -738,6 +752,7 @@ private:
int dropdownIndex_ = 0, dropdownTop_ = 0;
uint64_t signOutHoldStart_ = 0; // TOUCHPAD hold in progress
bool signOutLatched_ = false; // fired; wait for release
+ uint64_t resetSettingsHoldStart_ = 0; // Cross hold in progress for ResetSettings
void drawSignOutHold(Canvas& c, uint64_t nowMs);
std::string toast_;
uint64_t toastUntil_ = 0;
diff --git a/src/ui/input_mode.h b/src/ui/input_mode.h
index 4d3faa9..cadc083 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, 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] : "";
+ // As app_ui.cpp's Icon: Cross, Circle, Options, Triangle, Touchpad, Square, R3, L3, L2 R2, DpadLR, L1 R1.
+ static const char* const kLabels[] = {"Enter", "Esc", "Tab", "F", "Del", "H", "R", "Shift", "Z C", "<- ->", "Q E"};
+ return icon >= 0 && icon < 11 ? kLabels[icon] : "";
}
} // namespace xc::ui
diff --git a/src/ui/pad_icons.cpp b/src/ui/pad_icons.cpp
index 6b54fe3..5103256 100644
--- a/src/ui/pad_icons.cpp
+++ b/src/ui/pad_icons.cpp
@@ -28,6 +28,22 @@ void drawKeyboardGlyph(Canvas& c, int x, int y, int w, Color color) {
c.fillRect({x + w / 4, y + h - t - key - key / 2, w / 2, key}, color, 1); // the space bar
}
+void drawPhoneGlyph(Canvas& c, int x, int y, int w, Color color, Color background) {
+ int ph = w * 7 / 10;
+ int pw = std::max(12, w * 11 / 24);
+ int px = x + (w - pw) / 2;
+ int py = y;
+ int r = std::max(3, pw / 5);
+ c.fillRect({px, py, pw, ph}, color, r);
+ int border = std::max(2, w / 20);
+ int topBar = std::max(3, ph / 7);
+ int botBar = std::max(4, ph / 6);
+ c.fillRect({px + border, py + topBar, std::max(2, pw - 2 * border), std::max(2, ph - topBar - botBar)},
+ background, std::max(1, border / 2));
+ c.fillRect({px + pw / 3, py + std::max(1, topBar / 3), std::max(2, pw / 3), std::max(1, topBar / 3)}, background, 1);
+ c.fillCircle(px + pw / 2.0f, py + ph - botBar / 2.0f, std::max(1.5f, pw / 10.0f), background);
+}
+
int padIconHeight(int w) { return w * 7 / 10 + 4 + w * 3 / 10; }
void drawPadIcon(Canvas& c, const Font& font, int x, int y, int w, int index, bool connected, Color background) {
@@ -76,16 +92,20 @@ void drawPadIcon(Canvas& c, const Font& font, int x, int y, int w, int index, bo
void drawSlotIcon(Canvas& c, const Font& font, int x, int y, int w, int index, const PadSlot& slot, Color background,
const Font* icons) {
- if (!slot.keyboard && !icons) {
+ const bool isKb = slot.keyboard || slot.device == PadDevice::Keyboard;
+ const bool isPhone = slot.device == PadDevice::Phone;
+ if (!isKb && !isPhone && !icons) {
drawPadIcon(c, font, x, y, w, index, slot.connected, background);
return;
}
- // The console's own controller or keyboard-and-mouse icon (else a drawn
- // keyboard), in the player's colour (dim when free), numbered below.
- bool on = slot.connected || slot.keyboard;
+ // The console's own controller, keyboard-and-mouse, or smartphone icon,
+ // in the player's colour (dim when free), numbered below.
+ bool on = slot.connected || isKb || isPhone;
Color col = on ? playerColor(index) : rgba(70, 70, 70);
- if (icons) {
- const char* glyph = slot.keyboard ? kIconKeyboardMouse : kIconGamepad;
+ if (isPhone) {
+ drawPhoneGlyph(c, x, y, w, col, background);
+ } else if (icons) {
+ const char* glyph = isKb ? kIconKeyboardMouse : kIconGamepad;
int px2 = w * 9 / 10; // as wide as a pad, centred on its height
icons->draw(c, glyph, x + (w - icons->measure(glyph, px2)) / 2, y - w / 10, px2, col);
} else {
diff --git a/src/ui/pad_icons.h b/src/ui/pad_icons.h
index deaad87..c744d15 100644
--- a/src/ui/pad_icons.h
+++ b/src/ui/pad_icons.h
@@ -11,10 +11,13 @@
namespace xc::ui {
+enum class PadDevice : uint8_t { Gamepad = 0, Keyboard = 1, Phone = 2 };
+
struct PadSlot {
bool connected = false;
std::string name; // the PS5 user's
bool keyboard = false; // a USB keyboard and mouse plays in this slot
+ PadDevice device = PadDevice::Gamepad;
};
using PadSlots = std::array<PadSlot, 4>;
@@ -26,6 +29,9 @@ Color playerColor(int index);
// outline and three rows of keys, in `color` (cards, the players' row).
void drawKeyboardGlyph(Canvas& c, int x, int y, int w, Color color);
+// A smartphone glyph centered in `w` wide by `w * 7 / 10` tall at (x, y).
+void drawPhoneGlyph(Canvas& c, int x, int y, int w, Color color, Color background);
+
// One pad, a DualSense `w` wide with its number `index + 1` below
// (padIconHeight(w) in all): in the player's colour when connected, dim
// when not. Its buttons are cut out in `background`, the colour behind it.
diff --git a/src/ui/settings_choice.cpp b/src/ui/settings_choice.cpp
index 54ac017..ee0be36 100644
--- a/src/ui/settings_choice.cpp
+++ b/src/ui/settings_choice.cpp
@@ -39,6 +39,7 @@ SettingsChoice choiceFromSettings(const app::Settings& s) {
c.gyroLevel = s.gyroLevel;
c.fullscreen = s.desktopFullscreen;
c.touchpadMouse = s.touchpadMouse;
+ c.touchpadShortcuts = s.touchpadShortcuts;
c.voiceRouting = s.voiceRouting;
c.titlePlaytime = s.titlePlaytime;
return c;
@@ -74,6 +75,7 @@ void applyChoice(const SettingsChoice& c, app::Settings& s) {
s.gyroLevel = c.gyroLevel;
s.desktopFullscreen = c.fullscreen;
s.touchpadMouse = c.touchpadMouse;
+ s.touchpadShortcuts = c.touchpadShortcuts;
s.voiceRouting = c.voiceRouting;
s.titlePlaytime = c.titlePlaytime;
}
diff --git a/src/ui/stream_menu.cpp b/src/ui/stream_menu.cpp
index 504dce6..e8c2fcf 100644
--- a/src/ui/stream_menu.cpp
+++ b/src/ui/stream_menu.cpp
@@ -42,6 +42,7 @@ bool StreamMenu::itemShown(int item) const {
case GyroItem:
case GyroLevelItem: return caps_.gyro;
case PadSpeakerVolumeItem: return caps_.triggerRumble || caps_.adaptiveTriggers;
+ case TouchpadShortcutsItem: return caps_.touchpad;
default: return true;
}
}
@@ -86,6 +87,8 @@ void StreamMenu::open(int resolution, bool stats, int sharpness, int deband, int
resolutionAsked_ = false;
statsCustomizing_ = false;
statsCustomIndex_ = 0;
+ touchpadCustomizing_ = false;
+ touchpadCustomIndex_ = 0;
}
MenuAction StreamMenu::handle(const NavInput& in) {
@@ -113,6 +116,42 @@ MenuAction StreamMenu::handle(const NavInput& in) {
}
return MenuAction::None;
}
+ if (touchpadCustomizing_) {
+ if (in.back) {
+ touchpadCustomizing_ = false;
+ return MenuAction::TouchpadShortcuts;
+ }
+ if (in.options) {
+ touchpadCustomizing_ = false;
+ open_ = false;
+ return MenuAction::Close;
+ }
+ constexpr int kRows = 7; // 6 triggers + Reset to default
+ if (in.up) touchpadCustomIndex_ = (touchpadCustomIndex_ + kRows - 1) % kRows;
+ if (in.down) touchpadCustomIndex_ = (touchpadCustomIndex_ + 1) % kRows;
+ input::TouchpadAction* fields[6] = {
+ &touchpadShortcuts_.swipeUp, &touchpadShortcuts_.swipeDown,
+ &touchpadShortcuts_.swipeLeft, &touchpadShortcuts_.swipeRight,
+ &touchpadShortcuts_.clickLeft, &touchpadShortcuts_.clickRight,
+ };
+ if (touchpadCustomIndex_ < 6) {
+ if (in.left || in.right || in.accept) {
+ int dir = in.left ? -1 : 1;
+ int cur = static_cast<int>(*fields[touchpadCustomIndex_]);
+ int next = (cur + input::kTouchpadActions + dir) % input::kTouchpadActions;
+ *fields[touchpadCustomIndex_] = static_cast<input::TouchpadAction>(next);
+ return MenuAction::TouchpadShortcuts;
+ }
+ if (in.square) {
+ *fields[touchpadCustomIndex_] = input::TouchpadAction::None;
+ return MenuAction::TouchpadShortcuts;
+ }
+ } else if (in.accept) {
+ touchpadShortcuts_ = input::defaultTouchpadShortcuts();
+ return MenuAction::TouchpadShortcuts;
+ }
+ return MenuAction::None;
+ }
if (in.back || in.options) {
open_ = false;
return MenuAction::Close;
@@ -179,6 +218,11 @@ MenuAction StreamMenu::handle(const NavInput& in) {
padSpeakerVolume_ = newVol;
return MenuAction::PadSpeakerVolume;
}
+ if (selected_ == TouchpadShortcutsItem && (in.accept || in.left || in.right)) {
+ touchpadCustomizing_ = true;
+ touchpadCustomIndex_ = 0;
+ return MenuAction::TouchpadShortcuts;
+ }
if (selected_ == Stats && (in.left || in.right)) {
stats_ = !stats_;
return MenuAction::Stats;
@@ -288,10 +332,54 @@ Canvas StreamMenu::renderMenu(const StreamInfo& info) const {
return c;
}
- fonts_.bold.draw(c, tr(Str::MenuTitle), kPad, 38, 32, kWhite);
+ if (touchpadCustomizing_) {
+ fonts_.bold.draw(c, tr(Str::TouchpadShortcuts), kPad, 38, 28, kWhite);
+ auto descLines = fonts_.regular.wrap(tr(Str::SettingDescTouchpadShortcuts), 16, kMenuW - 2 * kPad, 2);
+ int dy = 74;
+ for (const auto& l : descLines) {
+ fonts_.regular.draw(c, l, kPad, dy, 16, kDim);
+ dy += 20;
+ }
+
+ const input::TouchpadAction vals[6] = {
+ touchpadShortcuts_.swipeUp, touchpadShortcuts_.swipeDown,
+ touchpadShortcuts_.swipeLeft, touchpadShortcuts_.swipeRight,
+ touchpadShortcuts_.clickLeft, touchpadShortcuts_.clickRight,
+ };
+ constexpr int kRowH = 48, kTop = 126, kPx = 19;
+ for (int i = 0; i < 6; ++i) {
+ Rect row{kPad - 16, kTop + i * kRowH, kMenuW - 2 * (kPad - 16), kRowH - 4};
+ bool sel = i == touchpadCustomIndex_;
+ if (sel) c.fillRect(row, kWhite, 8);
+ Color fg = sel ? kDark : kWhite;
+ int ty = fonts_.semibold.centeredY(row.y, row.h, kPx);
+ fonts_.semibold.draw(c, touchpadTriggerLabel(i), row.x + 16, ty, kPx, fg);
+ std::string val = touchpadActionLabel(static_cast<int>(vals[i]));
+ if (sel) val = "< " + val + " >";
+ int sw = fonts_.semibold.measure(val, 18);
+ fonts_.semibold.draw(c, val, row.x + row.w - 16 - sw, ty, 18, sel ? kDark : kGray);
+ }
+ Rect resetRow{kPad - 16, kTop + 6 * kRowH + 8, kMenuW - 2 * (kPad - 16), kRowH - 4};
+ bool resetSel = (touchpadCustomIndex_ == 6);
+ if (resetSel) c.fillRect(resetRow, kWhite, 8);
+ const char* resetLabel = tr(Str::ResetToDefault);
+ int rw = fonts_.semibold.measure(resetLabel, kPx);
+ int rty = fonts_.semibold.centeredY(resetRow.y, resetRow.h, kPx);
+ fonts_.semibold.draw(c, resetLabel, resetRow.x + (resetRow.w - rw) / 2, rty, kPx,
+ resetSel ? kDark : rgba(240, 100, 100));
+
+ int hy = kMenuH - 50, x = kPad;
+ icon(!circleConfirms_, x, hy);
+ x = fonts_.semibold.draw(c, tr(Str::Change), x + 34, hy, 20, kGray) + 32;
+ icon(circleConfirms_, x, hy);
+ fonts_.semibold.draw(c, tr(Str::Back), x + 34, hy, 20, kGray);
+ return c;
+ }
+
+ fonts_.bold.draw(c, tr(Str::MenuTitle), kPad, 34, 30, kWhite);
// The items: the selected one white, like the Xbox guide.
- constexpr int kRowH = 40, kTop = 84, kPx = 20;
+ constexpr int kRowH = 37, kTop = 78, kPx = 19;
int shown = 0; // the items on screen so far
for (int i = 0; i < ItemCount; ++i) {
if (!itemShown(i)) continue;
@@ -300,21 +388,22 @@ Canvas StreamMenu::renderMenu(const StreamInfo& info) const {
if (sel) c.fillRect(row, kWhite, 8);
Color fg = sel ? kDark : kWhite;
int ty = fonts_.semibold.centeredY(row.y, row.h, kPx);
- const char* label = i == XboxButton ? tr(Str::MenuXboxButton)
- : i == Profile ? tr(Str::Profile)
- : i == Stats ? tr(Str::MenuStats)
- : i == Sharpness ? tr(Str::MenuSharpness)
- : i == Deband ? tr(Str::MenuDeband)
- : i == Upscaler ? tr(Str::MenuUpscaler)
- : i == Resolution ? tr(Str::MenuResolution)
- : i == Triggers ? tr(Str::TriggerRumble)
- : i == DeadzoneItem ? tr(Str::Deadzone)
- : i == ConfirmItem ? tr(Str::ConfirmButton)
- : i == GyroItem ? tr(Str::Gyro)
- : i == GyroLevelItem ? tr(Str::GyroIntensity)
+ const char* label = i == XboxButton ? tr(Str::MenuXboxButton)
+ : i == Profile ? tr(Str::Profile)
+ : i == Stats ? tr(Str::MenuStats)
+ : i == Sharpness ? tr(Str::MenuSharpness)
+ : i == Deband ? tr(Str::MenuDeband)
+ : i == Upscaler ? tr(Str::MenuUpscaler)
+ : i == Resolution ? tr(Str::MenuResolution)
+ : i == Triggers ? tr(Str::TriggerRumble)
+ : i == DeadzoneItem ? tr(Str::Deadzone)
+ : 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);
+ : i == TouchpadShortcutsItem ? tr(Str::TouchpadShortcuts)
+ : homeConsole_ ? tr(Str::MenuEndStream)
+ : tr(Str::MenuLeave);
fonts_.semibold.draw(c, label, row.x + 16, ty, kPx, fg);
std::string value;
if (i == Profile) {
@@ -369,6 +458,10 @@ Canvas StreamMenu::renderMenu(const StreamInfo& info) const {
value = padSpeakerVolume_ == 0 ? tr(Str::Mute) : std::to_string(padSpeakerVolume_) + " %";
if (sel) value = "< " + value + " >";
}
+ if (i == TouchpadShortcutsItem) {
+ value = tr(touchpadShortcuts_ == input::defaultTouchpadShortcuts() ? Str::ProfileDefault : Str::ProfileCustom);
+ if (sel) value = "< " + value + " >";
+ }
if (i == ConfirmItem) {
value = circleConfirms_ ? "○" : "×";
if (sel) value = "< " + value + " >";
@@ -378,21 +471,21 @@ Canvas StreamMenu::renderMenu(const StreamInfo& info) const {
fonts_.semibold.draw(c, value, row.x + row.w - 16 - w, ty, kPx, sel ? kDark : kGray);
}
}
- int y = kTop + shown * kRowH + 6;
+ int y = kTop + shown * kRowH + 4;
if (resolutionAsked_) {
fonts_.regular.draw(c, tr(Str::ResolutionNote), kPad, y, 16, kDim);
- y += 22;
+ y += 20;
}
- y += 6;
+ y += 4;
// The connection.
c.fillRect({kPad, y, kMenuW - 2 * kPad, 2}, rgba(60, 60, 60));
- y += 14;
+ y += 12;
auto line = [&](Str label, const std::string& value) {
- fonts_.regular.draw(c, tr(label), kPad, y, 18, kGray);
- int w = fonts_.semibold.measure(value, 18);
- fonts_.semibold.draw(c, value, kMenuW - kPad - w, y, 18, kWhite);
- y += 24;
+ fonts_.regular.draw(c, tr(label), kPad, y, 17, kGray);
+ int w = fonts_.semibold.measure(value, 17);
+ fonts_.semibold.draw(c, value, kMenuW - kPad - w, y, 17, kWhite);
+ y += 22;
};
const std::string none = "-";
line(Str::StatRegion, info.region.empty() ? none : info.region);
diff --git a/src/ui/stream_menu.h b/src/ui/stream_menu.h
index a8b0586..43f8301 100644
--- a/src/ui/stream_menu.h
+++ b/src/ui/stream_menu.h
@@ -44,7 +44,8 @@ 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, PadSpeakerVolume
+ ProfileToggle, Triggers, Deadzone, ConfirmButton, MicToggle, Gyro, PadSpeakerVolume,
+ TouchpadShortcuts
};
class StreamMenu {
@@ -66,14 +67,18 @@ public:
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, int padSpeakerVolume = 100);
- void close() { open_ = false; }
+ void close() { open_ = false; statsCustomizing_ = false; touchpadCustomizing_ = false; }
bool isOpen() const { return open_; }
MenuAction handle(const NavInput& in);
int resolution() const { return resolution_; }
bool statsOn() const { return stats_; }
+ void setStatsOn(bool s) { stats_ = s; }
uint32_t statsMask() const { return statsMask_; }
void setStatsMask(uint32_t mask) { statsMask_ = mask; }
bool isCustomizingStats() const { return statsCustomizing_; }
+ bool isCustomizingTouchpad() const { return touchpadCustomizing_; }
+ const input::TouchpadShortcuts& touchpadShortcuts() const { return touchpadShortcuts_; }
+ void setTouchpadShortcuts(const input::TouchpadShortcuts& ts) { touchpadShortcuts_ = ts; }
void setFrametimes(const std::vector<float>& ft) const { frametimes_ = ft; }
int sharpness() const { return sharpness_; }
int deband() const { return deband_; }
@@ -133,6 +138,7 @@ private:
GyroItem,
GyroLevelItem,
PadSpeakerVolumeItem,
+ TouchpadShortcutsItem,
Leave,
ItemCount
};
@@ -146,6 +152,9 @@ private:
uint32_t statsMask_ = StatsDefaultMask;
bool statsCustomizing_ = false;
int statsCustomIndex_ = 0;
+ bool touchpadCustomizing_ = false;
+ int touchpadCustomIndex_ = 0;
+ input::TouchpadShortcuts touchpadShortcuts_ = input::defaultTouchpadShortcuts();
int selected_ = XboxButton;
int resolution_ = 0, applied_ = 0;
int sharpness_ = 0, deband_ = 1, upscaler_ = 0, debandInUse_ = 1;
diff --git a/src/ui/strings.cpp b/src/ui/strings.cpp
index 409b078..2c295c0 100644
--- a/src/ui/strings.cpp
+++ b/src/ui/strings.cpp
@@ -375,7 +375,7 @@ constexpr Column kEnglish = {
"Test sound", // TestSound
"Wishlist is empty", // WishlistEmpty
// Loading tips
- "Touchpad gestures or L2 + R2 + Touchpad open the in-game menu and Xbox guide", // TipTouchpadMenu
+ "Touchpad: swipe ↓ (or Touchpad + Options) for the menu, ↑ for the Xbox button", // 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
@@ -410,13 +410,35 @@ constexpr Column kEnglish = {
"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
+ "Connect to the same Wi-Fi to type search, remap buttons, use your phone as a virtual controller, report issues or view logs.", // WebControlDesc
"Video Decoder", // VideoDecoder
"Hardware (Recommended)", // VideoDecoderHw
"Software (CPU)", // VideoDecoderSw
"Selects hardware decoding (libSceVideodec2 on PS5, HWAccel on Desktop) or CPU software decoding", // SettingDescVideoDecoder
"Audio-to-Haptics", // AudioHaptics
"Converts low-frequency game audio into DualSense haptic rumble kicks", // SettingDescAudioHaptics
+ "Touchpad shortcuts", // TouchpadShortcuts
+ "Configures swipe gestures and left/right click actions on the DualSense touchpad", // SettingDescTouchpadShortcuts
+ "Swipe Up (↑)", // TouchpadSwipeUp
+ "Swipe Down (↓)", // TouchpadSwipeDown
+ "Swipe Left (←)", // TouchpadSwipeLeft
+ "Swipe Right (→)", // TouchpadSwipeRight
+ "Left Click", // TouchpadClickLeft
+ "Right Click", // TouchpadClickRight
+ "Disabled", // TouchpadActNone
+ "In-game menu", // TouchpadActGameMenu
+ "Xbox button", // TouchpadActXboxButton
+ "Toggle stats", // TouchpadActToggleStats
+ "Mute/unmute mic", // TouchpadActToggleMic
+ "Cycle gyro mode", // TouchpadActCycleGyro
+ "Cycle trigger profile", // TouchpadActCycleTrigger
+ "Touchpad + Options always opens the in-game menu", // TouchpadHelp
+ "Restore default settings", // ResetSettings
+ "Restores all settings to factory defaults. Hold Cross for 5 seconds to confirm.", // SettingDescResetSettings
+ "Settings restored to factory defaults.", // SettingsResetNotice
+ "Hold to reset", // HoldToReset
+ "Library is already up to date", // LibraryUpToDate
+ "Library updated (%s new games)", // LibraryUpdatedCount
};
constexpr Column kPortugueseBR = {
@@ -762,7 +784,7 @@ constexpr Column kPortugueseBR = {
"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
+ "Touchpad: deslize ↓ (ou Touchpad + Options) para o menu, ↑ para o botão 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
@@ -797,13 +819,35 @@ constexpr Column kPortugueseBR = {
"Mudo", // Mute
"Configuração Web", // WebControlTitle
"Acesse pelo celular", // WebControlSubtitle
- "Conecte no mesmo Wi-Fi para pesquisar, remapear botões ou baixar logs.", // WebControlDesc
+ "Conecte no mesmo Wi-Fi para pesquisar, remapear botões, usar o celular como controle virtual, relatar problemas ou visualizar o log.", // WebControlDesc
"Decodificação de Vídeo", // VideoDecoder
"Hardware (Recomendado)", // VideoDecoderHw
"Software (CPU)", // VideoDecoderSw
"Seleciona decodificação por hardware (libSceVideodec2 no PS5, HWAccel no Desktop) ou por software (CPU)", // SettingDescVideoDecoder
"Áudio para Vibração Háptica", // AudioHaptics
"Converte graves do áudio em vibração háptica no DualSense", // SettingDescAudioHaptics
+ "Atalhos do Touchpad", // TouchpadShortcuts
+ "Configura gestos de deslize e cliques esquerdo e direito no Touchpad do DualSense", // SettingDescTouchpadShortcuts
+ "Deslizar para Cima (↑)", // TouchpadSwipeUp
+ "Deslizar para Baixo (↓)", // TouchpadSwipeDown
+ "Deslizar para Esquerda (←)", // TouchpadSwipeLeft
+ "Deslizar para Direita (→)", // TouchpadSwipeRight
+ "Clique Esquerdo", // TouchpadClickLeft
+ "Clique Direito", // TouchpadClickRight
+ "Desativado", // TouchpadActNone
+ "Menu do jogo", // TouchpadActGameMenu
+ "Botão Xbox", // TouchpadActXboxButton
+ "Alternar estatísticas", // TouchpadActToggleStats
+ "Mutar/desmutar microfone", // TouchpadActToggleMic
+ "Alternar giroscópio", // TouchpadActCycleGyro
+ "Alternar perfil de gatilho", // TouchpadActCycleTrigger
+ "Touchpad + Options sempre abre o menu do jogo", // TouchpadHelp
+ "Restaurar configurações padrões", // ResetSettings
+ "Restaura todas as configurações para os padrões de fábrica. Mantenha ✕ por 5 segundos para confirmar.", // SettingDescResetSettings
+ "Configurações restauradas para os padrões.", // SettingsResetNotice
+ "Segure para restaurar", // HoldToReset
+ "Biblioteca já está atualizada", // LibraryUpToDate
+ "Biblioteca atualizada (%s novos jogos)", // LibraryUpdatedCount
};
constexpr Column kSpanish = {
@@ -1149,7 +1193,7 @@ constexpr Column kSpanish = {
"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
+ "Panel táctil: desliza ↓ (o Touchpad + Options) para el menú, ↑ para el botón 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
@@ -1184,13 +1228,35 @@ constexpr Column kSpanish = {
"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
+ "Conéctate al mismo Wi-Fi para buscar, reasignar botones, usar el celular como control virtual, reportar problemas o ver registros.", // WebControlDesc
"Decodificación de vídeo", // VideoDecoder
"Hardware (Recomendado)", // VideoDecoderHw
"Software (CPU)", // VideoDecoderSw
"Selecciona decodificación por hardware (libSceVideodec2 en PS5, HWAccel en Desktop) o software (CPU)", // SettingDescVideoDecoder
"Audio a Vibración Háptica", // AudioHaptics
"Convierte frecuencias graves del audio en vibración háptica en DualSense", // SettingDescAudioHaptics
+ "Atajos del panel táctil", // TouchpadShortcuts
+ "Configura gestos de deslizamiento y clics izquierdo y derecho en el panel táctil DualSense", // SettingDescTouchpadShortcuts
+ "Deslizar arriba (↑)", // TouchpadSwipeUp
+ "Deslizar abajo (↓)", // TouchpadSwipeDown
+ "Deslizar izquierda (←)", // TouchpadSwipeLeft
+ "Deslizar derecha (→)", // TouchpadSwipeRight
+ "Clic izquierdo", // TouchpadClickLeft
+ "Clic derecho", // TouchpadClickRight
+ "Desactivado", // TouchpadActNone
+ "Menú del juego", // TouchpadActGameMenu
+ "Botón Xbox", // TouchpadActXboxButton
+ "Alternar estadísticas", // TouchpadActToggleStats
+ "Silenciar/activar micrófono", // TouchpadActToggleMic
+ "Alternar giroscopio", // TouchpadActCycleGyro
+ "Alternar perfil de gatillo", // TouchpadActCycleTrigger
+ "Touchpad + Options siempre abre el menú del juego", // TouchpadHelp
+ "Restablecer ajustes predeterminados", // ResetSettings
+ "Restablece todos los ajustes a los valores de fábrica. Mantén ✕ durante 5 segundos para confirmar.", // SettingDescResetSettings
+ "Ajustes restablecidos a los valores predeterminados.", // SettingsResetNotice
+ "Mantén para restablecer", // HoldToReset
+ "La biblioteca ya está actualizada", // LibraryUpToDate
+ "Biblioteca actualizada (%s nuevos juegos)", // LibraryUpdatedCount
};
constexpr Column kFrench = {
@@ -1536,7 +1602,7 @@ constexpr Column kFrench = {
"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
+ "Pavé tactile : glissez ↓ (ou Pavé tactile + Options) pour le menu, ↑ pour le bouton 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
@@ -1571,13 +1637,35 @@ constexpr Column kFrench = {
"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
+ "Connectez-vous au même Wi-Fi pour chercher, remapper, utiliser le mobile comme manette virtuelle, signaler des soucis ou voir les logs.", // WebControlDesc
"Décodage vidéo", // VideoDecoder
"Matériel (Recommandé)", // VideoDecoderHw
"Logiciel (CPU)", // VideoDecoderSw
"Sélectionne le décodage matériel (libSceVideodec2 sur PS5, HWAccel sur Desktop) ou logiciel (CPU)", // SettingDescVideoDecoder
"Audio vers vibration haptique", // AudioHaptics
"Convertit les basses fréquences audio en vibrations haptiques sur DualSense", // SettingDescAudioHaptics
+ "Raccourcis du pavé tactile", // TouchpadShortcuts
+ "Configure les gestes de glissement et les clics gauche/droit sur le pavé tactile DualSense", // SettingDescTouchpadShortcuts
+ "Glisser vers le haut (↑)", // TouchpadSwipeUp
+ "Glisser vers le bas (↓)", // TouchpadSwipeDown
+ "Glisser vers la gauche (←)", // TouchpadSwipeLeft
+ "Glisser vers la droite (→)", // TouchpadSwipeRight
+ "Clic gauche", // TouchpadClickLeft
+ "Clic droit", // TouchpadClickRight
+ "Désactivé", // TouchpadActNone
+ "Menu du jeu", // TouchpadActGameMenu
+ "Bouton Xbox", // TouchpadActXboxButton
+ "Afficher/masquer les stats", // TouchpadActToggleStats
+ "Couper/activer le micro", // TouchpadActToggleMic
+ "Changer le mode gyro", // TouchpadActCycleGyro
+ "Changer le profil de gâchette", // TouchpadActCycleTrigger
+ "Pavé tactile + Options ouvre toujours le menu du jeu", // TouchpadHelp
+ "Restaurer les paramètres par défaut", // ResetSettings
+ "Restaure tous les paramètres aux valeurs d'usine. Maintenez ✕ pendant 5 secondes pour confirmer.", // SettingDescResetSettings
+ "Paramètres réinitialisés aux valeurs par défaut.", // SettingsResetNotice
+ "Maintenir pour réinitialiser", // HoldToReset
+ "La bibliothèque est déjà à jour", // LibraryUpToDate
+ "Bibliothèque mise à jour (%s nouveaux jeux)", // LibraryUpdatedCount
};
constexpr Column kGerman = {
@@ -1923,7 +2011,7 @@ constexpr Column kGerman = {
"Ton testen", // TestSound
"Wunschliste ist leer", // WishlistEmpty
// Loading tips
- "Touchpad-Gesten oder L2 + R2 + Touchpad öffnen das Spielmenü und den Xbox-Guide", // TipTouchpadMenu
+ "Touchpad: ↓ wischen (oder Touchpad + Options) für das Menü, ↑ für die Xbox-Taste", // 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
@@ -1958,13 +2046,35 @@ constexpr Column kGerman = {
"Stumm", // Mute
"Web-Steuerung", // WebControlTitle
"Über Smartphone verbinden", // WebControlSubtitle
- "Mit demselben WLAN verbinden, um zu suchen, Tasten zu belegen oder Logs zu laden.", // WebControlDesc
+ "Mit demselben WLAN verbinden, um zu suchen, Tasten zu belegen, das Smartphone als Controller zu nutzen, Fehler zu melden oder Logs anzusehen.", // WebControlDesc
"Videodekodierung", // VideoDecoder
"Hardware (Empfohlen)", // VideoDecoderHw
"Software (CPU)", // VideoDecoderSw
"Wählt Hardware-Dekodierung (libSceVideodec2 auf PS5, HWAccel auf Desktop) oder Software-Dekodierung (CPU)", // SettingDescVideoDecoder
"Audio-zu-Haptik", // AudioHaptics
"Wandelt tiefe Audiofrequenzen in DualSense-Haptik-Vibrationen um", // SettingDescAudioHaptics
+ "Touchpad-Kurzbefehle", // TouchpadShortcuts
+ "Konfiguriert Wischgesten sowie Links- und Rechtsklick auf dem DualSense-Touchpad", // SettingDescTouchpadShortcuts
+ "Nach oben wischen (↑)", // TouchpadSwipeUp
+ "Nach unten wischen (↓)", // TouchpadSwipeDown
+ "Nach links wischen (←)", // TouchpadSwipeLeft
+ "Nach rechts wischen (→)", // TouchpadSwipeRight
+ "Linksklick", // TouchpadClickLeft
+ "Rechtsklick", // TouchpadClickRight
+ "Deaktiviert", // TouchpadActNone
+ "Spielmenü", // TouchpadActGameMenu
+ "Xbox-Taste", // TouchpadActXboxButton
+ "Statistiken umschalten", // TouchpadActToggleStats
+ "Mikrofon stumm/aktiv", // TouchpadActToggleMic
+ "Gyro-Modus wechseln", // TouchpadActCycleGyro
+ "Trigger-Profil wechseln", // TouchpadActCycleTrigger
+ "Touchpad + Options öffnet immer das Spielmenü", // TouchpadHelp
+ "Standardeinstellungen wiederherstellen", // ResetSettings
+ "Setzt alle Einstellungen auf die Werkseinstellungen zurück. 5 Sekunden ✕ gedrückt halten zur Bestätigung.", // SettingDescResetSettings
+ "Einstellungen auf Standardwerte zurückgesetzt.", // SettingsResetNotice
+ "Halten zum Zurücksetzen", // HoldToReset
+ "Bibliothek ist bereits aktuell", // LibraryUpToDate
+ "Bibliothek aktualisiert (%s neue Spiele)", // LibraryUpdatedCount
};
constexpr Column kItalian = {
@@ -2310,7 +2420,7 @@ constexpr Column kItalian = {
"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
+ "Touchpad: scorri ↓ (o Touchpad + Options) per il menu, ↑ per il pulsante 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
@@ -2345,13 +2455,35 @@ constexpr Column kItalian = {
"Muto", // Mute
"Controllo Web", // WebControlTitle
"Connetti dallo smartphone", // WebControlSubtitle
- "Connettiti allo stesso Wi-Fi per cercare, rimappare i pulsanti o scaricare i log.", // WebControlDesc
+ "Connettiti allo stesso Wi-Fi per cercare, rimappare pulsanti, usare il telefono come controller virtuale, segnalare problemi o visualizzare i log.", // WebControlDesc
"Decodifica video", // VideoDecoder
"Hardware (Consigliato)", // VideoDecoderHw
"Software (CPU)", // VideoDecoderSw
"Seleziona decodifica hardware (libSceVideodec2 su PS5, HWAccel su Desktop) o software (CPU)", // SettingDescVideoDecoder
"Audio a vibrazione aptica", // AudioHaptics
"Converte le basse frequenze audio in vibrazioni aptiche su DualSense", // SettingDescAudioHaptics
+ "Scorciatoie del touchpad", // TouchpadShortcuts
+ "Configura i gesti di scorrimento e i clic sinistro/destro sul touchpad DualSense", // SettingDescTouchpadShortcuts
+ "Scorri in alto (↑)", // TouchpadSwipeUp
+ "Scorri in basso (↓)", // TouchpadSwipeDown
+ "Scorri a sinistra (←)", // TouchpadSwipeLeft
+ "Scorri a destra (→)", // TouchpadSwipeRight
+ "Clic sinistro", // TouchpadClickLeft
+ "Clic destro", // TouchpadClickRight
+ "Disattivato", // TouchpadActNone
+ "Menu di gioco", // TouchpadActGameMenu
+ "Pulsante Xbox", // TouchpadActXboxButton
+ "Mostra/nascondi statistiche", // TouchpadActToggleStats
+ "Disattiva/attiva microfono", // TouchpadActToggleMic
+ "Cambia modalità giroscopio", // TouchpadActCycleGyro
+ "Cambia profilo grilletto", // TouchpadActCycleTrigger
+ "Touchpad + Options apre sempre il menu di gioco", // TouchpadHelp
+ "Ripristina impostazioni predefinite", // ResetSettings
+ "Ripristina tutte le impostazioni ai valori di fabbrica. Tieni premuto ✕ per 5 secondi per confermare.", // SettingDescResetSettings
+ "Impostazioni ripristinate ai valori predefiniti.", // SettingsResetNotice
+ "Tieni premuto per ripristinare", // HoldToReset
+ "La libreria è già aggiornata", // LibraryUpToDate
+ "Libreria aggiornata (%s nuovi giochi)", // LibraryUpdatedCount
};
constexpr std::array<const Column*, kLangs> kTable = {&kEnglish, &kPortugueseBR, &kSpanish,
@@ -2400,4 +2532,43 @@ std::string trf(Str id, const std::string& arg) {
return s;
}
+std::string touchpadActionLabel(int actionIndex) {
+ switch (actionIndex) {
+ case 0: return tr(Str::TouchpadActNone);
+ case 1: return tr(Str::TouchpadActGameMenu);
+ case 2: return tr(Str::TouchpadActXboxButton);
+ case 3: return tr(Str::TouchpadActToggleStats);
+ case 4: return tr(Str::TouchpadActToggleMic);
+ case 5: return tr(Str::TouchpadActCycleGyro);
+ case 6: return tr(Str::TouchpadActCycleTrigger);
+ case 7: return "View (Select)";
+ case 8: return "Menu (Start)";
+ case 9: return "LS (L3)";
+ case 10: return "RS (R3)";
+ case 11: return "A";
+ case 12: return "B";
+ case 13: return "X";
+ case 14: return "Y";
+ case 15: return "LB (L1)";
+ case 16: return "RB (R1)";
+ case 17: return std::string(tr(Str::DPad)) + " ↑";
+ case 18: return std::string(tr(Str::DPad)) + " ↓";
+ case 19: return std::string(tr(Str::DPad)) + " ←";
+ case 20: return std::string(tr(Str::DPad)) + " →";
+ default: return tr(Str::TouchpadActNone);
+ }
+}
+
+const char* touchpadTriggerLabel(int triggerIndex) {
+ switch (triggerIndex) {
+ case 0: return tr(Str::TouchpadSwipeUp);
+ case 1: return tr(Str::TouchpadSwipeDown);
+ case 2: return tr(Str::TouchpadSwipeLeft);
+ case 3: return tr(Str::TouchpadSwipeRight);
+ case 4: return tr(Str::TouchpadClickLeft);
+ case 5: return tr(Str::TouchpadClickRight);
+ default: return "";
+ }
+}
+
} // namespace xc::ui
diff --git a/src/ui/strings.h b/src/ui/strings.h
index 373b18f..1a07603 100644
--- a/src/ui/strings.h
+++ b/src/ui/strings.h
@@ -394,6 +394,28 @@ enum class Str {
SettingDescVideoDecoder,
AudioHaptics,
SettingDescAudioHaptics,
+ TouchpadShortcuts,
+ SettingDescTouchpadShortcuts,
+ TouchpadSwipeUp,
+ TouchpadSwipeDown,
+ TouchpadSwipeLeft,
+ TouchpadSwipeRight,
+ TouchpadClickLeft,
+ TouchpadClickRight,
+ TouchpadActNone,
+ TouchpadActGameMenu,
+ TouchpadActXboxButton,
+ TouchpadActToggleStats,
+ TouchpadActToggleMic,
+ TouchpadActCycleGyro,
+ TouchpadActCycleTrigger,
+ TouchpadHelp,
+ ResetSettings,
+ SettingDescResetSettings,
+ SettingsResetNotice,
+ HoldToReset,
+ LibraryUpToDate,
+ LibraryUpdatedCount,
Count
};
@@ -414,5 +436,7 @@ const char* gameLocale();
const char* tr(Str id);
// tr() with one "%s" substituted.
std::string trf(Str id, const std::string& arg);
+std::string touchpadActionLabel(int actionIndex);
+const char* touchpadTriggerLabel(int triggerIndex);
} // namespace xc::ui
diff --git a/src/xcloud/catalog.cpp b/src/xcloud/catalog.cpp
index 55b528c..f3fc90a 100644
--- a/src/xcloud/catalog.cpp
+++ b/src/xcloud/catalog.cpp
@@ -52,6 +52,11 @@ bool fetchList(const std::string& siglId, const std::string& market, const std::
std::string& err) {
net::Request req;
req.url = "https://catalog.gamepass.com/sigls/v2?id=" + siglId + "&market=" + market + "&language=" + language;
+ req.headers = {{"Cache-Control", "no-cache"},
+ {"Pragma", "no-cache"},
+ {"ms-cv", "0.0"},
+ {"calling-app-name", "xcloud-ps5"},
+ {"calling-app-version", "0.1"}};
auto r = net::perform(req);
auto j = json::parse(r.body);
if (!r.ok() || !j || !j->isArray()) {
@@ -85,6 +90,8 @@ bool fetchProducts(const std::vector<std::string>& ids, const std::string& marke
req.url = "https://catalog.gamepass.com/v3/products?market=" + market + "&language=" + language +
"&hydration=" + (full ? "RemoteHighSapphire0" : "RemoteLowJade0");
req.headers = {{"Content-Type", "application/json"},
+ {"Cache-Control", "no-cache"},
+ {"Pragma", "no-cache"},
{"ms-cv", "0.0"},
{"calling-app-name", "xcloud-ps5"},
{"calling-app-version", "0.1"}};
@@ -138,6 +145,18 @@ bool fetchProducts(const std::vector<std::string>& ids, const std::string& marke
}
}
}
+ if (auto existing = out.find(id); existing != out.end()) {
+ if (prod.heroUrl.empty()) prod.heroUrl = existing->second.heroUrl;
+ if (prod.description.empty()) prod.description = existing->second.description;
+ if (prod.xcloudTitleId.empty()) prod.xcloudTitleId = existing->second.xcloudTitleId;
+ if (!prod.detailed && existing->second.detailed) {
+ prod.detailed = existing->second.detailed;
+ prod.detailedAt = existing->second.detailedAt;
+ prod.modes = existing->second.modes;
+ prod.plan = existing->second.plan;
+ prod.languages = existing->second.languages;
+ }
+ }
out[id] = std::move(prod);
}
}
diff --git a/src/xcloud/gssv.cpp b/src/xcloud/gssv.cpp
index ba744b2..d50b182 100644
--- a/src/xcloud/gssv.cpp
+++ b/src/xcloud/gssv.cpp
@@ -346,6 +346,12 @@ bool GssvClient::listTitles(std::vector<Title>& out, std::string& err, bool rece
title.hasEntitlement = t["details"]["hasEntitlement"].asBool();
title.xboxTitleId = t["details"]["xboxTitleId"].str();
title.isFreeInStore = t["details"]["isFreeInStore"].asBool();
+ for (const auto& alt : t["details"]["alternateProductIds"].items()) {
+ if (alt.isString() && !alt.str().empty()) title.alternateProductIds.push_back(alt.str());
+ }
+ if (title.productId.empty() && !title.alternateProductIds.empty()) {
+ title.productId = title.alternateProductIds[0];
+ }
for (const auto& input : t["details"]["supportedInputTypes"].items()) {
++inputTypes[input.str()];
if (input.str() == "MKB") title.mouseKeyboard = true;
@@ -365,7 +371,7 @@ bool GssvClient::listTitles(std::vector<Title>& out, std::string& err, bool rece
next.clear();
}
continuation = next;
- } while (!continuation.empty() && out.size() < 5000);
+ } while (!continuation.empty() && out.size() < 10000);
XC_LOGI("title list%s: %zu titles in %llu ms", recentOnly ? " (recent)" : "", out.size(),
static_cast<unsigned long long>(platform::nowMs() - started));
if (!inputTypes.empty()) {
diff --git a/src/xcloud/gssv.h b/src/xcloud/gssv.h
index 9680698..6b8076c 100644
--- a/src/xcloud/gssv.h
+++ b/src/xcloud/gssv.h
@@ -38,6 +38,7 @@ struct Title {
bool hasEntitlement = false;
std::string xboxTitleId; // Xbox Live title id (titlehub)
bool isFreeInStore = false;
+ std::vector<std::string> alternateProductIds;
// Playable through a subscription (the title's userPrograms has one
// besides F2P, such as CALLISTO for Game Pass). Entitled but not this:
// the account's own game, bought or free-to-play.
diff --git a/src/xcloud/prices.cpp b/src/xcloud/prices.cpp
index 4a3a653..94d60d0 100644
--- a/src/xcloud/prices.cpp
+++ b/src/xcloud/prices.cpp
@@ -33,10 +33,12 @@ bool fetchPrices(const std::vector<std::string>& productIds, const std::string&
bool purchase = false;
for (const auto& a : av["Actions"].items()) {
const auto act = a.str();
- purchase |= (act == "Purchase" || act == "Browse" || act == "Fulfill" || act == "License");
+ if (act == "Purchase") purchase = true;
}
const auto& price = av["OrderManagementData"]["Price"];
if (!purchase || !price.isObject()) continue;
+ bool remediation = av["RemediationRequired"].asBool();
+ if (remediation) continue;
Price pr;
pr.list = price["ListPrice"].asNumber();
pr.msrp = price["MSRP"].asNumber();
diff --git a/src/xcloud/purchase.cpp b/src/xcloud/purchase.cpp
index d07ed1f..1de9241 100644
--- a/src/xcloud/purchase.cpp
+++ b/src/xcloud/purchase.cpp
@@ -8,15 +8,73 @@
#include "util/log.h"
#include <cmath>
+#include <mutex>
+#include <set>
namespace xc::xcloud {
+namespace {
+std::mutex s_unclaimableMutex;
+std::set<std::string> s_unclaimable = {
+ // Known non-standalone / token bundles that lack purchase availability
+ "9PMFDKG5F9R7", "9N872NBW5XG5"
+};
+std::string s_unclaimablePath;
+} // namespace
+
+void markProductUnclaimable(const std::string& productId) {
+ if (productId.empty()) return;
+ std::string path;
+ {
+ std::lock_guard<std::mutex> lock(s_unclaimableMutex);
+ s_unclaimable.insert(productId);
+ path = s_unclaimablePath;
+ }
+ if (!path.empty()) saveUnclaimableProducts(path);
+}
+
+bool isProductUnclaimable(const std::string& productId) {
+ if (productId.empty()) return false;
+ std::lock_guard<std::mutex> lock(s_unclaimableMutex);
+ return s_unclaimable.count(productId) > 0;
+}
+
+void loadUnclaimableProducts(const std::string& path) {
+ std::lock_guard<std::mutex> lock(s_unclaimableMutex);
+ s_unclaimablePath = path;
+ std::string text;
+ if (platform::readFile(path, text)) {
+ if (auto j = json::parse(text)) {
+ for (const auto& item : (*j)["unclaimable"].items()) {
+ if (item.isString() && !item.str().empty()) s_unclaimable.insert(item.str());
+ }
+ }
+ }
+}
+
+void saveUnclaimableProducts(const std::string& path) {
+ std::set<std::string> copy;
+ {
+ std::lock_guard<std::mutex> lock(s_unclaimableMutex);
+ copy = s_unclaimable;
+ }
+ json::Value j = json::Value::object();
+ json::Value arr = json::Value::array();
+ for (const auto& id : copy) arr.push(id);
+ j.set("unclaimable", arr);
+ platform::writeFileAtomic(path, j.dump());
+}
+
bool fetchPurchaseOffer(const std::string& productId, const std::string& market, const std::string& language,
PurchaseOffer& out, std::string& err) {
if (productId.empty()) {
err = "empty product id";
return false;
}
+ if (isProductUnclaimable(productId)) {
+ err = "product has no claimable availability: " + productId;
+ return false;
+ }
net::Request req;
req.url = "https://displaycatalog.mp.microsoft.com/v7.0/products?bigIds=" + productId +
"&market=" + (market.empty() ? "US" : market) +
@@ -49,10 +107,12 @@ bool fetchPurchaseOffer(const std::string& productId, const std::string& market,
bool purchase = false;
for (const auto& a : av["Actions"].items()) {
const auto act = a.str();
- purchase |= (act == "Purchase" || act == "Browse" || act == "Fulfill" || act == "License");
+ if (act == "Purchase") purchase = true;
}
const auto& price = av["OrderManagementData"]["Price"];
if (!purchase || !price.isObject()) continue;
+ bool remediation = av["RemediationRequired"].asBool();
+ if (remediation) continue;
PurchaseOffer cand;
cand.productId = productId;
@@ -64,27 +124,20 @@ bool fetchPurchaseOffer(const std::string& productId, const std::string& market,
cand.isFree = (cand.listPrice <= 0.005 && cand.msrp <= 0.005);
if (cand.availabilityId.empty()) continue;
- bool remediation = av["RemediationRequired"].asBool();
- if (cand.isFree && !remediation) {
+ if (cand.isFree) {
out = cand;
return true;
}
- if (cand.isFree && fallbackFree.availabilityId.empty()) {
- fallbackFree = cand;
- }
if (fallbackAny.availabilityId.empty()) {
fallbackAny = cand;
}
}
}
- if (!fallbackFree.availabilityId.empty()) {
- out = fallbackFree;
- return true;
- }
if (!fallbackAny.availabilityId.empty()) {
out = fallbackAny;
return true;
}
+ markProductUnclaimable(productId);
err = "no purchase availability found for " + productId;
return false;
}
@@ -200,6 +253,11 @@ bool claimFreeProduct(const std::string& marketplaceAuthHeader, const PurchaseOf
return true;
}
err = extractErrorDetail(r);
+ if (err.find("CatalogAvailabilityDataNotFound") != std::string::npos ||
+ err.find("purchaseable action") != std::string::npos ||
+ err.find("Availability does not contain") != std::string::npos) {
+ markProductUnclaimable(offer.productId);
+ }
XC_LOGW("claimFreeProduct: create order failed for %s: %s (status %d)",
offer.productId.c_str(), err.c_str(), r.status);
return false;
@@ -224,6 +282,11 @@ bool claimFreeProduct(const std::string& marketplaceAuthHeader, const PurchaseOf
return true;
}
err = extractErrorDetail(finRes);
+ if (err.find("CatalogAvailabilityDataNotFound") != std::string::npos ||
+ err.find("purchaseable action") != std::string::npos ||
+ err.find("Availability does not contain") != std::string::npos) {
+ markProductUnclaimable(offer.productId);
+ }
XC_LOGW("claimFreeProduct: finalize order failed for %s (order %s): %s (status %d)",
offer.productId.c_str(), orderId.c_str(), err.c_str(), finRes.status);
return false;
diff --git a/src/xcloud/purchase.h b/src/xcloud/purchase.h
index d14e34a..2ff829a 100644
--- a/src/xcloud/purchase.h
+++ b/src/xcloud/purchase.h
@@ -26,4 +26,10 @@ bool fetchPurchaseOffer(const std::string& productId, const std::string& market,
bool claimFreeProduct(const std::string& marketplaceAuthHeader, const PurchaseOffer& offer,
const std::string& market, const std::string& language, std::string& err);
+// Tracks products known to fail claim (bundles, token/code-only, or no valid purchase action)
+void markProductUnclaimable(const std::string& productId);
+bool isProductUnclaimable(const std::string& productId);
+void loadUnclaimableProducts(const std::string& path);
+void saveUnclaimableProducts(const std::string& path);
+
} // namespace xc::xcloud
diff --git a/tests/test_main.cpp b/tests/test_main.cpp
index 4ce6d08..594d625 100644
--- a/tests/test_main.cpp
+++ b/tests/test_main.cpp
@@ -650,6 +650,9 @@ static void testStreamMenu() {
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; }); // Touchpad shortcuts
+ CHECK(press([](xc::ui::NavInput& n) { n.accept = true; }) == MenuAction::TouchpadShortcuts);
+ CHECK(press([](xc::ui::NavInput& n) { n.back = true; }) == MenuAction::TouchpadShortcuts);
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());
@@ -2068,21 +2071,21 @@ static void testVisibleSettingsRows() {
};
const ui::UiCaps ps5;
auto all = ui::visibleSettingsRows(ps5);
- CHECK((ids(all) == std::vector<int>{0, 8, 17, 1, 20, 9, 10, 2, 18, 14, 12, 3, 15, 4, 21, 5, 6, 16, 19, 7}));
- CHECK((groups(all) == std::vector<bool>{false, false, false, true, false, false, false, false, false, true, false, false, false, false, false, false, false, false, true, false}));
+ CHECK((ids(all) == std::vector<int>{0, 2, 8, 17, 18, 1, 20, 9, 10, 14, 12, 3, 15, 4, 21, 5, 6, 16, 19, 7, 23}));
+ CHECK((groups(all) == std::vector<bool>{false, false, false, false, false, true, false, false, false, true, false, false, false, false, false, false, false, false, true, false, true}));
ui::UiCaps pc;
pc.lightBar = pc.triggerRumble = pc.adaptiveTriggers = pc.gyro = pc.touchpad = false;
pc.upscalers = pc.sharpen = pc.deband = pc.highRefresh = pc.console = pc.selfUpdate = false;
pc.openUrl = true;
auto desk = ui::visibleSettingsRows(pc);
- CHECK((ids(desk) == std::vector<int>{0, 8, 17, 1, 20, 10, 2, 18, 14, 12, 3, 5, 16, 19, 7}));
- CHECK((groups(desk) == std::vector<bool>{false, false, false, true, false, false, false, false, true, false, false, false, false, true, false}));
+ CHECK((ids(desk) == std::vector<int>{0, 2, 8, 17, 18, 1, 20, 10, 14, 12, 3, 5, 16, 19, 7, 23}));
+ CHECK((groups(desk) == std::vector<bool>{false, false, false, false, false, true, false, false, true, false, false, false, false, true, false, true}));
// The desktop app's window: Display mode after the resolution, in the stream's group.
ui::UiCaps win = pc;
win.desktopWindow = true;
auto w = ui::visibleSettingsRows(win);
- CHECK((ids(w) == std::vector<int>{0, 8, 17, 1, 20, 13, 10, 2, 18, 14, 12, 3, 5, 16, 19, 7}));
- CHECK((groups(w) == std::vector<bool>{false, false, false, true, false, false, false, false, false, true, false, false, false, false, true, false}));
+ CHECK((ids(w) == std::vector<int>{0, 2, 8, 17, 18, 1, 20, 13, 10, 14, 12, 3, 5, 16, 19, 7, 23}));
+ CHECK((groups(w) == std::vector<bool>{false, false, false, false, false, true, false, false, false, true, false, false, false, false, true, false, true}));
ui::UiCaps xbox = pc; // an Xbox pad: impulse triggers, no light bar
xbox.triggerRumble = true;
auto x = ids(ui::visibleSettingsRows(xbox));
@@ -2100,11 +2103,12 @@ static void testVisibleSettingsRows() {
CHECK((ids(game) == std::vector<int>{0, 4, 15, 14, 5, 7, 11, 9}));
CHECK((groups(game) == std::vector<bool>{false, true, false, false, true, false, false, false}));
// How far down the autoplay tests walk to each row (autoplay.cpp's downsTo).
- CHECK(ui::settingsRowPosition(ps5, 1) == 3 && ui::settingsRowPosition(ps5, 3) == 11);
+ CHECK(ui::settingsRowPosition(ps5, 1) == 5 && ui::settingsRowPosition(ps5, 3) == 11);
CHECK(ui::settingsRowPosition(ps5, 16) == 17);
CHECK(ui::settingsRowPosition(ps5, 5) == 15 && ui::settingsRowPosition(ps5, 6) == 16);
CHECK(ui::settingsRowPosition(ps5, 12) == 10 && ui::settingsRowPosition(ps5, 14) == 9);
- CHECK(ui::settingsRowPosition(ps5, 7) == 19 && ui::settingsRowPosition(ps5, 19) == 18 && ui::settingsRowPosition(ps5, 2) == 7);
+ CHECK(ui::settingsRowPosition(ps5, 22) == -1);
+ CHECK(ui::settingsRowPosition(ps5, 7) == 19 && ui::settingsRowPosition(ps5, 19) == 18 && ui::settingsRowPosition(ps5, 2) == 1);
CHECK(ui::settingsRowPosition(ps5, 21) == 14);
CHECK(ui::settingsRowPosition(pc, 5) == 11 && ui::settingsRowPosition(pc, 6) == -1 && ui::settingsRowPosition(pc, 4) == -1);
}
@@ -2631,7 +2635,7 @@ static void testPurchase() {
CHECK(directOffer.isFree);
CHECK(directOffer.availabilityId == "AVAIL_DIRECT_FREE");
- // 9. fetchPurchaseOffer accepts actions like "Browse" or "License" for zero-priced games
+ // 9. fetchPurchaseOffer rejects non-purchaseable actions like "Browse" or "License"
net::setTestTransport([](const net::Request&) {
net::Response r;
r.status = 200;
@@ -2653,9 +2657,7 @@ static void testPurchase() {
return r;
});
PurchaseOffer trialOffer;
- CHECK(fetchPurchaseOffer("JUSTDANCE", "BR", "pt-br", trialOffer, err));
- CHECK(trialOffer.isFree);
- CHECK(trialOffer.availabilityId == "AVAIL_JUSTDANCE");
+ CHECK(!fetchPurchaseOffer("JUSTDANCE", "BR", "pt-br", trialOffer, err));
net::setTestTransport({});
}
@@ -3044,7 +3046,8 @@ static void testBlock2Features() {
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(10)) == "Q E");
+ CHECK(std::string(ui::keyLabel(11)) == "");
CHECK(std::string(ui::keyLabel(-1)) == "");
// Close Settings
@@ -4448,7 +4451,639 @@ static void testLibraryOfflineCache() {
::unlink(emptyCacheFile.c_str());
}
+static void testTouchpadShortcutsAndSlots() {
+ // 1. TouchpadShortcuts defaults and manipulation
+ {
+ input::TouchpadShortcuts ts = input::defaultTouchpadShortcuts();
+ CHECK(ts.swipeUp == input::TouchpadAction::XboxButton);
+ CHECK(ts.swipeDown == input::TouchpadAction::GameMenu);
+ CHECK(ts.swipeLeft == input::TouchpadAction::GameMenu);
+ CHECK(ts.swipeRight == input::TouchpadAction::XboxButton);
+ CHECK(ts.clickLeft == input::TouchpadAction::View);
+ CHECK(ts.clickRight == input::TouchpadAction::View);
+
+ CHECK(ts.get(0) == input::TouchpadAction::XboxButton);
+ CHECK(ts.get(1) == input::TouchpadAction::GameMenu);
+ CHECK(ts.get(2) == input::TouchpadAction::GameMenu);
+ CHECK(ts.get(3) == input::TouchpadAction::XboxButton);
+ CHECK(ts.get(4) == input::TouchpadAction::View);
+ CHECK(ts.get(5) == input::TouchpadAction::View);
+
+ ts.set(0, input::TouchpadAction::ToggleStats);
+ ts.set(4, input::TouchpadAction::A);
+ CHECK(ts.get(0) == input::TouchpadAction::ToggleStats);
+ CHECK(ts.get(4) == input::TouchpadAction::A);
+
+ // JSON roundtrip
+ json::Value j = input::touchpadShortcutsJson(ts);
+ input::TouchpadShortcuts back;
+ CHECK(input::readTouchpadShortcuts(j, back));
+ CHECK(back == ts);
+
+ // Button action checks
+ CHECK(input::isTouchpadButtonAction(input::TouchpadAction::A));
+ CHECK(input::isTouchpadButtonAction(input::TouchpadAction::View));
+ CHECK(!input::isTouchpadButtonAction(input::TouchpadAction::GameMenu));
+ CHECK(!input::isTouchpadButtonAction(input::TouchpadAction::XboxButton));
+ CHECK(!input::isTouchpadButtonAction(input::TouchpadAction::None));
+
+ input::ControllerState s{};
+ CHECK(input::applyTouchpadButtonAction(s, input::TouchpadAction::A));
+ CHECK(s.btnA);
+ CHECK(!input::applyTouchpadButtonAction(s, input::TouchpadAction::GameMenu));
+
+ // Edge cases: out of bounds indices and invalid actions
+ CHECK(ts.get(-1) == input::TouchpadAction::None);
+ CHECK(ts.get(99) == input::TouchpadAction::None);
+ ts.set(-1, input::TouchpadAction::A);
+ ts.set(99, input::TouchpadAction::A);
+ ts.set(0, static_cast<input::TouchpadAction>(250));
+ CHECK(ts.get(0) == input::TouchpadAction::None);
+
+ // Corrupted JSON inputs
+ input::TouchpadShortcuts corruptTs;
+ CHECK(!input::readTouchpadShortcuts(json::Value(), corruptTs));
+ CHECK(corruptTs == input::defaultTouchpadShortcuts());
+ json::Value badVer = json::Value::object();
+ badVer.set("version", 99);
+ CHECK(!input::readTouchpadShortcuts(badVer, corruptTs));
+ CHECK(corruptTs == input::defaultTouchpadShortcuts());
+
+ // Labels
+ for (int i = 0; i < 6; ++i) {
+ CHECK(ui::touchpadTriggerLabel(i)[0] != '\0');
+ }
+ CHECK(ui::touchpadTriggerLabel(-1)[0] == '\0');
+ CHECK(ui::touchpadTriggerLabel(10)[0] == '\0');
+ for (int a = 0; a < input::kTouchpadActions; ++a) {
+ CHECK(!ui::touchpadActionLabel(a).empty());
+ }
+ CHECK(ui::touchpadActionLabel(999) == ui::touchpadActionLabel(0));
+ }
+
+ // 2. 4 Virtual Gamepad Slots (P1..P4) and timestamps
+ {
+ app::resetVirtualGamepads();
+ app::WebServer srv;
+
+ for (int p = 1; p <= 4; ++p) {
+ int slotIdx = p - 1;
+ input::ControllerState st{};
+ bool conn = false;
+ app::virtualGamepadState(slotIdx, st, conn);
+ CHECK(!conn);
+ CHECK(app::virtualGamepadActiveAt(slotIdx) == 0);
+
+ // Send input for player p
+ std::string body = "{\"player\":" + std::to_string(p) + ",\"btnA\":true,\"leftStickX\":0.5}";
+ auto res = srv.handleRequest("POST", "/api/gamepad", body);
+ CHECK(res.status == 200);
+
+ bool ok = app::virtualGamepadState(slotIdx, st, conn);
+ CHECK(ok && conn);
+ CHECK(st.btnA);
+ CHECK(app::virtualGamepadActiveAt(slotIdx) > 0);
+ }
+
+ // touchVirtualGamepad
+ uint64_t before = app::virtualGamepadActiveAt(2);
+ app::touchVirtualGamepad(2);
+ CHECK(app::virtualGamepadActiveAt(2) >= before);
+
+ app::resetVirtualGamepads();
+ for (int i = 0; i < 4; ++i) {
+ input::ControllerState st{};
+ bool conn = false;
+ app::virtualGamepadState(i, st, conn);
+ CHECK(!conn);
+ }
+
+ // Out of bounds player index edge cases
+ {
+ input::ControllerState st{};
+ bool conn = false;
+ CHECK(!app::virtualGamepadState(-1, st, conn));
+ CHECK(!conn);
+ CHECK(!app::virtualGamepadState(4, st, conn));
+ CHECK(!conn);
+ CHECK(!app::virtualGamepadState(99, st, conn));
+ CHECK(!conn);
+ CHECK(app::virtualGamepadActiveAt(-1) == 0);
+ CHECK(app::virtualGamepadActiveAt(4) == 0);
+ CHECK(app::virtualGamepadActiveAt(99) == 0);
+ app::touchVirtualGamepad(-1);
+ app::touchVirtualGamepad(4);
+ app::touchVirtualGamepad(99);
+ }
+ }
+
+ // 3. Dynamic Slot Device Icon Resolution with Phone/Keyboard/Gamepad
+ {
+ ui::PadSlots slots;
+ for (int i = 0; i < 4; ++i) {
+ slots[i].device = ui::PadDevice::Gamepad;
+ slots[i].connected = true;
+ }
+
+ // Test slot 0: Phone is more recent than Gamepad and Keyboard
+ uint64_t padT = 1000, kbT = 500, phoneT = 2000;
+ ui::PadDevice dev = ui::PadDevice::Gamepad;
+ if (phoneT > 0 && phoneT >= padT && phoneT >= kbT) dev = ui::PadDevice::Phone;
+ else if (kbT > 0 && kbT >= padT && kbT >= phoneT) dev = ui::PadDevice::Keyboard;
+ CHECK(dev == ui::PadDevice::Phone);
+
+ // Pad becomes more recent
+ padT = 3000;
+ if (phoneT > 0 && phoneT >= padT && phoneT >= kbT) dev = ui::PadDevice::Phone;
+ else if (kbT > 0 && kbT >= padT && kbT >= phoneT) dev = ui::PadDevice::Keyboard;
+ else dev = ui::PadDevice::Gamepad;
+ CHECK(dev == ui::PadDevice::Gamepad);
+
+ // Keyboard becomes more recent
+ kbT = 4000;
+ if (phoneT > 0 && phoneT >= padT && phoneT >= kbT) dev = ui::PadDevice::Phone;
+ else if (kbT > 0 && kbT >= padT && kbT >= phoneT) dev = ui::PadDevice::Keyboard;
+ else dev = ui::PadDevice::Gamepad;
+ CHECK(dev == ui::PadDevice::Keyboard);
+
+ // PadSlot device enum check
+ ui::PadSlot slot{};
+ slot.device = ui::PadDevice::Phone;
+ CHECK(slot.device == ui::PadDevice::Phone);
+ }
+
+ // 4. WebUI Layout & WebSocket / settingsVersion
+ {
+ app::WebServer srv;
+ // Check kIndexHtml content for 3x2 grid and fullscreen landscape
+ auto res = srv.handleRequest("GET", "/", "");
+ CHECK(res.status == 200);
+ CHECK(res.body.find("grid-template-columns: repeat(3, 1fr)") != std::string::npos);
+ CHECK(res.body.find("btnFullscreen") != std::string::npos);
+ CHECK(res.body.find("lastSettingsVersion") != std::string::npos);
+ CHECK(res.body.find("P1") != std::string::npos && res.body.find("P4") != std::string::npos);
+
+ // Check settingsVersion in /api/status or /api/settings
+ auto statusRes = srv.handleRequest("GET", "/api/status", "");
+ CHECK(statusRes.status == 200);
+ auto jStatus = json::parse(statusRes.body);
+ CHECK(jStatus && jStatus->isObject());
+ CHECK((*jStatus).has("ok") && (*jStatus)["ok"].asBool());
+
+ // WebSocket frames
+ auto closeFrame = app::ws::makeCloseFrame();
+ CHECK(!closeFrame.empty());
+ std::vector<uint8_t> pongPayload = {'p', 'o', 'n', 'g'};
+ auto pongFrame = app::ws::makePongFrame(pongPayload);
+ CHECK(!pongFrame.empty());
+ }
+}
+
+static void testPlayerSwitchAndUnresolvedTiles() {
+ // 1. Virtual Gamepad Player Switching & Ghost Icon Prevention
+ {
+ app::resetVirtualGamepads();
+ app::WebServer srv;
+
+ // Player 2 connects and sends input
+ auto resP2 = srv.handleRequest("POST", "/api/gamepad", "{\"player\":2,\"btnA\":true}");
+ CHECK(resP2.status == 200);
+ input::ControllerState s1{};
+ bool conn1 = false;
+ CHECK(app::virtualGamepadState(1, s1, conn1) && conn1);
+ CHECK(s1.btnA);
+ CHECK(app::virtualGamepadActiveAt(1) > 0);
+
+ // Player 2 switches to Player 1 (with activeSwitch: true)
+ auto resP1 = srv.handleRequest("POST", "/api/gamepad", "{\"player\":1,\"activeSwitch\":true,\"btnB\":true}");
+ CHECK(resP1.status == 200);
+
+ // Player 1 must now be connected
+ input::ControllerState s0{};
+ bool conn0 = false;
+ CHECK(app::virtualGamepadState(0, s0, conn0) && conn0);
+ CHECK(s0.btnB);
+ CHECK(app::virtualGamepadActiveAt(0) > 0);
+
+ // Player 2 MUST be completely cleared and disconnected (no ghost icon on PS5)
+ input::ControllerState s1After{};
+ bool conn1After = false;
+ app::virtualGamepadState(1, s1After, conn1After);
+ CHECK(!conn1After);
+ CHECK(app::virtualGamepadActiveAt(1) == 0);
+ CHECK(!s1After.btnA);
+
+ // Player 3 & 4 remain disconnected
+ input::ControllerState sX{};
+ bool connX = false;
+ app::virtualGamepadState(2, sX, connX);
+ CHECK(!connX);
+ CHECK(app::virtualGamepadActiveAt(2) == 0);
+ app::virtualGamepadState(3, sX, connX);
+ CHECK(!connX);
+ CHECK(app::virtualGamepadActiveAt(3) == 0);
+
+ // Direct switchVirtualGamepadSlot test
+ app::switchVirtualGamepadSlot(3);
+ app::virtualGamepadState(0, s0, conn0);
+ CHECK(!conn0);
+ CHECK(app::virtualGamepadActiveAt(0) == 0);
+ app::virtualGamepadState(3, sX, connX);
+ CHECK(connX);
+ CHECK(app::virtualGamepadActiveAt(3) > 0);
+ }
+
+ // 2. Library Filtering of Unresolved Store BigIds (e.g. bsr9nlhvf1kl)
+ {
+ app::Library lib;
+ lib.markAsOwned("bsr9nlhvf1kl", "T_UNRESOLVED");
+ auto ownedTiles = lib.owned();
+ bool foundRawId = false;
+ for (const auto& t : ownedTiles) {
+ if (t.productId == "bsr9nlhvf1kl" || t.name == "bsr9nlhvf1kl" || t.tileUrl.empty()) {
+ foundRawId = true;
+ }
+ }
+ CHECK(!foundRawId);
+ }
+
+ // 3. WebUI HTML contains responsive layout and safe-area rules
+ {
+ app::WebServer srv;
+ auto res = srv.handleRequest("GET", "/", "");
+ CHECK(res.status == 200);
+ CHECK(res.body.find("safe-area-inset-top") != std::string::npos);
+ CHECK(res.body.find("safe-area-inset-bottom") != std::string::npos);
+ CHECK(res.body.find("gamepad-viewport-wrapper") != std::string::npos);
+ CHECK(res.body.find("gamepad-container") != std::string::npos);
+
+ auto resBoost = srv.handleRequest("GET", "/boost", "");
+ CHECK(resBoost.status == 200);
+ CHECK(resBoost.body.find("gamepad-container") != std::string::npos);
+ }
+}
+
+static void testWebReportAndGamepadLayout() {
+ app::WebServer srv;
+
+ // 1. GET /api/report-issue
+ {
+ auto res = srv.handleRequest("GET", "/api/report-issue", "");
+ CHECK(res.status == 200);
+ auto j = json::parse(res.body);
+ CHECK(j.has_value() && (*j)["ok"].asBool());
+ CHECK((*j).has("url") && (*j)["url"].str().find("github.com") != std::string::npos);
+ CHECK((*j).has("platform") && !(*j)["platform"].str().empty());
+ CHECK((*j).has("release") && (*j)["release"].str() == XC_APP_VERSION);
+ }
+
+ // 2. POST /api/report-issue with custom title and description
+ {
+ auto res = srv.handleRequest("POST", "/api/report-issue",
+ "{\"title\":\"Audio crackling on PS5\",\"what\":\"Sound started stuttering during stream\"}");
+ CHECK(res.status == 200);
+ auto j = json::parse(res.body);
+ CHECK(j.has_value() && (*j)["ok"].asBool());
+ CHECK((*j)["title"].str() == "Audio crackling on PS5");
+ CHECK((*j)["url"].str().find("Audio+crackling+on+PS5") != std::string::npos);
+ }
+
+ // 3. WebUI HTML checks (enlarged sticks/buttons, no L3/R3 tap-click, report UI, RT visibility layout)
+ {
+ auto res = srv.handleRequest("GET", "/", "");
+ CHECK(res.status == 200);
+ // Report form in tab-logs
+ CHECK(res.body.find("openGitHubReport()") != std::string::npos);
+ CHECK(res.body.find("copySanitizedReport()") != std::string::npos);
+ CHECK(res.body.find("reportTitle") != std::string::npos);
+ // Portrait 2-row layout classes
+ CHECK(res.body.find("pad-bumper-left") != std::string::npos);
+ CHECK(res.body.find("pad-bumper-right") != std::string::npos);
+ // Enlarged fullscreen sizes
+ CHECK(res.body.find("width: 152px !important") != std::string::npos);
+ CHECK(res.body.find("width: 160px !important") != std::string::npos);
+ // Tap-click removed from setupStick calls
+ CHECK(res.body.find("setupStick('leftStickZone', 'leftStickHead', 'leftStickX', 'leftStickY')") != std::string::npos);
+ CHECK(res.body.find("setupStick('leftStickZone', 'leftStickHead', 'leftStickX', 'leftStickY', 'btnL3')") == std::string::npos);
+ // Stick heads have no static L3/R3 text
+ CHECK(res.body.find("id=\"leftStickHead\"></div>") != std::string::npos);
+ CHECK(res.body.find("id=\"rightStickHead\"></div>") != std::string::npos);
+ }
+}
+
+static void testCodSearchRomanAndSettingsReset() {
+ // 1. Search matching: Call of Duty MW4, acronyms, Roman numerals
+ {
+ ui::Fonts fonts;
+ ui::ImageCache images([] {});
+ ui::AppUi app(fonts, images);
+
+ ui::GameTile mw3, mw4, bo6, gta5, fn;
+ mw3.productId = "COD_MW3";
+ mw3.name = "Call of Duty: Modern Warfare III";
+ mw3.playable = true;
+
+ mw4.productId = "9NCPSQQD1Z66";
+ mw4.name = "Call of Duty: Modern Warfare 4";
+ mw4.playable = true;
+
+ bo6.productId = "COD_BO6";
+ bo6.name = "Call of Duty: Black Ops 6";
+ bo6.playable = true;
+
+ gta5.productId = "GTA_V";
+ gta5.name = "Grand Theft Auto V";
+ gta5.playable = true;
+
+ fn.productId = "FN";
+ fn.name = "Fortnite";
+ fn.playable = true;
+
+ app.setSearchPools({mw3, mw4, bo6, gta5, fn}, {});
+
+ // Search "mw4" -> should match Call of Duty: Modern Warfare 4
+ app.showFilteredSearch(ui::Tab::GamePass, false, 0, "", 0, -1);
+ app.typeText("mw4");
+ auto res = app.searchResults(10);
+ CHECK(res.size() == 1 && res[0].first == "Call of Duty: Modern Warfare 4");
+
+ // Search "cod 4" -> should match Call of Duty: Modern Warfare 4
+ app.showFilteredSearch(ui::Tab::GamePass, false, 0, "", 0, -1);
+ app.typeText("cod 4");
+ res = app.searchResults(10);
+ CHECK(!res.empty() && res[0].first == "Call of Duty: Modern Warfare 4");
+
+ // Search "call of duty 4" -> should match Call of Duty: Modern Warfare 4
+ app.showFilteredSearch(ui::Tab::GamePass, false, 0, "", 0, -1);
+ app.typeText("call of duty 4");
+ res = app.searchResults(10);
+ CHECK(!res.empty() && res[0].first == "Call of Duty: Modern Warfare 4");
+
+ // Search "mw 3" -> Roman numeral 3 <-> iii
+ app.showFilteredSearch(ui::Tab::GamePass, false, 0, "", 0, -1);
+ app.typeText("mw 3");
+ res = app.searchResults(10);
+ CHECK(!res.empty() && res[0].first == "Call of Duty: Modern Warfare III");
+
+ // Search "gta 5" -> Roman numeral 5 <-> v
+ app.showFilteredSearch(ui::Tab::GamePass, false, 0, "", 0, -1);
+ app.typeText("gta 5");
+ res = app.searchResults(10);
+ CHECK(res.size() == 1 && res[0].first == "Grand Theft Auto V");
+
+ // Search "bo 6" -> Black Ops 6
+ app.showFilteredSearch(ui::Tab::GamePass, false, 0, "", 0, -1);
+ app.typeText("bo 6");
+ res = app.searchResults(10);
+ CHECK(res.size() == 1 && res[0].first == "Call of Duty: Black Ops 6");
+
+ // Search "cod" -> all 3 COD games
+ app.showFilteredSearch(ui::Tab::GamePass, false, 0, "", 0, -1);
+ app.typeText("cod");
+ res = app.searchResults(10);
+ CHECK(res.size() == 3);
+ }
+
+ // 2. WebControl strings
+ {
+ for (int lang = 0; lang < 6; ++lang) {
+ ui::setLanguage(static_cast<ui::Language>(lang));
+ std::string desc = ui::tr(ui::Str::WebControlDesc);
+ CHECK(!desc.empty());
+ std::string title = ui::tr(ui::Str::WebControlTitle);
+ CHECK(!title.empty());
+ std::string resetDesc = ui::tr(ui::Str::SettingDescResetSettings);
+ CHECK(!resetDesc.empty());
+ }
+ ui::setLanguage(ui::Language::English);
+ }
+
+ // 3. Settings Reset
+ {
+ app::Settings s{};
+ s.queueReadyAlert = false;
+ s.resolution = "720p";
+ s.language = "fr-FR";
+ s.padSpeakerVolume = 50;
+
+ app::Settings def{};
+ s = app::Settings{};
+ CHECK(s.queueReadyAlert == def.queueReadyAlert);
+ CHECK(s.resolution == def.resolution);
+ CHECK(s.language == def.language);
+ CHECK(s.padSpeakerVolume == def.padSpeakerVolume);
+ }
+}
+
+static void testCallOfDutyModernWarfare4CatalogAndRefresh() {
+ std::string testDir = "/tmp/test-cod-mw4";
+ std::system(("rm -rf " + testDir + " && mkdir -p " + testDir).c_str());
+ std::string cacheFile = testDir + "/library_cache.json";
+
+ net::setTestTransport([](const net::Request& req) {
+ net::Response r;
+ r.status = 200;
+ if (req.url.find("/sigls/") != std::string::npos) {
+ std::string id = req.url.substr(req.url.find("id=") + 3);
+ id = id.substr(0, id.find('&'));
+ r.body = R"([{"siglId":")" + id + R"(","title":"List )" + id + R"("},{"id":"P1"}])";
+ } else if (req.url.find("/v3/products") != std::string::npos) {
+ r.body = R"({"Products":{"P1":{"XCloudTitleId":"T1","ProductTitle":"Game One"}}})";
+ } else {
+ r.status = 503;
+ }
+ return r;
+ });
+
+ xcloud::GssvClient gssv;
+ std::string err;
+
+ // 1. Verify load() seeds Modern Warfare 4 and Call of Duty franchise
+ {
+ app::Library lib;
+ lib.setCachePath(cacheFile);
+ CHECK(lib.load(gssv, "en-US", [] {}, err));
+
+ auto gpPool = lib.gamePassSearchPool();
+ bool foundMw4 = false, foundCodHq = false, foundWarzone = false;
+ for (const auto& t : gpPool) {
+ if (t.productId == "9NCPSQQD1Z66" && t.name == "Call of Duty®: Modern Warfare® 4") foundMw4 = true;
+ if (t.productId == "9N201KQXS5BM" && t.name == "Call of Duty®") foundCodHq = true;
+ if (t.productId == "9NNFG8BQRCXL" && t.name == "Call of Duty®: Warzone™") foundWarzone = true;
+ }
+ CHECK(foundMw4);
+ CHECK(foundCodHq);
+ CHECK(foundWarzone);
+
+ // Check tile details
+ ui::GameTile mw4Tile;
+ for (const auto& t : gpPool) {
+ if (t.productId == "9NCPSQQD1Z66") {
+ mw4Tile = t;
+ break;
+ }
+ }
+ CHECK(mw4Tile.productId == "9NCPSQQD1Z66");
+ CHECK(mw4Tile.titleId == "CALLOFDUTYHQ");
+ CHECK(mw4Tile.xboxTitleId == "2001700854");
+ CHECK(mw4Tile.name == "Call of Duty®: Modern Warfare® 4");
+ CHECK(!mw4Tile.tileUrl.empty());
+ CHECK(!mw4Tile.heroUrl.empty());
+
+ // Check All Games row has MW4
+ bool mw4InRows = false;
+ for (const auto& row : lib.rows()) {
+ for (const auto& t : row.tiles) {
+ if (t.productId == "9NCPSQQD1Z66") mw4InRows = true;
+ }
+ }
+ CHECK(mw4InRows);
+
+ // Save cache for offline test
+ lib.saveCache();
+ }
+
+ // 2. Test offline cache / instant-resume withLayout retains MW4
+ {
+ app::Library libResume;
+ libResume.setCachePath(cacheFile);
+ CHECK(libResume.loadCache(true));
+ auto gpPool = libResume.gamePassSearchPool();
+ bool foundMw4 = false;
+ for (const auto& t : gpPool) {
+ if (t.productId == "9NCPSQQD1Z66") foundMw4 = true;
+ }
+ CHECK(foundMw4);
+ }
+
+ // 3. Test CALLOFDUTYHQ multi-experience deduplication and search
+ {
+ app::Library lib;
+ lib.setCachePath(cacheFile);
+ CHECK(lib.load(gssv, "en-US", [] {}, err));
+
+ ui::Fonts fonts;
+ ui::ImageCache images([] {});
+ ui::AppUi app(fonts, images);
+ app.setSearchPools(lib.gamePassSearchPool(), {});
+
+ // Search "Modern Warfare 4"
+ app.showFilteredSearch(ui::Tab::GamePass, false, 0, "", 0, -1);
+ app.typeText("Modern Warfare 4");
+ auto res = app.searchResults(10);
+ CHECK(!res.empty());
+ CHECK(res[0].first == "Call of Duty®: Modern Warfare® 4");
+
+ // Search "Warzone"
+ app.showFilteredSearch(ui::Tab::GamePass, false, 0, "", 0, -1);
+ app.typeText("Warzone");
+ res = app.searchResults(10);
+ CHECK(!res.empty());
+ CHECK(res[0].first == "Call of Duty®: Warzone™");
+ }
+
+ // 4. Test loadOwned entitles COD games for Game Pass members
+ {
+ app::Library lib;
+ lib.setCachePath(cacheFile);
+ CHECK(lib.load(gssv, "en-US", [] {}, err));
+
+ // Modern Warfare 4 is present in rows
+ bool foundInShelf = false;
+ for (const auto& row : lib.rows()) {
+ for (const auto& t : row.tiles) {
+ if (t.productId == "9NCPSQQD1Z66") foundInShelf = true;
+ }
+ }
+ CHECK(foundInShelf);
+
+ // Simulate loadOwned with Game Pass entitlement
+ net::setTestTransport([](const net::Request& req) {
+ net::Response r;
+ r.status = 200;
+ if (req.url.find("/v2/titles") != std::string::npos) {
+ r.body = R"({"results":[{"titleId":"CALLOFDUTYHQ","details":{"productId":"9N201KQXS5BM","hasEntitlement":true,"isFreeInStore":false,"userPrograms":["CALLISTO"]}}]})";
+ } else if (req.url.find("/v3/products") != std::string::npos) {
+ r.body = R"({"Products":{"9NCPSQQD1Z66":{"XCloudTitleId":"CALLOFDUTYHQ","ProductTitle":"Call of Duty®: Modern Warfare® 4"}}})";
+ } else {
+ r.status = 503;
+ }
+ return r;
+ });
+
+ std::atomic<bool> stop{false};
+ lib.loadOwned(gssv, [] {}, &stop);
+
+ // Verify MW4 is owned and playable
+ bool mw4Playable = false;
+ for (const auto& t : lib.owned()) {
+ if (t.productId == "9NCPSQQD1Z66") {
+ mw4Playable = t.playable;
+ break;
+ }
+ }
+ CHECK(mw4Playable);
+ }
+
+ // 5. Test plan tier checking: Essential does not play Ultimate-tier games, Ultimate does
+ {
+ net::setTestTransport([](const net::Request& req) {
+ net::Response r;
+ r.status = 200;
+ if (req.url.find("/sigls/") != std::string::npos) {
+ std::string id = req.url.substr(req.url.find("id=") + 3);
+ id = id.substr(0, id.find('&'));
+ r.body = R"([{"siglId":")" + id + R"(","title":"List )" + id + R"("},{"id":"P1"}])";
+ } else if (req.url.find("/v3/products") != std::string::npos) {
+ r.body = R"({"Products":{"P1":{"XCloudTitleId":"T1","ProductTitle":"Game One"},"9NCPSQQD1Z66":{"XCloudTitleId":"CALLOFDUTYHQ","ProductTitle":"Call of Duty®: Modern Warfare® 4"}}})";
+ } else {
+ r.status = 503;
+ }
+ return r;
+ });
+
+ std::string planCache = testDir + "/plan_cache.json";
+ platform::writeFileAtomic(planCache, R"({"version":2,"market":"US","language":"en-US","products":{},"owned":[],"purchasable":[],"ownedTitles":[],"ownedProducts":[],"gamePass":[]})");
+ app::Library libPlan;
+ libPlan.setCachePath(planCache);
+ libPlan.setSubscription("Essential");
+ CHECK(libPlan.load(gssv, "en-US", [] {}, err));
+ for (const auto& t : libPlan.gamePassSearchPool()) {
+ if (t.productId == "9NCPSQQD1Z66") {
+ // Not playable on Essential plan without ownership
+ CHECK(!t.playable);
+ }
+ }
+
+ libPlan.setSubscription("Ultimate");
+ for (const auto& t : libPlan.gamePassSearchPool()) {
+ if (t.productId == "9NCPSQQD1Z66") {
+ // Playable on Ultimate plan
+ CHECK(t.playable);
+ }
+ }
+ }
+
+ // 6. Test forceRefresh: force-refresh reloads without dropping offline cache
+ {
+ app::Library libRefresh;
+ libRefresh.setCachePath(cacheFile);
+ CHECK(libRefresh.load(gssv, "en-US", [] {}, err, true));
+ bool foundMw4 = false;
+ for (const auto& row : libRefresh.rows()) {
+ for (const auto& t : row.tiles) {
+ if (t.productId == "9NCPSQQD1Z66") foundMw4 = true;
+ }
+ }
+ CHECK(foundMw4);
+ }
+
+ net::setTestTransport({});
+ std::system(("rm -rf " + testDir).c_str());
+}
+
int main() {
+ testCallOfDutyModernWarfare4CatalogAndRefresh();
testBlock3Features();
testWishlist();
testAchievements();
@@ -4524,6 +5159,10 @@ int main() {
testExpandedUsbControllers();
testAudioToHaptics();
testLibraryOfflineCache();
+ testTouchpadShortcutsAndSlots();
+ testPlayerSwitchAndUnresolvedTiles();
+ testWebReportAndGamepadLayout();
+ testCodSearchRomanAndSettingsReset();
if (g_failures) {
std::fprintf(stderr, "%d failure(s)\n", g_failures);
return 1;
diff --git a/tools/ps5/ps5_dev.py b/tools/ps5/ps5_dev.py
index d8d83ff..838cc3d 100755
--- a/tools/ps5/ps5_dev.py
+++ b/tools/ps5/ps5_dev.py
@@ -185,7 +185,7 @@ def cmd_test(args):
"tunetest", "confirmtest", "pickertest", "menutest", "regiontest",
"friendstest", "publishertest", "scrolltest", "quicktest", "tlscheck",
"padspktest", "queuetest", "queueuitest", "wishlisttest", "block1test",
- "block2test", "block3test", "bitratetest",
+ "block2test", "block3test", "bitratetest", "touchpadtest", "mw4test", "v150test",
}
bitrate_opt = f" bitrate={args.bitrate}" if getattr(args, "bitrate", 0) > 0 else ""
if target.startswith("AUTOTEST") or target.startswith("BENCH") or " " in target:
@@ -228,7 +228,10 @@ def cmd_test(args):
"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"):
+ "settings_bitrate_caps.ppm", "settings_web_qr.ppm", "game_details_rating.ppm",
+ "settings_touchpad_modal.ppm", "settings_touchpad_reset.ppm", "stream_menu_slots.ppm",
+ "stream_menu_touchpad.ppm", "launch_screen_hint.ppm", "search_mw4.ppm", "details_mw4.ppm",
+ "v150_settings.ppm", "v150_search_free.ppm"):
try:
ftp.sendcmd(f"DELE {name}")
except (error_perm, error_reply):
@@ -268,7 +271,10 @@ def cmd_test(args):
"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"]
+ "settings_bitrate_caps.ppm", "settings_web_qr.ppm", "game_details_rating.ppm",
+ "settings_touchpad_modal.ppm", "settings_touchpad_reset.ppm", "stream_menu_slots.ppm",
+ "stream_menu_touchpad.ppm", "launch_screen_hint.ppm", "search_mw4.ppm", "details_mw4.ppm",
+ "v150_settings.ppm", "v150_search_free.ppm"]
ftp = get_ftp(host, port)
ftp.cwd("/data/psbox")
for name in ppm_names + ["xcloud.log"]: