Xbox Cloud Gaming app for PS5 Homebrew
C
feat: add card playtime badge, non-trimming queue chime, and detail test fix
Rafael Abud Ferreiraa4046cb4bcb7
diff --git a/src/app/autoplay.cpp b/src/app/autoplay.cppindex 65e67d0..a4e0650 100644--- a/src/app/autoplay.cpp+++ b/src/app/autoplay.cpp@@ -883,7 +883,8 @@ void autoplayScreens(const ui::Canvas& canvas, uint64_t now) {// page must fill in on its own. Or the game named, when known.static uint64_t openedAt = 0;ui::GameTile tile;- if (!openedAt && (g_ui->findTile("FORTNITE", tile) || g_ui->firstTile(tile) || g_ui->purchasableAt(40, tile))) {+ if (!openedAt && (g_ui->findTile(g_autoplay.title, tile) || g_ui->findTile("FORTNITE", tile) ||+ g_ui->purchasableAt(40, tile) || g_ui->firstTile(tile))) {XC_LOGI("autoplay: opening %s (%s)", tile.name.c_str(), tile.productId.c_str());ui::SettingsChoice c = g_ui->settings();if (!tile.productId.empty()) c.titlePlaytime[tile.productId] = 5520;@@ -919,7 +920,18 @@ void autoplayScreens(const ui::Canvas& canvas, uint64_t now) {}}if (!g_autoplay.title.empty() && !uiSaved && g_ui->screen() == ui::Screen::Home) {- if (!homeSince) homeSince = now;+ if (!homeSince) {+ homeSince = now;+ if (g_autoplay.detailTest) {+ ui::GameTile first;+ if (g_ui->firstTile(first)) {+ ui::SettingsChoice c = g_ui->settings();+ if (!first.productId.empty()) c.titlePlaytime[first.productId] = 5520;+ if (!first.titleId.empty()) c.titlePlaytime[first.titleId] = 5520;+ g_ui->setSettings(c);+ }+ }+ }uint64_t waitMs = g_autoplay.friendsTest ? 8000 : 5000;if (now - homeSince > waitMs) {uiSaved = true;diff --git a/src/app/worker.cpp b/src/app/worker.cppindex a0eb118..46fc289 100644--- a/src/app/worker.cpp+++ b/src/app/worker.cpp@@ -93,7 +93,17 @@ void playQueueReadyAlert() {}media::audioStart();- media::audioPush(pcm.data(), pcm.size() / 2);+ std::thread([pcm = std::move(pcm)]() {+ constexpr size_t kChunkFrames = (kRate * 20) / 1000; // 20 ms per push ( stays well below 250 ms trim )+ size_t totalFrames = pcm.size() / 2;+ size_t offset = 0;+ while (offset < totalFrames) {+ size_t n = std::min(kChunkFrames, totalFrames - offset);+ media::audioPush(pcm.data() + offset * 2, n);+ offset += n;+ if (offset < totalFrames) platform::sleepMs(18);+ }+ }).detach();// 3. System notification toastplatform::notify(ui::tr(ui::Str::QueueReadyAlert));diff --git a/src/ui/app_ui.cpp b/src/ui/app_ui.cppindex a89bc20..b4bce3c 100644--- a/src/ui/app_ui.cpp+++ b/src/ui/app_ui.cpp@@ -3134,6 +3134,24 @@ 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);}+ // Top-left: time played on this title, when recorded.+ uint64_t cardPlayedSec = 0;+ if (!t.productId.empty()) {+ auto it = settings_.titlePlaytime.find(t.productId);+ if (it != settings_.titlePlaytime.end()) cardPlayedSec = it->second;+ }+ if (!cardPlayedSec && !t.titleId.empty()) {+ auto it = settings_.titlePlaytime.find(t.titleId);+ if (it != settings_.titlePlaytime.end()) cardPlayedSec = it->second;+ }+ if (cardPlayedSec > 0) {+ std::string ptLabel = formatPlaytime(cardPlayedSec);+ int pw = std::min(kCard - 56, fonts_.bold.measure(ptLabel, 11) + 14);+ Rect ptBadge{x + 10, y + 10, pw, 22};+ c.fillRect(ptBadge, rgba(0, 0, 0, 215), 4);+ fonts_.bold.draw(c, ptLabel, ptBadge.x + (ptBadge.w - fonts_.bold.measure(ptLabel, 11)) / 2,+ fonts_.bold.centeredY(ptBadge.y, ptBadge.h, 11), 11, kWhite);+ }// 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.