Xbox Cloud Gaming app for PS5 Homebrew
C
fix(library): restore owned titles list and enable full L3 refresh (v1.5.1)
Rafael Abud Ferreira9e5979980a7c
diff --git a/CMakeLists.txt b/CMakeLists.txtindex 0f2e9ca..0e19973 100644--- a/CMakeLists.txt+++ b/CMakeLists.txt@@ -1,7 +1,7 @@# SPDX-License-Identifier: GPL-3.0-or-later# Copyright (C) 2026 RafaelNGPcmake_minimum_required(VERSION 3.20)-project(xcloud_ps5 VERSION 1.5.0 LANGUAGES C CXX)+project(xcloud_ps5 VERSION 1.5.1 LANGUAGES C CXX)set(CMAKE_CXX_STANDARD 20)set(CMAKE_CXX_STANDARD_REQUIRED ON)diff --git a/ROADMAP.md b/ROADMAP.mdindex 7e6fc79..7f739cf 100644--- a/ROADMAP.md+++ b/ROADMAP.md@@ -4,7 +4,7 @@ Where PSBox Cloud Gaming goes next, most valuable first. Each item says why itmatters, what "done" looks like, and how it is measured on the console.Status: **next** (being worked on), **planned**, **later**, **dropped**.-Last update: 2026-10-23, v1.5.0.+Last update: 2026-10-23, v1.5.1.## Now@@ -367,6 +367,11 @@ A browser-based visual layout editor embedded directly into the WebUI under the## Done+- **v1.5.1**:+ - Restored full "My Games" / owned games list (`owned_`), resolving regression where only Call of Duty and Fortnite appeared.+ - Eliminated duplicate Call of Duty entries in user library while keeping Modern Warfare 4 and Warzone playable.+ - Fixed manual library refresh (<kbd>L3</kbd>) ensuring full online synchronization and clear notification feedback.+ - Implemented automatic local cache self-healing against corrupted `library_cache.json`.- **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).diff --git a/notes.md b/notes.mdindex 701fc64..d73ffa6 100644--- a/notes.md+++ b/notes.md@@ -1,4 +1,14 @@<!-- LANG:PT -->+## Novidades e Correções no v1.5.1++### 🎮 Restauração Completa da Lista "Meus jogos"+- **Recuperação de Todos os Jogos da Conta**: Corrigida a regressão crítica introduzida no v1.5.0 onde a lista "Meus jogos" exibia apenas Call of Duty e Fortnite. Todos os títulos comprados e gratuitos do usuário voltam a aparecer normalmente.+- **Fim das Duplicatas de Call of Duty**: Removida a inserção em loop das dezenas de pacotes/DLCs de Call of Duty na biblioteca do usuário, mantendo apenas as entradas jogáveis legítimas (Modern Warfare 4 e Warzone).+- **Auto-cura de Cache Local**: O aplicativo agora detecta automaticamente se o arquivo `library_cache.json` no console foi corrompido por versões anteriores e reconstrói o catálogo limpo de forma transparente.++### ⚡ Atualização da Biblioteca (L3)+- **Atualização Forçada Confiável**: Pressionar `L3` ("Atualizar") agora executa uma sincronização completa com os servidores da Microsoft, garantindo que novos títulos adquiridos apareçam imediatamente.+## Novidades e Melhorias no v1.5.0### ⚙️ Reorganização das Configurações@@ -35,6 +45,16 @@- **Alinhamento Perfeito**: Textos, seletores e chevrons perfeitamente alinhados à direita no menu de configurações.<!-- LANG:EN -->+## What's New and Fixed in Version 1.5.1++### 🎮 Full Restoration of "My Games" / Owned Titles+- **Account Games Recovered**: Fixed critical regression in v1.5.0 where "My Games" displayed only Call of Duty and Fortnite. All purchased and streamable games associated with the user's account are restored.+- **Removed Duplicate Call of Duty Entries**: Cleaned up the loop insertion that populated dozens of Call of Duty DLC/edition entries, retaining only clean playable titles (Modern Warfare 4 and Warzone).+- **Automatic Cache Self-Healing**: App detects if previous versions stored a contaminated `library_cache.json` and automatically triggers a fresh sync to heal local storage.++### ⚡ Manual Library Refresh (L3)+- **Reliable Full Refresh**: Pressing `L3` ("Refresh") now performs a full refresh from Microsoft endpoints, ensuring freshly acquired titles show up immediately.+## What's New in Version 1.5.0### ⚙️ Settings Menu Reorganizationdiff --git a/ps5/sce_sys/param.json b/ps5/sce_sys/param.jsonindex 6f9951f..de8c85c 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.500.000",+ "contentVersion": "01.501.000","downloadDataSize": 256,"gameIntent": {"permittedIntents": [diff --git a/src/app/library.cpp b/src/app/library.cppindex ac2cea3..8260f23 100644--- a/src/app/library.cpp+++ b/src/app/library.cpp@@ -270,7 +270,9 @@ static void seedKnownGames(std::map<std::string, std::string>& cloudTitleOf,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::string_view(g.productId) == "9NCPSQQD1Z66") {+ gamePass.insert(g.productId);+ }if (std::find(allGames.begin(), allGames.end(), g.productId) == allGames.end()) {allGames.push_back(g.productId);}@@ -541,7 +543,9 @@ bool Library::loadCache(bool withLayout) {}}auto j = json::parse(text);- if (!j || (*j)["version"].asInt() != kCacheVersion) return false;+ if (!j) return false;+ int ver = (*j)["version"].asInt();+ if (ver != 2 && ver != kCacheVersion) return false;if (market_.empty()) market_ = (*j)["market"].str();else if ((*j)["market"].str() != market_) return false;if (language_.empty()) language_ = (*j)["language"].str();@@ -566,11 +570,17 @@ 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());- if (withLayout) {- gamePass_.insert(p.str());- allGames_.push_back(p.str());+ bool corruptedGamePass = (*j)["gamePass"].items().size() > 1050;+ if (corruptedGamePass) {+ XC_LOGW("library: cache gamePass has %zu items (likely contaminated), ignoring cached gamePass",+ (*j)["gamePass"].items().size());+ } else {+ for (const auto& p : (*j)["gamePass"].items()) {+ knownGamePass_.insert(p.str());+ if (withLayout) {+ gamePass_.insert(p.str());+ allGames_.push_back(p.str());+ }}}if (withLayout) {@@ -629,7 +639,15 @@ bool Library::loadCache(bool withLayout) {}}}- ownershipKnown_ = !ownedTitles_.empty() || !ownedProducts_.empty() || !owned_.empty();+ bool corruptedOwned = (owned_.size() <= 37 && ownedTitles_.size() > 100);+ if (corruptedOwned) {+ XC_LOGW("library: cache owned has only %zu items despite %zu streamable titles, invalidating cached ownership",+ owned_.size(), ownedTitles_.size());+ owned_.clear();+ ownershipKnown_ = false;+ } else {+ ownershipKnown_ = !ownedTitles_.empty() || !ownedProducts_.empty() || !owned_.empty();+ }sortOwned();XC_LOGI("library: cache: %zu of the account's games, %zu to buy, %zu home rows, %zu consoles known",owned_.size(), purchasable_.size(), layoutRows, platform_.size());@@ -770,6 +788,9 @@ size_t Library::syncDelta(xcloud::GssvClient& gssv, const Changed& changed, std:xcloud::ProductList allSigl;std::string siglErr;if (xcloud::fetchList(xcloud::sigl::kAllGames, market_, language_, allSigl, siglErr)) {+ gamePass_.clear();+ gamePass_.insert(allSigl.productIds.begin(), allSigl.productIds.end());+ allGames_ = allSigl.productIds;for (const auto& pid : allSigl.productIds) {if (!pid.empty() && !products_.count(pid)) {newProducts.push_back(pid);@@ -784,13 +805,6 @@ size_t Library::syncDelta(xcloud::GssvClient& gssv, const Changed& changed, std: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) {@@ -818,6 +832,7 @@ size_t Library::syncDelta(xcloud::GssvClient& gssv, const Changed& changed, std:}}loadOwned(gssv, changed);+ loadCatalogNames(changed, nullptr);saveCache();changed();return newCount;@@ -1010,36 +1025,21 @@ void Library::loadOwned(xcloud::GssvClient gssv, const Changed& changed, const sif (stop && *stop) return;std::set<std::string> ownedTitles, ownedProducts;std::vector<Item> mine;+ std::set<std::string> seenMine;std::map<std::string, std::string> toBuy; // productId -> titleIdbool member = false;- auto registerTitle = [&](const std::string& pid, const xcloud::Title& t, bool entitled, bool sub) {+ auto registerCloudTitle = [&](const std::string& pid, const std::string& tid, const std::string& xboxId, bool freeStore, bool mkb) {if (pid.empty()) return;- if (!t.titleId.empty() && t.titleId != "None") {- cloudTitleOf_[pid] = t.titleId;+ if (!tid.empty() && tid != "None") {+ cloudTitleOf_[pid] = tid;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);+ it->second.xcloudTitleId = tid;}}+ if (!xboxId.empty() && !xboxTitleOf_.count(pid)) xboxTitleOf_[pid] = xboxId;+ if (freeStore) freeInStore_.insert(pid);+ if (mkb) mouseKeyboard_.insert(pid);};for (const auto& t : titles) {@@ -1047,33 +1047,49 @@ void Library::loadOwned(xcloud::GssvClient gssv, const Changed& changed, const sif (xcloud::isNonGameAddon(t.titleId)) continue;if (t.hasEntitlement) ownedTitles.insert(t.titleId);- registerTitle(t.productId, t, t.hasEntitlement, t.viaSubscription);+ registerCloudTitle(t.productId, t.titleId, t.xboxTitleId, t.isFreeInStore, t.mouseKeyboard);for (const auto& alt : t.alternateProductIds) {- registerTitle(alt, t, t.hasEntitlement, t.viaSubscription);+ registerCloudTitle(alt, t.titleId, t.xboxTitleId, t.isFreeInStore, t.mouseKeyboard);}- 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 (t.hasEntitlement) {+ if (!t.productId.empty()) ownedProducts.insert(t.productId);+ for (const auto& alt : t.alternateProductIds) {+ if (!alt.empty()) ownedProducts.insert(alt);+ }+ // Game Pass games the account owns itself (free-to-play ones+ // like Fortnite, without the subscription) are its games too.+ // Also games outside the Game Pass catalog.+ if (!t.productId.empty()) {+ if (!gamePass_.count(t.productId) || !t.viaSubscription) {+ if (seenMine.insert(t.productId).second) {+ mine.emplace_back(t.productId, t.titleId);+ }}}+ } else if (!t.productId.empty() && !gamePass_.count(t.productId)) {+ toBuy[t.productId] = t.titleId;}}- if (member) {++ bool hasCod = member || ownedTitles.count("CALLOFDUTYHQ") || ownedTitles.count("CALLOFDUTYBLACKOPS6") ||+ ownedTitles.count("CALLOFDUTYMODERNWARFAREIII");+ if (hasCod) {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);+ }+ for (const auto& g : kKnownCloudGames) {+ registerCloudTitle(g.productId, g.cloudTitleId, g.xboxTitleId ? g.xboxTitleId : "", g.isFree, false);+ if (ownedTitles.count(g.cloudTitleId)) {+ ownedProducts.insert(g.productId);+ if (g.isFree || std::string_view(g.productId) == "9NCPSQQD1Z66") {+ if (seenMine.insert(g.productId).second) {+ mine.emplace_back(g.productId, g.cloudTitleId);+ }}+ } else if (!gamePass_.count(g.productId)) {+ toBuy[g.productId] = g.cloudTitleId;}}// Games to buy: the most popular in the cloud first, then the rest.diff --git a/src/app/worker.cpp b/src/app/worker.cppindex 02a8b7b..b12e9ce 100644--- a/src/app/worker.cpp+++ b/src/app/worker.cpp@@ -892,7 +892,7 @@ void loadLibrary(auth::AuthManager& am, xcloud::GssvClient& gssv, bool forceRefrexistingLib = s_library;}- if (existingLib && existingLib->ownedKnown()) {+ if (!forceRefresh && existingLib && existingLib->ownedKnown() && !existingLib->owned().empty()) {XC_LOGI("library: delta-sync against active library (forceRefresh=%d)", forceRefresh);g_ui->setLoading(true, 0, 0);auto publish = [](const app::Library& lib) {@@ -907,16 +907,10 @@ void loadLibrary(auth::AuthManager& am, xcloud::GssvClient& gssv, bool forceRefrg_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);- }+ 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);}return;}@@ -981,6 +975,11 @@ void loadLibrary(auth::AuthManager& am, xcloud::GssvClient& gssv, bool forceRefr}return;}+ if (forceRefresh) {+ std::string msg = ui::tr(ui::Str::LibraryUpToDate);+ if (!shell::caps().console) g_ui->showToast(msg);+ platform::notify(msg);+ }std::vector<ui::GameRow> rows = library->rows();{std::set<std::string> wishSet;diff --git a/tests/test_main.cpp b/tests/test_main.cppindex 594d625..8d4c511 100644--- a/tests/test_main.cpp+++ b/tests/test_main.cpp@@ -5078,6 +5078,77 @@ static void testCallOfDutyModernWarfare4CatalogAndRefresh() {CHECK(foundMw4);}+ // 7. Test loadOwned populates all owned and streamable titles, not just COD and Fortnite+ {+ 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":"FORTNITE","details":{"productId":"BT5P2X999VH2","hasEntitlement":true,"isFreeInStore":true,"userPrograms":["F2P"]}},+ {"titleId":"CYBERPUNK2077","details":{"productId":"BX3M8L83BBRW","hasEntitlement":true,"isFreeInStore":false,"userPrograms":[]}},+ {"titleId":"HALOINFINITE","details":{"productId":"9PP5G1F0C2B6","hasEntitlement":true,"isFreeInStore":true,"userPrograms":["F2P"]}},+ {"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":{+ "BT5P2X999VH2":{"XCloudTitleId":"FORTNITE","ProductTitle":"Fortnite"},+ "BX3M8L83BBRW":{"XCloudTitleId":"CYBERPUNK2077","ProductTitle":"Cyberpunk 2077"},+ "9PP5G1F0C2B6":{"XCloudTitleId":"HALOINFINITE","ProductTitle":"Halo Infinite"},+ "9N201KQXS5BM":{"XCloudTitleId":"CALLOFDUTYHQ","ProductTitle":"Call of Duty®"},+ "9NCPSQQD1Z66":{"XCloudTitleId":"CALLOFDUTYHQ","ProductTitle":"Call of Duty®: Modern Warfare® 4"}+ }})";+ } else {+ r.status = 503;+ }+ return r;+ });++ app::Library libOwnedAll;+ std::string allCache = testDir + "/all_cache.json";+ libOwnedAll.setCachePath(allCache);+ std::atomic<bool> stop{false};+ libOwnedAll.loadOwned(gssv, [] {}, &stop);++ // Verify all 4 titles are in owned (Fortnite, Cyberpunk, Halo Infinite, Call of Duty)+ std::set<std::string> ownedPids;+ for (const auto& t : libOwnedAll.owned()) {+ ownedPids.insert(t.productId);+ }+ CHECK(ownedPids.count("BT5P2X999VH2")); // Fortnite+ CHECK(ownedPids.count("BX3M8L83BBRW")); // Cyberpunk 2077+ CHECK(ownedPids.count("9PP5G1F0C2B6")); // Halo Infinite+ CHECK(ownedPids.count("9NCPSQQD1Z66") || ownedPids.count("9N201KQXS5BM")); // COD+ CHECK(libOwnedAll.owned().size() >= 4);+ }++ // 8. Test loadCache auto-healing of contaminated gamePass and truncated owned+ {+ std::string badCache = testDir + "/bad_cache.json";+ std::string gpItems = "";+ for (int i = 0; i < 1100; ++i) {+ if (i > 0) gpItems += ",";+ gpItems += "\"P_FAKE_" + std::to_string(i) + "\"";+ }+ std::string otItems = "";+ for (int i = 0; i < 150; ++i) {+ if (i > 0) otItems += ",";+ otItems += "\"T_FAKE_" + std::to_string(i) + "\"";+ }+ std::string badJson = "{\"version\":2,\"market\":\"US\",\"language\":\"en-US\",\"products\":{},"+ "\"owned\":[{\"p\":\"COD\",\"t\":\"CALLOFDUTYHQ\"},{\"p\":\"FORTNITE\",\"t\":\"FORTNITE\"}],"+ "\"purchasable\":[],\"ownedTitles\":[" + otItems + "],\"ownedProducts\":[],\"gamePass\":[" + gpItems + "]}";+ platform::writeFileAtomic(badCache, badJson);++ app::Library healLib;+ healLib.setCachePath(badCache);+ CHECK(healLib.loadCache(false));+ // Verify ownership was invalidated due to truncated owned list vs 150 titles+ CHECK(!healLib.ownedKnown());+ // Verify contaminated gamePass was discarded+ CHECK(healLib.gamePassSearchPool().empty());+ }+net::setTestTransport({});std::system(("rm -rf " + testDir).c_str());}