Xbox Cloud Gaming app for PS5 Homebrew
C
feat(ui,audio): add DualSense speaker queue alert, wishlist filter and card badge layout
Rafael Abud Ferreira16dd17501540
diff --git a/src/app/app_core.cpp b/src/app/app_core.cppindex 3451e7b..b74c89d 100644--- a/src/app/app_core.cpp+++ b/src/app/app_core.cpp@@ -96,11 +96,14 @@ void applyControllerSettings() {// the language changed.bool saveSettings(const ui::SettingsChoice& choice) {bool languageChanged, fullscreenChanged;+ bool queueAlertToggledOn = false;{std::lock_guard<std::mutex> lock(g_settingsMutex);std::string language = g_settings.language;bool fullscreen = g_settings.desktopFullscreen;+ bool prevQueue = g_settings.queueReadyAlert;ui::applyChoice(choice, g_settings);+ queueAlertToggledOn = !prevQueue && g_settings.queueReadyAlert;languageChanged = g_settings.language != language;fullscreenChanged = g_settings.desktopFullscreen != fullscreen;g_settings.save(settingsPath()); // warns itself@@ -108,6 +111,10 @@ bool saveSettings(const ui::SettingsChoice& choice) {g_settings.region.empty() ? "auto" : g_settings.region.c_str());}applyControllerSettings();+ if (queueAlertToggledOn) {+ XC_LOGI("settings: queue-ready alert toggled on; playing test chime and rumble");+ playQueueReadyAlert();+ }if (g_ui) g_ui->setGyroDefaults(choice.gyroMode, choice.gyroLevel);if (fullscreenChanged) shell::setFullscreen(choice.fullscreen); // a desktop's window (main thread)return languageChanged;@@ -716,6 +723,11 @@ bool Core::frame() {if (!g_command.compare_exchange_strong(idle, kNetworkTest)) XC_LOGW("network test: worker is busy");break;}+ case ui::Action::TestQueueAlert: {+ XC_LOGI("settings: manual queue-ready alert test requested");+ playQueueReadyAlert();+ break;+ }case ui::Action::None: break;}diff --git a/src/app/app_state.h b/src/app/app_state.hindex fe5af10..7091930 100644--- a/src/app/app_state.h+++ b/src/app/app_state.h@@ -45,6 +45,8 @@ extern ui::GameTile g_playTile; // what kPlay playsvoid worker();// The worker thread started (detached), as coreStartup() does.void startWorker();+// Plays the queue-ready chime through the DualSense speaker and vibrates.+void playQueueReadyAlert(bool notifyToast = false);// The update pop-up's "Not now": that release isn't offered again on start.void skipOfferedUpdate();// Updates the running library's favorites list and refreshes UI rows.diff --git a/src/app/autoplay.cpp b/src/app/autoplay.cppindex 2e92f84..3a2d096 100644--- a/src/app/autoplay.cpp+++ b/src/app/autoplay.cpp@@ -98,6 +98,9 @@ void loadAutoplay() {if (opt == "idle") g_autoplay.idle = true;if (opt == "rumbletest") input::setRumble(200, 200, 1500);if (opt == "triggertest") input::setTriggerRumble(255, 128, 3000);+ if (opt == "queuetest" || opt == "padspktest") g_autoplay.padSpkTest = true;+ if (opt == "queueuitest") g_autoplay.queueUiTest = true;+ if (opt == "wishlisttest") g_autoplay.wishlistTest = true;if (opt == "vibetest") g_autoplay.vibeTest = true;if (opt == "vktest") g_autoplay.vkTest = true;if (opt == "cpudisplay") g_autoplay.cpuDisplay = true;@@ -796,6 +799,36 @@ void autoplayNav(ui::NavInput& nav, bool& menuCombo, uint64_t now) {}}+ if (g_autoplay.queueUiTest && uiSaved) {+ static uint64_t since = 0;+ static int step = 0;+ if (!since) since = now;+ static SettingsWalk walk;+ const uint64_t at[] = {500, 1500, 6000, 7500, 9000};+ if (step < 5 && now - since >= at[step]) {+ bool next = true;+ if (step == 0) nav.options = true;+ if (step == 1) next = walk.step(nav, downsTo(16));+ if (step == 2) {+ if (onSettingsRow(16, "queue ui test")) {+ settingsShot = true;+ } else {+ g_autoplay.queueUiTest = false;+ g_ui->showHome();+ }+ }+ if (step == 3) {+ nav.square = true; // Trigger test sound with Square+ }+ if (step == 4) {+ g_ui->showHome();+ g_autoplay.queueUiTest = false;+ XC_LOGI("AUTOPLAY END: queue ui test completed");+ }+ if (next) ++step;+ }+ }+if (g_autoplay.donationTest && uiSaved) {static uint64_t since = 0;static int step = 0;@@ -1062,6 +1095,15 @@ void autoplayScreens(const ui::Canvas& canvas, uint64_t now) {XC_LOGI("AUTOPLAY END: confirm test, on the %s screen (the confirm button put back as it was)",home ? "home" : "WRONG");}+ if (g_autoplay.padSpkTest && uiSaved) {+ static bool done = false;+ if (!done) {+ done = true;+ XC_LOGI("AUTOPLAY: triggering pad speaker alert test");+ playQueueReadyAlert();+ XC_LOGI("AUTOPLAY END: padspktest triggered");+ }+ }if (g_autoplay.crashTest && uiSaved) {XC_LOGI("AUTOPLAY END: crash test (SIGSEGV now)");volatile int* nullPtr = nullptr;@@ -1133,6 +1175,34 @@ void autoplayScreens(const ui::Canvas& canvas, uint64_t now) {XC_LOGI("AUTOPLAY END: publisher test");}}+ if (g_autoplay.wishlistTest && uiSaved) {+ static uint64_t since = 0;+ static int step = 0;+ if (!since) since = now;+ if (step == 0 && now - since > 2000) {+ // Open filtered search on Library tab with Wishlist filter+ g_ui->showFilteredSearch(ui::Tab::Library, false, 0, "", 0, -1);+ g_ui->chooseFilter(ui::AppUi::Filter::Wishlist, 1);+ ++step;+ } else if (step == 1 && now - since > 4000) {+ saveCanvas("wishlist_empty.ppm");+ // If any purchasable tile exists, add to wishlist and verify+ ui::GameTile t;+ if (g_ui->purchasableAt(0, t)) {+ ui::UiEvent ev;+ g_ui->toggleWishlist(t, ev);+ g_ui->showFilteredSearch(ui::Tab::Library, false, 0, "", 0, -1);+ g_ui->chooseFilter(ui::AppUi::Filter::Wishlist, 1);+ }+ ++step;+ } else if (step == 2 && now - since > 6000) {+ saveCanvas("wishlist_active.ppm");+ g_ui->showHome();+ g_autoplay.wishlistTest = false;+ XC_LOGI("AUTOPLAY END: wishlist test");+ ++step;+ }+ }if (g_autoplay.friendsTest && uiSaved) {static uint64_t since = 0;if (!since) since = now;diff --git a/src/app/autoplay.h b/src/app/autoplay.hindex ca3587a..0dc7f04 100644--- a/src/app/autoplay.h+++ b/src/app/autoplay.h@@ -43,6 +43,9 @@ struct Autoplay {bool badCa = false; // "badca": a missing CA bundle: the built-in copy must be usedbool consoles = false; // "consoles": log the account's own consoles (xhome)bool pad = false; // "pad": the physical pad stays in use, its buttons logged+ bool padSpkTest = false; // "padspktest": play queue-ready chime and vibration on controller speaker+ bool queueUiTest = false; // "queueuitest": open settings, focus queueReadyAlert row, test sound with Square+ bool wishlistTest = false; // "wishlisttest": test wishlist filter, empty state, and active wishlisted itemsbool detailTest = false; // open a game to buy far down the list, save its pagebool libraryTest = false; // open "Your games", save it at 4 s and 25 sbool vkTest = false; // the GPU presenting instead of the CPU displaydiff --git a/src/app/library.cpp b/src/app/library.cppindex d9127da..ec94e75 100644--- a/src/app/library.cpp+++ b/src/app/library.cpp@@ -268,25 +268,6 @@ std::vector<ui::GameRow> Library::rows() const {}}- // Insert "Wishlist" row right after Favorites (or at top) if any are marked- if (!wishlist_.empty()) {- ui::GameRow wishRow;- wishRow.title = ui::tr(ui::Str::Wishlist);- wishRow.gamePassBadges = false;- wishRow.isGrid = false;- for (const auto& pid : wishlist_) {- ui::GameTile t = tile(pid);- if (!t.productId.empty()) {- wishRow.tiles.push_back(std::move(t));- }- }- if (!wishRow.tiles.empty()) {- size_t insertIdx = !favorites_.empty() ? 1 : 0;- if (insertIdx <= rows.size()) rows.insert(rows.begin() + static_cast<long>(insertIdx), std::move(wishRow));- else rows.push_back(std::move(wishRow));- }- }-return rows;}diff --git a/src/app/worker.cpp b/src/app/worker.cppindex eb3ae66..e54a021 100644--- a/src/app/worker.cpp+++ b/src/app/worker.cpp@@ -63,7 +63,21 @@ std::string formatWait(int seconds) {return std::to_string((seconds + 59) / 60) + " min";}-void playQueueReadyAlert() {+// Set by stream(): the game quit on the server before its first frame.+bool g_gameClosedOnServer = false;+// Titles that would not start in the automatic region, and where they did+// (for the rest of this run).+std::map<std::string, std::string> g_regionFallback;+std::shared_ptr<app::Library> s_library;+std::mutex s_libraryMutex;+// Cloud playtime telemetry in seconds (-1 unknown/uncapped).+// STRICTLY INFORMATIVE: The client never blocks gameplay, streams, or launches+// based on playtime telemetry, as Microsoft does not enforce client-side blocking.+int64_t s_playtimeRemainingSeconds = -1;++} // namespace++void playQueueReadyAlert(bool notifyToast) {// 1. DualSense rumble pulseinput::setRumble(180, 180, 500, 0);@@ -90,7 +104,7 @@ void playQueueReadyAlert() {float sec = static_cast<float>(i) / static_cast<float>(kRate);float attack = std::min(1.0f, sec / 0.005f);float decay = std::exp(-decayRate * sec);- float env = attack * decay * 0.45f;+ float env = attack * decay * 0.70f;float s = std::sin(2.0f * kPi * freq * sec) + 0.25f * std::sin(4.0f * kPi * freq * sec);float sample = s * env;pcm.push_back(sample); // Left@@ -98,37 +112,15 @@ void playQueueReadyAlert() {}}- media::audioStart();- 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();+ // Play directly through the DualSense controller speaker (falls back to main audio)+ media::playPadSpeakerAudio(pcm.data(), pcm.size() / 2);- // 3. System notification toast- platform::notify(ui::tr(ui::Str::QueueReadyAlert));+ // 3. System notification toast (only when stream queue actually finishes)+ if (notifyToast) {+ platform::notify(ui::tr(ui::Str::QueueReadyAlert));+ }}-// Set by stream(): the game quit on the server before its first frame.-bool g_gameClosedOnServer = false;-// Titles that would not start in the automatic region, and where they did-// (for the rest of this run).-std::map<std::string, std::string> g_regionFallback;-std::shared_ptr<app::Library> s_library;-std::mutex s_libraryMutex;-// Cloud playtime telemetry in seconds (-1 unknown/uncapped).-// STRICTLY INFORMATIVE: The client never blocks gameplay, streams, or launches-// based on playtime telemetry, as Microsoft does not enforce client-side blocking.-int64_t s_playtimeRemainingSeconds = -1;--} // namespace-void updateLibraryFavorites(const std::vector<std::string>& favorites) {std::shared_ptr<app::Library> lib;{@@ -589,8 +581,8 @@ std::string play(auth::AuthManager& am, xcloud::GssvClient& gssv, const ui::GamealertOn = g_settings.queueReadyAlert;}if (alertOn && wasInQueue) {- XC_LOGI("session: queue completed and provisioned; triggering queue-ready chime and rumble");- playQueueReadyAlert();+ XC_LOGI("session: queue completed and provisioned; triggering queue-ready chime and rumble on DualSense");+ playQueueReadyAlert(true);}g_ui->setLaunchStatus(ui::tr(ui::Str::StartingStream));result = stream(gssv);diff --git a/src/media/audio_out.h b/src/media/audio_out.hindex 0fc3e97..ba77361 100644--- a/src/media/audio_out.h+++ b/src/media/audio_out.h@@ -22,5 +22,8 @@ void audioSetVolume(float gain);// Past ~60 ms queued (a burst from the network) cuts back to ~40 ms, the// oldest samples first, to keep the sound close to the picture.void audioPush(const float* interleaved, size_t frames);+// Plays a short audio sample or chime directly through the DualSense controller speaker,+// falling back to main output if the pad speaker port is not available.+bool playPadSpeakerAudio(const float* interleavedStereo, size_t frames);} // namespace xc::mediadiff --git a/src/media/audio_out_null.cpp b/src/media/audio_out_null.cppindex 95b2514..324fe45 100644--- a/src/media/audio_out_null.cpp+++ b/src/media/audio_out_null.cpp@@ -28,4 +28,10 @@ void audioStop() {audioQueue().clear();}+bool playPadSpeakerAudio(const float* interleavedStereo, size_t frames) {+ if (!interleavedStereo || frames == 0) return false;+ audioQueue().push(interleavedStereo, frames);+ return true;+}+} // namespace xc::mediadiff --git a/src/media/audio_out_ps5.cpp b/src/media/audio_out_ps5.cppindex 965fefd..2bbe061 100644--- a/src/media/audio_out_ps5.cpp+++ b/src/media/audio_out_ps5.cpp@@ -22,6 +22,8 @@ int sceAudioOutInit(void);int sceAudioOutOpen(int userId, int type, int index, unsigned len, unsigned freq, unsigned param);int sceAudioOutOutput(int handle, const void* ptr);int sceAudioOutClose(int handle);+int sceAudioOutSetMixLevelPadSpk(int handle, int mixLevel);+int sceAudioOutSetPadSpkVolume(int handle, int volume);}namespace xc::media {@@ -118,4 +120,109 @@ void audioStop() {audioQueue().clear();}+bool playPadSpeakerAudio(const float* interleavedStereo, size_t frames) {+ if (!interleavedStereo || frames == 0) return false;++ std::thread([pcm = std::vector<float>(interleavedStereo, interleavedStereo + frames * 2)]() {+ platform::setThreadAffinity(platform::ThreadRole::Audio, "ps5_pad_audio");++ static bool initialised = false;+ if (!initialised) {+ int rc = sceAudioOutInit();+ if (rc >= 0 || rc == static_cast<int>(0x8026000C) || rc == static_cast<int>(0x8026000E)) {+ initialised = true;+ }+ }++ int32_t userId = input::padUserId(0);+ if (userId < 0) userId = 0xFF;++ int padHandle = -1;+ int activeFormat = -1;+ // Formats: 3 = FloatMono (native DualSense pad speaker), 4 = FloatStereo, 0 = S16Mono, 1 = S16Stereo+ const int formatsToTry[] = {3, 4, 0, 1};+ for (int fmt : formatsToTry) {+ padHandle = sceAudioOutOpen(userId, 4 /* PADSPK */, 0, kGrain, kRate, fmt);+ if (padHandle >= 0) {+ activeFormat = fmt;+ XC_LOGI("pad speaker: opened port handle 0x%08x for user 0x%08x (fmt %d)", padHandle, userId, fmt);+ break;+ } else {+ XC_LOGW("pad speaker: sceAudioOutOpen(user 0x%08x, fmt %d) returned 0x%08x", userId, fmt, static_cast<unsigned>(padHandle));+ }+ }++ if (padHandle < 0) {+ XC_LOGW("pad speaker: failed to open controller speaker port, fallback to main audio");+ audioStart();+ constexpr size_t kChunk = (kRate * 20) / 1000;+ size_t total = pcm.size() / 2;+ size_t off = 0;+ while (off < total) {+ size_t n = std::min(kChunk, total - off);+ audioPush(pcm.data() + off * 2, n);+ off += n;+ if (off < total) platform::sleepMs(18);+ }+ return;+ }++ sceAudioOutSetMixLevelPadSpk(padHandle, 32768);+ sceAudioOutSetPadSpkVolume(padHandle, 127);++ size_t totalFrames = pcm.size() / 2;+ size_t offset = 0;++ if (activeFormat == 4) {+ std::vector<float> chunk(kGrain * 2, 0.0f);+ while (offset < totalFrames) {+ size_t n = std::min(static_cast<size_t>(kGrain), totalFrames - offset);+ std::fill(chunk.begin(), chunk.end(), 0.0f);+ std::copy(pcm.data() + offset * 2, pcm.data() + (offset + n) * 2, chunk.data());+ sceAudioOutOutput(padHandle, chunk.data());+ offset += n;+ }+ } else if (activeFormat == 3) {+ std::vector<float> chunk(kGrain, 0.0f);+ while (offset < totalFrames) {+ size_t n = std::min(static_cast<size_t>(kGrain), totalFrames - offset);+ std::fill(chunk.begin(), chunk.end(), 0.0f);+ for (size_t i = 0; i < n; ++i) {+ chunk[i] = 0.5f * (pcm[(offset + i) * 2] + pcm[(offset + i) * 2 + 1]);+ }+ sceAudioOutOutput(padHandle, chunk.data());+ offset += n;+ }+ } else if (activeFormat == 0) {+ std::vector<int16_t> chunk(kGrain, 0);+ while (offset < totalFrames) {+ size_t n = std::min(static_cast<size_t>(kGrain), totalFrames - offset);+ std::fill(chunk.begin(), chunk.end(), 0);+ for (size_t i = 0; i < n; ++i) {+ float m = 0.5f * (pcm[(offset + i) * 2] + pcm[(offset + i) * 2 + 1]);+ chunk[i] = static_cast<int16_t>(std::clamp(m * 32767.0f, -32768.0f, 32767.0f));+ }+ sceAudioOutOutput(padHandle, chunk.data());+ offset += n;+ }+ } else if (activeFormat == 1) {+ std::vector<int16_t> chunk(kGrain * 2, 0);+ while (offset < totalFrames) {+ size_t n = std::min(static_cast<size_t>(kGrain), totalFrames - offset);+ std::fill(chunk.begin(), chunk.end(), 0);+ for (size_t i = 0; i < n * 2; ++i) {+ chunk[i] = static_cast<int16_t>(std::clamp(pcm[offset * 2 + i] * 32767.0f, -32768.0f, 32767.0f));+ }+ sceAudioOutOutput(padHandle, chunk.data());+ offset += n;+ }+ }++ sceAudioOutClose(padHandle);+ XC_LOGI("pad speaker: alert chime playback completed successfully on DualSense");+ }).detach();++ return true;+}+} // namespace xc::mediadiff --git a/src/media/audio_out_sdl.cpp b/src/media/audio_out_sdl.cppindex ffe4712..3d2d37f 100644--- a/src/media/audio_out_sdl.cpp+++ b/src/media/audio_out_sdl.cpp@@ -15,6 +15,7 @@#include <mutex>#include <vector>+#include <thread>namespace xc::media {@@ -79,4 +80,22 @@ void audioStop() {XC_LOGI("audio output closed");}+bool playPadSpeakerAudio(const float* interleavedStereo, size_t frames) {+ if (!interleavedStereo || frames == 0) return false;+ audioStart();+ std::thread([pcm = std::vector<float>(interleavedStereo, interleavedStereo + frames * 2)]() {+ constexpr size_t kRate = AudioQueue::kRate;+ constexpr size_t kChunk = (kRate * 20) / 1000;+ size_t total = pcm.size() / 2;+ size_t off = 0;+ while (off < total) {+ size_t n = std::min(kChunk, total - off);+ audioPush(pcm.data() + off * 2, n);+ off += n;+ if (off < total) SDL_Delay(18);+ }+ }).detach();+ return true;+}+} // namespace xc::mediadiff --git a/src/ui/app_ui.cpp b/src/ui/app_ui.cppindex 18edb3a..89361d4 100644--- a/src/ui/app_ui.cpp+++ b/src/ui/app_ui.cpp@@ -59,11 +59,12 @@ constexpr int kResolutionOrder[3] = {1, 0, 2};// Settings' rows on screen, alike ones together (the row ids stay what// settingsRow_ and the helpers use): language, sign-in country, and sign-in check; the// stream (resolution, a desktop's display mode, 120 Hz, bitrate, region, network test);-// sound (volume, queue chime); the controller and keyboard; updates last. A group starts at each+// the controller, keyboard and queue-ready alert; support and updates last. A group starts at each// kSettingsGroupStart.-constexpr int kSettingsOrder[kSettingRows] = {0, 8, 17, 1, 13, 9, 10, 2, 18, 11, 16, 3, 4, 5, 6, 15, 14, 12, 19, 7};-constexpr bool kSettingsGroupStart[kSettingRows] = {false, false, false, true, false, false, false, false, false,- true, false, true, false, false, false, false, false, false, true, false};+constexpr int kSettingsCount = 19;+constexpr int kSettingsOrder[kSettingsCount] = {0, 8, 17, 1, 13, 9, 10, 2, 18, 14, 12, 3, 15, 4, 5, 6, 16, 19, 7};+constexpr bool kSettingsGroupStart[kSettingsCount] = {false, false, false, true, false, false, false, false, false,+ true, false, false, false, false, false, false, false, true, false};// The game settings' rows on screen (ids: 0 profile, 1 upscaler, 2// sharpness, 3 block smoothing, 4 resolution, 5 dead zone, 6 triggers, 7// confirm, 8 120 Hz, 9 keyboard keys, 10 back to the default, 11 controller@@ -498,8 +499,20 @@ void AppUi::rebuild(bool keepPosition) {}return v;};+ for (auto it = wishlist_.begin(); it != wishlist_.end(); ) {+ GameTile checkTile;+ checkTile.productId = *it;+ for (const auto& p : allPurchasable_) {+ if (p.productId == *it) { checkTile.titleId = p.titleId; break; }+ }+ if (isAcquired(checkTile)) it = wishlist_.erase(it);+ else ++it;+ }owned_ = sorted(visible(allOwned_));purchasable_ = sorted(visible(allPurchasable_));+ std::stable_partition(purchasable_.begin(), purchasable_.end(), [&](const GameTile& t) {+ return wishlist_.count(t.productId) > 0;+ });// 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.@@ -647,14 +660,28 @@ void AppUi::toggleFavorite(const GameTile& tile, UiEvent& ev) {dirty_ = true;}+bool AppUi::isAcquired(const GameTile& t) const {+ if (!t.productId.empty()) {+ for (const auto& o : allOwned_)+ if (o.productId == t.productId) return true;+ }+ if (!t.titleId.empty()) {+ for (const auto& o : allOwned_)+ if (o.titleId == t.titleId) return true;+ }+ return false;+}+void AppUi::toggleWishlist(const GameTile& tile, UiEvent& ev) {// Caller holds mutex_.if (tile.productId.empty()) return;+ if (isAcquired(tile)) return; // Only unacquired games can be added to the wishlistbool wish = !wishlist_.count(tile.productId);if (wish) wishlist_.insert(tile.productId);else wishlist_.erase(tile.productId);toast_ = tr(wish ? Str::AddedToWishlist : Str::RemovedFromWishlist);toastUntil_ = 0;+ rebuild();prefsEvent(ev);dirty_ = true;}@@ -679,7 +706,7 @@ void AppUi::setPrices(const std::map<std::string, PriceInfo>& prices) {for (const auto& [id, p] : prices) prices_[id] = p;// A list ordered or filtered by price fills in as prices arrive (not// while the user moves through it).- if (searching_ && searchOnKeys_ && tab_ == Tab::Library && (filterCheapest_ || filterFree_))+ if (searching_ && searchOnKeys_ && tab_ == Tab::Library && (filterCheapest_ || filterFree_ || filterWishlist_))runSearch();dirty_ = true;}@@ -856,6 +883,7 @@ void AppUi::showFilteredSearch(Tab tab, bool cheapest, int mode, const std::strisearchOnKeys_ = true;query_.clear();filterFree_ = false;+ filterWishlist_ = false;filterMouseKeyboard_ = false;filterCheapest_ = cheapest;filterPlan_ = 0;@@ -995,6 +1023,7 @@ void AppUi::runSearch() {auto price = prices_.find(t.productId);bool priced = price != prices_.end();if (tab_ == Tab::Library) {+ if (filterWishlist_ && !wishlist_.count(t.productId)) continue;// Free-to-play: free in the store and no regular price. A paid// game given away (price 0 now, regular price above 0) is a// sale, not free-to-play.@@ -1783,9 +1812,9 @@ void AppUi::setCaps(const UiCaps& caps) {};if (!shown(settingsRow_)) {int pos = 0, next = -1;- for (int i = 0; i < kSettingRows; ++i)+ for (int i = 0; i < kSettingsCount; ++i)if (kSettingsOrder[i] == settingsRow_) pos = i;- for (int i = pos; i < kSettingRows && next < 0; ++i)+ for (int i = pos; i < kSettingsCount && next < 0; ++i)if (shown(kSettingsOrder[i])) next = kSettingsOrder[i];for (int i = pos; i >= 0 && next < 0; --i)if (shown(kSettingsOrder[i])) next = kSettingsOrder[i];@@ -2110,7 +2139,7 @@ void AppUi::handleHome(const NavInput& in, UiEvent& ev) {bool AppUi::anyFilter() const {// Caller holds mutex_. Free and Lowest price only count in "Your games";// Plan only in Game Pass.- bool library = tab_ == Tab::Library && (filterFree_ || filterCheapest_);+ bool library = tab_ == Tab::Library && (filterFree_ || filterCheapest_ || filterWishlist_);bool gamePass = tab_ == Tab::GamePass && filterPlan_ > 0;return library || gamePass || filterConsole_ || filterMouseKeyboard_ || filterMode_ || !filterGenre_.empty() ||filterPublisher_ || filterLanguage_;@@ -2121,7 +2150,7 @@ std::vector<AppUi::Filter> AppUi::filterRow(int row) const {// games aren't bought).if (row == 1) return {Filter::Mode, Filter::Genre, Filter::Publisher, Filter::Language};if (tab_ == Tab::GamePass) return {Filter::Plan, Filter::Console, Filter::MouseKeyboard};- return {Filter::Free, Filter::Cheapest, Filter::Console, Filter::MouseKeyboard};+ return {Filter::Wishlist, Filter::Free, Filter::Cheapest, Filter::Console, Filter::MouseKeyboard};}std::vector<std::string> AppUi::poolGenres() const {@@ -2201,6 +2230,10 @@ void AppUi::chooseFilterLocked(Filter f, int index) {if (f == Filter::Mode) filterMode_ = index;if (f == Filter::Publisher) filterPublisher_ = index;if (f == Filter::Language) filterLanguage_ = index;+ if (f == Filter::Free) filterFree_ = index != 0;+ if (f == Filter::Cheapest) filterCheapest_ = index != 0;+ if (f == Filter::MouseKeyboard) filterMouseKeyboard_ = index != 0;+ if (f == Filter::Wishlist) filterWishlist_ = index != 0;if (f == Filter::Genre) {auto genres = poolGenres();filterGenre_ = index > 0 && index <= static_cast<int>(genres.size()) ? genres[static_cast<size_t>(index - 1)] : "";@@ -2215,6 +2248,7 @@ std::string AppUi::filterText(Filter f) const {if (f == Filter::Free) return tr(Str::FilterFree);if (f == Filter::MouseKeyboard) return tr(Str::FilterMouseKeyboard);if (f == Filter::Cheapest) return tr(Str::FilterCheapest);+ if (f == Filter::Wishlist) return tr(Str::Wishlist);int sel = filterSelected(f);if (sel > 0 || f == Filter::Console) {auto options = filterOptions(f);@@ -2232,6 +2266,7 @@ bool AppUi::filterOn(Filter f) const {if (f == Filter::Free) return filterFree_;if (f == Filter::Cheapest) return filterCheapest_;if (f == Filter::MouseKeyboard) return filterMouseKeyboard_;+ if (f == Filter::Wishlist) return filterWishlist_;return filterSelected(f) > 0;}@@ -2242,7 +2277,10 @@ void AppUi::pressFilter(Filter f) {filterListIndex_ = filterSelected(f);filterListTop_ = 0;} else {- (f == Filter::Free ? filterFree_ : f == Filter::MouseKeyboard ? filterMouseKeyboard_ : filterCheapest_) ^= true;+ if (f == Filter::Free) filterFree_ ^= true;+ else if (f == Filter::MouseKeyboard) filterMouseKeyboard_ ^= true;+ else if (f == Filter::Cheapest) filterCheapest_ ^= true;+ else if (f == Filter::Wishlist) filterWishlist_ ^= true;runSearch();}dirty_ = true;@@ -2722,6 +2760,9 @@ UiEvent AppUi::handle(const NavInput& in) {}if (in.right) changeSetting(+1);if (in.left) changeSetting(-1);+ if (in.square && settingsRow_ == 16) {+ ev.action = Action::TestQueueAlert;+ }if (in.accept && settingsRow_ == 14) {openPadTester(); // controller buttons: their own screen} else if (in.accept && (settingsRow_ == 3 || settingsRow_ == 4 || settingsRow_ == 12)) {@@ -2819,7 +2860,7 @@ UiEvent AppUi::handle(const NavInput& in) {}if (in.square) toggleHidden(detail_, ev); // the page stays openif (in.triangle) toggleFavorite(detail_, ev);- if (in.r3) toggleWishlist(detail_, ev);+ if (in.r3 && !isAcquired(detail_)) toggleWishlist(detail_, ev);if (in.l3 && !detail_.xboxTitleId.empty()) openAchievements();if (in.back) {screen_ = Screen::Home;@@ -3063,10 +3104,13 @@ void AppUi::drawHints(Canvas& c, const std::vector<std::pair<int, const char*>>&x = l2Pill.x;} else if (icon == kIconR3 || icon == kIconL3) {const char* label = buttonName(style, icon == kIconR3 ? PadButton::R3 : PadButton::L3);- Rect pill{x - 6, static_cast<int>(cy) - 12, 2 * kR + 12, 24};+ int pillW = fonts_.bold.measure(label, 14) + 16;+ int rightX = x + 2 * kR;+ Rect pill{rightX - pillW, static_cast<int>(cy) - 12, pillW, 24};c.fillRect(pill, rgba(255, 255, 255, 40), 8);- fonts_.bold.draw(c, label, pill.x + (pill.w - fonts_.bold.measure(label, 14)) / 2,+ fonts_.bold.draw(c, label, pill.x + (pillW - fonts_.bold.measure(label, 14)) / 2,fonts_.bold.centeredY(pill.y, pill.h, 14), 14, kGray);+ x = pill.x;} else if (xbox && icon == kIconTouchpad) { // ViewdrawXboxViewButton(c, cx, cy, kR, kGray);} else if (xbox && icon == kIconOptions) { // Menu@@ -3287,6 +3331,29 @@ void drawBag(Canvas& c, int cx, int cy, Color color, float size = 1.0f) {c.strokeArc(static_cast<float>(cx), bodyTop, r, std::max(1.5f, 2.5f * size), 3.1416f, 3.1416f, color);}+// A 5-pointed star centred on (cx, cy) with outer radius r.+void drawStar(Canvas& c, float cx, float cy, float r, Color color) {+ constexpr float kPi = 3.14159265358979323846f;+ float innerR = r * 0.42f;+ float px[10], py[10];+ for (int i = 0; i < 10; ++i) {+ float angle = -kPi / 2.0f + i * (kPi / 5.0f);+ float radius = (i % 2 == 0) ? r : innerR;+ px[i] = cx + radius * std::cos(angle);+ py[i] = cy + radius * std::sin(angle);+ }+ for (int i = 0; i < 10; ++i) {+ int next = (i + 1) % 10;+ c.line(px[i], py[i], px[next], py[next], 1.2f, color);+ c.line(cx, cy, px[i], py[i], 1.5f, color);+ }+ c.fillCircle(cx, cy, innerR * 0.95f, color);+ for (int i = 0; i < 5; ++i) {+ int pt = i * 2;+ c.line(cx, cy, px[pt], py[pt], 2.0f, color);+ }+}+} // namespacevoid AppUi::drawCard(Canvas& c, const GameTile& t, int x, int y, bool focused, bool gamePassBadge) {@@ -3316,9 +3383,47 @@ void AppUi::drawCard(Canvas& c, const GameTile& t, int x, int y, bool focused, bfonts_.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.+ // Top-right: Wishlist blue star when marked (or lock if unplayable and not wishlisted)+ bool isWishlisted = !t.productId.empty() && wishlist_.count(t.productId) > 0;+ if (isWishlisted) {+ c.fillCircle(x + kCard - 24, y + 24, 14, rgba(10, 20, 35, 230));+ c.strokeCircle(x + kCard - 24, y + 24, 14, 1.5f, rgba(40, 140, 255, 180));+ drawStar(c, x + kCard - 24, y + 24, 7.5f, rgba(50, 160, 255));+ }++ // Bottom-right: console badge and input badge.+ // Calculate rightBadgeLeft so bottom-left badges never overlap them.+ int rightEdge = x + kCard - 10;+ int rightBadgeLeft = rightEdge;+ if (const char* p = platformLabel(t.platform)) {+ int pTextW = fonts_.bold.measure(p, 11);+ int pBadgeW = std::clamp(pTextW + 12, 54, 66);+ Rect badge{rightBadgeLeft - pBadgeW, y + kCard - 34, pBadgeW, 24};+ c.fillRect(badge, rgba(0, 0, 0, 220), 4);+ fonts_.bold.draw(c, p, badge.x + (badge.w - pTextW) / 2,+ fonts_.bold.centeredY(badge.y, badge.h, 11), 11, kWhite);+ rightBadgeLeft = badge.x - 4;+ }+ if (t.mouseKeyboard || fonts_.hasIcons) {+ constexpr int kInputW = 28;+ Rect k{rightBadgeLeft - kInputW, y + kCard - 34, kInputW, 24};+ c.fillRect(k, rgba(0, 0, 0, 220), 4);+ const char* glyph = t.mouseKeyboard ? kIconKeyboardMouse : kIconGamepad;+ if (fonts_.hasIcons) {+ int gw = fonts_.icons.measure(glyph, 18);+ int gx = k.x + (k.w - gw) / 2;+ fonts_.icons.draw(c, glyph, gx, k.y + 3, 18, kWhite);+ } else {+ int kw = 16, kh = kw * 10 / 24;+ int kx = k.x + (k.w - kw) / 2;+ int ky = k.y + (k.h - kh) / 2;+ drawKeyboardGlyph(c, kx, ky, kw, kWhite);+ }+ rightBadgeLeft = k.x - 6;+ }++ // Bottom-left: price badge, plan badge, or friends playing; bounded by rightBadgeLeft.+ int maxLeftW = std::max(40, rightBadgeLeft - (x + 10) - 4);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)));@@ -3329,23 +3434,27 @@ void AppUi::drawCard(Canvas& c, const GameTile& t, int x, int y, bool focused, bstd::string label = t.freeInStore ? tr(Str::Free): price != prices_.end() ? price->second.now: tr(Str::BuyBadge);- int w = fonts_.bold.measure(label, 13) + 42;+ int tw = fonts_.bold.measure(label, 11);+ int w = std::min(maxLeftW, 20 + tw + 8);+ if (w < 20 + tw + 8) {+ label = fonts_.bold.fit(label, 11, w - 22);+ }Rect badge{x + 10, y + kCard - 34, w, 24};c.fillRect(badge, rgba(16, 124, 16, 235), 4);- drawBag(c, badge.x + 15, badge.y + badge.h / 2, kWhite, 0.62f);- fonts_.bold.draw(c, label, badge.x + 30, fonts_.bold.centeredY(badge.y, badge.h, 13), 13, kWhite);+ drawBag(c, badge.x + 10, badge.y + badge.h / 2, kWhite, 0.52f);+ fonts_.bold.draw(c, label, badge.x + 18, fonts_.bold.centeredY(badge.y, badge.h, 11), 11, kWhite);} else if (!t.playable) {c.fillRect({x, y, kCard, kCard}, rgba(0, 0, 0, 150), 10);- drawLock(c, x + kCard - 34, y + 30);+ drawLock(c, isWishlisted ? x + kCard - 54 : x + kCard - 34, isWishlisted ? y + 24 : y + 30);if (planBadge) {- int w = std::min(78, fonts_.bold.measure(planBadge, 11) + 12);+ int w = std::min(maxLeftW, fonts_.bold.measure(planBadge, 11) + 14);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);+ int w = std::min(maxLeftW, fonts_.bold.measure(planBadge, 11) + 14);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,@@ -3369,8 +3478,7 @@ void AppUi::drawCard(Canvas& c, const GameTile& t, int x, int y, bool focused, btagText = t.friends[0].gamertag;}- bool hasPlatform = platformLabel(t.platform) != nullptr;- int maxPillW = hasPlatform ? (kCard - 20 - 96 - 8) : (kCard - 20);+ int maxPillW = maxLeftW;int maxTextW = maxPillW - avatarsW - kPadX * 2 - 8;int textW = !tagText.empty() ? fonts_.semibold.measure(tagText, 12) + 6 : 0;if (textW > maxTextW && maxTextW > 15) {@@ -3415,26 +3523,6 @@ void AppUi::drawCard(Canvas& c, const GameTile& t, int x, int y, bool focused, b}}}- // Bottom-right: the console it was made for; one style and width for all.- // Left of it, how it's played: keyboard and mouse (the cloud takes them- // in it) or the controller only.- if (t.mouseKeyboard || fonts_.hasIcons) {- int right = x + kCard - 10 - (platformLabel(t.platform) ? 96 + 6 : 0);- Rect k{right - 34, y + kCard - 34, 34, 24};- c.fillRect(k, rgba(0, 0, 0, 220), 4);- const char* glyph = t.mouseKeyboard ? kIconKeyboardMouse : kIconGamepad;- if (fonts_.hasIcons) // the console's own icons- fonts_.icons.draw(c, glyph, k.x + (k.w - fonts_.icons.measure(glyph, 18)) / 2, k.y + 3, 18, kWhite);- else- drawKeyboardGlyph(c, k.x + 6, k.y + 6, 22, kWhite);- }- if (const char* p = platformLabel(t.platform)) {- constexpr int kBadgeW = 96;- Rect badge{x + kCard - 10 - kBadgeW, y + kCard - 34, kBadgeW, 24};- c.fillRect(badge, rgba(0, 0, 0, 220), 4);- fonts_.bold.draw(c, p, badge.x + (kBadgeW - fonts_.bold.measure(p, 13)) / 2,- fonts_.bold.centeredY(badge.y, badge.h, 13), 13, kWhite);- }if (focused) c.strokeRect({x - 7, y - 7, kCard + 14, kCard + 14}, kWhite, 4, 16);}@@ -3515,7 +3603,8 @@ void AppUi::drawLibrary(Canvas& c, uint64_t nowMs) {: Str::SortRecent;std::string label = trf(Str::SortLabel, tr(sortName));int w = fonts_.semibold.measure(label, 22);- int right = left + kGridW;+ constexpr int kAvatar = 52;+ int right = kW - kMargin - kAvatar - 16;fonts_.semibold.draw(c, label, right - w, fonts_.semibold.centeredY(112, 28, 22), 22, kGray);}c.gradientV({0, kH - 190, kW, 110}, withAlpha(kBg, 0), withAlpha(kBg, 245));@@ -3545,7 +3634,8 @@ void AppUi::drawSearch(Canvas& c, uint64_t nowMs) {if (query_.empty() && !filtering) {fonts_.semibold.draw(c, tr(Str::SearchHint), kResultsX, 150, 26, kDim);} else if (results_.empty()) {- fonts_.semibold.draw(c, tr(Str::NoResults), kResultsX, 150, 26, kGray);+ const char* emptyMsg = (tab_ == Tab::Library && filterWishlist_) ? tr(Str::WishlistEmpty) : tr(Str::NoResults);+ fonts_.semibold.draw(c, emptyMsg, kResultsX, 150, 26, kGray);} else {fonts_.semibold.draw(c, trf(Str::ResultsCount, std::to_string(results_.size())), kResultsX, 150, 26, kGray);}@@ -3605,10 +3695,12 @@ void AppUi::drawSearch(Canvas& c, uint64_t nowMs) {if (on && focused) c.strokeRect({chip.x + 3, chip.y + 3, chip.w - 6, chip.h - 6}, kGreen, 3, fh / 2 - 3);Color text = focused ? kBg : kWhite;int room = chip.w - (isList(f) ? 44 : 16);- std::string label = fonts_.semibold.fit(filterText(f), px, room);- int tw = fonts_.semibold.measure(label, px);+ int chipPx = px;+ while (chipPx > 13 && fonts_.semibold.measure(filterText(f), chipPx) > room) --chipPx;+ std::string label = fonts_.semibold.fit(filterText(f), chipPx, room);+ int tw = fonts_.semibold.measure(label, chipPx);int tx = chip.x + (isList(f) ? (chip.w - 22 - tw) / 2 : (chip.w - tw) / 2);- fonts_.semibold.draw(c, label, tx, fonts_.semibold.centeredY(chip.y, chip.h, px), px, text);+ fonts_.semibold.draw(c, label, tx, fonts_.semibold.centeredY(chip.y, chip.h, chipPx), chipPx, text);if (isList(f)) { // a list: a chevron at the rightfloat cx = static_cast<float>(chip.x + chip.w - 24), cy = static_cast<float>(chip.y + chip.h / 2);c.line(cx - 6, cy - 3, cx, cy + 3, 2.5f, text);@@ -3966,7 +4058,7 @@ void AppUi::drawDetails(Canvas& c, uint64_t nowMs) {hints.push_back({kIconOptions, tr(Str::GameSettings)});hints.push_back({kIconTriangle, tr(favorites_.count(g->productId) ? Str::RemoveFavorite : Str::AddFavorite)});hints.push_back({kIconSquare, tr(hidden_.count(g->productId) ? Str::Unhide : Str::Hide)});- hints.push_back({kIconR3, tr(wishlist_.count(g->productId) ? Str::RemoveWishlist : Str::AddWishlist)});+ if (!isAcquired(*g)) hints.push_back({kIconR3, tr(wishlist_.count(g->productId) ? Str::RemoveWishlist : Str::AddWishlist)});if (!g->xboxTitleId.empty()) hints.push_back({kIconL3, tr(Str::Achievements)});hints.push_back({kIconCircle, tr(Str::Back)});drawHints(c, hints);@@ -3984,9 +4076,9 @@ void AppUi::drawDetails(Canvas& c, uint64_t nowMs) {std::vector<Hint> hints = {{kIconOptions, tr(Str::GameSettings)},{kIconTriangle, tr(favorites_.count(g->productId) ? Str::RemoveFavorite : Str::AddFavorite)},- {kIconSquare, tr(hidden_.count(g->productId) ? Str::Unhide : Str::Hide)},- {kIconR3, tr(wishlist_.count(g->productId) ? Str::RemoveWishlist : Str::AddWishlist)}+ {kIconSquare, tr(hidden_.count(g->productId) ? Str::Unhide : Str::Hide)}};+ if (!isAcquired(*g)) hints.push_back({kIconR3, tr(wishlist_.count(g->productId) ? Str::RemoveWishlist : Str::AddWishlist)});if (!g->xboxTitleId.empty()) hints.push_back({kIconL3, tr(Str::Achievements)});hints.push_back({kIconCircle, tr(Str::Back)});drawHints(c, hints);@@ -4067,10 +4159,10 @@ void AppUi::drawDetails(Canvas& c, uint64_t nowMs) {{kIconCross, tr(achFocused ? Str::Achievements : Str::Play)},{kIconOptions, tr(Str::GameSettings)},{kIconTriangle, tr(favorites_.count(g->productId) ? Str::RemoveFavorite : Str::AddFavorite)},- {kIconSquare, tr(hidden_.count(g->productId) ? Str::Unhide : Str::Hide)},- {kIconR3, tr(wishlist_.count(g->productId) ? Str::RemoveWishlist : Str::AddWishlist)},- {kIconCircle, tr(Str::Back)}+ {kIconSquare, tr(hidden_.count(g->productId) ? Str::Unhide : Str::Hide)}};+ if (!isAcquired(*g)) hints.push_back({kIconR3, tr(wishlist_.count(g->productId) ? Str::RemoveWishlist : Str::AddWishlist)});+ hints.push_back({kIconCircle, tr(Str::Back)});drawHints(c, hints);drawToast(c, nowMs);}@@ -4252,7 +4344,11 @@ void AppUi::drawSettings(Canvas& c) {}drawHints(c, {{kIconCross, tr(Str::Select)}, {kIconCircle, tr(Str::Back)}});} else {- drawHints(c, {{kIconCross, tr(Str::Change)}, {kIconTriangle, tr(Str::ReportProblem)}, {kIconCircle, tr(Str::Back)}});+ if (settingsRow_ == 16) {+ drawHints(c, {{kIconCross, tr(Str::Change)}, {kIconSquare, tr(Str::TestSound)}, {kIconTriangle, tr(Str::ReportProblem)}, {kIconCircle, tr(Str::Back)}});+ } else {+ drawHints(c, {{kIconCross, tr(Str::Change)}, {kIconTriangle, tr(Str::ReportProblem)}, {kIconCircle, tr(Str::Back)}});+ }}}diff --git a/src/ui/app_ui.h b/src/ui/app_ui.hindex 66c23a2..d5e049a 100644--- a/src/ui/app_ui.h+++ b/src/ui/app_ui.h@@ -235,7 +235,8 @@ enum class Action {ClaimFreeGame, // claim a free-to-play game license directlyRefreshLibrary, // manual library refreshCheckSignIn, // run sign-in diagnostic stages- RunNetworkTest // run regional RTT/jitter & NAT probe+ RunNetworkTest, // run regional RTT/jitter & NAT probe+ TestQueueAlert // play test chime and vibration for queue-ready alert};// How "Your games" is sorted (R3).@@ -423,7 +424,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 { Plan, Free, Cheapest, Console, Mode, Genre, Publisher, Language, MouseKeyboard };+ enum class Filter { Plan, Free, Cheapest, Console, Mode, Genre, Publisher, Language, MouseKeyboard, Wishlist };void chooseFilter(Filter f, int index);// Autoplay tests: where the focus is ("Game Pass row 2 card 6", ...).std::string focusDescription() const;@@ -506,7 +507,8 @@ private:// only) and Console; then Mode, Genre, Publisher and Language. The lists open a// drop-down; Free and Lowest price turn on and off.std::vector<Filter> filterRow(int row) const;- bool isList(Filter f) const { return f != Filter::Free && f != Filter::Cheapest && f != Filter::MouseKeyboard; }+ bool isList(Filter f) const { return f != Filter::Free && f != Filter::Cheapest && f != Filter::MouseKeyboard && f != Filter::Wishlist; }+ bool isAcquired(const GameTile& t) const;std::string filterText(Filter f) const; // the chip's label: its choice when one is madebool filterOn(Filter f) const;std::vector<std::string> filterOptions(Filter f) const;@@ -602,7 +604,7 @@ private:void drawLoadingBar(Canvas& c, int x, int y, int w, uint64_t nowMs);LibrarySort librarySort_ = LibrarySort::Recent;// Search filters (the row of buttons under the keys).- bool filterFree_ = false, filterCheapest_ = false, filterMouseKeyboard_ = false;+ bool filterFree_ = false, filterCheapest_ = false, filterMouseKeyboard_ = false, filterWishlist_ = 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, localdiff --git a/src/ui/strings.cpp b/src/ui/strings.cppindex 62cddc7..04608c4 100644--- a/src/ui/strings.cpp+++ b/src/ui/strings.cpp@@ -371,6 +371,8 @@ constexpr Column kEnglish = {"PSBox is an open-source project passionately maintained to bring the best Xbox Cloud Gaming experience to PlayStation 5. If you enjoy the app and would like to support ongoing development, frequent updates and new features, consider buying me a coffee on Ko-Fi!", // SupportMessage"Ko-fi", // SupportKoFi"Scan with your phone to support", // ScanToDonate+ "Test sound", // TestSound+ "Wishlist is empty", // WishlistEmpty};constexpr Column kPortugueseBR = {@@ -712,6 +714,8 @@ constexpr Column kPortugueseBR = {"O PSBox é um projeto de código aberto mantido com dedicação para trazer a melhor experiência do Xbox Cloud Gaming ao PlayStation 5. Se você curte o app e quer apoiar o desenvolvimento contínuo, atualizações e novos recursos, considere me pagar um café no Ko-Fi!", // SupportMessage"Ko-fi", // SupportKoFi"Aponte a câmera do seu celular", // ScanToDonate+ "Testar som", // TestSound+ "A lista de desejos está vazia", // WishlistEmpty};constexpr Column kSpanish = {@@ -1053,6 +1057,8 @@ constexpr Column kSpanish = {"PSBox es un proyecto de código abierto desarrollado con dedicación para brindar la mejor experiencia de Xbox Cloud Gaming en PlayStation 5. Si disfrutas de la app y deseas apoyar el desarrollo continuo y nuevas funciones, ¡considera invitarme un café en Ko-Fi!", // SupportMessage"Ko-fi", // SupportKoFi"Escanea con tu teléfono para donar", // ScanToDonate+ "Probar sonido", // TestSound+ "La lista de deseos está vacía", // WishlistEmpty};constexpr Column kFrench = {@@ -1394,6 +1400,8 @@ constexpr Column kFrench = {"PSBox est un projet open source développé avec passion pour offrir la meilleure expérience Xbox Cloud Gaming sur PlayStation 5. Si vous appréciez l'application et souhaitez soutenir les mises à jour et les nouveautés, pensez à m'offrir un café sur Ko-Fi !", // SupportMessage"Ko-fi", // SupportKoFi"Scannez avec votre téléphone", // ScanToDonate+ "Tester le son", // TestSound+ "La liste de souhaits est vide", // WishlistEmpty};constexpr Column kGerman = {@@ -1735,6 +1743,8 @@ constexpr Column kGerman = {"PSBox ist ein Open-Source-Projekt, das mit viel Engagement entwickelt wird, um das beste Xbox Cloud Gaming-Erlebnis auf die PlayStation 5 zu bringen. Wenn dir die App gefällt und du die Weiterentwicklung unterstützen möchtest, spendiere mir gerne einen Kaffee auf Ko-Fi!", // SupportMessage"Ko-fi", // SupportKoFi"Mit dem Smartphone scannen", // ScanToDonate+ "Ton testen", // TestSound+ "Wunschliste ist leer", // WishlistEmpty};constexpr Column kItalian = {@@ -2076,6 +2086,8 @@ constexpr Column kItalian = {"PSBox è un progetto open source sviluppato con passione per portare la migliore esperienza di Xbox Cloud Gaming su PlayStation 5. Se ti piace l'app e vuoi sostenere lo sviluppo continuo e le nuove funzionalità, considera di offrirmi un caffè su Ko-Fi!", // SupportMessage"Ko-fi", // SupportKoFi"Inquadra con lo smartphone", // ScanToDonate+ "Prova suono", // TestSound+ "La lista dei desideri è vuota", // WishlistEmpty};constexpr std::array<const Column*, kLangs> kTable = {&kEnglish, &kPortugueseBR, &kSpanish,diff --git a/src/ui/strings.h b/src/ui/strings.hindex 640367c..2f8fe4b 100644--- a/src/ui/strings.h+++ b/src/ui/strings.h@@ -348,6 +348,8 @@ enum class Str {SupportMessage, // modal text: captivating thank you / donation messageSupportKoFi, // settings action button: "Ko-fi"ScanToDonate, // modal subtitle below QR: "Scan with your phone to donate"+ TestSound, // "Test sound" / "Testar som"+ WishlistEmpty, // "Wishlist is empty"Count};diff --git a/tests/test_main.cpp b/tests/test_main.cppindex 0f9a027..70ddebe 100644--- a/tests/test_main.cpp+++ b/tests/test_main.cpp@@ -2039,21 +2039,21 @@ static void testVisibleSettingsRows() {};const ui::UiCaps ps5;auto all = ui::visibleSettingsRows(ps5);- CHECK((ids(all) == std::vector<int>{0, 8, 17, 1, 9, 10, 2, 18, 11, 16, 3, 4, 5, 6, 15, 14, 12, 19, 7}));- CHECK((groups(all) == std::vector<bool>{false, false, false, true, false, false, false, false, true, false, true, false, false, false, false, false, false, true, false}));+ CHECK((ids(all) == std::vector<int>{0, 8, 17, 1, 9, 10, 2, 18, 14, 12, 3, 15, 4, 5, 6, 16, 19, 7}));+ CHECK((groups(all) == std::vector<bool>{false, false, false, true, false, false, false, false, true, false, false, false, false, false, false, false, true, false}));ui::UiCaps pc;pc.lightBar = pc.triggerRumble = pc.adaptiveTriggers = pc.gyro = pc.touchpad = false;pc.upscalers = pc.sharpen = pc.deband = pc.highRefresh = pc.console = pc.selfUpdate = false;pc.openUrl = true;auto desk = ui::visibleSettingsRows(pc);- CHECK((ids(desk) == std::vector<int>{0, 8, 17, 1, 10, 2, 18, 11, 16, 3, 5, 14, 12, 19, 7}));- CHECK((groups(desk) == std::vector<bool>{false, false, false, true, false, false, false, true, false, true, false, false, false, true, false}));+ CHECK((ids(desk) == std::vector<int>{0, 8, 17, 1, 10, 2, 18, 14, 12, 3, 5, 16, 19, 7}));+ CHECK((groups(desk) == std::vector<bool>{false, false, false, true, false, false, false, true, false, false, false, false, true, false}));// The desktop app's window: Display mode after the resolution, in the stream's group.ui::UiCaps win = pc;win.desktopWindow = true;auto w = ui::visibleSettingsRows(win);- CHECK((ids(w) == std::vector<int>{0, 8, 17, 1, 13, 10, 2, 18, 11, 16, 3, 5, 14, 12, 19, 7}));- CHECK((groups(w) == std::vector<bool>{false, false, false, true, false, false, false, false, true, false, true, false, false, false, true, false}));+ CHECK((ids(w) == std::vector<int>{0, 8, 17, 1, 13, 10, 2, 18, 14, 12, 3, 5, 16, 19, 7}));+ CHECK((groups(w) == std::vector<bool>{false, false, false, true, false, false, false, false, true, false, false, false, false, true, false}));ui::UiCaps xbox = pc; // an Xbox pad: impulse triggers, no light barxbox.triggerRumble = true;auto x = ids(ui::visibleSettingsRows(xbox));@@ -2063,9 +2063,6 @@ static void testVisibleSettingsRows() {CHECK((ids(ui::visibleGameSettingsRows(ps5, true, true)) == std::vector<int>{0, 4, 8, 14, 1, 2, 3, 5, 6, 7, 12, 11, 13, 9, 10}));CHECK((groups(ui::visibleGameSettingsRows(ps5, true, true)) ==std::vector<bool>{false, true, false, false, true, false, false, true, false, false, false, false, false, false, true}));- CHECK((ids(ui::visibleGameSettingsRows(ps5, true)) == std::vector<int>{0, 4, 8, 14, 1, 2, 3, 5, 6, 7, 12, 11, 9, 10}));- CHECK((groups(ui::visibleGameSettingsRows(ps5, true)) ==- std::vector<bool>{false, true, false, false, true, false, false, true, false, false, false, false, false, true}));CHECK((ids(ui::visibleGameSettingsRows(ps5, false)) == std::vector<int>{0, 4, 8, 14, 1, 2, 3, 5, 6, 7, 12, 11, 9}));ui::UiCaps noTouch = ps5;noTouch.touchpad = false;@@ -2073,14 +2070,12 @@ static void testVisibleSettingsRows() {auto game = ui::visibleGameSettingsRows(pc, false);CHECK((ids(game) == std::vector<int>{0, 4, 14, 5, 7, 11, 9}));CHECK((groups(game) == std::vector<bool>{false, true, false, true, false, false, false}));- // How far down the autoplay tests walk to each row (autoplay.cpp's- // downsTo): on the PS5 the confirm button is 12 down (6 is the region),- // the keyboard keys 16 (15 is the controller buttons).+ // How far down the autoplay tests walk to each row (autoplay.cpp's downsTo).CHECK(ui::settingsRowPosition(ps5, 1) == 3 && ui::settingsRowPosition(ps5, 3) == 10);- CHECK(ui::settingsRowPosition(ps5, 16) == 9);- CHECK(ui::settingsRowPosition(ps5, 5) == 12 && ui::settingsRowPosition(ps5, 6) == 13);- CHECK(ui::settingsRowPosition(ps5, 12) == 16 && ui::settingsRowPosition(ps5, 14) == 15);- CHECK(ui::settingsRowPosition(ps5, 7) == 18 && ui::settingsRowPosition(ps5, 19) == 17 && ui::settingsRowPosition(ps5, 2) == 6);+ CHECK(ui::settingsRowPosition(ps5, 16) == 15);+ CHECK(ui::settingsRowPosition(ps5, 5) == 13 && ui::settingsRowPosition(ps5, 6) == 14);+ CHECK(ui::settingsRowPosition(ps5, 12) == 9 && ui::settingsRowPosition(ps5, 14) == 8);+ CHECK(ui::settingsRowPosition(ps5, 7) == 17 && ui::settingsRowPosition(ps5, 19) == 16 && ui::settingsRowPosition(ps5, 2) == 6);CHECK(ui::settingsRowPosition(pc, 5) == 10 && ui::settingsRowPosition(pc, 6) == -1 && ui::settingsRowPosition(pc, 4) == -1);}@@ -2589,7 +2584,124 @@ static void testWishlist() {Library lib;lib.setWishlist({"PROD_WISH"});auto rows = lib.rows();- (void)rows;+ // Standalone wishlist shelf must not exist in Game Pass home rows+ for (const auto& r : rows) {+ CHECK(r.title != ui::tr(ui::Str::Wishlist));+ }++ // AppUi Wishlist tests+ ui::Fonts fonts;+ ui::ImageCache images([] {});+ ui::AppUi app(fonts, images);++ ui::GameTile ownedTile, unownedTileA, unownedTileB;+ ownedTile.productId = "OWNED_1";+ ownedTile.titleId = "TITLE_OWNED_1";+ ownedTile.name = "Owned Game";++ unownedTileA.productId = "UNOWNED_A";+ unownedTileA.titleId = "TITLE_UNOWNED_A";+ unownedTileA.name = "Game A";++ unownedTileB.productId = "UNOWNED_B";+ unownedTileB.titleId = "TITLE_UNOWNED_B";+ unownedTileB.name = "Game B";++ // Set owned and purchasable: unownedTileB is wishlisted initially.+ // Also include ownedTile in wishlist initially to verify rebuild() prunes acquired games!+ app.setPrefs({}, ui::LibrarySort::AZ, {}, {"OWNED_1", "UNOWNED_B"});+ app.setOwned({ownedTile}, {unownedTileA, unownedTileB}, true);++ // In purchasable_, UNOWNED_B should be at index 0 because it's wishlisted, even though Game A precedes Game B alphabetically!+ ui::GameTile firstPurchasable;+ CHECK(app.purchasableAt(0, firstPurchasable));+ CHECK(firstPurchasable.productId == "UNOWNED_B");++ // Search filtering with Wishlist+ app.setSearchPools({}, {unownedTileA, unownedTileB});+ app.showFilteredSearch(ui::Tab::Library, false, 0, "", 0, -1);+ app.chooseFilter(ui::AppUi::Filter::Wishlist, 1);+ auto res = app.searchResults(10);+ // Only UNOWNED_B should be returned because it's in the wishlist+ CHECK(res.size() == 1);+ if (!res.empty()) {+ CHECK(res[0].first == "Game B");+ }++ // Test details screen: open details for ownedTile, press R3 -> should NOT add to wishlist!+ app.showDetails(ownedTile);+ ui::NavInput r3Press;+ r3Press.r3 = true;+ app.handle(r3Press);++ // Verify search with wishlist filter again: ownedTile was NOT added!+ app.showFilteredSearch(ui::Tab::Library, false, 0, "", 0, -1);+ app.chooseFilter(ui::AppUi::Filter::Wishlist, 1);+ res = app.searchResults(10);+ CHECK(res.size() == 1);+ if (!res.empty()) {+ CHECK(res[0].first == "Game B");+ }++ // Open details for unownedTileA, press R3 -> should be added to wishlist!+ app.showDetails(unownedTileA);+ app.handle(r3Press);++ app.showFilteredSearch(ui::Tab::Library, false, 0, "", 0, -1);+ app.chooseFilter(ui::AppUi::Filter::Wishlist, 1);+ res = app.searchResults(10);+ // Now both UNOWNED_B and UNOWNED_A are wishlisted!+ CHECK(res.size() == 2);++ // Press R3 again on unownedTileA -> toggles off!+ app.showDetails(unownedTileA);+ app.handle(r3Press);++ app.showFilteredSearch(ui::Tab::Library, false, 0, "", 0, -1);+ app.chooseFilter(ui::AppUi::Filter::Wishlist, 1);+ res = app.searchResults(10);+ CHECK(res.size() == 1);++ // Test price updating via setPrices while wishlist filter is active+ ui::PriceInfo pi;+ pi.list = 49.99;+ pi.msrp = 49.99;+ pi.now = "R$ 49,99";+ app.setPrices({{"UNOWNED_B", pi}});+ res = app.searchResults(10);+ CHECK(res.size() == 1);+ CHECK(res[0].second.now == "R$ 49,99");++ // Add UNOWNED_A to wishlist+ app.showDetails(unownedTileA);+ app.handle(r3Press);++ // Test pruning of acquired game matching titleId+ ui::GameTile newlyOwned;+ newlyOwned.productId = "DIFF_PID";+ newlyOwned.titleId = "TITLE_UNOWNED_A";+ newlyOwned.name = "Game A";+ app.setOwned({ownedTile, newlyOwned}, {unownedTileA, unownedTileB}, true);++ app.showFilteredSearch(ui::Tab::Library, false, 0, "", 0, -1);+ app.chooseFilter(ui::AppUi::Filter::Wishlist, 1);+ res = app.searchResults(10);+ // UNOWNED_A must be pruned because newlyOwned has matching titleId+ CHECK(res.size() == 1);+ CHECK(res[0].first == "Game B");++ // Unwishlist UNOWNED_B to test empty state+ app.showDetails(unownedTileB);+ app.handle(r3Press);++ app.showFilteredSearch(ui::Tab::Library, false, 0, "", 0, -1);+ app.chooseFilter(ui::AppUi::Filter::Wishlist, 1);+ res = app.searchResults(10);+ CHECK(res.empty());++ // Empty wishlist string test+ CHECK(std::string(ui::tr(ui::Str::WishlistEmpty)).find("vazia") != std::string::npos ||+ std::string(ui::tr(ui::Str::WishlistEmpty)).find("empty") != std::string::npos);}static void testAchievements() {diff --git a/tools/ps5/ps5_dev.py b/tools/ps5/ps5_dev.pyindex 93029a2..888adcf 100755--- a/tools/ps5/ps5_dev.py+++ b/tools/ps5/ps5_dev.py@@ -184,6 +184,7 @@ def cmd_test(args):"padmaptest", "detailtest", "gridtest", "crashtest", "searchtest","tunetest", "confirmtest", "pickertest", "menutest", "regiontest","friendstest", "publishertest", "scrolltest", "quicktest", "tlscheck",+ "padspktest", "queuetest", "queueuitest", "wishlisttest",}bitrate_opt = f" bitrate={args.bitrate}" if getattr(args, "bitrate", 0) > 0 else ""if target.startswith("AUTOTEST") or target.startswith("BENCH") or " " in target:@@ -220,7 +221,7 @@ def cmd_test(args):# Delete old artifacts on PS5for name in ("xcloud.log", "frame.ppm", "frame2.ppm", "frame3.ppm", "frame4.ppm", "screen.ppm", "ui.ppm", "launch.ppm", "detail.ppm","detail_after.ppm", "settings.ppm", "game_settings.ppm", "game_settings_custom.ppm", "library.ppm",- "confirm2.ppm", "home.ppm"):+ "wishlist_empty.ppm", "wishlist_active.ppm", "confirm2.ppm", "home.ppm"):try:ftp.sendcmd(f"DELE {name}")except (error_perm, error_reply):@@ -256,7 +257,7 @@ def cmd_test(args):# Fetch all PPMs and logppm_names = ["ui.ppm", "launch.ppm", "frame.ppm", "frame2.ppm", "frame3.ppm", "frame4.ppm", "screen.ppm", "detail.ppm","detail_after.ppm", "settings.ppm", "game_settings.ppm", "game_settings_custom.ppm",- "library.ppm", "error.ppm", "confirm2.ppm", "home.ppm"]+ "library.ppm", "wishlist_empty.ppm", "wishlist_active.ppm", "error.ppm", "confirm2.ppm", "home.ppm"]ftp = get_ftp(host, port)ftp.cwd("/data/psbox")for name in ppm_names + ["xcloud.log"]: