Skip to content

Xbox Cloud Gaming app for PS5 Homebrew

C

Settings: stream resolutions listed lowest first

Rafael Abud Ferreira07c28e81b090
diff --git a/src/app/cli_main.cpp b/src/app/cli_main.cpp
index b5ad9ab..1dad56a 100644
--- a/src/app/cli_main.cpp
+++ b/src/app/cli_main.cpp
@@ -581,6 +581,10 @@ int main(int argc, char** argv) {
press([](ui::NavInput& n) { n.accept = true; });
press([](ui::NavInput& n) { n.down = true; });
save("settings_language");
+ press([](ui::NavInput& n) { n.back = true; });
+ press([](ui::NavInput& n) { n.down = true; });
+ press([](ui::NavInput& n) { n.accept = true; });
+ save("settings_resolution");
return 0;
} else if (cmd == "ui-badges" && argi < argc) {
// Offline: cards with every badge, to check their layout.
diff --git a/src/ui/app_ui.cpp b/src/ui/app_ui.cpp
index 6d0a32a..a6dd02c 100644
--- a/src/ui/app_ui.cpp
+++ b/src/ui/app_ui.cpp
@@ -44,6 +44,10 @@ constexpr Color kPlaceholder = rgba(44, 44, 44);
enum Icon { kIconCross, kIconCircle, kIconOptions, kIconTriangle, kIconTouchpad, kIconSquare };
+// The resolution list, lowest first: SettingsChoice::resolution value per
+// position (0 = 1080p, 1 = 720p, 2 = 1440p, as saved).
+constexpr int kResolutionOrder[3] = {1, 0, 2};
+
// Grids ("Your games", search results): cards with the name below.
constexpr int kGridPitchY = 300;
constexpr int kLibraryCols = 6;
@@ -445,7 +449,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::Res1080), tr(Str::Res720), tr(Str::Res1440)}; // = SettingsChoice::resolution
+ out = {tr(Str::Res720), tr(Str::Res1080), tr(Str::Res1440)}; // kResolutionOrder
} else {
// Automatic first, then the regions in the login's order.
out.push_back(withMs(trf(Str::RegionAuto, defaultRegion_.empty() ? "-" : prettyRegion(defaultRegion_)),
@@ -458,7 +462,9 @@ std::vector<std::string> AppUi::settingOptions(int row) const {
int AppUi::settingSelected(int row) const {
// Caller holds mutex_.
if (row == 0) return settings_.language;
- if (row == 1) return settings_.resolution;
+ if (row == 1)
+ for (int i = 0; i < 3; ++i)
+ if (kResolutionOrder[i] == settings_.resolution) return i;
for (size_t i = 0; i < regions_.size(); ++i)
if (regions_[i] == settings_.region) return static_cast<int>(i) + 1;
return 0;
@@ -470,7 +476,7 @@ void AppUi::applySetting(int row, int index) {
settings_.language = index;
setLanguage(static_cast<Language>(index)); // the UI switches right away
} else if (row == 1) {
- settings_.resolution = index;
+ settings_.resolution = kResolutionOrder[index];
} else {
settings_.region = index == 0 ? std::string() : regions_[static_cast<size_t>(index - 1)];
}