Xbox Cloud Gaming app for PS5 Homebrew
C
Every cross-gen pair told apart, not only the ones named in English (#31)
Rafael Abud Ferreira38d9b8683075
diff --git a/src/app/autoplay.cpp b/src/app/autoplay.cppindex ba25393..0754070 100644--- a/src/app/autoplay.cpp+++ b/src/app/autoplay.cpp@@ -441,7 +441,9 @@ void autoplayScreens(const ui::Canvas& canvas, uint64_t now) {if (g_autoplay.quickTest && uiSaved) {g_autoplay.quickTest = false;ui::GameTile t;- for (const char* id : {"HOGWARTSLEGACYXBOXSERIESXSVERSION", "HOGWARTSLEGACYXBOXONEVERSION"})+ for (const char* id : {"HOGWARTSLEGACYXBOXSERIESXSVERSION", "HOGWARTSLEGACYXBOXONEVERSION", "RUSTCONSOLEEDITIONXS",+ "RUSTCONSOLEEDITION", "CALLOFDUTYVANGUARDXBOXSERIESXS", "CALLOFDUTYVANGUARD", "PGATOUR2K23",+ "PGATOUR2K23XBOXONE"})XC_LOGI("quick: %s badge %s", id, g_ui->findTile(id, t) ? t.platform.c_str() : "(not found)");if (!g_autoplay.lockTitle.empty())XC_LOGI("quick: %s %s", g_autoplay.lockTitle.c_str(),diff --git a/src/app/autoplay.h b/src/app/autoplay.hindex 5931f3d..f45ba78 100644--- a/src/app/autoplay.h+++ b/src/app/autoplay.h@@ -60,7 +60,7 @@ struct Autoplay {bool updateTest = false; // updatetest: accept the update pop-up, save update.ppm / updating.ppmbool updateSkip = false; // updateskip: "Not now" on the update pop-upbool settingsUpdate = false; // settingsupdate: Settings > Updates, Cross- bool quickTest = false; // quicktest: Hogwarts Legacy's badges, MOBA games, the lock on `lockTitle`+ bool quickTest = false; // quicktest: cross-gen pairs' badges, MOBA games, the lock on `lockTitle`std::string lockTitle; // locktitle=<xCloud title id>: logged playable or locked at oncebool searchTest = false; // searchtest: lowest price, Game Pass co-op + dubbed, the genres' list// (cheapest.ppm, filters.ppm, genres.ppm)diff --git a/src/app/library.cpp b/src/app/library.cppindex bba71f0..2bf04e9 100644--- a/src/app/library.cpp+++ b/src/app/library.cpp@@ -10,6 +10,7 @@#include "xcloud/titlehub.h"#include <algorithm>+#include <cstring>#include <map>namespace xc::app {@@ -79,6 +80,24 @@ bool namesSeries(const std::string& title) {return title.find("Series X|S") != std::string::npos || title.find("Series X/S") != std::string::npos;}+bool endsWith(const std::string& s, const char* tail) {+ size_t n = std::strlen(tail);+ return s.size() >= n && s.compare(s.size() - n, n, tail) == 0;+}++// Which version of a cross-gen pair (two products, one Xbox title id) a+// product is, from its cloud title id or its name: +1 Series X|S, -1 Xbox+// One, 0 can't tell. "HOGWARTSLEGACYXBOXONEVERSION", "...XBOXSERIESXSVERSION",+// "RUSTCONSOLEEDITIONXS" / "Rust Console Edition X|S", "... - Xbox Series X|S".+int pairVersion(const xcloud::Product& p) {+ const std::string& c = p.xcloudTitleId;+ if (c.find("XBOXONE") != std::string::npos) return -1;+ 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;+ 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.@@ -134,7 +153,12 @@ ui::GameTile Library::tile(const std::string& productId, const std::string& titlauto xs = xboxTitleOf_.find(id);const std::string& xbox = xs != xboxTitleOf_.end() ? xs->second : prod.xboxTitleId;if (!xbox.empty() && !seen.insert(xbox).second) sharedXbox_.insert(xbox);- if (namesSeries(prod.title)) seriesSiblings_.insert(xbox);+ }+ // The pairs with a Series X|S side: the other side is the Xbox One one.+ for (const auto& [id, prod] : products_) {+ auto xs = xboxTitleOf_.find(id);+ const std::string& xbox = xs != xboxTitleOf_.end() ? xs->second : prod.xboxTitleId;+ if (namesSeries(prod.title) || (sharedXbox_.count(xbox) && pairVersion(prod) > 0)) seriesSiblings_.insert(xbox);}siblingsFor_ = products_.size();}@@ -147,10 +171,9 @@ ui::GameTile Library::tile(const std::string& productId, const std::string& titl// The cloud title id names the version where the store's name doesn't// say it in English ("Hogwarts Legacy" / "... Versão Xbox One":// HOGWARTSLEGACYXBOXSERIESXSVERSION / ...XBOXONEVERSION).- bool pair = sharedXbox_.count(xbox) > 0;- if (pair && t.titleId.find("XBOXONE") != std::string::npos) t.platform = xcloud::kPlatformOne;- else if (pair && (t.titleId.find("XBOXSERIES") != std::string::npos || t.titleId.find("SERIESXS") != std::string::npos))- t.platform = xcloud::kPlatformSeries;+ int 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 (t.platform == xcloud::kPlatformSeries && seriesSiblings_.count(xbox)) t.platform = xcloud::kPlatformOne;return t;