Xbox Cloud Gaming app for PS5 Homebrew
C
feat: add sign-in diagnostics and in-settings network test
Rafael Abud Ferreira95d38401b81e
diff --git a/src/app/app_core.cpp b/src/app/app_core.cppindex 707f66e..0bfdbff 100644--- a/src/app/app_core.cpp+++ b/src/app/app_core.cpp@@ -695,6 +695,18 @@ bool Core::frame() {platform::notify(ui::tr(ui::Str::RefreshingLibrary));break;}+ case ui::Action::CheckSignIn: {+ XC_LOGI("sign-in check: requested from Settings");+ int idle = kNone;+ if (!g_command.compare_exchange_strong(idle, kCheckSignIn)) XC_LOGW("sign-in check: worker is busy");+ break;+ }+ case ui::Action::RunNetworkTest: {+ XC_LOGI("network test: requested from Settings");+ int idle = kNone;+ if (!g_command.compare_exchange_strong(idle, kNetworkTest)) XC_LOGW("network test: worker is busy");+ break;+ }case ui::Action::None: break;}diff --git a/src/app/app_state.h b/src/app/app_state.hindex ce813eb..d70d0a1 100644--- a/src/app/app_state.h+++ b/src/app/app_state.h@@ -37,7 +37,7 @@ bool allow1440Locked();void refreshSettingsUiLocked();// --- Worker commands (worker.cpp) -----------------------------------------------enum Command { kNone, kSignIn, kPlay, kSignOut, kReloadLibrary, kConsoles, kUpdate, kClaimFree };+enum Command { kNone, kSignIn, kPlay, kSignOut, kReloadLibrary, kConsoles, kUpdate, kClaimFree, kCheckSignIn, kNetworkTest };extern std::atomic<int> g_command;extern std::atomic<bool> g_cancel;extern std::mutex g_argMutex;diff --git a/src/app/report.cpp b/src/app/report.cppindex a93bc42..9279b10 100644--- a/src/app/report.cpp+++ b/src/app/report.cpp@@ -119,6 +119,7 @@ std::string logExcerpt(const std::string& logText, bool previousSession, size_tfor (size_t i = 0; i < lines.size(); ++i)if (i == 0 || lines[i].find("[E]") != std::string::npos || lines[i].find("[W]") != std::string::npos ||lines[i].find("session summary:") != std::string::npos || lines[i].find("crash:") != std::string::npos ||+ lines[i].find("network test:") != std::string::npos || lines[i].find("sign-in check:") != std::string::npos ||i + lastLines >= lines.size())keep.insert(i);std::string out;diff --git a/src/app/worker.cpp b/src/app/worker.cppindex 46fc289..5876317 100644--- a/src/app/worker.cpp+++ b/src/app/worker.cpp@@ -25,10 +25,15 @@#include <cmath>+#include <algorithm>#include <chrono>#include <condition_variable>#include <cstdlib>+#include <cstring>#include <map>+#include <netdb.h>+#include <poll.h>+#include <sys/socket.h>#include <unistd.h>#include <memory>#include <thread>@@ -786,10 +791,23 @@ void signInAndLoad(auth::AuthManager& am, xcloud::GssvClient& gssv) {g_ui->showError(ui::tr(ui::Str::ConnectionIntercepted));} else if (isDnsOrSinkholeError(err)) {g_ui->showError(ui::tr(ui::Str::DnsBlockedNanoDns));+ } else if (err.find("2148916227") != std::string::npos ||+ err.find("suspended or banned") != std::string::npos) {+ g_ui->showError(ui::tr(ui::Str::XboxAccountBanned),+ am.redirectUrl().empty() ? "https://enforcement.xbox.com" : am.redirectUrl());} else if (err.find("2148916233") != std::string::npos ||err.find("no Xbox profile") != std::string::npos) {g_ui->showError(ui::tr(ui::Str::XboxProfileMissing),am.redirectUrl().empty() ? "https://www.xbox.com" : am.redirectUrl());+ } else if (err.find("2148916235") != std::string::npos) {+ g_ui->showError(ui::tr(ui::Str::XboxRegionNotSupported), am.redirectUrl());+ } else if (err.find("2148916236") != std::string::npos ||+ err.find("2148916237") != std::string::npos) {+ g_ui->showError(ui::tr(ui::Str::XboxAdultVerificationRequired),+ am.redirectUrl().empty() ? "https://www.xbox.com" : am.redirectUrl());+ } else if (err.find("2148916238") != std::string::npos) {+ g_ui->showError(ui::tr(ui::Str::XboxChildAccountFamily),+ am.redirectUrl().empty() ? "https://account.microsoft.com/family" : am.redirectUrl());} else if (err.find("user interaction is required") != std::string::npos ||err.find("invalid_grant") != std::string::npos ||err.find("authorization_declined") != std::string::npos) {@@ -961,6 +979,203 @@ void setWorkerState(int state) {g_workerStateCv.notify_all();}+void runSignInCheck(auth::AuthManager& am, xcloud::GssvClient& gssv) {+ ui::SignInCheckState st;+ st.running = true;+ st.stages = {+ {"1. Account Storage", false, true, "Checking..."},+ {"2. Microsoft OAuth (MSA)", false, true, "Waiting..."},+ {"3. Xbox Live User Token", false, true, "Waiting..."},+ {"4. XSTS Security Token", false, true, "Waiting..."},+ {"5. xCloud Offering (xgpuweb)", false, true, "Waiting..."},+ };+ g_ui->setSignInCheckState(st);++ bool writable = platform::dataDirWritable();+ bool hasAccount = am.hasStoredAccount();+ st.stages[0].pending = false;+ st.stages[0].ok = writable && hasAccount;+ st.stages[0].detail = !writable ? "Storage read-only" : (hasAccount ? "OK (account.json saved)" : "No saved account");+ XC_LOGI("sign-in check: stage 1 (%s) -> %s: %s", st.stages[0].name.c_str(),+ st.stages[0].ok ? "OK" : "FAIL", st.stages[0].detail.c_str());+ if (!hasAccount) {+ for (size_t i = 1; i < st.stages.size(); ++i) {+ st.stages[i].pending = false;+ st.stages[i].ok = false;+ st.stages[i].detail = "Skipped (not signed in)";+ }+ st.running = false;+ g_ui->setSignInCheckState(st);+ return;+ }+ g_ui->setSignInCheckState(st);++ std::string err;+ uint64_t t0 = platform::nowMs();+ bool ok = am.ensureFresh(&gssv, err, true);+ uint64_t elapsedMs = platform::nowMs() - t0;++ int failedStage = -1;+ if (!ok) {+ if (err.find("token refresh") != std::string::npos || err.find("not signed in") != std::string::npos) {+ failedStage = 1;+ } else if (err.find("Xbox user authentication") != std::string::npos) {+ failedStage = 2;+ } else if (err.find("XSTS authorization") != std::string::npos) {+ failedStage = 3;+ } else {+ failedStage = 4;+ }+ }++ for (int i = 1; i <= 4; ++i) {+ auto& s = st.stages[static_cast<size_t>(i)];+ s.pending = false;+ if (ok || i < failedStage) {+ s.ok = true;+ if (i == 1) s.detail = "OK";+ else if (i == 2) s.detail = "OK";+ else if (i == 3) s.detail = am.profile().gamertag.empty() ? "OK" : ("OK (" + am.profile().gamertag + ")");+ else if (i == 4)+ s.detail = "OK (" + (gssv.session().market.empty() ? std::string("cloud") : gssv.session().market) ++ ", " + std::to_string(gssv.session().regions.size()) + " regions, " ++ std::to_string(elapsedMs) + " ms)";+ } else if (i == failedStage) {+ s.ok = false;+ s.detail = err;+ } else {+ s.ok = false;+ s.detail = "Skipped";+ }+ XC_LOGI("sign-in check: stage %d (%s) -> %s: %s", i + 1, s.name.c_str(), s.ok ? "OK" : "FAIL", s.detail.c_str());+ }+ st.running = false;+ g_ui->setSignInCheckState(st);+}++std::string probeStunUdp() {+ addrinfo hints{};+ hints.ai_family = AF_INET;+ hints.ai_socktype = SOCK_DGRAM;+ addrinfo* res = nullptr;+ if (::getaddrinfo("stun.l.google.com", "19302", &hints, &res) != 0 || !res) {+ return "DNS / UDP Unavailable";+ }+ int fd = ::socket(res->ai_family, res->ai_socktype, res->ai_protocol);+ if (fd < 0) {+ ::freeaddrinfo(res);+ return "UDP Socket Error";+ }+ // RFC 5389 STUN Binding Request (20 bytes)+ uint8_t req[20] = {+ 0x00, 0x01, 0x00, 0x00, // Binding Request, length 0+ 0x21, 0x12, 0xA4, 0x42, // Magic cookie+ 0x63, 0x87, 0x11, 0x42, 0x99, 0x10, // Transaction ID (12 bytes)+ 0x24, 0x55, 0x7A, 0xBC, 0xDE, 0xF0,+ };+ uint64_t t0 = platform::nowMs();+ ssize_t sent = ::sendto(fd, req, sizeof(req), 0, res->ai_addr, res->ai_addrlen);+ ::freeaddrinfo(res);+ if (sent != static_cast<ssize_t>(sizeof(req))) {+ ::close(fd);+ return "UDP Blocked";+ }+ pollfd pfd{};+ pfd.fd = fd;+ pfd.events = POLLIN;+ int pr = ::poll(&pfd, 1, 900);+ if (pr <= 0) {+ ::close(fd);+ return "UDP Filtered / Timeout";+ }+ uint8_t resp[128];+ ssize_t got = ::recv(fd, resp, sizeof(resp), 0);+ ::close(fd);+ int rtt = static_cast<int>(platform::nowMs() - t0);+ if (got >= 20 && resp[0] == 0x01 && resp[1] == 0x01) {+ return "UDP Reachable (" + std::to_string(rtt) + " ms)";+ }+ return "UDP Invalid Response";+}++void runNetworkTest(xcloud::GssvClient& gssv) {+ ui::NetworkTestState state;+ state.running = true;+ state.natStatus = "Probing UDP STUN...";+ auto regions = gssv.session().regions;+ if (regions.empty()) {+ regions = {+ {"BRAZILSOUTH", "https://brazilsouth.core.gssv-play-prod.xboxlive.com", true},+ {"EASTUS", "https://eastus.core.gssv-play-prod.xboxlive.com", false},+ {"EASTUS2", "https://eastus2.core.gssv-play-prod.xboxlive.com", false},+ {"SOUTHCENTRALUS", "https://southcentralus.core.gssv-play-prod.xboxlive.com", false},+ {"WESTUS2", "https://westus2.core.gssv-play-prod.xboxlive.com", false},+ {"WESTEUROPE", "https://westeurope.core.gssv-play-prod.xboxlive.com", false},+ };+ }+ for (const auto& r : regions) {+ state.regions.push_back({r.name, -1, -1});+ }+ g_ui->setNetworkTestState(state);++ state.natStatus = probeStunUdp();+ XC_LOGI("network test: NAT/STUN -> %s", state.natStatus.c_str());+ g_ui->setNetworkTestState(state);++ std::map<std::string, int> measured;+ {+ std::lock_guard<std::mutex> lock(g_settingsMutex);+ measured = g_settings.regionRtt;+ }++ 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;+ }+ for (auto& entry : state.regions) {+ if (entry.name == r.name) {+ entry.rttMs = rtt;+ entry.jitterMs = jitter;+ break;+ }+ }+ XC_LOGI("network test: region %s -> rtt=%d ms, jitter=%d ms", r.name.c_str(), rtt, jitter);+ g_ui->setNetworkTestState(state);+ }++ std::sort(state.regions.begin(), state.regions.end(), [](const ui::RegionNetStat& a, const ui::RegionNetStat& b) {+ if ((a.rttMs >= 0) != (b.rttMs >= 0)) return a.rttMs >= 0;+ if (a.rttMs != b.rttMs) return a.rttMs < b.rttMs;+ return a.name < b.name;+ });+ state.running = false;+ g_ui->setNetworkTestState(state);+ if (!measured.empty()) {+ {+ std::lock_guard<std::mutex> lock(g_settingsMutex);+ g_settings.regionRtt = measured;+ }+ g_ui->setRegionLatency(measured);+ }+}+} // namespacevoid startWorker() {@@ -1017,6 +1232,8 @@ void worker() {break;case kConsoles: loadConsoles(am, home); break;case kUpdate: runUpdate(); break;+ case kCheckSignIn: runSignInCheck(am, gssv); break;+ case kNetworkTest: runNetworkTest(gssv); break;case kReloadLibrary:if (am.signedIn()) loadLibrary(am, gssv);else signInAndLoad(am, gssv);diff --git a/src/auth/xbox_live.cpp b/src/auth/xbox_live.cppindex ff1886f..2307aea 100644--- a/src/auth/xbox_live.cpp+++ b/src/auth/xbox_live.cpp@@ -42,9 +42,11 @@ bool readXbl(const net::Response& r, XblToken& out, std::string& err, const charint64_t x = (*j)["XErr"].asInt();err += " XErr " + std::to_string(x);// Well-known XSTS errors worth telling the user about.- if (x == 2148916233) err += " (this Microsoft account has no Xbox profile yet)";- if (x == 2148916235) err += " (Xbox Live is not available in this account's country)";- if (x == 2148916238) err += " (child account: needs to be added to a family by an adult)";+ if (x == 2148916227) err += " (this Xbox account is suspended or banned (2148916227))";+ if (x == 2148916233) err += " (this Microsoft account has no Xbox profile yet — sign in once at xbox.com to create a Gamertag (2148916233))";+ if (x == 2148916235) err += " (Xbox Live is not offered in this account's country/region (2148916235))";+ if (x == 2148916236 || x == 2148916237) err += " (age verification or terms acceptance is required at xbox.com in a browser (2148916236))";+ if (x == 2148916238) err += " (child account: an adult must add this account to a Microsoft family at account.microsoft.com/family (2148916238))";}if (j && (*j)["Redirect"].isString()) {std::string red = (*j)["Redirect"].str();diff --git a/src/ui/app_ui.cpp b/src/ui/app_ui.cppindex b4bce3c..e379160 100644--- a/src/ui/app_ui.cpp+++ b/src/ui/app_ui.cpp@@ -57,13 +57,13 @@ enum Icon { kIconCross, kIconCircle, kIconOptions, kIconTriangle, kIconTouchpad,// position (0 = 1080p, 1 = 720p, 2 = 1440p, as saved).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 and sign-in country; the-// stream (resolution, a desktop's display mode, 120 Hz, bitrate, region);+// 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// kSettingsGroupStart.-constexpr int kSettingsOrder[kSettingRows] = {0, 8, 1, 13, 9, 10, 2, 11, 16, 3, 4, 5, 6, 15, 14, 12, 7};-constexpr bool kSettingsGroupStart[kSettingRows] = {false, false, true, false, false, false, false, true,- false, true, false, false, false, false, false, false, true};+constexpr int kSettingsOrder[kSettingRows] = {0, 8, 17, 1, 13, 9, 10, 2, 18, 11, 16, 3, 4, 5, 6, 15, 14, 12, 7};+constexpr bool kSettingsGroupStart[kSettingRows] = {false, false, false, true, false, false, false, false, false,+ true, false, true, false, false, false, false, false, false, true};// 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@@ -1368,6 +1368,28 @@ void AppUi::setUpdateState(const std::string& current, const std::string& availadirty_ = true;}+void AppUi::setSignInCheckState(const SignInCheckState& state) {+ std::lock_guard<std::mutex> lock(mutex_);+ signInCheck_ = state;+ dirty_ = true;+}++SignInCheckState AppUi::signInCheckState() const {+ std::lock_guard<std::mutex> lock(mutex_);+ return signInCheck_;+}++void AppUi::setNetworkTestState(const NetworkTestState& state) {+ std::lock_guard<std::mutex> lock(mutex_);+ networkTest_ = state;+ dirty_ = true;+}++NetworkTestState AppUi::networkTestState() const {+ std::lock_guard<std::mutex> lock(mutex_);+ return networkTest_;+}+void AppUi::offerUpdate() {std::lock_guard<std::mutex> lock(mutex_);updatePrompt_ = true;@@ -1586,7 +1608,10 @@ std::vector<std::string> AppUi::settingOptions(int row) const {out = {tr(settings_.padMap == input::defaultPadMap() ? Str::ProfileDefault : Str::ProfileCustom)};} else if (row == 15) {out = {tr(Str::Off), tr(Str::GyroAlways), tr(Str::GyroAiming)};-+ } else if (row == 17) {+ out = {tr(Str::RunCheck)};+ } else if (row == 18) {+ out = {tr(Str::RunTest)};} else if (row == 8) {out.push_back(loginCountryOffText());for (const char* country : kLoginCountries) out.push_back(loginCountryName(country));@@ -1606,7 +1631,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) return 0;+ if (row == 3 || row == 12 || row == 14 || row == 17 || row == 18) return 0;if (row == 4) return settings_.triggerStrength;if (row == 5) return settings_.circleConfirms ? 1 : 0;if (row == 6) return settings_.lightBarMode;@@ -1642,7 +1667,7 @@ void AppUi::applySetting(int row, int index) {setLanguage(static_cast<Language>(index)); // the UI switches right away} else if (row == 1) {settings_.resolution = kResolutionOrder[index];- } else if (row == 3 || row == 12 || row == 14) {+ } else if (row == 3 || row == 12 || row == 14 || row == 17 || row == 18) {(void)index; // the tester sets each stick's, the keys' and buttons' screens theirs} else if (row == 4) {settings_.triggerStrength = index;@@ -2590,6 +2615,24 @@ UiEvent AppUi::handle(const NavInput& in) {handleColourPicker(in);break;}+ if (tester_ == Tester::SignInCheck) {+ if (in.back) {+ tester_ = Tester::None;+ dirty_ = true;+ } else if (in.accept && !signInCheck_.running) {+ ev.action = Action::CheckSignIn;+ }+ break;+ }+ if (tester_ == Tester::NetworkTest) {+ if (in.back) {+ tester_ = Tester::None;+ dirty_ = true;+ } else if (in.accept && !networkTest_.running) {+ ev.action = Action::RunNetworkTest;+ }+ break;+ }if (tester_ != Tester::None) {handleTester(in);break;@@ -2620,6 +2663,12 @@ UiEvent AppUi::handle(const NavInput& in) {} else if (in.accept && (settingsRow_ == 3 || settingsRow_ == 4 || settingsRow_ == 12)) {// Dead zone, trigger vibration, keyboard keys: their own screens instead of a list.openTester(settingsRow_ == 3 ? Tester::Sticks : settingsRow_ == 4 ? Tester::Triggers : Tester::Keys);+ } else if (in.accept && settingsRow_ == 17) {+ openTester(Tester::SignInCheck);+ ev.action = Action::CheckSignIn;+ } else if (in.accept && settingsRow_ == 18) {+ openTester(Tester::NetworkTest);+ ev.action = Action::RunNetworkTest;} 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@@ -2756,7 +2805,9 @@ bool AppUi::needsRedraw(uint64_t nowMs) const {if (platform::toastsEnabled() && platform::toasts().version(nowMs) != toastsDrawn_) return true;// Spinners keep moving (about 30 fps is enough).bool spinner = screen_ == Screen::Splash || screen_ == Screen::SignIn || screen_ == Screen::Launching ||- screen_ == Screen::Updating;+ screen_ == Screen::Updating ||+ (screen_ == Screen::Settings && ((tester_ == Tester::SignInCheck && signInCheck_.running) ||+ (tester_ == Tester::NetworkTest && networkTest_.running)));return spinner && nowMs - lastRender_ >= 33;}@@ -3925,25 +3976,26 @@ void AppUi::drawError(Canvas& c) {void AppUi::drawSettings(Canvas& c) {drawBackground(c);drawTopBar(c);- fonts_.bold.draw(c, tr(Str::Settings), kMargin, 170, 60, kWhite);+ fonts_.bold.draw(c, tr(Str::Settings), kMargin, 146, 52, kWhite);const char* labels[kSettingRows] = {tr(Str::Language), tr(Str::Resolution), tr(Str::Region),tr(Str::Deadzone), tr(Str::TriggerRumble), tr(Str::ConfirmButton),tr(Str::LightBar), tr(Str::Updates), tr(Str::LoginCountry),tr(Str::HighRefresh), tr(Str::BitrateCap), tr(Str::GameVolume),tr(Str::KeyboardKeys), tr(Str::DisplayMode), tr(Str::ControllerButtons),- tr(Str::Gyro), tr(Str::QueueReadyNotification)};- constexpr int kRowW = 1200, kRowH = 46, kGap = 4, kGroupGap = 12;+ tr(Str::Gyro), tr(Str::QueueReadyNotification),+ tr(Str::CheckSignIn), tr(Str::NetworkTest)};+ constexpr int kRowW = 1200, kRowH = 36, kGap = 3, kGroupGap = 7, kRowPx = 24;Rect rows[kSettingRows]; // by row id- int y = 236;+ int y = 200;for (const auto& [i, groupStart] : visibleSettingsRows(caps_)) { // what caps_ rules out is hiddenif (groupStart) y += kGroupGap;Rect r{kMargin, y, kRowW, kRowH};rows[i] = r;bool focused = i == settingsRow_;- c.fillRect(r, focused ? rgba(255, 255, 255, 36) : rgba(255, 255, 255, 14), 16);- if (focused && !dropdownOpen_) c.strokeRect({r.x - 5, r.y - 5, r.w + 10, r.h + 10}, kWhite, 3, 20);- int ty = fonts_.semibold.centeredY(r.y, r.h, 28);- fonts_.semibold.draw(c, labels[i], r.x + 36, ty, 28, kWhite);+ c.fillRect(r, focused ? rgba(255, 255, 255, 36) : rgba(255, 255, 255, 14), 12);+ if (focused && !dropdownOpen_) c.strokeRect({r.x - 4, r.y - 4, r.w + 8, r.h + 8}, kWhite, 3, 16);+ int ty = fonts_.semibold.centeredY(r.y, r.h, kRowPx);+ fonts_.semibold.draw(c, labels[i], r.x + 32, ty, kRowPx, kWhite);if (i == 7) {// Updates: the state; Cross updates when there is a newer version.std::string value = updateChecking_ ? tr(Str::UpdateChecking)@@ -3951,8 +4003,8 @@ void AppUi::drawSettings(Canvas& c) {? trf(caps_.selfUpdate ? Str::UpdateReady : Str::UpdateReadyPc, updateAvailable_): trf(Str::UpToDate, "v" + updateCurrent_);Color color = !updateAvailable_.empty() && !updateChecking_ ? rgba(120, 220, 120) : focused ? kWhite : kGray;- int w = fonts_.regular.measure(value, 28);- fonts_.regular.draw(c, value, r.x + r.w - 44 - w, fonts_.regular.centeredY(r.y, r.h, 28), 28, color);+ int w = fonts_.regular.measure(value, kRowPx);+ fonts_.regular.draw(c, value, r.x + r.w - 40 - w, fonts_.regular.centeredY(r.y, r.h, kRowPx), kRowPx, color);y += kRowH + kGap;continue;}@@ -3960,26 +4012,26 @@ void AppUi::drawSettings(Canvas& c) {auto options = settingOptions(i);int sel = settingSelected(i);std::string value = sel < static_cast<int>(options.size()) ? options[static_cast<size_t>(sel)] : "";- float cx = static_cast<float>(r.x + r.w - 44), cy = static_cast<float>(r.y + r.h / 2);- c.line(cx - 9, cy - 4, cx, cy + 5, 3, focused ? kWhite : kGray);- c.line(cx, cy + 5, cx + 9, cy - 4, 3, focused ? kWhite : kGray);- int vx = r.x + r.w - 76;+ float cx = static_cast<float>(r.x + r.w - 40), cy = static_cast<float>(r.y + r.h / 2);+ c.line(cx - 8, cy - 3, cx, cy + 4, 2.5f, focused ? kWhite : kGray);+ c.line(cx, cy + 4, cx + 8, cy - 3, 2.5f, focused ? kWhite : kGray);+ int vx = r.x + r.w - 68;if (i == 5) {// The confirm button, as the button itself.- drawFaceButton(c, fonts_.bold, settings_.circleConfirms ? kIconCircle : kIconCross, vx - 20.0f, cy, 20);+ drawFaceButton(c, fonts_.bold, settings_.circleConfirms ? kIconCircle : kIconCross, vx - 16.0f, cy, 16);} 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);+ int w = fonts_.regular.measure(value, kRowPx);+ fonts_.regular.draw(c, value, vx - w, fonts_.regular.centeredY(r.y, r.h, kRowPx), kRowPx, focused ? kWhite : kGray);if (i == 6 && settings_.lightBarMode == 1) { // the colour chosen- c.fillCircle(vx - w - 30.0f, cy, 14, settings_.lightBarColour);- c.strokeArc(vx - w - 30.0f, cy, 14, 2, 0, 6.2832f, rgba(255, 255, 255, 120));+ c.fillCircle(vx - w - 26.0f, cy, 11, settings_.lightBarColour);+ c.strokeArc(vx - w - 26.0f, cy, 11, 2, 0, 6.2832f, rgba(255, 255, 255, 120));}}y += kRowH + kGap;}- for (const auto& line : fonts_.regular.wrap(tr(Str::SettingsNote), 24, kRowW, 2)) {- fonts_.regular.draw(c, line, kMargin, y + 20, 24, kDim);- y += 34;+ for (const auto& line : fonts_.regular.wrap(tr(Str::SettingsNote), 22, kRowW, 2)) {+ fonts_.regular.draw(c, line, kMargin, y + 6, 22, kDim);+ y += 28;}if (pickerOpen_) {@@ -3990,6 +4042,8 @@ void AppUi::drawSettings(Canvas& c) {if (tester_ == Tester::Triggers) return drawTriggerTester(c);if (tester_ == Tester::Keys) return drawKeysTester(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 (dropdownOpen_) {// The list under (or, near the bottom, over) the row, right-aligned// with it; scrolls past kVisible choices.@@ -4346,6 +4400,94 @@ void AppUi::drawPadTester(Canvas& c) {drawHints(c, {{kIconCross, tr(Str::ChangeKey)}, {kIconSquare, tr(Str::ClearKey)}, {kIconCircle, tr(Str::Back)}});}+void AppUi::drawSignInCheck(Canvas& c, uint64_t nowMs) {+ Rect panel = drawModal(c, 1180, 620, tr(Str::CheckSignIn));+ if (signInCheck_.running) {+ drawSpinner(c, static_cast<float>(panel.x + panel.w - 76), static_cast<float>(panel.y + 64), 14.0f, nowMs);+ animating_ = true;+ }+ int y = panel.y + 120;+ constexpr int kRowH = 66, kGap = 10;+ for (size_t i = 0; i < signInCheck_.stages.size() && i < 6; ++i) {+ const auto& st = signInCheck_.stages[i];+ Rect r{panel.x + 56, y, panel.w - 112, kRowH};+ c.fillRect(r, rgba(255, 255, 255, 14), 14);+ float cx = static_cast<float>(r.x + 36), cy = static_cast<float>(r.y + r.h / 2);+ if (st.pending) {+ drawSpinner(c, cx, cy, 12.0f, nowMs);+ animating_ = true;+ } else if (st.ok) {+ c.fillCircle(cx, cy, 14.0f, kGreen);+ c.line(cx - 6, cy, cx - 2, cy + 5, 2.5f, kWhite);+ c.line(cx - 2, cy + 5, cx + 7, cy - 5, 2.5f, kWhite);+ } else {+ c.fillCircle(cx, cy, 14.0f, rgba(220, 65, 65));+ c.line(cx - 5, cy - 5, cx + 5, cy + 5, 2.5f, kWhite);+ c.line(cx - 5, cy + 5, cx + 5, cy - 5, 2.5f, kWhite);+ }+ int ty = fonts_.semibold.centeredY(r.y, r.h, 24);+ fonts_.semibold.draw(c, st.name, r.x + 70, ty, 24, kWhite);+ if (!st.detail.empty()) {+ int maxW = r.w - 380;+ std::string det = fonts_.regular.fit(st.detail, 22, maxW);+ int dw = fonts_.regular.measure(det, 22);+ Color detCol = st.pending ? kDim : (st.ok ? kGray : rgba(255, 130, 130));+ fonts_.regular.draw(c, det, r.x + r.w - 28 - dw, fonts_.regular.centeredY(r.y, r.h, 22), 22, detCol);+ }+ y += kRowH + kGap;+ }+ c.fillRect({0, kH - 80, kW, 80}, kBg);+ if (signInCheck_.running)+ drawHints(c, {{kIconCircle, tr(Str::Back)}});+ else+ drawHints(c, {{kIconCross, tr(Str::TryAgain)}, {kIconCircle, tr(Str::Back)}});+}++void AppUi::drawNetworkTest(Canvas& c, uint64_t nowMs) {+ Rect panel = drawModal(c, 1180, 740, tr(Str::NetworkTest));+ if (networkTest_.running) {+ drawSpinner(c, static_cast<float>(panel.x + panel.w - 76), static_cast<float>(panel.y + 64), 14.0f, nowMs);+ animating_ = true;+ }+ Rect natBox{panel.x + 56, panel.y + 114, panel.w - 112, 56};+ c.fillRect(natBox, rgba(255, 255, 255, 18), 14);+ fonts_.semibold.draw(c, "UDP / STUN (NAT)", natBox.x + 28, fonts_.semibold.centeredY(natBox.y, natBox.h, 24), 24, kWhite);+ std::string natVal = networkTest_.natStatus.empty() ? "..." : networkTest_.natStatus;+ int nw = fonts_.regular.measure(natVal, 24);+ Color natCol = natVal.find("OK") != std::string::npos || natVal.find("Reachable") != std::string::npos+ ? rgba(110, 225, 120)+ : (networkTest_.running ? kDim : rgba(255, 180, 90));+ fonts_.regular.draw(c, natVal, natBox.x + natBox.w - 28 - nw, fonts_.regular.centeredY(natBox.y, natBox.h, 24), 24, natCol);++ int y = panel.y + 188;+ constexpr int kRowH = 54, kGap = 8;+ for (size_t i = 0; i < networkTest_.regions.size() && i < 8; ++i) {+ const auto& reg = networkTest_.regions[i];+ Rect r{panel.x + 56, y, panel.w - 112, kRowH};+ c.fillRect(r, i == 0 && reg.rttMs >= 0 ? rgba(16, 124, 16, 45) : rgba(255, 255, 255, 12), 12);+ std::string label = prettyRegion(reg.name);+ if (i == 0 && reg.rttMs >= 0) label += " \xE2\x98\x85";+ fonts_.semibold.draw(c, label, r.x + 28, fonts_.semibold.centeredY(r.y, r.h, 24), 24, kWhite);+ std::string val;+ Color valCol = kDim;+ if (reg.rttMs >= 0) {+ val = "RTT " + std::to_string(reg.rttMs) + " ms \xC2\xB7 Jitter " ++ std::to_string(std::max(0, reg.jitterMs)) + " ms";+ valCol = reg.rttMs < 60 ? rgba(110, 225, 120) : (reg.rttMs < 120 ? rgba(255, 200, 80) : rgba(255, 120, 120));+ } else {+ val = networkTest_.running ? "..." : "--";+ }+ int vw = fonts_.regular.measure(val, 22);+ fonts_.regular.draw(c, val, r.x + r.w - 28 - vw, fonts_.regular.centeredY(r.y, r.h, 22), 22, valCol);+ y += kRowH + kGap;+ }+ c.fillRect({0, kH - 80, kW, 80}, kBg);+ if (networkTest_.running)+ drawHints(c, {{kIconCircle, tr(Str::Back)}});+ else+ drawHints(c, {{kIconCross, tr(Str::TryAgain)}, {kIconCircle, tr(Str::Back)}});+}+void AppUi::drawKeysTester(Canvas& c) {Rect panel = drawModal(c, 1500, 860, tr(Str::KeyboardKeys));// Each input: its name (the PlayStation button, the Xbox one beside),diff --git a/src/ui/app_ui.h b/src/ui/app_ui.hindex f8fc47e..3e95966 100644--- a/src/ui/app_ui.h+++ b/src/ui/app_ui.h@@ -186,9 +186,34 @@ 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 = 17; // language, resolution, region, dead zone, triggers, confirm, light bar, updates,+constexpr int kSettingRows = 19; // 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+ // display mode (a desktop's window), controller buttons, gyro aiming, queue chime,+ // check sign-in, network test++struct SignInStage {+ std::string name;+ bool ok = false;+ bool pending = false;+ std::string detail;+};++struct SignInCheckState {+ bool running = false;+ std::vector<SignInStage> stages;+};++struct RegionNetStat {+ std::string name;+ int rttMs = -1;+ int jitterMs = -1;+};++struct NetworkTestState {+ bool running = false;+ std::string natStatus;+ std::vector<RegionNetStat> regions;+};// The countries "Sign in as another country" offers (xcloud::loginCountryAddress).constexpr const char* kLoginCountries[] = {"br", "jp", "kr", "pl", "us"};@@ -206,7 +231,9 @@ enum class Action {OpenUrl, // a link on screen to open in the browser (UiCaps::openUrl): `url`Quit, // desktop: the user closed the app from the home screenClaimFreeGame, // claim a free-to-play game license directly- RefreshLibrary // manual library refresh+ RefreshLibrary, // manual library refresh+ CheckSignIn, // run sign-in diagnostic stages+ RunNetworkTest // run regional RTT/jitter & NAT probe};// How "Your games" is sorted (R3).@@ -367,6 +394,10 @@ public:// Updates: this version, and the newer one (empty: up to date);// `checking` while it is being asked (Settings shows it).void setUpdateState(const std::string& current, const std::string& available, bool checking);+ void setSignInCheckState(const SignInCheckState& state);+ SignInCheckState signInCheckState() const;+ void setNetworkTestState(const NetworkTestState& state);+ NetworkTestState networkTestState() const;// The pop-up offering the newer version, over the home screen.void offerUpdate();bool updateOffered() const;@@ -498,7 +529,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 };+ enum class Tester { None, Sticks, Triggers, Keys, Pad, SignInCheck, NetworkTest };void openTester(Tester t);void handleTester(const NavInput& in);void drawStickTester(Canvas& c);@@ -510,6 +541,8 @@ private:void openPadTester();void handlePadTester(const NavInput& in);void drawPadTester(Canvas& c);+ void drawSignInCheck(Canvas& c, uint64_t nowMs);+ void drawNetworkTest(Canvas& c, uint64_t nowMs);// A modal panel over Settings with its title; returns its rectangle.Rect drawModal(Canvas& c, int w, int h, const std::string& title);void drawUpdating(Canvas& c, uint64_t nowMs);@@ -604,6 +637,8 @@ private:std::map<std::string, DetailInfo> detailInfo_; // fetched on demand, by product idstd::string updateCurrent_, updateAvailable_;bool updateChecking_ = false;+ SignInCheckState signInCheck_;+ NetworkTestState networkTest_;bool reportOpen_ = false; // the report's QR code is upbool regionRefused_ = false; // the error is showRegionRefused()'sbool countryPickerOpen_ = false;diff --git a/src/ui/strings.cpp b/src/ui/strings.cppindex 3a8f091..fcd772b 100644--- a/src/ui/strings.cpp+++ b/src/ui/strings.cpp@@ -347,6 +347,14 @@ constexpr Column kEnglish = {"Played: %s", // PlaytimePlayed"Refresh", // RefreshLibrary"Refreshing library...", // RefreshingLibrary+ "This Xbox account is suspended or banned. Visit enforcement.xbox.com for details.", // XboxAccountBanned+ "Xbox Live is not offered in this account's country or region.", // XboxRegionNotSupported+ "Age verification or terms acceptance is required. Sign in to xbox.com in a browser, then try again.", // XboxAdultVerificationRequired+ "Child account: an adult must add this account to a Microsoft family at account.microsoft.com/family.", // XboxChildAccountFamily+ "Check my sign-in", // CheckSignIn+ "Run check", // RunCheck+ "Network test", // NetworkTest+ "Run test", // RunTest};constexpr Column kPortugueseBR = {@@ -664,6 +672,14 @@ constexpr Column kPortugueseBR = {"Jogado: %s", // PlaytimePlayed"Atualizar", // RefreshLibrary"Atualizando biblioteca...", // RefreshingLibrary+ "Esta conta Xbox está suspensa ou banida. Acesse enforcement.xbox.com para mais detalhes.", // XboxAccountBanned+ "O Xbox Live não é oferecido no país ou região desta conta.", // XboxRegionNotSupported+ "Verificação de idade ou aceite dos termos necessário. Entre em xbox.com pelo navegador e tente novamente.", // XboxAdultVerificationRequired+ "Conta infantil: um adulto precisa adicionar esta conta a uma família Microsoft em account.microsoft.com/family.", // XboxChildAccountFamily+ "Verificar meu login", // CheckSignIn+ "Verificar", // RunCheck+ "Teste de rede", // NetworkTest+ "Testar", // RunTest};constexpr Column kSpanish = {@@ -981,6 +997,14 @@ constexpr Column kSpanish = {"Jugado: %s", // PlaytimePlayed"Actualizar", // RefreshLibrary"Actualizando biblioteca...", // RefreshingLibrary+ "Esta cuenta de Xbox está suspendida o bloqueada. Visita enforcement.xbox.com para más detalles.", // XboxAccountBanned+ "Xbox Live no se ofrece en el país o región de esta cuenta.", // XboxRegionNotSupported+ "Se requiere verificación de edad o aceptar los términos. Inicia sesión en xbox.com desde un navegador y vuelve a intentarlo.", // XboxAdultVerificationRequired+ "Cuenta infantil: un adulto debe añadir esta cuenta a una familia de Microsoft en account.microsoft.com/family.", // XboxChildAccountFamily+ "Comprobar mi inicio de sesión", // CheckSignIn+ "Comprobar", // RunCheck+ "Prueba de red", // NetworkTest+ "Probar", // RunTest};constexpr Column kFrench = {@@ -1298,6 +1322,14 @@ constexpr Column kFrench = {"Joué : %s", // PlaytimePlayed"Actualiser", // RefreshLibrary"Actualisation de la bibliothèque...", // RefreshingLibrary+ "Ce compte Xbox est suspendu ou banni. Consultez enforcement.xbox.com pour plus de détails.", // XboxAccountBanned+ "Xbox Live n'est pas proposé dans le pays ou la région de ce compte.", // XboxRegionNotSupported+ "Vérification d'âge ou acceptation des conditions requise. Connectez-vous sur xbox.com dans un navigateur, puis réessayez.", // XboxAdultVerificationRequired+ "Compte enfant : un adulte doit ajouter ce compte à une famille Microsoft sur account.microsoft.com/family.", // XboxChildAccountFamily+ "Vérifier ma connexion", // CheckSignIn+ "Vérifier", // RunCheck+ "Test réseau", // NetworkTest+ "Tester", // RunTest};constexpr Column kGerman = {@@ -1615,6 +1647,14 @@ constexpr Column kGerman = {"Gespielt: %s", // PlaytimePlayed"Aktualisieren", // RefreshLibrary"Bibliothek wird aktualisiert...", // RefreshingLibrary+ "Dieses Xbox-Konto ist gesperrt oder gebannt. Details unter enforcement.xbox.com.", // XboxAccountBanned+ "Xbox Live wird im Land oder in der Region dieses Kontos nicht angeboten.", // XboxRegionNotSupported+ "Altersprüfung oder Zustimmung zu den Bedingungen erforderlich. Melde dich im Browser auf xbox.com an und versuche es erneut.", // XboxAdultVerificationRequired+ "Kinderkonto: Ein Erwachsener muss dieses Konto unter account.microsoft.com/family zu einer Microsoft-Familie hinzufügen.", // XboxChildAccountFamily+ "Anmeldung prüfen", // CheckSignIn+ "Prüfen", // RunCheck+ "Netzwerktest", // NetworkTest+ "Testen", // RunTest};constexpr Column kItalian = {@@ -1932,6 +1972,14 @@ constexpr Column kItalian = {"Giocato: %s", // PlaytimePlayed"Aggiorna", // RefreshLibrary"Aggiornamento libreria...", // RefreshingLibrary+ "Questo account Xbox è sospeso o bloccato. Visita enforcement.xbox.com per i dettagli.", // XboxAccountBanned+ "Xbox Live non è offerto nel paese o nella regione di questo account.", // XboxRegionNotSupported+ "È richiesta la verifica dell'età o l'accettazione dei termini. Accedi a xbox.com in un browser, poi riprova.", // XboxAdultVerificationRequired+ "Account bambino: un adulto deve aggiungere questo account a una famiglia Microsoft su account.microsoft.com/family.", // XboxChildAccountFamily+ "Verifica il mio accesso", // CheckSignIn+ "Verifica", // RunCheck+ "Test di rete", // NetworkTest+ "Testa", // RunTest};constexpr std::array<const Column*, kLangs> kTable = {&kEnglish, &kPortugueseBR, &kSpanish,diff --git a/src/ui/strings.h b/src/ui/strings.hindex 511b880..7eda8cc 100644--- a/src/ui/strings.h+++ b/src/ui/strings.h@@ -324,6 +324,14 @@ enum class Str {PlaytimePlayed, // details / menu: "Played: %s"RefreshLibrary, // hint: "Refresh"RefreshingLibrary, // toast: "Refreshing library..."+ XboxAccountBanned, // error: 2148916227 suspended or banned+ XboxRegionNotSupported, // error: 2148916235 Xbox Live not offered in country/region+ XboxAdultVerificationRequired, // error: 2148916236/2148916237 age verification or terms acceptance required+ XboxChildAccountFamily, // error: 2148916238 child account needs Microsoft family+ CheckSignIn, // settings: "Check my sign-in"+ RunCheck, // settings option: "Run check"+ NetworkTest, // settings: "Network test"+ RunTest, // settings option: "Run test"Count};diff --git a/tests/test_main.cpp b/tests/test_main.cppindex b578eca..e48403e 100644--- a/tests/test_main.cpp+++ b/tests/test_main.cpp@@ -2013,21 +2013,21 @@ static void testVisibleSettingsRows() {};const ui::UiCaps ps5;auto all = ui::visibleSettingsRows(ps5);- CHECK((ids(all) == std::vector<int>{0, 8, 1, 9, 10, 2, 11, 16, 3, 4, 5, 6, 15, 14, 12, 7}));- CHECK((groups(all) == std::vector<bool>{false, false, true, 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}));+ CHECK((groups(all) == std::vector<bool>{false, false, false, true, false, false, false, false, true, false, true, false, false, false, false, false, false, true}));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, 1, 10, 2, 11, 16, 3, 5, 14, 12, 7}));- CHECK((groups(desk) == std::vector<bool>{false, false, true, 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}));+ CHECK((groups(desk) == std::vector<bool>{false, false, false, true, false, false, false, true, false, true, false, false, false, true}));// 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, 1, 13, 10, 2, 11, 16, 3, 5, 14, 12, 7}));- CHECK((groups(w) == std::vector<bool>{false, false, true, 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}));+ CHECK((groups(w) == std::vector<bool>{false, false, false, true, false, false, false, false, true, false, true, false, false, false, true}));ui::UiCaps xbox = pc; // an Xbox pad: impulse triggers, no light barxbox.triggerRumble = true;auto x = ids(ui::visibleSettingsRows(xbox));@@ -2048,14 +2048,14 @@ static void testVisibleSettingsRows() {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 10 down (5 is the region),- // the keyboard keys 14 (13 is the controller buttons).- CHECK(ui::settingsRowPosition(ps5, 1) == 2 && ui::settingsRowPosition(ps5, 3) == 8);- CHECK(ui::settingsRowPosition(ps5, 16) == 7);- CHECK(ui::settingsRowPosition(ps5, 5) == 10 && ui::settingsRowPosition(ps5, 6) == 11);- CHECK(ui::settingsRowPosition(ps5, 12) == 14 && ui::settingsRowPosition(ps5, 14) == 13);- CHECK(ui::settingsRowPosition(ps5, 7) == 15 && ui::settingsRowPosition(ps5, 2) == 5);- CHECK(ui::settingsRowPosition(pc, 5) == 8 && ui::settingsRowPosition(pc, 6) == -1 && ui::settingsRowPosition(pc, 4) == -1);+ // downsTo): on the PS5 the confirm button is 12 down (6 is the region),+ // the keyboard keys 16 (15 is the controller buttons).+ 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) == 17 && ui::settingsRowPosition(ps5, 2) == 6);+ CHECK(ui::settingsRowPosition(pc, 5) == 10 && ui::settingsRowPosition(pc, 6) == -1 && ui::settingsRowPosition(pc, 4) == -1);}// The controller's glyphs by pad kind (ui/pad_glyphs.h).