Xbox Cloud Gaming app for PS5 Homebrew
C
feat(catalog): filter catalog and search by Game Pass plan
Rafael Abud Ferreira1d27adf0549f
diff --git a/ROADMAP.md b/ROADMAP.mdindex 3d14df6..758cc7c 100644--- a/ROADMAP.md+++ b/ROADMAP.md@@ -220,7 +220,7 @@ is rolled back at the next start), then the app restarts itself| --- | --- | --- || VRR for the stream | `sceVideoOutVrrUnpegFromFixedRate` would absorb the 60 fps stream's jitter (ProsperoLight's "Paced + VRR"); needs an extended libSceVideoOut stub | medium || **next** Cloud playtime left | From November 2026 cloud play is capped each month (Ultimate 15 h, Premium 10 h, Essential 5 h). Informational only: no lock in the app (more time can be bought); to build once Microsoft turns it on. Source found (xbox.com/play): `GET contentaccess.exp.xboxservices.com/all/v1?market=..&offering=xgpuweb` with the `http://mp.microsoft.com/` XSTS (already used for the plan), protobuf answer: `remainingGameplayTimeInSeconds` / `maxGameplayTimeInSeconds` / monthly reset. A minimal protobuf reader, the hours left on Home and in the game menu, a warning near the end; and GSSV's `MonthlyLimitExceeded` (0x87DD043A) shown as such | small–medium |-| **next** Catalog by Game Pass plan | Rows and tabs show only what the account's plan plays; the search gets a **Plan** filter (My plan / Ultimate / Premium / Essential / All) to see what an upgrade or downgrade changes; other plans' games marked (badge, "Included with Game Pass Ultimate" on the page). Data already downloaded: catalog.gamepass.com v3 `PassMetadataByPassProductId` (full hydration): Essential `CFQ7TTC0K5DJ`, Premium `CFQ7TTC0P85B`, otherwise Ultimate (EA Play `CFQ7TTC0K5DH`, Ubisoft+ Classics, PC, day-one); Ultimate plays all, Premium plays Premium + Essential, Essential only Essential. The free-to-play list (87 games, BR) is open to every plan and to no plan, even the 34 also tagged with a plan (partly free: Halo Infinite, the Call of Duty launchers, Warzone; "Fortnite" tagged Ultimate next to the untagged "Fortnite Battle Royale"). Audit 2026-10-15, 894 cloud games: 126 Essential, 440 Premium, 328 Ultimate only. The plan itself comes from the store (v0.9.7). A non-Ultimate account is needed to check the default view | medium |+| Catalog by Game Pass plan (done) | Rows and tabs show only what the account's plan plays; the search gets a **Plan** filter (My plan / Ultimate / Premium / Essential / All) to see what an upgrade or downgrade changes; other plans' games marked (badge, "Included with Game Pass Ultimate" on the page). Data already downloaded: catalog.gamepass.com v3 `PassMetadataByPassProductId` (full hydration): Essential `CFQ7TTC0K5DJ`, Premium `CFQ7TTC0P85B`, otherwise Ultimate (EA Play `CFQ7TTC0K5DH`, Ubisoft+ Classics, PC, day-one); Ultimate plays all, Premium plays Premium + Essential, Essential only Essential. The free-to-play list (87 games, BR) is open to every plan and to no plan, even the 34 also tagged with a plan (partly free: Halo Infinite, the Call of Duty launchers, Warzone; "Fortnite" tagged Ultimate next to the untagged "Fortnite Battle Royale"). Audit 2026-10-15, 894 cloud games: 126 Essential, 440 Premium, 328 Ultimate only. The plan itself comes from the store (v0.9.7). A non-Ultimate account is needed to check the default view | medium || Free play with ads | Microsoft's ad-supported offering (`xgpuwebf2p` login and sessions, its own list): play without a subscription, with the service's limits; the ads are never skipped (as green-nx, Nubix, XStreaming) | small–medium || Game Pass trial badge (later) | The store's answer says `isTrial`; a TRIAL mark next to the plan. Not now | small || Unreliable input channel (protocol v9) | The official client sends input on an unordered channel, so a lost packet doesn't hold the ones after it; needs a capture of its frames | medium |diff --git a/src/app/autoplay.cpp b/src/app/autoplay.cppindex 0967196..01d60f0 100644--- a/src/app/autoplay.cpp+++ b/src/app/autoplay.cpp@@ -843,6 +843,11 @@ void autoplayScreens(const ui::Canvas& canvas, uint64_t now) {++step;} else if (step == 2 && now - since > 6000) {saveCanvas("publisher_results.ppm");+ // Filtra também por plano Ultimate (índice 1) para exibir badges de plano nos cards+ g_ui->chooseFilter(ui::AppUi::Filter::Plan, 1);+ ++step;+ } else if (step == 3 && now - since > 8000) {+ saveCanvas("plan_results.ppm");g_autoplay.publisherTest = false;XC_LOGI("AUTOPLAY END: publisher test");}diff --git a/src/app/cli_main.cpp b/src/app/cli_main.cppindex 62556fa..08be276 100644--- a/src/app/cli_main.cpp+++ b/src/app/cli_main.cpp@@ -781,7 +781,7 @@ int main(int argc, char** argv) {std::string path = std::string(argv[argi]) + "/" + name + ".png";stbi_write_png(path.c_str(), canvas.width(), canvas.height(), 4, canvas.data(), canvas.width() * 4);};- // Game Pass: one filter on the first row, four on the second.+ // Game Pass: three filters on the first row, four on the second.app.showFilteredSearch(ui::Tab::GamePass, false, 0, "", 0, -1);for (int i = 0; i < 8; ++i) up(); // from the row of lists to the first lettersfor (int i = 0; i < 5; ++i) right();@@ -789,26 +789,26 @@ int main(int argc, char** argv) {for (int i = 0; i < 6; ++i) down();expect(6, 2, "F, down to the wide keys: Clear");down();- expect(7, 0, "Clear, down: the only filter of the first row");+ expect(7, 2, "Clear, down: the rightmost filter of the first row");down();- expect(8, 1, "the centred filter, down: the one under it (not the leftmost)");+ expect(8, 3, "rightmost filter, down: the rightmost list");save("search_gamepass");up();up();- expect(6, 1, "up twice: Delete, over the filter");- // Your games: three filters, then four.+ expect(6, 2, "up twice: Clear, over the rightmost filter");+ // Your games: four filters, then four.app.showFilteredSearch(ui::Tab::Library, false, 0, "", 0, -1);for (int i = 0; i < 2; ++i) up();expect(6, 0, "Space");right();right();down();- expect(7, 2, "Clear, down: the rightmost filter");+ expect(7, 3, "Clear, down: the rightmost filter");down();expect(8, 3, "rightmost filter, down: the rightmost list");save("search_library");up();- expect(7, 2, "up: back to it");+ expect(7, 3, "up: back to it");up();expect(6, 2, "up: Clear");up();diff --git a/src/app/library.cpp b/src/app/library.cppindex c2f855b..a489d84 100644--- a/src/app/library.cpp+++ b/src/app/library.cpp@@ -43,6 +43,7 @@ json::Value productToJson(const xcloud::Product& p) {v.set("d", true);v.set("at", p.detailedAt);v.set("modes", static_cast<int64_t>(p.modes));+ if (p.plan) v.set("plan", static_cast<int64_t>(p.plan));json::Value langs = json::Value::object();for (const auto& [lang, bits] : p.languages) langs.set(lang, static_cast<int64_t>(bits));v.set("langs", langs);@@ -66,6 +67,7 @@ xcloud::Product productFromJson(const std::string& id, const json::Value& v) {// 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)));p.modes = static_cast<uint32_t>(v["modes"].asInt(0));+ p.plan = static_cast<uint8_t>(v["plan"].asInt(0));for (const auto& [lang, bits] : v["langs"].members()) p.languages[lang] = static_cast<uint8_t>(bits.asInt(0));return p;}@@ -141,12 +143,20 @@ 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 languageif (ownershipKnown_) t.playable = ownedTitles_.count(t.titleId) || ownedProducts_.count(t.productId);+ t.freeInStore = freeInStore_.count(productId) > 0;+ // Free-to-play games are open to every plan and to no plan, even those+ // also tagged with a Pass product id in the catalog.+ t.plan = (!t.freeInStore && gamePass_.count(productId)) ? p.plan : 0;+ uint8_t myPlan = xcloud::planTier(subscription_);// Added to Game Pass since the last start: the account's list from then- // doesn't have it yet. Not locked until this start's list arrives.+ // doesn't have it yet. Not locked until this start's list arrives, if the+ // account's plan includes it.if (!t.playable && !ownershipFresh_ && !knownGamePass_.empty() && gamePass_.count(productId) &&- !knownGamePass_.count(productId))+ !knownGamePass_.count(productId) && (myPlan == 0 || xcloud::planIncludes(myPlan, t.plan, t.freeInStore)))t.playable = true;- t.freeInStore = freeInStore_.count(productId) > 0;+ if (t.playable && !ownershipKnown_) {+ if (myPlan > 0 && !xcloud::planIncludes(myPlan, t.plan, t.freeInStore)) t.playable = false;+ }t.mouseKeyboard = mouseKeyboard_.count(productId) > 0;// A free-to-play game not on the account yet is got like one bought// (the store page's QR code), only free.@@ -198,6 +208,7 @@ std::vector<ui::GameTile> Library::tiles(const std::vector<Item>& items) const {std::vector<ui::GameRow> Library::rows() const {std::vector<ui::GameRow> rows;+ uint8_t myPlan = xcloud::planTier(subscription_);for (const auto& r : layout_) {ui::GameRow row;row.title = r.title;@@ -209,6 +220,11 @@ std::vector<ui::GameRow> Library::rows() const {// "Jump back in": Game Pass games and the account's own (bought,// free-to-play); not one it can't start any more.if (r.recent && !gamePass_.empty() && !gamePass_.count(pid) && !t.playable) continue;+ // Rows show only what the account's plan plays (free-to-play is+ // open to every plan).+ if (!t.playable && !t.freeInStore &&+ (ownershipKnown_ || (myPlan > 0 && !xcloud::planIncludes(myPlan, t.plan, t.freeInStore))))+ continue;row.tiles.push_back(std::move(t));}if (!row.tiles.empty()) rows.push_back(std::move(row));@@ -288,6 +304,7 @@ bool Library::loadCache() {for (const auto& id : (*j)["mouseKeyboard"].items()) mouseKeyboard_.insert(id.str());for (const auto& t : (*j)["ownedTitles"].items()) ownedTitles_.insert(t.str());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());owned_.clear();@@ -319,6 +336,7 @@ void Library::saveCache() const {for (const auto& p : ownedProducts_) prods.push(p);root.set("ownedTitles", titles);root.set("gamePassMember", gamePassMember_);+ if (!subscription_.empty()) root.set("subscription", subscription_);root.set("ownedProducts", prods);root.set("owned", itemsToJson(owned_));json::Value gamePass = json::Value::array();@@ -430,6 +448,7 @@ bool Library::load(xcloud::GssvClient& gssv, const std::string& language, const{xcloud::sigl::kFreeToPlay, 40},{xcloud::sigl::kLeavingSoon, 40},{xcloud::sigl::kAllGames, 0}};+ uint8_t myPlan = xcloud::planTier(subscription_);for (const auto& spec : lists) {xcloud::ProductList list;bool isAllGames = std::string_view(spec.sigl) == xcloud::sigl::kAllGames;@@ -453,10 +472,20 @@ bool Library::load(xcloud::GssvClient& gssv, const std::string& language, constif (!gamePass_.empty() && !freeToPlay) {size_t before = list.productIds.size();list.productIds.erase(std::remove_if(list.productIds.begin(), list.productIds.end(),- [&](const std::string& id) { return !gamePass_.count(id); }),+ [&](const std::string& id) {+ if (!gamePass_.count(id)) return true;+ if (myPlan > 0 && myPlan < xcloud::kPlanUltimate && !ownedProducts_.count(id) &&+ !freeInStore_.count(id)) {+ auto it = products_.find(id);+ if (it != products_.end() &&+ !xcloud::planIncludes(myPlan, it->second.plan, false))+ return true;+ }+ return false;+ }),list.productIds.end());if (list.productIds.size() != before)- XC_LOGI("library: %s: %zu of %zu not in Game Pass, left out", list.title.c_str(),+ XC_LOGI("library: %s: %zu of %zu not in Game Pass/plan, left out", list.title.c_str(),before - list.productIds.size(), before);}if (spec.limit > 0 && list.productIds.size() > spec.limit) list.productIds.resize(spec.limit);@@ -575,10 +604,11 @@ void Library::loadCatalogNames(const Changed& changed, const std::atomic<bool>*if (old != products_.end()) {if (p.heroUrl.empty()) p.heroUrl = old->second.heroUrl;if (p.description.empty() && !otherLanguage_.count(id)) p.description = old->second.description;- if (!p.detailed && old->second.detailed) { // modes and languages don't change with the language+ if (!p.detailed && old->second.detailed) { // modes, languages and plan don't change with the languagep.detailed = true;p.detailedAt = old->second.detailedAt;p.modes = old->second.modes;+ p.plan = old->second.plan;p.languages = old->second.languages;}}@@ -604,7 +634,7 @@ bool Library::fetchFull(const std::vector<std::string>& ids, const Changed& chanfor (const auto& id : ids) {auto it = products_.find(id);if ((it == products_.end() || it->second.heroUrl.empty() || it->second.description.empty() ||- !it->second.detailed) &&+ !it->second.detailed || !it->second.plan) &&queued.insert(id).second)order.push_back(id);}diff --git a/src/app/library.h b/src/app/library.hindex 0f0b110..70ef3a6 100644--- a/src/app/library.h+++ b/src/app/library.h@@ -43,6 +43,8 @@ public:// Where the cache lives (read by load(), written by the later phases).void setCachePath(std::string path) { cachePath_ = std::move(path); }+ // The account's Game Pass plan ("Ultimate", "Premium", "Essential", ...).+ void setSubscription(std::string sub) { subscription_ = std::move(sub); }// Calls `changed` after each row arrives; false only when nothing loaded.bool load(xcloud::GssvClient& gssv, const std::string& language, const Changed& changed, std::string& err);@@ -105,6 +107,7 @@ private:void saveCache() const;std::string cachePath_;+ std::string subscription_;std::string market_, language_;std::vector<RowIds> layout_;std::map<std::string, xcloud::Product> products_;diff --git a/src/app/worker.cpp b/src/app/worker.cppindex c715394..92aeb36 100644--- a/src/app/worker.cpp+++ b/src/app/worker.cpp@@ -533,6 +533,10 @@ void loadConsoles(auth::AuthManager& am, xcloud::GssvClient& home) {g_ui->setConsoles(std::move(tiles), true);}+namespace {+std::string g_subscription;+} // namespace+void signInAndLoad(auth::AuthManager& am, xcloud::GssvClient& gssv) {g_ui->showSplash(ui::tr(am.hasStoredAccount() ? ui::Str::SigningIn : ui::Str::RequestingCode));std::string err;@@ -594,7 +598,8 @@ void signInAndLoad(auth::AuthManager& am, xcloud::GssvClient& gssv) {if (!am.saved()) // the next start would ask for a code again: said now, not thenplatform::notify(ui::tr(ui::Str::SignInNotSaved), "the sign-in couldn't be saved (notification)");g_ui->setProfile(am.profile().gamertag, am.profile().gamerpicUrl, am.profile().gamerscore);- if (!am.profile().subscription.empty()) g_ui->setSubscription(am.profile().subscription);+ g_subscription = am.profile().subscription;+ if (!g_subscription.empty()) g_ui->setSubscription(g_subscription);{std::lock_guard<std::mutex> lock(g_argMutex);g_xblAuth = am.profile().xblAuthorization;@@ -618,6 +623,7 @@ void loadLibrary(xcloud::GssvClient& gssv) {stopHydration();auto library = std::make_shared<app::Library>();library->setCachePath(platform::dataDir() + "/library.json");+ library->setSubscription(g_subscription);setPriceMarket(gssv.session().market.empty() ? "US" : gssv.session().market, ui::catalogLanguage());setQueueClient(&gssv);bool shown = false;diff --git a/src/ui/app_ui.cpp b/src/ui/app_ui.cppindex 06f69bb..c32fa83 100644--- a/src/ui/app_ui.cpp+++ b/src/ui/app_ui.cpp@@ -374,6 +374,7 @@ void AppUi::setProfile(const std::string& gamertag, const std::string& gamerpicUvoid AppUi::setSubscription(const std::string& plan) {std::lock_guard<std::mutex> lock(mutex_);subscription_ = plan;+ if (searching_) runSearch();dirty_ = true;}@@ -766,6 +767,7 @@ void AppUi::showFilteredSearch(Tab tab, bool cheapest, int mode, const std::strifilterFree_ = false;filterMouseKeyboard_ = false;filterCheapest_ = cheapest;+ filterPlan_ = 0;filterConsole_ = 0;filterMode_ = mode;filterGenre_ = genre;@@ -872,6 +874,19 @@ void AppUi::runSearch() {std::vector<Hit> hits;for (const auto& t : tab_ == Tab::GamePass ? gamePassPool_ : libraryPool_) {if (hidden_.count(t.productId)) continue;+ if (tab_ == Tab::GamePass && filterPlan_ != 4) {+ if (filterPlan_ == 0) {+ uint8_t myPlan = xcloud::planTier(subscription_);+ if (!t.freeInStore && (!t.playable || (myPlan > 0 && !xcloud::planIncludes(myPlan, t.plan, false))))+ continue;+ } else {+ uint8_t want = filterPlan_ == 1 ? xcloud::kPlanUltimate+ : filterPlan_ == 2 ? xcloud::kPlanPremium+ : xcloud::kPlanEssential;+ if (!t.freeInStore && (want < xcloud::kPlanUltimate && t.plan == 0)) continue;+ if (!xcloud::planIncludes(want, t.plan, t.freeInStore)) continue;+ }+ }if (filterConsole_ && t.platform != kConsoleCodes[filterConsole_]) continue;if (filterMouseKeyboard_ && !t.mouseKeyboard) continue;// Play mode and language need the full details: a game without them@@ -1934,16 +1949,19 @@ void AppUi::handleHome(const NavInput& in, UiEvent& ev) {}bool AppUi::anyFilter() const {- // Caller holds mutex_. Free and Lowest price only count in "Your games".+ // Caller holds mutex_. Free and Lowest price only count in "Your games";+ // Plan only in Game Pass.bool library = tab_ == Tab::Library && (filterFree_ || filterCheapest_);- return library || filterConsole_ || filterMode_ || !filterGenre_.empty() || filterPublisher_ || filterLanguage_;+ bool gamePass = tab_ == Tab::GamePass && filterPlan_ > 0;+ return library || gamePass || filterConsole_ || filterMouseKeyboard_ || filterMode_ || !filterGenre_.empty() ||+ filterPublisher_ || filterLanguage_;}std::vector<AppUi::Filter> AppUi::filterRow(int row) const {// Caller holds mutex_. Prices only matter in "Your games" (Game Pass// games aren't bought).if (row == 1) return {Filter::Mode, Filter::Genre, Filter::Publisher, Filter::Language};- if (tab_ == Tab::GamePass) return {Filter::Console, Filter::MouseKeyboard};+ if (tab_ == Tab::GamePass) return {Filter::Plan, Filter::Console, Filter::MouseKeyboard};return {Filter::Free, Filter::Cheapest, Filter::Console, Filter::MouseKeyboard};}@@ -1963,6 +1981,7 @@ std::vector<std::string> AppUi::poolGenres() const {std::vector<std::string> AppUi::filterOptions(Filter f) const {// Caller holds mutex_. The first choice is always "all".switch (f) {+ case Filter::Plan: return {tr(Str::PlanMine), "Ultimate", "Premium", "Essential", tr(Str::PlanAll)};case Filter::Console: return {tr(Str::FilterAllConsoles), "SERIES X|S", "XBOX ONE", "XBOX 360"};case Filter::Mode:return {tr(Str::ModeAll), tr(Str::ModeSingle), tr(Str::ModeOnlineMulti), tr(Str::ModeOnlineCoop), tr(Str::ModeLocal)};@@ -1998,6 +2017,7 @@ std::vector<std::string> AppUi::filterOptions(Filter f) const {int AppUi::filterSelected(Filter f) const {// Caller holds mutex_.+ if (f == Filter::Plan) return filterPlan_;if (f == Filter::Console) return filterConsole_;if (f == Filter::Mode) return filterMode_;if (f == Filter::Publisher) return filterPublisher_;@@ -2017,6 +2037,7 @@ void AppUi::chooseFilter(Filter f, int index) {void AppUi::chooseFilterLocked(Filter f, int index) {// Caller holds mutex_.+ if (f == Filter::Plan) filterPlan_ = index;if (f == Filter::Console) filterConsole_ = index;if (f == Filter::Mode) filterMode_ = index;if (f == Filter::Publisher) filterPublisher_ = index;@@ -2040,7 +2061,11 @@ std::string AppUi::filterText(Filter f) const {auto options = filterOptions(f);if (sel < static_cast<int>(options.size())) return options[static_cast<size_t>(sel)];}- return tr(f == Filter::Mode ? Str::FilterMode : f == Filter::Genre ? Str::FilterGenre : f == Filter::Publisher ? Str::FilterPublisher : Str::FilterLanguage);+ return tr(f == Filter::Plan ? Str::FilterPlan+ : f == Filter::Mode ? Str::FilterMode+ : f == Filter::Genre ? Str::FilterGenre+ : f == Filter::Publisher ? Str::FilterPublisher+ : Str::FilterLanguage);}bool AppUi::filterOn(Filter f) const {@@ -2921,6 +2946,20 @@ const char* platformLabel(const std::string& code) {return nullptr;}+const char* planBadgeLabel(uint8_t plan) {+ if (plan == xcloud::kPlanEssential) return "ESSENTIAL";+ if (plan == xcloud::kPlanPremium) return "PREMIUM";+ if (plan == xcloud::kPlanUltimate) return "ULTIMATE";+ return nullptr;+}++const char* planDisplayName(uint8_t plan) {+ if (plan == xcloud::kPlanEssential) return "Essential";+ if (plan == xcloud::kPlanPremium) return "Premium";+ if (plan == xcloud::kPlanUltimate) return "Ultimate";+ return nullptr;+}+// A shopping bag centred on (cx, cy), about 22x24 px: a game to buy.// A shopping bag (body + handle) centred on (cx, cy); `size` scales it// (1 = 22 x 23 px).@@ -2944,8 +2983,13 @@ void AppUi::drawCard(Canvas& c, const GameTile& t, int x, int y, bool focused, bfor (size_t k = 0; k < lines.size(); ++k)fonts_.semibold.draw(c, lines[k], x + 16, y + 16 + static_cast<int>(k) * 30, 22, kGray);}- // Bottom-left: GAME PASS, or BUY with a bag; a padlock (top right) when- // it can't be played or bought.+ // Bottom-left: BUY with a bag, a Game Pass plan badge when the game is+ // in another plan (or while filtering by plan), or friends playing; a+ // padlock (top right) when it can't be played or bought.+ const char* planBadge = planBadgeLabel(t.plan);+ uint8_t myPlan = xcloud::planTier(subscription_);+ bool otherPlan = planBadge && (!t.playable || (myPlan > 0 && !xcloud::planIncludes(myPlan, t.plan, t.freeInStore)));+ bool showPlan = otherPlan || (planBadge && searching_ && tab_ == Tab::GamePass && filterPlan_ > 0 && t.friends.empty());if (t.purchasable) {c.fillRect({x, y, kCard, kCard}, rgba(0, 0, 0, 70), 10);auto price = prices_.find(t.productId);@@ -2960,6 +3004,19 @@ void AppUi::drawCard(Canvas& c, const GameTile& t, int x, int y, bool focused, b} else if (!t.playable) {c.fillRect({x, y, kCard, kCard}, rgba(0, 0, 0, 150), 10);drawLock(c, x + kCard - 34, y + 30);+ if (planBadge) {+ int w = std::min(78, fonts_.bold.measure(planBadge, 11) + 12);+ Rect badge{x + 10, y + kCard - 34, w, 24};+ c.fillRect(badge, rgba(0, 0, 0, 220), 4);+ fonts_.bold.draw(c, planBadge, badge.x + (badge.w - fonts_.bold.measure(planBadge, 11)) / 2,+ fonts_.bold.centeredY(badge.y, badge.h, 11), 11, kWhite);+ }+ } else if (showPlan) {+ int w = std::min(78, fonts_.bold.measure(planBadge, 11) + 12);+ Rect badge{x + 10, y + kCard - 34, w, 24};+ c.fillRect(badge, rgba(0, 0, 0, 220), 4);+ fonts_.bold.draw(c, planBadge, badge.x + (badge.w - fonts_.bold.measure(planBadge, 11)) / 2,+ fonts_.bold.centeredY(badge.y, badge.h, 11), 11, kWhite);} else if (!t.friends.empty()) {int numAvatars = std::min<int>(static_cast<int>(t.friends.size()), 2);int extraCount = static_cast<int>(t.friends.size()) - numAvatars;@@ -3500,8 +3557,13 @@ void AppUi::drawDetails(Canvas& c, uint64_t nowMs) {y += 82;}y += 6;- if (!g->publisher.empty()) {- fonts_.semibold.draw(c, trf(Str::PublisherBy, g->publisher), kMargin, y, 26, kGray);+ const char* planName = planDisplayName(g->plan);+ std::string byLine;+ if (!g->publisher.empty()) byLine = trf(Str::PublisherBy, g->publisher);+ if (planName && g->playable)+ byLine += (byLine.empty() ? "" : " \xE2\x80\xA2 ") + trf(Str::IncludedWithPlan, planName);+ if (!byLine.empty()) {+ fonts_.semibold.draw(c, byLine, kMargin, y, 26, kGray);y += 40;}std::string cats;@@ -3585,10 +3647,12 @@ void AppUi::drawDetails(Canvas& c, uint64_t nowMs) {}if (!g->playable) {// Bought separately or outside the subscription: no Play button.- Rect note{kMargin, std::max(y + 48, 620), 560, 76};+ std::string msg = planName ? trf(Str::IncludedWithPlan, planName) : std::string(tr(Str::NotPlayable));+ int w = std::max(560, fonts_.semibold.measure(msg, 28) + 124);+ Rect note{kMargin, std::max(y + 48, 620), w, 76};c.fillRect(note, rgba(255, 255, 255, 40), 38);drawLock(c, note.x + 52, note.y + note.h / 2);- fonts_.semibold.draw(c, tr(Str::NotPlayable), note.x + 90, note.y + 22, 28, kGray);+ fonts_.semibold.draw(c, msg, note.x + 90, note.y + 22, 28, kGray);drawHints(c, {{kIconOptions, tr(Str::GameSettings)},{kIconSquare, tr(hidden_.count(g->productId) ? Str::Unhide : Str::Hide)},{kIconCircle, tr(Str::Back)}});diff --git a/src/ui/app_ui.h b/src/ui/app_ui.hindex 9105328..e14b2d0 100644--- a/src/ui/app_ui.h+++ b/src/ui/app_ui.h@@ -58,6 +58,7 @@ struct GameTile {bool detailed = false;uint32_t modes = 0;uint8_t languages = 0;+ uint8_t plan = 0; // xcloud::kPlanEssential..kPlanUltimate (0 for free-to-play or unknown)// Active friends playing this game nowstd::vector<FriendPlaying> friends;};@@ -351,7 +352,7 @@ public:// The search keyboard's focus (row, column), for the tests.std::pair<int, int> searchKeyFocus() const;std::vector<std::pair<std::string, PriceInfo>> searchResults(size_t max) const;- enum class Filter { Free, Cheapest, Console, Mode, Genre, Publisher, Language, MouseKeyboard };+ enum class Filter { Plan, Free, Cheapest, Console, Mode, Genre, Publisher, Language, MouseKeyboard };void chooseFilter(Filter f, int index);// Autoplay tests: where the focus is ("Game Pass row 2 card 6", ...).std::string focusDescription() const;@@ -522,6 +523,7 @@ private:LibrarySort librarySort_ = LibrarySort::Recent;// Search filters (the row of buttons under the keys).bool filterFree_ = false, filterCheapest_ = false, filterMouseKeyboard_ = false;+ int filterPlan_ = 0; // 0 My plan, 1 Ultimate, 2 Premium, 3 Essential, 4 All plansint filterConsole_ = 0; // 0 all, 1 Series X|S, 2 Xbox One, 3 Xbox 360int filterMode_ = 0; // 0 all, single, online multiplayer, online co-op, localstd::string filterGenre_; // empty: alldiff --git a/src/ui/strings.cpp b/src/ui/strings.cppindex 62c677c..4ec8785 100644--- a/src/ui/strings.cpp+++ b/src/ui/strings.cpp@@ -302,6 +302,10 @@ constexpr Column kEnglish = {"Missing a button: %s. Give each one a button, or reset or discard the changes.", // PadMissing"Discard changes", // DiscardChanges"Only the game sees this: the app's menus keep the buttons as they are. Picking a button used by another swaps the two.", // PadHelp+ "Plan", // FilterPlan+ "My plan", // PlanMine+ "All plans", // PlanAll+ "Included with Game Pass %s", // IncludedWithPlan};constexpr Column kPortugueseBR = {@@ -574,6 +578,10 @@ constexpr Column kPortugueseBR = {"Falta botão para: %s. Dê um botão a cada um, ou restaure o padrão ou descarte as alterações.", // PadMissing"Descartar alterações", // DiscardChanges"Só o jogo vê isto: os menus do app usam os botões como são. Escolher um botão já usado troca os dois.", // PadHelp+ "Plano", // FilterPlan+ "Meu plano", // PlanMine+ "Todos os planos", // PlanAll+ "Incluído no Game Pass %s", // IncludedWithPlan};constexpr Column kSpanish = {@@ -846,6 +854,10 @@ constexpr Column kSpanish = {"Falta botón para: %s. Asigna uno a cada función, o restablece o descarta los cambios.", // PadMissing"Descartar cambios", // DiscardChanges"Solo el juego lo ve: los menús de la app usan los botones tal cual. Elegir un botón ya usado intercambia los dos.", // PadHelp+ "Plan", // FilterPlan+ "Mi plan", // PlanMine+ "Todos los planes", // PlanAll+ "Incluido con Game Pass %s", // IncludedWithPlan};constexpr Column kFrench = {@@ -1118,6 +1130,10 @@ constexpr Column kFrench = {"Bouton manquant pour : %s. Attribuez-en un à chaque fonction, ou réinitialisez ou annulez les modifications.", // PadMissing"Annuler les modifications", // DiscardChanges"Seul le jeu est concerné : les menus de l'app gardent les boutons tels quels. Choisir un bouton déjà utilisé échange les deux.", // PadHelp+ "Forfait", // FilterPlan+ "Mon forfait", // PlanMine+ "Tous les forfaits", // PlanAll+ "Inclus avec Game Pass %s", // IncludedWithPlan};constexpr Column kGerman = {@@ -1390,6 +1406,10 @@ constexpr Column kGerman = {"Ohne Taste: %s. Weise jeder Funktion eine zu, oder setze zurück bzw. verwirf die Änderungen.", // PadMissing"Änderungen verwerfen", // DiscardChanges"Gilt nur im Spiel: Die Menüs der App nutzen die Tasten, wie sie sind. Eine schon belegte Taste zu wählen tauscht die beiden.", // PadHelp+ "Abo", // FilterPlan+ "Mein Abo", // PlanMine+ "Alle Abos", // PlanAll+ "In Game Pass %s enthalten", // IncludedWithPlan};constexpr Column kItalian = {@@ -1662,6 +1682,10 @@ constexpr Column kItalian = {"Manca un pulsante per: %s. Assegnane uno a ogni funzione, oppure ripristina o annulla le modifiche.", // PadMissing"Annulla modifiche", // DiscardChanges"Vale solo nel gioco: i menu dell'app usano i pulsanti così come sono. Scegliere un pulsante già usato scambia i due.", // PadHelp+ "Piano", // FilterPlan+ "Il mio piano", // PlanMine+ "Tutti i piani", // PlanAll+ "Incluso con Game Pass %s", // IncludedWithPlan};constexpr std::array<const Column*, kLangs> kTable = {&kEnglish, &kPortugueseBR, &kSpanish,diff --git a/src/ui/strings.h b/src/ui/strings.hindex 7c6fe7a..e46e8b1 100644--- a/src/ui/strings.h+++ b/src/ui/strings.h@@ -279,6 +279,10 @@ enum class Str {PadMissing, // controller buttons: can't leave yet (%s: the Xbox buttons without one, "A, LB")DiscardChanges, // controller buttons: leave without keeping the changesPadHelp, // controller buttons: only the game sees the map; a button already used swaps+ FilterPlan, // search filter: Game Pass plan+ PlanMine, // ... what the account's plan plays+ PlanAll, // ... every Game Pass plan+ IncludedWithPlan, // game page: "%s" = "Ultimate" / "Premium" / "Essential"Count};diff --git a/src/xcloud/catalog.cpp b/src/xcloud/catalog.cppindex 99db049..d9362ee 100644--- a/src/xcloud/catalog.cpp+++ b/src/xcloud/catalog.cpp@@ -21,8 +21,33 @@ std::string describe(const net::Response& r) {return r.status == 0 ? r.error : "HTTP " + std::to_string(r.status);}+uint8_t parsePassPlan(const json::Value& passes) {+ if (passes.has("CFQ7TTC0K5DJ")) return kPlanEssential;+ if (passes.has("CFQ7TTC0P85B")) return kPlanPremium;+ return kPlanUltimate;+}+} // namespace+uint8_t productPlanFromJson(const std::string& passMetadataJson) {+ auto j = json::parse(passMetadataJson);+ return j ? parsePassPlan(*j) : kPlanUltimate;+}++uint8_t planTier(const std::string& subscription) {+ if (subscription == "Essential") return kPlanEssential;+ if (subscription == "Premium") return kPlanPremium;+ if (subscription == "Ultimate") return kPlanUltimate;+ return kPlanNone;+}++bool planIncludes(uint8_t plan, uint8_t gamePlan, bool freeInStore) {+ if (freeInStore) return true;+ if (plan == kPlanNone) return false;+ if (gamePlan == kPlanNone) return true;+ return gamePlan <= plan;+}+bool fetchList(const std::string& siglId, const std::string& market, const std::string& language, ProductList& out,std::string& err) {net::Request req;@@ -86,9 +111,11 @@ 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()));if (full) {- // How it can be played, from the store's attributes.+ // How it can be played, from the store's attributes, and the+ // lowest Game Pass plan that includes it.prod.detailed = true;prod.detailedAt = static_cast<int64_t>(std::time(nullptr));+ prod.plan = parsePassPlan(p["PassMetadataByPassProductId"]);for (const auto& a : p["Attributes"].items()) {std::string n = a["Name"].str();if (n == "SinglePlayer") prod.modes |= kModeSingle;diff --git a/src/xcloud/catalog.h b/src/xcloud/catalog.hindex 117937d..fb1fda3 100644--- a/src/xcloud/catalog.h+++ b/src/xcloud/catalog.h@@ -30,14 +30,31 @@ struct Product {bool detailed = false;int64_t detailedAt = 0; // when the full details were fetched (unix s)uint32_t modes = 0;+ uint8_t plan = 0; // kPlanEssential..kPlanUltimate from PassMetadataByPassProductIdstd::map<std::string, uint8_t> languages;};constexpr uint32_t kModeSingle = 1, kModeOnlineMulti = 2, kModeOnlineCoop = 4, kModeLocal = 8;constexpr uint8_t kLangInterface = 1, kLangSubtitles = 2, kLangAudio = 4;+// The lowest Game Pass plan that includes a Game Pass game+// (PassMetadataByPassProductId in the full product details): Essential plays+// on Essential, Premium and Ultimate; Premium on Premium and Ultimate;+// Ultimate on Ultimate only. 0 = not known yet (or free-to-play / not Game Pass).+constexpr uint8_t kPlanNone = 0, kPlanEssential = 1, kPlanPremium = 2, kPlanUltimate = 3;// The languages kept from a product's list: the app's own.constexpr const char* kKeptLanguages[] = {"en", "pt", "es", "fr", "de", "it"};+// The lowest plan in a product's PassMetadataByPassProductId JSON object+// (Essential CFQ7TTC0K5DJ, Premium CFQ7TTC0P85B, else Ultimate).+uint8_t productPlanFromJson(const std::string& passMetadataJson);+// The tier 1..3 of an account's subscription ("Essential", "Premium",+// "Ultimate"); 0 when none or not one of the cloud plans ("PC", "").+uint8_t planTier(const std::string& subscription);+// Whether a plan of tier `plan` (1..3) includes a Game Pass game of+// `gamePlan` (0 unknown, 1..3); free-to-play games (`freeInStore`) are open+// to every plan and to no plan.+bool planIncludes(uint8_t plan, uint8_t gamePlan, bool freeInStore = false);+// Lists shown on xbox.com/play.namespace sigl {constexpr const char* kRecentlyAdded = "06323672-b8c8-43cc-b0de-32d5a9834749";diff --git a/tests/test_main.cpp b/tests/test_main.cppindex 8d62a56..8f5d023 100644--- a/tests/test_main.cpp+++ b/tests/test_main.cpp@@ -38,6 +38,7 @@#include "platform/platform.h"#include "auth/msa.h"#include "ui/image_cache.h"+#include "xcloud/catalog.h"#include "xcloud/gssv.h"#include "xcloud/titlehub.h"#include "xcloud/prices.h"@@ -853,6 +854,45 @@ static void testSubscriptionPlan() {std::string ends = "{\"entitlements\":{\"CFQ7TTC0KHS0\":{\"status\":\"Active\",\"autoRenew\":false,\"endDate\":\"2026-10-20T00:00:00.0000000Z\"}}}";CHECK(auth::subscriptionRenewal(ends, 1792108800) == "no auto-renew, ends in 4 day(s)"); // from 2026-10-16CHECK(auth::subscriptionRenewal("{\"entitlements\":{}}", 0).empty());++ // Catalog plan tiers from PassMetadataByPassProductId, and search Plan filter.+ using namespace xcloud;+ auto pass = [](const char* text) { return productPlanFromJson(text); };+ CHECK(pass(R"({"CFQ7TTC0K5DJ":{},"CFQ7TTC0P85B":{},"CFQ7TTC0KHS0":{}})") == kPlanEssential);+ CHECK(pass(R"({"CFQ7TTC0P85B":{},"CFQ7TTC0KHS0":{}})") == kPlanPremium);+ CHECK(pass(R"({"CFQ7TTC0KHS0":{},"CFQ7TTC0K5DH":{}})") == kPlanUltimate);+ CHECK(pass(R"({})") == kPlanUltimate);+ CHECK(planTier("Essential") == kPlanEssential && planTier("Premium") == kPlanPremium &&+ planTier("Ultimate") == kPlanUltimate && planTier("PC") == kPlanNone && planTier("") == kPlanNone);+ CHECK(planIncludes(kPlanEssential, kPlanEssential, false) && !planIncludes(kPlanEssential, kPlanPremium, false) &&+ !planIncludes(kPlanEssential, kPlanUltimate, false) && planIncludes(kPlanEssential, kPlanUltimate, true));+ CHECK(planIncludes(kPlanPremium, kPlanEssential, false) && planIncludes(kPlanPremium, kPlanPremium, false) &&+ !planIncludes(kPlanPremium, kPlanUltimate, false));+ CHECK(planIncludes(kPlanUltimate, kPlanEssential, false) && planIncludes(kPlanUltimate, kPlanPremium, false) &&+ planIncludes(kPlanUltimate, kPlanUltimate, false));++ ui::Fonts fonts;+ ui::ImageCache images([] {});+ ui::AppUi app(fonts, images);+ ui::GameTile ess, prem, ult, f2p;+ ess.productId = "ESS", ess.name = "Alpha", ess.plan = kPlanEssential, ess.playable = true;+ prem.productId = "PREM", prem.name = "Beta", prem.plan = kPlanPremium, prem.playable = true;+ ult.productId = "ULT", ult.name = "Gamma", ult.plan = kPlanUltimate, ult.playable = false;+ f2p.productId = "F2P", f2p.name = "Delta", f2p.plan = kPlanNone, f2p.freeInStore = true, f2p.playable = false;+ app.setSubscription("Premium");+ app.setSearchPools({ess, prem, ult, f2p}, {});+ app.showFilteredSearch(ui::Tab::GamePass, false, 0, "", 0, -1);+ app.chooseFilter(ui::AppUi::Filter::Plan, 3); // Essential: Alpha + Delta (free-to-play)+ CHECK(app.searchResults(10).size() == 2);+ app.chooseFilter(ui::AppUi::Filter::Plan, 2); // Premium: Alpha + Beta + Delta+ CHECK(app.searchResults(10).size() == 3);+ app.chooseFilter(ui::AppUi::Filter::Plan, 1); // Ultimate: all 4+ CHECK(app.searchResults(10).size() == 4);+ app.chooseFilter(ui::AppUi::Filter::Plan, 4); // All plans: all 4+ CHECK(app.searchResults(10).size() == 4);+ app.chooseFilter(ui::AppUi::Filter::Plan, 0); // My plan (Premium), with query "a": Alpha, Beta, Delta (not Gamma)+ app.typeText("a");+ CHECK(app.searchResults(10).size() == 3);}static void testHostPacer() {