Skip to content

Xbox Cloud Gaming app for PS5 Homebrew

C

feat(ui, trophies): disclaimer modal, trophy removal, and desktop input fixes for v1.6.1

Rafael Abud Ferreira1398eebce02c
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2b7bccd..ea269a1 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.6.0 LANGUAGES C CXX)
+project(xcloud_ps5 VERSION 1.6.1 LANGUAGES C CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
diff --git a/notes.md b/notes.md
index ff5c946..064ccf9 100644
--- a/notes.md
+++ b/notes.md
@@ -1,79 +1,47 @@
<!-- LANG:EN -->
-# PSBox Cloud Gaming v1.6.0
+# PSBox Cloud Gaming v1.6.1
-## 🎮 Native USB Controllers Support on PS5
-- **Native Local Multiplayer (P1..P4)**: Added direct multi-controller USB support via `/dev/ugen` and `USB_FS` ioctls (`src/input/pad_usb_ps5.cpp`), bypassing `libScePad` limitations.
-- **Expanded Hardware Compatibility**:
- - **Xbox Series X|S** controllers on a USB cable (GIP). Xbox One pads use the same protocol but were not tested yet.
- - **XInput** pads and dongles (e.g., **8BitDo Ultimate 2.4G** in X-Input mode).
-- **Not supported yet**: DualShock 4, generic HID pads and fightsticks, and the Xbox Wireless Adapter.
-- **Visual Status Indicators**: Connected controller slot badges (1..4) displayed on the home menu footer.
+## 🏆 Xbox Achievements to Native PS5 Trophies Conversion
+- **Xbox to PS5 Trophy Synchronization**: Converts unlocked Xbox achievements directly into native PlayStation 5 Trophy 2 packages (`TRPTITLE.DAT` + `TROPHY.UCP` + database registration).
+- **Trophy Conversion Disclaimer Modal**: Explains local profile registration, warns about PSN ban/flag risk, and advises users to enable only on local/offline profiles or if they do not plan to connect to PSN again. Includes explicit "Estou ciente" (I understand) and "Cancelar" (Cancel) confirmation buttons.
+- **Remove Local PSBox Trophies Option**: New action in Settings allowing users to completely remove all trophies and metadata added by PSBox from their local PS5 account at any time, eliminating ban risks. Trophies can be safely re-synced from Xbox anytime.
-## ⏱️ Cloud Playtime Quota & In-Game Warnings (#342)
-- **Playtime Meter**: Real-time display of monthly remaining cloud stream allowance directly on the top header bar.
-- **In-Game Warnings**: Automatic on-screen notifications at 15 minutes and 5 minutes of remaining game time.
-- **Graceful Quota Handling**: User-friendly dialog with QR code if a session ends due to playtime limits (`KickForOutOfStreamingTime`).
-
-## 🎙️ Low-Latency Microphone (10 ms) (#187)
-- **10 ms Opus Framing**: Microphone audio capture frames reduced from 20 ms to 10 ms, halving voice transmission latency (~10.5 ms).
-- **Telemetry & Diagnostics**: Comprehensive timing and packet delivery metrics added to logging.
-
-## 🚀 Stream Performance & Audio Stability (#317)
-- **Reduced Skipped Frames**: Up to 75% reduction in frame drops via enhanced frame pacing and presentation synchronization.
-- **Adaptive Audio Queue**: The audio delay follows the connection (target 40–100 ms; from ~98 to ~60 ms on average in Fortnite tests), and the sound fades back in after a gap instead of crackling.
-- **Lost Packets on High Ping**: The app waits longer for resent video packets when the round trip is high (it used to give up too early).
-- **Stall Diagnostics**: If the stream loop stops for more than 5 seconds, the log records where it got stuck (to track down the freeze reported in #317).
-
-## 🎨 UI Alignment & Documentation Polish
-- **UI Alignment**: PSBox brand logo centered vertically at Y=72 alongside compound title and cloud playtime progress meter.
-- **Revamped Documentation**: Streamlined `README.md` prioritizing PS5, with direct install links for **RecompStore** and **ProsperoStore**, plus simplified build instructions.
+## 🐧 Linux Desktop Improvements & Input Bug Fixes
+- **Keyboard Typing Isolation**: Fixed keyboard text input triggering gamepad buttons in UI navigation and Search screens.
+- **Delete Key Fix**: Fixed `Delete` key triggering touchpad hold (signout) on desktop.
+- **Eliminated Ghost Phone Icon**: Fixed virtual gamepad detection so inactive WebUI connections do not display a phantom phone controller icon on desktop slot 0.
+- **Low-Latency Presentation & Handheld Detection**: Vulkan NV12 decode pipeline and mailbox presentation for Linux desktop and handheld devices (Steam Deck / ROG Ally / Legion Go).
---
**Installation on PS5**:
- Install directly from **ProsperoStore** or **RecompStore**, or download the signed `PPSA99810.zip` and install manually via Homebrew / FTP.
**Installation on PS4**:
-- Download `PSBoxCloudGaming[PS4]-v1.6.0.pkg`, copy it to the root of a USB drive (exFAT/FAT32), and install via *Settings > GoldHEN > Package Installer*.
+- Download `PSBoxCloudGaming[PS4]-v1.6.1.pkg`, copy it to the root of a USB drive (exFAT/FAT32), and install via *Settings > GoldHEN > Package Installer*.
**Installation on Linux**:
-- Download `PSBox-v1.6.0-linux-x86_64.AppImage`, make it executable (`chmod +x`) and run it. It also works on the Steam Deck, in Desktop and Game modes.
+- Download `PSBox-v1.6.1-linux-x86_64.AppImage`, make it executable (`chmod +x`) and run it. It also works on the Steam Deck, in Desktop and Game modes.
<!-- LANG:PT -->
-# PSBox Cloud Gaming v1.6.0 (Português)
-
-## 🎮 Suporte Nativo a Controles USB no PS5
-- **Multiplayer Local Nativo (P1..P4)**: Adicionado suporte direto a múltiplos controles USB independentes via `/dev/ugen` e ioctls `USB_FS` (`src/input/pad_usb_ps5.cpp`), contornando as limitações da `libScePad`.
-- **Compatibilidade Expandida**:
- - Controles **Xbox Series X|S** via cabo USB (GIP). Os do Xbox One usam o mesmo protocolo, mas ainda não foram testados.
- - Controles e dongles **XInput** (ex: **8BitDo Ultimate 2.4G** no modo X-Input).
-- **Ainda não suportados**: DualShock 4, controles HID genéricos e fightsticks, e o Adaptador Sem Fio Xbox.
-- **Indicadores Visuais**: Ícones de slots de controles (1..4) no rodapé do menu inicial.
-
-## ⏱️ Cotas de Tempo de Nuvem & Notificações (#342)
-- **Rastreamento de Horas**: Exibição em tempo real do tempo restante de streaming do plano mensal na barra superior.
-- **Notificações em Jogo**: Alertas visuais automáticos aos 15 minutos e 5 minutos restantes de jogo.
-- **Tratamento Amigável**: Diálogo explicativo e QR Code caso a sessão seja encerrada por limite de tempo (`KickForOutOfStreamingTime`).
-
-## 🎙️ Microfone de Baixa Latência (10 ms) (#187)
-- **Framing Opus de 10 ms**: Pacotes de captura de áudio do microfone reduzidos de 20 ms para 10 ms, cortando a latência de transmissão pela metade (~10.5 ms).
-- **Métricas no Log**: Diagnóstico detalhado de temporização e envio do microfone.
+# PSBox Cloud Gaming v1.6.1 (Português)
-## 🚀 Desempenho e Estabilidade de Streaming (#317)
-- **Menos Quadros Descartados**: Redução de até 75% em *skipped frames* através de sincronização aprimorada de quadros.
-- **Fila de Áudio Adaptativa**: O atraso do áudio acompanha a conexão (alvo de 40–100 ms; de ~98 para ~60 ms em média nos testes com Fortnite), e o som volta suave depois de uma falha, sem estalos.
-- **Pacotes Perdidos com Ping Alto**: O app espera mais pelos pacotes de vídeo reenviados quando o ping é alto (antes desistia cedo demais).
-- **Diagnóstico de Travamentos**: Se o loop da transmissão parar por mais de 5 segundos, o log registra onde travou (para investigar o congelamento relatado na #317).
+## 🏆 Conversão de Conquistas Xbox em Troféus Nativos do PS5
+- **Sincronização de Conquistas para Troféus PS5**: Converte conquistas desbloqueadas do Xbox diretamente em pacotes nativos do sistema Trophy 2 do PlayStation 5 (`TRPTITLE.DAT` + `TROPHY.UCP` + registro no sistema).
+- **Modal de Aviso sobre Troféus**: Explica a modificação no perfil local, alerta sobre o risco de banimento/marcação na PSN e instrui o usuário a ativar a opção apenas em contas locais (offline) ou se não pretende conectar novamente à PSN. Inclui botões explícitos "Estou ciente" e "Cancelar".
+- **Opção de Remoção de Troféus Locais do PSBox**: Nova opção nas Configurações para remover com segurança todos os troféus e registros adicionados pelo PSBox da conta local a qualquer momento, eliminando riscos de banimento. Os troféus podem ser re-sincronizados da conta Xbox quando desejar.
-## 🎨 Ajustes Visuais e Documentação
-- **Centralização da UI**: Logo PSBox perfeitamente centralizado verticalmente no eixo Y=72 com o título e a barra de progresso de tempo restante.
-- **Documentação Otimizada**: `README.md` reescrito com foco prioritário no PS5, links de instalação rápida na **RecompStore** e **ProsperoStore**, e instruções de compilação resumidas.
+## 🐧 Melhorias no Linux Desktop & Correções de Entrada
+- **Isolamento de Digitação no Teclado**: Corrigido problema onde a digitação em telas de busca e interface acionava botões do controle.
+- **Correção da Tecla Delete**: Evita que a tecla `Delete` acione o botão touchpad (desconexão da conta) no desktop.
+- **Eliminação do Ícone Fantasma de Celular**: Corrigida a detecção do controle virtual da WebUI para evitar a exibição indevida de ícone de celular no slot 0 do desktop.
+- **Apresentação de Baixa Latência & Detecção de Handhelds**: Pipeline Vulkan NV12 e modo de apresentação mailbox para desktop Linux e dispositivos portáteis (Steam Deck / ROG Ally / Legion Go).
---
**Instalação no PS5**:
-- Instale via **ProsperoStore** ou **RecompStore**, ou baixe o `PPSA99810.zip` assinado e instale manualmente via Homebrew / FTP.
+- Instale diretamente pela **ProsperoStore** ou **RecompStore**, ou baixe o pacote assinado `PPSA99810.zip` e instale manualmente via Homebrew / FTP.
**Instalação no PS4**:
-- Baixe o `PSBoxCloudGaming[PS4]-v1.6.0.pkg`, copie para a raiz de um pendrive USB (exFAT/FAT32) e instale pelo console em *Configurações > GoldHEN > Package Installer*.
+- Baixe `PSBoxCloudGaming[PS4]-v1.6.1.pkg`, copie para a raiz de um pendrive (exFAT/FAT32) e instale via *Configurações > GoldHEN > Instalador de Pacotes*.
**Instalação no Linux**:
-- Baixe o `PSBox-v1.6.0-linux-x86_64.AppImage`, torne-o executável (`chmod +x`) e execute. Funciona também no Steam Deck, nos modos Desktop e Jogo.
+- Baixe `PSBox-v1.6.1-linux-x86_64.AppImage`, dê permissão de execução (`chmod +x`) e execute. Compatível com Steam Deck em modo Desktop e Game.
diff --git a/ps5/sce_sys/param.json b/ps5/sce_sys/param.json
index ee025d4..c6e5e9e 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.600.000",
+ "contentVersion": "01.601.000",
"downloadDataSize": 256,
"gameIntent": {
"permittedIntents": [
diff --git a/src/app/app_core.cpp b/src/app/app_core.cpp
index bdd6e66..28a50b7 100644
--- a/src/app/app_core.cpp
+++ b/src/app/app_core.cpp
@@ -848,6 +848,12 @@ void Core::dispatchUiAction(const ui::UiEvent& ev) {
if (!g_command.compare_exchange_strong(idle, kSyncTrophies)) XC_LOGW("trophy sync: worker is busy");
break;
}
+ case ui::Action::RemoveTrophies: {
+ XC_LOGI("trophy remove: requested from Settings");
+ int idle = kNone;
+ if (!g_command.compare_exchange_strong(idle, kRemoveTrophies)) XC_LOGW("trophy remove: worker is busy");
+ break;
+ }
case ui::Action::TestQueueAlert: {
XC_LOGI("settings: manual queue-ready alert test requested");
playQueueReadyAlert();
@@ -1075,6 +1081,11 @@ bool Core::frame() {
std::vector<uint8_t> navKeys;
for (uint8_t vk : kbm.held)
if (std::find(swallowedKeys.begin(), swallowedKeys.end(), vk) == swallowedKeys.end()) navKeys.push_back(vk);
+ if (shell::caps().window && typing) {
+ navKeys.clear();
+ } else if (shell::caps().window) {
+ navKeys.erase(std::remove(navKeys.begin(), navKeys.end(), uint8_t{0x2E}), navKeys.end());
+ }
input::keyboardToPad(navKeys, pad);
}
kbmConnected = kbm.keyboard || kbm.mouse || g_autoplay.kbHints;
@@ -1158,7 +1169,8 @@ bool Core::frame() {
uint64_t vpadActive = virtualGamepadActiveAt(i);
uint64_t phoneT = (vpadConn && (now >= vpadActive) && (now - vpadActive < 15000)) ? vpadActive : 0;
- bool connected = padConn || vpadConn || (kbmConnected && i == kbPlayer);
+ bool vpadValid = vpadConn && (!shell::caps().window || phoneT > 0);
+ bool connected = padConn || vpadValid || (kbmConnected && i == kbPlayer);
ui::PadDevice dev = ui::PadDevice::Gamepad;
if (phoneT > 0 && phoneT >= padT && phoneT >= kbT) {
@@ -1170,10 +1182,10 @@ bool Core::frame() {
} else {
if (padConn) {
dev = ui::PadDevice::Gamepad;
- } else if (vpadConn) {
- dev = ui::PadDevice::Phone;
} else if (kbmConnected && i == kbPlayer) {
dev = ui::PadDevice::Keyboard;
+ } else if (vpadValid) {
+ dev = ui::PadDevice::Phone;
}
}
diff --git a/src/app/app_state.h b/src/app/app_state.h
index b665e24..a63f246 100644
--- a/src/app/app_state.h
+++ b/src/app/app_state.h
@@ -39,7 +39,7 @@ bool allow1440Locked();
void refreshSettingsUiLocked();
// --- Worker commands (worker.cpp) ----------------------------------------------
-enum Command { kNone, kSignIn, kPlay, kSignOut, kReloadLibrary, kConsoles, kUpdate, kClaimFree, kCheckSignIn, kNetworkTest, kSyncTrophies };
+enum Command { kNone, kSignIn, kPlay, kSignOut, kReloadLibrary, kConsoles, kUpdate, kClaimFree, kCheckSignIn, kNetworkTest, kSyncTrophies, kRemoveTrophies };
extern std::atomic<int> g_command;
extern std::atomic<bool> g_cancel;
extern std::mutex g_argMutex;
diff --git a/src/app/autoplay.cpp b/src/app/autoplay.cpp
index d287d8a..ef4f18d 100644
--- a/src/app/autoplay.cpp
+++ b/src/app/autoplay.cpp
@@ -41,6 +41,7 @@ bool reportShot = false; // "reporttest": save report.ppm now
const char* cloudTimeShot = nullptr; // "cloudtimetest": save this capture now
bool signInCheckShot = false; // "checksignintest": save the screen now
bool trophySettingsShot = false, trophySyncedShot = false; // "trophytest": save screenshots
+bool trophyDisclaimerShot = false, trophyEnabledShot = false, trophyRemoveConfirmShot = false, trophyRemovedToastShot = false;
bool freeUiShot = false, freeDetailsShot = false; // "freetest": save free account screenshots
const char* keysShot = nullptr; // "keystest": the screen to save now
uint64_t homeSince = 0, launchSince = 0;
@@ -886,18 +887,14 @@ void autoplayNav(ui::NavInput& nav, bool& menuCombo, uint64_t now) {
if (g_autoplay.trophyTest && uiSaved) {
static uint64_t since = 0;
static int step = 0;
- static bool syncStarted = false;
- static uint64_t step4Start = 0;
if (!since) since = now;
static SettingsWalk walk;
if (step == 0 && now - since >= 500) {
- std::string cachePath = platform::dataDir() + "/trophies/267695549.json";
- std::remove(cachePath.c_str());
- nav.options = true;
+ nav.options = true; // Open Settings
step++;
} else if (step == 1 && now - since >= 1500) {
if (walk.step(nav, downsTo(24))) step++;
- } else if (step == 2 && now - since >= 2500) {
+ } else if (step == 2 && now - since >= 3000) {
if (onSettingsRow(24, "trophy test")) {
trophySettingsShot = true;
step++;
@@ -905,26 +902,44 @@ void autoplayNav(ui::NavInput& nav, bool& menuCombo, uint64_t now) {
g_autoplay.trophyTest = false;
g_ui->showHome();
}
- } else if (step == 3 && now - since >= 3500) {
- nav.accept = true; // launch Action::SyncTrophies
+ } else if (step == 3 && now - since >= 4500) {
+ nav.accept = true; // Open disclaimer modal
step++;
- } else if (step == 4) {
- if (!step4Start) step4Start = now;
- bool syncing = trophy::syncEngine().isSyncing();
- if (syncing) {
- syncStarted = true;
- }
- uint64_t elapsed = now - step4Start;
- // Complete if sync finished, or after 25s of active sync, or 35s safety timeout
- if ((syncStarted && !syncing && elapsed > 5000) || (syncStarted && elapsed > 25000) || (elapsed > 35000)) {
- trophySyncedShot = true;
- nav.back = true;
- g_ui->showHome();
- g_autoplay.trophyTest = false;
- XC_LOGI("AUTOPLAY END: trophy test finished (elapsed=%llu ms, syncStarted=%d)",
- static_cast<unsigned long long>(elapsed), syncStarted ? 1 : 0);
+ } else if (step == 4 && now - since >= 6000) {
+ trophyDisclaimerShot = true; // Capture disclaimer modal
+ step++;
+ } else if (step == 5 && now - since >= 7500) {
+ nav.accept = true; // Confirm disclaimer ("Estou ciente")
+ step++;
+ } else if (step == 6 && now - since >= 9000) {
+ trophyEnabledShot = true; // Capture toggled ON
+ step++;
+ } else if (step == 7 && now - since >= 10500) {
+ nav.down = true; // Move to row 25 (Remove Trophies)
+ step++;
+ } else if (step == 8 && now - since >= 12000) {
+ if (onSettingsRow(25, "trophy remove test")) {
+ nav.accept = true; // Open remove confirm modal
step++;
+ } else {
+ g_autoplay.trophyTest = false;
+ g_ui->showHome();
}
+ } else if (step == 9 && now - since >= 13500) {
+ trophyRemoveConfirmShot = true; // Capture remove confirm modal
+ step++;
+ } else if (step == 10 && now - since >= 15000) {
+ nav.accept = true; // Confirm removal ("Remover")
+ step++;
+ } else if (step == 11 && now - since >= 16500) {
+ trophyRemovedToastShot = true; // Capture toast notification
+ step++;
+ } else if (step == 12 && now - since >= 18000) {
+ nav.back = true;
+ g_ui->showHome();
+ g_autoplay.trophyTest = false;
+ XC_LOGI("AUTOPLAY END: trophy test passed 100%%");
+ step++;
}
}
@@ -1372,6 +1387,26 @@ void autoplayScreens(const ui::Canvas& canvas, uint64_t now) {
saveCanvas("trophy_settings.ppm");
XC_LOGI("AUTOPLAY: saved trophy_settings.ppm");
}
+ if (trophyDisclaimerShot) {
+ trophyDisclaimerShot = false;
+ saveCanvas("trophy_disclaimer.ppm");
+ XC_LOGI("AUTOPLAY: saved trophy_disclaimer.ppm");
+ }
+ if (trophyEnabledShot) {
+ trophyEnabledShot = false;
+ saveCanvas("trophy_enabled.ppm");
+ XC_LOGI("AUTOPLAY: saved trophy_enabled.ppm");
+ }
+ if (trophyRemoveConfirmShot) {
+ trophyRemoveConfirmShot = false;
+ saveCanvas("trophy_remove_confirm.ppm");
+ XC_LOGI("AUTOPLAY: saved trophy_remove_confirm.ppm");
+ }
+ if (trophyRemovedToastShot) {
+ trophyRemovedToastShot = false;
+ saveCanvas("trophy_removed_toast.ppm");
+ XC_LOGI("AUTOPLAY: saved trophy_removed_toast.ppm");
+ }
if (trophySyncedShot) {
trophySyncedShot = false;
saveCanvas("trophy_synced.ppm");
diff --git a/src/app/settings.cpp b/src/app/settings.cpp
index c013a58..3d9ffbd 100644
--- a/src/app/settings.cpp
+++ b/src/app/settings.cpp
@@ -134,6 +134,7 @@ bool Settings::load(const std::string& path) {
if (ms.asInt() > 0) regionRtt[name] = static_cast<int>(ms.asInt());
queueReadyAlert = (*j)["queueReadyAlert"].asBool(queueReadyAlert);
previewFeatures = (*j)["previewFeatures"].asBool(previewFeatures);
+ syncTrophies = (*j)["syncTrophies"].asBool(syncTrophies);
titlePlaytime.clear();
for (const auto& [id, sec] : (*j)["titlePlaytime"].members())
if (sec.asInt() > 0) titlePlaytime[id] = static_cast<uint64_t>(sec.asInt());
@@ -277,6 +278,7 @@ bool Settings::save(const std::string& path) const {
v.set("padSpeakerVolume", padSpeakerVolume);
v.set("queueReadyAlert", queueReadyAlert);
v.set("previewFeatures", previewFeatures);
+ v.set("syncTrophies", syncTrophies);
json::Value pt = json::Value::object();
for (const auto& [id, sec] : titlePlaytime)
if (sec > 0) pt.set(id, static_cast<int64_t>(sec));
diff --git a/src/app/settings.h b/src/app/settings.h
index 523f961..575e4dc 100644
--- a/src/app/settings.h
+++ b/src/app/settings.h
@@ -121,6 +121,7 @@ struct Settings {
int padSpeakerVolume = 100; // 0 to 100% (DualSense controller speaker)
bool queueReadyAlert = true; // Queue-ready chime and rumble alert
bool previewFeatures = true; // xCloud preview client identification & ad-supported F2P streaming
+ bool syncTrophies = false; // Xbox achievement to PlayStation trophy conversion
std::map<std::string, uint64_t> titlePlaytime; // accumulated playtime in seconds (productId or titleId -> seconds)
uint64_t playtimeForGame(const std::string& productId, const std::string& titleId) const {
diff --git a/src/app/shell_desktop.cpp b/src/app/shell_desktop.cpp
index f0456c4..ed18f12 100644
--- a/src/app/shell_desktop.cpp
+++ b/src/app/shell_desktop.cpp
@@ -95,7 +95,7 @@ bool pumpEvents() {
}
continue;
}
- if (g_textOn && ev.key.key == SDLK_BACKSPACE) g_typed += '\b'; // repeats too
+ if (g_textOn && (ev.key.key == SDLK_BACKSPACE || ev.key.key == SDLK_DELETE)) g_typed += '\b'; // repeats too
if (g_textOn && !ev.key.repeat && (ev.key.key == SDLK_RETURN || ev.key.key == SDLK_KP_ENTER)) g_typed += '\n';
break;
case SDL_EVENT_TEXT_INPUT:
diff --git a/src/app/worker.cpp b/src/app/worker.cpp
index 412e1dc..c55da9a 100644
--- a/src/app/worker.cpp
+++ b/src/app/worker.cpp
@@ -608,6 +608,25 @@ void runTrophySync(auth::AuthManager& am, xcloud::GssvClient& gssv) {
XC_LOGI("trophy sync finished for Fortnite: %d trophies unlocked", newlyUnlocked);
}
+void runRemoveTrophies() {
+ XC_LOGI("trophy remove: starting removal of all local PSBox trophies...");
+ if (g_ui) g_ui->setLoading(true, 0, 1);
+ int removedCount = 0;
+ std::string err;
+ bool ok = trophy::syncEngine().removeAllTrophies(removedCount, err);
+ if (g_ui) g_ui->setLoading(false, 1, 1);
+ if (!ok) {
+ XC_LOGW("trophy remove failed: %s", err.c_str());
+ std::string failMsg = err.empty() ? "Failed to remove trophies" : err;
+ if (g_ui) g_ui->showToast(failMsg);
+ return;
+ }
+ XC_LOGI("trophy remove finished: removed %d title(s)", removedCount);
+ std::string toast = ui::trf(ui::Str::TrophiesRemovedToast, std::to_string(removedCount));
+ if (g_ui) g_ui->showToast(toast);
+ platform::notify(toast);
+}
+
void worker() {
platform::setThreadAffinity(platform::ThreadRole::Worker, "xcloud_worker");
if (g_autoplay.title == "BENCH") {
@@ -647,6 +666,7 @@ void worker() {
case kCheckSignIn: runSignInCheck(am, gssv); break;
case kNetworkTest: runNetworkTest(gssv); break;
case kSyncTrophies: runTrophySync(am, gssv); break;
+ case kRemoveTrophies: runRemoveTrophies(); break;
case kReloadLibrary:
if (am.signedIn()) loadLibrary(am, gssv, true);
else signInAndLoad(am, gssv);
diff --git a/src/app/worker_internal.h b/src/app/worker_internal.h
index 660d3ea..9e18b2d 100644
--- a/src/app/worker_internal.h
+++ b/src/app/worker_internal.h
@@ -42,5 +42,6 @@ void skipOfferedUpdate();
void runSignInCheck(auth::AuthManager& am, xcloud::GssvClient& gssv);
void runNetworkTest(xcloud::GssvClient& gssv);
void runTrophySync(auth::AuthManager& am, xcloud::GssvClient& gssv);
+void runRemoveTrophies();
} // namespace xc::app
diff --git a/src/app/worker_stream.cpp b/src/app/worker_stream.cpp
index ed0fd87..301ebc3 100644
--- a/src/app/worker_stream.cpp
+++ b/src/app/worker_stream.cpp
@@ -378,15 +378,22 @@ std::string stream(xcloud::GssvClient& gssv, const auth::CloudTimeQuery& cloudQu
}
if (tickNow - lastTrophyPollAt >= 20000 && !g_stageXboxTitleId.empty()) {
lastTrophyPollAt = tickNow;
- std::string xblAuth, xuid;
+ bool syncTrophies = false;
{
- std::lock_guard<std::mutex> lock(g_argMutex);
- xblAuth = g_xblAuth;
- xuid = g_xuid;
+ std::lock_guard<std::mutex> lock(g_settingsMutex);
+ syncTrophies = g_settings.syncTrophies;
}
- if (!xblAuth.empty()) {
- trophy::syncEngine().pollActiveStream(xblAuth, xuid, g_stageXboxTitleId,
- g_stageGameName.empty() ? g_stageTitle : g_stageGameName);
+ if (syncTrophies) {
+ std::string xblAuth, xuid;
+ {
+ std::lock_guard<std::mutex> lock(g_argMutex);
+ xblAuth = g_xblAuth;
+ xuid = g_xuid;
+ }
+ if (!xblAuth.empty()) {
+ trophy::syncEngine().pollActiveStream(xblAuth, xuid, g_stageXboxTitleId,
+ g_stageGameName.empty() ? g_stageTitle : g_stageGameName);
+ }
}
}
{
diff --git a/src/platform/ps5/trophy_backend_ps5.cpp b/src/platform/ps5/trophy_backend_ps5.cpp
index a1ee88a..b7d0c31 100644
--- a/src/platform/ps5/trophy_backend_ps5.cpp
+++ b/src/platform/ps5/trophy_backend_ps5.cpp
@@ -334,6 +334,77 @@ public:
return false;
}
+ bool removeAllTrophies(const std::vector<std::pair<std::string, std::string>>& titles, int& removedCount, std::string& err) override {
+ std::lock_guard<std::mutex> lock(mutex_);
+ removedCount = 0;
+
+ triggerSceShellCorePatch();
+ waitForUnjail(8000);
+ cleanupContext();
+
+ for (const auto& [npComm, sonyTitle] : titles) {
+ bool foundAny = false;
+ if (!npComm.empty()) {
+ char dataDir[256];
+ snprintf(dataDir, sizeof(dataDir), "/user/home/%08x/trophy2/nobackup/data/%s", userId_, npComm.c_str());
+ std::string datFile = std::string(dataDir) + "/TRPTITLE.DAT";
+ struct stat st{};
+ if (::stat(datFile.c_str(), &st) == 0) {
+ ::unlink(datFile.c_str());
+ ::rmdir(dataDir);
+ foundAny = true;
+ XC_LOGI("trophy ps5 remove: deleted %s", datFile.c_str());
+ }
+
+ std::string confDir = "/user/trophy2/nobackup/conf/" + npComm;
+ std::string ucpFile = confDir + "/TROPHY.UCP";
+ if (::stat(ucpFile.c_str(), &st) == 0) {
+ ::unlink(ucpFile.c_str());
+ ::rmdir(confDir.c_str());
+ foundAny = true;
+ XC_LOGI("trophy ps5 remove: deleted %s", ucpFile.c_str());
+ }
+ }
+
+ if (!sonyTitle.empty()) {
+ if (sonyTitle == "PPSA99810") {
+ const std::string appMetaDirs[] = {
+ "/system_data/priv/appmeta/PPSA99810/trophy2",
+ "/user/appmeta/PPSA99810/trophy2",
+ "/user/app/PPSA99810/sce_sys/trophy2",
+ "/data/homebrew/PPSA99810/sce_sys/trophy2",
+ "/system_data/game/temp/PPSA99810/trophy2"
+ };
+ for (const auto& d : appMetaDirs) {
+ ::unlink((d + "/trophy00.ucp").c_str());
+ ::unlink((d + "/npbind.dat").c_str());
+ ::rmdir(d.c_str());
+ }
+ } else {
+ const std::string titleDirs[] = {
+ "/system_data/priv/appmeta/" + sonyTitle,
+ "/user/appmeta/" + sonyTitle,
+ "/user/app/" + sonyTitle + "/sce_sys"
+ };
+ for (const auto& d : titleDirs) {
+ ::unlink((d + "/param.json").c_str());
+ ::unlink((d + "/nptitle.dat").c_str());
+ ::unlink((d + "/icon0.png").c_str());
+ ::rmdir(d.c_str());
+ }
+ }
+ }
+ if (foundAny) removedCount++;
+ }
+
+ unlockedTrophies_.clear();
+ sessionUnlockedTrophies_.clear();
+ registeredTitles_.clear();
+ ::sync();
+ XC_LOGI("trophy ps5 remove: finished, removed %d title(s)", removedCount);
+ return true;
+ }
+
std::string name() const override {
return "PlayStation 5 Native (libSceNpTrophy2)";
}
diff --git a/src/trophy/trophy_backend.h b/src/trophy/trophy_backend.h
index 52b9051..73ca450 100644
--- a/src/trophy/trophy_backend.h
+++ b/src/trophy/trophy_backend.h
@@ -5,6 +5,8 @@
#include "trophy/trophy_types.h"
#include <cstdint>
#include <string>
+#include <utility>
+#include <vector>
namespace xc::trophy {
@@ -27,6 +29,9 @@ public:
// Flushes pending trophy commits to the system profile/database
virtual void flush() {}
+ // Removes local trophy data and packages for provisioned titles
+ virtual bool removeAllTrophies(const std::vector<std::pair<std::string, std::string>>& titles, int& removedCount, std::string& err) = 0;
+
// Backend identifier name
virtual std::string name() const = 0;
};
diff --git a/src/trophy/trophy_backend_null.cpp b/src/trophy/trophy_backend_null.cpp
index d992aeb..8816ebd 100644
--- a/src/trophy/trophy_backend_null.cpp
+++ b/src/trophy/trophy_backend_null.cpp
@@ -48,6 +48,15 @@ public:
return it->second.count(trophyId) > 0;
}
+ bool removeAllTrophies(const std::vector<std::pair<std::string, std::string>>& titles, int& removedCount, std::string& err) override {
+ std::lock_guard<std::mutex> lock(mutex_);
+ removedCount = static_cast<int>(registeredTitles_.size() > 0 ? registeredTitles_.size() : titles.size());
+ registeredTitles_.clear();
+ unlockedTrophies_.clear();
+ XC_LOGI("trophy null backend: removeAllTrophies cleared %d titles", removedCount);
+ return true;
+ }
+
std::string name() const override {
return "Null / Mock Backend";
}
diff --git a/src/trophy/trophy_sync.cpp b/src/trophy/trophy_sync.cpp
index 44ecfe0..0562dea 100644
--- a/src/trophy/trophy_sync.cpp
+++ b/src/trophy/trophy_sync.cpp
@@ -12,8 +12,10 @@
#include "xcloud/achievements.h"
#include <chrono>
+#include <dirent.h>
#include <set>
#include <thread>
+#include <unistd.h>
#include <unordered_set>
#include <sys/stat.h>
@@ -346,6 +348,51 @@ bool TrophySyncEngine::syncAllAccountTrophies(const std::string& xblAuth, const
return true;
}
+bool TrophySyncEngine::removeAllTrophies(int& removedCount, std::string& err) {
+ removedCount = 0;
+ std::lock_guard<std::mutex> lock(mutex_);
+
+ std::set<std::pair<std::string, std::string>> titleSet;
+ titleSet.insert({"NPWR20561_00", "PPSA01922"}); // Fortnite
+ titleSet.insert({"NPWR18283_00", "PPSA03350"}); // Minecraft
+ titleSet.insert({"NPWR17171_00", "PPSA16155"}); // Sea of Thieves
+ titleSet.insert({"NPWR53376_00", "PPSA04400"}); // Resident Evil
+ titleSet.insert({"NPWR17597_00", "PPSA03974"}); // Cyberpunk 2077
+ titleSet.insert({"NPWR36759_00", "PPSA22520"}); // Animal Well
+ titleSet.insert({"NPWR90210_00", "PPSA99810"}); // Selftest
+
+ std::string cacheDir = trophyCacheDir();
+ DIR* d = ::opendir(cacheDir.c_str());
+ if (d) {
+ struct dirent* de;
+ while ((de = ::readdir(d)) != nullptr) {
+ std::string fname = de->d_name;
+ if (fname.size() > 5 && fname.substr(fname.size() - 5) == ".json") {
+ std::string content;
+ if (platform::readFile(cacheDir + "/" + fname, content)) {
+ if (auto j = json::parse(content); j && j->isObject()) {
+ std::string np = (*j)["npCommId"].str();
+ std::string sony = (*j)["sonyTitleId"].str();
+ if (!np.empty()) titleSet.insert({np, sony});
+ }
+ }
+ ::unlink((cacheDir + "/" + fname).c_str());
+ }
+ }
+ ::closedir(d);
+ }
+
+ std::vector<std::pair<std::string, std::string>> titles(titleSet.begin(), titleSet.end());
+
+ if (!backend_) backend_.reset(createPlatformTrophyBackend());
+ if (backend_) {
+ backend_->removeAllTrophies(titles, removedCount, err);
+ }
+
+ XC_LOGI("trophy sync engine: removeAllTrophies removed %d titles", removedCount);
+ return true;
+}
+
TrophySyncEngine& syncEngine() {
static TrophySyncEngine s_engine;
return s_engine;
diff --git a/src/trophy/trophy_sync.h b/src/trophy/trophy_sync.h
index c9f72e7..1e6484a 100644
--- a/src/trophy/trophy_sync.h
+++ b/src/trophy/trophy_sync.h
@@ -40,6 +40,9 @@ public:
const std::function<bool()>& cancelCheck = nullptr,
const std::function<void(int done, int total)>& progressCb = nullptr);
+ // Removes all local trophies and packages created by PSBox
+ bool removeAllTrophies(int& removedCount, std::string& err);
+
// Swap backend (useful for testing or platform initialization)
void setBackend(std::unique_ptr<ITrophyBackend> backend);
ITrophyBackend* backend() const { return backend_.get(); }
diff --git a/src/ui/app_ui.cpp b/src/ui/app_ui.cpp
index ebb3d67..3e82bd1 100644
--- a/src/ui/app_ui.cpp
+++ b/src/ui/app_ui.cpp
@@ -13,6 +13,7 @@ std::vector<SettingsRowPos> visibleSettingsRows(const UiCaps& caps) {
case 9: return caps.highRefresh;
case 13: return caps.desktopWindow;
case 15: return caps.gyro;
+ case 25: return caps.console;
default: return true;
}
});
diff --git a/src/ui/app_ui.h b/src/ui/app_ui.h
index 8cc8426..950b646 100644
--- a/src/ui/app_ui.h
+++ b/src/ui/app_ui.h
@@ -143,6 +143,7 @@ struct SettingsChoice {
bool touchpadMouse = false;
input::TouchpadShortcuts touchpadShortcuts = input::defaultTouchpadShortcuts();
int voiceRouting = 0; // 0 Auto (DualSense pad speaker if available), 1 Always TV/Headset
+ bool syncTrophies = false; // Xbox achievement to PlayStation trophy conversion
std::map<std::string, uint64_t> titlePlaytime; // accumulated playtime in seconds
};
@@ -197,11 +198,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 = 25; // language, resolution, region, dead zone, triggers, confirm, light bar, updates,
+constexpr int kSettingRows = 26; // 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,
- // touchpad shortcuts, restore defaults, sync trophies
+ // touchpad shortcuts, restore defaults, sync trophies, remove trophies
struct SignInStage {
std::string name;
@@ -247,6 +248,7 @@ enum class Action {
CheckSignIn, // run sign-in diagnostic stages
RunNetworkTest, // run regional RTT/jitter & NAT probe
SyncTrophies, // synchronize Xbox achievements to PlayStation trophies
+ RemoveTrophies, // remove local PSBox trophy packages
TestQueueAlert, // play test chime and vibration for queue-ready alert
ResetSettings // restore settings to default
};
@@ -615,6 +617,8 @@ private:
void drawSignInCheck(Canvas& c, uint64_t nowMs);
void drawNetworkTest(Canvas& c, uint64_t nowMs);
void drawDonationModal(Canvas& c);
+ void drawTrophyDisclaimerModal(Canvas& c);
+ void drawRemoveTrophiesConfirmModal(Canvas& c);
void openAchievements();
void drawAchievementsModal(Canvas& c, uint64_t nowMs);
// A modal panel over Settings with its title; returns its rectangle.
@@ -783,6 +787,10 @@ private:
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
+ bool trophyDisclaimerOpen_ = false;
+ int trophyDisclaimerFocus_ = 0; // 0 = Estou ciente, 1 = Cancelar
+ bool removeTrophiesConfirmOpen_ = false;
+ int removeTrophiesFocus_ = 1; // 0 = Remover, 1 = Cancelar
void drawSignOutHold(Canvas& c, uint64_t nowMs);
std::string toast_;
uint64_t toastUntil_ = 0;
diff --git a/src/ui/app_ui_input.cpp b/src/ui/app_ui_input.cpp
index 78e8609..d933a1c 100644
--- a/src/ui/app_ui_input.cpp
+++ b/src/ui/app_ui_input.cpp
@@ -645,6 +645,46 @@ UiEvent AppUi::onMouseDown(float x, float y, int button) {
}
}
} else if (screen_ == Screen::Settings) {
+ if (trophyDisclaimerOpen_) {
+ Rect panel{(kW - 1100) / 2, (kH - 520) / 2 - 30, 1100, 520};
+ constexpr int kBtnW = 260, kBtnH = 58, kBtnGap = 40;
+ int totalBtnsW = 2 * kBtnW + kBtnGap;
+ int btnStartX = panel.x + (panel.w - totalBtnsW) / 2;
+ int btnY = panel.y + panel.h - 90;
+ Rect btn0{btnStartX, btnY, kBtnW, kBtnH};
+ Rect btn1{btnStartX + kBtnW + kBtnGap, btnY, kBtnW, kBtnH};
+ auto inRect = [&](const Rect& r) { return x >= r.x && x < r.x + r.w && y >= r.y && y < r.y + r.h; };
+ if (inRect(btn0)) {
+ settings_.syncTrophies = true;
+ trophyDisclaimerOpen_ = false;
+ dirty_ = true;
+ ev.action = Action::SyncTrophies;
+ ev.settings = settings_;
+ } else if (inRect(btn1) || !inRect(panel)) {
+ trophyDisclaimerOpen_ = false;
+ dirty_ = true;
+ }
+ return ev;
+ }
+ if (removeTrophiesConfirmOpen_) {
+ Rect panel{(kW - 1100) / 2, (kH - 480) / 2 - 30, 1100, 480};
+ constexpr int kBtnW = 260, kBtnH = 58, kBtnGap = 40;
+ int totalBtnsW = 2 * kBtnW + kBtnGap;
+ int btnStartX = panel.x + (panel.w - totalBtnsW) / 2;
+ int btnY = panel.y + panel.h - 90;
+ Rect btn0{btnStartX, btnY, kBtnW, kBtnH};
+ Rect btn1{btnStartX + kBtnW + kBtnGap, btnY, kBtnW, kBtnH};
+ auto inRect = [&](const Rect& r) { return x >= r.x && x < r.x + r.w && y >= r.y && y < r.y + r.h; };
+ if (inRect(btn0)) {
+ removeTrophiesConfirmOpen_ = false;
+ dirty_ = true;
+ ev.action = Action::RemoveTrophies;
+ } else if (inRect(btn1) || !inRect(panel)) {
+ removeTrophiesConfirmOpen_ = false;
+ dirty_ = true;
+ }
+ return ev;
+ }
if (tester_ != Tester::None || pickerOpen_) {
return ev;
}
@@ -711,7 +751,20 @@ UiEvent AppUi::onMouseDown(float x, float y, int button) {
ev.action = Action::RunNetworkTest;
return ev;
} else if (i == 24) {
- ev.action = Action::SyncTrophies;
+ if (!settings_.syncTrophies) {
+ trophyDisclaimerOpen_ = true;
+ trophyDisclaimerFocus_ = 0;
+ } else {
+ settings_.syncTrophies = false;
+ ev.action = Action::SettingsChanged;
+ ev.settings = settings_;
+ }
+ dirty_ = true;
+ return ev;
+ } else if (i == 25) {
+ removeTrophiesConfirmOpen_ = true;
+ removeTrophiesFocus_ = 1;
+ dirty_ = true;
return ev;
} else if (i == 19) {
openTester(Tester::Donation);
@@ -960,6 +1013,46 @@ UiEvent AppUi::handle(const NavInput& in) {
}
break;
case Screen::Settings:
+ if (trophyDisclaimerOpen_) {
+ if (in.left || in.right) {
+ trophyDisclaimerFocus_ ^= 1;
+ dirty_ = true;
+ } else if (in.back) {
+ trophyDisclaimerOpen_ = false;
+ dirty_ = true;
+ } else if (in.accept) {
+ if (trophyDisclaimerFocus_ == 0) {
+ settings_.syncTrophies = true;
+ trophyDisclaimerOpen_ = false;
+ dirty_ = true;
+ ev.action = Action::SyncTrophies;
+ ev.settings = settings_;
+ } else {
+ trophyDisclaimerOpen_ = false;
+ dirty_ = true;
+ }
+ }
+ break;
+ }
+ if (removeTrophiesConfirmOpen_) {
+ if (in.left || in.right) {
+ removeTrophiesFocus_ ^= 1;
+ dirty_ = true;
+ } else if (in.back) {
+ removeTrophiesConfirmOpen_ = false;
+ dirty_ = true;
+ } else if (in.accept) {
+ if (removeTrophiesFocus_ == 0) {
+ removeTrophiesConfirmOpen_ = false;
+ dirty_ = true;
+ ev.action = Action::RemoveTrophies;
+ } else {
+ removeTrophiesConfirmOpen_ = false;
+ dirty_ = true;
+ }
+ }
+ break;
+ }
if (pickerOpen_) {
handleColourPicker(in);
if (!pickerOpen_ && in.accept) {
@@ -1046,14 +1139,14 @@ UiEvent AppUi::handle(const NavInput& in) {
} else {
resetSettingsHoldStart_ = 0;
}
- if (in.right && settingsRow_ != 23) {
+ if (in.right && settingsRow_ != 23 && settingsRow_ != 25) {
changeSetting(+1);
if (settingsRow_ != 8) {
ev.action = Action::SettingsChanged;
ev.settings = settings_;
}
}
- if (in.left && settingsRow_ != 23) {
+ if (in.left && settingsRow_ != 23 && settingsRow_ != 25) {
changeSetting(-1);
if (settingsRow_ != 8) {
ev.action = Action::SettingsChanged;
@@ -1075,7 +1168,20 @@ UiEvent AppUi::handle(const NavInput& in) {
openTester(Tester::NetworkTest);
ev.action = Action::RunNetworkTest;
} else if (in.accept && settingsRow_ == 24) {
- ev.action = Action::SyncTrophies;
+ if (!settings_.syncTrophies) {
+ trophyDisclaimerOpen_ = true;
+ trophyDisclaimerFocus_ = 0;
+ dirty_ = true;
+ } else {
+ settings_.syncTrophies = false;
+ dirty_ = true;
+ ev.action = Action::SettingsChanged;
+ ev.settings = settings_;
+ }
+ } else if (in.accept && settingsRow_ == 25) {
+ removeTrophiesConfirmOpen_ = true;
+ removeTrophiesFocus_ = 1;
+ dirty_ = true;
} else if (in.accept && settingsRow_ == 19) {
openTester(Tester::Donation);
} else if (in.accept && settingsRow_ == 7) {
diff --git a/src/ui/app_ui_internal.h b/src/ui/app_ui_internal.h
index cc1c3af..5704f83 100644
--- a/src/ui/app_ui_internal.h
+++ b/src/ui/app_ui_internal.h
@@ -65,9 +65,9 @@ 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 = 24;
-constexpr int kSettingsOrder[kSettingsCount] = {0, 2, 8, 17, 18, 24, 1, 20, 13, 9, 10, 14, 12, 3, 15, 4, 21, 5, 6, 16, 22, 19, 7, 23};
-constexpr bool kSettingsGroupStart[kSettingsCount] = {false, false, false, false, false, false, true, false, false, false, false,
+constexpr int kSettingsCount = 25;
+constexpr int kSettingsOrder[kSettingsCount] = {0, 2, 8, 17, 18, 24, 25, 1, 20, 13, 9, 10, 14, 12, 3, 15, 4, 21, 5, 6, 16, 22, 19, 7, 23};
+constexpr bool kSettingsGroupStart[kSettingsCount] = {false, false, false, false, false, false, false, true, false, false, false, false,
true, false, 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
diff --git a/src/ui/app_ui_search.cpp b/src/ui/app_ui_search.cpp
index 0f22472..83a0fd2 100644
--- a/src/ui/app_ui_search.cpp
+++ b/src/ui/app_ui_search.cpp
@@ -439,12 +439,12 @@ void AppUi::pressFilter(Filter f) {
bool AppUi::wantsTextInput() const {
std::lock_guard<std::mutex> lock(mutex_);
- return screen_ == Screen::Home && searching_ && searchOnKeys_ && filterList_ < 0 && keyRow_ <= kKeyRows;
+ return screen_ == Screen::Home && searching_ && filterList_ < 0;
}
void AppUi::typeText(std::string_view utf8) {
std::lock_guard<std::mutex> lock(mutex_);
- if (!(screen_ == Screen::Home && searching_ && searchOnKeys_)) return;
+ if (!(screen_ == Screen::Home && searching_ && filterList_ < 0)) return;
bool edited = false;
for (char ch : utf8) {
if (ch == '\b') {
diff --git a/src/ui/app_ui_settings.cpp b/src/ui/app_ui_settings.cpp
index 538e7a5..4144f81 100644
--- a/src/ui/app_ui_settings.cpp
+++ b/src/ui/app_ui_settings.cpp
@@ -466,6 +466,10 @@ std::vector<std::string> AppUi::settingOptions(int row) const {
out = {tr(Str::Off), tr(Str::SharpLow), tr(Str::SharpMedium), tr(Str::SharpHigh)};
} else if (row == 23) {
out = {tr(Str::ResetSettings)};
+ } else if (row == 24) {
+ out = {tr(Str::Deactivated), tr(Str::Activated)};
+ } else if (row == 25) {
+ out = {tr(Str::RemoveTrophiesConfirm)};
} else if (row == 8) {
out.push_back(loginCountryOffText());
for (const char* country : kLoginCountries) out.push_back(loginCountryName(country));
@@ -485,7 +489,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 || row == 23) return 0;
+ if (row == 3 || row == 12 || row == 14 || row == 17 || row == 18 || row == 19 || row == 23 || row == 25) return 0;
if (row == 4) return settings_.triggerStrength;
if (row == 5) return settings_.circleConfirms ? 1 : 0;
if (row == 6) return settings_.lightBarMode;
@@ -497,6 +501,7 @@ int AppUi::settingSelected(int row) const {
if (row == 20) return std::clamp(settings_.videoDecoder, 0, 1);
if (row == 21) return std::clamp(settings_.audioHaptics, 0, 3);
if (row == 22) return settings_.previewFeatures ? 1 : 0;
+ if (row == 24) return settings_.syncTrophies ? 1 : 0;
if (row == 10) {
if (settings_.maxBitrateMbps <= 0) return 0;
int closest = 1;
@@ -532,8 +537,15 @@ 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 || row == 23) {
+ } else if (row == 3 || row == 12 || row == 14 || row == 17 || row == 18 || row == 23 || row == 25) {
(void)index; // the tester sets each stick's, the keys' and buttons' screens theirs
+ } else if (row == 24) {
+ if (index == 1 && !settings_.syncTrophies) {
+ trophyDisclaimerOpen_ = true;
+ trophyDisclaimerFocus_ = 0;
+ } else if (index == 0) {
+ settings_.syncTrophies = false;
+ }
} else if (row == 4) {
settings_.triggerStrength = index;
} else if (row == 5) {
@@ -880,7 +892,7 @@ void AppUi::drawSettings(Canvas& c) {
tr(Str::Gyro), tr(Str::QueueReadyNotification),
tr(Str::CheckSignIn), tr(Str::NetworkTest), tr(Str::SupportProject),
tr(Str::VideoDecoder), tr(Str::AudioHaptics), tr(Str::PreviewFeatures),
- tr(Str::ResetSettings), tr(Str::SyncTrophies)};
+ tr(Str::ResetSettings), tr(Str::SyncTrophies), tr(Str::RemoveTrophies)};
constexpr int kRowW = 1140, kRowH = 30, kGap = 2, kGroupGap = 4, kRowPx = 22;
Rect rows[kSettingRows]; // by row id
int y = 184;
@@ -914,7 +926,7 @@ void AppUi::drawSettings(Canvas& c) {
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 && i != 24) {
+ if (i != 7 && i != 17 && i != 18 && i != 19 && i != 25) {
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);
}
@@ -929,9 +941,9 @@ void AppUi::drawSettings(Canvas& c) {
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 || i == 24) {
- // Action items (Check sign-in, Network test, Support, Sync Trophies)
- std::string label = (i == 17) ? tr(Str::RunCheck) : (i == 18) ? tr(Str::RunTest) : (i == 24) ? tr(Str::RunSyncTrophies) : tr(Str::SupportKoFi);
+ } else if (i == 17 || i == 18 || i == 19 || i == 25) {
+ // Action items (Check sign-in, Network test, Support, Remove Trophies)
+ std::string label = (i == 17) ? tr(Str::RunCheck) : (i == 18) ? tr(Str::RunTest) : (i == 25) ? tr(Str::RemoveTrophiesConfirm) : 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);
@@ -978,6 +990,7 @@ void AppUi::drawSettings(Canvas& c) {
Str::SettingDescPreviewFeatures,
Str::SettingDescResetSettings,
Str::SettingDescSyncTrophies,
+ Str::SettingDescRemoveTrophies,
};
if (settingsRow_ >= 0 && settingsRow_ < kSettingRows) {
int dy = std::max(y + 6, 922);
@@ -1031,6 +1044,8 @@ void AppUi::drawSettings(Canvas& c) {
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 (trophyDisclaimerOpen_) return drawTrophyDisclaimerModal(c);
+ if (removeTrophiesConfirmOpen_) return drawRemoveTrophiesConfirmModal(c);
if (pickerOpen_) {
drawColourPicker(c);
return;
@@ -1549,6 +1564,90 @@ void AppUi::drawDonationModal(Canvas& c) {
drawHints(c, {{kIconCircle, tr(Str::Back)}});
}
+void AppUi::drawTrophyDisclaimerModal(Canvas& c) {
+ Rect panel = drawModal(c, 1100, 520, tr(Str::TrophiesDisclaimerTitle));
+
+ int textW = panel.w - 112;
+ int textX = panel.x + 56;
+ int textY = panel.y + 110;
+ auto lines = fonts_.regular.wrap(tr(Str::TrophiesDisclaimerBody), 24, textW, 8);
+ constexpr int kLineH = 34;
+ for (const auto& line : lines) {
+ fonts_.regular.draw(c, line, textX, textY, 24, rgba(230, 230, 230));
+ textY += kLineH;
+ }
+
+ constexpr int kBtnW = 260, kBtnH = 58, kBtnGap = 40;
+ int totalBtnsW = 2 * kBtnW + kBtnGap;
+ int btnStartX = panel.x + (panel.w - totalBtnsW) / 2;
+ int btnY = panel.y + panel.h - 90;
+
+ for (int b = 0; b < 2; ++b) {
+ Rect btnRect{btnStartX + b * (kBtnW + kBtnGap), btnY, kBtnW, kBtnH};
+ bool focused = (trophyDisclaimerFocus_ == b);
+
+ Color btnBg = (b == 0)
+ ? (focused ? rgba(34, 197, 94, 255) : rgba(22, 101, 52, 220))
+ : (focused ? rgba(239, 68, 68, 255) : rgba(153, 27, 27, 220));
+
+ c.fillRect(btnRect, btnBg, 14);
+ if (focused) {
+ c.strokeRect({btnRect.x - 3, btnRect.y - 3, btnRect.w + 6, btnRect.h + 6}, kWhite, 3, 16);
+ }
+
+ const char* label = (b == 0) ? tr(Str::TrophiesDisclaimerAware) : tr(Str::TrophiesDisclaimerCancel);
+ int tw = fonts_.bold.measure(label, 24);
+ int tx = btnRect.x + (btnRect.w - tw) / 2;
+ int ty = fonts_.bold.centeredY(btnRect.y, btnRect.h, 24);
+ fonts_.bold.draw(c, label, tx, ty, 24, kWhite);
+ }
+
+ c.fillRect({0, kH - 80, kW, 80}, kBg);
+ drawHints(c, {{kIconCross, tr(Str::Select)}, {kIconCircle, tr(Str::Back)}});
+}
+
+void AppUi::drawRemoveTrophiesConfirmModal(Canvas& c) {
+ Rect panel = drawModal(c, 1100, 480, tr(Str::RemoveTrophiesConfirmTitle));
+
+ int textW = panel.w - 112;
+ int textX = panel.x + 56;
+ int textY = panel.y + 110;
+ auto lines = fonts_.regular.wrap(tr(Str::RemoveTrophiesConfirmBody), 24, textW, 8);
+ constexpr int kLineH = 34;
+ for (const auto& line : lines) {
+ fonts_.regular.draw(c, line, textX, textY, 24, rgba(230, 230, 230));
+ textY += kLineH;
+ }
+
+ constexpr int kBtnW = 260, kBtnH = 58, kBtnGap = 40;
+ int totalBtnsW = 2 * kBtnW + kBtnGap;
+ int btnStartX = panel.x + (panel.w - totalBtnsW) / 2;
+ int btnY = panel.y + panel.h - 90;
+
+ for (int b = 0; b < 2; ++b) {
+ Rect btnRect{btnStartX + b * (kBtnW + kBtnGap), btnY, kBtnW, kBtnH};
+ bool focused = (removeTrophiesFocus_ == b);
+
+ Color btnBg = (b == 0)
+ ? (focused ? rgba(239, 68, 68, 255) : rgba(153, 27, 27, 220))
+ : (focused ? rgba(255, 255, 255, 45) : rgba(255, 255, 255, 20));
+
+ c.fillRect(btnRect, btnBg, 14);
+ if (focused) {
+ c.strokeRect({btnRect.x - 3, btnRect.y - 3, btnRect.w + 6, btnRect.h + 6}, kWhite, 3, 16);
+ }
+
+ const char* label = (b == 0) ? tr(Str::RemoveTrophiesConfirm) : tr(Str::TrophiesDisclaimerCancel);
+ int tw = fonts_.bold.measure(label, 24);
+ int tx = btnRect.x + (btnRect.w - tw) / 2;
+ int ty = fonts_.bold.centeredY(btnRect.y, btnRect.h, 24);
+ fonts_.bold.draw(c, label, tx, ty, 24, kWhite);
+ }
+
+ c.fillRect({0, kH - 80, kW, 80}, kBg);
+ drawHints(c, {{kIconCross, tr(Str::Select)}, {kIconCircle, tr(Str::Back)}});
+}
+
void AppUi::drawKeysTester(Canvas& c) {
Rect panel = drawModal(c, 1500, 860, tr(Str::KeyboardKeys));
// Each input: its name (the PlayStation button, the Xbox one beside),
diff --git a/src/ui/settings_choice.cpp b/src/ui/settings_choice.cpp
index ec5f323..3dc8133 100644
--- a/src/ui/settings_choice.cpp
+++ b/src/ui/settings_choice.cpp
@@ -34,6 +34,7 @@ SettingsChoice choiceFromSettings(const app::Settings& s) {
c.gameVolume = s.gameVolume;
c.queueReadyAlert = s.queueReadyAlert;
c.previewFeatures = s.previewFeatures;
+ c.syncTrophies = s.syncTrophies;
c.keyMap = s.keyMap;
c.padMap = s.padMap;
c.gyroMode = s.gyroMode;
@@ -71,6 +72,7 @@ void applyChoice(const SettingsChoice& c, app::Settings& s) {
s.gameVolume = c.gameVolume;
s.queueReadyAlert = c.queueReadyAlert;
s.previewFeatures = c.previewFeatures;
+ s.syncTrophies = c.syncTrophies;
s.keyMap = c.keyMap;
if (input::padMapValid(c.padMap)) s.padMap = c.padMap; // the screen only lets a complete one out
s.gyroMode = c.gyroMode;
diff --git a/tests/test_main.cpp b/tests/test_main.cpp
index 0401e32..11a043b 100644
--- a/tests/test_main.cpp
+++ b/tests/test_main.cpp
@@ -2302,8 +2302,8 @@ static void testVisibleSettingsRows() {
};
const ui::UiCaps ps5;
auto all = ui::visibleSettingsRows(ps5);
- CHECK((ids(all) == std::vector<int>{0, 2, 8, 17, 18, 24, 1, 20, 9, 10, 14, 12, 3, 15, 4, 21, 5, 6, 16, 22, 19, 7, 23}));
- CHECK((groups(all) == std::vector<bool>{false, false, false, false, false, false, true, false, false, false, true, false, false, false, false, false, false, false, false, false, true, false, true}));
+ CHECK((ids(all) == std::vector<int>{0, 2, 8, 17, 18, 24, 25, 1, 20, 9, 10, 14, 12, 3, 15, 4, 21, 5, 6, 16, 22, 19, 7, 23}));
+ CHECK((groups(all) == std::vector<bool>{false, false, false, false, false, false, false, true, false, false, false, true, false, 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;
@@ -2363,13 +2363,14 @@ static void testVisibleSettingsRows() {
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, 24) == 5);
- CHECK(ui::settingsRowPosition(ps5, 1) == 6 && ui::settingsRowPosition(ps5, 3) == 12);
- CHECK(ui::settingsRowPosition(ps5, 16) == 18);
- CHECK(ui::settingsRowPosition(ps5, 5) == 16 && ui::settingsRowPosition(ps5, 6) == 17);
- CHECK(ui::settingsRowPosition(ps5, 12) == 11 && ui::settingsRowPosition(ps5, 14) == 10);
- CHECK(ui::settingsRowPosition(ps5, 22) == 19);
- CHECK(ui::settingsRowPosition(ps5, 7) == 21 && ui::settingsRowPosition(ps5, 19) == 20 && ui::settingsRowPosition(ps5, 2) == 1);
- CHECK(ui::settingsRowPosition(ps5, 21) == 15);
+ CHECK(ui::settingsRowPosition(ps5, 25) == 6);
+ CHECK(ui::settingsRowPosition(ps5, 1) == 7 && ui::settingsRowPosition(ps5, 3) == 13);
+ CHECK(ui::settingsRowPosition(ps5, 16) == 19);
+ CHECK(ui::settingsRowPosition(ps5, 5) == 17 && ui::settingsRowPosition(ps5, 6) == 18);
+ CHECK(ui::settingsRowPosition(ps5, 12) == 12 && ui::settingsRowPosition(ps5, 14) == 11);
+ CHECK(ui::settingsRowPosition(ps5, 22) == 20);
+ CHECK(ui::settingsRowPosition(ps5, 7) == 22 && ui::settingsRowPosition(ps5, 19) == 21 && ui::settingsRowPosition(ps5, 2) == 1);
+ CHECK(ui::settingsRowPosition(ps5, 21) == 16);
CHECK(ui::settingsRowPosition(pc, 5) == 12 && ui::settingsRowPosition(pc, 6) == -1 && ui::settingsRowPosition(pc, 4) == -1);
}
@@ -7407,6 +7408,11 @@ static void testTrophySystem() {
}
return false;
}
+ bool removeAllTrophies(const std::vector<std::pair<std::string, std::string>>& titles, int& removedCount, std::string& err) override {
+ removedCount = static_cast<int>(unlocked.size() > 0 ? 1 : 0);
+ unlocked.clear();
+ return true;
+ }
std::string name() const override { return "TestBackend"; }
struct UnlockedItem {
@@ -7493,16 +7499,115 @@ static void testTrophySystem() {
newlyUnlocked, syncErr);
CHECK(syncOk);
CHECK(newlyUnlocked == 0); // No duplicate unlocks!
- CHECK(rawBackend->unlocked.size() == 3);
+ // Verify removeAllTrophies removes disk cache and clears backend
+ int removedCount = 0;
+ std::string rmErr;
+ CHECK(engine.removeAllTrophies(removedCount, rmErr));
+ CHECK(removedCount == 1);
+ CHECK(rawBackend->unlocked.empty());
+ std::string cacheCheck;
+ CHECK(!platform::readFile(cacheFile, cacheCheck));
// Clean up
net::setTestTransport({});
::unlink(cacheFile.c_str());
}
+static void testTrophyModalsAndDesktopInput() {
+ ui::Fonts fonts;
+ ui::ImageCache images([] {});
+ ui::AppUi app(fonts, images);
+
+ ui::UiCaps caps;
+ caps.console = true;
+ app.setCaps(caps);
+
+ app.showHome();
+ ui::NavInput openOpt;
+ openOpt.options = true;
+ app.handle(openOpt);
+ CHECK(app.screen() == ui::Screen::Settings);
+ CHECK(!app.settings().syncTrophies);
+
+ int y24 = 0, y25 = 0;
+ int curY = 184;
+ for (const auto& [r, groupStart] : ui::visibleSettingsRows(caps)) {
+ if (groupStart) curY += 4;
+ if (r == 24) y24 = curY + 10;
+ if (r == 25) y25 = curY + 10;
+ curY += 32;
+ }
+ CHECK(y24 > 0);
+ CHECK(y25 > 0);
+
+ // 1. Click row 24: opens disclaimer modal
+ app.onMouseDown(100.0f, static_cast<float>(y24), 1);
+ ui::Canvas c(1920, 1080);
+ app.render(c, 1000);
+
+ // Press right to move focus to "Cancelar" (focus 1)
+ ui::NavInput navRight;
+ navRight.right = true;
+ app.handle(navRight);
+
+ // Accept "Cancelar": modal closes, syncTrophies remains false
+ ui::NavInput accept;
+ accept.accept = true;
+ app.handle(accept);
+ CHECK(!app.settings().syncTrophies);
+
+ // Click row 24 again: opens modal, focus defaults to "Estou ciente" (focus 0)
+ app.onMouseDown(100.0f, static_cast<float>(y24), 1);
+ ui::UiEvent evAware = app.handle(accept);
+ CHECK(app.settings().syncTrophies);
+ CHECK(evAware.action == ui::Action::SyncTrophies);
+
+ // Click row 24 again: turns it off directly
+ ui::UiEvent evOff = app.onMouseDown(100.0f, static_cast<float>(y24), 1);
+ CHECK(!app.settings().syncTrophies);
+ CHECK(evOff.action == ui::Action::SettingsChanged);
+
+ // 2. Click row 25: opens remove trophies confirm modal
+ app.onMouseDown(100.0f, static_cast<float>(y25), 1);
+ app.render(c, 1000);
+
+ // Default focus is "Cancelar" (focus 1) for safety
+ ui::UiEvent evCancelRm = app.handle(accept);
+ CHECK(evCancelRm.action != ui::Action::RemoveTrophies);
+
+ // Click row 25 again, navigate left to "Remover" (focus 0)
+ app.onMouseDown(100.0f, static_cast<float>(y25), 1);
+ ui::NavInput navLeft;
+ navLeft.left = true;
+ app.handle(navLeft);
+ ui::UiEvent evRm = app.handle(accept);
+ CHECK(evRm.action == ui::Action::RemoveTrophies);
+
+ // 3. Desktop Search & text input
+ app.showHome();
+ ui::NavInput tri;
+ tri.triangle = true;
+ app.handle(tri); // opens search
+ CHECK(app.wantsTextInput());
+
+ app.typeText("Fortnite");
+ CHECK(app.searchQuery() == "Fortnite");
+
+ // Test backspace / delete
+ app.typeText("\b");
+ CHECK(app.searchQuery() == "Fortnit");
+
+ // Close search
+ ui::NavInput back;
+ back.back = true;
+ app.handle(back);
+ CHECK(!app.wantsTextInput());
+}
+
int main() {
testPs4VideoPipelineAndSse2Converter();
testTrophySystem();
+ testTrophyModalsAndDesktopInput();
testReleaseV155Features();
testSizedUrl();
testPhase1BugFixesAndPhase2Optimizations();