Skip to content

Xbox Cloud Gaming app for PS5 Homebrew

C

v0.9.2: per-game settings profile and custom stream options

Rafael Abud Ferreira7b37f84e7017
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0d550c3..157542c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# Copyright (C) 2026 RafaelNGP
cmake_minimum_required(VERSION 3.20)
-project(xcloud_ps5 VERSION 0.9.1 LANGUAGES C CXX)
+project(xcloud_ps5 VERSION 0.9.2 LANGUAGES C CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
diff --git a/ROADMAP.md b/ROADMAP.md
index 53d8ce7..e2a3b7b 100644
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@ -140,11 +140,20 @@ is rolled back at the next start), then the app restarts itself
- Cached game details older than 30 days are fetched again, 40 per start,
oldest first.
+### Per-game settings — done (v0.9.2)
+- Custom profile per game (picture: sharpness, deband, upscaler, resolution;
+ triggers: strength, Hz, resistance, pulses; dead zones: left, right; controls:
+ circleConfirms).
+- Overrides general settings for that game only; games without one seamlessly
+ use global settings.
+- Configurable directly from the game details screen (`Screen::Details` via Options button) and in-game from the stream overlay menu (`StreamMenu`).
+- Interactive stick and trigger testers accessible directly within the modal.
+- "Restaurar padrão" (Reset to default) option cleanly restores global settings.
+
## Next
| Item | Why | Size |
| --- | --- | --- |
-| Per-game settings (next release) | A profile per game (picture, triggers, dead zones, controls) that overrides the general settings for that game only; games without one use the general ones | medium |
| Publisher filter | 918 publishers: the most frequent first, studios of one owner grouped | medium |
| Friends playing now | Xbox social / presence APIs; privacy to handle | large |
| Keyboard and mouse filter / icon | The store marks games that take them; together with keyboard and mouse support | small |
diff --git a/ps5/sce_sys/param.json b/ps5/sce_sys/param.json
index 3fa2684..9c2e96c 100644
--- a/ps5/sce_sys/param.json
+++ b/ps5/sce_sys/param.json
@@ -10,7 +10,7 @@
"conceptId": "99810",
"contentBadgeType": 1,
"contentId": "UP9000-PPSA99810_00-XCLOUDPS5CLI0000",
- "contentVersion": "00.901.000",
+ "contentVersion": "00.902.000",
"downloadDataSize": 256,
"gameIntent": {
"permittedIntents": [
diff --git a/src/app/autoplay.cpp b/src/app/autoplay.cpp
index 06df5b6..61f684d 100644
--- a/src/app/autoplay.cpp
+++ b/src/app/autoplay.cpp
@@ -30,6 +30,7 @@ const char* pickerShot = nullptr;
bool confirmShot = false, confirmHome = false;
const char* tuneShot = nullptr; // "tunetest": save this screen next // "confirmtest": save confirm2.ppm / check the home screen // "pickertest": save this screen next, once drawn
const char* gridShot = nullptr; // "gridtest": save grid screenshot
+const char* gameSettingsShot = nullptr; // "gamesettingstest": save screenshot
bool acceptUpdate = false; // "updatetest": Cross on the pop-up, next pass ("updateskip": Circle)
} // namespace
@@ -88,6 +89,7 @@ void loadAutoplay() {
if (opt == "scrolltest") g_autoplay.scrollTest = true;
if (opt.rfind("locktitle=", 0) == 0) g_autoplay.lockTitle = opt.substr(10);
if (opt == "gridtest") g_autoplay.gridTest = true;
+ if (opt == "gamesettingstest") g_autoplay.gameSettingsTest = true;
if (opt == "norestart") g_autoplay.noRestart = true;
if (opt.rfind("threads=", 0) == 0) g_autoplay.decodeThreads = std::atoi(opt.c_str() + 8);
}
@@ -167,6 +169,83 @@ void autoplayPad(input::ControllerState& pad) {
XC_LOGI("AUTOPLAY END: tune test");
}
}
+ if (g_autoplay.gameSettingsTest && uiSaved) {
+ static uint64_t since = 0;
+ static int step = 0;
+ uint64_t now = platform::nowMs();
+ if (!since) since = now;
+ uint64_t t = now - since;
+
+ // Step 0: Open details
+ if (step == 0 && t >= 500) {
+ ui::GameTile tile;
+ bool found = (!g_autoplay.title.empty() && g_ui->findTile(g_autoplay.title, tile)) ||
+ g_ui->firstTile(tile) || g_ui->purchasableAt(0, tile);
+ if (found) {
+ g_ui->showDetails(tile);
+ step = 1;
+ }
+ }
+ // Step 1: Wait for details to draw, then take screenshot
+ if (step == 1 && t >= 2500) {
+ gameSettingsShot = "detail.ppm";
+ step = 2;
+ }
+ // Step 2: Press Options to open Game Settings
+ if (step == 2 && t >= 3200 && t < 3400) {
+ pad.btnOptions = true;
+ }
+ if (step == 2 && t >= 3500) {
+ step = 3;
+ }
+ // Step 3: Take screenshot of default Game Settings modal
+ if (step == 3 && t >= 4500) {
+ gameSettingsShot = "game_settings.ppm";
+ step = 4;
+ }
+ // Step 4: D-pad navigation and changes
+ if (step == 4 && t >= 5200 && t < 5400) {
+ pad.dpadDown = true;
+ }
+ if (step == 4 && t >= 6000 && t < 6200) {
+ pad.dpadRight = true;
+ }
+ if (step == 4 && t >= 6800 && t < 7000) {
+ pad.dpadDown = true;
+ }
+ if (step == 4 && t >= 7600 && t < 7800) {
+ pad.dpadRight = true;
+ }
+ if (step == 4 && t >= 8400 && t < 8600) {
+ pad.dpadDown = true;
+ }
+ if (step == 4 && t >= 9000) {
+ step = 5;
+ }
+ // Step 5: Take screenshot of Custom Game Settings modal
+ if (step == 5 && t >= 9800) {
+ gameSettingsShot = "game_settings_custom.ppm";
+ step = 6;
+ }
+ // Step 6: Press Circle (btnB) to save and close
+ if (step == 6 && t >= 10600 && t < 10800) {
+ pad.btnB = true;
+ }
+ if (step == 6 && t >= 11000) {
+ step = 7;
+ }
+ // Step 7: Take screenshot of detail after closing modal
+ if (step == 7 && t >= 12000) {
+ gameSettingsShot = "detail_after.ppm";
+ step = 8;
+ }
+ // Step 8: Finish
+ if (step == 8 && t >= 13000) {
+ g_autoplay.gameSettingsTest = false;
+ XC_LOGI("AUTOPLAY END: game settings test");
+ step = 9;
+ }
+ }
if (g_autoplay.scrollTest && uiSaved) {
// Game Pass: right stick down, then right; R1 to My games: right
// stick down; a finger moving up the touchpad, then down. The focus
@@ -475,6 +554,10 @@ void autoplayScreens(const ui::Canvas& canvas, uint64_t now) {
saveCanvas(gridShot);
gridShot = nullptr;
}
+ if (gameSettingsShot) {
+ saveCanvas(gameSettingsShot);
+ gameSettingsShot = nullptr;
+ }
if (confirmShot) {
confirmShot = false;
saveCanvas("confirm2.ppm");
diff --git a/src/app/autoplay.h b/src/app/autoplay.h
index 7c805f8..b840a36 100644
--- a/src/app/autoplay.h
+++ b/src/app/autoplay.h
@@ -72,6 +72,7 @@ struct Autoplay {
// bar's colour picker moved (picker.ppm), chosen (settings.ppm)
bool noRestart = false; // norestart: after an update, close instead of restarting
bool gridTest = false; // gridtest: navigate to All games grid, verify 2D navigation and capture screenshots
+ bool gameSettingsTest = false; // gamesettingstest: test details and game settings modal
};
extern Autoplay g_autoplay;
extern std::atomic<bool> g_syntheticA; // A held down for the game
diff --git a/src/app/ps5_main.cpp b/src/app/ps5_main.cpp
index 84c2521..91e7aa6 100644
--- a/src/app/ps5_main.cpp
+++ b/src/app/ps5_main.cpp
@@ -79,7 +79,7 @@ bool saveSettings(const ui::SettingsChoice& choice) {
std::string code = ui::languageCode(static_cast<ui::Language>(choice.language));
languageChanged = code != g_settings.language;
g_settings.language = code;
- g_settings.resolution = choice.resolution == 1 ? "720p" : choice.resolution == 2 ? "1440p" : "1080p";
+ g_settings.resolution = choice.resolution == 1 ? "720p" : choice.resolution == 2 ? "best" : "1080p";
g_settings.region = choice.region;
g_settings.deadzoneLeft = choice.deadzone[0];
g_settings.deadzoneRight = choice.deadzone[1];
@@ -90,6 +90,9 @@ bool saveSettings(const ui::SettingsChoice& choice) {
g_settings.circleConfirms = choice.circleConfirms;
g_settings.lightBarMode = choice.lightBarMode;
g_settings.lightBarColour = choice.lightBarColour;
+ g_settings.sharpness = choice.sharpness;
+ g_settings.deband = choice.deband;
+ g_settings.upscaler = choice.upscaler;
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());
@@ -165,7 +168,7 @@ int main(int argc, char** argv) {
{
ui::SettingsChoice choice;
choice.language = static_cast<int>(ui::language());
- choice.resolution = g_settings.resolution == "720p" ? 1 : g_settings.resolution == "1440p" ? 2 : 0;
+ choice.resolution = g_settings.resolution == "720p" ? 1 : (g_settings.resolution == "1440p" || g_settings.resolution == "best") ? 2 : 0;
choice.region = g_settings.region;
choice.deadzone[0] = std::clamp(g_settings.deadzoneLeft, 0, ui::kMaxDeadzone);
choice.deadzone[1] = std::clamp(g_settings.deadzoneRight, 0, ui::kMaxDeadzone);
@@ -176,9 +179,13 @@ int main(int argc, char** argv) {
choice.circleConfirms = g_settings.circleConfirms;
choice.lightBarMode = g_settings.lightBarMode;
choice.lightBarColour = g_settings.lightBarColour;
+ choice.sharpness = g_settings.sharpness;
+ choice.deband = g_settings.deband;
+ choice.upscaler = g_settings.upscaler;
g_ui->setAllow1440(allow1440Locked());
g_ui->setUpdateState(XC_APP_VERSION, {}, false); // Settings shows this version before any check
g_ui->setSettings(choice);
+ g_ui->setPerGameSettings(g_settings.perGame);
applyControllerSettings();
g_ui->setRegionLatency(g_settings.regionRtt);
g_ui->setPrefs(g_settings.hidden, g_settings.librarySort == "az" ? ui::LibrarySort::AZ
@@ -394,6 +401,19 @@ int main(int argc, char** argv) {
XC_LOGI("prefs saved: %zu hidden, sort %s", g_settings.hidden.size(), g_settings.librarySort.c_str());
break;
}
+ case ui::Action::GameSettingsChanged: {
+ std::lock_guard<std::mutex> lock(g_settingsMutex);
+ std::string key = app::gameProfileKey(ev.game.productId, ev.game.titleId);
+ if (ev.hasGameProfile) {
+ g_settings.perGame[key] = ev.gameProfile;
+ XC_LOGI("per-game profile saved for %s (%s)", ev.game.name.c_str(), key.c_str());
+ } else {
+ g_settings.perGame.erase(key);
+ XC_LOGI("per-game profile reset to default for %s (%s)", ev.game.name.c_str(), key.c_str());
+ }
+ if (!g_settings.save(settingsPath())) XC_LOGW("could not save settings");
+ break;
+ }
case ui::Action::SettingsChanged:
// Row titles and game details come from the catalog in the
// chosen language.
diff --git a/src/app/settings.cpp b/src/app/settings.cpp
index c30945e..ad15bc4 100644
--- a/src/app/settings.cpp
+++ b/src/app/settings.cpp
@@ -20,7 +20,7 @@ bool Settings::load(const std::string& path) {
language = (*j)["language"].str(language);
resolution = (*j)["resolution"].str(resolution);
region = (*j)["region"].str(region);
- if (resolution != "720p" && resolution != "1440p") resolution = "1080p";
+ if (resolution != "720p" && resolution != "1440p" && resolution != "best") resolution = "1080p";
hidden.clear();
for (const auto& id : (*j)["hidden"].items())
if (!id.str().empty()) hidden.push_back(id.str());
@@ -64,9 +64,61 @@ bool Settings::load(const std::string& path) {
regionRtt.clear();
for (const auto& [name, ms] : (*j)["regionRtt"].members())
if (ms.asInt() > 0) regionRtt[name] = static_cast<int>(ms.asInt());
+ perGame.clear();
+ for (const auto& [id, obj] : (*j)["perGame"].members()) {
+ GameProfile p;
+ p.sharpness = static_cast<int>(std::clamp<int64_t>(obj["sharpness"].asInt(sharpness), 0, 3));
+ p.deband = static_cast<int>(std::clamp<int64_t>(obj["deband"].asInt(deband), 0, 3));
+ p.upscaler = static_cast<int>(std::clamp<int64_t>(obj["upscaler"].asInt(upscaler), 0, 3));
+ int resDef = resolution == "720p" ? 1 : resolution == "1440p" ? 2 : 0;
+ p.resolution = static_cast<int>(std::clamp<int64_t>(obj["resolution"].asInt(resDef), 0, 2));
+ p.deadzoneLeft = static_cast<int>(std::clamp<int64_t>(obj["deadzoneLeft"].asInt(deadzoneLeft), 0, 50));
+ p.deadzoneRight = static_cast<int>(std::clamp<int64_t>(obj["deadzoneRight"].asInt(deadzoneRight), 0, 50));
+ p.triggerStrength = static_cast<int>(std::clamp<int64_t>(obj["triggerStrength"].asInt(triggerStrength), 0, 4));
+ 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.circleConfirms = obj["circleConfirms"].asBool(circleConfirms);
+ perGame[id] = p;
+ }
return true;
}
+GameProfile Settings::defaultProfile() const {
+ GameProfile p;
+ p.sharpness = sharpness;
+ p.deband = deband;
+ p.upscaler = upscaler;
+ p.resolution = resolution == "720p" ? 1 : resolution == "1440p" ? 2 : 0;
+ p.deadzoneLeft = deadzoneLeft;
+ p.deadzoneRight = deadzoneRight;
+ p.triggerStrength = triggerStrength;
+ p.triggerHz = triggerHz;
+ p.triggerResistance = triggerResistance;
+ p.triggerPulses = triggerPulses;
+ p.circleConfirms = circleConfirms;
+ return p;
+}
+
+GameProfile Settings::profileForGame(const std::string& productId, const std::string& titleId, bool* hasCustom) const {
+ if (!productId.empty()) {
+ auto it = perGame.find(productId);
+ if (it != perGame.end()) {
+ if (hasCustom) *hasCustom = true;
+ return it->second;
+ }
+ }
+ if (!titleId.empty()) {
+ auto it = perGame.find(titleId);
+ if (it != perGame.end()) {
+ if (hasCustom) *hasCustom = true;
+ return it->second;
+ }
+ }
+ if (hasCustom) *hasCustom = false;
+ return defaultProfile();
+}
+
bool Settings::save(const std::string& path) const {
json::Value v = json::Value::object();
v.set("language", language);
@@ -101,6 +153,23 @@ bool Settings::save(const std::string& path) const {
v.set("maxHeightHome", maxHeightHome);
v.set("probedCloud", probedCloud);
v.set("probedHome", probedHome);
+ json::Value pg = json::Value::object();
+ for (const auto& [id, p] : perGame) {
+ json::Value obj = json::Value::object();
+ obj.set("sharpness", p.sharpness);
+ obj.set("deband", p.deband);
+ obj.set("upscaler", p.upscaler);
+ obj.set("resolution", p.resolution);
+ obj.set("deadzoneLeft", p.deadzoneLeft);
+ obj.set("deadzoneRight", p.deadzoneRight);
+ obj.set("triggerStrength", p.triggerStrength);
+ obj.set("triggerHz", p.triggerHz);
+ obj.set("triggerResistance", p.triggerResistance);
+ obj.set("triggerPulses", p.triggerPulses);
+ obj.set("circleConfirms", p.circleConfirms);
+ pg.set(id, obj);
+ }
+ v.set("perGame", pg);
v.set("settingsVersion", 2);
return platform::writeFileAtomic(path, v.dump());
}
diff --git a/src/app/settings.h b/src/app/settings.h
index 6b5cdcf..f0fadf3 100644
--- a/src/app/settings.h
+++ b/src/app/settings.h
@@ -10,6 +10,26 @@
namespace xc::app {
+struct GameProfile {
+ // Picture
+ int sharpness = 0; // 0 off, 1..3 low, medium, high
+ int deband = 3; // 0 off, 1 low, 2 high, 3 auto
+ int upscaler = 2; // 0 FSR 1, 1 Anime4K, 2 FSR + clean, 3 Anime4K + clean
+ int resolution = 0; // 0 1080p, 1 720p, 2 1440p
+ // Controller: dead zone (percent), triggers, confirm button
+ int deadzoneLeft = 15, deadzoneRight = 15;
+ int triggerStrength = 2; // 0 off .. 4 max
+ int triggerHz = 1; // 0..2
+ int triggerResistance = 0; // 0 off .. 3 strong
+ bool triggerPulses = false;
+ bool circleConfirms = false;
+};
+
+// Key to identify a game profile: productId first, else titleId.
+inline std::string gameProfileKey(const std::string& productId, const std::string& titleId) {
+ return !productId.empty() ? productId : titleId;
+}
+
struct Settings {
std::string language = "en"; // ui::languageCode()
std::string resolution = "1080p"; // "1080p", "720p" or "1440p" (experimental)
@@ -52,6 +72,12 @@ struct Settings {
int maxHeightCloud = 0, maxHeightHome = 0;
int64_t probedCloud = 0, probedHome = 0; // streams that showed the touchpad gestures' hint (three do)
+ // Per-game profiles overriding the general settings (productId or titleId -> profile).
+ std::map<std::string, GameProfile> perGame;
+
+ GameProfile defaultProfile() const;
+ GameProfile profileForGame(const std::string& productId, const std::string& titleId, bool* hasCustom = nullptr) const;
+
bool load(const std::string& path);
bool save(const std::string& path) const;
};
diff --git a/src/app/stream_screen.cpp b/src/app/stream_screen.cpp
index f704968..c2dcb73 100644
--- a/src/app/stream_screen.cpp
+++ b/src/app/stream_screen.cpp
@@ -88,18 +88,40 @@ void StreamScreen::update(const input::ControllerState& pad, ui::NavInput nav, b
}
if (g_player != overlayPlayer_) { // a new stream
overlayPlayer_ = g_player;
+ wasStreaming_ = true;
menu_.close();
+ ui::GameTile tile;
+ {
+ std::lock_guard<std::mutex> argLock(g_argMutex);
+ tile = g_playTile;
+ }
+ gameKey_ = gameProfileKey(tile.productId, tile.titleId);
+
std::lock_guard<std::mutex> settingsLock(g_settingsMutex);
- streamResolution_ = g_settings.resolution == "720p" ? 1 : g_settings.resolution == "1440p" ? 2 : 0;
+ bool hasCustom = false;
+ GameProfile prof = g_settings.profileForGame(tile.productId, tile.titleId, &hasCustom);
+ hasCustomProfile_ = hasCustom;
+
+ streamResolution_ = prof.resolution;
showStats_ = g_settings.streamStats;
- sharpness_ = g_autoplay.sharpness >= 0 ? g_autoplay.sharpness : g_settings.sharpness;
+ sharpness_ = g_autoplay.sharpness >= 0 ? g_autoplay.sharpness : prof.sharpness;
display::setSharpness(kSharpAmount[std::clamp(sharpness_, 0, 3)]);
- deband_ = g_autoplay.deband >= 0 ? g_autoplay.deband : g_settings.deband;
+ deband_ = g_autoplay.deband >= 0 ? g_autoplay.deband : prof.deband;
autoDeband_.reset();
applyDeband_();
- upscaler_ = g_autoplay.upscaler >= 0 ? g_autoplay.upscaler : g_settings.upscaler;
+ upscaler_ = g_autoplay.upscaler >= 0 ? g_autoplay.upscaler : prof.upscaler;
if (g_autoplay.restore) upscaler_ = (upscaler_ & 1) | 2;
applyUpscaler(upscaler_);
+
+ // Apply controller profile settings
+ triggerStrength_ = prof.triggerStrength;
+ deadzone_ = prof.deadzoneLeft;
+ circleConfirms_ = prof.circleConfirms;
+ input::setDeadzone(prof.deadzoneLeft / 100.0f, prof.deadzoneRight / 100.0f);
+ input::setTriggerFeel(prof.triggerStrength, prof.triggerHz, prof.triggerResistance, prof.triggerPulses);
+ input::setCircleConfirms(prof.circleConfirms);
+ if (g_ui) g_ui->setCircleConfirms(prof.circleConfirms);
+
overlaySeq_ = 0;
}
if (g_player) {
@@ -108,14 +130,15 @@ void StreamScreen::update(const input::ControllerState& pad, ui::NavInput nav, b
bool wasOpen = menu_.isOpen();
if (!wasOpen && (menuCombo || swipeMenu_) && g_keyboardFor.empty()) {
swipeMenu_ = false;
- menu_.setCircleConfirms(g_settings.circleConfirms);
+ menu_.setCircleConfirms(circleConfirms_);
bool allow1440;
{
std::lock_guard<std::mutex> settingsLock(g_settingsMutex);
allow1440 = allow1440Locked();
}
menu_.setDebandInUse(autoDeband_.level());
- menu_.open(streamResolution_, showStats_, sharpness_, deband_, upscaler_, g_playingHome, allow1440);
+ menu_.open(streamResolution_, showStats_, sharpness_, deband_, upscaler_, g_playingHome, allow1440,
+ hasCustomProfile_, triggerStrength_, deadzone_, circleConfirms_);
overlaySeq_ = 0;
} else if (wasOpen) {
switch (menu_.handle(nav)) {
@@ -134,29 +157,118 @@ void StreamScreen::update(const input::ControllerState& pad, ui::NavInput nav, b
g_player->requestResolution(streamResolution_ == 1 ? "720HQ"
: streamResolution_ == 2 || g_playingHome ? "1440"
: "1080HQ");
+ {
+ std::lock_guard<std::mutex> settingsLock(g_settingsMutex);
+ if (hasCustomProfile_) {
+ g_settings.perGame[gameKey_].resolution = streamResolution_;
+ g_settings.save(settingsPath());
+ }
+ }
break;
+ case ui::MenuAction::ProfileToggle: {
+ hasCustomProfile_ = menu_.hasCustomProfile();
+ std::lock_guard<std::mutex> settingsLock(g_settingsMutex);
+ if (hasCustomProfile_) {
+ GameProfile p;
+ p.sharpness = sharpness_;
+ p.deband = deband_;
+ p.upscaler = upscaler_;
+ p.resolution = streamResolution_;
+ p.deadzoneLeft = deadzone_;
+ p.deadzoneRight = deadzone_;
+ p.triggerStrength = triggerStrength_;
+ p.triggerHz = g_settings.triggerHz;
+ p.triggerResistance = g_settings.triggerResistance;
+ p.triggerPulses = g_settings.triggerPulses;
+ p.circleConfirms = circleConfirms_;
+ g_settings.perGame[gameKey_] = p;
+ } else {
+ g_settings.perGame.erase(gameKey_);
+ auto def = g_settings.defaultProfile();
+ sharpness_ = def.sharpness;
+ deband_ = def.deband;
+ upscaler_ = def.upscaler;
+ streamResolution_ = def.resolution;
+ deadzone_ = def.deadzoneLeft;
+ triggerStrength_ = def.triggerStrength;
+ circleConfirms_ = def.circleConfirms;
+ display::setSharpness(kSharpAmount[sharpness_]);
+ applyDeband_();
+ applyUpscaler(upscaler_);
+ input::setDeadzone(deadzone_ / 100.0f, deadzone_ / 100.0f);
+ input::setTriggerFeel(triggerStrength_, g_settings.triggerHz, g_settings.triggerResistance, g_settings.triggerPulses);
+ input::setCircleConfirms(circleConfirms_);
+ menu_.setProfileValues(streamResolution_, sharpness_, deband_, upscaler_,
+ triggerStrength_, deadzone_, circleConfirms_, false);
+ }
+ g_settings.save(settingsPath());
+ if (g_ui) g_ui->setPerGameSettings(g_settings.perGame);
+ break;
+ }
case ui::MenuAction::Sharpness: {
sharpness_ = menu_.sharpness();
display::setSharpness(kSharpAmount[sharpness_]);
std::lock_guard<std::mutex> settingsLock(g_settingsMutex);
- g_settings.sharpness = sharpness_;
+ if (hasCustomProfile_) g_settings.perGame[gameKey_].sharpness = sharpness_;
+ else g_settings.sharpness = sharpness_;
g_settings.save(settingsPath());
+ if (g_ui) g_ui->setPerGameSettings(g_settings.perGame);
break;
}
case ui::MenuAction::Upscaler: {
upscaler_ = menu_.upscaler();
applyUpscaler(upscaler_);
std::lock_guard<std::mutex> settingsLock(g_settingsMutex);
- g_settings.upscaler = upscaler_;
+ if (hasCustomProfile_) g_settings.perGame[gameKey_].upscaler = upscaler_;
+ else g_settings.upscaler = upscaler_;
g_settings.save(settingsPath());
+ if (g_ui) g_ui->setPerGameSettings(g_settings.perGame);
break;
}
case ui::MenuAction::Deband: {
deband_ = menu_.deband();
applyDeband_();
std::lock_guard<std::mutex> settingsLock(g_settingsMutex);
- g_settings.deband = deband_;
+ if (hasCustomProfile_) g_settings.perGame[gameKey_].deband = deband_;
+ else g_settings.deband = deband_;
g_settings.save(settingsPath());
+ if (g_ui) g_ui->setPerGameSettings(g_settings.perGame);
+ break;
+ }
+ case ui::MenuAction::Triggers: {
+ triggerStrength_ = menu_.triggerStrength();
+ std::lock_guard<std::mutex> settingsLock(g_settingsMutex);
+ input::setTriggerFeel(triggerStrength_, g_settings.triggerHz, g_settings.triggerResistance, g_settings.triggerPulses);
+ if (hasCustomProfile_) g_settings.perGame[gameKey_].triggerStrength = triggerStrength_;
+ else g_settings.triggerStrength = triggerStrength_;
+ g_settings.save(settingsPath());
+ if (g_ui) g_ui->setPerGameSettings(g_settings.perGame);
+ break;
+ }
+ case ui::MenuAction::Deadzone: {
+ deadzone_ = menu_.deadzone();
+ std::lock_guard<std::mutex> settingsLock(g_settingsMutex);
+ input::setDeadzone(deadzone_ / 100.0f, deadzone_ / 100.0f);
+ if (hasCustomProfile_) {
+ g_settings.perGame[gameKey_].deadzoneLeft = deadzone_;
+ g_settings.perGame[gameKey_].deadzoneRight = deadzone_;
+ } else {
+ g_settings.deadzoneLeft = deadzone_;
+ g_settings.deadzoneRight = deadzone_;
+ }
+ g_settings.save(settingsPath());
+ if (g_ui) g_ui->setPerGameSettings(g_settings.perGame);
+ break;
+ }
+ case ui::MenuAction::ConfirmButton: {
+ circleConfirms_ = menu_.circleConfirms();
+ input::setCircleConfirms(circleConfirms_);
+ if (g_ui) g_ui->setCircleConfirms(circleConfirms_);
+ std::lock_guard<std::mutex> settingsLock(g_settingsMutex);
+ if (hasCustomProfile_) g_settings.perGame[gameKey_].circleConfirms = circleConfirms_;
+ else g_settings.circleConfirms = circleConfirms_;
+ g_settings.save(settingsPath());
+ if (g_ui) g_ui->setPerGameSettings(g_settings.perGame);
break;
}
case ui::MenuAction::Stats: {
@@ -274,6 +386,15 @@ void StreamScreen::idle() {
overlayShown_ = false;
menu_.close();
}
+ if (wasStreaming_) {
+ wasStreaming_ = false;
+ overlayPlayer_ = nullptr;
+ std::lock_guard<std::mutex> lock(g_settingsMutex);
+ input::setDeadzone(g_settings.deadzoneLeft / 100.0f, g_settings.deadzoneRight / 100.0f);
+ input::setTriggerFeel(g_settings.triggerStrength, g_settings.triggerHz, g_settings.triggerResistance, g_settings.triggerPulses);
+ input::setCircleConfirms(g_settings.circleConfirms);
+ if (g_ui) g_ui->setCircleConfirms(g_settings.circleConfirms);
+ }
}
} // namespace xc::app
diff --git a/src/app/stream_screen.h b/src/app/stream_screen.h
index e2acf47..857c77b 100644
--- a/src/app/stream_screen.h
+++ b/src/app/stream_screen.h
@@ -53,6 +53,12 @@ private:
bool padAttached_[input::kMaxPads] = {}; // controllers 1..3 announced to the stream
uint32_t playerReconnects_ = 0;
uint32_t overlaySeq_ = 0; // g_infoSeq + 1 when drawn; 0 = redraw
+ bool hasCustomProfile_ = false;
+ std::string gameKey_;
+ int triggerStrength_ = 2;
+ int deadzone_ = 15;
+ bool circleConfirms_ = false;
+ bool wasStreaming_ = false;
};
} // namespace xc::app
diff --git a/src/app/worker.cpp b/src/app/worker.cpp
index fb2e5ab..53027f4 100644
--- a/src/app/worker.cpp
+++ b/src/app/worker.cpp
@@ -207,7 +207,17 @@ std::string play(auth::AuthManager& am, xcloud::GssvClient& gssv, const ui::Game
std::string err;
{
std::lock_guard<std::mutex> lock(g_settingsMutex);
- const std::string& res = g_autoplay.resolution.empty() ? g_settings.resolution : g_autoplay.resolution;
+ bool hasCustom = false;
+ GameProfile prof = g_settings.profileForGame(game.productId, game.titleId, &hasCustom);
+ std::string res;
+ if (!g_autoplay.resolution.empty()) {
+ res = g_autoplay.resolution;
+ } else if (hasCustom) {
+ res = prof.resolution == 1 ? "720p" : prof.resolution == 2 ? "best" : "1080p";
+ } else {
+ res = g_settings.resolution;
+ }
+ bool isBest = (res == "best" || res == "1440p");
// What each kind of stream can deliver is measured, not assumed: the
// first stream (and one a week) asks for the top tier and records
// the picture's height. The user's own Xbox always gets the top tier
@@ -222,25 +232,27 @@ std::string play(auth::AuthManager& am, xcloud::GssvClient& gssv, const ui::Game
xcloud::Resolution tier;
if (!g_autoplay.resolution.empty())
tier = res == "720p" ? xcloud::Resolution::P720
- : res == "1440p" ? xcloud::Resolution::P1440
+ : isBest ? xcloud::Resolution::P1440
: res == "1080p-hq" ? xcloud::Resolution::P1080HQ
: xcloud::Resolution::P1080;
else if (res == "720p")
tier = xcloud::Resolution::P720;
- else if (home || g_probing || (res == "1440p" && known >= 1440))
+ else if (home || g_probing || (isBest && known >= 1440))
tier = xcloud::Resolution::P1440;
+ else if (isBest)
+ tier = xcloud::Resolution::P1080HQ;
else
tier = xcloud::Resolution::P1080;
// A cloud probe goes back to what the user chose once measured.
- if (g_probing && !home && !(res == "1440p")) g_afterProbeAlias = "1080HQ";
+ if (g_probing && !home && !isBest) g_afterProbeAlias = "1080HQ";
gssv.setResolution(tier);
const xcloud::Region* region = gssv.session().defaultRegion();
const std::string& wanted = regionName.empty() ? g_settings.region : regionName;
for (const auto& r : gssv.session().regions)
if (r.name == wanted) region = &r;
if (region) gssv.setRegion(*region);
- XC_LOGI("stream settings: %s, region %s, locale %s", g_settings.resolution.c_str(),
- region ? region->name.c_str() : "?", ui::gameLocale());
+ XC_LOGI("stream settings: %s%s, region %s, locale %s", res.c_str(),
+ hasCustom ? " (per-game)" : "", region ? region->name.c_str() : "?", ui::gameLocale());
}
if (!gssv.startSession(game.titleId, ui::gameLocale(), err)) return err;
if (game.heroUrl.empty() && !game.productId.empty()) {
@@ -536,7 +548,7 @@ void loadLibrary(xcloud::GssvClient& gssv) {
if (!g_autoplay.title.empty() && g_autoplay.title != "BENCH" && g_autoplay.title != "UPDATE" && !g_autoplay.detailTest && !g_autoplay.libraryTest &&
!g_autoplay.consolesTab && !g_autoplay.settingsTest &&
!g_autoplay.imeTest && !g_autoplay.vibeTest && !g_autoplay.searchTest && !g_autoplay.quickTest && !g_autoplay.scrollTest &&
- !g_autoplay.gridTest) {
+ !g_autoplay.gridTest && !g_autoplay.gameSettingsTest) {
platform::sleepMs(6000); // leave the home screen up for ui.ppm
ui::GameTile tile;
tile.titleId = g_autoplay.title;
diff --git a/src/ui/app_ui.cpp b/src/ui/app_ui.cpp
index fb28290..e08576e 100644
--- a/src/ui/app_ui.cpp
+++ b/src/ui/app_ui.cpp
@@ -500,6 +500,25 @@ bool AppUi::purchasableAt(size_t index, GameTile& out) const {
return true;
}
+bool AppUi::firstTile(GameTile& out) const {
+ std::lock_guard<std::mutex> lock(mutex_);
+ for (const auto& row : rows_) {
+ if (!row.tiles.empty()) {
+ out = row.tiles.front();
+ return true;
+ }
+ }
+ if (!owned_.empty()) {
+ out = owned_.front();
+ return true;
+ }
+ if (!purchasable_.empty()) {
+ out = purchasable_.front();
+ return true;
+ }
+ return false;
+}
+
void AppUi::showDetails(const GameTile& tile) {
std::lock_guard<std::mutex> lock(mutex_);
openDetails(tile);
@@ -575,6 +594,8 @@ Tab AppUi::tab() const {
void AppUi::openDetails(const GameTile& tile) {
// Caller holds mutex_.
detail_ = tile;
+ gameSettingsOpen_ = false;
+ tester_ = Tester::None;
auto info = detailInfo_.find(tile.productId);
if (info != detailInfo_.end()) {
if (detail_.description.empty()) detail_.description = info->second.description;
@@ -768,7 +789,7 @@ bool AppUi::settingsLightBar(int& mode, Color& colour) const {
bool AppUi::settingsTriggerFeel(int& strength, int& hzIndex, int& resistance, bool& pulses) const {
std::lock_guard<std::mutex> lock(mutex_);
- if (screen_ != Screen::Settings) return false;
+ if (screen_ != Screen::Settings && !gameSettingsOpen_) return false;
strength = settings_.triggerStrength;
hzIndex = settings_.triggerHz;
resistance = settings_.triggerResistance;
@@ -778,7 +799,7 @@ bool AppUi::settingsTriggerFeel(int& strength, int& hzIndex, int& resistance, bo
bool AppUi::triggerTest(float& l2, float& r2) const {
std::lock_guard<std::mutex> lock(mutex_);
- if (screen_ != Screen::Settings || tester_ != Tester::Triggers) return false;
+ if ((screen_ != Screen::Settings && !gameSettingsOpen_) || tester_ != Tester::Triggers) return false;
l2 = testL2_;
r2 = testR2_;
return true;
@@ -825,6 +846,18 @@ void AppUi::handleTester(const NavInput& in) {
settings_.triggerResistance = testerBackup_.triggerResistance, settings_.triggerPulses = testerBackup_.triggerPulses;
}
if (in.accept || in.back) {
+ if (gameSettingsOpen_) {
+ if (in.accept) {
+ activeGameProfile_.deadzoneLeft = settings_.deadzone[0];
+ activeGameProfile_.deadzoneRight = settings_.deadzone[1];
+ activeGameProfile_.triggerStrength = settings_.triggerStrength;
+ activeGameProfile_.triggerHz = settings_.triggerHz;
+ activeGameProfile_.triggerResistance = settings_.triggerResistance;
+ activeGameProfile_.triggerPulses = settings_.triggerPulses;
+ activeGameHasCustom_ = true;
+ }
+ settings_ = testerBackup_;
+ }
tester_ = Tester::None;
testL2_ = testR2_ = 0;
dirty_ = true;
@@ -922,6 +955,41 @@ void AppUi::setSettings(const SettingsChoice& choice) {
dirty_ = true;
}
+void AppUi::setPerGameSettings(const std::map<std::string, app::GameProfile>& perGame) {
+ std::lock_guard<std::mutex> lock(mutex_);
+ perGameSettings_ = perGame;
+ dirty_ = true;
+}
+
+void AppUi::openGameSettings() {
+ gameSettingsOpen_ = true;
+ gameSettingsRow_ = 0;
+ std::string key = app::gameProfileKey(detail_.productId, detail_.titleId);
+ auto it = perGameSettings_.find(key);
+ if (it != perGameSettings_.end()) {
+ activeGameHasCustom_ = true;
+ activeGameProfile_ = it->second;
+ } else {
+ activeGameHasCustom_ = false;
+ activeGameProfile_.sharpness = settings_.sharpness;
+ activeGameProfile_.deband = settings_.deband;
+ activeGameProfile_.upscaler = settings_.upscaler;
+ activeGameProfile_.resolution = settings_.resolution;
+ activeGameProfile_.deadzoneLeft = settings_.deadzone[0];
+ activeGameProfile_.deadzoneRight = settings_.deadzone[1];
+ activeGameProfile_.triggerStrength = settings_.triggerStrength;
+ activeGameProfile_.triggerHz = settings_.triggerHz;
+ activeGameProfile_.triggerResistance = settings_.triggerResistance;
+ activeGameProfile_.triggerPulses = settings_.triggerPulses;
+ activeGameProfile_.circleConfirms = settings_.circleConfirms;
+ }
+}
+
+void AppUi::closeGameSettings() {
+ gameSettingsOpen_ = false;
+ tester_ = Tester::None;
+}
+
void AppUi::setCircleConfirms(bool on) {
std::lock_guard<std::mutex> lock(mutex_);
circleConfirms_ = on;
@@ -997,8 +1065,7 @@ std::vector<std::string> AppUi::settingOptions(int row) const {
if (row == 0) {
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)}; // kResolutionOrder
- if (allow1440_) out.push_back(tr(Str::Res1440));
+ out = {tr(Str::Res720), tr(Str::Res1080), tr(Str::ResBest)}; // kResolutionOrder
} else if (row == 3) {
// Left and right stick (the tester changes them).
out = {std::to_string(settings_.deadzone[0]) + " % \xC2\xB7 " + std::to_string(settings_.deadzone[1]) + " %"};
@@ -1024,7 +1091,6 @@ int AppUi::settingSelected(int row) const {
// Caller holds mutex_.
if (row == 0) return settings_.language;
if (row == 1) {
- if (settings_.resolution == 2 && !allow1440_) return 1; // 1440p saved, not offered: 1080p
for (int i = 0; i < 3; ++i)
if (kResolutionOrder[i] == settings_.resolution) return i;
}
@@ -1530,6 +1596,168 @@ void AppUi::handleSearchKeys(const NavInput& in) {
if (in.up || in.down || in.left || in.right || edited) dirty_ = true;
}
+void AppUi::handleGameSettings(const NavInput& in, UiEvent& ev) {
+ if (tester_ != Tester::None) {
+ handleTester(in);
+ return;
+ }
+ int rowCount = activeGameHasCustom_ ? 9 : 8;
+ if (in.up) {
+ gameSettingsRow_ = (gameSettingsRow_ + rowCount - 1) % rowCount;
+ dirty_ = true;
+ }
+ if (in.down) {
+ gameSettingsRow_ = (gameSettingsRow_ + 1) % rowCount;
+ dirty_ = true;
+ }
+ if (in.left || in.right) {
+ int dir = in.right ? 1 : -1;
+ switch (gameSettingsRow_) {
+ case 0:
+ activeGameHasCustom_ = !activeGameHasCustom_;
+ dirty_ = true;
+ break;
+ case 1: { // Upscaler (0 FSR, 2 FSR+clean, 1 AI, 3 AI+clean)
+ static constexpr int kOrder[4] = {0, 2, 1, 3};
+ int pos = 0;
+ for (int i = 0; i < 4; ++i) if (kOrder[i] == activeGameProfile_.upscaler) pos = i;
+ activeGameProfile_.upscaler = kOrder[(pos + 4 + dir) % 4];
+ activeGameHasCustom_ = true;
+ dirty_ = true;
+ break;
+ }
+ case 2: // Sharpness (0..3)
+ activeGameProfile_.sharpness = std::clamp(activeGameProfile_.sharpness + dir, 0, 3);
+ activeGameHasCustom_ = true;
+ dirty_ = true;
+ break;
+ case 3: // Deband (0..3)
+ activeGameProfile_.deband = std::clamp(activeGameProfile_.deband + dir, 0, 3);
+ activeGameHasCustom_ = true;
+ dirty_ = true;
+ break;
+ case 4: { // Resolution (1 = 720p, 0 = 1080p, 2 = Best (Auto))
+ static constexpr int kOrder[3] = {1, 0, 2};
+ int pos = 0;
+ for (int i = 0; i < 3; ++i) if (kOrder[i] == activeGameProfile_.resolution) pos = i;
+ activeGameProfile_.resolution = kOrder[(pos + 3 + dir) % 3];
+ activeGameHasCustom_ = true;
+ dirty_ = true;
+ break;
+ }
+ case 5: // Deadzone (0..30)
+ activeGameProfile_.deadzoneLeft = std::clamp(activeGameProfile_.deadzoneLeft + dir * 5, 0, 30);
+ activeGameProfile_.deadzoneRight = activeGameProfile_.deadzoneLeft;
+ activeGameHasCustom_ = true;
+ dirty_ = true;
+ break;
+ case 6: // Triggers (0..4)
+ activeGameProfile_.triggerStrength = std::clamp(activeGameProfile_.triggerStrength + dir, 0, 4);
+ activeGameHasCustom_ = true;
+ dirty_ = true;
+ break;
+ case 7: // Confirm button
+ activeGameProfile_.circleConfirms = !activeGameProfile_.circleConfirms;
+ activeGameHasCustom_ = true;
+ dirty_ = true;
+ break;
+ default: break;
+ }
+ }
+ if (in.accept) {
+ switch (gameSettingsRow_) {
+ case 0:
+ activeGameHasCustom_ = !activeGameHasCustom_;
+ dirty_ = true;
+ break;
+ case 1: {
+ static constexpr int kOrder[4] = {0, 2, 1, 3};
+ int pos = 0;
+ for (int i = 0; i < 4; ++i) if (kOrder[i] == activeGameProfile_.upscaler) pos = i;
+ activeGameProfile_.upscaler = kOrder[(pos + 1) % 4];
+ activeGameHasCustom_ = true;
+ dirty_ = true;
+ break;
+ }
+ case 2:
+ activeGameProfile_.sharpness = (activeGameProfile_.sharpness + 1) % 4;
+ activeGameHasCustom_ = true;
+ dirty_ = true;
+ break;
+ case 3:
+ activeGameProfile_.deband = (activeGameProfile_.deband + 1) % 4;
+ activeGameHasCustom_ = true;
+ dirty_ = true;
+ break;
+ case 4: {
+ static constexpr int kOrder[3] = {1, 0, 2};
+ int pos = 0;
+ for (int i = 0; i < 3; ++i) if (kOrder[i] == activeGameProfile_.resolution) pos = i;
+ activeGameProfile_.resolution = kOrder[(pos + 1) % 3];
+ activeGameHasCustom_ = true;
+ dirty_ = true;
+ break;
+ }
+ case 5: { // Open stick tester
+ tester_ = Tester::Sticks;
+ testerBackup_ = settings_;
+ settings_.deadzone[0] = activeGameProfile_.deadzoneLeft;
+ settings_.deadzone[1] = activeGameProfile_.deadzoneRight;
+ testerStick_ = 0;
+ dirty_ = true;
+ break;
+ }
+ case 6: { // Open trigger tester
+ tester_ = Tester::Triggers;
+ testerBackup_ = settings_;
+ settings_.triggerStrength = activeGameProfile_.triggerStrength;
+ settings_.triggerHz = activeGameProfile_.triggerHz;
+ settings_.triggerResistance = activeGameProfile_.triggerResistance;
+ settings_.triggerPulses = activeGameProfile_.triggerPulses;
+ testerRow_ = 0;
+ dirty_ = true;
+ break;
+ }
+ case 7:
+ activeGameProfile_.circleConfirms = !activeGameProfile_.circleConfirms;
+ activeGameHasCustom_ = true;
+ dirty_ = true;
+ break;
+ case 8: // Reset to default
+ activeGameHasCustom_ = false;
+ activeGameProfile_.sharpness = settings_.sharpness;
+ activeGameProfile_.deband = settings_.deband;
+ activeGameProfile_.upscaler = settings_.upscaler;
+ activeGameProfile_.resolution = settings_.resolution;
+ activeGameProfile_.deadzoneLeft = settings_.deadzone[0];
+ activeGameProfile_.deadzoneRight = settings_.deadzone[1];
+ activeGameProfile_.triggerStrength = settings_.triggerStrength;
+ activeGameProfile_.triggerHz = settings_.triggerHz;
+ activeGameProfile_.triggerResistance = settings_.triggerResistance;
+ activeGameProfile_.triggerPulses = settings_.triggerPulses;
+ activeGameProfile_.circleConfirms = settings_.circleConfirms;
+ gameSettingsRow_ = 0;
+ dirty_ = true;
+ break;
+ default: break;
+ }
+ }
+ if (in.back || in.options) {
+ gameSettingsOpen_ = false;
+ std::string key = app::gameProfileKey(detail_.productId, detail_.titleId);
+ if (activeGameHasCustom_) {
+ perGameSettings_[key] = activeGameProfile_;
+ } else {
+ perGameSettings_.erase(key);
+ }
+ ev.action = Action::GameSettingsChanged;
+ ev.game = detail_;
+ ev.hasGameProfile = activeGameHasCustom_;
+ ev.gameProfile = activeGameProfile_;
+ dirty_ = true;
+ }
+}
+
UiEvent AppUi::handle(const NavInput& in) {
std::lock_guard<std::mutex> lock(mutex_);
UiEvent ev;
@@ -1593,6 +1821,15 @@ UiEvent AppUi::handle(const NavInput& in) {
}
break;
case Screen::Details:
+ if (gameSettingsOpen_) {
+ handleGameSettings(in, ev);
+ break;
+ }
+ if (in.options) {
+ openGameSettings();
+ dirty_ = true;
+ break;
+ }
// A free game not on the account yet may already be (got on the
// phone a moment ago): Play tries, and the server says.
if (in.accept && (detail_.playable || detail_.freeInStore) && !detail_.titleId.empty()) {
@@ -2508,10 +2745,12 @@ void AppUi::drawDetails(Canvas& c, uint64_t nowMs) {
}
if (g->freeInStore)
drawHints(c, {{kIconCross, tr(Str::Play)},
+ {kIconOptions, tr(Str::GameSettings)},
{kIconSquare, tr(hidden_.count(g->productId) ? Str::Unhide : Str::Hide)},
{kIconCircle, tr(Str::Back)}});
else
- drawHints(c, {{kIconSquare, tr(hidden_.count(g->productId) ? Str::Unhide : Str::Hide)},
+ drawHints(c, {{kIconOptions, tr(Str::GameSettings)},
+ {kIconSquare, tr(hidden_.count(g->productId) ? Str::Unhide : Str::Hide)},
{kIconCircle, tr(Str::Back)}});
drawToast(c, nowMs);
return;
@@ -2522,7 +2761,9 @@ void AppUi::drawDetails(Canvas& c, uint64_t nowMs) {
c.fillRect(note, rgba(255, 255, 255, 40), 38);
drawLock(c, note.x + 52, note.y + note.h / 2);
fonts_.semibold.draw(c, tr(Str::NotPlayable), note.x + 90, note.y + 22, 28, kGray);
- drawHints(c, {{kIconSquare, tr(hidden_.count(g->productId) ? Str::Unhide : Str::Hide)}, {kIconCircle, tr(Str::Back)}});
+ drawHints(c, {{kIconOptions, tr(Str::GameSettings)},
+ {kIconSquare, tr(hidden_.count(g->productId) ? Str::Unhide : Str::Hide)},
+ {kIconCircle, tr(Str::Back)}});
drawToast(c, nowMs);
return;
}
@@ -2536,6 +2777,7 @@ void AppUi::drawDetails(Canvas& c, uint64_t nowMs) {
c.line(tx - 8, ty + 13, tx + 13, ty, 4, kWhite);
fonts_.semibold.draw(c, tr(Str::Play), play.x + 108, play.y + 20, 32, kWhite);
drawHints(c, {{kIconCross, tr(Str::Play)},
+ {kIconOptions, tr(Str::GameSettings)},
{kIconSquare, tr(hidden_.count(g->productId) ? Str::Unhide : Str::Hide)},
{kIconCircle, tr(Str::Back)}});
drawToast(c, nowMs);
@@ -2915,6 +3157,122 @@ void AppUi::drawSignOutHold(Canvas& c, uint64_t nowMs) {
animating_ = true;
}
+void AppUi::drawGameSettings(Canvas& c) {
+ if (tester_ == Tester::Sticks) {
+ drawStickTester(c);
+ return;
+ }
+ if (tester_ == Tester::Triggers) {
+ drawTriggerTester(c);
+ return;
+ }
+ std::string title = tr(Str::GameSettings);
+ if (!detail_.name.empty()) {
+ std::string full = title + " \xE2\x80\xA2 " + detail_.name;
+ if (fonts_.bold.measure(full, 40) <= 960) {
+ title = full;
+ } else {
+ std::string cut = detail_.name;
+ while (!cut.empty() && fonts_.bold.measure(title + " \xE2\x80\xA2 " + cut + "...", 40) > 960) {
+ do {
+ cut.pop_back();
+ } while (!cut.empty() && (static_cast<uint8_t>(cut.back()) & 0xC0) == 0x80);
+ }
+ title = title + " \xE2\x80\xA2 " + cut + "...";
+ }
+ }
+ constexpr int kModalW = 1140, kModalH = 740;
+ Rect panel = drawModal(c, kModalW, kModalH, title);
+
+ int rowCount = activeGameHasCustom_ ? 9 : 8;
+ constexpr int kRowH = 52, kGap = 8;
+ int y = panel.y + 110;
+
+ for (int i = 0; i < rowCount; ++i) {
+ Rect r{panel.x + 50, y, panel.w - 100, kRowH};
+ bool focused = (i == gameSettingsRow_);
+ c.fillRect(r, focused ? rgba(255, 255, 255, 36) : rgba(255, 255, 255, 14), 14);
+ if (focused) c.strokeRect({r.x - 4, r.y - 4, r.w + 8, r.h + 8}, kWhite, 2, 18);
+
+ int ty = fonts_.semibold.centeredY(r.y, r.h, 26);
+
+ if (i == 8) {
+ const char* resetLabel = tr(Str::ResetToDefault);
+ int tw = fonts_.semibold.measure(resetLabel, 26);
+ fonts_.semibold.draw(c, resetLabel, r.x + (r.w - tw) / 2, ty, 26, focused ? kWhite : rgba(240, 100, 100));
+ y += kRowH + kGap;
+ continue;
+ }
+
+ const char* label = "";
+ std::string value;
+
+ switch (i) {
+ case 0:
+ label = tr(Str::Profile);
+ value = tr(activeGameHasCustom_ ? Str::ProfileCustom : Str::ProfileDefault);
+ break;
+ case 1:
+ label = tr(Str::MenuUpscaler);
+ value = activeGameProfile_.upscaler == 3 ? tr(Str::UpscalerAiClean)
+ : activeGameProfile_.upscaler == 2 ? tr(Str::UpscalerFsrClean)
+ : activeGameProfile_.upscaler == 1 ? tr(Str::UpscalerAi)
+ : "FSR";
+ break;
+ case 2: {
+ label = tr(Str::MenuSharpness);
+ static constexpr Str kLevels[] = {Str::SharpOff, Str::SharpLow, Str::SharpMedium, Str::SharpHigh};
+ value = tr(kLevels[std::clamp(activeGameProfile_.sharpness, 0, 3)]);
+ break;
+ }
+ case 3: {
+ label = tr(Str::MenuDeband);
+ static constexpr Str kLevels[] = {Str::SharpOff, Str::SharpLow, Str::SharpHigh};
+ value = activeGameProfile_.deband == 3 ? "Auto"
+ : tr(kLevels[std::clamp(activeGameProfile_.deband, 0, 2)]);
+ break;
+ }
+ case 4:
+ label = tr(Str::Resolution);
+ value = activeGameProfile_.resolution == 1 ? "720p" : activeGameProfile_.resolution == 2 ? tr(Str::ResBest) : "1080p";
+ break;
+ case 5:
+ label = tr(Str::Deadzone);
+ value = std::to_string(activeGameProfile_.deadzoneLeft) + " %";
+ break;
+ case 6: {
+ label = tr(Str::TriggerRumble);
+ static constexpr Str kStrengths[] = {Str::Deactivated, Str::TriggerLight, Str::TriggerMedium,
+ Str::TriggerStrong, Str::TriggerMax};
+ value = tr(kStrengths[std::clamp(activeGameProfile_.triggerStrength, 0, 4)]);
+ break;
+ }
+ case 7:
+ label = tr(Str::ConfirmButton);
+ break;
+ default: break;
+ }
+
+ fonts_.semibold.draw(c, label, r.x + 28, ty, 26, kWhite);
+
+ if (i == 7) {
+ float cx = static_cast<float>(r.x + r.w - 50), cy = static_cast<float>(r.y + r.h / 2);
+ if (focused) {
+ fonts_.regular.draw(c, "\xE2\x80\xB9", static_cast<int>(cx) - 40, fonts_.regular.centeredY(r.y, r.h, 26), 26, kWhite);
+ fonts_.regular.draw(c, "\xE2\x80\xBA", static_cast<int>(cx) + 28, fonts_.regular.centeredY(r.y, r.h, 26), 26, kWhite);
+ }
+ drawFaceButton(c, activeGameProfile_.circleConfirms ? kIconCircle : kIconCross, cx, cy, 16);
+ } else {
+ std::string disp = focused ? ("\xE2\x80\xB9 " + value + " \xE2\x80\xBA") : value;
+ int vw = fonts_.regular.measure(disp, 26);
+ fonts_.regular.draw(c, disp, r.x + r.w - 28 - vw, fonts_.regular.centeredY(r.y, r.h, 26), 26,
+ focused ? kWhite : kGray);
+ }
+
+ y += kRowH + kGap;
+ }
+}
+
void AppUi::render(Canvas& c, uint64_t nowMs) {
std::lock_guard<std::mutex> lock(mutex_);
float dt = lastRender_ ? std::min(0.1f, (nowMs - lastRender_) / 1000.0f) : 0.0f;
@@ -2928,7 +3286,10 @@ void AppUi::render(Canvas& c, uint64_t nowMs) {
case Screen::Splash: drawSplash(c, nowMs); break;
case Screen::SignIn: drawSignIn(c, nowMs); break;
case Screen::Home: drawHome(c, nowMs); break;
- case Screen::Details: drawDetails(c, nowMs); break;
+ case Screen::Details:
+ drawDetails(c, nowMs);
+ if (gameSettingsOpen_) drawGameSettings(c);
+ break;
case Screen::Launching: drawLaunching(c, nowMs); break;
case Screen::Error: drawError(c); break;
case Screen::Settings: drawSettings(c); break;
diff --git a/src/ui/app_ui.h b/src/ui/app_ui.h
index 6d9c538..70deb0f 100644
--- a/src/ui/app_ui.h
+++ b/src/ui/app_ui.h
@@ -8,6 +8,7 @@
// Model setters are thread-safe; handle() and render() run on the UI thread.
#pragma once
+#include "app/settings.h"
#include "ui/canvas.h"
#include "ui/font.h"
#include "ui/image_cache.h"
@@ -101,6 +102,9 @@ struct SettingsChoice {
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);
+ int sharpness = 0;
+ int deband = 3;
+ int upscaler = 2;
};
// The largest stick dead zone Settings offers, in percent of the travel.
@@ -111,7 +115,8 @@ constexpr int kSettingRows = 8; // language, resolution, region, dead zone, tri
// (with the settings, saved first when it came from Settings) / UpdateLater:
// the answer to the update pop-up, or Updates in Settings.
enum class Action {
- None, Play, SignOut, Retry, CancelLaunch, SettingsChanged, PrefsChanged, ConsolesShown, UpdateNow, UpdateLater
+ None, Play, SignOut, Retry, CancelLaunch, SettingsChanged, PrefsChanged, ConsolesShown, UpdateNow, UpdateLater,
+ GameSettingsChanged
};
// How "Your games" is sorted (R3).
@@ -127,6 +132,8 @@ struct UiEvent {
Action action = Action::None;
GameTile game;
SettingsChoice settings; // SettingsChanged
+ app::GameProfile gameProfile; // GameSettingsChanged
+ bool hasGameProfile = false;
// PrefsChanged: hidden games (product ids) and the "Your games" order.
std::vector<std::string> hidden;
LibrarySort librarySort = LibrarySort::Recent;
@@ -177,6 +184,8 @@ public:
void showDetails(const GameTile& tile);
// The `index`-th game to buy, if loaded (autoplay tests).
bool purchasableAt(size_t index, GameTile& out) const;
+ // Any loaded game on the home screen or catalog.
+ bool firstTile(GameTile& out) const;
// The game with this xCloud title id on the home screen or in Your games.
bool findTile(const std::string& titleId, GameTile& out) const;
void showHome(const std::string& toast = {});
@@ -188,6 +197,11 @@ public:
// on the phone meanwhile): Cross plays it again, Circle opens its page.
void showPlayError(const std::string& message, const GameTile& game);
void setSettings(const SettingsChoice& choice);
+ // Per-game settings
+ void setPerGameSettings(const std::map<std::string, app::GameProfile>& perGame);
+ bool gameSettingsOpen() const { return gameSettingsOpen_; }
+ void openGameSettings();
+ void closeGameSettings();
// Whether 1440p is offered (a stream delivered it); false hides it.
void setAllow1440(bool on);
// The confirm button in force (the hints show it); Settings may be
@@ -430,6 +444,13 @@ private:
uint64_t heroShownAt_ = 0; // when its image first drew (0: not yet)
uint64_t lastRender_ = 0;
bool animating_ = false;
+ std::map<std::string, app::GameProfile> perGameSettings_;
+ bool gameSettingsOpen_ = false;
+ int gameSettingsRow_ = 0;
+ app::GameProfile activeGameProfile_;
+ bool activeGameHasCustom_ = false;
+ void handleGameSettings(const NavInput& in, UiEvent& ev);
+ void drawGameSettings(Canvas& c);
};
} // namespace xc::ui
diff --git a/src/ui/stream_menu.cpp b/src/ui/stream_menu.cpp
index 1fe50df..9c68135 100644
--- a/src/ui/stream_menu.cpp
+++ b/src/ui/stream_menu.cpp
@@ -20,7 +20,7 @@ constexpr Color kGreen = rgba(16, 124, 16);
// Left to right on the resolution row: SettingsChoice::resolution values.
constexpr int kResolutionOrder[] = {1, 0, 2};
-const char* resolutionName(int r) { return r == 1 ? "720p" : r == 2 ? "1440p" : "1080p"; }
+const char* resolutionName(int r) { return r == 1 ? "720p" : r == 2 ? tr(Str::ResBest) : "1080p"; }
std::string fmt(const char* f, double v) {
char b[32];
@@ -30,16 +30,33 @@ std::string fmt(const char* f, double v) {
} // namespace
+void StreamMenu::setProfileValues(int resolution, int sharpness, int deband, int upscaler,
+ int triggerStrength, int deadzone, bool circleConfirms,
+ bool hasCustomProfile) {
+ resolution_ = applied_ = resolution;
+ sharpness_ = sharpness;
+ deband_ = deband;
+ upscaler_ = upscaler;
+ triggerStrength_ = triggerStrength;
+ deadzone_ = deadzone;
+ circleConfirms_ = circleConfirms;
+ hasCustomProfile_ = hasCustomProfile;
+}
+
void StreamMenu::open(int resolution, bool stats, int sharpness, int deband, int upscaler, bool homeConsole,
- bool allow1440) {
+ bool allow1440, bool hasCustomProfile, int triggerStrength, int deadzone,
+ bool circleConfirms) {
open_ = true;
homeConsole_ = homeConsole;
allow1440_ = allow1440;
- if (resolution == 2 && !allow1440) resolution = 0;
stats_ = stats;
sharpness_ = sharpness;
deband_ = deband;
upscaler_ = upscaler;
+ hasCustomProfile_ = hasCustomProfile;
+ triggerStrength_ = triggerStrength;
+ deadzone_ = deadzone;
+ circleConfirms_ = circleConfirms;
selected_ = XboxButton;
resolution_ = applied_ = resolution;
resolutionAsked_ = false;
@@ -53,9 +70,13 @@ MenuAction StreamMenu::handle(const NavInput& in) {
}
if (in.up) selected_ = (selected_ + ItemCount - 1) % ItemCount;
if (in.down) selected_ = (selected_ + 1) % ItemCount;
+ if (selected_ == Profile && (in.left || in.right || in.accept)) {
+ hasCustomProfile_ = !hasCustomProfile_;
+ return MenuAction::ProfileToggle;
+ }
if (selected_ == Resolution && (in.left || in.right)) {
int pos = 0;
- int n = allow1440_ ? 3 : 2; // 720p, 1080p (, 1440p)
+ int n = 3; // 720p, 1080p, Best (Auto)
for (int i = 0; i < n; ++i)
if (kResolutionOrder[i] == resolution_) pos = i;
pos = in.left ? (pos + n - 1) % n : (pos + 1) % n;
@@ -79,6 +100,19 @@ MenuAction StreamMenu::handle(const NavInput& in) {
deband_ = in.left ? (deband_ + 3) % 4 : (deband_ + 1) % 4;
return MenuAction::Deband;
}
+ if (selected_ == Triggers && (in.left || in.right || in.accept)) {
+ triggerStrength_ = in.left ? (triggerStrength_ + 4) % 5 : (triggerStrength_ + 1) % 5;
+ return MenuAction::Triggers;
+ }
+ if (selected_ == DeadzoneItem && (in.left || in.right)) {
+ if (in.left && deadzone_ > 0) deadzone_ -= 5;
+ else if (in.right && deadzone_ < 30) deadzone_ += 5;
+ return MenuAction::Deadzone;
+ }
+ if (selected_ == ConfirmItem && (in.left || in.right || in.accept)) {
+ circleConfirms_ = !circleConfirms_;
+ return MenuAction::ConfirmButton;
+ }
if (selected_ == Stats && (in.left || in.right)) {
stats_ = !stats_;
return MenuAction::Stats;
@@ -101,26 +135,34 @@ Canvas StreamMenu::renderMenu(const StreamInfo& info) const {
c.clear(kPanel);
c.fillRect({0, 0, kMenuW, 6}, kGreen);
constexpr int kPad = 40;
- fonts_.bold.draw(c, tr(Str::MenuTitle), kPad, 40, 34, kWhite);
+ fonts_.bold.draw(c, tr(Str::MenuTitle), kPad, 38, 32, kWhite);
// The items: the selected one white, like the Xbox guide.
- constexpr int kRowH = 54, kTop = 108, kPx = 24;
+ constexpr int kRowH = 46, kTop = 96, kPx = 22;
for (int i = 0; i < ItemCount; ++i) {
- Rect row{kPad - 16, kTop + i * kRowH, kMenuW - 2 * (kPad - 16), kRowH - 8};
+ Rect row{kPad - 16, kTop + i * kRowH, kMenuW - 2 * (kPad - 16), kRowH - 6};
bool sel = i == selected_;
if (sel) c.fillRect(row, kWhite, 8);
Color fg = sel ? kDark : kWhite;
int ty = fonts_.semibold.centeredY(row.y, row.h, kPx);
- const char* label = i == XboxButton ? tr(Str::MenuXboxButton)
- : i == Stats ? tr(Str::MenuStats)
- : i == Sharpness ? tr(Str::MenuSharpness)
- : i == Deband ? tr(Str::MenuDeband)
- : i == Upscaler ? tr(Str::MenuUpscaler)
- : i == Resolution ? tr(Str::MenuResolution)
- : homeConsole_ ? tr(Str::MenuEndStream)
- : tr(Str::MenuLeave);
+ const char* label = i == XboxButton ? tr(Str::MenuXboxButton)
+ : i == Profile ? tr(Str::Profile)
+ : i == Stats ? tr(Str::MenuStats)
+ : i == Sharpness ? tr(Str::MenuSharpness)
+ : i == Deband ? tr(Str::MenuDeband)
+ : i == Upscaler ? tr(Str::MenuUpscaler)
+ : i == Resolution ? tr(Str::MenuResolution)
+ : i == Triggers ? tr(Str::TriggerRumble)
+ : i == DeadzoneItem ? tr(Str::Deadzone)
+ : i == ConfirmItem ? tr(Str::ConfirmButton)
+ : homeConsole_ ? tr(Str::MenuEndStream)
+ : tr(Str::MenuLeave);
fonts_.semibold.draw(c, label, row.x + 16, ty, kPx, fg);
std::string value;
+ if (i == Profile) {
+ value = tr(hasCustomProfile_ ? Str::ProfileCustom : Str::ProfileDefault);
+ if (sel) value = "< " + value + " >";
+ }
if (i == Stats) value = tr(stats_ ? Str::On : Str::Off);
if (i == Sharpness) {
static constexpr Str kLevels[] = {Str::SharpOff, Str::SharpLow, Str::SharpMedium, Str::SharpHigh};
@@ -144,23 +186,40 @@ Canvas StreamMenu::renderMenu(const StreamInfo& info) const {
value = resolutionName(resolution_);
if (sel) value = "< " + value + " >";
}
+ if (i == Triggers) {
+ static constexpr Str kStrengths[] = {Str::Deactivated, Str::TriggerLight, Str::TriggerMedium,
+ Str::TriggerStrong, Str::TriggerMax};
+ value = tr(kStrengths[std::clamp(triggerStrength_, 0, 4)]);
+ if (sel) value = "< " + value + " >";
+ }
+ if (i == DeadzoneItem) {
+ value = std::to_string(deadzone_) + " %";
+ if (sel) value = "< " + value + " >";
+ }
+ if (i == ConfirmItem) {
+ value = circleConfirms_ ? "○" : "×";
+ if (sel) value = "< " + value + " >";
+ }
if (!value.empty()) {
int w = fonts_.semibold.measure(value, kPx);
fonts_.semibold.draw(c, value, row.x + row.w - 16 - w, ty, kPx, sel ? kDark : kGray);
}
}
- int y = kTop + ItemCount * kRowH;
- if (resolutionAsked_) fonts_.regular.draw(c, tr(Str::ResolutionNote), kPad, y, 18, kDim);
- y += 40;
+ int y = kTop + ItemCount * kRowH + 6;
+ if (resolutionAsked_) {
+ fonts_.regular.draw(c, tr(Str::ResolutionNote), kPad, y, 18, kDim);
+ y += 26;
+ }
+ y += 10;
// The connection.
c.fillRect({kPad, y, kMenuW - 2 * kPad, 2}, rgba(60, 60, 60));
- y += 22;
+ y += 18;
auto line = [&](Str label, const std::string& value) {
- fonts_.regular.draw(c, tr(label), kPad, y, 22, kGray);
- int w = fonts_.semibold.measure(value, 22);
- fonts_.semibold.draw(c, value, kMenuW - kPad - w, y, 22, kWhite);
- y += 36;
+ fonts_.regular.draw(c, tr(label), kPad, y, 20, kGray);
+ int w = fonts_.semibold.measure(value, 20);
+ fonts_.semibold.draw(c, value, kMenuW - kPad - w, y, 20, kWhite);
+ y += 30;
};
const std::string none = "-";
line(Str::StatRegion, info.region.empty() ? none : info.region);
diff --git a/src/ui/stream_menu.h b/src/ui/stream_menu.h
index ecac1d4..0f2f521 100644
--- a/src/ui/stream_menu.h
+++ b/src/ui/stream_menu.h
@@ -24,7 +24,10 @@ struct StreamInfo {
};
// Close: the menu went away (Circle, OPTIONS, or the Xbox button): a fresh key frame is asked for.
-enum class MenuAction { None, Close, Leave, Resolution, Stats, Sharpness, Deband, Upscaler, XboxButton };
+enum class MenuAction {
+ None, Close, Leave, Resolution, Stats, Sharpness, Deband, Upscaler, XboxButton,
+ ProfileToggle, Triggers, Deadzone, ConfirmButton
+};
class StreamMenu {
public:
@@ -41,7 +44,8 @@ public:
// `homeConsole`: the user's own Xbox ("End the stream" instead of "Leave the game").
// `allow1440`: offered only once a stream delivered it.
void open(int resolution, bool stats, int sharpness = 0, int deband = 1, int upscaler = 0, bool homeConsole = false,
- bool allow1440 = true);
+ bool allow1440 = true, bool hasCustomProfile = false, int triggerStrength = 2, int deadzone = 15,
+ bool circleConfirms = false);
void close() { open_ = false; }
bool isOpen() const { return open_; }
MenuAction handle(const NavInput& in);
@@ -50,10 +54,21 @@ public:
int sharpness() const { return sharpness_; }
int deband() const { return deband_; }
int upscaler() const { return upscaler_; }
+ bool hasCustomProfile() const { return hasCustomProfile_; }
+ void setHasCustomProfile(bool custom) { hasCustomProfile_ = custom; }
+ int triggerStrength() const { return triggerStrength_; }
+ void setTriggerStrength(int strength) { triggerStrength_ = strength; }
+ int deadzone() const { return deadzone_; }
+ void setDeadzone(int deadzone) { deadzone_ = deadzone; }
+ bool circleConfirms() const { return circleConfirms_; }
+ void setCircleConfirms(bool cc) { circleConfirms_ = cc; }
// The block smoothing level "auto" picked for the bitrate (shown as "Auto (low)").
void setDebandInUse(int level) { debandInUse_ = level; }
// Circle confirms: the hints swap their buttons.
- void setCircleConfirms(bool on) { circleConfirms_ = on; }
+ // Update active profile values without resetting cursor position.
+ void setProfileValues(int resolution, int sharpness, int deband, int upscaler,
+ int triggerStrength, int deadzone, bool circleConfirms,
+ bool hasCustomProfile);
// The controllers in use, under the connection.
void setPads(const PadSlots& pads) { pads_ = pads; }
@@ -61,7 +76,20 @@ public:
Canvas renderStats(const StreamInfo& info) const;
private:
- enum Item { XboxButton, Stats, Upscaler, Sharpness, Deband, Resolution, Leave, ItemCount };
+ enum Item {
+ XboxButton,
+ Profile,
+ Stats,
+ Upscaler,
+ Sharpness,
+ Deband,
+ Resolution,
+ Triggers,
+ DeadzoneItem,
+ ConfirmItem,
+ Leave,
+ ItemCount
+ };
const Fonts& fonts_;
bool open_ = false, stats_ = false;
@@ -71,6 +99,9 @@ private:
bool resolutionAsked_ = false;
bool circleConfirms_ = false;
bool homeConsole_ = false, allow1440_ = true;
+ bool hasCustomProfile_ = false;
+ int triggerStrength_ = 2;
+ int deadzone_ = 15;
PadSlots pads_{};
};
diff --git a/src/ui/strings.cpp b/src/ui/strings.cpp
index 9fe7c5d..3d96ba3 100644
--- a/src/ui/strings.cpp
+++ b/src/ui/strings.cpp
@@ -67,7 +67,7 @@ constexpr Column kEnglish = {
"Automatic (%s)", // RegionAuto
"1080p (Full HD)", // Res1080
"720p (uses less data)", // Res720
- "1440p (experimental, where available)", // Res1440
+ "Best (Auto)", // ResBest
"Resolution and region apply to the next game you start.", // SettingsNote
"Change", // Change
"Hold to sign out", // HoldSignOut
@@ -226,6 +226,11 @@ constexpr Column kEnglish = {
"English", // LanguageNoun
"Subtitles in %s", // LangSubtitles
"Audio in %s", // LangAudio
+ "Game settings", // GameSettings
+ "Profile", // Profile
+ "Default", // ProfileDefault
+ "Custom", // ProfileCustom
+ "Reset to default", // ResetToDefault
};
constexpr Column kPortugueseBR = {
@@ -263,7 +268,7 @@ constexpr Column kPortugueseBR = {
"Automática (%s)",
"1080p (Full HD)",
"720p (usa menos dados)",
- "1440p (experimental, onde disponível)",
+ "Melhor (Auto)",
"A resolução e a região valem a partir do próximo jogo.",
"Alterar",
"Segure para sair da conta",
@@ -422,6 +427,11 @@ constexpr Column kPortugueseBR = {
"português",
"Legendas em %s",
"Dublado em %s",
+ "Configurações do jogo",
+ "Perfil",
+ "Padrão",
+ "Personalizado",
+ "Restaurar padrão",
};
constexpr Column kSpanish = {
@@ -459,7 +469,7 @@ constexpr Column kSpanish = {
"Automática (%s)",
"1080p (Full HD)",
"720p (usa menos datos)",
- "1440p (experimental, donde esté disponible)",
+ "Mejor (Auto)",
"La resolución y la región se aplican al próximo juego que inicies.",
"Cambiar",
"Mantén para cerrar sesión",
@@ -618,6 +628,11 @@ constexpr Column kSpanish = {
"español",
"Subtítulos en %s",
"Doblado al %s",
+ "Ajustes del juego",
+ "Perfil",
+ "Predeterminado",
+ "Personalizado",
+ "Restaurar predeterminado",
};
constexpr Column kFrench = {
@@ -655,7 +670,7 @@ constexpr Column kFrench = {
"Automatique (%s)",
"1080p (Full HD)",
"720p (consomme moins de données)",
- "1440p (expérimental, si disponible)",
+ "Meilleure (Auto)",
"La résolution et la région s'appliquent au prochain jeu lancé.",
"Modifier",
"Maintenez pour vous déconnecter",
@@ -814,6 +829,11 @@ constexpr Column kFrench = {
"français",
"Sous-titres en %s",
"Doublé en %s",
+ "Paramètres du jeu",
+ "Profil",
+ "Par défaut",
+ "Personnalisé",
+ "Réinitialiser",
};
constexpr Column kGerman = {
@@ -851,7 +871,7 @@ constexpr Column kGerman = {
"Automatisch (%s)",
"1080p (Full HD)",
"720p (verbraucht weniger Daten)",
- "1440p (experimentell, wo verfügbar)",
+ "Beste (Auto)",
"Auflösung und Region gelten ab dem nächsten gestarteten Spiel.",
"Ändern",
"Halten zum Abmelden",
@@ -1010,6 +1030,11 @@ constexpr Column kGerman = {
"Deutsch",
"Untertitel: %s",
"Sprachausgabe: %s",
+ "Spieleinstellungen",
+ "Profil",
+ "Standard",
+ "Benutzerdefiniert",
+ "Auf Standard zurücksetzen",
};
constexpr Column kItalian = {
@@ -1047,7 +1072,7 @@ constexpr Column kItalian = {
"Automatica (%s)",
"1080p (Full HD)",
"720p (usa meno dati)",
- "1440p (sperimentale, dove disponibile)",
+ "Migliore (Auto)",
"Risoluzione e regione valgono dal prossimo gioco avviato.",
"Cambia",
"Tieni premuto per uscire",
@@ -1206,6 +1231,11 @@ constexpr Column kItalian = {
"italiano",
"Sottotitoli in %s",
"Doppiato in %s",
+ "Impostazioni di gioco",
+ "Profilo",
+ "Predefinito",
+ "Personalizzato",
+ "Ripristina predefiniti",
};
constexpr std::array<const Column*, kLangs> kTable = {&kEnglish, &kPortugueseBR, &kSpanish,
diff --git a/src/ui/strings.h b/src/ui/strings.h
index 7c6eae9..5d1dae4 100644
--- a/src/ui/strings.h
+++ b/src/ui/strings.h
@@ -44,7 +44,7 @@ enum class Str {
RegionAuto, // "%s" = the account's default region
Res1080,
Res720,
- Res1440,
+ ResBest,
SettingsNote,
Change,
HoldSignOut,
@@ -203,6 +203,11 @@ enum class Str {
LanguageNoun, // this language's name, as the filters say it
LangSubtitles, // "%s" = LanguageNoun: subtitles or menus in it
LangAudio, // "%s" = LanguageNoun: spoken in it
+ GameSettings, // game details hint and game settings modal title
+ Profile, // game menu and settings: profile row
+ ProfileDefault, // global/default profile
+ ProfileCustom, // per-game custom profile
+ ResetToDefault, // button to reset per-game profile to general settings
Count
};
diff --git a/tests/test_main.cpp b/tests/test_main.cpp
index 786d673..3cfe8ed 100644
--- a/tests/test_main.cpp
+++ b/tests/test_main.cpp
@@ -258,6 +258,76 @@ static void testSettingsMigration() {
std::remove(path.c_str());
}
+static void testPerGameSettings() {
+ std::string path = "/tmp/xcloud-tests-pergame.json";
+ xc::app::Settings s;
+ s.sharpness = 1;
+ s.deband = 2;
+ s.upscaler = 0;
+ s.deadzoneLeft = 12;
+ s.deadzoneRight = 18;
+ s.triggerStrength = 3;
+ s.circleConfirms = false;
+
+ // Default profile reflects global settings.
+ auto def = s.defaultProfile();
+ CHECK(def.sharpness == 1 && def.deband == 2 && def.upscaler == 0);
+ CHECK(def.deadzoneLeft == 12 && def.deadzoneRight == 18 && def.triggerStrength == 3);
+ CHECK(!def.circleConfirms);
+
+ // Unknown games return default profile with hasCustom = false.
+ bool hasCustom = true;
+ auto prof1 = s.profileForGame("GAME1", "", &hasCustom);
+ CHECK(!hasCustom);
+ CHECK(prof1.sharpness == 1 && prof1.deadzoneLeft == 12);
+
+ // Add per-game profile for GAME1.
+ xc::app::GameProfile p1;
+ p1.sharpness = 3;
+ p1.deband = 0;
+ p1.upscaler = 3;
+ p1.deadzoneLeft = 5;
+ p1.deadzoneRight = 8;
+ p1.triggerStrength = 1;
+ p1.circleConfirms = true;
+ s.perGame["GAME1"] = p1;
+
+ // Now GAME1 returns custom profile, while GAME2 still returns defaults.
+ auto prof1Custom = s.profileForGame("GAME1", "", &hasCustom);
+ CHECK(hasCustom);
+ CHECK(prof1Custom.sharpness == 3 && prof1Custom.upscaler == 3 && prof1Custom.circleConfirms);
+ CHECK(prof1Custom.deadzoneLeft == 5 && prof1Custom.triggerStrength == 1);
+
+ hasCustom = true;
+ auto prof2 = s.profileForGame("GAME2", "", &hasCustom);
+ CHECK(!hasCustom);
+ CHECK(prof2.sharpness == 1 && !prof2.circleConfirms);
+
+ // Title ID fallback when productId is empty.
+ s.perGame["CONSOLE_SERVER_1"] = p1;
+ auto consoleProf = s.profileForGame("", "CONSOLE_SERVER_1", &hasCustom);
+ CHECK(hasCustom);
+ CHECK(consoleProf.sharpness == 3 && consoleProf.circleConfirms);
+
+ // Save to disk and reload.
+ CHECK(s.save(path));
+ xc::app::Settings reloaded;
+ CHECK(reloaded.load(path));
+ CHECK(reloaded.perGame.size() == 2);
+ auto loadedP1 = reloaded.profileForGame("GAME1", "", &hasCustom);
+ CHECK(hasCustom);
+ CHECK(loadedP1.sharpness == 3 && loadedP1.upscaler == 3 && loadedP1.circleConfirms);
+ CHECK(loadedP1.deadzoneLeft == 5 && loadedP1.deadzoneRight == 8 && loadedP1.triggerStrength == 1);
+
+ // Remove game profile restores default.
+ reloaded.perGame.erase("GAME1");
+ auto afterErase = reloaded.profileForGame("GAME1", "", &hasCustom);
+ CHECK(!hasCustom);
+ CHECK(afterErase.sharpness == reloaded.sharpness);
+
+ std::remove(path.c_str());
+}
+
static void testStreamMenu() {
using xc::ui::MenuAction;
xc::ui::Fonts fonts; // not loaded: handle() never draws
@@ -274,6 +344,9 @@ static void testStreamMenu() {
CHECK(!menu.isOpen());
menu.open(0, false);
press([](xc::ui::NavInput& n) { n.down = true; });
+ CHECK(press([](xc::ui::NavInput& n) { n.right = true; }) == MenuAction::ProfileToggle);
+ CHECK(menu.hasCustomProfile());
+ press([](xc::ui::NavInput& n) { n.down = true; });
CHECK(press([](xc::ui::NavInput& n) { n.right = true; }) == MenuAction::Stats);
CHECK(menu.statsOn());
press([](xc::ui::NavInput& n) { n.down = true; });
@@ -299,19 +372,27 @@ static void testStreamMenu() {
press([](xc::ui::NavInput& n) { n.left = true; }); // wraps to 1440p
CHECK(menu.resolution() == 2);
CHECK(press([](xc::ui::NavInput& n) { n.accept = true; }) == MenuAction::Resolution);
+ press([](xc::ui::NavInput& n) { n.down = true; });
+ CHECK(press([](xc::ui::NavInput& n) { n.right = true; }) == MenuAction::Triggers);
+ press([](xc::ui::NavInput& n) { n.down = true; });
+ CHECK(press([](xc::ui::NavInput& n) { n.right = true; }) == MenuAction::Deadzone);
+ press([](xc::ui::NavInput& n) { n.down = true; });
+ CHECK(press([](xc::ui::NavInput& n) { n.right = true; }) == MenuAction::ConfirmButton);
press([](xc::ui::NavInput& n) { n.down = true; }); // "Leave game", last
CHECK(press([](xc::ui::NavInput& n) { n.accept = true; }) == MenuAction::Leave);
CHECK(!menu.isOpen());
menu.open(1, true);
CHECK(press([](xc::ui::NavInput& n) { n.back = true; }) == MenuAction::Close);
- // 1440p not offered: a saved 1440p shows as 1080p, and the row cycles 720p / 1080p.
+ // Best (Auto) offered as resolution 2; cycling is 720p (1) -> 1080p (0) -> Best (2).
menu.open(2, false, 0, 1, 0, false, false);
- CHECK(menu.resolution() == 0);
- for (int i = 0; i < 5; ++i) press([](xc::ui::NavInput& n) { n.down = true; }); // to the resolution
+ CHECK(menu.resolution() == 2);
+ for (int i = 0; i < 6; ++i) press([](xc::ui::NavInput& n) { n.down = true; }); // to the resolution
+ press([](xc::ui::NavInput& n) { n.right = true; });
+ CHECK(menu.resolution() == 1); // Best (2) -> wraps to 720p (1)
press([](xc::ui::NavInput& n) { n.right = true; });
- CHECK(menu.resolution() == 1); // 1080p -> wraps to 720p
+ CHECK(menu.resolution() == 0); // 720p -> 1080p
press([](xc::ui::NavInput& n) { n.right = true; });
- CHECK(menu.resolution() == 0); // back to 1080p, never 1440p
+ CHECK(menu.resolution() == 2); // 1080p -> Best (2)
}
// A zip archive of stored (uncompressed) files, as the test needs one.
@@ -456,6 +537,7 @@ int main() {
testVersions();
testStreamMenu();
testSettingsMigration();
+ testPerGameSettings();
testStrings();
testRegions();
testPrices();