Skip to content

Xbox Cloud Gaming app for PS5 Homebrew

C

Controller icons, a light bar colour picker, button glyphs in Settings

Rafael Abud Ferreira412463a70295
diff --git a/src/app/autoplay.cpp b/src/app/autoplay.cpp
index bb3314d..07fa578 100644
--- a/src/app/autoplay.cpp
+++ b/src/app/autoplay.cpp
@@ -26,6 +26,7 @@ bool uiSaved = false;
bool settingsShot = false; // "settingstest": save the screen now
uint64_t homeSince = 0, launchSince = 0;
bool launchSaved = false;
+const char* pickerShot = nullptr; // "pickertest": save this screen next, once drawn
bool acceptUpdate = false; // "updatetest": Cross on the pop-up, next pass ("updateskip": Circle)
} // namespace
@@ -75,6 +76,8 @@ void loadAutoplay() {
if (opt == "updatetest") g_autoplay.updateTest = true;
if (opt == "updateskip") g_autoplay.updateSkip = true;
if (opt == "settingsupdate") g_autoplay.settingsUpdate = true;
+ if (opt == "pickertest") g_autoplay.pickerTest = true;
+ if (opt == "menushot") g_autoplay.menuShot = true;
if (opt == "norestart") g_autoplay.noRestart = true;
if (opt.rfind("threads=", 0) == 0) g_autoplay.decodeThreads = std::atoi(opt.c_str() + 8);
}
@@ -162,6 +165,40 @@ void autoplayNav(ui::NavInput& nav, bool& menuCombo, uint64_t now) {
++step;
}
}
+ if (g_autoplay.menuShot && g_ui->screen() == ui::Screen::Streaming) {
+ static uint64_t since = 0;
+ static int step = 0;
+ if (!since) since = now;
+ if (step == 0 && now - since >= 7000) menuCombo = true, ++step;
+ else if (step == 1 && now - since >= 13000) nav = ui::NavInput{}, nav.back = true, ++step;
+ }
+ if (g_autoplay.pickerTest && uiSaved) {
+ // Settings; down to the confirm button, its list (saved), closed;
+ // down to the light bar, its list, Custom colour; the stick right and
+ // up for 1.5 s, L2 (darker); saved; Cross; Settings saved.
+ static uint64_t since = 0;
+ if (!since) since = now;
+ uint64_t t = now - since;
+ static int step = 0;
+ const uint64_t at[] = {500, 1000, 1300, 1600, 1900, 2200, 2700, 4500, 5000, 5500, 6000, 6500, 7000, 9000, 10500, 11000, 12500};
+ if (t >= 7500 && t < 9000) nav.stickX = 1.0f, nav.stickY = -0.6f;
+ if (step < 17 && t >= at[step]) {
+ nav = ui::NavInput{};
+ nav.nowMs = now;
+ switch (step) {
+ case 0: nav.options = true; break;
+ case 1: case 2: case 3: case 4: case 5: case 9: case 11: nav.down = true; break;
+ case 6: case 10: case 12: case 15: nav.accept = true; break;
+ case 7: pickerShot = "confirm.ppm"; break;
+ case 8: nav.back = true; break; // the confirm button's list closes, unchanged
+ case 13: nav.l2 = true; break; // after the stick: darker
+ case 14: pickerShot = "picker.ppm"; break;
+ case 16: pickerShot = "settings.ppm"; break;
+ }
+ XC_LOGI("autoplay: picker step %d", step);
+ ++step;
+ }
+ }
if (acceptUpdate) {
acceptUpdate = false;
nav = ui::NavInput{};
@@ -328,6 +365,11 @@ void autoplayScreens(const ui::Canvas& canvas, uint64_t now) {
saveCanvas("ui.ppm");
}
}
+ if (pickerShot) {
+ saveCanvas(pickerShot);
+ if (std::string(pickerShot) == "settings.ppm") XC_LOGI("AUTOPLAY END: picker test");
+ pickerShot = nullptr;
+ }
if (g_autoplay.title == "UPDATE") {
// The update test: the pop-up saved and accepted, the progress
// saved; the run ends on the home screen without one (the new
diff --git a/src/app/autoplay.h b/src/app/autoplay.h
index 3e6418e..0c51c8b 100644
--- a/src/app/autoplay.h
+++ b/src/app/autoplay.h
@@ -60,6 +60,9 @@ struct Autoplay {
bool updateTest = false; // updatetest: accept the update pop-up, save update.ppm / updating.ppm
bool updateSkip = false; // updateskip: "Not now" on the update pop-up
bool settingsUpdate = false; // settingsupdate: Settings > Updates, Cross
+ bool menuShot = false; // menushot: the game menu open over the 10 s snapshot (screen.ppm)
+ bool pickerTest = false; // pickertest: the confirm button's list (confirm.ppm), the light
+ // bar's colour picker moved (picker.ppm), chosen (settings.ppm)
bool noRestart = false; // norestart: after an update, close instead of restarting
};
extern Autoplay g_autoplay;
diff --git a/src/app/ps5_main.cpp b/src/app/ps5_main.cpp
index 203d1e4..02e4f93 100644
--- a/src/app/ps5_main.cpp
+++ b/src/app/ps5_main.cpp
@@ -89,7 +89,8 @@ bool saveSettings(const ui::SettingsChoice& choice) {
g_settings.deadzone = ui::kDeadzonePercent[choice.deadzone];
g_settings.triggerRumble = choice.triggerRumble;
g_settings.circleConfirms = choice.circleConfirms;
- g_settings.lightBar = choice.lightBar;
+ g_settings.lightBarMode = choice.lightBarMode;
+ g_settings.lightBarColour = choice.lightBarColour;
if (!g_settings.save(settingsPath())) XC_LOGW("could not save settings");
XC_LOGI("settings saved: language %s, %s, region %s", code.c_str(), g_settings.resolution.c_str(),
g_settings.region.empty() ? "auto" : g_settings.region.c_str());
@@ -170,8 +171,10 @@ int main(int argc, char** argv) {
choice.deadzone = deadzoneIndex(g_settings.deadzone);
choice.triggerRumble = g_settings.triggerRumble;
choice.circleConfirms = g_settings.circleConfirms;
- choice.lightBar = g_settings.lightBar;
+ choice.lightBarMode = g_settings.lightBarMode;
+ choice.lightBarColour = g_settings.lightBarColour;
g_ui->setAllow1440(allow1440Locked());
+ g_ui->setUpdateState(XC_APP_VERSION, {}, false); // Settings shows this version before any check
g_ui->setSettings(choice);
applyControllerSettings();
g_ui->setRegionLatency(g_settings.regionRtt);
@@ -212,18 +215,21 @@ int main(int argc, char** argv) {
input::poll(pad);
autoplayPad(pad);
uint64_t now = platform::nowMs();
- if (now - lightBarAt >= 100) { // the light bar follows the game in focus
+ if (now - lightBarAt >= 50) { // the light bar: the game in focus, the user's colour or off
lightBarAt = now;
- bool on;
- {
+ int mode;
+ ui::Color c;
+ if (!g_ui->settingsLightBar(mode, c)) { // Settings shows a choice at once, before it is saved
std::lock_guard<std::mutex> lock(g_settingsMutex);
- on = g_settings.lightBar;
+ mode = g_settings.lightBarMode;
+ c = g_settings.lightBarColour;
}
- ui::Color c;
- if (!on) {
+ if (mode == 2) {
if (lightBarSet) input::resetLightBar(0);
lightBarSet = false;
- } else if (g_ui->accentColor(c)) {
+ } else if (mode == 1 || g_ui->accentColor(c)) {
+ static ui::Color logged = 0;
+ if (!g_autoplay.title.empty() && c != logged) XC_LOGI("light bar: #%06X", c & 0xFFFFFF), logged = c;
input::setLightBar(static_cast<uint8_t>(c), static_cast<uint8_t>(c >> 8), static_cast<uint8_t>(c >> 16));
lightBarSet = true;
}
@@ -259,6 +265,8 @@ int main(int argc, char** argv) {
nav.l2 = pad.triggerL2 > 0.5f && prev.triggerL2 <= 0.5f;
nav.r2 = pad.triggerR2 > 0.5f && prev.triggerR2 <= 0.5f;
nav.touchpad = pad.btnTouchpad;
+ nav.stickX = pad.leftStickX;
+ nav.stickY = pad.leftStickY;
nav.nowMs = now;
bool menuCombo = pad.btnOptions && pad.btnTouchpad && !(prev.btnOptions && prev.btnTouchpad);
prev = pad;
diff --git a/src/app/settings.cpp b/src/app/settings.cpp
index ef17237..f81717e 100644
--- a/src/app/settings.cpp
+++ b/src/app/settings.cpp
@@ -7,6 +7,8 @@
#include "util/log.h"
#include <algorithm>
+#include <cstdio>
+#include <cstdlib>
namespace xc::app {
@@ -30,7 +32,13 @@ bool Settings::load(const std::string& path) {
deadzone = static_cast<int>(std::clamp<int64_t>((*j)["deadzone"].asInt(deadzone), 0, 50));
triggerRumble = (*j)["triggerRumble"].asBool(triggerRumble);
circleConfirms = (*j)["circleConfirms"].asBool(circleConfirms);
- lightBar = (*j)["lightBar"].asBool(lightBar);
+ // "lightBar" (on/off) until the colour could be chosen.
+ lightBarMode = (*j)["lightBar"].asBool(true) ? 0 : 2;
+ lightBarMode = static_cast<int>(std::clamp<int64_t>((*j)["lightBarMode"].asInt(lightBarMode), 0, 2));
+ if (std::string hex = (*j)["lightBarColour"].str(); hex.size() == 7 && hex[0] == '#') {
+ uint32_t rgb = static_cast<uint32_t>(std::strtoul(hex.c_str() + 1, nullptr, 16));
+ lightBarColour = 0xFF000000u | (rgb >> 16 & 0xFF) | (rgb & 0xFF00) | (rgb & 0xFF) << 16;
+ }
gestureHints = static_cast<int>((*j)["gestureHints"].asInt(gestureHints));
skippedUpdate = (*j)["skippedUpdate"].str();
maxHeightCloud = static_cast<int>((*j)["maxHeightCloud"].asInt(0));
@@ -70,7 +78,11 @@ bool Settings::save(const std::string& path) const {
v.set("deadzone", deadzone);
v.set("triggerRumble", triggerRumble);
v.set("circleConfirms", circleConfirms);
- v.set("lightBar", lightBar);
+ v.set("lightBarMode", lightBarMode);
+ char hex[8];
+ std::snprintf(hex, sizeof hex, "#%02X%02X%02X", static_cast<unsigned>(lightBarColour & 0xFF),
+ static_cast<unsigned>(lightBarColour >> 8 & 0xFF), static_cast<unsigned>(lightBarColour >> 16 & 0xFF));
+ v.set("lightBarColour", std::string(hex));
v.set("gestureHints", gestureHints);
v.set("skippedUpdate", skippedUpdate);
v.set("maxHeightCloud", maxHeightCloud);
diff --git a/src/app/settings.h b/src/app/settings.h
index b9de523..bcea7e6 100644
--- a/src/app/settings.h
+++ b/src/app/settings.h
@@ -3,6 +3,7 @@
// User settings, kept in <dataDir>/settings.json.
#pragma once
+#include <cstdint>
#include <map>
#include <string>
#include <vector>
@@ -34,8 +35,10 @@ struct Settings {
int deadzone = 15;
bool triggerRumble = true;
bool circleConfirms = false;
- // The DualSense light bar takes the colour of the game in focus.
- bool lightBar = true;
+ // The DualSense light bar: 0 the colour of the game in focus, 1
+ // lightBarColour, 2 off.
+ int lightBarMode = 0;
+ uint32_t lightBarColour = 0xFFDC7000; // as ui::Color: 0xAABBGGRR, opaque (blue)
int gestureHints = 0;
// The release the user said "Not now" to: not offered again on start.
std::string skippedUpdate;
diff --git a/src/ui/app_ui.cpp b/src/ui/app_ui.cpp
index f2d4d35..2afef61 100644
--- a/src/ui/app_ui.cpp
+++ b/src/ui/app_ui.cpp
@@ -666,6 +666,93 @@ void AppUi::showPlayError(const std::string& message, const GameTile& game) {
dirty_ = true;
}
+namespace {
+
+// Hue 0..1, saturation and value 0..1.
+Color hsvColour(float h, float s, float v) {
+ h = (h - std::floor(h)) * 6.0f;
+ int i = static_cast<int>(h) % 6;
+ float f = h - std::floor(h), p = v * (1 - s), q = v * (1 - s * f), t = v * (1 - s * (1 - f));
+ float r = i == 0 || i == 5 ? v : i == 1 ? q : i == 2 || i == 3 ? p : t;
+ float g = i == 0 ? t : i == 1 || i == 2 ? v : i == 3 ? q : p;
+ float b = i == 2 ? t : i == 3 || i == 4 ? v : i == 5 ? q : p;
+ auto byte = [](float x) { return static_cast<uint8_t>(std::lround(std::clamp(x, 0.0f, 1.0f) * 255)); };
+ return rgba(byte(r), byte(g), byte(b));
+}
+
+void colourHsv(Color c, float& h, float& s, float& v) {
+ float r = (c & 0xFF) / 255.0f, g = (c >> 8 & 0xFF) / 255.0f, b = (c >> 16 & 0xFF) / 255.0f;
+ float mx = std::max({r, g, b}), mn = std::min({r, g, b}), d = mx - mn;
+ v = mx;
+ s = mx > 0 ? d / mx : 0;
+ if (d <= 0) h = 0;
+ else if (mx == r) h = (g - b) / d / 6.0f;
+ else if (mx == g) h = ((b - r) / d + 2) / 6.0f;
+ else h = ((r - g) / d + 4) / 6.0f;
+ if (h < 0) h += 1;
+}
+
+constexpr int kWheelR = 180;
+constexpr float kMinValue = 0.2f; // darker turns the light bar all but off
+
+} // namespace
+
+bool AppUi::settingsLightBar(int& mode, Color& colour) const {
+ std::lock_guard<std::mutex> lock(mutex_);
+ if (screen_ != Screen::Settings) return false;
+ mode = pickerOpen_ ? 1 : settings_.lightBarMode;
+ colour = pickerOpen_ ? pickerColour() : settings_.lightBarColour;
+ return true;
+}
+
+void AppUi::openColourPicker(int previousMode) {
+ // Caller holds mutex_. Starts on the colour saved.
+ float h, s, v;
+ colourHsv(settings_.lightBarColour, h, s, v);
+ pickU_ = s * std::cos(h * 6.2832f);
+ pickV_ = s * std::sin(h * 6.2832f);
+ pickValue_ = std::max(kMinValue, v);
+ pickerPrevMode_ = previousMode;
+ pickerLastMs_ = 0;
+ pickerOpen_ = true;
+ dirty_ = true;
+}
+
+Color AppUi::pickerColour() const {
+ float h = std::atan2(pickV_, pickU_) / 6.2832f;
+ return hsvColour(h < 0 ? h + 1 : h, std::min(1.0f, std::hypot(pickU_, pickV_)), pickValue_);
+}
+
+void AppUi::handleColourPicker(const NavInput& in) {
+ // Caller holds mutex_. The stick moves the cursor smoothly, the D-pad a
+ // step at a time; L2 / R2 change the brightness.
+ float dt = pickerLastMs_ && in.nowMs > pickerLastMs_ ? std::min(0.1f, (in.nowMs - pickerLastMs_) / 1000.0f) : 0;
+ pickerLastMs_ = in.nowMs;
+ float u = pickU_, v = pickV_;
+ auto axis = [](float a) { return std::abs(a) < 0.2f ? 0.0f : a; };
+ u += axis(in.stickX) * 1.1f * dt;
+ v += axis(in.stickY) * 1.1f * dt;
+ constexpr float kStep = 0.05f;
+ if (in.left) u -= kStep;
+ if (in.right) u += kStep;
+ if (in.up) v -= kStep;
+ if (in.down) v += kStep;
+ if (float d = std::hypot(u, v); d > 1) u /= d, v /= d;
+ if (u != pickU_ || v != pickV_) pickU_ = u, pickV_ = v, dirty_ = true;
+ if (in.l2) pickValue_ = std::max(kMinValue, pickValue_ - 0.1f), dirty_ = true;
+ if (in.r2) pickValue_ = std::min(1.0f, pickValue_ + 0.1f), dirty_ = true;
+ if (in.accept) {
+ settings_.lightBarColour = pickerColour();
+ settings_.lightBarMode = 1;
+ pickerOpen_ = false;
+ dirty_ = true;
+ } else if (in.back) {
+ settings_.lightBarMode = pickerPrevMode_;
+ pickerOpen_ = false;
+ dirty_ = true;
+ }
+}
+
void AppUi::setUpdateState(const std::string& current, const std::string& available, bool checking) {
std::lock_guard<std::mutex> lock(mutex_);
updateCurrent_ = current;
@@ -758,7 +845,7 @@ bool AppUi::accentColor(Color& out) {
void AppUi::drawPads(Canvas& c) {
// Bottom left, on the line of the button hints (which are right-aligned).
- drawPadRow(c, fonts_.bold, kMargin, kH - 70, 54, 14, pads_);
+ drawPadRow(c, fonts_.bold, kMargin, kH - 26 - padIconHeight(48), 48, 16, pads_, kBg);
}
void AppUi::setRegions(std::vector<std::string> regions, const std::string& defaultRegion) {
@@ -786,9 +873,9 @@ std::vector<std::string> AppUi::settingOptions(int row) const {
} else if (row == 4) {
out = {tr(Str::Activated), tr(Str::Deactivated)};
} else if (row == 5) {
- out = {tr(Str::ButtonCross), tr(Str::ButtonCircle)};
+ out = {"", ""}; // Cross, Circle: drawn as the buttons
} else if (row == 6) {
- out = {tr(Str::Activated), tr(Str::Deactivated)};
+ out = {tr(Str::LightBarGame), tr(Str::LightBarCustom), tr(Str::Deactivated)};
} else if (row == 7) {
// Updates: Cross acts, no list.
} else {
@@ -811,7 +898,7 @@ int AppUi::settingSelected(int row) const {
if (row == 3) return settings_.deadzone;
if (row == 4) return settings_.triggerRumble ? 0 : 1;
if (row == 5) return settings_.circleConfirms ? 1 : 0;
- if (row == 6) return settings_.lightBar ? 0 : 1;
+ if (row == 6) return settings_.lightBarMode;
if (row == 7) return 0;
for (size_t i = 0; i < regions_.size(); ++i)
if (regions_[i] == settings_.region) return static_cast<int>(i) + 1;
@@ -832,7 +919,7 @@ void AppUi::applySetting(int row, int index) {
} else if (row == 5) {
settings_.circleConfirms = index == 1;
} else if (row == 6) {
- settings_.lightBar = index == 0;
+ settings_.lightBarMode = index;
} else if (row == 7) {
} else {
settings_.region = index == 0 ? std::string() : regions_[static_cast<size_t>(index - 1)];
@@ -1176,13 +1263,19 @@ UiEvent AppUi::handle(const NavInput& in) {
switch (screen_) {
case Screen::Home: handleHome(in, ev); break;
case Screen::Settings:
+ if (pickerOpen_) {
+ handleColourPicker(in);
+ break;
+ }
if (dropdownOpen_) {
// The list: up / down, Cross picks, Circle closes it unchanged.
int n = static_cast<int>(settingOptions(settingsRow_).size());
if (in.down && dropdownIndex_ + 1 < n) ++dropdownIndex_;
if (in.up && dropdownIndex_ > 0) --dropdownIndex_;
+ int before = settingSelected(settingsRow_);
if (in.accept) applySetting(settingsRow_, dropdownIndex_);
if (in.accept || in.back) dropdownOpen_ = false;
+ if (in.accept && settingsRow_ == 6 && dropdownIndex_ == 1) openColourPicker(before);
dirty_ = true;
break;
}
@@ -1301,6 +1394,27 @@ 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));
+ }
+}
+
void AppUi::drawHints(Canvas& c, const std::vector<std::pair<int, const char*>>& hints) {
// Right-aligned PlayStation button glyphs with labels.
constexpr int kPx = 22, kR = 14, kGap = 36;
@@ -1337,19 +1451,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 {
- c.fillCircle(cx, cy, kR, rgba(255, 255, 255, 40));
- if (icon == kIconCross) {
- c.line(cx - 6, cy - 6, cx + 6, cy + 6, 2.5f, rgba(124, 178, 232));
- c.line(cx + 6, cy - 6, cx - 6, cy + 6, 2.5f, rgba(124, 178, 232));
- } else if (icon == kIconCircle) {
- c.strokeArc(cx, cy, 6.5f, 2.5f, 0, 6.2832f, rgba(255, 102, 102));
- } else if (icon == kIconSquare) {
- c.strokeRect({static_cast<int>(cx) - 6, static_cast<int>(cy) - 6, 12, 12}, rgba(240, 130, 200), 2);
- } else {
- c.line(cx, cy - 7, cx - 7, cy + 5, 2.5f, rgba(64, 226, 160));
- c.line(cx, cy - 7, cx + 7, cy + 5, 2.5f, rgba(64, 226, 160));
- c.line(cx - 7, cy + 5, cx + 7, cy + 5, 2.5f, rgba(64, 226, 160));
- }
+ drawFaceButton(c, icon, cx, cy, kR);
}
x -= kGap;
}
@@ -2097,9 +2199,18 @@ void AppUi::drawSettings(Canvas& c) {
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 w = fonts_.regular.measure(value, 30);
- fonts_.regular.draw(c, value, r.x + r.w - 76 - w, fonts_.regular.centeredY(r.y, r.h, 30), 30,
- focused ? kWhite : kGray);
+ 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);
+ } else {
+ int w = fonts_.regular.measure(value, 30);
+ fonts_.regular.draw(c, value, vx - w, fonts_.regular.centeredY(r.y, r.h, 30), 30, 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));
+ }
+ }
y += kRowH + 10;
}
for (const auto& line : fonts_.regular.wrap(tr(Str::SettingsNote), 24, kRowW, 2)) {
@@ -2107,6 +2218,10 @@ void AppUi::drawSettings(Canvas& c) {
y += 34;
}
+ if (pickerOpen_) {
+ drawColourPicker(c);
+ return;
+ }
if (dropdownOpen_) {
// The list under (or, near the bottom, over) the row, right-aligned
// with it; scrolls past kVisible choices.
@@ -2129,8 +2244,13 @@ void AppUi::drawSettings(Canvas& c) {
bool on = i == dropdownIndex_;
if (on) c.fillRect(item, kWhite, 12);
Color text = on ? kBg : (i == sel ? kWhite : kGray);
- fonts_.semibold.draw(c, options[static_cast<size_t>(i)], item.x + 24,
- fonts_.semibold.centeredY(item.y, item.h, 26), 26, text);
+ if (settingsRow_ == 5)
+ drawFaceButton(c, i == 1 ? kIconCircle : kIconCross, item.x + 44.0f, item.y + item.h / 2.0f, 20);
+ else
+ fonts_.semibold.draw(c, options[static_cast<size_t>(i)], item.x + 24,
+ fonts_.semibold.centeredY(item.y, item.h, 26), 26, text);
+ if (settingsRow_ == 6 && i == 1)
+ c.fillCircle(item.x + item.w - 84.0f, item.y + item.h / 2.0f, 12, settings_.lightBarColour);
if (i == sel) { // a check mark on the current choice
float cx = static_cast<float>(item.x + item.w - 36), cy = static_cast<float>(item.y + item.h / 2);
c.line(cx - 10, cy, cx - 3, cy + 7, 3, on ? kBg : kGreen);
@@ -2179,6 +2299,78 @@ void AppUi::drawUpdatePrompt(Canvas& c) {
drawHints(c, {{kIconCross, tr(Str::Select)}, {kIconCircle, tr(Str::NotNow)}});
}
+void AppUi::drawColourPicker(Canvas& c) {
+ c.fillRect({0, 0, kW, kH}, rgba(0, 0, 0, 160));
+ constexpr int kPanelW = 1000, kPanelH = 540;
+ Rect panel{(kW - kPanelW) / 2, (kH - kPanelH) / 2 - 20, kPanelW, kPanelH};
+ c.fillRect({panel.x + 8, panel.y + 12, panel.w, panel.h}, rgba(0, 0, 0, 120), 26); // shadow
+ c.fillRect(panel, kPanel, 24);
+ c.strokeRect(panel, rgba(255, 255, 255, 50), 2, 24);
+ fonts_.bold.draw(c, tr(Str::LightBarColour), panel.x + 56, panel.y + 44, 40, kWhite);
+
+ // The wheel: angle = hue, distance from the centre = saturation, at the
+ // brightness chosen (its pixels kept until that changes).
+ const int R = kWheelR, cx = panel.x + 56 + R, cy = panel.y + 120 + R;
+ if (wheelValue_ != pickValue_ || wheel_.empty()) {
+ wheel_.assign(static_cast<size_t>(4 * R * R), 0);
+ for (int y = 0; y < 2 * R; ++y)
+ for (int x = 0; x < 2 * R; ++x) {
+ float u = (x + 0.5f - R) / R, v = (y + 0.5f - R) / R, d = std::hypot(u, v);
+ if (d > 1.0f + 1.0f / R) continue;
+ float h = std::atan2(v, u) / 6.2832f;
+ Color col = hsvColour(h < 0 ? h + 1 : h, std::min(1.0f, d), pickValue_);
+ // Edge coverage, for a smooth rim.
+ uint32_t a = static_cast<uint32_t>(std::clamp((1.0f - d) * R + 0.5f, 0.0f, 1.0f) * 255);
+ wheel_[static_cast<size_t>(y * 2 * R + x)] = (col & 0x00FFFFFF) | a << 24;
+ }
+ wheelValue_ = pickValue_;
+ }
+ uint32_t* px = c.data();
+ for (int y = 0; y < 2 * R; ++y)
+ for (int x = 0; x < 2 * R; ++x) {
+ uint32_t w = wheel_[static_cast<size_t>(y * 2 * R + x)], a = w >> 24;
+ if (!a) continue;
+ uint32_t& d = px[static_cast<size_t>((cy - R + y) * kW + (cx - R + x))];
+ auto mix = [&](int shift) {
+ uint32_t s = w >> shift & 0xFF, t = d >> shift & 0xFF;
+ return ((s * a + t * (255 - a)) / 255) << shift;
+ };
+ d = mix(0) | mix(8) | mix(16) | 0xFF000000u;
+ }
+ float kx = cx + pickU_ * R, ky = cy + pickV_ * R; // the cursor
+ c.strokeArc(kx, ky, 15, 3, 0, 6.2832f, rgba(0, 0, 0, 160));
+ c.strokeArc(kx, ky, 12, 3, 0, 6.2832f, kWhite);
+
+ // The colour chosen, and the brightness under it.
+ const int sx = panel.x + 56 + 2 * R + 80, sw = panel.x + panel.w - 56 - sx;
+ Color chosen = pickerColour();
+ c.fillRect({sx, cy - R + 10, sw, 170}, chosen, 20);
+ c.strokeRect({sx, cy - R + 10, sw, 170}, rgba(255, 255, 255, 60), 2, 20);
+ Rect bar{sx, cy + 30, sw, 18};
+ float h = std::atan2(pickV_, pickU_) / 6.2832f, s = std::min(1.0f, std::hypot(pickU_, pickV_));
+ c.gradientH(bar, hsvColour(h < 0 ? h + 1 : h, s, kMinValue), hsvColour(h < 0 ? h + 1 : h, s, 1));
+ float mx = bar.x + (pickValue_ - kMinValue) / (1 - kMinValue) * bar.w;
+ c.fillCircle(mx, bar.y + bar.h / 2.0f, 14, kWhite);
+ c.fillCircle(mx, bar.y + bar.h / 2.0f, 9, chosen);
+ // The help, a line per control (its parts are four spaces apart).
+ std::string help = tr(Str::ColourPickerHelp);
+ int hy = cy + 90;
+ for (size_t start = 0; start < help.size();) {
+ size_t gap = help.find(" ", start);
+ std::string part = help.substr(start, gap == std::string::npos ? std::string::npos : gap - start);
+ for (const auto& line : fonts_.regular.wrap(part, 22, sw, 2)) {
+ fonts_.regular.draw(c, line, sx, hy, 22, kGray);
+ hy += 32;
+ }
+ if (gap == std::string::npos) break;
+ start = help.find_first_not_of(' ', gap);
+ if (start == std::string::npos) break;
+ }
+
+ c.fillRect({0, kH - 80, kW, 80}, kBg);
+ drawHints(c, {{kIconCross, tr(Str::Select)}, {kIconCircle, tr(Str::Back)}});
+}
+
void AppUi::drawUpdating(Canvas& c, uint64_t nowMs) {
drawBackground(c);
drawLogo(c, kW / 2.0f, 330, 56);
diff --git a/src/ui/app_ui.h b/src/ui/app_ui.h
index 2aa4955..ebb1334 100644
--- a/src/ui/app_ui.h
+++ b/src/ui/app_ui.h
@@ -69,6 +69,7 @@ struct NavInput {
bool l1 = false, r1 = false, square = false, triangle = false, r3 = false;
bool l2 = false, r2 = false; // pressed (triggers past halfway)
bool touchpad = false; // held right now (sign out needs a 5 s hold)
+ float stickX = 0, stickY = 0; // the left stick, -1..1 (the colour picker)
uint64_t nowMs = 0;
};
@@ -80,7 +81,8 @@ struct SettingsChoice {
int deadzone = 3; // index into kDeadzonePercent (15 %)
bool triggerRumble = true;
bool circleConfirms = false; // Circle is Xbox A (and Cross is B)
- bool lightBar = true; // the light bar takes the game's colour
+ int lightBarMode = 0; // 0 the game's colour, 1 lightBarColour, 2 off
+ Color lightBarColour = rgba(0, 112, 220);
};
// The stick dead zones Settings offers, in percent of the travel.
@@ -177,6 +179,9 @@ public:
// The colour of the game in focus (or being played), from its art, for
// the DualSense light bar; false while there is none to show.
bool accentColor(Color& out);
+ // While Settings is open: the light bar being chosen there (the colour
+ // picker's colour as it moves), so the pad shows it at once.
+ bool settingsLightBar(int& mode, Color& colour) const;
// Regions offered by the account's xCloud login; `defaultRegion` is the
// one "Automatic" picks.
void setRegions(std::vector<std::string> regions, const std::string& defaultRegion);
@@ -262,6 +267,11 @@ private:
void drawError(Canvas& c);
void drawSettings(Canvas& c);
void drawUpdatePrompt(Canvas& c);
+ // The light bar's colour picker (Settings > Light bar > Custom colour).
+ void openColourPicker(int previousMode);
+ void handleColourPicker(const NavInput& in);
+ Color pickerColour() const;
+ void drawColourPicker(Canvas& c);
void drawUpdating(Canvas& c, uint64_t nowMs);
void changeSetting(int delta);
// Settings drop-downs: the choices of a row, the chosen one, choosing.
@@ -337,6 +347,13 @@ private:
int promptFocus_ = 0; // 0 Update now, 1 Not now
std::string updatingTo_, updateStatus_;
float updateFraction_ = -1;
+ bool pickerOpen_ = false;
+ float pickU_ = 0, pickV_ = 0; // on the wheel: angle = hue, distance = saturation
+ float pickValue_ = 1; // brightness
+ int pickerPrevMode_ = 0; // what Circle goes back to
+ uint64_t pickerLastMs_ = 0;
+ std::vector<uint32_t> wheel_; // the wheel's pixels at wheelValue_
+ float wheelValue_ = -1;
int settingsRow_ = 0;
bool dropdownOpen_ = false; // the list of the focused settings row
int dropdownIndex_ = 0, dropdownTop_ = 0;
diff --git a/src/ui/pad_icons.cpp b/src/ui/pad_icons.cpp
index 0459eb6..aae8ac4 100644
--- a/src/ui/pad_icons.cpp
+++ b/src/ui/pad_icons.cpp
@@ -2,6 +2,9 @@
// Copyright (C) 2026 RafaelNGP
#include "ui/pad_icons.h"
+#include <string>
+#include <utility>
+
namespace xc::ui {
Color playerColor(int index) {
@@ -13,24 +16,55 @@ Color playerColor(int index) {
}
}
-void drawPadIcon(Canvas& c, const Font& font, int x, int y, int w, int index, bool connected) {
- int h = w * 2 / 3;
+int padIconHeight(int w) { return w * 7 / 10 + 4 + w * 3 / 10; }
+
+void drawPadIcon(Canvas& c, const Font& font, int x, int y, int w, int index, bool connected, Color background) {
+ const float W = static_cast<float>(w), H = W * 0.7f, X = static_cast<float>(x), Y = static_cast<float>(y);
+ auto px = [&](float f) { return X + f * W; };
+ auto py = [&](float f) { return Y + f * H; };
// Opaque even when dim: overlapping translucent parts would show seams.
- Color body = connected ? playerColor(index) : rgba(52, 52, 52);
- // A rounded body with two grips hanging from its lower corners.
- int bodyH = h * 3 / 4;
- float gripR = w * 0.19f;
- c.fillCircle(x + w * 0.22f, y + h - gripR, gripR, body);
- c.fillCircle(x + w * 0.78f, y + h - gripR, gripR, body);
- c.fillRect({x, y, w, bodyH}, body, bodyH / 2);
+ Color body = connected ? playerColor(index) : rgba(70, 70, 70);
+ // A DualSense from the front: the body, its two grips, and the controls
+ // cut out of it in the background's colour.
+ c.fillRect({static_cast<int>(px(0.05f)), static_cast<int>(py(0.04f)), static_cast<int>(W * 0.90f),
+ static_cast<int>(H * 0.56f)},
+ body, static_cast<int>(H * 0.24f));
+ c.fillRect({static_cast<int>(px(0.24f)), static_cast<int>(py(0.36f)), static_cast<int>(W * 0.52f),
+ static_cast<int>(H * 0.36f)},
+ body, static_cast<int>(H * 0.14f));
+ for (int side = 0; side < 2; ++side) {
+ float x0 = side ? 0.74f : 0.26f, x1 = side ? 0.86f : 0.14f;
+ for (int k = 0; k <= 10; ++k) { // a capsule, out and down
+ float t = k / 10.0f;
+ c.fillCircle(px(x0 + (x1 - x0) * t), py(0.42f + 0.40f * t), W * (0.13f - 0.015f * t), body);
+ }
+ }
+ c.fillRect({static_cast<int>(px(0.355f)), static_cast<int>(py(0.12f)), static_cast<int>(W * 0.29f),
+ static_cast<int>(H * 0.22f)},
+ background, static_cast<int>(W * 0.035f)); // touchpad
+ float dx = px(0.19f), dy = py(0.30f), arm = W * 0.075f, bar = W * 0.045f; // D-pad
+ c.fillRect({static_cast<int>(dx - arm), static_cast<int>(dy - bar / 2), static_cast<int>(2 * arm), static_cast<int>(bar)},
+ background, 1);
+ c.fillRect({static_cast<int>(dx - bar / 2), static_cast<int>(dy - arm), static_cast<int>(bar), static_cast<int>(2 * arm)},
+ background, 1);
+ float bx = px(0.81f), by = py(0.30f), off = W * 0.06f; // the four buttons
+ for (auto [ox, oy] : {std::pair{0.0f, -1.0f}, {0.0f, 1.0f}, {-1.0f, 0.0f}, {1.0f, 0.0f}})
+ c.fillCircle(bx + ox * off, by + oy * off, W * 0.027f, background);
+ for (float sx : {0.37f, 0.63f}) { // the sticks
+ c.fillCircle(px(sx), py(0.58f), W * 0.085f, background);
+ c.fillCircle(px(sx), py(0.58f), W * 0.05f, body);
+ }
+ c.fillCircle(px(0.5f), py(0.58f), W * 0.02f, background); // PS button
+
std::string n = std::to_string(index + 1);
- int px = bodyH * 9 / 10;
- font.draw(c, n, x + (w - font.measure(n, px)) / 2, font.centeredY(y, bodyH, px), px,
- connected ? rgba(255, 255, 255) : rgba(120, 120, 120));
+ int npx = w * 3 / 10;
+ font.draw(c, n, x + (w - font.measure(n, npx)) / 2, y + static_cast<int>(H) + 4, npx,
+ connected ? rgba(255, 255, 255) : rgba(110, 110, 110));
}
-int drawPadRow(Canvas& c, const Font& font, int x, int y, int w, int gap, const PadSlots& pads) {
- for (int i = 0; i < static_cast<int>(pads.size()); ++i) drawPadIcon(c, font, x + i * (w + gap), y, w, i, pads[i].connected);
+int drawPadRow(Canvas& c, const Font& font, int x, int y, int w, int gap, const PadSlots& pads, Color background) {
+ for (int i = 0; i < static_cast<int>(pads.size()); ++i)
+ drawPadIcon(c, font, x + i * (w + gap), y, w, i, pads[i].connected, background);
return static_cast<int>(pads.size()) * (w + gap) - gap;
}
diff --git a/src/ui/pad_icons.h b/src/ui/pad_icons.h
index 61aebf6..fe806ad 100644
--- a/src/ui/pad_icons.h
+++ b/src/ui/pad_icons.h
@@ -21,11 +21,13 @@ using PadSlots = std::array<PadSlot, 4>;
// green, pink.
Color playerColor(int index);
-// One pad, `w` wide and w * 2 / 3 high, numbered `index + 1`: in the
-// player's colour when connected, dim when not.
-void drawPadIcon(Canvas& c, const Font& font, int x, int y, int w, int index, bool connected);
+// One pad, a DualSense `w` wide with its number `index + 1` below
+// (padIconHeight(w) in all): in the player's colour when connected, dim
+// when not. Its buttons are cut out in `background`, the colour behind it.
+void drawPadIcon(Canvas& c, const Font& font, int x, int y, int w, int index, bool connected, Color background);
+int padIconHeight(int w);
// The four side by side, `gap` apart; returns the width taken.
-int drawPadRow(Canvas& c, const Font& font, int x, int y, int w, int gap, const PadSlots& pads);
+int drawPadRow(Canvas& c, const Font& font, int x, int y, int w, int gap, const PadSlots& pads, Color background);
} // namespace xc::ui
diff --git a/src/ui/stream_menu.cpp b/src/ui/stream_menu.cpp
index f3b9812..1fe50df 100644
--- a/src/ui/stream_menu.cpp
+++ b/src/ui/stream_menu.cpp
@@ -181,11 +181,12 @@ Canvas StreamMenu::renderMenu(const StreamInfo& info) const {
for (int i = 0; i < static_cast<int>(pads_.size()); ++i) {
int sx = kPad + i * slotW;
constexpr int kIconW = 60;
- drawPadIcon(c, fonts_.bold, sx + (slotW - kIconW) / 2, y, kIconW, i, pads_[i].connected);
+ drawPadIcon(c, fonts_.bold, sx + (slotW - kIconW) / 2, y, kIconW, i, pads_[i].connected, kPanel);
if (!pads_[i].connected || pads_[i].name.empty()) continue;
auto name = fonts_.regular.wrap(pads_[i].name, 16, slotW - 8, 1);
if (!name.empty())
- fonts_.regular.draw(c, name[0], sx + (slotW - fonts_.regular.measure(name[0], 16)) / 2, y + 48, 16, kGray);
+ fonts_.regular.draw(c, name[0], sx + (slotW - fonts_.regular.measure(name[0], 16)) / 2,
+ y + padIconHeight(kIconW) + 4, 16, kGray);
}
// Cross selects, Circle goes back to the game (swapped with Circle
diff --git a/src/ui/strings.cpp b/src/ui/strings.cpp
index 47e083a..51fb7d1 100644
--- a/src/ui/strings.cpp
+++ b/src/ui/strings.cpp
@@ -137,8 +137,6 @@ constexpr Column kEnglish = {
"Confirm button", // ConfirmButton
"On", // Activated
"Off", // Deactivated
- "Cross", // ButtonCross
- "Circle", // ButtonCircle
"Version %s available", // UpdateAvailable
"Controllers", // Controllers
"Controller %s connected", // PadConnected
@@ -147,7 +145,7 @@ constexpr Column kEnglish = {
"On screen after", // StatOnScreen
"Connection lost: reconnecting...", // Reconnecting
"Reconnected", // Reconnected
- "Light bar in the game's colour", // LightBar
+ "Light bar", // LightBar
"Upscaling", // MenuUpscaler
"AI (Anime4K)", // UpscalerAi
"Free to play", // FreeToPlay
@@ -193,6 +191,10 @@ constexpr Column kEnglish = {
"Updated. Restarting...", // UpdateRestarting
"PSBox updated: open the app again", // UpdateReopen
"Update failed: nothing was changed", // UpdateFailed
+ "Game colour", // LightBarGame
+ "Custom colour", // LightBarCustom
+ "Light bar colour", // LightBarColour
+ "Left stick or D-pad: colour L2 / R2: brightness", // ColourPickerHelp
};
constexpr Column kPortugueseBR = {
@@ -300,8 +302,6 @@ constexpr Column kPortugueseBR = {
"Botão de confirmar",
"Ativada",
"Desativada",
- "Xis",
- "Círculo",
"Versão %s disponível",
"Controles",
"Controle %s conectado",
@@ -310,7 +310,7 @@ constexpr Column kPortugueseBR = {
"Na tela após",
"Conexão perdida: reconectando...",
"Reconectado",
- "Barra de luz com a cor do jogo",
+ "Barra de luz",
"Ampliação",
"IA (Anime4K)",
"Grátis para jogar",
@@ -356,6 +356,10 @@ constexpr Column kPortugueseBR = {
"Atualizado. Reiniciando...",
"PSBox atualizado: abra o app de novo",
"A atualização falhou: nada foi alterado",
+ "Cor do jogo",
+ "Cor personalizada",
+ "Cor da barra de luz",
+ "Analógico esquerdo ou direcional: cor L2 / R2: brilho",
};
constexpr Column kSpanish = {
@@ -463,8 +467,6 @@ constexpr Column kSpanish = {
"Botón de confirmar",
"Activada",
"Desactivada",
- "Equis",
- "Círculo",
"Versión %s disponible",
"Mandos",
"Mando %s conectado",
@@ -473,7 +475,7 @@ constexpr Column kSpanish = {
"En pantalla tras",
"Conexión perdida: reconectando...",
"Reconectado",
- "Barra de luz con el color del juego",
+ "Barra de luz",
"Escalado",
"IA (Anime4K)",
"Gratis para jugar",
@@ -519,6 +521,10 @@ constexpr Column kSpanish = {
"Actualizado. Reiniciando...",
"PSBox actualizado: abre la app de nuevo",
"La actualización falló: no se cambió nada",
+ "Color del juego",
+ "Color personalizado",
+ "Color de la barra de luz",
+ "Stick izquierdo o cruceta: color L2 / R2: brillo",
};
constexpr Column kFrench = {
@@ -626,8 +632,6 @@ constexpr Column kFrench = {
"Bouton de validation",
"Activée",
"Désactivée",
- "Croix",
- "Rond",
"Version %s disponible",
"Manettes",
"Manette %s connectée",
@@ -636,7 +640,7 @@ constexpr Column kFrench = {
"À l'écran après",
"Connexion perdue : reconnexion...",
"Reconnecté",
- "Barre lumineuse aux couleurs du jeu",
+ "Barre lumineuse",
"Mise à l'échelle",
"IA (Anime4K)",
"Gratuit",
@@ -682,6 +686,10 @@ constexpr Column kFrench = {
"Mis à jour. Redémarrage...",
"PSBox mis à jour : rouvrez l'app",
"Échec de la mise à jour : rien n'a changé",
+ "Couleur du jeu",
+ "Couleur personnalisée",
+ "Couleur de la barre lumineuse",
+ "Joystick gauche ou croix : couleur L2 / R2 : luminosité",
};
constexpr Column kGerman = {
@@ -789,8 +797,6 @@ constexpr Column kGerman = {
"Bestätigungstaste",
"An",
"Aus",
- "Kreuz",
- "Kreis",
"Version %s verfügbar",
"Controller",
"Controller %s verbunden",
@@ -799,7 +805,7 @@ constexpr Column kGerman = {
"Auf dem Bildschirm nach",
"Verbindung verloren: neu verbinden...",
"Wieder verbunden",
- "Lichtleiste in der Farbe des Spiels",
+ "Lichtleiste",
"Hochskalierung",
"KI (Anime4K)",
"Free-to-play",
@@ -845,6 +851,10 @@ constexpr Column kGerman = {
"Aktualisiert. Neustart...",
"PSBox aktualisiert: App erneut öffnen",
"Update fehlgeschlagen: nichts wurde geändert",
+ "Farbe des Spiels",
+ "Eigene Farbe",
+ "Farbe der Lichtleiste",
+ "Linker Stick oder Steuerkreuz: Farbe L2 / R2: Helligkeit",
};
constexpr Column kItalian = {
@@ -952,8 +962,6 @@ constexpr Column kItalian = {
"Tasto di conferma",
"Attivata",
"Disattivata",
- "Croce",
- "Cerchio",
"Versione %s disponibile",
"Controller",
"Controller %s connesso",
@@ -962,7 +970,7 @@ constexpr Column kItalian = {
"Sullo schermo dopo",
"Connessione persa: riconnessione...",
"Riconnesso",
- "Barra luminosa con il colore del gioco",
+ "Barra luminosa",
"Upscaling",
"IA (Anime4K)",
"Free to play",
@@ -1008,6 +1016,10 @@ constexpr Column kItalian = {
"Aggiornato. Riavvio...",
"PSBox aggiornato: riapri l'app",
"Aggiornamento non riuscito: nulla è cambiato",
+ "Colore del gioco",
+ "Colore personalizzato",
+ "Colore della barra luminosa",
+ "Levetta sinistra o croce: colore L2 / R2: luminosità",
};
constexpr std::array<const Column*, kLangs> kTable = {&kEnglish, &kPortugueseBR, &kSpanish,
diff --git a/src/ui/strings.h b/src/ui/strings.h
index 55d4e3c..d3827a4 100644
--- a/src/ui/strings.h
+++ b/src/ui/strings.h
@@ -114,8 +114,6 @@ enum class Str {
ConfirmButton, // settings: which button is Xbox A
Activated, // feminine on/off where the language needs it
Deactivated,
- ButtonCross,
- ButtonCircle,
UpdateAvailable, // the update pop-up's title; "%s" = the new version
Controllers, // in-game menu: the pads in use
PadConnected, // "%s" = "2 (user name)"
@@ -124,7 +122,7 @@ enum class Str {
StatOnScreen, // network arrival to on the TV
Reconnecting, // the connection dropped mid-game
Reconnected,
- LightBar, // settings: the light bar takes the game's colour
+ LightBar, // settings: the DualSense light bar's colour
MenuUpscaler, // game menu: how the picture is upscaled to 4K
UpscalerAi, // the Anime4K network
FreeToPlay, // details: a free-to-play game not on the account yet
@@ -170,6 +168,10 @@ enum class Str {
UpdateRestarting,
UpdateReopen, // notification when it couldn't restart
UpdateFailed, // toast; nothing was changed
+ LightBarGame, // Settings > Light bar: the game's colour
+ LightBarCustom, // Settings > Light bar: one the user picks
+ LightBarColour, // the colour picker's title
+ ColourPickerHelp, // under the colour picker
Count
};
diff --git a/tests/test_main.cpp b/tests/test_main.cpp
index 1cf93b1..65902d9 100644
--- a/tests/test_main.cpp
+++ b/tests/test_main.cpp
@@ -236,6 +236,16 @@ static void testSettingsMigration() {
CHECK(old.save(path));
xc::app::Settings again;
CHECK(again.load(path) && again.deband == 3 && again.upscaler == 2);
+ // The light bar's on/off before its colour could be chosen.
+ CHECK(loadFrom(R"({"lightBar":false})").lightBarMode == 2 && loadFrom(R"({"lightBar":true})").lightBarMode == 0);
+ xc::app::Settings custom;
+ custom.lightBarMode = 1;
+ custom.lightBarColour = xc::ui::rgba(0x12, 0x34, 0x56);
+ CHECK(custom.save(path));
+ std::string text;
+ CHECK(xc::platform::readFile(path, text) && text.find("\"#123456\"") != std::string::npos);
+ xc::app::Settings back;
+ CHECK(back.load(path) && back.lightBarMode == 1 && back.lightBarColour == xc::ui::rgba(0x12, 0x34, 0x56));
std::remove(path.c_str());
}