Skip to content

Xbox Cloud Gaming app for PS5 Homebrew

C

Hidden games stay in their tab; L2 / R2 jump between sections

Rafael Abud Ferreira08d9a6de7920
diff --git a/src/app/cli_main.cpp b/src/app/cli_main.cpp
index 4b4288d..be65060 100644
--- a/src/app/cli_main.cpp
+++ b/src/app/cli_main.cpp
@@ -645,6 +645,30 @@ int main(int argc, char** argv) {
save("library_console");
press([](ui::NavInput& n) { n.down = true; }, 3); // down to "Hidden"
save("library_hidden");
+ press([](ui::NavInput& n) { n.up = true; }, 6); // back to the top of Your games
+ press([](ui::NavInput& n) { n.r2 = true; }, 2); // jump: to buy, then Hidden
+ save("library_r2");
+ {
+ // Game Pass: hide the second game of the first row; it goes to a
+ // "Hidden" row at the end of that tab.
+ ui::GameRow row;
+ row.title = "Recently added";
+ for (int i = 0; i < 4; ++i) {
+ ui::GameTile t;
+ t.productId = "GP" + std::to_string(i);
+ t.titleId = t.productId;
+ t.name = "Game Pass game " + std::to_string(i);
+ t.platform = platforms[i % 3];
+ row.tiles.push_back(t);
+ }
+ app.setRows({row});
+ press([](ui::NavInput& n) { n.l1 = true; });
+ press([](ui::NavInput& n) { n.right = true; });
+ press([](ui::NavInput& n) { n.square = true; });
+ press([](ui::NavInput& n) { n.down = true; });
+ save("gamepass_hidden");
+ press([](ui::NavInput& n) { n.r1 = true; });
+ }
press([](ui::NavInput& n) { n.triangle = true; }); // search "Your games"
press([](ui::NavInput& n) { n.down = true; }, 7); // the filter row
press([](ui::NavInput& n) { n.right = true; }); // "Lowest price"
diff --git a/src/app/ps5_main.cpp b/src/app/ps5_main.cpp
index d13ed72..257244a 100644
--- a/src/app/ps5_main.cpp
+++ b/src/app/ps5_main.cpp
@@ -695,6 +695,8 @@ int main(int argc, char** argv) {
nav.square = pad.btnX && !prev.btnX; // Square (Xbox X)
nav.triangle = pad.btnY && !prev.btnY; // Triangle (Xbox Y)
nav.r3 = pad.btnR3 && !prev.btnR3;
+ nav.l2 = pad.triggerL2 > 0.5f && prev.triggerL2 <= 0.5f;
+ nav.r2 = pad.triggerR2 > 0.5f && prev.triggerR2 <= 0.5f;
nav.touchpad = pad.btnTouchpad;
nav.nowMs = now;
prev = pad;
diff --git a/src/ui/app_ui.cpp b/src/ui/app_ui.cpp
index d15e211..8620656 100644
--- a/src/ui/app_ui.cpp
+++ b/src/ui/app_ui.cpp
@@ -42,7 +42,7 @@ constexpr Color kGreen = rgba(16, 124, 16);
constexpr Color kPanel = rgba(36, 36, 36);
constexpr Color kPlaceholder = rgba(44, 44, 44);
-enum Icon { kIconCross, kIconCircle, kIconOptions, kIconTriangle, kIconTouchpad, kIconSquare, kIconR3 };
+enum Icon { kIconCross, kIconCircle, kIconOptions, kIconTriangle, kIconTouchpad, kIconSquare, kIconR3, kIconL2R2 };
// The resolution list, lowest first: SettingsChoice::resolution value per
// position (0 = 1080p, 1 = 720p, 2 = 1440p, as saved).
@@ -266,17 +266,24 @@ void AppUi::rebuild() {
};
owned_ = sorted(visible(allOwned_));
purchasable_ = sorted(visible(allPurchasable_));
- // Hidden games, from wherever they appear, once each, A-Z.
- hiddenTiles_.clear();
+ // Hidden games stay in their tab, at its end: the account's games and
+ // games to buy in "Your games", Game Pass games in a last Game Pass row
+ // (a few rows away, not past ~2000 games to buy). Once each, A-Z.
std::set<std::string> seen;
- auto collect = [&](const GameTile& t) {
- if (hidden_.count(t.productId) && seen.insert(t.productId).second) hiddenTiles_.push_back(t);
+ auto collect = [&](std::vector<GameTile>& into, const GameTile& t) {
+ if (hidden_.count(t.productId) && seen.insert(t.productId).second) into.push_back(t);
};
- for (const auto* list : {&allOwned_, &allPurchasable_, &gamePassPool_})
- for (const auto& t : *list) collect(t);
- for (const auto& row : allRows_)
- for (const auto& t : row.tiles) collect(t);
+ hiddenTiles_.clear();
+ for (const auto* list : {&allOwned_, &allPurchasable_})
+ for (const auto& t : *list) collect(hiddenTiles_, t);
std::stable_sort(hiddenTiles_.begin(), hiddenTiles_.end(), byName);
+ GameRow hiddenRow;
+ hiddenRow.title = tr(Str::HiddenSection);
+ hiddenRow.gamePassBadges = true;
+ for (const auto& row : allRows_)
+ for (const auto& t : row.tiles) collect(hiddenRow.tiles, t);
+ for (const auto& t : gamePassPool_) collect(hiddenRow.tiles, t);
+ std::stable_sort(hiddenRow.tiles.begin(), hiddenRow.tiles.end(), byName);
std::vector<GameRow> rows;
for (const auto& row : allRows_) {
@@ -284,6 +291,7 @@ void AppUi::rebuild() {
r.tiles = visible(row.tiles);
rows.push_back(std::move(r));
}
+ if (!hiddenRow.tiles.empty()) rows.push_back(std::move(hiddenRow));
setRowsLocked(std::move(rows));
gridFocus_ = 0;
@@ -787,6 +795,37 @@ void AppUi::handleHome(const NavInput& in, UiEvent& ev) {
GameTile t = *libraryTile(f);
toggleHidden(t, ev);
}
+ if (in.l2 || in.r2) {
+ // Jump between sections: the account's games, games to buy,
+ // hidden games. L2 goes to the start of this section first.
+ int starts[3] = {0, static_cast<int>(owned_.size()),
+ static_cast<int>(owned_.size() + purchasable_.size())};
+ int total = starts[2] + static_cast<int>(hiddenTiles_.size());
+ int section = f >= starts[2] ? 2 : f >= starts[1] ? 1 : 0;
+ int target = f;
+ if (in.r2) {
+ for (int k = section + 1; k < 3; ++k)
+ if (starts[k] < total && (k == 2 ? !hiddenTiles_.empty() : starts[k] < starts[k + 1])) {
+ target = starts[k];
+ break;
+ }
+ } else if (f != starts[section]) {
+ target = starts[section];
+ } else {
+ for (int k = section - 1; k >= 0; --k)
+ if (starts[k] < starts[k + 1]) {
+ target = starts[k];
+ break;
+ }
+ }
+ if (target != f) {
+ gridFocus_ = target;
+ int y = L.rowY[static_cast<size_t>(L.rowOf[static_cast<size_t>(target)])];
+ // The section's heading in view.
+ gridScroll_.target = static_cast<float>(std::max(0, y - (target ? kSectionHeaderH + 20 : 0)));
+ dirty_ = true;
+ }
+ }
if (in.r3) { // next sort order
librarySort_ = static_cast<LibrarySort>((static_cast<int>(librarySort_) + 1) %
static_cast<int>(LibrarySort::Count));
@@ -995,7 +1034,13 @@ void AppUi::drawHints(Canvas& c, const std::vector<std::pair<int, const char*>>&
fonts_.semibold.draw(c, it->second, x, y, kPx, kGray);
x -= 10 + 2 * kR;
float cx = x + kR, cy = y + 13;
- if (it->first == kIconR3) {
+ if (it->first == kIconL2R2) {
+ Rect pill{x - 40, static_cast<int>(cy) - 12, 2 * kR + 46, 24};
+ c.fillRect(pill, rgba(255, 255, 255, 40), 8);
+ fonts_.bold.draw(c, "L2 R2", pill.x + (pill.w - fonts_.bold.measure("L2 R2", 14)) / 2,
+ fonts_.bold.centeredY(pill.y, pill.h, 14), 14, kGray);
+ x -= 34;
+ } else if (it->first == kIconR3) {
Rect pill{x - 6, static_cast<int>(cy) - 12, 2 * kR + 12, 24};
c.fillRect(pill, rgba(255, 255, 255, 40), 8);
fonts_.bold.draw(c, "R3", pill.x + (pill.w - fonts_.bold.measure("R3", 14)) / 2,
@@ -1327,8 +1372,8 @@ void AppUi::drawLibrary(Canvas& c, uint64_t nowMs) {
{kIconSquare, tr(focusHidden ? Str::Unhide : Str::Hide)},
{kIconTriangle, tr(Str::TabSearch)},
{kIconR3, tr(Str::SortHint)},
- {kIconOptions, tr(Str::Settings)},
- {kIconTouchpad, tr(Str::HoldSignOut)}});
+ {kIconL2R2, tr(Str::Sections)},
+ {kIconOptions, tr(Str::Settings)}});
drawToast(c, nowMs);
}
@@ -1460,13 +1505,14 @@ void AppUi::drawHome(Canvas& c, uint64_t nowMs) {
if (x + kCard < 0) continue;
bool focused = static_cast<int>(r) == focusRow_ && static_cast<int>(col) == focusCol_[r];
drawCard(c, row.tiles[col], x, cardY, focused, row.gamePassBadges);
+ if (hidden_.count(row.tiles[col].productId)) c.fillRect({x, cardY, kCard, kCard}, rgba(0, 0, 0, 120), 10);
}
}
// Fade the rows out under the button hints.
c.gradientV({0, kH - 190, kW, 110}, withAlpha(kBg, 0), withAlpha(kBg, 245));
c.fillRect({0, kH - 80, kW, 80}, withAlpha(kBg, 245));
drawHints(c, {{kIconCross, tr(Str::Select)},
- {kIconSquare, tr(Str::Hide)},
+ {kIconSquare, tr(focus && hidden_.count(focus->productId) ? Str::Unhide : Str::Hide)},
{kIconTriangle, tr(Str::TabSearch)},
{kIconOptions, tr(Str::Settings)},
{kIconTouchpad, tr(Str::HoldSignOut)}});
diff --git a/src/ui/app_ui.h b/src/ui/app_ui.h
index 91f93b6..d441dfb 100644
--- a/src/ui/app_ui.h
+++ b/src/ui/app_ui.h
@@ -57,6 +57,7 @@ struct NavInput {
bool up = false, down = false, left = false, right = false;
bool accept = false, back = false, options = false;
bool l1 = false, r1 = false, square = false, triangle = false, r3 = false;
+ bool l2 = false, r2 = false; // pressed (triggers past halfway)
bool touchpad = false; // held right now (sign out needs a 5 s hold)
uint64_t nowMs = 0;
};
diff --git a/src/ui/strings.cpp b/src/ui/strings.cpp
index 767f9cb..3e7405e 100644
--- a/src/ui/strings.cpp
+++ b/src/ui/strings.cpp
@@ -100,7 +100,7 @@ constexpr Column kEnglish = {
"Show", // Unhide
"Hidden", // HiddenSection
"Square shows a game again", // HiddenHint
- "Hidden: find it in Your games > Hidden", // HiddenToast
+ "Hidden: find it under Hidden, at the end of this tab", // HiddenToast
"Shown again", // UnhiddenToast
"Sort: %s", // SortLabel
"Recent first", // SortRecent
@@ -112,6 +112,7 @@ constexpr Column kEnglish = {
"On sale", // FilterSale
"All consoles", // FilterAllConsoles
"1 game", // OneGame
+ "Sections", // Sections
};
constexpr Column kPortugueseBR = {
@@ -182,7 +183,7 @@ constexpr Column kPortugueseBR = {
"Mostrar",
"Ocultos",
"\xE2\x96\xA1 mostra o jogo de novo",
- "Oculto: veja em Seus jogos > Ocultos",
+ "Oculto: veja em Ocultos, no fim desta aba",
"Visível de novo",
"Ordenar: %s",
"Recentes primeiro",
@@ -194,6 +195,7 @@ constexpr Column kPortugueseBR = {
"Em promoção",
"Todos os consoles",
"1 jogo",
+ "Seções",
};
constexpr Column kSpanish = {
@@ -264,7 +266,7 @@ constexpr Column kSpanish = {
"Mostrar",
"Ocultos",
"\xE2\x96\xA1 vuelve a mostrar un juego",
- "Oculto: búscalo en Tus juegos > Ocultos",
+ "Oculto: está en Ocultos, al final de esta pestaña",
"Visible de nuevo",
"Ordenar: %s",
"Recientes primero",
@@ -276,6 +278,7 @@ constexpr Column kSpanish = {
"En oferta",
"Todas las consolas",
"1 juego",
+ "Secciones",
};
constexpr Column kFrench = {
@@ -346,7 +349,7 @@ constexpr Column kFrench = {
"Afficher",
"Masqués",
"\xE2\x96\xA1 réaffiche un jeu",
- "Masqué : voir Vos jeux > Masqués",
+ "Masqué : voir Masqués, à la fin de cet onglet",
"De nouveau visible",
"Trier : %s",
"Récents d'abord",
@@ -358,6 +361,7 @@ constexpr Column kFrench = {
"En promotion",
"Toutes les consoles",
"1 jeu",
+ "Sections",
};
constexpr Column kGerman = {
@@ -428,7 +432,7 @@ constexpr Column kGerman = {
"Einblenden",
"Ausgeblendet",
"\xE2\x96\xA1 blendet ein Spiel wieder ein",
- "Ausgeblendet: unter Deine Spiele > Ausgeblendet",
+ "Ausgeblendet: unter Ausgeblendet, am Ende dieses Tabs",
"Wieder sichtbar",
"Sortieren: %s",
"Zuletzt gespielt",
@@ -440,6 +444,7 @@ constexpr Column kGerman = {
"Im Angebot",
"Alle Konsolen",
"1 Spiel",
+ "Abschnitte",
};
constexpr Column kItalian = {
@@ -510,7 +515,7 @@ constexpr Column kItalian = {
"Mostra",
"Nascosti",
"\xE2\x96\xA1 mostra di nuovo un gioco",
- "Nascosto: lo trovi in I tuoi giochi > Nascosti",
+ "Nascosto: lo trovi in Nascosti, in fondo a questa scheda",
"Di nuovo visibile",
"Ordina: %s",
"Recenti prima",
@@ -522,6 +527,7 @@ constexpr Column kItalian = {
"In offerta",
"Tutte le console",
"1 gioco",
+ "Sezioni",
};
constexpr std::array<const Column*, kLangs> kTable = {&kEnglish, &kPortugueseBR, &kSpanish,
diff --git a/src/ui/strings.h b/src/ui/strings.h
index ab8d6ec..cef509b 100644
--- a/src/ui/strings.h
+++ b/src/ui/strings.h
@@ -89,6 +89,7 @@ enum class Str {
FilterSale,
FilterAllConsoles,
OneGame, // GamesCount for exactly one
+ Sections, // hint for L2 / R2: jump between sections
Count
};