Skip to content

Xbox Cloud Gaming app for PS5 Homebrew

C

feat(input): DualSense Smart Trigger profiles and audio-to-haptics

Rafael Abud Ferreira60ba8ffeb80e
diff --git a/src/app/app_core.cpp b/src/app/app_core.cpp
index 568f2ad..e5a1fb6 100644
--- a/src/app/app_core.cpp
+++ b/src/app/app_core.cpp
@@ -238,6 +238,7 @@ ui::UiCaps uiCaps() {
bool coreStartup() {
platform::init();
+ platform::setThreadAffinity(platform::ThreadRole::Main, "xcloud_main");
log::setFile((platform::dataDir() + "/xcloud.log").c_str());
if (!platform::dataDirNote().empty())
XC_LOGI("data folder %s: %s", platform::dataDir().c_str(), platform::dataDirNote().c_str());
@@ -625,12 +626,12 @@ bool Core::frame() {
streamScreen->idle();
ui::UiEvent ev = g_ui->handle(nav);
- int strength, hz, resistance;
+ int strength, hz, resistance, profile = 0;
bool pulses;
- if (g_ui->settingsTriggerFeel(strength, hz, resistance, pulses)) {
+ if (g_ui->settingsTriggerFeel(strength, hz, resistance, pulses, profile)) {
// Settings: the triggers' feel as chosen there, at once; their
// tester makes them vibrate as far as they are pressed.
- input::setTriggerFeel(strength, hz, resistance, pulses);
+ input::setTriggerFeel(strength, hz, resistance, pulses, profile);
float l2, r2;
static bool testing = false;
input::setTriggerLogging(g_ui->triggerTest(l2, r2));
diff --git a/src/app/settings.cpp b/src/app/settings.cpp
index 0d1ab47..95e4f7d 100644
--- a/src/app/settings.cpp
+++ b/src/app/settings.cpp
@@ -74,6 +74,7 @@ bool Settings::load(const std::string& path) {
triggerHz = static_cast<int>(std::clamp<int64_t>((*j)["triggerHz"].asInt(triggerHz), 0, 2));
triggerResistance = static_cast<int>(std::clamp<int64_t>((*j)["triggerResistance"].asInt(0), 0, 3));
triggerPulses = (*j)["triggerPulses"].asBool(false);
+ triggerProfile = static_cast<int>(std::clamp<int64_t>((*j)["triggerProfile"].asInt(0), 0, 2));
circleConfirms = (*j)["circleConfirms"].asBool(circleConfirms);
// "lightBar" (on/off) until the colour could be chosen.
lightBarMode = (*j)["lightBar"].asBool(true) ? 0 : 2;
@@ -130,6 +131,7 @@ bool Settings::load(const std::string& path) {
p.triggerHz = static_cast<int>(std::clamp<int64_t>(obj["triggerHz"].asInt(triggerHz), 0, 2));
p.triggerResistance = static_cast<int>(std::clamp<int64_t>(obj["triggerResistance"].asInt(triggerResistance), 0, 3));
p.triggerPulses = obj["triggerPulses"].asBool(triggerPulses);
+ p.triggerProfile = static_cast<int>(std::clamp<int64_t>(obj["triggerProfile"].asInt(triggerProfile), 0, 2));
p.circleConfirms = obj["circleConfirms"].asBool(circleConfirms);
p.highRefresh = obj["highRefresh"].asBool(highRefresh);
p.keyMap = readKeyMap(obj["keyMap"], keyMap);
@@ -160,6 +162,7 @@ GameProfile Settings::defaultProfile() const {
p.triggerHz = triggerHz;
p.triggerResistance = triggerResistance;
p.triggerPulses = triggerPulses;
+ p.triggerProfile = triggerProfile;
p.circleConfirms = circleConfirms;
p.highRefresh = highRefresh;
p.keyMap = keyMap;
@@ -215,6 +218,7 @@ bool Settings::save(const std::string& path) const {
v.set("triggerHz", triggerHz);
v.set("triggerResistance", triggerResistance);
v.set("triggerPulses", triggerPulses);
+ v.set("triggerProfile", triggerProfile);
v.set("circleConfirms", circleConfirms);
v.set("lightBarMode", lightBarMode);
char hex[8];
@@ -253,6 +257,7 @@ bool Settings::save(const std::string& path) const {
obj.set("triggerHz", p.triggerHz);
obj.set("triggerResistance", p.triggerResistance);
obj.set("triggerPulses", p.triggerPulses);
+ obj.set("triggerProfile", p.triggerProfile);
obj.set("circleConfirms", p.circleConfirms);
obj.set("highRefresh", p.highRefresh);
obj.set("keyMap", keyMapJson(p.keyMap));
diff --git a/src/app/settings.h b/src/app/settings.h
index 83c0235..f1dde1a 100644
--- a/src/app/settings.h
+++ b/src/app/settings.h
@@ -25,6 +25,7 @@ struct GameProfile {
int triggerHz = 1; // 0..2
int triggerResistance = 0; // 0 off .. 3 strong
bool triggerPulses = false;
+ int triggerProfile = 0; // 0 Standard, 1 Shooter, 2 Racing
bool circleConfirms = false;
// Display
bool highRefresh = false; // 120 Hz output (VRR) while streaming
@@ -78,6 +79,7 @@ struct Settings {
int triggerHz = 1;
int triggerResistance = 0; // 0 off .. 3 strong (the triggers' weight)
bool triggerPulses = false; // pulses of the resistance instead of the motor vibrating
+ int triggerProfile = 0; // 0 Standard, 1 Shooter, 2 Racing
bool circleConfirms = false;
// The DualSense light bar: 0 the colour of the game in focus, 1
// lightBarColour, 2 off.
diff --git a/src/input/controller.h b/src/input/controller.h
index d5b4885..72fa9a8 100644
--- a/src/input/controller.h
+++ b/src/input/controller.h
@@ -80,6 +80,8 @@ std::string padDeviceName(int index);
// Rumble, 0..255 per motor (large = low frequency, small = high frequency),
// for `durationMs` (0 = until changed). Any thread; polling applies it.
void setRumble(uint8_t large, uint8_t small, uint32_t durationMs, int pad = 0);
+// Sub-bass audio-to-haptics pulse (when no active game rumble is running)
+void setAudioHaptics(uint8_t kick, uint32_t durationMs = 60, 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);
@@ -93,8 +95,10 @@ bool circleConfirms();
// How the triggers feel (input/tuning.h): vibration strength 0 (off:
// setTriggerRumble() is ignored) to kTriggerStrengths - 1, the frequency
// choice (index), the resistance (weight) and the style (pulses of the
-// resistance instead of the motor vibrating).
-void setTriggerFeel(int strength, int hzIndex, int resistance, bool pulses);
+// resistance instead of the motor vibrating). Profile: 0 Standard, 1 Shooter, 2 Racing.
+void setTriggerFeel(int strength, int hzIndex, int resistance, bool pulses, int profile = 0);
+void setTriggerProfile(int profile);
+int triggerProfile();
// Logs each time a trigger starts or stops vibrating (the Settings tester).
void setTriggerLogging(bool on);
// The resistance (setTriggerFeel) only weighs the triggers while this is on:
diff --git a/src/input/controller_common.cpp b/src/input/controller_common.cpp
index 1959a9d..d606bdc 100644
--- a/src/input/controller_common.cpp
+++ b/src/input/controller_common.cpp
@@ -82,6 +82,7 @@ std::atomic<float> g_deadzone[2] = {0.15f, 0.15f};
std::atomic<bool> g_circleConfirms{false};
std::atomic<int> g_triggerStrength{kTriggerMedium}, g_triggerHz{1}, g_triggerResistance{0};
std::atomic<bool> g_triggerPulses{false}, g_triggerLogging{false}, g_resistanceActive{false};
+std::atomic<int> g_triggerProfile{kTriggerProfileStandard};
std::atomic<int> g_gyroMode{kGyroOff}, g_gyroLevel{5};
std::atomic<bool> g_gyroActive{false};
int g_gyroLogged = 0, g_gyroLoggedX = 0; // the first turns up / down and sideways, to check the axes
@@ -142,9 +143,10 @@ void applyRumble(int index, Pad& pad) {
const uint8_t level[2] = {static_cast<uint8_t>(v >> 8), static_cast<uint8_t>(v)};
int strength = g_triggerStrength, hz = g_triggerHz, resistance = g_resistanceActive ? g_triggerResistance.load() : 0;
bool pulses = g_triggerPulses;
+ int profile = g_resistanceActive ? g_triggerProfile.load() : kTriggerProfileStandard;
uint64_t now = platform::nowMs();
TriggerCommand want[2];
- for (int t = 0; t < 2; ++t) want[t] = triggerCommand(level[t], strength, hz, resistance, pulses, now);
+ for (int t = 0; t < 2; ++t) want[t] = triggerCommand(t, level[t], strength, hz, resistance, pulses, profile, now);
if (pad.triggerFresh && want[0] == pad.triggerSent[0] && want[1] == pad.triggerSent[1]) return;
int rc = backend::setTriggerEffects(index, want);
static int failures = 0; // a refused effect is sent again each poll: logged a few times
@@ -192,6 +194,15 @@ 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 setAudioHaptics(uint8_t kick, uint32_t durationMs, int pad) {
+ if (pad >= 0 && pad < kMaxPads && kick > 0) {
+ Pad& p = g_pads[pad];
+ if (p.motors.current() == 0) {
+ p.motors.set(kick, 0, durationMs);
+ }
+ }
+}
+
void setTriggerRumble(uint8_t left, uint8_t right, uint32_t durationMs, int pad) {
if (g_triggerStrength <= 0) left = right = 0;
if (pad >= 0 && pad < kMaxPads) g_pads[pad].triggers.set(left, right, durationMs);
@@ -210,16 +221,25 @@ void resetLightBar(int pad) {
bool padConnected(int index) { return index >= 0 && index < kMaxPads && g_pads[index].connected; }
-void setTriggerFeel(int strength, int hzIndex, int resistance, bool pulses) {
+void setTriggerFeel(int strength, int hzIndex, int resistance, bool pulses, int profile) {
g_triggerStrength = std::clamp(strength, 0, kTriggerStrengths - 1);
g_triggerHz = std::clamp(hzIndex, 0, 2);
g_triggerResistance = std::clamp(resistance, 0, kTriggerResistances - 1);
g_triggerPulses = pulses;
+ g_triggerProfile = std::clamp(profile, 0, kTriggerProfiles - 1);
if (!g_triggerStrength)
for (Pad& p : g_pads) p.triggers.set(0, 0, 0);
// The next poll works the triggers out in the new feel.
}
+void setTriggerProfile(int profile) {
+ g_triggerProfile = std::clamp(profile, 0, kTriggerProfiles - 1);
+}
+
+int triggerProfile() {
+ return g_triggerProfile.load();
+}
+
void setTriggerLogging(bool on) { g_triggerLogging = on; }
void setTriggerResistanceActive(bool on) { g_resistanceActive = on; }
diff --git a/src/input/tuning.h b/src/input/tuning.h
index d089c96..b4517f7 100644
--- a/src/input/tuning.h
+++ b/src/input/tuning.h
@@ -77,13 +77,80 @@ struct TriggerCommand {
// second, so the push / release can't go faster than this.
constexpr int kTriggerPulseHz[] = {10, 20, 30};
+// Trigger feel profiles:
+// 0: Standard (user vibration, frequency, resistance, and pulses)
+// 1: Shooter (L2 Hair Trigger instant aim snap, R2 Weapon Trigger Break wall)
+// 2: Racing (L2 Hydraulic ABS brake lockup pulses, R2 Progressive Throttle)
+constexpr int kTriggerProfileStandard = 0;
+constexpr int kTriggerProfileShooter = 1;
+constexpr int kTriggerProfileRacing = 2;
+constexpr int kTriggerProfiles = 3;
+
// One trigger at a moment: `level` the game's request (0..255), and the
// user's strength, frequency choice (index), resistance, and style: the
// motor vibrating (resistance gone while it does), or pulses of the
// resistance itself (pushing harder and letting go at kTriggerPulseHz),
// which keep the weight.
-inline TriggerCommand triggerCommand(uint8_t level, int strength, int hzIndex, int resistance, bool pulses, uint64_t nowMs) {
- // Resistance: where it starts (0..9) and how hard (0..8).
+inline TriggerCommand triggerCommand(int triggerIndex, uint8_t level, int strength, int hzIndex, int resistance, bool pulses, int profile, uint64_t nowMs) {
+ if (profile == kTriggerProfileShooter) {
+ TriggerCommand c;
+ uint8_t amplitude = triggerAmplitude(level, strength);
+ if (triggerIndex == 0) {
+ // L2 (Aim Down Sight): Hair Trigger snap with instant light resistance at position 1
+ if (amplitude) {
+ c.mode = 3;
+ c.data[1] = amplitude;
+ c.data[2] = static_cast<uint8_t>(kTriggerHz[hzIndex]);
+ } else {
+ c.mode = 1;
+ c.data[0] = 1; // start position 1
+ c.data[1] = 2; // force 2 (light aim wall)
+ }
+ } else {
+ // R2 (Weapon Trigger): Mechanical Trigger Break wall at position 2
+ if (amplitude) {
+ c.mode = 3;
+ c.data[1] = std::max<uint8_t>(amplitude, 6);
+ c.data[2] = 60; // 60 Hz weapon recoil
+ } else {
+ c.mode = 1;
+ c.data[0] = 2; // start position 2
+ c.data[1] = 5; // force 5 (firm trigger wall)
+ }
+ }
+ return c;
+ }
+ if (profile == kTriggerProfileRacing) {
+ TriggerCommand c;
+ uint8_t amplitude = triggerAmplitude(level, strength);
+ if (triggerIndex == 0) {
+ // L2 (Brake Pedal): ABS Hydraulic Pulsing when braking hard (level > 0)
+ if (amplitude || level > 30) {
+ bool push = (nowMs * 25 * 2 / 1000) % 2 == 0;
+ c.mode = 1;
+ c.data[0] = 1;
+ c.data[1] = push ? 7 : 2; // ABS rapid kickback
+ } else {
+ c.mode = 1;
+ c.data[0] = 2;
+ c.data[1] = 3; // moderate brake resistance
+ }
+ } else {
+ // R2 (Gas / Throttle): Smooth progressive throttle resistance
+ if (amplitude) {
+ c.mode = 3;
+ c.data[1] = amplitude;
+ c.data[2] = 60; // traction loss vibration
+ } else {
+ c.mode = 1;
+ c.data[0] = 1;
+ c.data[1] = 3; // throttle resistance
+ }
+ }
+ return c;
+ }
+
+ // Standard profile
static constexpr uint8_t kFeedback[kTriggerResistances][2] = {{0, 0}, {4, 2}, {3, 4}, {2, 6}};
static constexpr uint8_t kBase[kTriggerResistances] = {0, 2, 3, 4};
resistance = std::clamp(resistance, 0, kTriggerResistances - 1);
@@ -105,4 +172,8 @@ inline TriggerCommand triggerCommand(uint8_t level, int strength, int hzIndex, i
return c;
}
+inline TriggerCommand triggerCommand(uint8_t level, int strength, int hzIndex, int resistance, bool pulses, uint64_t nowMs) {
+ return triggerCommand(0, level, strength, hzIndex, resistance, pulses, kTriggerProfileStandard, nowMs);
+}
+
} // namespace xc::input
diff --git a/src/media/audio_out_ps5.cpp b/src/media/audio_out_ps5.cpp
index 6e08f88..6a98031 100644
--- a/src/media/audio_out_ps5.cpp
+++ b/src/media/audio_out_ps5.cpp
@@ -6,9 +6,12 @@
// elsewhere.
#include "media/audio_out.h"
+#include "input/controller.h"
#include "media/audio_queue.h"
+#include "platform/platform.h"
#include "util/log.h"
+#include <algorithm>
#include <atomic>
#include <chrono>
#include <thread>
@@ -33,8 +36,11 @@ std::thread g_thread;
int g_handle = -1;
void loop() {
+ platform::setThreadAffinity(platform::ThreadRole::Audio, "ps5_audio_out");
+ platform::setThreadRealtimePriority();
std::vector<float> grain(kGrain * 2);
AudioQueue& queue = audioQueue();
+ float lowPass = 0.0f;
while (g_running) {
queue.pull(grain.data(), kGrain); // silence past what is queued
int h = g_handle;
@@ -42,6 +48,20 @@ void loop() {
std::this_thread::sleep_for(std::chrono::milliseconds(5));
continue;
}
+
+ // Audio-to-Haptics: detect deep sub-bass impacts (cutoff ~100 Hz at 48 kHz)
+ float energy = 0.0f;
+ for (unsigned i = 0; i < kGrain; ++i) {
+ float mono = 0.5f * (grain[i * 2] + grain[i * 2 + 1]);
+ lowPass += 0.013f * (mono - lowPass);
+ energy += lowPass * lowPass;
+ }
+ energy /= static_cast<float>(kGrain);
+ if (energy > 0.06f) {
+ uint8_t kick = static_cast<uint8_t>(std::clamp((energy - 0.06f) * 1400.0f, 40.0f, 180.0f));
+ input::setAudioHaptics(kick, 60);
+ }
+
// Blocks until the hardware wants the next grain (5.3 ms).
int rc = sceAudioOutOutput(h, grain.data());
if (rc < 0) {
diff --git a/src/ui/app_ui.cpp b/src/ui/app_ui.cpp
index 36b6999..9d99c32 100644
--- a/src/ui/app_ui.cpp
+++ b/src/ui/app_ui.cpp
@@ -1063,13 +1063,14 @@ bool AppUi::settingsLightBar(int& mode, Color& colour) const {
return true;
}
-bool AppUi::settingsTriggerFeel(int& strength, int& hzIndex, int& resistance, bool& pulses) const {
+bool AppUi::settingsTriggerFeel(int& strength, int& hzIndex, int& resistance, bool& pulses, int& profile) const {
std::lock_guard<std::mutex> lock(mutex_);
if (screen_ != Screen::Settings && !gameSettingsOpen_) return false;
strength = settings_.triggerStrength;
hzIndex = settings_.triggerHz;
resistance = settings_.triggerResistance;
pulses = settings_.triggerPulses;
+ profile = settings_.triggerProfile;
return true;
}
@@ -1242,6 +1243,7 @@ void AppUi::handleTester(const NavInput& in) {
if (delta && testerRow_ == 2)
settings_.triggerResistance = std::clamp(settings_.triggerResistance + delta, 0, input::kTriggerResistances - 1);
if (delta && testerRow_ == 3) settings_.triggerPulses = !settings_.triggerPulses;
+ if (delta && testerRow_ == 4) settings_.triggerProfile = std::clamp(settings_.triggerProfile + delta, 0, input::kTriggerProfiles - 1);
if (delta) dirty_ = true;
if (in.l2Analog != testL2_ || in.r2Analog != testR2_) testL2_ = in.l2Analog, testR2_ = in.r2Analog, dirty_ = true;
}
@@ -1249,6 +1251,7 @@ void AppUi::handleTester(const NavInput& in) {
settings_.deadzone[0] = testerBackup_.deadzone[0], settings_.deadzone[1] = testerBackup_.deadzone[1];
settings_.triggerStrength = testerBackup_.triggerStrength, settings_.triggerHz = testerBackup_.triggerHz;
settings_.triggerResistance = testerBackup_.triggerResistance, settings_.triggerPulses = testerBackup_.triggerPulses;
+ settings_.triggerProfile = testerBackup_.triggerProfile;
}
if (in.accept || in.back) {
if (gameSettingsOpen_) {
@@ -1259,6 +1262,7 @@ void AppUi::handleTester(const NavInput& in) {
activeGameProfile_.triggerHz = settings_.triggerHz;
activeGameProfile_.triggerResistance = settings_.triggerResistance;
activeGameProfile_.triggerPulses = settings_.triggerPulses;
+ activeGameProfile_.triggerProfile = settings_.triggerProfile;
activeGameHasCustom_ = true;
}
settings_ = testerBackup_;
@@ -2378,6 +2382,7 @@ void AppUi::handleGameSettings(const NavInput& in, UiEvent& ev) {
settings_.triggerHz = activeGameProfile_.triggerHz;
settings_.triggerResistance = activeGameProfile_.triggerResistance;
settings_.triggerPulses = activeGameProfile_.triggerPulses;
+ settings_.triggerProfile = activeGameProfile_.triggerProfile;
testerRow_ = 0;
dirty_ = true;
break;
@@ -2437,6 +2442,7 @@ void AppUi::handleGameSettings(const NavInput& in, UiEvent& ev) {
activeGameProfile_.triggerHz = settings_.triggerHz;
activeGameProfile_.triggerResistance = settings_.triggerResistance;
activeGameProfile_.triggerPulses = settings_.triggerPulses;
+ activeGameProfile_.triggerProfile = settings_.triggerProfile;
activeGameProfile_.circleConfirms = settings_.circleConfirms;
activeGameProfile_.highRefresh = settings_.highRefresh;
activeGameProfile_.gyroMode = gyroMode_;
@@ -4083,21 +4089,24 @@ void AppUi::drawStickTester(Canvas& c) {
}
void AppUi::drawTriggerTester(Canvas& c) {
- // Without adaptive triggers, no resistance or style rows: the panel shorter by them.
- const int rows = triggerTesterRows(), lessY = (4 - rows) * 84;
- Rect panel = drawModal(c, 1100, 830 - lessY, tr(Str::TriggerRumble));
- // The two choices, as Settings' rows: up / down picks one, left / right changes it.
+ // Without adaptive triggers, no resistance, style or profile rows: the panel shorter by them.
+ const int rows = triggerTesterRows(), lessY = (5 - rows) * 84;
+ Rect panel = drawModal(c, 1100, 890 - lessY, tr(Str::TriggerRumble));
+ // The choices, as Settings' rows: up / down picks one, left / right changes it.
const char* strengths[] = {tr(Str::Deactivated), tr(Str::TriggerLight), tr(Str::TriggerMedium), tr(Str::TriggerStrong),
tr(Str::TriggerMax)};
const char* freqs[] = {tr(Str::FrequencyLow), tr(Str::TriggerMedium), tr(Str::FrequencyHigh)};
+ static constexpr Str kProfileStrs[] = {Str::TriggerProfileStd, Str::TriggerProfileShooter, Str::TriggerProfileRacing};
const char* labels[] = {tr(Str::TriggerIntensity), tr(Str::TriggerFrequency), tr(Str::TriggerResistance),
- tr(Str::TriggerStyle)};
+ tr(Str::TriggerStyle), tr(Str::TriggerProfile)};
// Pulses go at their own, slower rates.
int hz = settings_.triggerPulses ? input::kTriggerPulseHz[settings_.triggerHz] : input::kTriggerHz[settings_.triggerHz];
+ int prof = std::clamp(settings_.triggerProfile, 0, 2);
const std::string values[] = {strengths[settings_.triggerStrength],
std::string(freqs[settings_.triggerHz]) + " (" + std::to_string(hz) + " Hz)",
strengths[settings_.triggerResistance], // off, light, medium, strong
- tr(settings_.triggerPulses ? Str::StylePulses : Str::StyleVibration)};
+ tr(settings_.triggerPulses ? Str::StylePulses : Str::StyleVibration),
+ tr(kProfileStrs[prof])};
for (int i = 0; i < rows; ++i) {
Rect r{panel.x + 56, panel.y + 120 + i * 84, panel.w - 112, 70};
bool on = i == testerRow_;
@@ -4111,8 +4120,8 @@ void AppUi::drawTriggerTester(Canvas& c) {
// L2 and R2: how far each is pressed, and the level it sends to the trigger.
const float pressed[2] = {testL2_, testR2_};
for (int t = 0; t < 2; ++t) {
- constexpr int kBarW = 90, kBarH = 170;
- int bx = panel.x + panel.w / 2 + (t ? 80 : -80 - kBarW), by = panel.y + 490 - lessY;
+ constexpr int kBarW = 90, kBarH = 150;
+ int bx = panel.x + panel.w / 2 + (t ? 80 : -80 - kBarW), by = panel.y + 560 - lessY;
c.fillRect({bx, by, kBarW, kBarH}, rgba(255, 255, 255, 20), 16);
int fill = static_cast<int>(kBarH * std::clamp(pressed[t], 0.0f, 1.0f));
int level = input::triggerAmplitude(static_cast<uint8_t>(std::lround(pressed[t] * 255)), settings_.triggerStrength);
diff --git a/src/ui/app_ui.h b/src/ui/app_ui.h
index 75556e0..ffc2ce5 100644
--- a/src/ui/app_ui.h
+++ b/src/ui/app_ui.h
@@ -115,6 +115,7 @@ struct SettingsChoice {
int triggerHz = 1; // index into input::kTriggerHz
int triggerResistance = 0; // 0 off .. 3 strong
bool triggerPulses = false; // force pulses instead of the motor vibrating
+ int triggerProfile = 0; // 0 Standard, 1 Shooter, 2 Racing
bool circleConfirms = false; // Circle is Xbox A (and Cross is B)
int lightBarMode = 0; // 0 the game's colour, 1 lightBarColour, 2 off
Color lightBarColour = rgba(0, 112, 220);
@@ -329,10 +330,14 @@ public:
// 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;
- // The same for the trigger vibration (strength, frequency index), and,
+ // The same for the trigger vibration (strength, frequency index, profile), and,
// while its tester is open, how far each trigger is pressed: the app
// makes them vibrate as a game asking that much would.
- bool settingsTriggerFeel(int& strength, int& hzIndex, int& resistance, bool& pulses) const;
+ bool settingsTriggerFeel(int& strength, int& hzIndex, int& resistance, bool& pulses, int& profile) const;
+ bool settingsTriggerFeel(int& strength, int& hzIndex, int& resistance, bool& pulses) const {
+ int prof = 0;
+ return settingsTriggerFeel(strength, hzIndex, resistance, pulses, prof);
+ }
bool triggerTest(float& l2, float& r2) const;
// Regions offered by the account's xCloud login; `defaultRegion` is the
// one "Automatic" picks.
@@ -494,9 +499,9 @@ private:
void drawCentered(Canvas& c, const Font& f, const std::string& text, int y, int px, Color color);
// The sign-in country's "off" choice, worded for the platform (caller holds mutex_).
const char* loginCountryOffText() const;
- // The trigger tester's rows: intensity and frequency, then resistance
- // and style with adaptive triggers.
- int triggerTesterRows() const { return caps_.adaptiveTriggers ? 4 : 2; }
+ // The trigger tester's rows: intensity and frequency, then resistance,
+ // style, and feel profile with adaptive triggers.
+ int triggerTesterRows() const { return caps_.adaptiveTriggers ? 5 : 2; }
const Fonts& fonts_;
ImageCache& images_;
diff --git a/src/ui/strings.cpp b/src/ui/strings.cpp
index 78c690e..4775c05 100644
--- a/src/ui/strings.cpp
+++ b/src/ui/strings.cpp
@@ -317,6 +317,10 @@ constexpr Column kEnglish = {
"Playtime remaining", // PlaytimeRemaining
"%s h remaining", // HoursRemaining
"Less than 2 h remaining", // PlaytimeWarning
+ "Trigger profile", // TriggerProfile
+ "Standard", // TriggerProfileStd
+ "Shooter (Hair Trigger)", // TriggerProfileShooter
+ "Racing (ABS)", // TriggerProfileRacing
};
constexpr Column kPortugueseBR = {
@@ -604,6 +608,10 @@ constexpr Column kPortugueseBR = {
"Tempo de jogo restante", // PlaytimeRemaining
"%s h restantes", // HoursRemaining
"Menos de 2 h restantes", // PlaytimeWarning
+ "Perfil de gatilho", // TriggerProfile
+ "Padrão", // TriggerProfileStd
+ "Tiroteio (Hair Trigger)", // TriggerProfileShooter
+ "Corrida (ABS)", // TriggerProfileRacing
};
constexpr Column kSpanish = {
@@ -891,6 +899,10 @@ constexpr Column kSpanish = {
"Tiempo de juego restante", // PlaytimeRemaining
"%s h restantes", // HoursRemaining
"Menos de 2 h restantes", // PlaytimeWarning
+ "Perfil de gatillos", // TriggerProfile
+ "Estándar", // TriggerProfileStd
+ "Disparos (Hair Trigger)", // TriggerProfileShooter
+ "Carreras (ABS)", // TriggerProfileRacing
};
constexpr Column kFrench = {
@@ -1178,6 +1190,10 @@ constexpr Column kFrench = {
"Temps de jeu restant", // PlaytimeRemaining
"%s h restantes", // HoursRemaining
"Moins de 2 h restantes", // PlaytimeWarning
+ "Profil de gâchettes", // TriggerProfile
+ "Standard", // TriggerProfileStd
+ "Tir (Hair Trigger)", // TriggerProfileShooter
+ "Course (ABS)", // TriggerProfileRacing
};
constexpr Column kGerman = {
@@ -1465,6 +1481,10 @@ constexpr Column kGerman = {
"Verbleibende Spielzeit", // PlaytimeRemaining
"%s Std. verbleibend", // HoursRemaining
"Weniger als 2 Std. verbleibend", // PlaytimeWarning
+ "Trigger-Profil", // TriggerProfile
+ "Standard", // TriggerProfileStd
+ "Shooter (Hair Trigger)", // TriggerProfileShooter
+ "Rennen (ABS)", // TriggerProfileRacing
};
constexpr Column kItalian = {
@@ -1752,6 +1772,10 @@ constexpr Column kItalian = {
"Tempo di gioco rimanente", // PlaytimeRemaining
"%s ore rimanenti", // HoursRemaining
"Meno di 2 ore rimanenti", // PlaytimeWarning
+ "Profilo grilletti", // TriggerProfile
+ "Standard", // TriggerProfileStd
+ "Sparatutto (Hair Trigger)", // TriggerProfileShooter
+ "Corsa (ABS)", // TriggerProfileRacing
};
constexpr std::array<const Column*, kLangs> kTable = {&kEnglish, &kPortugueseBR, &kSpanish,
diff --git a/src/ui/strings.h b/src/ui/strings.h
index 95817dd..18b7cab 100644
--- a/src/ui/strings.h
+++ b/src/ui/strings.h
@@ -294,6 +294,10 @@ enum class Str {
PlaytimeRemaining, // telemetry / top bar: playtime remaining
HoursRemaining, // "%s h remaining" / "%s h restantes"
PlaytimeWarning, // warning when < 2 hours remaining
+ TriggerProfile, // trigger profile row
+ TriggerProfileStd, // Standard
+ TriggerProfileShooter, // Shooter (Hair Trigger)
+ TriggerProfileRacing, // Racing (ABS)
Count
};