Xbox Cloud Gaming app for PS5 Homebrew
C
Settings from before v0.8.0 get the new picture defaults; auto smoothing ignores no-video seconds
Rafael Abud Ferreira0fb0d4d61717
diff --git a/src/app/ps5_main.cpp b/src/app/ps5_main.cppindex 1891358..ae854bd 100644--- a/src/app/ps5_main.cpp+++ b/src/app/ps5_main.cpp@@ -186,9 +186,10 @@ int g_autoplayDeband = -1; // deband=0..3: instead of the setting// Block smoothing "auto": the level for a bitrate (Mbps) coming from `now`,// stronger as it falls (high below ~5 Mbps, off above ~10). A 1 Mbps margin-// each way keeps a bitrate near a limit from flipping it; -1 = no measure.+// each way keeps a bitrate near a limit from flipping it; -1 = no measure+// (below 0.5 Mbps: the stream is starting, or the picture is standing still).int debandForMbps(double mbps, int now) {- if (mbps <= 0) return -1;+ if (mbps < 0.5) return -1;if (now == 2) return mbps >= 6 ? (mbps >= 11 ? 0 : 1) : 2;if (now == 1) return mbps < 4 ? 2 : mbps >= 11 ? 0 : 1;return mbps < 4 ? 2 : mbps < 9 ? 1 : 0;diff --git a/src/app/settings.cpp b/src/app/settings.cppindex b11fcdb..0d5c4de 100644--- a/src/app/settings.cpp+++ b/src/app/settings.cpp@@ -4,6 +4,7 @@#include "platform/platform.h"#include "util/json.h"+#include "util/log.h"#include <algorithm>@@ -35,6 +36,14 @@ bool Settings::load(const std::string& path) {maxHeightHome = static_cast<int>((*j)["maxHeightHome"].asInt(0));probedCloud = (*j)["probedCloud"].asInt(0);probedHome = (*j)["probedHome"].asInt(0);+ // Files from before v0.8.0 (no version): what still holds the old+ // defaults moves to the new ones (block smoothing low -> auto, FSR ->+ // FSR + clean-up); anything chosen otherwise stays.+ if ((*j)["settingsVersion"].asInt(1) < 2) {+ if (deband == 1) deband = 3;+ if (upscaler == 0) upscaler = 2;+ XC_LOGI("settings: from before v0.8.0; block smoothing %d, upscaling %d", deband, upscaler);+ }regionRtt.clear();for (const auto& [name, ms] : (*j)["regionRtt"].members())if (ms.asInt() > 0) regionRtt[name] = static_cast<int>(ms.asInt());@@ -66,6 +75,7 @@ bool Settings::save(const std::string& path) const {v.set("maxHeightHome", maxHeightHome);v.set("probedCloud", probedCloud);v.set("probedHome", probedHome);+ v.set("settingsVersion", 2);return platform::writeFileAtomic(path, v.dump());}diff --git a/tests/test_main.cpp b/tests/test_main.cppindex 5d8ced9..75a9c72 100644--- a/tests/test_main.cpp+++ b/tests/test_main.cpp@@ -1,8 +1,10 @@// SPDX-License-Identifier: GPL-3.0-or-later// Copyright (C) 2026 RafaelNGP// Offline unit tests for the portable core (no network).+#include "app/settings.h"#include "app/update_check.h"#include "net/http.h"+#include "platform/platform.h"#include "stream/input_packet.h"#include "stream/stream_session.h"#include "ui/app_ui.h"@@ -210,6 +212,29 @@ static void testVersions() {CHECK(!isNewerVersion("", "0.3.0"));}+static void testSettingsMigration() {+ // A file from before v0.8.0 at the old defaults gets the new ones; other+ // choices, and files already saved by v0.8.0, stay as they are.+ std::string path = "/tmp/xcloud-tests-settings.json";+ auto loadFrom = [&](const std::string& text) {+ xc::platform::writeFileAtomic(path, text);+ xc::app::Settings s;+ CHECK(s.load(path));+ return s;+ };+ auto old = loadFrom(R"({"deband":1,"upscaler":0})");+ CHECK(old.deband == 3 && old.upscaler == 2);+ auto chosen = loadFrom(R"({"deband":2,"upscaler":1})");+ CHECK(chosen.deband == 2 && chosen.upscaler == 1);+ auto current = loadFrom(R"({"deband":1,"upscaler":0,"settingsVersion":2})");+ CHECK(current.deband == 1 && current.upscaler == 0);+ // Saved again, the migration doesn't repeat.+ CHECK(old.save(path));+ xc::app::Settings again;+ CHECK(again.load(path) && again.deband == 3 && again.upscaler == 2);+ std::remove(path.c_str());+}+static void testStreamMenu() {using xc::ui::MenuAction;xc::ui::Fonts fonts; // not loaded: handle() never draws@@ -270,6 +295,7 @@ int main() {testAccentColor();testVersions();testStreamMenu();+ testSettingsMigration();testStrings();testRegions();testPrices();