Xbox Cloud Gaming app for PS5 Homebrew
C
fix(catalog): enforce strict SIGL shelf filters, universal cross-gen deduplication (Series X|S > One), filter PC games, and populate COD artwork
Rafael Abud Ferreira4ac32379de8f
diff --git a/src/app/library.cpp b/src/app/library.cppindex f71fc3e..2a94ba9 100644--- a/src/app/library.cpp+++ b/src/app/library.cpp@@ -56,6 +56,7 @@ json::Value productToJson(const xcloud::Product& p) {for (const auto& d : p.ratingDescriptors) rdesc.push(d);v.set("rdesc", rdesc);}+ if (p.isPcOnly) v.set("isPc", true);return v;}@@ -72,6 +73,7 @@ xcloud::Product productFromJson(const std::string& id, const json::Value& v) {p.posterUrl = v["poster"].str();p.heroUrl = v["hero"].str();for (const auto& c : v["categories"].items()) p.categories.push_back(xcloud::categoryName(c.str()));+ p.isPcOnly = v["isPc"].asBool(false);p.detailed = v["d"].asBool(false);// Details from before their date was kept count from now (not all due at once).p.detailedAt = v["at"].asInt(static_cast<int64_t>(std::time(nullptr)));@@ -95,6 +97,14 @@ json::Value itemsToJson(const std::vector<std::pair<std::string, std::string>>&return a;}+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;+}+bool namesSeries(const std::string& title) {return title.find("Series X|S") != std::string::npos || title.find("Series X/S") != std::string::npos;}@@ -114,21 +124,63 @@ int pairVersion(const xcloud::Product& p) {if (c.find("XBOXSERIES") != std::string::npos || c.find("SERIESXS") != std::string::npos || endsWith(c, "XS"))return 1;if (namesSeries(p.title) || endsWith(p.title, "X|S") || endsWith(p.title, "X/S")) return 1;+ if (p.title.find("Xbox One") != std::string::npos || p.title.find("Xbox 360") != std::string::npos) return -1;return 0;}-// Editions of one game ("Forza Horizon 5", "... Standard Edition") are-// separate products that start the same cloud title: keep one, the shortest-// name, where the first one was.+static int tileQualityScore(const ui::GameTile& t) {+ int score = 0;+ // Platform priority: Xbox Series X|S gets absolute highest priority over Xbox One and 360+ if (t.platform == xcloud::kPlatformSeries || t.platform == "Series" || t.platform == "XS") {+ score += 10000;+ } else if (namesSeries(t.name) || endsWith(t.name, "X|S") || endsWith(t.name, "X/S")) {+ score += 10000;+ } else if (t.titleId.find("XBOXSERIES") != std::string::npos ||+ t.titleId.find("SERIESXS") != std::string::npos ||+ endsWith(t.titleId, "XS")) {+ score += 10000;+ } else if (t.platform == xcloud::kPlatformOne || t.platform == "XboxOne" || t.platform == "ONE") {+ score += 5000;+ } else if (t.titleId.find("XBOXONE") != std::string::npos || t.name.find("Xbox One") != std::string::npos) {+ score += 5000;+ } else if (t.platform == xcloud::kPlatform360 || t.platform == "Xbox360" || t.platform == "360") {+ score += 1000;+ } else if (t.titleId.find("XBOX360") != std::string::npos || t.name.find("Xbox 360") != std::string::npos) {+ score += 1000;+ } else {+ score += 3000; // Unknown console+ }++ if (t.playable) score += 50;+ if (t.detailed) score += 10;+ if (!t.tileUrl.empty()) score += 10;+ if (!t.heroUrl.empty()) score += 5;+ if (!t.description.empty()) score += 5;++ // Prefer shorter / cleaner title names when scores are otherwise tied+ score -= static_cast<int>(std::min<size_t>(t.name.size(), 40));+ return score;+}++} // namespace++// Universal deduplication: normalized base titles (stripping Xbox Series X|S,+// Xbox One, PC, editions, etc.) and matching cloud title IDs.+// Absolute priority to Xbox Series X|S over Xbox One; preserves playable & store capabilities.void dedupeByTitle(std::vector<ui::GameTile>& tiles) {- std::map<std::string, size_t> first;+ std::map<std::string, size_t> keyMap;+ std::map<std::string, size_t> tidMap;+ std::map<std::string, size_t> xboxIdMap;std::vector<ui::GameTile> out;+for (auto& t : tiles) {- 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.+ if (t.productId.empty() || t.name.empty()) continue;++ std::string norm = xcloud::normalizeBaseTitle(t.name);+ std::string tid = t.titleId;++ // Call of Duty HQ special sub-experience keying+ if (tid == "CALLOFDUTYHQ") {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))));@@ -136,49 +188,102 @@ void dedupeByTitle(std::vector<ui::GameTile>& tiles) {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";+ norm = "codhq:mw4";} else if (lower.find("warzone") != std::string::npos) {- key = "CALLOFDUTYHQ:WARZONE";+ norm = "codhq:warzone";} else if (lower.find("black ops 7") != std::string::npos) {- key = "CALLOFDUTYHQ:BO7";+ norm = "codhq:bo7";} else if (lower.find("black ops 6") != std::string::npos) {- key = "CALLOFDUTYHQ:BO6";+ norm = "codhq:bo6";} else if (lower == "call of duty" || lower == "call of duty®") {- key = "CALLOFDUTYHQ:HUB";+ norm = "codhq:hub";} else {- key = "CALLOFDUTYHQ:" + t.productId;+ norm = "codhq:" + t.productId;}}- auto it = first.find(key);- if (it == first.end()) {- first[key] = out.size();++ size_t matchIdx = static_cast<size_t>(-1);++ if (!norm.empty()) {+ auto it = keyMap.find(norm);+ if (it != keyMap.end()) matchIdx = it->second;+ }++ if (matchIdx == static_cast<size_t>(-1) && tid != "CALLOFDUTYHQ" && !tid.empty() && tid != "None" && !isStoreBigId(tid)) {+ auto it = tidMap.find(tid);+ if (it != tidMap.end()) matchIdx = it->second;+ }++ if (matchIdx == static_cast<size_t>(-1) && tid != "CALLOFDUTYHQ" && !t.xboxTitleId.empty() && !isStoreBigId(t.xboxTitleId)) {+ auto it = xboxIdMap.find(t.xboxTitleId);+ if (it != xboxIdMap.end()) matchIdx = it->second;+ }++ if (matchIdx == static_cast<size_t>(-1)) {+ size_t idx = out.size();+ if (!norm.empty()) keyMap[norm] = idx;+ if (tid != "CALLOFDUTYHQ" && !tid.empty() && tid != "None" && !isStoreBigId(tid)) {+ tidMap[tid] = idx;+ }+ if (tid != "CALLOFDUTYHQ" && !t.xboxTitleId.empty() && !isStoreBigId(t.xboxTitleId)) {+ xboxIdMap[t.xboxTitleId] = idx;+ }out.push_back(std::move(t));} else {- auto& exist = out[it->second];+ auto& exist = out[matchIdx];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;+ bool anyMkb = exist.mouseKeyboard || t.mouseKeyboard;++ int scoreNew = tileQualityScore(t);+ int scoreExist = tileQualityScore(exist);++ if (scoreNew > scoreExist) {+ // New tile is higher priority (e.g. Series X|S over Xbox One)+ if (t.tileUrl.empty()) t.tileUrl = exist.tileUrl;+ if (t.heroUrl.empty()) t.heroUrl = exist.heroUrl;+ if (t.description.empty()) t.description = exist.description;+ if (t.publisher.empty()) t.publisher = exist.publisher;+ if (t.categories.empty()) t.categories = exist.categories;+ if (t.ratingAge.empty()) t.ratingAge = exist.ratingAge;+ if (t.ratingSystem.empty()) t.ratingSystem = exist.ratingSystem;+ if (t.ratingDescriptors.empty()) t.ratingDescriptors = exist.ratingDescriptors;+ if (t.platform.empty()) t.platform = exist.platform;exist = std::move(t);+ } else {+ // Existing tile is higher or equal priority; absorb any metadata from new tile+ if (exist.tileUrl.empty()) exist.tileUrl = t.tileUrl;+ if (exist.heroUrl.empty()) exist.heroUrl = t.heroUrl;+ if (exist.description.empty()) exist.description = t.description;+ if (exist.publisher.empty()) exist.publisher = t.publisher;+ if (exist.categories.empty()) exist.categories = t.categories;+ if (exist.ratingAge.empty()) exist.ratingAge = t.ratingAge;+ if (exist.ratingSystem.empty()) exist.ratingSystem = t.ratingSystem;+ if (exist.ratingDescriptors.empty()) exist.ratingDescriptors = t.ratingDescriptors;+ if (exist.platform.empty()) exist.platform = t.platform;}exist.playable = anyPlayable;exist.purchasable = anyPurchasable;exist.freeInStore = anyFree;+ exist.mouseKeyboard = anyMkb;+ if (!exist.detailed && !exist.description.empty() && !exist.tileUrl.empty() && !exist.heroUrl.empty()) {+ exist.detailed = true;+ }++ if (!norm.empty()) keyMap[norm] = matchIdx;+ if (exist.titleId != "CALLOFDUTYHQ" && !exist.titleId.empty() && exist.titleId != "None" && !isStoreBigId(exist.titleId)) {+ tidMap[exist.titleId] = matchIdx;+ }+ if (exist.titleId != "CALLOFDUTYHQ" && !exist.xboxTitleId.empty() && !isStoreBigId(exist.xboxTitleId)) {+ xboxIdMap[exist.xboxTitleId] = matchIdx;+ }}}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;-}+namespace {struct KnownCloudGame {const char* productId;@@ -228,36 +333,79 @@ static const KnownCloudGame kKnownCloudGames[] = {"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",+ "https://store-images.s-microsoft.com/image/apps.21616.14207097610490811.5b338e31-5c12-4d95-9a2a-2f16ceb01377.5c60a78b-cc32-4777-9141-90ebd76e88ad",+ "https://store-images.s-microsoft.com/image/apps.28966.14207097610490811.5b338e31-5c12-4d95-9a2a-2f16ceb01377.acc0294d-61eb-49e2-a059-758d5b1227d4",+ "https://store-images.s-microsoft.com/image/apps.5449.14207097610490811.5b338e31-5c12-4d95-9a2a-2f16ceb01377.54d31648-9587-49a6-b312-7df6ce023530",+ "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},+ "https://store-images.s-microsoft.com/image/apps.44737.13702346117700120.96dcc05d-7589-4e95-abbc-4fbc3399d7ff.76cfb4be-3069-4cd2-a883-70654bf6898e",+ "https://store-images.s-microsoft.com/image/apps.35931.13702346117700120.96dcc05d-7589-4e95-abbc-4fbc3399d7ff.bf621533-dad7-4478-8719-e8ff3da2223e",+ "https://store-images.s-microsoft.com/image/apps.44508.13702346117700120.96dcc05d-7589-4e95-abbc-4fbc3399d7ff.aca3a7f0-6dab-4d13-be0a-c87a416eac22",+ "Shooter",+ "In the direct sequel to the record-breaking Call of Duty®: Modern Warfare® II, Captain Price and Task Force 141 face off against the ultimate threat.",+ "18", "ClassInd", "Violência Extrema, Drogas Lícitas, Linguagem Imprópria", 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},+ "https://store-images.s-microsoft.com/image/apps.62866.14349375889218622.77ec9575-f44b-4013-97c6-f9cd0bbc53f5.b1790761-1d9e-4ffd-b146-3f68bdeb949e",+ "https://store-images.s-microsoft.com/image/apps.34778.14349375889218622.77ec9575-f44b-4013-97c6-f9cd0bbc53f5.fd60100a-bbb6-4eb3-a03c-6da8e90db089",+ "https://store-images.s-microsoft.com/image/apps.46802.14349375889218622.77ec9575-f44b-4013-97c6-f9cd0bbc53f5.041995ec-87c2-4c88-b7a6-98dbdbb5c975",+ "Shooter",+ "Call of Duty®: Modern Warfare® II drops players into an unprecedented global conflict that features the return of the iconic Operators of Task Force 141.",+ "18", "ClassInd", "Violência Extrema, Drogas Lícitas, Linguagem Imprópria", 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},+ "https://store-images.s-microsoft.com/image/apps.52064.14393996338935986.84c4ee65-c726-49ae-925f-3dca581be2df.3e540e94-9e5a-41f5-9b00-c8f5190819f7",+ "https://store-images.s-microsoft.com/image/apps.50528.14393996338935986.84c4ee65-c726-49ae-925f-3dca581be2df.31d66188-6781-49ce-a75a-b4247e73b89d",+ "https://store-images.s-microsoft.com/image/apps.1926.14393996338935986.84c4ee65-c726-49ae-925f-3dca581be2df.46cd9cf0-2829-4517-a140-3d163199497f",+ "Shooter",+ "Experience a visceral Campaign or assemble your team in the ultimate online playground with multiple Special Ops challenges and a mix of Multiplayer maps and modes.",+ "18", "ClassInd", "Violência Extrema, Drogas Lícitas, Linguagem Imprópria", 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},+ "https://store-images.s-microsoft.com/image/apps.52064.67185831113154542.823e899c-d262-40a0-91f6-eee04bdc3713.74be39c5-2d6e-4e6b-960b-7d8077da0142",+ "https://store-images.s-microsoft.com/image/apps.50528.67185831113154542.823e899c-d262-40a0-91f6-eee04bdc3713.dd7010c6-9641-4c5a-b8b5-7eb16ddc67ea",+ "https://store-images.s-microsoft.com/image/apps.1926.67185831113154542.823e899c-d262-40a0-91f6-eee04bdc3713.ca4b2ff5-8dc9-4774-a5f1-4e379a72cbda",+ "Shooter",+ "Experience a visceral Campaign or assemble your team in the ultimate online playground with multiple Special Ops challenges and a mix of Multiplayer maps and modes.",+ "18", "ClassInd", "Violência Extrema, Drogas Lícitas, Linguagem Imprópria", false},+ {"9P7PFH4RMFZD", "CALLOFDUTYBLACKOPSCOLDWAR", "1790482525", "Call of Duty®: Black Ops Cold War", "Activision Publishing Inc.",+ "https://store-images.s-microsoft.com/image/apps.16401.14107985044965209.e8fed65f-093d-40d1-849f-6c564d2ad876.13b9c6b6-dddd-4f67-a303-b98250929229",+ "https://store-images.s-microsoft.com/image/apps.25992.14107985044965209.e8fed65f-093d-40d1-849f-6c564d2ad876.89955624-8043-4f20-8620-4381e11a3546",+ "https://store-images.s-microsoft.com/image/apps.52829.14107985044965209.e8fed65f-093d-40d1-849f-6c564d2ad876.8fe14720-2b8f-4b9c-aebf-07f1610816d5",+ "Shooter",+ "The iconic Black Ops series is back with Call of Duty®: Black Ops Cold War - the direct sequel to the original and fan-favorite Call of Duty®: Black Ops.\n\nWelcome to the brink. Welcome to Call of Duty®: Black Ops Cold War.",+ "18", "ClassInd", "Violência Extrema, Drogas Lícitas, Linguagem Imprópria", false},+ {"9NPLRJ9CC870", "CALLOFDUTYBLACKOPSCOLDWARXBOXSERIESXS", "1790482525", "Call of Duty®: Black Ops Cold War - Xbox Series X|S", "Activision Publishing Inc.",+ "https://store-images.s-microsoft.com/image/apps.16401.13791444986287693.243003e9-8583-4df9-a0fc-2345d2f82ed4.e5e2cd4a-420a-41eb-bade-0eab002eab9c",+ "https://store-images.s-microsoft.com/image/apps.25992.13791444986287693.243003e9-8583-4df9-a0fc-2345d2f82ed4.b477eb21-1438-49b1-bf72-a36ed8d74bb8",+ "https://store-images.s-microsoft.com/image/apps.52829.13791444986287693.243003e9-8583-4df9-a0fc-2345d2f82ed4.92c561dc-948f-445a-ad29-5e287d884e0c",+ "Shooter",+ "The iconic Black Ops series is back with Call of Duty®: Black Ops Cold War - the direct sequel to the original and fan-favorite Call of Duty®: Black Ops.\n\nWelcome to the brink. Welcome to Call of Duty®: Black Ops Cold War.",+ "18", "ClassInd", "Violência Extrema, Drogas Lícitas, Linguagem Imprópria", false},+ {"9PHP6HF58MB5", "CALLOFDUTYVANGUARD", "1929807318", "Call of Duty®: Vanguard", "Activision Publishing Inc.",+ "https://store-images.s-microsoft.com/image/apps.25644.14231872788446538.01bda410-79a7-42cd-a67b-497b17d840f1.b577a06e-1952-4f78-9ca8-6e43b94f985b",+ "https://store-images.s-microsoft.com/image/apps.31712.14231872788446538.ec1df70e-1780-4ec2-90fc-de130713250f.37f86b3f-4921-4955-902e-3325f37a3e17",+ "https://store-images.s-microsoft.com/image/apps.27881.14231872788446538.ec1df70e-1780-4ec2-90fc-de130713250f.b54d334f-52d0-45e1-ac31-c86b1d4b6ad6",+ "Shooter",+ "Call of Duty®: Vanguard includes a deeply engaging single player Campaign, a massive Multiplayer offering featuring over 20 maps including 16 built for core Multiplayer and an exciting new Zombies experience developed by Treyarch.",+ "18", "ClassInd", "Violência Extrema, Drogas Lícitas, Linguagem Imprópria", false},+ {"9MWHTW1SF7RW", "CALLOFDUTYVANGUARDXBOXSERIESXS", "1929807318", "Call of Duty®: Vanguard - Xbox Series X|S", "Activision Publishing Inc.",+ "https://store-images.s-microsoft.com/image/apps.25644.13843233178803270.b12b929c-1b87-4fa1-900a-23a132dc9775.bdbacf51-1647-4c87-b9dc-6c455834d9bb",+ "https://store-images.s-microsoft.com/image/apps.31712.13843233178803270.d4ae9cce-02bd-4f56-8f61-6e02568a7dfd.401708cf-3756-4e90-b73d-bd1a6d4e1c09",+ "https://store-images.s-microsoft.com/image/apps.27881.13843233178803270.d4ae9cce-02bd-4f56-8f61-6e02568a7dfd.7b70ba8c-ba77-4fc3-af0d-cc1f87530bb0",+ "Shooter",+ "Call of Duty®: Vanguard includes a deeply engaging single player Campaign, a massive Multiplayer offering featuring over 20 maps including 16 built for core Multiplayer and an exciting new Zombies experience developed by Treyarch.",+ "18", "ClassInd", "Violência Extrema, Drogas Lícitas, Linguagem Imprópria", false},};static void seedKnownGames(std::map<std::string, std::string>& cloudTitleOf,@@ -270,11 +418,14 @@ 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);- if (std::string_view(g.productId) == "9NCPSQQD1Z66") {+ bool isCodHub = (std::string_view(g.productId) == "9NCPSQQD1Z66" ||+ std::string_view(g.productId) == "9N201KQXS5BM" ||+ std::string_view(g.productId) == "9NNFG8BQRCXL");+ if (isCodHub) {gamePass.insert(g.productId);- }- if (std::find(allGames.begin(), allGames.end(), g.productId) == allGames.end()) {- allGames.push_back(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;@@ -293,18 +444,23 @@ static void seedKnownGames(std::map<std::string, std::string>& cloudTitleOf,p.ratingDescriptors.push_back(g.ratingDescriptors);}if (g.category && g.category[0]) p.categories.push_back(g.category);- p.detailed = true;+ p.detailed = (g.description != nullptr && g.tileUrl != nullptr && g.heroUrl != nullptr);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.title.empty() && g.fallbackTitle) p.title = g.fallbackTitle;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.publisher.empty() && g.publisher) p.publisher = g.publisher;if (p.ratingAge.empty() && g.ratingAge) p.ratingAge = g.ratingAge;if (p.ratingSystem.empty() && g.ratingSystem) p.ratingSystem = g.ratingSystem;+ if (p.categories.empty() && g.category) p.categories.push_back(g.category);+ if (!p.detailed && !p.description.empty() && !p.tileUrl.empty() && !p.heroUrl.empty())+ p.detailed = true;}}}@@ -317,34 +473,49 @@ ui::GameTile Library::tile(const std::string& productId, const std::string& titlt.titleId = titleId;static const xcloud::Product s_dummy{};auto it = products_.find(productId);- if (it == products_.end() && !titleId.empty()) {- for (auto pit = products_.begin(); pit != products_.end(); ++pit) {- if (pit->second.xcloudTitleId == titleId) {- it = pit;- if (t.productId.empty()) t.productId = pit->first;- break;+ if (it == products_.end()) {+ if (!titleId.empty()) {+ for (auto pit = products_.begin(); pit != products_.end(); ++pit) {+ if (pit->second.xcloudTitleId == titleId) {+ it = pit;+ if (t.productId.empty()) t.productId = pit->first;+ break;+ }}- }- if (it == products_.end()) {- for (const auto& [cpid, ctid] : cloudTitleOf_) {- if (ctid == titleId) {- it = products_.find(cpid);- if (it != products_.end()) {- if (t.productId.empty()) t.productId = cpid;- break;+ if (it == products_.end()) {+ for (const auto& [cpid, ctid] : cloudTitleOf_) {+ if (ctid == titleId) {+ it = products_.find(cpid);+ if (it != products_.end()) {+ if (t.productId.empty()) t.productId = cpid;+ break;+ }}}}}if (it == products_.end()) {for (const auto& g : kKnownCloudGames) {- if (g.cloudTitleId && titleId == g.cloudTitleId) {+ bool match = (!productId.empty() && productId == g.productId) ||+ (!titleId.empty() && (titleId == g.cloudTitleId ||+ (titleId == "CALLOFDUTYCOLDWAR" && std::string_view(g.cloudTitleId) == "CALLOFDUTYBLACKOPSCOLDWAR")));+ if (match) {if (t.productId.empty()) t.productId = g.productId;+ if (t.titleId.empty() || t.titleId == "None" || isStoreBigId(t.titleId)) {+ if (g.cloudTitleId) t.titleId = g.cloudTitleId;+ }if (t.name.empty() && g.fallbackTitle) t.name = g.fallbackTitle;if (t.publisher.empty() && g.publisher) t.publisher = g.publisher;if (t.tileUrl.empty() && g.tileUrl) t.tileUrl = g.tileUrl;if (t.heroUrl.empty() && g.heroUrl) t.heroUrl = g.heroUrl;if (t.description.empty() && g.description) t.description = g.description;+ if (t.categories.empty() && g.category) t.categories.push_back(g.category);+ if (t.ratingAge.empty() && g.ratingAge) t.ratingAge = g.ratingAge;+ if (t.ratingSystem.empty() && g.ratingSystem) t.ratingSystem = g.ratingSystem;+ if (t.ratingDescriptors.empty() && g.ratingDescriptors && g.ratingDescriptors[0]) {+ t.ratingDescriptors.push_back(g.ratingDescriptors);+ }+ if (!t.description.empty() && !t.tileUrl.empty() && !t.heroUrl.empty()) t.detailed = true;break;}}@@ -373,8 +544,10 @@ ui::GameTile Library::tile(const std::string& productId, const std::string& titlif (auto lang = p.languages.find(language_.substr(0, language_.find('-'))); lang != p.languages.end())t.languages = lang->second; // in the app's language} else {- if (isStoreBigId(productId)) t.name.clear();- else t.name = productId;+ if (t.name.empty()) {+ if (isStoreBigId(productId)) t.name.clear();+ else t.name = productId;+ }}t.freeInStore = freeInStore_.count(productId) > 0;// Free-to-play games are open to every plan and to no plan, even those@@ -440,11 +613,60 @@ ui::GameTile Library::tile(const std::string& productId, const std::string& titlint version = sharedXbox_.count(xbox) ? pairVersion(p) : 0;if (version < 0) t.platform = xcloud::kPlatformOne;else if (version > 0) t.platform = xcloud::kPlatformSeries;- else if (namesSeries(p.title)) t.platform = xcloud::kPlatformSeries;+ else if (namesSeries(p.title) || namesSeries(t.name)) t.platform = xcloud::kPlatformSeries;+ else if (t.name.find("Xbox One") != std::string::npos || p.title.find("Xbox One") != std::string::npos) t.platform = xcloud::kPlatformOne;+ else if (t.name.find("Xbox 360") != std::string::npos || p.title.find("Xbox 360") != std::string::npos) t.platform = xcloud::kPlatform360;else if (t.platform == xcloud::kPlatformSeries && seriesSiblings_.count(xbox)) t.platform = xcloud::kPlatformOne;+ if (t.tileUrl.empty() || t.heroUrl.empty() || t.description.empty() ||+ t.name.empty() || isStoreBigId(t.name) || (t.name == t.productId && isStoreBigId(t.productId)) ||+ t.titleId.empty() || t.titleId == "None" || isStoreBigId(t.titleId)) {+ for (const auto& g : kKnownCloudGames) {+ bool match = (!t.productId.empty() && t.productId == g.productId) ||+ (!t.titleId.empty() && (t.titleId == g.cloudTitleId ||+ (t.titleId == "CALLOFDUTYCOLDWAR" && std::string_view(g.cloudTitleId) == "CALLOFDUTYBLACKOPSCOLDWAR")));+ if (match) {+ if (t.productId.empty()) t.productId = g.productId;+ if ((t.titleId.empty() || t.titleId == "None" || isStoreBigId(t.titleId)) && g.cloudTitleId) {+ t.titleId = g.cloudTitleId;+ }+ if ((t.name.empty() || isStoreBigId(t.name) || t.name == t.productId) && g.fallbackTitle) {+ t.name = g.fallbackTitle;+ }+ if (t.tileUrl.empty() && g.tileUrl) t.tileUrl = g.tileUrl;+ if (t.heroUrl.empty() && g.heroUrl) t.heroUrl = g.heroUrl;+ if (t.description.empty() && g.description) t.description = g.description;+ if (t.publisher.empty() && g.publisher) t.publisher = g.publisher;+ if (t.categories.empty() && g.category) t.categories.push_back(g.category);+ if (t.ratingAge.empty() && g.ratingAge) t.ratingAge = g.ratingAge;+ if (t.ratingSystem.empty() && g.ratingSystem) t.ratingSystem = g.ratingSystem;+ if (t.ratingDescriptors.empty() && g.ratingDescriptors && g.ratingDescriptors[0]) {+ t.ratingDescriptors.push_back(g.ratingDescriptors);+ }+ if (!t.description.empty() && !t.tileUrl.empty() && !t.heroUrl.empty()) t.detailed = true;+ break;+ }+ }+ }return t;}+bool Library::isPcOnly(const std::string& productId) const {+ auto it = products_.find(productId);+ if (it != products_.end()) {+ if (xcloud::isPcProduct(it->second)) return true;+ }+ return false;+}++bool Library::hasStreamingSupport(const ui::GameTile& t) const {+ if (t.titleId.empty() || t.titleId == "None") return false;+ if (t.titleId == t.productId && isStoreBigId(t.productId)) {+ auto ct = cloudTitleOf_.find(t.productId);+ if (ct == cloudTitleOf_.end() || ct->second.empty() || ct->second == "None") return false;+ }+ return true;+}+std::vector<ui::GameTile> Library::tiles(const std::vector<Item>& items) const {std::vector<ui::GameTile> out;for (const auto& [pid, tid] : items) {@@ -452,6 +674,8 @@ std::vector<ui::GameTile> Library::tiles(const std::vector<Item>& items) const {if (xcloud::isNonGameAddon(t.titleId, t.name)) continue;if (t.productId.empty() || t.titleId.empty() || t.name.empty()) continue;if (isStoreBigId(t.name) || (t.name == t.productId && isStoreBigId(t.productId))) continue;+ if (isPcOnly(t.productId) || xcloud::isPcTitle(t.name)) continue;+ if (!hasStreamingSupport(t)) continue;out.push_back(std::move(t));}dedupeByTitle(out);@@ -471,6 +695,8 @@ std::vector<ui::GameRow> Library::rows() const {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;+ if (isPcOnly(t.productId) || xcloud::isPcTitle(t.name)) continue;+ if (!hasStreamingSupport(t)) 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;@@ -501,6 +727,7 @@ std::vector<ui::GameRow> Library::rows() const {if (!fresh.publisher.empty() && t.publisher.empty()) t.publisher = fresh.publisher;if (!fresh.categories.empty() && t.categories.empty()) t.categories = fresh.categories;}+ dedupeByTitle(friendsRow.tiles);// Place right after "Jump back in" if present, otherwise at index 0size_t insertIdx = 0;@@ -528,6 +755,7 @@ std::vector<ui::GameRow> Library::rows() const {favRow.tiles.push_back(std::move(t));}}+ dedupeByTitle(favRow.tiles);if (!favRow.tiles.empty()) {rows.insert(rows.begin(), std::move(favRow));}@@ -863,33 +1091,29 @@ size_t Library::syncDelta(xcloud::GssvClient& gssv, const Changed& changed, std:}}newCount = actuallyAdded.size();-- if (newCount > 0) {- for (auto& row : layout_) {- if (row.isGrid) {- for (const auto& pid : actuallyAdded) {- 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 : actuallyAdded) {- 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});- }- }- }+ }+ allGames_.erase(std::remove_if(allGames_.begin(), allGames_.end(),+ [&](const std::string& id) {+ return isPcOnly(id);+ }),+ allGames_.end());+ for (auto it = gamePass_.begin(); it != gamePass_.end(); ) {+ if (isPcOnly(*it)) it = gamePass_.erase(it);+ else ++it;+ }+ for (auto& row : layout_) {+ if (row.isGrid) {+ row.items.clear();+ for (const auto& pid : allGames_) {+ std::string tid = cloudTitleOf_.count(pid) ? cloudTitleOf_[pid] : "";+ row.items.emplace_back(pid, tid);}+ } else {+ row.items.erase(std::remove_if(row.items.begin(), row.items.end(),+ [&](const auto& item) {+ return isPcOnly(item.first);+ }),+ row.items.end());}}loadOwned(gssv, changed, nullptr, &titles);@@ -994,9 +1218,11 @@ bool Library::load(xcloud::GssvClient& gssv, const std::string& language, constconst 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);+ 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...):@@ -1004,13 +1230,15 @@ bool Library::load(xcloud::GssvClient& gssv, const std::string& language, constif (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+ // within the visible most popular shelf if legitimately in the feedconst 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);+ 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@@ -1020,7 +1248,8 @@ bool Library::load(xcloud::GssvClient& gssv, const std::string& language, constfreeInStore_.insert(list.productIds.begin(), list.productIds.end());XC_LOGI("library: %s: %zu games", list.title.c_str(), list.productIds.size());}- if (!gamePass_.empty() && !freeToPlay) {+ bool isMostPopular = spec.sigl == xcloud::sigl::kMostPopular;+ if (!gamePass_.empty() && !freeToPlay && !isMostPopular) {size_t before = list.productIds.size();list.productIds.erase(std::remove_if(list.productIds.begin(), list.productIds.end(),[&](const std::string& id) {@@ -1039,6 +1268,11 @@ bool Library::load(xcloud::GssvClient& gssv, const std::string& language, constXC_LOGI("library: %s: %zu of %zu not in Game Pass/plan, left out", list.title.c_str(),before - list.productIds.size(), before);}+ list.productIds.erase(std::remove_if(list.productIds.begin(), list.productIds.end(),+ [&](const std::string& id) {+ return isPcOnly(id);+ }),+ list.productIds.end());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) {@@ -1191,6 +1425,7 @@ void Library::loadCatalogNames(const Changed& changed, const std::atomic<bool>*auto it = products_.find(id);bool needs = (it == products_.end()) ||it->second.title.empty() ||+ it->second.tileUrl.empty() ||(it->second.xcloudTitleId.empty() || it->second.xcloudTitleId == "None") ||otherLanguage_.count(id);if (needs && queued.insert(id).second) missing.push_back(id);@@ -1239,6 +1474,30 @@ void Library::loadCatalogNames(const Changed& changed, const std::atomic<bool>*changed(); // each batch: the lists fill in as names arrive}progress_ = {};+ allGames_.erase(std::remove_if(allGames_.begin(), allGames_.end(),+ [&](const std::string& id) {+ return isPcOnly(id);+ }),+ allGames_.end());+ for (auto it = gamePass_.begin(); it != gamePass_.end(); ) {+ if (isPcOnly(*it)) it = gamePass_.erase(it);+ else ++it;+ }+ for (auto& row : layout_) {+ if (row.isGrid) {+ row.items.clear();+ for (const auto& pid : allGames_) {+ std::string tid = cloudTitleOf_.count(pid) ? cloudTitleOf_[pid] : "";+ row.items.emplace_back(pid, tid);+ }+ } else {+ row.items.erase(std::remove_if(row.items.begin(), row.items.end(),+ [&](const auto& item) {+ return isPcOnly(item.first);+ }),+ row.items.end());+ }+ }saveCache();XC_LOGI("library: search covers %zu Game Pass games and %zu of yours or to buy", gamePassSearchPool().size(),librarySearchPool().size());diff --git a/src/app/library.h b/src/app/library.hindex 2d79e86..89d20f8 100644--- a/src/app/library.h+++ b/src/app/library.h@@ -36,6 +36,8 @@namespace xc::app {+void dedupeByTitle(std::vector<ui::GameTile>& tiles);+class Library {public:// Called whenever anything the getters return changed.@@ -114,6 +116,8 @@ private:bool recent = false; // "Jump back in"};std::vector<ui::GameTile> tiles(const std::vector<Item>& items) const;+ bool isPcOnly(const std::string& productId) const;+ bool hasStreamingSupport(const ui::GameTile& t) const;// Full details (hero art, description) for `ids` lacking them, in batches,// `changed` after each; false on a network error.bool fetchFull(const std::vector<std::string>& ids, const Changed& changed, const std::atomic<bool>* stop,diff --git a/src/xcloud/catalog.cpp b/src/xcloud/catalog.cppindex f3fc90a..8421d2a 100644--- a/src/xcloud/catalog.cpp+++ b/src/xcloud/catalog.cpp@@ -2,6 +2,9 @@// Copyright (C) 2026 RafaelNGP#include "xcloud/catalog.h"+#include <algorithm>+#include <cctype>+#include <cstring>#include <ctime>#include "net/http.h"@@ -118,6 +121,44 @@ bool fetchProducts(const std::vector<std::string>& ids, const std::string& markeif (prod.heroUrl.empty()) prod.heroUrl = imageUrl(p["Image_TitledHero"]);for (const auto& c : p["LocalizedCategories"].items()) prod.categories.push_back(categoryName(c.str()));parseContentRatings(p, market, prod.ratingAge, prod.ratingSystem, prod.ratingDescriptors);++ bool hasConsole = false;+ bool hasPc = false;+ auto checkPlatformStr = [&](const std::string& s) {+ if (s == "PC" || s == "Windows.Desktop" || s == "Win32") hasPc = true;+ if (s == "XboxOne" || s == "XboxSeries" || s == "XboxSeriesX" || s == "XboxSeriesS" ||+ s == "Console" || s == "Xbox360") hasConsole = true;+ };+ if (p.has("Platforms") && p["Platforms"].isArray()) {+ for (const auto& pl : p["Platforms"].items()) checkPlatformStr(pl.str());+ }+ if (p.has("AllowedPlatforms") && p["AllowedPlatforms"].isArray()) {+ for (const auto& pl : p["AllowedPlatforms"].items()) checkPlatformStr(pl.str());+ }+ if (p.has("AvailablePlatforms") && p["AvailablePlatforms"].isArray()) {+ for (const auto& pl : p["AvailablePlatforms"].items()) checkPlatformStr(pl.str());+ }+ if (p.has("SupportedPlatforms") && p["SupportedPlatforms"].isArray()) {+ for (const auto& pl : p["SupportedPlatforms"].items()) checkPlatformStr(pl.str());+ }++ bool catPcOnly = false;+ if (!prod.categories.empty()) {+ bool hasOnlyPc = true;+ for (const auto& cat : prod.categories) {+ std::string c = cat;+ for (char& ch : c) ch = static_cast<char>(std::tolower(static_cast<unsigned char>(ch)));+ if (c != "pc" && c != "pc games" && c != "jogos para pc" && c != "jogos de pc") {+ hasOnlyPc = false;+ break;+ }+ }+ catPcOnly = hasOnlyPc;+ }++ if ((hasPc && !hasConsole) || catPcOnly || (isPcTitle(prod.title) && !hasConsole)) {+ prod.isPcOnly = true;+ }if (full) {// How it can be played, from the store's attributes, and the// lowest Game Pass plan that includes it.@@ -149,6 +190,7 @@ bool fetchProducts(const std::vector<std::string>& ids, const std::string& markeif (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;+ prod.isPcOnly = prod.isPcOnly || existing->second.isPcOnly;if (!prod.detailed && existing->second.detailed) {prod.detailed = existing->second.detailed;prod.detailedAt = existing->second.detailedAt;@@ -209,6 +251,253 @@ bool isNonGameAddon(const std::string& titleId, const std::string& titleName) {return false;}+static bool endsWithNoCase(const std::string& s, const char* tail) {+ size_t n = std::strlen(tail);+ if (s.size() < n) return false;+ for (size_t i = 0; i < n; ++i) {+ if (std::tolower(static_cast<unsigned char>(s[s.size() - n + i])) !=+ std::tolower(static_cast<unsigned char>(tail[i]))) {+ return false;+ }+ }+ return true;+}++bool isPcTitle(const std::string& title) {+ if (title.empty()) return false;+ static const char* const kPcTokens[] = {+ " (pc)", " - pc", " [pc]", " for pc", " pc",+ " (windows 10)", " - windows 10", " [windows 10]", " for windows 10",+ " (windows 11)", " - windows 11", " [windows 11]", " for windows 11",+ " (windows)", " - windows", " [windows]", " for windows",+ " (win 10)", " - win 10", " [win 10]",+ " windows 10 edition", " windows 11 edition", " windows edition",+ " pc edition", " (pc edition)", " [pc edition]",+ };+ for (const char* tok : kPcTokens) {+ if (endsWithNoCase(title, tok)) return true;+ }+ std::string lower;+ lower.reserve(title.size());+ for (char c : title) lower.push_back(static_cast<char>(std::tolower(static_cast<unsigned char>(c))));+ if (lower.find("windows 10 edition") != std::string::npos ||+ lower.find("windows 11 edition") != std::string::npos ||+ lower.find("pc edition") != std::string::npos ||+ lower.find("(pc)") != std::string::npos ||+ lower.find("[pc]") != std::string::npos ||+ lower.find("for windows") != std::string::npos) {+ return true;+ }+ return false;+}++bool isPcProduct(const Product& p) {+ if (p.isPcOnly) return true;+ if (isPcTitle(p.title)) return true;+ if (!p.categories.empty()) {+ bool onlyPc = true;+ for (const auto& cat : p.categories) {+ std::string c = cat;+ for (char& ch : c) ch = static_cast<char>(std::tolower(static_cast<unsigned char>(ch)));+ if (c != "pc" && c != "pc games" && c != "jogos para pc" && c != "jogos de pc") {+ onlyPc = false;+ break;+ }+ }+ if (onlyPc) return true;+ }+ return false;+}++std::string normalizeBaseTitle(const std::string& input) {+ if (input.empty()) return "";++ // 1. Lowercase, normalize dashes (en-dash, em-dash -> '-'), and remove UTF-8 symbols:+ // ® (0xC2 0xAE), © (0xC2 0xA9), ™ (0xE2 0x84 0xA2), smart quotes (‘ ’), apostrophes.+ std::string s;+ s.reserve(input.size());+ for (size_t i = 0; i < input.size(); ) {+ unsigned char c = static_cast<unsigned char>(input[i]);+ if (c == 0xC2 && i + 1 < input.size()) {+ unsigned char c2 = static_cast<unsigned char>(input[i + 1]);+ if (c2 == 0xAE || c2 == 0xA9) {+ i += 2;+ continue;+ }+ } else if (c == 0xE2 && i + 2 < input.size()) {+ unsigned char c2 = static_cast<unsigned char>(input[i + 1]);+ unsigned char c3 = static_cast<unsigned char>(input[i + 2]);+ if (c2 == 0x84 && c3 == 0xA2) {+ i += 3;+ continue;+ }+ if (c2 == 0x80 && (c3 == 0x93 || c3 == 0x94)) {+ // En-dash (–) or Em-dash (—) -> standard '-'+ s.push_back('-');+ i += 3;+ continue;+ }+ if (c2 == 0x80 && (c3 == 0x98 || c3 == 0x99)) {+ // Smart single quotes ‘ or ’ -> drop+ i += 3;+ continue;+ }+ }+ if (c == '\'' || c == '`') {+ ++i;+ continue;+ }+ s.push_back(static_cast<char>(std::tolower(c)));+ ++i;+ }++ auto trim = [](std::string& str) {+ while (!str.empty() && (std::isspace(static_cast<unsigned char>(str.front())) ||+ str.front() == '-' || str.front() == ':' || str.front() == '/' ||+ str.front() == '|')) {+ str.erase(str.begin());+ }+ while (!str.empty() && (std::isspace(static_cast<unsigned char>(str.back())) ||+ str.back() == '-' || str.back() == ':' || str.back() == '/' ||+ str.back() == '|')) {+ str.pop_back();+ }+ };++ trim(s);++ // 2. Strip platform and edition suffixes iteratively+ static const char* const kSuffixes[] = {+ " (xbox series x|s)",+ " (xbox series x/s)",+ " (xbox series x)",+ " (xbox series s)",+ " [xbox series x|s]",+ " [xbox series x/s]",+ " - xbox series x|s",+ " - xbox series x/s",+ " - xbox series x",+ " - xbox series s",+ " : xbox series x|s",+ " : xbox series x/s",+ " for xbox series x|s",+ " for xbox series x/s",+ " for xbox series x",+ " for xbox series s",+ " xbox series x|s version",+ " xbox series x/s version",+ " versão xbox series x|s",+ " versao xbox series x|s",+ " xbox series x|s",+ " xbox series x/s",+ " xbox series x",+ " xbox series s",+ " (xbox one)",+ " [xbox one]",+ " - xbox one",+ " : xbox one",+ " for xbox one",+ " xbox one version",+ " versão xbox one",+ " versao xbox one",+ " xbox one",+ " (xbox 360)",+ " [xbox 360]",+ " - xbox 360",+ " : xbox 360",+ " for xbox 360",+ " xbox 360",+ " (windows 11)",+ " - windows 11",+ " [windows 11]",+ " for windows 11",+ " windows 11",+ " (windows 10)",+ " - windows 10",+ " [windows 10]",+ " for windows 10",+ " windows 10 edition",+ " windows 10",+ " (windows)",+ " - windows",+ " [windows]",+ " for windows",+ " (win 10)",+ " - win 10",+ " [win 10]",+ " (pc)",+ " - pc",+ " [pc]",+ " pc edition",+ " digital deluxe edition",+ " digital deluxe",+ " deluxe edition",+ " deluxe version",+ " premium edition",+ " premium version",+ " definitive edition",+ " ultimate edition",+ " gold edition",+ " special edition",+ " game of the year edition",+ " goty edition",+ " anniversary edition",+ " enhanced edition",+ " standard edition",+ " standard version",+ " edição padrão",+ " edicao padrao",+ " cross-gen bundle",+ " cross gen bundle",+ " cross-gen edition",+ " cross gen edition",+ " pacote cross-gen",+ " bundle cross-gen",+ " remastered",+ " remaster",+ " remasterizado",+ " remasterizada",+ " edition",+ " edição",+ " edicao",+ };++ bool stripped = true;+ while (stripped) {+ stripped = false;+ trim(s);+ for (const char* suf : kSuffixes) {+ size_t len = std::strlen(suf);+ if (s.size() >= len && s.compare(s.size() - len, len, suf) == 0) {+ s.erase(s.size() - len);+ trim(s);+ stripped = true;+ break;+ }+ }+ }++ // 3. Normalize punctuation and spaces (apostrophes already handled, non-alphanumeric converted to space)+ std::string clean;+ clean.reserve(s.size());+ for (size_t i = 0; i < s.size(); ++i) {+ char c = s[i];+ if (std::isalnum(static_cast<unsigned char>(c))) {+ clean.push_back(c);+ } else if (clean.empty() || clean.back() != ' ') {+ clean.push_back(' ');+ }+ }+ trim(clean);++ // 4. Special cases: "aliens dark descent" -> "alien dark descent"+ if (clean.rfind("aliens dark descent", 0) == 0) {+ clean = "alien dark descent" + clean.substr(19);+ }++ return clean;+}+void parseContentRatings(const json::Value& p, const std::string& market,std::string& outAge, std::string& outSystem,std::vector<std::string>& outDescriptors) {diff --git a/src/xcloud/catalog.h b/src/xcloud/catalog.hindex 55425c3..0777359 100644--- a/src/xcloud/catalog.h+++ b/src/xcloud/catalog.h@@ -28,6 +28,7 @@ struct Product {std::string posterUrl; // 2:3std::string heroUrl; // 16:9 backgroundstd::vector<std::string> categories;+ bool isPcOnly = false;// From the full details only (`detailed`): how it can be played// (kMode* bits) and, per language ("en", "pt"...: any of its locales),// what is translated (kLang* bits).@@ -86,6 +87,13 @@ std::string categoryName(const std::string& storeName);// Returns true if titleId or titleName corresponds to a non-game add-on (artbook, soundtrack, install pack).bool isNonGameAddon(const std::string& titleId, const std::string& titleName = "");+// Returns true if title or product represents a PC-only / non-cloud title.+bool isPcTitle(const std::string& title);+bool isPcProduct(const Product& p);++// Normalizes a title for universal cross-edition and cross-platform deduplication.+std::string normalizeBaseTitle(const std::string& title);+bool fetchList(const std::string& siglId, const std::string& market, const std::string& language, ProductList& out,std::string& err);// Details for `ids` (batched); products the catalog does not know are absent.diff --git a/tests/test_main.cpp b/tests/test_main.cppindex 1190765..52d40c5 100644--- a/tests/test_main.cpp+++ b/tests/test_main.cpp@@ -5525,7 +5525,511 @@ static void testBloco2Corrections() {}}+static void testBloco3Corrections() {+ // -------------------------------------------------------------------------+ // Item 1: Shelf Filters / Non-contamination+ // Store/owned games (e.g. Tesla vs Lovecraft) must never contaminate Game Pass+ // shelves (Recently Added, Most Popular, Leaving Soon, All Games).+ // syncDelta must not inject arbitrary owned titles into rows.+ // Paid games in "Most Popular" are only allowed if legitimately in kMostPopular.+ // -------------------------------------------------------------------------+ {+ std::string testDir = "/tmp/test-bloco3-shelves";+ std::system(("rm -rf " + testDir + " && mkdir -p " + testDir).c_str());+ std::string cacheFile = testDir + "/library_cache.json";++ std::map<std::string, std::string> siglFeeds;+ siglFeeds[xcloud::sigl::kRecentlyAdded] = R"([{"siglId":"recent","title":"Recently Added"},{"id":"GP_RECENT_1"}])";+ siglFeeds[xcloud::sigl::kMostPopular] = R"([{"siglId":"pop","title":"Most Popular"},{"id":"GP_POP_1"},{"id":"PAID_LEGIT_POP"}])";+ siglFeeds[xcloud::sigl::kFreeToPlay] = R"([{"siglId":"f2p","title":"Free to Play"},{"id":"F2P_CLOUD_1"}])";+ siglFeeds[xcloud::sigl::kLeavingSoon] = R"([{"siglId":"leaving","title":"Leaving Soon"},{"id":"GP_LEAVING_1"}])";+ siglFeeds[xcloud::sigl::kAllGames] = R"([{"siglId":"all","title":"All Games"},{"id":"GP_RECENT_1"},{"id":"GP_POP_1"},{"id":"GP_LEAVING_1"}])";++ std::string titlesV2Body = R"({"results":[]})";++ net::setTestTransport([&](const net::Request& req) {+ net::Response r;+ r.status = 200;+ if (req.url.find("sigls") != std::string::npos) {+ for (const auto& [siglId, body] : siglFeeds) {+ if (req.url.find("id=" + siglId) != std::string::npos) {+ r.body = body;+ return r;+ }+ }+ r.body = "[]";+ return r;+ } else if (req.url.find("titles") != std::string::npos) {+ r.body = titlesV2Body;+ return r;+ } else if (req.url.find("products") != std::string::npos) {+ r.body = R"({+ "Products": {+ "GP_RECENT_1": {+ "XCloudTitleId": "T_REC",+ "ProductTitle": "Recent Cloud Game",+ "Image_Tile": {"URL": "https://store-images.s-microsoft.com/image/apps.tile"},+ "PassMetadataByPassProductId": {"CFQ7TTC0K5DJ": {}}+ },+ "GP_POP_1": {+ "XCloudTitleId": "T_POP",+ "ProductTitle": "Popular Cloud Game",+ "Image_Tile": {"URL": "https://store-images.s-microsoft.com/image/apps.tile"},+ "PassMetadataByPassProductId": {"CFQ7TTC0K5DJ": {}}+ },+ "PAID_LEGIT_POP": {+ "XCloudTitleId": "T_LEGIT_POP",+ "ProductTitle": "Elden Ring",+ "Image_Tile": {"URL": "https://store-images.s-microsoft.com/image/apps.tile"},+ "PassMetadataByPassProductId": {}+ },+ "F2P_CLOUD_1": {+ "XCloudTitleId": "T_F2P",+ "ProductTitle": "Free Cloud Shooter",+ "Image_Tile": {"URL": "https://store-images.s-microsoft.com/image/apps.tile"}+ },+ "GP_LEAVING_1": {+ "XCloudTitleId": "T_LEAVE",+ "ProductTitle": "Leaving Cloud Game",+ "Image_Tile": {"URL": "https://store-images.s-microsoft.com/image/apps.tile"},+ "PassMetadataByPassProductId": {"CFQ7TTC0K5DJ": {}}+ },+ "PROD_TESLA": {+ "XCloudTitleId": "TESLAVSLOVE",+ "ProductTitle": "Tesla vs Lovecraft",+ "Image_Tile": {"URL": "https://store-images.s-microsoft.com/image/apps.tile"}+ }+ }+ })";+ return r;+ }+ r.status = 503;+ return r;+ });++ app::Library lib;+ lib.setCachePath(cacheFile);+ lib.setSubscription("Ultimate");+ xcloud::GssvClient gssv;+ std::string err;+ CHECK(lib.load(gssv, "en-US", [] {}, err));++ // Verify initial load shelves:+ // PAID_LEGIT_POP should appear in Most Popular because it's legitimately in the feed+ bool paidInPop = false;+ bool paidInRecent = false;+ bool paidInLeaving = false;+ for (const auto& row : lib.rows()) {+ for (const auto& t : row.tiles) {+ if (t.productId == "PAID_LEGIT_POP") {+ if (row.title == "Most Popular") paidInPop = true;+ if (row.title == "Recently Added") paidInRecent = true;+ if (row.title == "Leaving Soon") paidInLeaving = true;+ }+ }+ }+ CHECK(paidInPop);+ CHECK(!paidInRecent);+ CHECK(!paidInLeaving);++ // Now simulate user having bought / owned "Tesla vs Lovecraft" via /v2/titles+ titlesV2Body = R"({+ "results": [+ {+ "titleId": "TESLAVSLOVE",+ "details": {+ "productId": "PROD_TESLA",+ "hasEntitlement": true,+ "isFreeInStore": false,+ "userPrograms": []+ }+ }+ ]+ })";++ // Call syncDelta: buying an owned store game outside Game Pass must NOT count as a Game Pass catalog addition+ size_t deltaAdded = lib.syncDelta(gssv, [] {}, err);+ CHECK(deltaAdded == 0);++ // Verify Tesla vs Lovecraft is owned+ bool teslaOwned = false;+ for (const auto& t : lib.owned()) {+ if (t.productId == "PROD_TESLA") teslaOwned = true;+ }+ CHECK(teslaOwned);++ // CRITICAL CHECK: Tesla vs Lovecraft MUST NOT contaminate ANY Game Pass shelf+ for (const auto& row : lib.rows()) {+ for (const auto& t : row.tiles) {+ CHECK(t.productId != "PROD_TESLA");+ CHECK(t.titleId != "TESLAVSLOVE");+ }+ }++ net::setTestTransport({});+ }++ // -------------------------------------------------------------------------+ // Item 2: Universal Deduplication & PC Removal+ // -------------------------------------------------------------------------+ {+ // 2a. normalizeBaseTitle+ CHECK(xcloud::normalizeBaseTitle("A Way Out") == "a way out");+ CHECK(xcloud::normalizeBaseTitle("A Way Out (Xbox One)") == "a way out");+ CHECK(xcloud::normalizeBaseTitle("A Way Out – Xbox One") == "a way out"); // en-dash+ CHECK(xcloud::normalizeBaseTitle("A Way Out: Standard Edition") == "a way out");+ CHECK(xcloud::normalizeBaseTitle("Alien: Dark Descent") == "alien dark descent");+ CHECK(xcloud::normalizeBaseTitle("Aliens: Dark Descent - Xbox Series X|S") == "alien dark descent");+ CHECK(xcloud::normalizeBaseTitle("Aliens: Dark Descent – Xbox Series X|S") == "alien dark descent");+ CHECK(xcloud::normalizeBaseTitle("Assassin's Creed® Unity") == "assassins creed unity");+ CHECK(xcloud::normalizeBaseTitle("Assassin’s Creed Unity (Xbox One)") == "assassins creed unity"); // smart quote+ CHECK(xcloud::normalizeBaseTitle("Assassin's Creed Unity (Xbox One)") == "assassins creed unity");+ CHECK(xcloud::normalizeBaseTitle("Broken Age") == "broken age");+ CHECK(xcloud::normalizeBaseTitle("Broken Age (PC)") == "broken age");+ CHECK(xcloud::normalizeBaseTitle("Broken Age (Windows)") == "broken age");+ CHECK(xcloud::normalizeBaseTitle("Broken Age (Windows 11)") == "broken age");+ CHECK(xcloud::normalizeBaseTitle("Burnout™ Paradise Remastered") == "burnout paradise");+ CHECK(xcloud::normalizeBaseTitle("Burnout Paradise Remastered - Xbox One") == "burnout paradise");+ CHECK(xcloud::normalizeBaseTitle("Burnout Paradise Remastered – Xbox One") == "burnout paradise");+ CHECK(xcloud::normalizeBaseTitle("FIFA 22 Xbox One") == "fifa 22");+ CHECK(xcloud::normalizeBaseTitle("FIFA 22 Xbox Series X|S") == "fifa 22");+ CHECK(xcloud::normalizeBaseTitle("Call of Duty®: Vanguard (Xbox One)") == "call of duty vanguard");+ CHECK(xcloud::normalizeBaseTitle("Call of Duty®: Vanguard - Xbox Series X|S") == "call of duty vanguard");+ CHECK(xcloud::normalizeBaseTitle("Grand Theft Auto V: Premium Edition") == "grand theft auto v");++ // 2b. isPcTitle & isPcProduct+ CHECK(xcloud::isPcTitle("Broken Age (PC)"));+ CHECK(xcloud::isPcTitle("Broken Age (Windows)"));+ CHECK(xcloud::isPcTitle("Broken Age (Windows 11)"));+ CHECK(xcloud::isPcTitle("Age of Empires II: Definitive Edition (Windows 10)"));+ CHECK(xcloud::isPcTitle("Fallout 76: PC Edition"));+ CHECK(xcloud::isPcTitle("Sea of Thieves [PC]"));+ CHECK(!xcloud::isPcTitle("Halo Infinite"));+ CHECK(!xcloud::isPcTitle("Forza Horizon 5"));++ xcloud::Product pcProd;+ pcProd.title = "PC Simulator";+ pcProd.categories = {"PC"};+ CHECK(xcloud::isPcProduct(pcProd));++ xcloud::Product consoleProd;+ consoleProd.title = "Halo";+ consoleProd.categories = {"Shooter"};+ CHECK(!xcloud::isPcProduct(consoleProd));++ // 2c. dedupeByTitle priority (Series X|S > Xbox One > 360) and capability merging+ std::vector<ui::GameTile> tiles;++ // Vanguard pair: Xbox One vs Series X|S+ ui::GameTile vgOne;+ vgOne.productId = "9PHP6HF58MB5";+ vgOne.titleId = "VANGUARDONE";+ vgOne.name = "Call of Duty®: Vanguard (Xbox One)";+ vgOne.platform = "XboxOne";+ vgOne.playable = true;+ vgOne.purchasable = false;++ ui::GameTile vgXs;+ vgXs.productId = "9MWHTW1SF7RW";+ vgXs.titleId = "VANGUARDXS";+ vgXs.name = "Call of Duty®: Vanguard - Xbox Series X|S";+ vgXs.platform = "Series";+ vgXs.playable = false;+ vgXs.purchasable = true;++ // Cold War pair+ ui::GameTile cwOne;+ cwOne.productId = "9P7PFH4RMFZD";+ cwOne.titleId = "COLDWARONE";+ cwOne.name = "Call of Duty®: Black Ops Cold War (Xbox One)";+ cwOne.platform = "XboxOne";++ ui::GameTile cwXs;+ cwXs.productId = "9NPLRJ9CC870";+ cwXs.titleId = "COLDWARXS";+ cwXs.name = "Call of Duty®: Black Ops Cold War - Xbox Series X|S";+ cwXs.platform = "Series";++ // A Way Out pair+ ui::GameTile awo1;+ awo1.productId = "AWAYOUT1";+ awo1.titleId = "AWO_1";+ awo1.name = "A Way Out";++ ui::GameTile awo2;+ awo2.productId = "AWAYOUT2";+ awo2.titleId = "AWO_2";+ awo2.name = "A Way Out (Xbox One)";++ // Burnout Paradise Remastered pair+ ui::GameTile bp1;+ bp1.productId = "BP_1";+ bp1.titleId = "BP_T1";+ bp1.name = "Burnout™ Paradise Remastered";++ ui::GameTile bp2;+ bp2.productId = "BP_2";+ bp2.titleId = "BP_T2";+ bp2.name = "Burnout Paradise Remastered - Xbox One";++ // Assassin's Creed Unity pair+ ui::GameTile acu1;+ acu1.productId = "ACU_1";+ acu1.titleId = "ACU_T1";+ acu1.name = "Assassin's Creed® Unity";++ ui::GameTile acu2;+ acu2.productId = "ACU_2";+ acu2.titleId = "ACU_T2";+ acu2.name = "Assassin's Creed Unity (Xbox One)";++ // Alien Dark Descent pair+ ui::GameTile add1;+ add1.productId = "ADD_1";+ add1.titleId = "ADD_T1";+ add1.name = "Aliens: Dark Descent";++ ui::GameTile add2;+ add2.productId = "ADD_2";+ add2.titleId = "ADD_T2";+ add2.name = "Alien: Dark Descent - Xbox Series X|S";+ add2.platform = "Series";++ // FIFA 22 pair+ ui::GameTile fifa1;+ fifa1.productId = "FIFA_ONE";+ fifa1.titleId = "FIFA_T1";+ fifa1.name = "FIFA 22 Xbox One";+ fifa1.platform = "XboxOne";++ ui::GameTile fifa2;+ fifa2.productId = "FIFA_XS";+ fifa2.titleId = "FIFA_T2";+ fifa2.name = "FIFA 22 Xbox Series X|S";+ fifa2.platform = "Series";++ tiles.push_back(vgOne);+ tiles.push_back(vgXs);+ tiles.push_back(cwOne);+ tiles.push_back(cwXs);+ tiles.push_back(awo1);+ tiles.push_back(awo2);+ tiles.push_back(bp1);+ tiles.push_back(bp2);+ tiles.push_back(acu1);+ tiles.push_back(acu2);+ tiles.push_back(add1);+ tiles.push_back(add2);+ tiles.push_back(fifa1);+ tiles.push_back(fifa2);++ app::dedupeByTitle(tiles);++ // Exactly 7 deduplicated entries+ CHECK(tiles.size() == 7);++ // Vanguard: Series X|S preferred, capabilities merged+ bool foundVanguard = false;+ for (const auto& t : tiles) {+ if (t.productId == "9MWHTW1SF7RW") {+ foundVanguard = true;+ CHECK(t.platform == "Series");+ CHECK(t.playable); // absorbed from vgOne+ CHECK(t.purchasable); // preserved from vgXs+ }+ }+ CHECK(foundVanguard);++ // Cold War: Series X|S preferred+ bool foundColdWar = false;+ for (const auto& t : tiles) {+ if (t.productId == "9NPLRJ9CC870") {+ foundColdWar = true;+ CHECK(t.platform == "Series");+ }+ }+ CHECK(foundColdWar);++ // Alien Dark Descent: Series X|S preferred+ bool foundAdd = false;+ for (const auto& t : tiles) {+ if (t.productId == "ADD_2") {+ foundAdd = true;+ CHECK(t.platform == "Series");+ }+ }+ CHECK(foundAdd);++ // FIFA 22: Series X|S preferred+ bool foundFifa = false;+ for (const auto& t : tiles) {+ if (t.productId == "FIFA_XS") {+ foundFifa = true;+ CHECK(t.platform == "Series");+ }+ }+ CHECK(foundFifa);++ // 2d. Dominant Series priority: Series must win even if Xbox One has full metadata & shorter name+ {+ std::vector<ui::GameTile> domTest;+ ui::GameTile richOne;+ richOne.productId = "RICH_ONE";+ richOne.titleId = "RICH_ONE_TID";+ richOne.name = "Epic Game";+ richOne.platform = "XboxOne";+ richOne.playable = true;+ richOne.detailed = true;+ richOne.tileUrl = "https://example.com/one.png";+ richOne.heroUrl = "https://example.com/one_hero.png";+ richOne.description = "Awesome Xbox One version";++ ui::GameTile bareXs;+ bareXs.productId = "BARE_XS";+ bareXs.titleId = "BARE_XS_TID";+ bareXs.name = "Epic Game - Xbox Series X|S";+ bareXs.platform = "Series";+ bareXs.playable = false;+ bareXs.detailed = false;++ domTest.push_back(richOne);+ domTest.push_back(bareXs);+ app::dedupeByTitle(domTest);+ CHECK(domTest.size() == 1);+ CHECK(domTest[0].productId == "BARE_XS");+ CHECK(domTest[0].platform == "Series");+ CHECK(domTest[0].playable); // absorbed from richOne+ CHECK(domTest[0].tileUrl == "https://example.com/one.png");+ CHECK(domTest[0].description == "Awesome Xbox One version");++ // Order independence: bareXs first, richOne second+ std::vector<ui::GameTile> domTestRev;+ domTestRev.push_back(bareXs);+ domTestRev.push_back(richOne);+ app::dedupeByTitle(domTestRev);+ CHECK(domTestRev.size() == 1);+ CHECK(domTestRev[0].productId == "BARE_XS");+ CHECK(domTestRev[0].platform == "Series");+ CHECK(domTestRev[0].playable);+ }+ }++ // -------------------------------------------------------------------------+ // Item 3: Call of Duty CDN Art & Metadata in kKnownCloudGames+ // -------------------------------------------------------------------------+ {+ app::Library lib;++ // Cold War Xbox One (9P7PFH4RMFZD)+ ui::GameTile cwOne = lib.tile("9P7PFH4RMFZD", "CALLOFDUTYCOLDWAR");+ CHECK(!cwOne.name.empty());+ CHECK(cwOne.name.find("Cold War") != std::string::npos);+ CHECK(!cwOne.titleId.empty() && cwOne.titleId != "None");+ CHECK(!cwOne.tileUrl.empty());+ CHECK(cwOne.tileUrl.find("store-images.s-microsoft.com") != std::string::npos);+ CHECK(!cwOne.heroUrl.empty());+ CHECK(!cwOne.description.empty());+ CHECK(cwOne.description.find("Cold War") != std::string::npos);+ CHECK(cwOne.detailed);++ // Cold War Series X|S (9NPLRJ9CC870)+ ui::GameTile cwXs = lib.tile("9NPLRJ9CC870", "CALLOFDUTYCOLDWAR");+ CHECK(!cwXs.name.empty());+ CHECK(cwXs.name.find("Cold War") != std::string::npos);+ CHECK(!cwXs.titleId.empty() && cwXs.titleId != "None");+ CHECK(!cwXs.tileUrl.empty());+ CHECK(cwXs.tileUrl.find("store-images.s-microsoft.com") != std::string::npos);+ CHECK(!cwXs.heroUrl.empty());+ CHECK(!cwXs.description.empty());+ CHECK(cwXs.detailed);++ // Cold War query without titleId (store ID only)+ ui::GameTile cwNoTid = lib.tile("9P7PFH4RMFZD", "");+ CHECK(!cwNoTid.name.empty());+ CHECK(!cwNoTid.titleId.empty() && cwNoTid.titleId != "None");+ CHECK(!cwNoTid.tileUrl.empty());+ CHECK(!cwNoTid.description.empty());+ CHECK(cwNoTid.detailed);++ // Cold War query without productId (cloudTitleId only)+ ui::GameTile cwNoPid = lib.tile("", "CALLOFDUTYBLACKOPSCOLDWAR");+ CHECK(!cwNoPid.name.empty());+ CHECK(cwNoPid.productId == "9P7PFH4RMFZD");+ CHECK(!cwNoPid.tileUrl.empty());+ CHECK(cwNoPid.detailed);++ // Vanguard Xbox One (9PHP6HF58MB5)+ ui::GameTile vgOne = lib.tile("9PHP6HF58MB5", "CALLOFDUTYVANGUARD");+ CHECK(!vgOne.name.empty());+ CHECK(!vgOne.titleId.empty());+ CHECK(!vgOne.tileUrl.empty());+ CHECK(vgOne.tileUrl.find("store-images.s-microsoft.com") != std::string::npos);+ CHECK(!vgOne.heroUrl.empty());+ CHECK(!vgOne.description.empty());+ CHECK(vgOne.description.find("Vanguard") != std::string::npos);+ CHECK(vgOne.detailed);++ // Vanguard Series X|S (9MWHTW1SF7RW)+ ui::GameTile vgXs = lib.tile("9MWHTW1SF7RW", "CALLOFDUTYVANGUARD");+ CHECK(!vgXs.name.empty());+ CHECK(!vgXs.titleId.empty());+ CHECK(!vgXs.tileUrl.empty());+ CHECK(vgXs.tileUrl.find("store-images.s-microsoft.com") != std::string::npos);+ CHECK(!vgXs.heroUrl.empty());+ CHECK(!vgXs.description.empty());+ CHECK(vgXs.detailed);++ // Modern Warfare (9NVQBQ3F6W9W & C5DTJ99626K3)+ ui::GameTile mw1 = lib.tile("9NVQBQ3F6W9W", "CALLOFDUTYMODERNWARFARE");+ CHECK(!mw1.name.empty());+ CHECK(!mw1.titleId.empty());+ CHECK(!mw1.tileUrl.empty());+ CHECK(mw1.tileUrl.find("store-images.s-microsoft.com") != std::string::npos);+ CHECK(!mw1.heroUrl.empty());+ CHECK(!mw1.description.empty());+ CHECK(mw1.detailed);++ ui::GameTile mw2 = lib.tile("C5DTJ99626K3", "CALLOFDUTYMODERNWARFARE");+ CHECK(!mw2.name.empty());+ CHECK(!mw2.titleId.empty());+ CHECK(!mw2.tileUrl.empty());+ CHECK(mw2.tileUrl.find("store-images.s-microsoft.com") != std::string::npos);+ CHECK(!mw2.heroUrl.empty());+ CHECK(!mw2.description.empty());+ CHECK(mw2.detailed);++ // Verify end-to-end processing through lib.tiles() without dropping cards+ std::vector<std::pair<std::string, std::string>> codItems = {+ {"9P7PFH4RMFZD", ""}, // Cold War Xbox One+ {"9NPLRJ9CC870", ""}, // Cold War Series X|S+ {"9PHP6HF58MB5", ""}, // Vanguard Xbox One+ {"9MWHTW1SF7RW", ""}, // Vanguard Series X|S+ {"9NVQBQ3F6W9W", ""}, // Modern Warfare 2019+ {"C5DTJ99626K3", ""} // Modern Warfare 2019 alt+ };+ std::vector<ui::GameTile> codTiles;+ for (const auto& [pid, tid] : codItems) {+ ui::GameTile t = lib.tile(pid, tid);+ if (!t.productId.empty() && !t.titleId.empty() && !t.name.empty()) {+ codTiles.push_back(std::move(t));+ }+ }+ app::dedupeByTitle(codTiles);+ // Exactly 3 deduplicated games (Cold War Series X|S, Vanguard Series X|S, Modern Warfare)+ CHECK(codTiles.size() == 3);+ for (const auto& t : codTiles) {+ CHECK(!t.name.empty());+ CHECK(!t.titleId.empty());+ CHECK(!t.tileUrl.empty());+ CHECK(!t.heroUrl.empty());+ CHECK(!t.description.empty());+ CHECK(t.detailed);+ }+ }+}+int main() {+ testBloco3Corrections();testBloco2Corrections();testBlock1Corrections();testCallOfDutyModernWarfare4CatalogAndRefresh();