Skip to content

Xbox Cloud Gaming app for PS5 Homebrew

C

DualSense: trigger vibration, up to four players; controller settings; update notice

Rafael Abud Ferreiradc4da10d6fea
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2e3a2d9..a516e16 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -67,8 +67,10 @@ add_library(xcloud_ui STATIC
src/ui/brand.cpp
src/app/library.cpp
src/app/settings.cpp
+ src/app/update_check.cpp
extern/qrcodegen/qrcodegen.c
)
+target_compile_definitions(xcloud_ui PUBLIC XC_APP_VERSION="${PROJECT_VERSION}")
target_include_directories(xcloud_ui PUBLIC extern/stb extern/qrcodegen)
target_link_libraries(xcloud_ui PUBLIC xcloud_core)
diff --git a/src/app/ps5_main.cpp b/src/app/ps5_main.cpp
index 2d940bf..6b678a1 100644
--- a/src/app/ps5_main.cpp
+++ b/src/app/ps5_main.cpp
@@ -8,6 +8,7 @@
#include "app/library.h"
#include "app/settings.h"
#include "app/stream_player.h"
+#include "app/update_check.h"
#include "auth/auth_manager.h"
#include "display/display.h"
#include "input/controller.h"
@@ -77,6 +78,23 @@ std::mutex g_infoMutex;
ui::StreamInfo g_streamInfo;
std::atomic<uint32_t> g_infoSeq{0};
+// The dead zone setting (percent) as an index into ui::kDeadzonePercent.
+int deadzoneIndex(int percent) {
+ int best = 0;
+ for (int i = 0; i < static_cast<int>(std::size(ui::kDeadzonePercent)); ++i)
+ if (std::abs(ui::kDeadzonePercent[i] - percent) < std::abs(ui::kDeadzonePercent[best] - percent)) best = i;
+ return best;
+}
+
+// Dead zone, trigger vibration and confirm button from g_settings.
+void applyControllerSettings() {
+ std::lock_guard<std::mutex> lock(g_settingsMutex);
+ input::setDeadzone(g_settings.deadzone / 100.0f);
+ input::setTriggerRumbleEnabled(g_settings.triggerRumble);
+ input::setCircleConfirms(g_settings.circleConfirms);
+ if (g_ui) g_ui->setCircleConfirms(g_settings.circleConfirms);
+}
+
// The console keyboard answering a game's text field (main thread): the
// request it answers, and the stream that asked.
std::string g_keyboardFor;
@@ -124,7 +142,8 @@ void updateTextInput(app::StreamPlayer* player) {
// in, plays that title for that long (pressing A at 15 s and 20 s), saves
// decoded frames and logs "AUTOPLAY END". Options, comma-separated: nosimd,
// dump, repeat, idle (no A presses), threads=N (H.264 decoder threads),
-// rumbletest (rumbles the pad for 1.5 s at start), detailtest (opens a game to
+// rumbletest (rumbles the pad for 1.5 s at start), triggertest (the triggers
+// for 3 s), detailtest (opens a game to
// buy far down the list instead of playing, saves detail.ppm), imetest (opens
// the system keyboard on the home screen), menutest (in the game: the menu,
// 720p, back to 1080p), res=720p|1080p|1080p-hq|1440p and sharp=0..3 (instead
@@ -163,6 +182,7 @@ void loadAutoplay() {
if (opt == "repeat") g_autoplayRuns = 2;
if (opt == "idle") g_autoplayIdle = true;
if (opt == "rumbletest") input::setRumble(200, 200, 1500);
+ if (opt == "triggertest") input::setTriggerRumble(255, 128, 3000);
if (opt == "detailtest") g_autoplayDetailTest = true;
if (opt == "librarytest") g_autoplayLibraryTest = true;
if (opt == "imetest") g_autoplayImeTest = true;
@@ -513,6 +533,15 @@ void signInAndLoad(auth::AuthManager& am, xcloud::GssvClient& gssv) {
g_xblAuth = am.profile().xblAuthorization;
}
platform::notify(ui::trf(ui::Str::SignedInAs, am.profile().gamertag));
+ static bool updateChecked = false;
+ if (!updateChecked && g_autoplayTitle.empty()) {
+ updateChecked = true;
+ std::thread([] {
+ std::string tag = app::latestReleaseTag();
+ XC_LOGI("latest release: %s (this is %s)", tag.empty() ? "unknown" : tag.c_str(), XC_APP_VERSION);
+ if (app::isNewerVersion(tag, XC_APP_VERSION)) platform::notify(ui::trf(ui::Str::UpdateAvailable, tag));
+ }).detach();
+ }
std::vector<std::string> regions;
for (const auto& r : gssv.session().regions) regions.push_back(r.name);
const xcloud::Region* def = gssv.session().defaultRegion();
@@ -718,7 +747,11 @@ int main(int argc, char** argv) {
choice.language = static_cast<int>(ui::language());
choice.resolution = g_settings.resolution == "720p" ? 1 : g_settings.resolution == "1440p" ? 2 : 0;
choice.region = g_settings.region;
+ choice.deadzone = deadzoneIndex(g_settings.deadzone);
+ choice.triggerRumble = g_settings.triggerRumble;
+ choice.circleConfirms = g_settings.circleConfirms;
g_ui->setSettings(choice);
+ applyControllerSettings();
g_ui->setRegionLatency(g_settings.regionRtt);
g_ui->setPrefs(g_settings.hidden, g_settings.librarySort == "az" ? ui::LibrarySort::AZ
: g_settings.librarySort == "console" ? ui::LibrarySort::Console
@@ -744,7 +777,9 @@ int main(int argc, char** argv) {
int sharpness = 0; // 0..3, as Settings::sharpness
// How much CAS each sharpness level mixes in (display::setSharpness).
static constexpr int kSharpAmount[] = {0, 96, 176, 256};
- bool padReleased = true; // false from the menu/keyboard until the buttons are let go
+ bool padReleased = true;
+ bool padAttached[input::kMaxPads] = {}; // controllers 1..3 announced to the stream
+ uint64_t padsCheckedAt = 0; // false from the menu/keyboard until the buttons are let go
uint32_t overlaySeq = 0; // g_infoSeq + 1 when drawn; 0 = redraw
uint64_t homeSince = 0, launchSince = 0;
bool uiSaved = false, launchSaved = false;
@@ -753,6 +788,10 @@ int main(int argc, char** argv) {
// Autoplay runs unattended: the physical pad must not interfere.
if (!g_autoplayTitle.empty()) pad = input::ControllerState{};
uint64_t now = platform::nowMs();
+ if (now - padsCheckedAt >= 1000) { // other players signing in or out
+ padsCheckedAt = now;
+ input::refreshPads();
+ }
if (!g_keyboardFor.empty() && g_ui->screen() != ui::Screen::Streaming) updateTextInput(nullptr);
ui::NavInput nav;
@@ -797,6 +836,7 @@ int main(int argc, char** argv) {
std::lock_guard<std::mutex> lock(g_playerMutex);
if (g_player != overlayPlayer) { // a new stream
overlayPlayer = g_player;
+ for (bool& a : padAttached) a = false;
menu.close();
std::lock_guard<std::mutex> settingsLock(g_settingsMutex);
streamResolution = g_settings.resolution == "720p" ? 1 : g_settings.resolution == "1440p" ? 2 : 0;
@@ -810,6 +850,7 @@ int main(int argc, char** argv) {
// OPTIONS + TOUCHPAD opens the menu (and closes it again).
bool wasOpen = menu.isOpen();
if (!wasOpen && menuCombo && g_keyboardFor.empty()) {
+ menu.setCircleConfirms(g_settings.circleConfirms);
menu.open(streamResolution, showStats, sharpness);
overlaySeq = 0;
} else if (wasOpen) {
@@ -851,6 +892,16 @@ int main(int argc, char** argv) {
else if (!held) padReleased = true;
if (!padReleased || menuCombo) sent = input::ControllerState{};
g_player->sendInput(sent);
+ // The other players' controllers, straight to the game.
+ for (int i = 1; i < input::kMaxPads; ++i) {
+ input::ControllerState other;
+ bool on = input::pollPad(i, other);
+ if (on != padAttached[i]) {
+ padAttached[i] = on;
+ g_player->setPadConnected(i, on);
+ }
+ if (on) g_player->sendInput(other, i);
+ }
}
// The overlay: the menu, else the statistics line, redrawn when
// the numbers or the menu change.
@@ -917,10 +968,14 @@ int main(int argc, char** argv) {
: ev.settings.resolution == 2 ? "1440p"
: "1080p";
g_settings.region = ev.settings.region;
+ g_settings.deadzone = ui::kDeadzonePercent[ev.settings.deadzone];
+ g_settings.triggerRumble = ev.settings.triggerRumble;
+ g_settings.circleConfirms = ev.settings.circleConfirms;
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());
}
+ applyControllerSettings();
// Row titles and game details come from the catalog in the
// chosen language.
if (languageChanged) g_command = kReloadLibrary;
diff --git a/src/app/settings.cpp b/src/app/settings.cpp
index ae57c2c..ed1a11a 100644
--- a/src/app/settings.cpp
+++ b/src/app/settings.cpp
@@ -24,6 +24,9 @@ bool Settings::load(const std::string& path) {
librarySort = (*j)["librarySort"].str(librarySort);
streamStats = (*j)["streamStats"].asBool(streamStats);
sharpness = static_cast<int>(std::clamp<int64_t>((*j)["sharpness"].asInt(sharpness), 0, 3));
+ deadzone = static_cast<int>(std::clamp<int64_t>((*j)["deadzone"].asInt(deadzone), 0, 50));
+ triggerRumble = (*j)["triggerRumble"].asBool(triggerRumble);
+ circleConfirms = (*j)["circleConfirms"].asBool(circleConfirms);
regionRtt.clear();
for (const auto& [name, ms] : (*j)["regionRtt"].members())
if (ms.asInt() > 0) regionRtt[name] = static_cast<int>(ms.asInt());
@@ -44,6 +47,9 @@ bool Settings::save(const std::string& path) const {
v.set("librarySort", librarySort);
v.set("streamStats", streamStats);
v.set("sharpness", sharpness);
+ v.set("deadzone", deadzone);
+ v.set("triggerRumble", triggerRumble);
+ v.set("circleConfirms", circleConfirms);
return platform::writeFileAtomic(path, v.dump());
}
diff --git a/src/app/settings.h b/src/app/settings.h
index 6c33972..da89448 100644
--- a/src/app/settings.h
+++ b/src/app/settings.h
@@ -23,6 +23,11 @@ struct Settings {
bool streamStats = false;
// Sharpening of the game picture: 0 off, 1..3 low, medium, high.
int sharpness = 0;
+ // Controller: stick dead zone (percent), vibration in the triggers,
+ // Circle as the confirm button (Xbox A).
+ int deadzone = 15;
+ bool triggerRumble = true;
+ bool circleConfirms = false;
bool load(const std::string& path);
bool save(const std::string& path) const;
diff --git a/src/app/stream_player.cpp b/src/app/stream_player.cpp
index f21f526..23e3451 100644
--- a/src/app/stream_player.cpp
+++ b/src/app/stream_player.cpp
@@ -252,13 +252,14 @@ struct StreamPlayer::Impl {
};
// xCloud's motors are 0..100 percent, like the web client's
// dual-rumble effect (left = strong, right = weak). The trigger
- // motors have no plain-rumble counterpart on the DualSense.
+ // motors (impulse triggers) become the adaptive triggers vibrating.
cb.vibration = [this](const stream::Vibration& v) {
if (++vibrations <= 5)
XC_LOGI("vibration %u/%u/%u/%u for %ums", v.leftMotor, v.rightMotor, v.leftTrigger, v.rightTrigger,
v.durationMs);
auto scale = [](uint8_t pct) { return static_cast<uint8_t>(std::min<int>(pct, 100) * 255 / 100); };
- input::setRumble(scale(v.leftMotor), scale(v.rightMotor), v.durationMs);
+ input::setRumble(scale(v.leftMotor), scale(v.rightMotor), v.durationMs, v.gamepadIndex);
+ input::setTriggerRumble(scale(v.leftTrigger), scale(v.rightTrigger), v.durationMs, v.gamepadIndex);
};
cb.idleWarning = [](int seconds) {
platform::notify(ui::trf(ui::Str::IdleWarning, std::to_string(seconds)));
@@ -370,7 +371,10 @@ struct StreamPlayer::Impl {
if (audioThread.joinable()) audioThread.join();
session.reset();
media::audioStop();
- input::setRumble(0, 0, 0);
+ for (int i = 0; i < input::kMaxPads; ++i) {
+ input::setRumble(0, 0, 0, i);
+ input::setTriggerRumble(0, 0, 0, i);
+ }
}
};
@@ -385,9 +389,10 @@ std::string StreamPlayer::endReason() const {
return impl_->endReason;
}
-void StreamPlayer::sendInput(const input::ControllerState& p) {
+void StreamPlayer::sendInput(const input::ControllerState& p, int index) {
if (!impl_->session || !impl_->running) return;
stream::GamepadFrame f;
+ f.index = static_cast<uint8_t>(index);
auto set = [&](bool on, uint16_t bit) {
if (on) f.buttons |= bit;
};
@@ -414,6 +419,10 @@ void StreamPlayer::sendInput(const input::ControllerState& p) {
impl_->session->sendGamepad(f);
}
+void StreamPlayer::setPadConnected(int index, bool connected) {
+ if (impl_->session && impl_->running) impl_->session->setGamepadConnected(index, connected);
+}
+
bool StreamPlayer::takeTextInput(stream::TextInputRequest& out) {
std::lock_guard<std::mutex> lock(impl_->mutex);
while (!impl_->textRequests.empty()) {
diff --git a/src/app/stream_player.h b/src/app/stream_player.h
index 13709c6..152f4da 100644
--- a/src/app/stream_player.h
+++ b/src/app/stream_player.h
@@ -23,8 +23,11 @@ public:
bool start(std::string& err);
bool running() const;
std::string endReason() const;
- // From the input thread, once per polled pad state.
- void sendInput(const input::ControllerState& pad);
+ // From the input thread, once per polled pad state; `index` 0..3 is the
+ // controller's slot (input::pollPad).
+ void sendInput(const input::ControllerState& pad, int index = 0);
+ // Controllers 1..3 coming and going (0 is there from the start).
+ void setPadConnected(int index, bool connected);
// The game's requests for text, oldest first (main thread): false when
// none. Each one is answered once with answerTextInput() (accepted false
// = cancelled); textInputWithdrawn() turns true when the game gave up
diff --git a/src/app/update_check.cpp b/src/app/update_check.cpp
new file mode 100644
index 0000000..b9ff74c
--- /dev/null
+++ b/src/app/update_check.cpp
@@ -0,0 +1,48 @@
+// SPDX-License-Identifier: GPL-3.0-or-later
+// Copyright (C) 2026 RafaelNGP
+#include "app/update_check.h"
+
+#include "net/http.h"
+#include "util/json.h"
+
+#include <vector>
+
+namespace xc::app {
+
+namespace {
+
+constexpr const char* kLatestRelease = "https://api.github.com/repos/RafaelNGP/xbox-cloud-gaming-ps5/releases/latest";
+
+// "v1.2.3" / "1.2" -> {1, 2, 3} / {1, 2, 0}; empty when it isn't a version.
+std::vector<int> parts(const std::string& v) {
+ size_t i = !v.empty() && (v[0] == 'v' || v[0] == 'V') ? 1 : 0;
+ std::vector<int> out;
+ while (out.size() < 3 && i < v.size() && v[i] >= '0' && v[i] <= '9') {
+ int n = 0;
+ while (i < v.size() && v[i] >= '0' && v[i] <= '9') n = n * 10 + (v[i++] - '0');
+ out.push_back(n);
+ if (i < v.size() && v[i] == '.') ++i;
+ }
+ if (!out.empty()) out.resize(3, 0);
+ return out;
+}
+
+} // namespace
+
+bool isNewerVersion(const std::string& tag, const std::string& current) {
+ auto a = parts(tag), b = parts(current);
+ return !a.empty() && !b.empty() && a > b;
+}
+
+std::string latestReleaseTag() {
+ net::Request req;
+ req.url = kLatestRelease;
+ req.headers = {{"Accept", "application/vnd.github+json"}, {"User-Agent", "PSBox-Cloud-Gaming"}};
+ req.timeoutMs = 10000;
+ auto r = net::perform(req);
+ if (!r.ok()) return {};
+ auto j = json::parse(r.body);
+ return j ? (*j)["tag_name"].str() : std::string();
+}
+
+} // namespace xc::app
diff --git a/src/app/update_check.h b/src/app/update_check.h
new file mode 100644
index 0000000..8d9495b
--- /dev/null
+++ b/src/app/update_check.h
@@ -0,0 +1,17 @@
+// SPDX-License-Identifier: GPL-3.0-or-later
+// Copyright (C) 2026 RafaelNGP
+// Is there a newer release of the app on GitHub?
+#pragma once
+
+#include <string>
+
+namespace xc::app {
+
+// "v0.4.0" against "0.3.0": true when `tag` is a later version. Tags that
+// aren't versions are never newer.
+bool isNewerVersion(const std::string& tag, const std::string& current);
+
+// The tag of the latest GitHub release, or empty (no network, rate limit).
+std::string latestReleaseTag();
+
+} // namespace xc::app
diff --git a/src/input/controller.cpp b/src/input/controller.cpp
index 446d2ce..4e0d6d3 100644
--- a/src/input/controller.cpp
+++ b/src/input/controller.cpp
@@ -57,9 +57,13 @@ static_assert(offsetof(ScePadData, connected) == 76, "ScePadData layout");
struct SceUserServiceInitializeParams {
uint32_t priority;
};
+struct SceUserServiceLoginUserIdList {
+ int32_t userId[4]; // -1: none
+};
int sceUserServiceInitialize(const SceUserServiceInitializeParams* param);
int sceUserServiceGetInitialUser(int32_t* userId);
+int sceUserServiceGetLoginUserIdList(SceUserServiceLoginUserIdList* list);
int scePadInit(void);
int scePadOpen(int32_t userId, int32_t type, int32_t index, const void* param);
int scePadClose(int32_t handle);
@@ -71,18 +75,66 @@ struct ScePadVibrationParam {
};
int scePadSetVibration(int32_t handle, const ScePadVibrationParam* param);
int scePadSetVibrationMode(int32_t handle, int32_t mode);
+
+// Adaptive triggers (layout as ProsperoEden's ps5_pad.hpp).
+struct ScePadTriggerEffectCommand {
+ int32_t mode; // 0 off, 3 vibration
+ int32_t reserved;
+ uint8_t data[48]; // vibration: position (0..9), amplitude (0..8), frequency (Hz)
+};
+struct ScePadTriggerEffectParam {
+ uint8_t triggerMask; // 1 = L2, 2 = R2
+ uint8_t reserved[7];
+ ScePadTriggerEffectCommand command[2];
+};
+static_assert(sizeof(ScePadTriggerEffectParam) == 120, "ScePadTriggerEffectParam layout");
+int scePadSetTriggerEffect(int32_t handle, const ScePadTriggerEffectParam* param);
}
namespace xc::input {
namespace {
-int32_t g_userId = -1;
-int32_t g_padHandle = -1;
+
+constexpr uint8_t kTriggerVibrationHz = 40;
+
+// A rumble request: packed as a << 8 | b, and when it ends (0 = never).
+struct Rumble {
+ std::atomic<uint32_t> wanted{0};
+ std::atomic<uint64_t> untilMs{0};
+ uint32_t applied = 0;
+
+ void set(uint8_t a, uint8_t b, uint32_t durationMs) {
+ untilMs = durationMs ? platform::nowMs() + durationMs : 0;
+ wanted = (uint32_t(a) << 8) | b;
+ }
+ // The value to apply now, or false when it hasn't changed.
+ bool due(uint32_t& out) {
+ uint32_t want = wanted;
+ uint64_t until = untilMs;
+ if (want && until && platform::nowMs() >= until) {
+ wanted.compare_exchange_strong(want, 0);
+ want = 0;
+ }
+ if (want == applied) return false;
+ applied = out = want;
+ return true;
+ }
+};
+
+struct Pad {
+ int32_t userId = -1;
+ int32_t handle = -1;
+ Rumble motors, triggers;
+};
+Pad g_pads[kMaxPads];
+std::atomic<float> g_deadzone{0.15f};
+std::atomic<bool> g_circleConfirms{false}, g_triggerRumble{true};
+bool g_rumbleLogged = false, g_triggerLogged = false;
inline float normStick(uint8_t val) {
- // 0..255 -> -1.0 .. 1.0 (deadzone 0.15)
+ // 0..255 -> -1.0 .. 1.0, nothing inside the dead zone
float v = (static_cast<float>(val) - 128.0f) / 128.0f;
- if (std::abs(v) < 0.15f) return 0.0f;
+ if (std::abs(v) < g_deadzone.load(std::memory_order_relaxed)) return 0.0f;
return std::clamp(v, -1.0f, 1.0f);
}
@@ -90,37 +142,81 @@ inline float normTrigger(uint8_t val) {
return static_cast<float>(val) / 255.0f;
}
-// Requested rumble, packed as large << 8 | small, and when it ends (0 = never).
-std::atomic<uint32_t> g_rumbleWanted{0};
-std::atomic<uint64_t> g_rumbleUntilMs{0};
-uint32_t g_rumbleApplied = 0;
-bool g_rumbleErrorLogged = false;
-
-void applyRumble() {
- uint32_t want = g_rumbleWanted;
- uint64_t until = g_rumbleUntilMs;
- if (want && until && platform::nowMs() >= until) {
- g_rumbleWanted.compare_exchange_strong(want, 0);
- want = 0;
+bool openPad(Pad& pad, int32_t userId, int slot) {
+ int32_t h = scePadOpen(userId, 0, 0, nullptr);
+ if (h < 0) {
+ XC_LOGW("scePadOpen(user %d): 0x%08x", userId, static_cast<unsigned>(h));
+ return false;
}
- if (want == g_rumbleApplied) return;
- ScePadVibrationParam p{static_cast<uint8_t>(want >> 8), static_cast<uint8_t>(want)};
- int rc = scePadSetVibration(g_padHandle, &p);
- if (!g_rumbleErrorLogged) { // the first call, and the first failure
- g_rumbleErrorLogged = rc != 0;
- static bool firstLogged = false;
- if (!firstLogged || rc != 0) XC_LOGI("scePadSetVibration(%u, %u): 0x%08x", p.largeMotor, p.smallMotor, rc);
- firstLogged = true;
+ // The DualSense starts in haptics mode, where scePadSetVibration succeeds
+ // and does nothing; mode 2 is classic two-motor rumble (as ProsperoEden).
+ int mode = scePadSetVibrationMode(h, 2);
+ pad.userId = userId;
+ pad.handle = h;
+ pad.motors.applied = pad.triggers.applied = 0;
+ XC_LOGI("pad %d opened (handle %d, user %d, rumble mode 0x%08x)", slot, h, userId, static_cast<unsigned>(mode));
+ return true;
+}
+
+void closePad(Pad& pad, int slot) {
+ if (pad.handle < 0) return;
+ ScePadVibrationParam off{0, 0};
+ scePadSetVibration(pad.handle, &off);
+ ScePadTriggerEffectParam none{};
+ none.triggerMask = 3;
+ scePadSetTriggerEffect(pad.handle, &none);
+ scePadClose(pad.handle);
+ XC_LOGI("pad %d closed (user %d)", slot, pad.userId);
+ pad.handle = -1;
+ pad.userId = -1;
+}
+
+void applyRumble(Pad& pad) {
+ uint32_t v;
+ if (pad.motors.due(v)) {
+ ScePadVibrationParam p{static_cast<uint8_t>(v >> 8), static_cast<uint8_t>(v)};
+ int rc = scePadSetVibration(pad.handle, &p);
+ if (!g_rumbleLogged || rc != 0) XC_LOGI("scePadSetVibration(%u, %u): 0x%08x", p.largeMotor, p.smallMotor, rc);
+ g_rumbleLogged = true;
+ }
+ if (pad.triggers.due(v)) {
+ ScePadTriggerEffectParam p{};
+ p.triggerMask = 3;
+ const uint8_t level[2] = {static_cast<uint8_t>(v >> 8), static_cast<uint8_t>(v)};
+ for (int t = 0; t < 2; ++t) {
+ if (!level[t]) continue; // mode 0: off
+ p.command[t].mode = 3;
+ p.command[t].data[0] = 0; // from the top of the travel
+ p.command[t].data[1] = static_cast<uint8_t>(std::max(1, (level[t] * 8 + 127) / 255));
+ p.command[t].data[2] = kTriggerVibrationHz;
+ }
+ int rc = scePadSetTriggerEffect(pad.handle, &p);
+ if (!g_triggerLogged || rc != 0) XC_LOGI("scePadSetTriggerEffect(%u, %u): 0x%08x", level[0], level[1], rc);
+ g_triggerLogged = true;
}
- g_rumbleApplied = want;
}
+
} // namespace
-void setRumble(uint8_t large, uint8_t small, uint32_t durationMs) {
- g_rumbleUntilMs = durationMs ? platform::nowMs() + durationMs : 0;
- g_rumbleWanted = (uint32_t(large) << 8) | small;
+void setRumble(uint8_t large, uint8_t small, uint32_t durationMs, int pad) {
+ if (pad >= 0 && pad < kMaxPads) g_pads[pad].motors.set(large, small, durationMs);
}
+void setTriggerRumble(uint8_t left, uint8_t right, uint32_t durationMs, int pad) {
+ if (!g_triggerRumble) left = right = 0;
+ if (pad >= 0 && pad < kMaxPads) g_pads[pad].triggers.set(left, right, durationMs);
+}
+
+void setCircleConfirms(bool on) { g_circleConfirms = on; }
+
+void setTriggerRumbleEnabled(bool on) {
+ g_triggerRumble = on;
+ if (!on)
+ for (Pad& p : g_pads) p.triggers.set(0, 0, 0);
+}
+
+void setDeadzone(float deadzone) { g_deadzone = std::clamp(deadzone, 0.0f, 0.5f); }
+
bool init() {
int rc = scePadInit();
if (rc != 0) {
@@ -138,41 +234,51 @@ bool init() {
XC_LOGE("sceUserServiceGetInitialUser failed: 0x%08x", rc);
return false;
}
- g_userId = uid;
- g_padHandle = scePadOpen(g_userId, 0, 0, nullptr);
- if (g_padHandle < 0) {
- XC_LOGE("scePadOpen failed: 0x%08x", g_padHandle);
+ if (!openPad(g_pads[0], uid, 0)) return false;
+ refreshPads();
+ return true;
+}
+
+void refreshPads() {
+ SceUserServiceLoginUserIdList list;
+ std::memset(&list, 0xFF, sizeof list);
+ if (sceUserServiceGetLoginUserIdList(&list) != 0) return;
+ auto signedIn = [&](int32_t user) {
+ for (int32_t u : list.userId)
+ if (u == user) return true;
return false;
+ };
+ // Signed out: free the slot (pad 0 stays with the app's user).
+ for (int i = 1; i < kMaxPads; ++i)
+ if (g_pads[i].handle >= 0 && !signedIn(g_pads[i].userId)) closePad(g_pads[i], i);
+ // Signed in: the first free slot.
+ for (int32_t user : list.userId) {
+ if (user < 0) continue;
+ bool known = false;
+ for (const Pad& p : g_pads) known |= p.userId == user;
+ if (known) continue;
+ for (int i = 1; i < kMaxPads; ++i)
+ if (g_pads[i].handle < 0) {
+ openPad(g_pads[i], user, i);
+ break;
+ }
}
- // The DualSense starts in haptics mode, where scePadSetVibration succeeds
- // and does nothing; mode 2 is classic two-motor rumble (as ProsperoEden).
- int mode = scePadSetVibrationMode(g_padHandle, 2);
- XC_LOGI("DualSense pad opened successfully (handle: %d, user: %d, rumble mode: 0x%08x)", g_padHandle, g_userId,
- mode);
- return true;
}
void shutdown() {
- if (g_padHandle >= 0) {
- ScePadVibrationParam off{0, 0};
- scePadSetVibration(g_padHandle, &off);
- scePadClose(g_padHandle);
- g_padHandle = -1;
- }
+ for (int i = 0; i < kMaxPads; ++i) closePad(g_pads[i], i);
}
-bool poll(ControllerState& out) {
- if (g_padHandle < 0) {
- out = {};
- return false;
- }
- applyRumble();
+bool poll(ControllerState& out) { return pollPad(0, out); }
+
+bool pollPad(int index, ControllerState& out) {
+ out = {};
+ if (index < 0 || index >= kMaxPads || g_pads[index].handle < 0) return false;
+ Pad& slot = g_pads[index];
+ applyRumble(slot);
ScePadData pad{};
- int rc = scePadReadState(g_padHandle, &pad);
- if (rc != 0 || !pad.connected) {
- out.connected = false;
- return false;
- }
+ int rc = scePadReadState(slot.handle, &pad);
+ if (rc != 0 || !pad.connected) return false;
out.connected = true;
uint32_t b = pad.buttons;
@@ -188,6 +294,7 @@ bool poll(ControllerState& out) {
out.btnB = (b & 0x2000) != 0; // Circle
out.btnX = (b & 0x8000) != 0; // Square
out.btnY = (b & 0x1000) != 0; // Triangle
+ if (g_circleConfirms) std::swap(out.btnA, out.btnB);
// Shoulders & Sticks
out.btnL1 = (b & 0x0400) != 0;
@@ -218,12 +325,18 @@ bool poll(ControllerState& out) {
namespace xc::input {
bool init() { return true; }
void shutdown() {}
-bool poll(ControllerState& out) {
+bool poll(ControllerState& out) { return pollPad(0, out); }
+bool pollPad(int index, ControllerState& out) {
out = {};
- out.connected = true;
- return true;
+ out.connected = index == 0;
+ return out.connected;
}
-void setRumble(uint8_t, uint8_t, uint32_t) {}
+void refreshPads() {}
+void setRumble(uint8_t, uint8_t, uint32_t, int) {}
+void setTriggerRumble(uint8_t, uint8_t, uint32_t, int) {}
+void setDeadzone(float) {}
+void setCircleConfirms(bool) {}
+void setTriggerRumbleEnabled(bool) {}
} // namespace xc::input
#endif
diff --git a/src/input/controller.h b/src/input/controller.h
index 27b4131..0952f7f 100644
--- a/src/input/controller.h
+++ b/src/input/controller.h
@@ -39,11 +39,30 @@ struct ControllerState {
float triggerR2 = 0.0f;
};
+// Up to four DualSense: pad 0 belongs to the user who started the app, the
+// others to the other signed-in users (each PS5 controller is tied to a
+// user), in the order they appear.
+constexpr int kMaxPads = 4;
+
bool init();
void shutdown();
+// Pad 0 (the menus).
bool poll(ControllerState& out);
+// Any pad; false (and `out` cleared) when there is none at `index`.
+bool pollPad(int index, ControllerState& out);
+// Looks for users who signed in or out since (about once a second).
+void refreshPads();
// Rumble, 0..255 per motor (large = low frequency, small = high frequency),
-// for `durationMs` (0 = until changed). Any thread; poll() applies it.
-void setRumble(uint8_t large, uint8_t small, uint32_t durationMs);
+// for `durationMs` (0 = until changed). Any thread; polling applies it.
+void setRumble(uint8_t large, uint8_t small, uint32_t durationMs, int pad = 0);
+// Vibration in the triggers (Xbox impulse triggers), 0..255 each; the
+// DualSense's adaptive triggers vibrate along their whole travel.
+void setTriggerRumble(uint8_t left, uint8_t right, uint32_t durationMs, int pad = 0);
+// Stick dead zone, 0..0.5 of the travel.
+void setDeadzone(float deadzone);
+// Circle reported as Cross (Xbox A) and Cross as Circle, everywhere.
+void setCircleConfirms(bool on);
+// Off: setTriggerRumble() is ignored.
+void setTriggerRumbleEnabled(bool on);
} // namespace xc::input
diff --git a/src/stream/stream_session.cpp b/src/stream/stream_session.cpp
index 312fe57..1e89181 100644
--- a/src/stream/stream_session.cpp
+++ b/src/stream/stream_session.cpp
@@ -643,6 +643,12 @@ void StreamSession::sendGamepad(const GamepadFrame& frame) {
Impl::sendBinary(impl_->input, gamepadReport(impl_->inputSequence++, impl_->nowMs(), frame));
}
+void StreamSession::setGamepadConnected(int index, bool connected) {
+ if (!impl_->open) return;
+ XC_LOGI("gamepad %d %s", index, connected ? "attached" : "detached");
+ impl_->sendGamepadChanged(index, connected);
+}
+
void StreamSession::requestKeyframe() {
try {
impl_->requestKeyframe();
diff --git a/src/stream/stream_session.h b/src/stream/stream_session.h
index e8aa210..08b0f96 100644
--- a/src/stream/stream_session.h
+++ b/src/stream/stream_session.h
@@ -77,6 +77,8 @@ public:
bool isOpen() const;
void sendGamepad(const GamepadFrame& frame);
+ // A controller at `index` (1..3; 0 is attached at the start) came or went.
+ void setGamepadConnected(int index, bool connected);
void requestKeyframe();
// A frame shown: its timings go back to the server (see FrameMetadata).
void reportFrame(const FrameMetadata& frame);
diff --git a/src/ui/app_ui.cpp b/src/ui/app_ui.cpp
index 304a789..85da72e 100644
--- a/src/ui/app_ui.cpp
+++ b/src/ui/app_ui.cpp
@@ -625,6 +625,12 @@ void AppUi::setSettings(const SettingsChoice& choice) {
dirty_ = true;
}
+void AppUi::setCircleConfirms(bool on) {
+ std::lock_guard<std::mutex> lock(mutex_);
+ circleConfirms_ = on;
+ dirty_ = true;
+}
+
void AppUi::setRegions(std::vector<std::string> regions, const std::string& defaultRegion) {
std::lock_guard<std::mutex> lock(mutex_);
regions_ = std::move(regions);
@@ -644,6 +650,12 @@ std::vector<std::string> AppUi::settingOptions(int row) const {
for (int i = 0; i < static_cast<int>(Language::Count); ++i) out.push_back(languageName(static_cast<Language>(i)));
} else if (row == 1) {
out = {tr(Str::Res720), tr(Str::Res1080), tr(Str::Res1440)}; // kResolutionOrder
+ } else if (row == 3) {
+ for (int p : kDeadzonePercent) out.push_back(std::to_string(p) + " %");
+ } else if (row == 4) {
+ out = {tr(Str::Activated), tr(Str::Deactivated)};
+ } else if (row == 5) {
+ out = {tr(Str::ButtonCross), tr(Str::ButtonCircle)};
} else {
// Automatic first, then the regions in the login's order.
out.push_back(withMs(trf(Str::RegionAuto, defaultRegion_.empty() ? "-" : prettyRegion(defaultRegion_)),
@@ -659,6 +671,9 @@ int AppUi::settingSelected(int row) const {
if (row == 1)
for (int i = 0; i < 3; ++i)
if (kResolutionOrder[i] == settings_.resolution) return i;
+ if (row == 3) return settings_.deadzone;
+ if (row == 4) return settings_.triggerRumble ? 0 : 1;
+ if (row == 5) return settings_.circleConfirms ? 1 : 0;
for (size_t i = 0; i < regions_.size(); ++i)
if (regions_[i] == settings_.region) return static_cast<int>(i) + 1;
return 0;
@@ -671,6 +686,12 @@ 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) {
+ settings_.deadzone = index;
+ } else if (row == 4) {
+ settings_.triggerRumble = index == 0;
+ } else if (row == 5) {
+ settings_.circleConfirms = index == 1;
} else {
settings_.region = index == 0 ? std::string() : regions_[static_cast<size_t>(index - 1)];
}
@@ -987,7 +1008,7 @@ UiEvent AppUi::handle(const NavInput& in) {
dirty_ = true;
break;
}
- if (in.down && settingsRow_ < 2) ++settingsRow_, dirty_ = true;
+ if (in.down && settingsRow_ < kSettingRows - 1) ++settingsRow_, dirty_ = true;
if (in.up && settingsRow_ > 0) --settingsRow_, dirty_ = true;
if (in.right) changeSetting(+1);
if (in.left) changeSetting(-1);
@@ -1086,38 +1107,43 @@ void AppUi::drawHints(Canvas& c, const std::vector<std::pair<int, const char*>>&
int x = kW - kMargin;
const int y = kH - 64;
for (auto it = hints.rbegin(); it != hints.rend(); ++it) {
+ // With Circle confirming, the pad reports it as Cross (and the
+ // other way round): the hints show the button to press.
+ int icon = it->first;
+ if (circleConfirms_ && (icon == kIconCross || icon == kIconCircle))
+ icon = icon == kIconCross ? kIconCircle : kIconCross;
int w = fonts_.semibold.measure(it->second, kPx);
x -= w;
fonts_.semibold.draw(c, it->second, x, y, kPx, kGray);
x -= 10 + 2 * kR;
float cx = x + kR, cy = y + 13;
- if (it->first == kIconL2R2) {
+ if (icon == kIconL2R2) {
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.centeredY(pill.y, pill.h, 14), 14, kGray);
x -= 34;
- } else if (it->first == kIconR3) {
+ } else if (icon == kIconR3) {
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.centeredY(pill.y, pill.h, 14), 14, kGray);
- } else if (it->first == kIconTouchpad) {
+ } 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);
c.strokeRect(pad, kGray, 2, 6);
x -= 10;
- } else if (it->first == kIconOptions) {
+ } else if (icon == kIconOptions) {
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 (it->first == kIconCross) {
+ 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 (it->first == kIconCircle) {
+ } else if (icon == kIconCircle) {
c.strokeArc(cx, cy, 6.5f, 2.5f, 0, 6.2832f, rgba(255, 102, 102));
- } else if (it->first == kIconSquare) {
+ } 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));
@@ -1711,11 +1737,12 @@ void AppUi::drawSettings(Canvas& c) {
drawBackground(c);
drawTopBar(c);
fonts_.bold.draw(c, tr(Str::Settings), kMargin, 170, 60, kWhite);
- const char* labels[3] = {tr(Str::Language), tr(Str::Resolution), tr(Str::Region)};
- constexpr int kRowW = 1200, kRowH = 92;
- Rect rows[3];
- int y = 290;
- for (int i = 0; i < 3; ++i) {
+ const char* labels[kSettingRows] = {tr(Str::Language), tr(Str::Resolution), tr(Str::Region),
+ tr(Str::Deadzone), tr(Str::TriggerRumble), tr(Str::ConfirmButton)};
+ constexpr int kRowW = 1200, kRowH = 76;
+ Rect rows[kSettingRows];
+ int y = 270;
+ for (int i = 0; i < kSettingRows; ++i) {
Rect r{kMargin, y, kRowW, kRowH};
rows[i] = r;
bool focused = i == settingsRow_;
@@ -1733,7 +1760,7 @@ void AppUi::drawSettings(Canvas& c) {
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);
- y += kRowH + 22;
+ y += kRowH + 16;
}
for (const auto& line : fonts_.regular.wrap(tr(Str::SettingsNote), 24, kRowW, 2)) {
fonts_.regular.draw(c, line, kMargin, y + 20, 24, kDim);
diff --git a/src/ui/app_ui.h b/src/ui/app_ui.h
index 6a6bb79..b4e4a40 100644
--- a/src/ui/app_ui.h
+++ b/src/ui/app_ui.h
@@ -67,8 +67,15 @@ struct SettingsChoice {
int language = 0; // ui::Language
int resolution = 0; // 0 = 1080p, 1 = 720p, 2 = 1440p (experimental)
std::string region; // gssv region name; empty = automatic
+ int deadzone = 3; // index into kDeadzonePercent (15 %)
+ bool triggerRumble = true;
+ bool circleConfirms = false; // Circle is Xbox A (and Cross is B)
};
+// The stick dead zones Settings offers, in percent of the travel.
+constexpr int kDeadzonePercent[] = {0, 5, 10, 15, 20, 25};
+constexpr int kSettingRows = 6; // language, resolution, region, dead zone, triggers, confirm
+
enum class Action { None, Play, SignOut, Retry, CancelLaunch, SettingsChanged, PrefsChanged };
// How "Your games" is sorted (R3).
@@ -137,6 +144,9 @@ public:
void showStreaming();
void showError(const std::string& message);
void setSettings(const SettingsChoice& choice);
+ // The confirm button in force (the hints show it); Settings may be
+ // showing another choice not saved yet.
+ void setCircleConfirms(bool on);
// 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);
@@ -256,6 +266,7 @@ private:
GameTile launching_;
std::string error_;
SettingsChoice settings_;
+ bool circleConfirms_ = false;
std::vector<std::string> regions_;
std::string defaultRegion_;
std::map<std::string, int> regionMs_;
diff --git a/src/ui/stream_menu.cpp b/src/ui/stream_menu.cpp
index 0f8879e..7f4bfea 100644
--- a/src/ui/stream_menu.cpp
+++ b/src/ui/stream_menu.cpp
@@ -136,14 +136,21 @@ Canvas StreamMenu::renderMenu(const StreamInfo& info) const {
line(Str::StatLoss, fmt("%.1f %%", info.lossPct));
line(Str::StatDecode, info.decodeMs > 0 ? fmt("%.1f ms", info.decodeMs) : none);
- // Cross selects, Circle goes back to the game.
+ // Cross selects, Circle goes back to the game (swapped with Circle
+ // confirming).
int hy = kMenuH - 56, x = kPad;
- c.fillCircle(x + 14, hy + 13, 14, rgba(255, 255, 255, 40));
- c.line(x + 8, hy + 7, x + 20, hy + 19, 2.5f, rgba(124, 178, 232));
- c.line(x + 20, hy + 7, x + 8, hy + 19, 2.5f, rgba(124, 178, 232));
+ auto icon = [&](bool cross) {
+ c.fillCircle(x + 14, hy + 13, 14, rgba(255, 255, 255, 40));
+ if (cross) {
+ c.line(x + 8, hy + 7, x + 20, hy + 19, 2.5f, rgba(124, 178, 232));
+ c.line(x + 20, hy + 7, x + 8, hy + 19, 2.5f, rgba(124, 178, 232));
+ } else {
+ c.strokeArc(x + 14, hy + 13, 6.5f, 2.5f, 0, 6.2832f, rgba(255, 102, 102));
+ }
+ };
+ icon(!circleConfirms_);
x = fonts_.semibold.draw(c, tr(Str::Select), x + 38, hy, 22, kGray) + 36;
- c.fillCircle(x + 14, hy + 13, 14, rgba(255, 255, 255, 40));
- c.strokeArc(x + 14, hy + 13, 6.5f, 2.5f, 0, 6.2832f, rgba(255, 102, 102));
+ icon(circleConfirms_);
fonts_.semibold.draw(c, tr(Str::Back), x + 38, hy, 22, kGray);
return c;
}
diff --git a/src/ui/stream_menu.h b/src/ui/stream_menu.h
index 0eef59f..50a3391 100644
--- a/src/ui/stream_menu.h
+++ b/src/ui/stream_menu.h
@@ -40,6 +40,8 @@ public:
int resolution() const { return resolution_; }
bool statsOn() const { return stats_; }
int sharpness() const { return sharpness_; }
+ // Circle confirms: the hints swap their buttons.
+ void setCircleConfirms(bool on) { circleConfirms_ = on; }
Canvas renderMenu(const StreamInfo& info) const;
Canvas renderStats(const StreamInfo& info) const;
@@ -53,6 +55,7 @@ private:
int resolution_ = 0, applied_ = 0;
int sharpness_ = 0;
bool resolutionAsked_ = false;
+ bool circleConfirms_ = false;
};
} // namespace xc::ui
diff --git a/src/ui/strings.cpp b/src/ui/strings.cpp
index e785bab..041ee71 100644
--- a/src/ui/strings.cpp
+++ b/src/ui/strings.cpp
@@ -134,6 +134,14 @@ constexpr Column kEnglish = {
"Low", // SharpLow
"Medium", // SharpMedium
"High", // SharpHigh
+ "Stick dead zone", // Deadzone
+ "Trigger vibration", // TriggerRumble
+ "Confirm button", // ConfirmButton
+ "On", // Activated
+ "Off", // Deactivated
+ "Cross", // ButtonCross
+ "Circle", // ButtonCircle
+ "PSBox Cloud Gaming %s is out: get it on GitHub (RafaelNGP/xbox-cloud-gaming-ps5)",// UpdateAvailable
};
constexpr Column kPortugueseBR = {
@@ -238,6 +246,14 @@ constexpr Column kPortugueseBR = {
"Baixa",
"Média",
"Alta",
+ "Zona morta do analógico",
+ "Vibração nos gatilhos",
+ "Botão de confirmar",
+ "Ativada",
+ "Desativada",
+ "Xis",
+ "Círculo",
+ "Saiu o PSBox Cloud Gaming %s: baixe no GitHub (RafaelNGP/xbox-cloud-gaming-ps5)",
};
constexpr Column kSpanish = {
@@ -342,6 +358,14 @@ constexpr Column kSpanish = {
"Baja",
"Media",
"Alta",
+ "Zona muerta del stick",
+ "Vibración en los gatillos",
+ "Botón de confirmar",
+ "Activada",
+ "Desactivada",
+ "Equis",
+ "Círculo",
+ "Ya está disponible PSBox Cloud Gaming %s: descárgalo en GitHub (RafaelNGP/xbox-cloud-gaming-ps5)",
};
constexpr Column kFrench = {
@@ -446,6 +470,14 @@ constexpr Column kFrench = {
"Faible",
"Moyenne",
"Élevée",
+ "Zone morte du stick",
+ "Vibration des gâchettes",
+ "Bouton de validation",
+ "Activée",
+ "Désactivée",
+ "Croix",
+ "Rond",
+ "PSBox Cloud Gaming %s est disponible : téléchargez-le sur GitHub (RafaelNGP/xbox-cloud-gaming-ps5)",
};
constexpr Column kGerman = {
@@ -550,6 +582,14 @@ constexpr Column kGerman = {
"Niedrig",
"Mittel",
"Hoch",
+ "Stick-Totzone",
+ "Trigger-Vibration",
+ "Bestätigungstaste",
+ "An",
+ "Aus",
+ "Kreuz",
+ "Kreis",
+ "PSBox Cloud Gaming %s ist da: auf GitHub herunterladen (RafaelNGP/xbox-cloud-gaming-ps5)",
};
constexpr Column kItalian = {
@@ -654,6 +694,14 @@ constexpr Column kItalian = {
"Bassa",
"Media",
"Alta",
+ "Zona morta dello stick",
+ "Vibrazione dei grilletti",
+ "Tasto di conferma",
+ "Attivata",
+ "Disattivata",
+ "Croce",
+ "Cerchio",
+ "È disponibile PSBox Cloud Gaming %s: scaricalo da GitHub (RafaelNGP/xbox-cloud-gaming-ps5)",
};
constexpr std::array<const Column*, kLangs> kTable = {&kEnglish, &kPortugueseBR, &kSpanish,
diff --git a/src/ui/strings.h b/src/ui/strings.h
index 10872c0..176ec26 100644
--- a/src/ui/strings.h
+++ b/src/ui/strings.h
@@ -111,6 +111,14 @@ enum class Str {
SharpLow,
SharpMedium,
SharpHigh,
+ Deadzone, // settings: stick dead zone
+ TriggerRumble, // settings: vibration in the triggers
+ ConfirmButton, // settings: which button is Xbox A
+ Activated, // feminine on/off where the language needs it
+ Deactivated,
+ ButtonCross,
+ ButtonCircle,
+ UpdateAvailable, // "%s" = the new version
Count
};
diff --git a/tests/test_main.cpp b/tests/test_main.cpp
index 95904dd..580f370 100644
--- a/tests/test_main.cpp
+++ b/tests/test_main.cpp
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright (C) 2026 RafaelNGP
// Offline unit tests for the portable core (no network).
+#include "app/update_check.h"
#include "net/http.h"
#include "stream/input_packet.h"
#include "stream/stream_session.h"
@@ -181,6 +182,17 @@ static void testPrices() {
CHECK(formatPrice(4, "XYZ") == "XYZ 4.00");
}
+static void testVersions() {
+ using xc::app::isNewerVersion;
+ CHECK(isNewerVersion("v0.4.0", "0.3.0"));
+ CHECK(isNewerVersion("v0.3.1", "0.3.0"));
+ CHECK(isNewerVersion("1.0", "0.9.9"));
+ CHECK(!isNewerVersion("v0.3.0", "0.3.0"));
+ CHECK(!isNewerVersion("v0.2.9", "0.3.0"));
+ CHECK(!isNewerVersion("nightly", "0.3.0"));
+ CHECK(!isNewerVersion("", "0.3.0"));
+}
+
static void testStreamMenu() {
using xc::ui::MenuAction;
xc::ui::Fonts fonts; // not loaded: handle() never draws
@@ -213,6 +225,7 @@ static void testStreamMenu() {
}
int main() {
+ testVersions();
testStreamMenu();
testStrings();
testRegions();