Xbox Cloud Gaming app for PS5 Homebrew
C
psbox: Xbox button glyphs with an Xbox (or generic / Switch) pad
Rafael Abud Ferreira11aceb9e5ea9
diff --git a/CMakeLists.txt b/CMakeLists.txtindex 3eed823..69113a2 100644--- a/CMakeLists.txt+++ b/CMakeLists.txt@@ -88,6 +88,7 @@ add_library(xcloud_ui STATICsrc/ui/stream_menu.cppsrc/ui/toast_view.cppsrc/ui/pad_icons.cpp+ src/ui/pad_glyphs.cppsrc/ui/accent_color.cppsrc/ui/brand.cppsrc/app/library.cppdiff --git a/src/app/app_core.cpp b/src/app/app_core.cppindex 525a35a..498ac85 100644--- a/src/app/app_core.cpp+++ b/src/app/app_core.cpp@@ -22,6 +22,7 @@#include "input/kbm.h"#include "input/keyboard_nav.h"#include "ui/input_mode.h"+#include "ui/pad_glyphs.h"#include "input/tuning.h"#include "net/http.h"#include "platform/platform.h"@@ -408,6 +409,16 @@ bool Core::frame() {g_ui->invalidate();streamScreen->redrawMenu();}+ // The controller's glyphs: those of the pad driving the menus (the+ // first connected one, which input::poll() reads), kept while none+ // is connected. The PS5's pads are DualSense: always PlayStation.+ const input::PadKind kind = input::anyPadCaps().kind;+ const ui::GlyphStyle style = ui::glyphStyleFor(kind);+ if (kind != input::PadKind::None && style != ui::g_glyphStyle) {+ ui::g_glyphStyle = style;+ g_ui->invalidate();+ streamScreen->redrawMenu();+ }}// Keys 1-4 (off a game, or with the app's menu open in one): the// player the keyboard and mouse play as. 1 native with player 1;diff --git a/src/app/desktop_selftest.cpp b/src/app/desktop_selftest.cppindex 425084a..9fc9751 100644--- a/src/app/desktop_selftest.cpp+++ b/src/app/desktop_selftest.cpp@@ -19,6 +19,7 @@#include "ui/canvas.h"#include "ui/font.h"#include "ui/image_cache.h"+#include "ui/pad_glyphs.h"#include "ui/stream_menu.h"#include "util/log.h"@@ -204,6 +205,26 @@ int desktopSelftest(const std::string& dir) {ui.render(canvas, platform::nowMs());drawCanvas(canvas);check(screenshot(dir, "2-settings.png", shot) && varied(shot), "Settings screen (2-settings.png)");+ // The same with an Xbox pad's glyphs (A / B, Menu, View...).+ {+ const std::vector<uint8_t> ps = shot.rgb;+ ui::g_glyphStyle = ui::glyphStyleFor(input::PadKind::Xbox);+ ui.invalidate();+ ui.render(canvas, platform::nowMs());+ drawCanvas(canvas);+ check(screenshot(dir, "2b-settings-xbox.png", shot) && varied(shot) && shot.rgb != ps,+ "Settings with Xbox glyphs (2b-settings-xbox.png)");+ ui::NavInput back;+ back.back = true;+ back.nowMs = platform::nowMs();+ ui.handle(back); // the home screen: LB / RB, Y, Menu, View+ ui.render(canvas, platform::nowMs());+ drawCanvas(canvas);+ check(ui.screen() == ui::Screen::Home && screenshot(dir, "2c-home-xbox.png", shot) && varied(shot),+ "home screen with Xbox glyphs (2c-home-xbox.png)");+ ui::g_glyphStyle = ui::GlyphStyle::PlayStation;+ ui.invalidate();+ }// A video frame through the mailbox, then under the game menu.Yuv bars = colourBars();diff --git a/src/ui/app_ui.cpp b/src/ui/app_ui.cppindex f29f31c..8de2683 100644--- a/src/ui/app_ui.cpp+++ b/src/ui/app_ui.cpp@@ -2,6 +2,7 @@// Copyright (C) 2026 RafaelNGP#include "ui/app_ui.h"#include "ui/input_mode.h"+#include "ui/pad_glyphs.h"#include "input/tuning.h"#include "xcloud/catalog.h"@@ -2544,25 +2545,17 @@ void AppUi::drawTopBar(Canvas& c) {}}-// A face button as on the pad: its symbol in its colour on a round key,-// `r` its radius (14 in the button hints).-static void drawFaceButton(Canvas& c, int icon, float cx, float cy, float r) {- const float k = r / 14.0f, t = 2.5f * k;- c.fillCircle(cx, cy, r, rgba(255, 255, 255, 40));- if (icon == kIconCross) {- c.line(cx - 6 * k, cy - 6 * k, cx + 6 * k, cy + 6 * k, t, rgba(124, 178, 232));- c.line(cx + 6 * k, cy - 6 * k, cx - 6 * k, cy + 6 * k, t, rgba(124, 178, 232));- } else if (icon == kIconCircle) {- c.strokeArc(cx, cy, 6.5f * k, t, 0, 6.2832f, rgba(255, 102, 102));- } else if (icon == kIconSquare) {- int h = static_cast<int>(6 * k);- c.strokeRect({static_cast<int>(cx) - h, static_cast<int>(cy) - h, 2 * h, 2 * h}, rgba(240, 130, 200),- std::max(2, static_cast<int>(2 * k)));- } else {- c.line(cx, cy - 7 * k, cx - 7 * k, cy + 5 * k, t, rgba(64, 226, 160));- c.line(cx, cy - 7 * k, cx + 7 * k, cy + 5 * k, t, rgba(64, 226, 160));- c.line(cx - 7 * k, cy + 5 * k, cx + 7 * k, cy + 5 * k, t, rgba(64, 226, 160));- }+// A face button (an Icon: Cross, Circle, Square, Triangle) as on the pad,+// in the glyphs of the pad in use (pad_glyphs.h), `r` its radius (14 in the+// button hints).+static PadButton faceOf(int icon) {+ return icon == kIconCross ? PadButton::Cross+ : icon == kIconCircle ? PadButton::Circle+ : icon == kIconSquare ? PadButton::Square+ : PadButton::Triangle;+}+static void drawFaceButton(Canvas& c, const Font& letters, int icon, float cx, float cy, float r) {+ ui::drawFaceButton(c, letters, g_glyphStyle, faceOf(icon), cx, cy, r);}void AppUi::drawHints(Canvas& c, const std::vector<std::pair<int, const char*>>& hints) {@@ -2591,17 +2584,25 @@ void AppUi::drawHints(Canvas& c, const std::vector<std::pair<int, const char*>>&icon = icon == kIconCross ? kIconCircle : kIconCross;x -= 10 + 2 * kR;float cx = x + kR, cy = y + 13;+ const GlyphStyle style = g_glyphStyle;+ const bool xbox = style == GlyphStyle::Xbox;if (icon == kIconL2R2) {+ const std::string both = std::string(buttonName(style, PadButton::L2)) + " " + buttonName(style, PadButton::R2);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.draw(c, both, pill.x + (pill.w - fonts_.bold.measure(both, 14)) / 2,fonts_.bold.centeredY(pill.y, pill.h, 14), 14, kGray);x -= 34;} else if (icon == kIconR3) {+ const char* r3 = buttonName(style, PadButton::R3);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,+ fonts_.bold.draw(c, r3, pill.x + (pill.w - fonts_.bold.measure(r3, 14)) / 2,fonts_.bold.centeredY(pill.y, pill.h, 14), 14, kGray);+ } else if (xbox && icon == kIconTouchpad) { // View+ drawXboxViewButton(c, cx, cy, kR, kGray);+ } else if (xbox && icon == kIconOptions) { // Menu+ drawXboxMenuButton(c, cx, cy, kR, kGray);} else if (icon == kIconTouchpad) {Rect pad{x - 18, static_cast<int>(cy) - 10, 2 * kR + 12, 20};c.fillRect(pad, rgba(255, 255, 255, 40), 6);@@ -2611,7 +2612,7 @@ void AppUi::drawHints(Canvas& c, const std::vector<std::pair<int, const char*>>&c.fillRect({x - 4, static_cast<int>(cy) - 11, 2 * kR + 8, 22}, rgba(255, 255, 255, 40), 11);for (int k = -1; k <= 1; ++k) c.line(cx - 8, cy + k * 5, cx + 8, cy + k * 5, 2, kGray);} else {- drawFaceButton(c, icon, cx, cy, kR);+ drawFaceButton(c, fonts_.bold, icon, cx, cy, kR);}x -= kGap;}@@ -2745,7 +2746,7 @@ void AppUi::drawTabs(Canvas& c) {c.fillRect(r, rgba(255, 255, 255, 40), 8);fonts_.bold.draw(c, name, cx - fonts_.bold.measure(name, 16) / 2, fonts_.bold.centeredY(r.y, r.h, 16), 16, kGray);};- shoulder(g_keyboardHints ? "Q" : "L1", x - 40);+ shoulder(g_keyboardHints ? "Q" : buttonName(g_glyphStyle, PadButton::L1), x - 40);for (int i = 0; i < 3; ++i) {bool on = static_cast<int>(tab_) == i;Rect r{x, kY, widths[i], kH};@@ -2753,7 +2754,7 @@ void AppUi::drawTabs(Canvas& c) {fonts_.semibold.draw(c, labels[i], x + kPad, fonts_.semibold.centeredY(kY, kH, kPx), kPx, on ? kBg : kGray);x += widths[i] + kGap;}- shoulder(g_keyboardHints ? "E" : "R1", x - kGap + 40);+ shoulder(g_keyboardHints ? "E" : buttonName(g_glyphStyle, PadButton::R1), x - kGap + 40);}namespace {@@ -2989,7 +2990,7 @@ void AppUi::drawLibrary(Canvas& c, uint64_t nowMs) {std::string label = trf(Str::SortLabel, tr(sortName));int w = fonts_.semibold.measure(label, 22);int right = left + kGridW;- const char* sortKey = g_keyboardHints ? "R" : "R3";+ const char* sortKey = g_keyboardHints ? "R" : buttonName(g_glyphStyle, PadButton::R3);Rect pill{right - 44, 112, 44, 28};c.fillRect(pill, rgba(255, 255, 255, 40), 8);if (g_keyboardHints) c.strokeRect(pill, kGray, 2, 8);@@ -3562,7 +3563,7 @@ void AppUi::drawSettings(Canvas& c) {int vx = r.x + r.w - 76;if (i == 5) {// The confirm button, as the button itself.- drawFaceButton(c, settings_.circleConfirms ? kIconCircle : kIconCross, vx - 20.0f, cy, 20);+ drawFaceButton(c, fonts_.bold, settings_.circleConfirms ? kIconCircle : kIconCross, vx - 20.0f, cy, 20);} else {int w = fonts_.regular.measure(value, 28);fonts_.regular.draw(c, value, vx - w, fonts_.regular.centeredY(r.y, r.h, 28), 28, focused ? kWhite : kGray);@@ -3608,7 +3609,7 @@ void AppUi::drawSettings(Canvas& c) {if (on) c.fillRect(item, kWhite, 12);Color text = on ? kBg : (i == sel ? kWhite : kGray);if (settingsRow_ == 5)- drawFaceButton(c, i == 1 ? kIconCircle : kIconCross, item.x + 44.0f, item.y + item.h / 2.0f, 20);+ drawFaceButton(c, fonts_.bold, i == 1 ? kIconCircle : kIconCross, item.x + 44.0f, item.y + item.h / 2.0f, 20);elsefonts_.semibold.draw(c, options[static_cast<size_t>(i)], item.x + 24,fonts_.semibold.centeredY(item.y, item.h, 26), 26, text);@@ -3836,7 +3837,7 @@ void AppUi::drawTriggerTester(Canvas& c) {int fill = static_cast<int>(kBarH * std::clamp(pressed[t], 0.0f, 1.0f));int level = input::triggerAmplitude(static_cast<uint8_t>(std::lround(pressed[t] * 255)), settings_.triggerStrength);if (fill > 0) c.fillRect({bx, by + kBarH - fill, kBarW, fill}, level ? rgba(90, 220, 110) : rgba(120, 120, 120), 16);- std::string name = t ? "R2" : "L2";+ std::string name = buttonName(g_glyphStyle, t ? PadButton::R2 : PadButton::L2);fonts_.bold.draw(c, name, bx + (kBarW - fonts_.bold.measure(name, 26)) / 2, by + kBarH + 14, 26, kWhite);std::string lv = trf(Str::TriggerLevel, std::to_string(level) + " / 8");fonts_.regular.draw(c, lv, bx + (kBarW - fonts_.regular.measure(lv, 22)) / 2, by + kBarH + 48, 22, kGray);@@ -3856,6 +3857,15 @@ void AppUi::drawKeysTester(Canvas& c) {stick + kUp, stick + kDown, stick + kLeft, stick + kRight, dpad + kUp, dpad + kDown, dpad + kLeft, dpad + kRight,"A", "B", "X", "Y", "L1 (LB)", "R1 (RB)", "L2 (LT)", "R2 (RT)", "L3", "R3", "View", "Menu"};const int faceIcon[4] = {kIconCross, kIconCircle, kIconSquare, kIconTriangle}; // A B X Y+ // An Xbox pad: its own names alone.+ const bool xbox = g_glyphStyle == GlyphStyle::Xbox;+ std::string xboxNames[input::kKeyActions];+ if (xbox) {+ static constexpr PadButton kShoulders[6] = {PadButton::L1, PadButton::R1, PadButton::L2,+ PadButton::R2, PadButton::L3, PadButton::R3};+ for (int i = 0; i < 6; ++i)+ xboxNames[static_cast<int>(input::KeyAction::LB) + i] = buttonName(GlyphStyle::Xbox, kShoulders[i]);+ }constexpr int kRowH = 52, kGap = 8, kChipW = 170, kColGap = 40;const int colW = (panel.w - 112 - kColGap) / 2;const bool capturing = captureSince_ != 0;@@ -3867,10 +3877,10 @@ void AppUi::drawKeysTester(Canvas& c) {int ty = fonts_.semibold.centeredY(r.y, r.h, 24);if (a >= static_cast<int>(input::KeyAction::A) && a <= static_cast<int>(input::KeyAction::Y)) {int k = a - static_cast<int>(input::KeyAction::A);- drawFaceButton(c, faceIcon[k], r.x + 38.0f, r.y + r.h / 2.0f, 16);- fonts_.semibold.draw(c, "(" + names[a] + ")", r.x + 66, ty, 24, kGray);+ drawFaceButton(c, fonts_.bold, faceIcon[k], r.x + 38.0f, r.y + r.h / 2.0f, 16);+ if (!xbox) fonts_.semibold.draw(c, "(" + names[a] + ")", r.x + 66, ty, 24, kGray);} else {- fonts_.semibold.draw(c, names[a], r.x + 22, ty, 24, kWhite);+ fonts_.semibold.draw(c, xbox && !xboxNames[a].empty() ? xboxNames[a] : names[a], r.x + 22, ty, 24, kWhite);}for (int slot = 0; slot < 2; ++slot) {Rect chip{r.x + r.w - 10 - (2 - slot) * kChipW - (1 - slot) * 10, r.y + 7, kChipW, r.h - 14};@@ -4148,7 +4158,7 @@ void AppUi::drawGameSettings(Canvas& c) {fonts_.regular.draw(c, "\xE2\x80\xB9", static_cast<int>(cx) - 40, fonts_.regular.centeredY(r.y, r.h, 26), 26, kWhite);fonts_.regular.draw(c, "\xE2\x80\xBA", static_cast<int>(cx) + 28, fonts_.regular.centeredY(r.y, r.h, 26), 26, kWhite);}- drawFaceButton(c, activeGameProfile_.circleConfirms ? kIconCircle : kIconCross, cx, cy, 16);+ drawFaceButton(c, fonts_.bold, activeGameProfile_.circleConfirms ? kIconCircle : kIconCross, cx, cy, 16);} else {std::string disp = focused ? ("\xE2\x80\xB9 " + value + " \xE2\x80\xBA") : value;int vw = fonts_.regular.measure(disp, 26);diff --git a/src/ui/pad_glyphs.cpp b/src/ui/pad_glyphs.cppnew file mode 100644index 0000000..f12b223--- /dev/null+++ b/src/ui/pad_glyphs.cpp@@ -0,0 +1,90 @@+// SPDX-License-Identifier: GPL-3.0-or-later+// Copyright (C) 2026 RafaelNGP+#include "ui/pad_glyphs.h"++#include "ui/font.h"++#include <algorithm>++namespace xc::ui {++GlyphStyle glyphStyleFor(input::PadKind kind) {+ switch (kind) {+ case input::PadKind::Xbox:+ case input::PadKind::Switch:+ case input::PadKind::Generic: return GlyphStyle::Xbox;+ default: return GlyphStyle::PlayStation;+ }+}++const char* buttonName(GlyphStyle style, PadButton b) {+ static const char* const kPs[] = {"Cross", "Circle", "Square", "Triangle", "Options", "Touchpad",+ "L1", "R1", "L2", "R2", "L3", "R3"};+ static const char* const kXbox[] = {"A", "B", "X", "Y", "Menu", "View", "LB", "RB", "LT", "RT", "LS", "RS"};+ int i = static_cast<int>(b);+ if (i < 0 || i > static_cast<int>(PadButton::R3)) return "";+ return style == GlyphStyle::Xbox ? kXbox[i] : kPs[i];+}++Color faceColor(GlyphStyle style, PadButton b) {+ if (style == GlyphStyle::Xbox) {+ switch (b) {+ case PadButton::Cross: return rgba(84, 178, 58); // A+ case PadButton::Circle: return rgba(222, 62, 54); // B+ case PadButton::Square: return rgba(48, 120, 222); // X+ case PadButton::Triangle: return rgba(236, 184, 30); // Y+ default: return 0;+ }+ }+ switch (b) {+ case PadButton::Cross: return rgba(124, 178, 232);+ case PadButton::Circle: return rgba(255, 102, 102);+ case PadButton::Square: return rgba(240, 130, 200);+ case PadButton::Triangle: return rgba(64, 226, 160);+ default: return 0;+ }+}++void drawFaceButton(Canvas& c, const Font& letters, GlyphStyle style, PadButton b, float cx, float cy, float r) {+ const float k = r / 14.0f, t = 2.5f * k;+ const Color col = faceColor(style, b);+ if (style == GlyphStyle::Xbox) {+ c.fillCircle(cx, cy, r, col);+ const char* name = buttonName(style, b);+ int px = std::max(10, static_cast<int>(r * 1.25f));+ int top = static_cast<int>(cy - r), h = static_cast<int>(2 * r);+ Color ink = b == PadButton::Triangle ? rgba(30, 30, 30) : rgba(255, 255, 255);+ letters.draw(c, name, static_cast<int>(cx) - letters.measure(name, px) / 2, letters.centeredY(top, h, px), px, ink);+ return;+ }+ c.fillCircle(cx, cy, r, rgba(255, 255, 255, 40));+ if (b == PadButton::Cross) {+ c.line(cx - 6 * k, cy - 6 * k, cx + 6 * k, cy + 6 * k, t, col);+ c.line(cx + 6 * k, cy - 6 * k, cx - 6 * k, cy + 6 * k, t, col);+ } else if (b == PadButton::Circle) {+ c.strokeArc(cx, cy, 6.5f * k, t, 0, 6.2832f, col);+ } else if (b == PadButton::Square) {+ int h = static_cast<int>(6 * k);+ c.strokeRect({static_cast<int>(cx) - h, static_cast<int>(cy) - h, 2 * h, 2 * h}, col, std::max(2, static_cast<int>(2 * k)));+ } else {+ c.line(cx, cy - 7 * k, cx - 7 * k, cy + 5 * k, t, col);+ c.line(cx, cy - 7 * k, cx + 7 * k, cy + 5 * k, t, col);+ c.line(cx - 7 * k, cy + 5 * k, cx + 7 * k, cy + 5 * k, t, col);+ }+}++void drawXboxMenuButton(Canvas& c, float cx, float cy, float r, Color color) {+ const float k = r / 14.0f;+ c.fillCircle(cx, cy, r, rgba(255, 255, 255, 40));+ for (int i = -1; i <= 1; ++i) c.line(cx - 6 * k, cy + i * 4 * k, cx + 6 * k, cy + i * 4 * k, 2 * k, color);+}++void drawXboxViewButton(Canvas& c, float cx, float cy, float r, Color color) {+ const float k = r / 14.0f;+ c.fillCircle(cx, cy, r, rgba(255, 255, 255, 40));+ const int s = static_cast<int>(8 * k), th = std::max(2, static_cast<int>(2 * k));+ c.strokeRect({static_cast<int>(cx - 6 * k), static_cast<int>(cy - 6 * k), s, s}, color, th, 1);+ c.fillRect({static_cast<int>(cx - 2 * k), static_cast<int>(cy - 2 * k), s, s}, color, 1);+}++} // namespace xc::uidiff --git a/src/ui/pad_glyphs.h b/src/ui/pad_glyphs.hnew file mode 100644index 0000000..76c2493--- /dev/null+++ b/src/ui/pad_glyphs.h@@ -0,0 +1,52 @@+// SPDX-License-Identifier: GPL-3.0-or-later+// Copyright (C) 2026 RafaelNGP+// The controller's buttons as the screens draw them: PlayStation glyphs+// (Cross, Circle, Square, Triangle, Options, the touchpad, L1...R3) or, with+// an Xbox or another pad laid out like one on a desktop, Xbox ones (A, B, X,+// Y as coloured letters, Menu, View, LB...RS). The PS5's pads are DualSense:+// it always draws the PlayStation ones.+#pragma once++#include "input/input_ext.h"+#include "ui/canvas.h"++#include <atomic>++namespace xc::ui {++class Font;++enum class GlyphStyle { PlayStation, Xbox };++// The glyphs for a pad of this kind: PlayStation for a DualSense, a+// DualShock 4 or no pad; Xbox for the rest (Xbox, Switch and generic pads,+// whose buttons SDL reports by position, as an Xbox pad's).+GlyphStyle glyphStyleFor(input::PadKind kind);++// The glyphs drawn now: the kind of the pad driving the menus (app_core+// sets it; it never changes on the PS5).+inline std::atomic<GlyphStyle> g_glyphStyle{GlyphStyle::PlayStation};++// A button by its place on the pad: the face buttons south, east, west,+// north are Cross / A, Circle / B, Square / X, Triangle / Y.+enum class PadButton { Cross, Circle, Square, Triangle, Options, Touchpad, L1, R1, L2, R2, L3, R3 };++// Its name: "Cross" / "A", "Options" / "Menu", "Touchpad" / "View", "L1" / "LB",+// "L2" / "LT", "L3" / "LS"...+const char* buttonName(GlyphStyle style, PadButton b);++// A face button's colour: the symbol's (PlayStation) or the letter circle's+// (Xbox: A green, B red, X blue, Y yellow). 0 for the other buttons.+Color faceColor(GlyphStyle style, PadButton b);++// A face button as on the pad, `r` its radius: a PlayStation symbol in its+// colour on a round key, or an Xbox letter on a circle of its colour+// (`letters`: the font for it).+void drawFaceButton(Canvas& c, const Font& letters, GlyphStyle style, PadButton b, float cx, float cy, float r);++// Xbox Menu (three lines) and View (two overlapping windows) on a round+// key of radius `r`, lines in `color`.+void drawXboxMenuButton(Canvas& c, float cx, float cy, float r, Color color);+void drawXboxViewButton(Canvas& c, float cx, float cy, float r, Color color);++} // namespace xc::uidiff --git a/src/ui/stream_menu.cpp b/src/ui/stream_menu.cppindex 7b975bb..83cbf64 100644--- a/src/ui/stream_menu.cpp+++ b/src/ui/stream_menu.cpp@@ -4,6 +4,7 @@#include "ui/strings.h"#include "ui/input_mode.h"+#include "ui/pad_glyphs.h"#include <algorithm>#include <cstdio>@@ -351,6 +352,11 @@ Canvas StreamMenu::renderMenu(const StreamInfo& info) const {}}auto icon = [&](bool cross) {+ if (g_glyphStyle == GlyphStyle::Xbox) { // A / B+ drawFaceButton(c, fonts_.bold, GlyphStyle::Xbox, cross ? PadButton::Cross : PadButton::Circle, x + 13.0f,+ hy + 12.0f, 13);+ return;+ }c.fillCircle(x + 13, hy + 12, 13, rgba(255, 255, 255, 40));if (cross) {c.line(x + 7, hy + 6, x + 19, hy + 18, 2.5f, rgba(124, 178, 232));diff --git a/tests/test_main.cpp b/tests/test_main.cppindex 4e13c86..bd91899 100644--- a/tests/test_main.cpp+++ b/tests/test_main.cpp@@ -25,6 +25,7 @@#include "stream/stream_session.h"#include "ui/app_ui.h"#include "ui/accent_color.h"+#include "ui/pad_glyphs.h"#include "ui/stream_menu.h"#include "ui/strings.h"#include "util/json.h"@@ -1209,6 +1210,38 @@ static void testVisibleSettingsRows() {CHECK((groups(game) == std::vector<bool>{false, true, true, false, false}));}+// The controller's glyphs by pad kind (ui/pad_glyphs.h).+static void testPadGlyphs() {+ using input::PadKind;+ using ui::GlyphStyle;+ using ui::PadButton;+ CHECK(ui::glyphStyleFor(PadKind::DualSense) == GlyphStyle::PlayStation);+ CHECK(ui::glyphStyleFor(PadKind::DualShock4) == GlyphStyle::PlayStation);+ CHECK(ui::glyphStyleFor(PadKind::None) == GlyphStyle::PlayStation);+ CHECK(ui::glyphStyleFor(PadKind::Xbox) == GlyphStyle::Xbox);+ CHECK(ui::glyphStyleFor(PadKind::Switch) == GlyphStyle::Xbox);+ CHECK(ui::glyphStyleFor(PadKind::Generic) == GlyphStyle::Xbox);+ // The PS5's pads, whatever the desktop shows.+ CHECK(ui::glyphStyleFor(input::anyPadCaps().kind) == GlyphStyle::PlayStation); // null backend: no pad+ const PadButton all[] = {PadButton::Cross, PadButton::Circle, PadButton::Square, PadButton::Triangle,+ PadButton::Options, PadButton::Touchpad, PadButton::L1, PadButton::R1,+ PadButton::L2, PadButton::R2, PadButton::L3, PadButton::R3};+ std::string ps, xb;+ for (PadButton b : all) {+ ps += std::string(ui::buttonName(GlyphStyle::PlayStation, b)) + ",";+ xb += std::string(ui::buttonName(GlyphStyle::Xbox, b)) + ",";+ }+ CHECK(ps == "Cross,Circle,Square,Triangle,Options,Touchpad,L1,R1,L2,R2,L3,R3,");+ CHECK(xb == "A,B,X,Y,Menu,View,LB,RB,LT,RT,LS,RS,");+ // Xbox letters: A green, B red, X blue, Y yellow; no colour off the face.+ ui::Color a = ui::faceColor(GlyphStyle::Xbox, PadButton::Cross), b = ui::faceColor(GlyphStyle::Xbox, PadButton::Circle);+ CHECK(a != b && a != 0 && b != 0);+ CHECK(ui::faceColor(GlyphStyle::Xbox, PadButton::L1) == 0);+ CHECK(ui::faceColor(GlyphStyle::PlayStation, PadButton::Cross) == ui::rgba(124, 178, 232));+ CHECK(ui::faceColor(GlyphStyle::Xbox, PadButton::Cross) == ui::rgba(84, 178, 58));+ CHECK(ui::faceColor(GlyphStyle::Xbox, PadButton::Triangle) == ui::rgba(236, 184, 30));+}+// The desktop app's in-app notices (platform/toasts.h).static void testToasts() {using platform::ToastQueue;@@ -1477,6 +1510,7 @@ static void testNullBackendsM1() {int main() {testNullBackends();+ testPadGlyphs();testToasts();testVisibleSettingsRows();testMissingFont();