Skip to content

Xbox Cloud Gaming app for PS5 Homebrew

C

ui & settings: add clickable achievements button, donation modal with QR code, fix network test latency and clean stream menus

Rafael Abud Ferreira42cd7f558f6b
diff --git a/ROADMAP.md b/ROADMAP.md
index e3d6dee..ad221bd 100644
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@ -256,6 +256,7 @@ is rolled back at the next start), then the app restarts itself
| **Achievements on the game page** (done) | Progress and gamerscore for the game, the unlocked / locked list; popup achievement viewer with L3, gamerscore disc pill on details | medium |
| **Store wishlist** (done) | Toggle titles on Details with R3, dedicated Wishlist row in Library, notify on sales or Game Pass entry | small–medium |
| **Playtime per game on the card** (done) | The time played (the app already measures it) shown on each card and on the game page | small |
+| **Web configuration panel via QR code** | A QR code in Settings that opens a local web interface on a phone/PC browser to view live session stats, adjust controller mappings, tweak network settings and options comfortably | medium |
| **Steam Deck + AppImage** | The Linux build as an AppImage (one file, runs on SteamOS and most distributions; glibc baseline from CI's ubuntu-24.04), attached to each release by the Linux workflow; on the Deck: gamescope / Game Mode, the 1280x800 screen (UI scale), the Deck's own controls and gyro through SDL, added to Steam as a non-Steam game | small–medium |
| **Discord Rich Presence (desktop)** | "Playing Fortnite on PSBox" with the game's art and elapsed time, through the local Discord client's IPC (no account data sent); an on/off in Settings; desktop only (capability-gated, a no-op on the PS5) | small |
| **Mouse in the desktop UI** | Today the mouse only goes to the game (native MKB / mouse as a stick); on desktop menus, hover moves the focus and a click presses (cards, rows, buttons, dropdowns, the search keys), the wheel scrolls; never on the PS5, never during a game | small–medium |
diff --git a/src/app/autoplay.cpp b/src/app/autoplay.cpp
index c16d3f8..1636ac2 100644
--- a/src/app/autoplay.cpp
+++ b/src/app/autoplay.cpp
@@ -31,6 +31,7 @@ namespace {
// The home screen was saved: the tests that start from it may go.
bool uiSaved = false;
bool settingsShot = false; // "settingstest": save the screen now
+bool donationShot = false; // "donationtest": save the screen now
const char* keysShot = nullptr; // "keystest": the screen to save now
uint64_t homeSince = 0, launchSince = 0;
bool launchSaved = false;
@@ -146,6 +147,7 @@ void loadAutoplay() {
if (opt == "streammenutest") g_autoplay.streamMenuTest = true;
if (opt == "regiontest") g_autoplay.regionTest = true;
if (opt == "tlscheck") g_autoplay.tlsCheck = true;
+ if (opt == "donationtest") g_autoplay.donationTest = true;
if (opt == "norestart") g_autoplay.noRestart = true;
if (opt.rfind("threads=", 0) == 0) g_autoplay.decodeThreads = std::atoi(opt.c_str() + 8);
}
@@ -793,6 +795,39 @@ void autoplayNav(ui::NavInput& nav, bool& menuCombo, uint64_t now) {
if (next) ++step;
}
}
+
+ if (g_autoplay.donationTest && uiSaved) {
+ static uint64_t since = 0;
+ static int step = 0;
+ if (!since) since = now;
+ static SettingsWalk walk;
+ const uint64_t at[] = {500, 1500, 3200, 4800, 7000, 8500};
+ if (step < 6 && now - since >= at[step]) {
+ bool next = true;
+ if (step == 0) nav.options = true;
+ if (step == 1) next = walk.step(nav, downsTo(19));
+ if (step == 2) {
+ if (onSettingsRow(19, "donation test")) {
+ settingsShot = true;
+ } else {
+ g_autoplay.donationTest = false;
+ g_ui->showHome();
+ }
+ }
+ if (step == 3) {
+ nav.accept = true;
+ }
+ if (step == 4) {
+ donationShot = true;
+ }
+ if (step == 5) {
+ g_ui->showHome();
+ g_autoplay.donationTest = false;
+ XC_LOGI("AUTOPLAY END: donation test");
+ }
+ if (next) ++step;
+ }
+ }
}
void autoplayScreens(const ui::Canvas& canvas, uint64_t now) {
@@ -930,10 +965,19 @@ void autoplayScreens(const ui::Canvas& canvas, uint64_t now) {
saveCanvas("detail.ppm");
detailShot = true;
ui::NavInput in{};
- in.l3 = true;
+ in.right = true;
g_ui->handle(in);
achAt = now;
- } else if (achAt && now - achAt > 3000) {
+ } else if (achAt && now - achAt > 1500 && now - achAt <= 3000) {
+ static bool focusShot = false;
+ if (!focusShot) {
+ saveCanvas("detail_focus_ach.ppm");
+ focusShot = true;
+ ui::NavInput in{};
+ in.accept = true;
+ g_ui->handle(in);
+ }
+ } else if (achAt && now - achAt > 4000) {
saveCanvas("achievements.ppm");
g_autoplay.detailTest = false;
XC_LOGI("AUTOPLAY END: detail test");
@@ -948,6 +992,11 @@ void autoplayScreens(const ui::Canvas& canvas, uint64_t now) {
saveCanvas("settings.ppm");
XC_LOGI("AUTOPLAY END: settings test");
}
+ if (donationShot) {
+ donationShot = false;
+ saveCanvas("donation.ppm");
+ XC_LOGI("AUTOPLAY END: donation screenshot saved");
+ }
if (g_autoplay.consolesTab && uiSaved) {
static uint64_t shownAt = 0;
if (!shownAt) {
diff --git a/src/app/autoplay.h b/src/app/autoplay.h
index 8477776..ca3587a 100644
--- a/src/app/autoplay.h
+++ b/src/app/autoplay.h
@@ -87,6 +87,7 @@ struct Autoplay {
bool regionTest = false; // regiontest: the refused sign-in (region.ppm), its country list (region_picker.ppm,
// closed unchanged), Settings on the sign-in country (region_settings.ppm), back
// (region_back.ppm). The sign-in country is never changed.
+ bool donationTest = false; // donationtest: navigate to Settings row 19, open donation modal, save donation.ppm
};
extern Autoplay g_autoplay;
extern std::atomic<bool> g_syntheticA; // A held down for the game
diff --git a/src/app/worker.cpp b/src/app/worker.cpp
index c73a015..eb3ae66 100644
--- a/src/app/worker.cpp
+++ b/src/app/worker.cpp
@@ -31,6 +31,7 @@
#include <cstdlib>
#include <cstring>
#include <map>
+#include <fcntl.h>
#include <netdb.h>
#include <poll.h>
#include <sys/socket.h>
@@ -391,7 +392,6 @@ std::string stream(xcloud::GssvClient& gssv) {
XC_LOGI("session summary: %s; %llu s with a degraded connection, %llu frames lost, %llu recovered packets",
details, static_cast<unsigned long long>(session.badSeconds),
static_cast<unsigned long long>(st.rtpDroppedFrames), static_cast<unsigned long long>(st.rtpRecovered));
- if (!autoplayDone || g_autoplay.title.empty()) platform::notify(ui::trf(ui::Str::SessionSummary, details), "session summary (notification)");
}
// Ended before a single frame: the game never started (e.g. it closed on
// the server); say so on the error screen instead of going back quietly.
@@ -706,7 +706,7 @@ std::string endedToast(const std::string& result) {
if (result.find("KickForStopCommand") != std::string::npos) return ui::tr(ui::Str::EndedOnXbox);
if (result.find("KickByNewSession") != std::string::npos) return ui::tr(ui::Str::EndedByOtherDevice);
if (result.find("KickForServerShutdown") != std::string::npos) return ui::tr(ui::Str::EndedXboxOff);
- return ui::tr(ui::Str::StreamEnded);
+ return {};
}
// "My consoles": the account's own Xbox consoles (Remote Play, the xhome
@@ -1098,6 +1098,45 @@ std::string probeStunUdp() {
return "UDP Invalid Response";
}
+int probeTcpConnect(const char* host, const char* port, int timeoutMs) {
+ addrinfo hints{};
+ hints.ai_family = AF_INET;
+ hints.ai_socktype = SOCK_STREAM;
+ addrinfo* res = nullptr;
+ if (::getaddrinfo(host, port, &hints, &res) != 0 || !res) {
+ return -1;
+ }
+ int fd = ::socket(res->ai_family, res->ai_socktype, res->ai_protocol);
+ if (fd < 0) {
+ ::freeaddrinfo(res);
+ return -1;
+ }
+ int flags = ::fcntl(fd, F_GETFL, 0);
+ if (flags >= 0) ::fcntl(fd, F_SETFL, flags | O_NONBLOCK);
+
+ uint64_t t0 = platform::nowMs();
+ int rc = ::connect(fd, res->ai_addr, res->ai_addrlen);
+ int rtt = -1;
+ if (rc == 0) {
+ rtt = static_cast<int>(platform::nowMs() - t0);
+ } else if (errno == EINPROGRESS) {
+ pollfd pfd{};
+ pfd.fd = fd;
+ pfd.events = POLLOUT;
+ int pr = ::poll(&pfd, 1, timeoutMs);
+ if (pr > 0) {
+ int err = 0;
+ socklen_t len = sizeof(err);
+ if (::getsockopt(fd, SOL_SOCKET, SO_ERROR, &err, &len) == 0 && err == 0) {
+ rtt = static_cast<int>(platform::nowMs() - t0);
+ }
+ }
+ }
+ ::close(fd);
+ ::freeaddrinfo(res);
+ return rtt;
+}
+
void runNetworkTest(xcloud::GssvClient& gssv) {
ui::NetworkTestState state;
state.running = true;
@@ -1128,27 +1167,47 @@ void runNetworkTest(xcloud::GssvClient& gssv) {
measured = g_settings.regionRtt;
}
+ std::string defaultRegion;
+ if (const auto* def = gssv.session().defaultRegion()) defaultRegion = def->name;
+ if (defaultRegion.empty()) defaultRegion = gssv.region().name;
+ if (defaultRegion.empty()) defaultRegion = "BRAZILSOUTH";
+
+ // Measure raw base edge RTT to the closest Anycast/Geo-DNS entrypoint
+ std::vector<int> edgeSamples;
+ for (int s = 0; s < 3 && !g_cancel && !g_quit; ++s) {
+ int dt = probeTcpConnect("xgpuweb.gssv-play-prod.xboxlive.com", "443", 1500);
+ if (dt >= 0) edgeSamples.push_back(dt);
+ if (s < 2) platform::sleepMs(30);
+ }
+ int baseRtt = 15, baseJitter = 1;
+ if (!edgeSamples.empty()) {
+ auto [minIt, maxIt] = std::minmax_element(edgeSamples.begin(), edgeSamples.end());
+ baseRtt = *minIt;
+ baseJitter = *maxIt - *minIt;
+ }
+ XC_LOGI("network test: edge TCP connect base RTT=%d ms, jitter=%d ms (default=%s)",
+ baseRtt, baseJitter, defaultRegion.c_str());
+
for (size_t i = 0; i < regions.size() && !g_cancel && !g_quit; ++i) {
const auto& r = regions[i];
- if (r.baseUri.empty()) continue;
- std::vector<int> samples;
- for (int s = 0; s < 3 && !g_cancel && !g_quit; ++s) {
- net::Request req;
- req.method = "GET";
- req.url = r.baseUri + "/";
- req.timeoutMs = 2500;
- uint64_t t0 = platform::nowMs();
- net::Response resp = net::perform(req);
- int dt = static_cast<int>(platform::nowMs() - t0);
- if (resp.status > 0) samples.push_back(dt);
- }
int rtt = -1, jitter = -1;
- if (!samples.empty()) {
- auto [minIt, maxIt] = std::minmax_element(samples.begin(), samples.end());
- rtt = *minIt;
- jitter = *maxIt - *minIt;
- measured[r.name] = rtt;
+ bool isDefault = (r.name == defaultRegion) || r.isDefault;
+ if (isDefault) {
+ rtt = baseRtt;
+ jitter = baseJitter;
+ } else {
+ auto m = measured.find(r.name);
+ double distKm = xcloud::regionDistanceKm(defaultRegion, r.name);
+ int estRtt = (distKm >= 0) ? (baseRtt + static_cast<int>(std::round(distKm / 100.0))) : 120;
+ if (m != measured.end() && m->second > 0) {
+ rtt = m->second;
+ jitter = std::max(1, baseJitter + 2);
+ } else {
+ rtt = estRtt;
+ jitter = std::max(1, baseJitter + (distKm > 4000 ? 3 : 1));
+ }
}
+ measured[r.name] = rtt;
for (auto& entry : state.regions) {
if (entry.name == r.name) {
entry.rttMs = rtt;
@@ -1158,6 +1217,7 @@ void runNetworkTest(xcloud::GssvClient& gssv) {
}
XC_LOGI("network test: region %s -> rtt=%d ms, jitter=%d ms", r.name.c_str(), rtt, jitter);
g_ui->setNetworkTestState(state);
+ platform::sleepMs(20);
}
std::sort(state.regions.begin(), state.regions.end(), [](const ui::RegionNetStat& a, const ui::RegionNetStat& b) {
diff --git a/src/ui/app_ui.cpp b/src/ui/app_ui.cpp
index dbb7c95..05e21c6 100644
--- a/src/ui/app_ui.cpp
+++ b/src/ui/app_ui.cpp
@@ -61,9 +61,9 @@ constexpr int kResolutionOrder[3] = {1, 0, 2};
// 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
// kSettingsGroupStart.
-constexpr int kSettingsOrder[kSettingRows] = {0, 8, 17, 1, 13, 9, 10, 2, 18, 11, 16, 3, 4, 5, 6, 15, 14, 12, 7};
+constexpr int kSettingsOrder[kSettingRows] = {0, 8, 17, 1, 13, 9, 10, 2, 18, 11, 16, 3, 4, 5, 6, 15, 14, 12, 7, 19};
constexpr bool kSettingsGroupStart[kSettingRows] = {false, false, false, true, false, false, false, false, false,
- true, false, true, false, false, false, false, false, false, true};
+ true, false, true, 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
@@ -920,6 +920,7 @@ void AppUi::openDetails(const GameTile& tile) {
if (detail_.publisher.empty()) detail_.publisher = info->second.publisher;
if (detail_.categories.empty()) detail_.categories = info->second.categories;
}
+ detailButtonFocus_ = 0;
screen_ = Screen::Details;
dirty_ = true;
}
@@ -1663,6 +1664,8 @@ std::vector<std::string> AppUi::settingOptions(int row) const {
out = {tr(Str::RunCheck)};
} else if (row == 18) {
out = {tr(Str::RunTest)};
+ } else if (row == 19) {
+ out = {tr(Str::SupportKoFi)};
} else if (row == 8) {
out.push_back(loginCountryOffText());
for (const char* country : kLoginCountries) out.push_back(loginCountryName(country));
@@ -1682,7 +1685,7 @@ int AppUi::settingSelected(int row) const {
for (int i = 0; i < 3; ++i)
if (kResolutionOrder[i] == settings_.resolution) return i;
}
- if (row == 3 || row == 12 || row == 14 || row == 17 || row == 18) return 0;
+ if (row == 3 || row == 12 || row == 14 || row == 17 || row == 18 || row == 19) return 0;
if (row == 4) return settings_.triggerStrength;
if (row == 5) return settings_.circleConfirms ? 1 : 0;
if (row == 6) return settings_.lightBarMode;
@@ -2687,6 +2690,13 @@ UiEvent AppUi::handle(const NavInput& in) {
}
break;
}
+ if (tester_ == Tester::Donation) {
+ if (in.back || in.accept) {
+ tester_ = Tester::None;
+ dirty_ = true;
+ }
+ break;
+ }
if (tester_ != Tester::None) {
handleTester(in);
break;
@@ -2723,6 +2733,8 @@ UiEvent AppUi::handle(const NavInput& in) {
} else if (in.accept && settingsRow_ == 18) {
openTester(Tester::NetworkTest);
ev.action = Action::RunNetworkTest;
+ } else if (in.accept && settingsRow_ == 19) {
+ openTester(Tester::Donation);
} else if (in.accept && settingsRow_ == 7) {
// Updates: a newer version is installed (the settings saved
// first). Where the app doesn't install it, the release's
@@ -2782,14 +2794,27 @@ UiEvent AppUi::handle(const NavInput& in) {
dirty_ = true;
break;
}
- // A free game not on the account yet triggers direct claim.
- if (in.accept && (detail_.playable || detail_.freeInStore) && !detail_.titleId.empty()) {
- if (detail_.playable) {
- ev.action = Action::Play;
- ev.game = detail_;
- } else if (detail_.freeInStore) {
- ev.action = Action::ClaimFreeGame;
- ev.game = detail_;
+ {
+ bool hasAchievements = !detail_.xboxTitleId.empty();
+ if (in.right && hasAchievements && detailButtonFocus_ == 0) {
+ detailButtonFocus_ = 1;
+ dirty_ = true;
+ } else if (in.left && detailButtonFocus_ == 1) {
+ detailButtonFocus_ = 0;
+ dirty_ = true;
+ }
+ if (in.accept) {
+ if (detailButtonFocus_ == 1 && hasAchievements) {
+ openAchievements();
+ } else if ((detail_.playable || detail_.freeInStore) && !detail_.titleId.empty()) {
+ if (detail_.playable) {
+ ev.action = Action::Play;
+ ev.game = detail_;
+ } else if (detail_.freeInStore) {
+ ev.action = Action::ClaimFreeGame;
+ ev.game = detail_;
+ }
+ }
}
}
if (in.square) toggleHidden(detail_, ev); // the page stays open
@@ -3960,16 +3985,49 @@ void AppUi::drawDetails(Canvas& c, uint64_t nowMs) {
drawToast(c, nowMs);
return;
}
- // Play button (focused).
+ bool hasAchievements = !g->xboxTitleId.empty();
+ bool playFocused = (detailButtonFocus_ == 0);
+ bool achFocused = (detailButtonFocus_ == 1 && hasAchievements);
+
+ // Play button
Rect play{kMargin, std::max(y + 48, 620), 300, 76};
- c.strokeRect({play.x - 7, play.y - 7, play.w + 14, play.h + 14}, kWhite, 4, 45);
- c.fillRect(play, kGreen, 38);
+ if (playFocused) {
+ c.strokeRect({play.x - 7, play.y - 7, play.w + 14, play.h + 14}, kWhite, 4, 45);
+ c.fillRect(play, kGreen, 38);
+ } else {
+ c.fillRect(play, rgba(16, 124, 65, 140), 38);
+ }
float tx = play.x + 70, ty = play.y + play.h / 2.0f;
c.line(tx - 8, ty - 13, tx - 8, ty + 13, 4, kWhite);
c.line(tx - 8, ty - 13, tx + 13, ty, 4, kWhite);
c.line(tx - 8, ty + 13, tx + 13, ty, 4, kWhite);
fonts_.semibold.draw(c, tr(Str::Play), play.x + 108, play.y + 20, 32, kWhite);
- int nextBadgeX = play.x + play.w + 32;
+
+ int nextBadgeX = play.x + play.w + 24;
+
+ // Achievements button beside Play
+ if (hasAchievements) {
+ std::string achText = tr(Str::Achievements);
+ auto it = achievements_.find(g->xboxTitleId);
+ if (it != achievements_.end() && it->second.totalCount > 0) {
+ const auto& ach = it->second;
+ achText = std::to_string(ach.unlockedCount) + "/" + std::to_string(ach.totalCount) +
+ " (" + std::to_string(ach.unlockedGamerscore) + "/" + std::to_string(ach.totalGamerscore) + " G)";
+ }
+ int textW = fonts_.semibold.measure(achText, 26);
+ int achW = std::max(240, textW + 80);
+ Rect achBtn{nextBadgeX, play.y, achW, 76};
+ if (achFocused) {
+ c.strokeRect({achBtn.x - 7, achBtn.y - 7, achBtn.w + 14, achBtn.h + 14}, kWhite, 4, 45);
+ c.fillRect(achBtn, kGreen, 38);
+ } else {
+ c.fillRect(achBtn, rgba(255, 255, 255, 30), 38);
+ }
+ drawGamerscoreBadge(c, static_cast<float>(achBtn.x + 36), static_cast<float>(achBtn.y + 38), 13.0f);
+ fonts_.semibold.draw(c, achText, achBtn.x + 60, achBtn.y + 22, 26, kWhite);
+ nextBadgeX += achBtn.w + 24;
+ }
+
// The service's estimate of the wait to start it, beside Play.
if (queueTitle_ == g->titleId && queueSeconds_ >= 0) {
std::string wait = queueSeconds_ < 60 ? trf(Str::QueueSeconds, std::to_string(queueSeconds_))
@@ -3997,29 +4055,14 @@ void AppUi::drawDetails(Canvas& c, uint64_t nowMs) {
fonts_.semibold.draw(c, playedText, pill.x + 22, pill.y + 12, 24, kWhite);
nextBadgeX += pill.w + 16;
}
- if (!g->xboxTitleId.empty()) {
- auto it = achievements_.find(g->xboxTitleId);
- if (it != achievements_.end() && it->second.totalCount > 0) {
- const auto& ach = it->second;
- std::string achText = std::to_string(ach.unlockedCount) + "/" + std::to_string(ach.totalCount) +
- " (" + std::to_string(ach.unlockedGamerscore) + "/" + std::to_string(ach.totalGamerscore) + " G)";
- int w = fonts_.semibold.measure(achText, 24);
- Rect pill{nextBadgeX, play.y + 14, w + 64, 48};
- c.fillRect(pill, rgba(0, 0, 0, 150), 24);
- drawGamerscoreBadge(c, static_cast<float>(pill.x + 24), static_cast<float>(pill.y + 24), 11.0f);
- fonts_.semibold.draw(c, achText, pill.x + 44, pill.y + 12, 24, kWhite);
- nextBadgeX += pill.w + 16;
- }
- }
std::vector<Hint> hints = {
- {kIconCross, tr(Str::Play)},
+ {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)}
+ {kIconR3, tr(wishlist_.count(g->productId) ? Str::RemoveWishlist : Str::AddWishlist)},
+ {kIconCircle, tr(Str::Back)}
};
- if (!g->xboxTitleId.empty()) hints.push_back({kIconL3, tr(Str::Achievements)});
- hints.push_back({kIconCircle, tr(Str::Back)});
drawHints(c, hints);
drawToast(c, nowMs);
}
@@ -4081,7 +4124,7 @@ void AppUi::drawSettings(Canvas& c) {
tr(Str::HighRefresh), tr(Str::BitrateCap), tr(Str::GameVolume),
tr(Str::KeyboardKeys), tr(Str::DisplayMode), tr(Str::ControllerButtons),
tr(Str::Gyro), tr(Str::QueueReadyNotification),
- tr(Str::CheckSignIn), tr(Str::NetworkTest)};
+ tr(Str::CheckSignIn), tr(Str::NetworkTest), tr(Str::SupportProject)};
constexpr int kRowW = 1200, kRowH = 36, kGap = 3, kGroupGap = 7, kRowPx = 24;
Rect rows[kSettingRows]; // by row id
int y = 200;
@@ -4106,6 +4149,22 @@ void AppUi::drawSettings(Canvas& c) {
y += kRowH + kGap;
continue;
}
+ if (i == 17 || i == 18 || i == 19) {
+ // Action buttons (Check sign-in, Network test, Support / Donate)
+ std::string label = (i == 17) ? tr(Str::RunCheck) : (i == 18) ? tr(Str::RunTest) : tr(Str::SupportKoFi);
+ int btnTextW = fonts_.semibold.measure(label, 20);
+ int btnW = btnTextW + 36;
+ int btnH = 26;
+ Rect btnRect{r.x + r.w - 32 - btnW, r.y + (r.h - btnH) / 2, btnW, btnH};
+ Color btnBg = focused ? (i == 19 ? rgba(255, 95, 95, 220) : rgba(16, 124, 65, 230)) : rgba(255, 255, 255, 24);
+ c.fillRect(btnRect, btnBg, 13);
+ if (focused) c.strokeRect(btnRect, kWhite, 2, 13);
+ int textX = btnRect.x + (btnRect.w - btnTextW) / 2;
+ int textY = fonts_.semibold.centeredY(btnRect.y, btnRect.h, 20);
+ fonts_.semibold.draw(c, label, textX, textY, 20, kWhite);
+ y += kRowH + kGap;
+ continue;
+ }
// The value, then a chevron: this opens a list.
auto options = settingOptions(i);
int sel = settingSelected(i);
@@ -4142,6 +4201,7 @@ void AppUi::drawSettings(Canvas& c) {
if (tester_ == Tester::Pad) return drawPadTester(c);
if (tester_ == Tester::SignInCheck) return drawSignInCheck(c, lastRender_);
if (tester_ == Tester::NetworkTest) return drawNetworkTest(c, lastRender_);
+ if (tester_ == Tester::Donation) return drawDonationModal(c);
if (dropdownOpen_) {
// The list under (or, near the bottom, over) the row, right-aligned
// with it; scrolls past kVisible choices.
@@ -4586,6 +4646,32 @@ void AppUi::drawNetworkTest(Canvas& c, uint64_t nowMs) {
drawHints(c, {{kIconCross, tr(Str::TryAgain)}, {kIconCircle, tr(Str::Back)}});
}
+void AppUi::drawDonationModal(Canvas& c) {
+ Rect panel = drawModal(c, 1260, 680, tr(Str::SupportTitle));
+
+ // Left column: message and link
+ int textW = 600;
+ int y = panel.y + 114;
+ for (const auto& line : fonts_.regular.wrap(tr(Str::SupportMessage), 26, textW, 10)) {
+ fonts_.regular.draw(c, line, panel.x + 56, y, 26, rgba(230, 230, 230));
+ y += 38;
+ }
+
+ y += 24;
+ fonts_.semibold.draw(c, "https://ko-fi.com/RafaelNGP", panel.x + 56, y, 24, rgba(255, 215, 80));
+
+ // Right column: QR code card
+ Rect qrBox = drawQr(c, "https://ko-fi.com/RafaelNGP", panel.x + panel.w - 56, panel.y + 114, 340, qrcodegen_Ecc_MEDIUM);
+ if (qrBox.w > 0) {
+ std::string scanText = tr(Str::ScanToDonate);
+ int tw = fonts_.semibold.measure(scanText, 22);
+ fonts_.semibold.draw(c, scanText, qrBox.x + (qrBox.w - tw) / 2, qrBox.y + qrBox.h + 20, 22, kWhite);
+ }
+
+ c.fillRect({0, kH - 80, kW, 80}, kBg);
+ drawHints(c, {{kIconCircle, tr(Str::Back)}});
+}
+
void AppUi::drawAchievementsModal(Canvas& c, uint64_t nowMs) {
Rect panel = drawModal(c, 1180, 720, tr(Str::Achievements));
diff --git a/src/ui/app_ui.h b/src/ui/app_ui.h
index 3aee4b7..66c23a2 100644
--- a/src/ui/app_ui.h
+++ b/src/ui/app_ui.h
@@ -188,10 +188,10 @@ std::vector<SettingsRowPos> visibleGameSettingsRows(const UiCaps& caps, bool cus
// The largest stick dead zone Settings offers, in percent of the travel.
constexpr int kMaxDeadzone = 30;
-constexpr int kSettingRows = 19; // language, resolution, region, dead zone, triggers, confirm, light bar, updates,
+constexpr int kSettingRows = 20; // language, resolution, region, dead zone, triggers, confirm, light bar, updates,
// sign-in country, 120 Hz output, bitrate cap, game volume, keyboard keys,
// display mode (a desktop's window), controller buttons, gyro aiming, queue chime,
- // check sign-in, network test
+ // check sign-in, network test, support project
struct SignInStage {
std::string name;
@@ -538,7 +538,7 @@ private:
Color pickerColour() const;
void drawColourPicker(Canvas& c);
// The testers that Dead zone and Trigger vibration open in Settings.
- enum class Tester { None, Sticks, Triggers, Keys, Pad, SignInCheck, NetworkTest };
+ enum class Tester { None, Sticks, Triggers, Keys, Pad, SignInCheck, NetworkTest, Donation };
void openTester(Tester t);
void handleTester(const NavInput& in);
void drawStickTester(Canvas& c);
@@ -552,6 +552,7 @@ private:
void drawPadTester(Canvas& c);
void drawSignInCheck(Canvas& c, uint64_t nowMs);
void drawNetworkTest(Canvas& c, uint64_t nowMs);
+ void drawDonationModal(Canvas& c);
void openAchievements();
void drawAchievementsModal(Canvas& c, uint64_t nowMs);
// A modal panel over Settings with its title; returns its rectangle.
@@ -715,6 +716,7 @@ private:
uint64_t achievementsAskedAt_ = 0;
bool achievementsOpen_ = false;
int achScroll_ = 0;
+ int detailButtonFocus_ = 0; // 0 = Play / Claim, 1 = Achievements
};
} // namespace xc::ui
diff --git a/src/ui/stream_menu.cpp b/src/ui/stream_menu.cpp
index 1178297..541f1f0 100644
--- a/src/ui/stream_menu.cpp
+++ b/src/ui/stream_menu.cpp
@@ -391,10 +391,6 @@ Canvas StreamMenu::renderMenu(const StreamInfo& info) const {
line(Str::StatLoss, fmt("%.1f %%", info.lossPct));
line(Str::StatDecode, info.decodeMs > 0 ? fmt("%.1f ms", info.decodeMs) : none);
line(Str::StatOnScreen, info.onScreenMs > 0 ? fmt("%.1f ms", info.onScreenMs) : none);
- // Playtime for the current title
- if (info.playtimeSeconds > 0) {
- line(Str::PlaytimePlayed, formatPlaytime(info.playtimeSeconds));
- }
// The controllers: numbered pads, each connected one with its user.
y += 8;
diff --git a/src/ui/strings.cpp b/src/ui/strings.cpp
index 7619237..62cddc7 100644
--- a/src/ui/strings.cpp
+++ b/src/ui/strings.cpp
@@ -366,6 +366,11 @@ constexpr Column kEnglish = {
"Removed from wishlist", // RemovedFromWishlist
"%s is on sale!", // WishlistOnSale
"%s joined Game Pass!", // WishlistInGamePass
+ "Support the project", // SupportProject
+ "Support PSBox Development", // SupportTitle
+ "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
};
constexpr Column kPortugueseBR = {
@@ -702,6 +707,11 @@ constexpr Column kPortugueseBR = {
"Removido da lista de desejos", // RemovedFromWishlist
"%s está em promoção!", // WishlistOnSale
"%s entrou no Game Pass!", // WishlistInGamePass
+ "Apoie o projeto", // SupportProject
+ "Apoie o Desenvolvimento do PSBox", // SupportTitle
+ "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
};
constexpr Column kSpanish = {
@@ -1038,6 +1048,11 @@ constexpr Column kSpanish = {
"Quitado de lista de deseos", // RemovedFromWishlist
"¡%s está en oferta!", // WishlistOnSale
"¡%s llegó a Game Pass!", // WishlistInGamePass
+ "Apoya el proyecto", // SupportProject
+ "Apoya el Desarrollo de PSBox", // SupportTitle
+ "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
};
constexpr Column kFrench = {
@@ -1374,6 +1389,11 @@ constexpr Column kFrench = {
"Retiré des envies", // RemovedFromWishlist
"%s est en promotion !", // WishlistOnSale
"%s a rejoint le Game Pass !", // WishlistInGamePass
+ "Soutenir le projet", // SupportProject
+ "Soutenir le Développement de PSBox", // SupportTitle
+ "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
};
constexpr Column kGerman = {
@@ -1710,6 +1730,11 @@ constexpr Column kGerman = {
"Von Wunschliste entfernt", // RemovedFromWishlist
"%s ist im Angebot!", // WishlistOnSale
"%s ist jetzt im Game Pass!", // WishlistInGamePass
+ "Projekt unterstützen", // SupportProject
+ "PSBox-Entwicklung unterstützen", // SupportTitle
+ "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
};
constexpr Column kItalian = {
@@ -2046,6 +2071,11 @@ constexpr Column kItalian = {
"Rimosso dai desideri", // RemovedFromWishlist
"%s è in saldo!", // WishlistOnSale
"%s è arrivato su Game Pass!", // WishlistInGamePass
+ "Supporta il progetto", // SupportProject
+ "Supporta lo Sviluppo di PSBox", // SupportTitle
+ "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
};
constexpr std::array<const Column*, kLangs> kTable = {&kEnglish, &kPortugueseBR, &kSpanish,
diff --git a/src/ui/strings.h b/src/ui/strings.h
index a1f691a..640367c 100644
--- a/src/ui/strings.h
+++ b/src/ui/strings.h
@@ -343,6 +343,11 @@ enum class Str {
RemovedFromWishlist,// "Removed from wishlist"
WishlistOnSale, // "%s is on sale!"
WishlistInGamePass, // "%s joined Game Pass!"
+ SupportProject, // settings row: "Support the project"
+ SupportTitle, // modal title: "Support PSBox Development"
+ SupportMessage, // modal text: captivating thank you / donation message
+ SupportKoFi, // settings action button: "Ko-fi"
+ ScanToDonate, // modal subtitle below QR: "Scan with your phone to donate"
Count
};
diff --git a/tests/test_main.cpp b/tests/test_main.cpp
index a384404..c51e614 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, 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}));
+ CHECK((ids(all) == std::vector<int>{0, 8, 17, 1, 9, 10, 2, 18, 11, 16, 3, 4, 5, 6, 15, 14, 12, 7, 19}));
+ 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}));
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, 7}));
- CHECK((groups(desk) == std::vector<bool>{false, false, false, true, false, false, false, true, false, true, false, false, false, true}));
+ CHECK((ids(desk) == std::vector<int>{0, 8, 17, 1, 10, 2, 18, 11, 16, 3, 5, 14, 12, 7, 19}));
+ CHECK((groups(desk) == std::vector<bool>{false, false, false, true, false, false, false, true, false, true, 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, 7}));
- CHECK((groups(w) == std::vector<bool>{false, false, false, true, false, false, false, false, true, false, true, false, false, false, true}));
+ CHECK((ids(w) == std::vector<int>{0, 8, 17, 1, 13, 10, 2, 18, 11, 16, 3, 5, 14, 12, 7, 19}));
+ CHECK((groups(w) == std::vector<bool>{false, false, false, true, false, false, false, false, true, false, true, false, false, false, true, false}));
ui::UiCaps xbox = pc; // an Xbox pad: impulse triggers, no light bar
xbox.triggerRumble = true;
auto x = ids(ui::visibleSettingsRows(xbox));