Xbox Cloud Gaming app for PS5 Homebrew
C
psbox: starts fullscreen; Settings > Display mode (window / fullscreen) on the desktop
Rafael Abud Ferreirad337c56772b9
diff --git a/docs/multiplatform.md b/docs/multiplatform.mdindex e9fdd6a..ddcbf90 100644--- a/docs/multiplatform.md+++ b/docs/multiplatform.md@@ -152,12 +152,15 @@ shared code:cmake -S . -B build-desktop -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo \-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ninja -C build-desktop-build-desktop/psbox # --fullscreen, --windowed, --data-dir <dir>+build-desktop/psbox # --fullscreen, --windowed (this run), --data-dir <dir>SDL_VIDEO_DRIVER=offscreen SDL_AUDIO_DRIVER=dummy build-desktop/psbox --selftest /tmp/psbox-selftest```-- **Display** (`display_sdl.cpp`): a 1600x900 resizable window (F11 or- Alt+Enter: fullscreen), an `SDL_Renderer` with vsync, the 1920x1080 picture+- **Display** (`display_sdl.cpp`): fullscreen at the desktop's own mode by+ default, else a 1600x900 resizable window: Settings > Display mode (a row+ only a desktop shows, `UiCaps::desktopWindow`; `desktopFullscreen` in+ settings.json), F11 / Alt+Enter switch it and the setting follows,+ `--fullscreen` / `--windowed` choose for one run. An `SDL_Renderer` with vsync, the 1920x1080 pictureletterboxed. SDL renders on the main thread only: the drawing threads fill aback frame, `present()` puts it in a one-slot mailbox (the newest wins; thevideo thread never waits for vsync) and `display::pump()`, each pass of thediff --git a/src/app/app_core.cpp b/src/app/app_core.cppindex 3461fe4..e810c9b 100644--- a/src/app/app_core.cpp+++ b/src/app/app_core.cpp@@ -84,7 +84,7 @@ void applyControllerSettings() {// Saves what Settings edits (and applies the controller's part); true when// the language changed.bool saveSettings(const ui::SettingsChoice& choice) {- bool languageChanged;+ bool languageChanged, fullscreenChanged;{std::lock_guard<std::mutex> lock(g_settingsMutex);std::string code = ui::languageCode(static_cast<ui::Language>(choice.language));@@ -109,11 +109,14 @@ bool saveSettings(const ui::SettingsChoice& choice) {g_settings.maxBitrateMbps = choice.maxBitrateMbps;g_settings.gameVolume = choice.gameVolume;g_settings.keyMap = choice.keyMap;+ fullscreenChanged = g_settings.desktopFullscreen != choice.fullscreen;+ g_settings.desktopFullscreen = choice.fullscreen;g_settings.save(settingsPath()); // warns itselfXC_LOGI("settings saved: language %s, %s, region %s", code.c_str(), g_settings.resolution.c_str(),g_settings.region.empty() ? "auto" : g_settings.region.c_str());}applyControllerSettings();+ if (fullscreenChanged) shell::setFullscreen(choice.fullscreen); // a desktop's window (main thread)return languageChanged;}@@ -221,6 +224,7 @@ ui::UiCaps uiCaps() {c.console = sc.console;c.openUrl = sc.openUrl;c.selfUpdate = sc.selfUpdate;+ c.desktopWindow = sc.window;return c;}@@ -301,6 +305,7 @@ bool coreStartup() {choice.maxBitrateMbps = g_settings.maxBitrateMbps;choice.gameVolume = g_settings.gameVolume;choice.keyMap = g_settings.keyMap;+ choice.fullscreen = g_settings.desktopFullscreen;g_ui->setAllow1440(allow1440Locked());g_ui->setUpdateState(XC_APP_VERSION, {}, false); // Settings shows this version before any checkg_ui->setSettings(choice);@@ -334,6 +339,15 @@ bool coreStartup() {bool Core::frame() {if (!shell::pumpEvents()) return false;+ if (bool on; shell::fullscreenSwitched(on)) {+ // F11 / Alt+Enter on a desktop: the Display mode setting follows.+ {+ std::lock_guard<std::mutex> lock(g_settingsMutex);+ g_settings.desktopFullscreen = on;+ g_settings.save(settingsPath()); // warns itself+ }+ g_ui->setFullscreen(on);+ }crash::heartbeat();if (ui::Screen sc = g_ui->screen(); sc != stageScreen) {// What the app is doing, for a crash marker (the worker namesdiff --git a/src/app/desktop_main.cpp b/src/app/desktop_main.cppindex 8110d4f..92f9530 100644--- a/src/app/desktop_main.cpp+++ b/src/app/desktop_main.cpp@@ -22,8 +22,9 @@ void usage(std::FILE* to) {"usage: psbox [--data-dir <dir>] [--fullscreen | --windowed] [--selftest <dir>]\n"" --data-dir <dir> sign-in, settings and caches there (default $XCLOUD_DATA_DIR,\n"" else $XDG_DATA_HOME/psbox)\n"- " --fullscreen start fullscreen (F11 or Alt+Enter switches)\n"- " --windowed start in a window (the default)\n"+ " --fullscreen start fullscreen this time (F11 or Alt+Enter switches)\n"+ " --windowed start in a window this time (default: Settings > Display mode,\n"+ " fullscreen at first)\n"" --selftest <dir> check the window, screens, input and sound; screenshots in <dir>\n");}diff --git a/src/app/desktop_selftest.cpp b/src/app/desktop_selftest.cppindex 81732cb..425084a 100644--- a/src/app/desktop_selftest.cpp+++ b/src/app/desktop_selftest.cpp@@ -147,7 +147,9 @@ int desktopSelftest(const std::string& dir) {// SDL and the window, as the app brings them up.shell::beforeSettings();- shell::beforeDisplay(Settings{});+ Settings windowed;+ windowed.desktopFullscreen = false; // a window of a known size (unless --fullscreen)+ shell::beforeDisplay(windowed);bool display = display::init(true);check(display, "window and renderer");if (!display) return 1;@@ -197,6 +199,8 @@ int desktopSelftest(const std::string& dir) {});std::printf("selftest: Settings shows %zu of %d rows\n", rows.size(), ui::kSettingRows);check(hidden && rows.size() < static_cast<size_t>(ui::kSettingRows), "Settings hides light bar / 120 Hz rows");+ check(caps.desktopWindow && std::any_of(rows.begin(), rows.end(), [](const ui::SettingsRowPos& r) { return r.row == 13; }),+ "Settings has the Display mode row");ui.render(canvas, platform::nowMs());drawCanvas(canvas);check(screenshot(dir, "2-settings.png", shot) && varied(shot), "Settings screen (2-settings.png)");diff --git a/src/app/settings.cpp b/src/app/settings.cppindex 3d606b9..4befa9d 100644--- a/src/app/settings.cpp+++ b/src/app/settings.cpp@@ -73,6 +73,7 @@ bool Settings::load(const std::string& path) {gestureHints = static_cast<int>((*j)["gestureHints"].asInt(gestureHints));micEnabled = (*j)["micEnabled"].asBool(micEnabled);highRefresh = (*j)["highRefresh"].asBool(highRefresh);+ desktopFullscreen = (*j)["desktopFullscreen"].asBool(desktopFullscreen);maxBitrateMbps = static_cast<int>(std::clamp<int64_t>((*j)["maxBitrateMbps"].asInt(maxBitrateMbps), 0, 40));gameVolume = static_cast<int>(std::clamp<int64_t>((*j)["gameVolume"].asInt(gameVolume), 0, 200));keyMap = readKeyMap((*j)["keyMap"], input::defaultKeyMap());@@ -197,6 +198,7 @@ bool Settings::save(const std::string& path) const {v.set("gestureHints", gestureHints);v.set("micEnabled", micEnabled);v.set("highRefresh", highRefresh);+ v.set("desktopFullscreen", desktopFullscreen);v.set("maxBitrateMbps", maxBitrateMbps);v.set("gameVolume", gameVolume);v.set("keyMap", keyMapJson(keyMap));diff --git a/src/app/settings.h b/src/app/settings.hindex 8c669cb..6373fde 100644--- a/src/app/settings.h+++ b/src/app/settings.h@@ -92,7 +92,10 @@ struct Settings {// The tallest picture each kind of stream delivered when asked for its// top tier, and when (unix s): 1440p is only offered once one did.int maxHeightCloud = 0, maxHeightHome = 0;- int64_t probedCloud = 0, probedHome = 0; // streams that showed the touchpad gestures' hint (three do)+ int64_t probedCloud = 0, probedHome = 0;+ // A desktop app: its window fullscreen (the desktop's own mode) or not.+ // Unused on the PS5.+ bool desktopFullscreen = true; // 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;diff --git a/src/app/shell.h b/src/app/shell.hindex cba9d16..7a37176 100644--- a/src/app/shell.h+++ b/src/app/shell.h@@ -52,8 +52,16 @@ struct Caps {bool console = false; // the PS5: "this console", the paths of its menusbool openUrl = false; // openUrl() works: a link on screen opens in the browserbool selfUpdate = false; // canSelfUpdate()+ bool window = false; // the app is a window: it can go fullscreen (setFullscreen())};Caps caps();+// A desktop's window fullscreen or not (Settings > Display mode); nothing+// where the app isn't a window.+void setFullscreen(bool on);+// True once after the user switched fullscreen another way (F11 /+// Alt+Enter), with the new state in `on`: the setting follows. Never on the+// PS5.+bool fullscreenSwitched(bool& on);// Opens `url` in the system's browser; false where there is none (PS5).bool openUrl(const std::string& url);diff --git a/src/app/shell_desktop.cpp b/src/app/shell_desktop.cppindex 22c476c..df7fef7 100644--- a/src/app/shell_desktop.cpp+++ b/src/app/shell_desktop.cpp@@ -4,7 +4,7 @@// the window (display_sdl.cpp) goes to the input backend, and each pass// empties SDL's event queue: closing the window (or Ctrl+C, which SDL turns// into a quit event) ends the app in order, F11 / Alt+Enter switch-// fullscreen, every event goes on to the input backend (pads, keyboard,+// fullscreen (the setting follows), every event goes on to the input backend (pads, keyboard,// mouse). Notices are toasts in the window; links open in the browser; no// update is installed (Settings opens the release page).#include "app/shell.h"@@ -25,6 +25,7 @@ namespace xc::app::shell {namespace {bool g_quit = false; // main thread+int g_switchedTo = -1; // F11 / Alt+Enter: the fullscreen state asked (main thread), -1 nonestd::atomic<bool> g_focus{true}; // the window has the keyboardvolatile std::sig_atomic_t g_signalled = 0;void onSignal(int) { g_signalled = 1; }@@ -34,7 +35,8 @@ void beforeSettings() {platform::enableToasts(true); // platform::notify() -> a toast in the window}-void beforeDisplay(const Settings&) {+void beforeDisplay(const Settings& settings) {+ display::sdlStartFullscreenSetting(settings.desktopFullscreen); // unless --windowed / --fullscreen// The display, the pads and the sound start their own parts; the event// loop is ours.if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_GAMEPAD | SDL_INIT_AUDIO | SDL_INIT_EVENTS))@@ -81,7 +83,11 @@ bool pumpEvents() {case SDL_EVENT_KEY_DOWN:// F11 / Alt+Enter: fullscreen. Not passed on (Enter would accept).if (ev.key.key == SDLK_F11 || (ev.key.key == SDLK_RETURN && (ev.key.mod & SDL_KMOD_ALT))) {- if (!ev.key.repeat) display::sdlToggleFullscreen();+ if (!ev.key.repeat) {+ bool on = !display::sdlIsFullscreen();+ display::sdlSetFullscreen(on);+ g_switchedTo = on;+ }continue;}break;@@ -105,7 +111,16 @@ void beforeShutdown() {input::sdlInputShutdown();}-Caps caps() { return {false, true, false}; }+Caps caps() { return {false, true, false, true}; }++void setFullscreen(bool on) { display::sdlSetFullscreen(on); }++bool fullscreenSwitched(bool& on) {+ if (g_switchedTo < 0) return false;+ on = g_switchedTo == 1;+ g_switchedTo = -1;+ return true;+}bool openUrl(const std::string& url) {if (SDL_OpenURL(url.c_str())) return true;diff --git a/src/app/shell_null.cpp b/src/app/shell_null.cppindex 664ebbe..024de79 100644--- a/src/app/shell_null.cpp+++ b/src/app/shell_null.cpp@@ -37,6 +37,8 @@ bool canSelfUpdate() { return false; }bool isInstalledCopy(const std::string&) { return false; }void beforeShutdown() {}Caps caps() { return {false, false, false}; }+void setFullscreen(bool) {}+bool fullscreenSwitched(bool&) { return false; }bool openUrl(const std::string&) { return false; }void restartOrExit() {diff --git a/src/app/shell_ps5.cpp b/src/app/shell_ps5.cppindex fe7cfce..be351c7 100644--- a/src/app/shell_ps5.cpp+++ b/src/app/shell_ps5.cpp@@ -61,6 +61,8 @@ bool canSelfUpdate() { return true; }// Never called: the PS5's loop doesn't end.void beforeShutdown() {}Caps caps() { return {true, false, true}; }+void setFullscreen(bool) {}+bool fullscreenSwitched(bool&) { return false; }// No browser to send a link to: the screens show a QR code instead.bool openUrl(const std::string&) { return false; }diff --git a/src/display/display_sdl.cpp b/src/display/display_sdl.cppindex ea97039..a4fd4b5 100644--- a/src/display/display_sdl.cpp+++ b/src/display/display_sdl.cpp@@ -56,7 +56,8 @@ SDL_Texture* g_overlayTex = nullptr;int g_overlayW = 0, g_overlayH = 0;SDL_Texture* g_readTex = nullptr; // readBackRgb()'s targetSDL_ThreadID g_mainThread = 0;-bool g_startFullscreen = false;+bool g_startFullscreen = true; // the setting's default+bool g_startForced = false; // the command line chosebool g_shown = false; // the window shows from its first picture onFrame g_front; // the picture on screenOverlay g_overlayShown;@@ -155,19 +156,26 @@ void renderScene() {} // namespace-void sdlStartFullscreen(bool on) { g_startFullscreen = on; }+void sdlStartFullscreen(bool on) { g_startFullscreen = on, g_startForced = true; }+void sdlStartFullscreenSetting(bool on) {+ if (!g_startForced) g_startFullscreen = on;+}SDL_Window* sdlWindow() { return g_window; }const char* sdlRendererName() { return g_renderer ? SDL_GetRendererName(g_renderer) : ""; }void sdlRepaint() { g_repaint = true; }-void sdlToggleFullscreen() {- if (!g_window) return;- bool full = (SDL_GetWindowFlags(g_window) & SDL_WINDOW_FULLSCREEN) != 0;- if (!SDL_SetWindowFullscreen(g_window, !full)) XC_LOGW("display: fullscreen: %s", SDL_GetError());- XC_LOGI("display: %s", full ? "windowed" : "fullscreen");+bool sdlIsFullscreen() { return g_window && (SDL_GetWindowFlags(g_window) & SDL_WINDOW_FULLSCREEN) != 0; }++void sdlSetFullscreen(bool on) {+ if (!g_window || sdlIsFullscreen() == on) return;+ // No SDL_SetWindowFullscreenMode(): borderless at the desktop's own mode.+ if (!SDL_SetWindowFullscreen(g_window, on)) XC_LOGW("display: fullscreen: %s", SDL_GetError());+ XC_LOGI("display: %s", on ? "fullscreen" : "windowed");g_repaint = true;}+void sdlToggleFullscreen() { sdlSetFullscreen(!sdlIsFullscreen()); }+std::mutex& frameMutex() { return g_frameMutex; }bool init(bool) {diff --git a/src/display/display_sdl.h b/src/display/display_sdl.hindex 46a98a6..fcb4983 100644--- a/src/display/display_sdl.h+++ b/src/display/display_sdl.h@@ -8,8 +8,11 @@ struct SDL_Window;namespace xc::display {-// Before init(): the window opens fullscreen (desktop resolution) or not.-void sdlStartFullscreen(bool on);+// Before init(): the window opens fullscreen (the desktop's own mode, no+// mode change) or not. The command line's choice (--fullscreen /+// --windowed) wins over the setting's for that run.+void sdlStartFullscreen(bool on); // the command line+void sdlStartFullscreenSetting(bool on); // settings.json (desktopFullscreen)// The app's window once init() made it; null before (or without one).SDL_Window* sdlWindow();// The renderer's name ("vulkan", "opengl", "software"...), for the log.@@ -17,7 +20,9 @@ const char* sdlRendererName();// The window was resized, shown again or uncovered: the last picture is// presented again at the next pump().void sdlRepaint();-// F11 / Alt+Enter: fullscreen on or off.+// Fullscreen on or off (Settings > Display mode); F11 / Alt+Enter toggle.+void sdlSetFullscreen(bool on);void sdlToggleFullscreen();+bool sdlIsFullscreen();} // namespace xc::displaydiff --git a/src/ui/app_ui.cpp b/src/ui/app_ui.cppindex ec81682..517d38f 100644--- a/src/ui/app_ui.cpp+++ b/src/ui/app_ui.cpp@@ -56,11 +56,12 @@ enum Icon { kIconCross, kIconCircle, kIconOptions, kIconTriangle, kIconTouchpad,constexpr int kResolutionOrder[3] = {1, 0, 2};// Settings' rows on screen, alike ones together (the row ids stay what// settingsRow_ and the helpers use): language and sign-in country; the-// stream (resolution, 120 Hz, bitrate, region); sound; the controller and-// keyboard; updates last. A group starts at each kSettingsGroupStart.-constexpr int kSettingsOrder[kSettingRows] = {0, 8, 1, 9, 10, 2, 11, 3, 4, 5, 6, 12, 7};-constexpr bool kSettingsGroupStart[kSettingRows] = {false, false, true, false, false, false, true,- true, false, false, false, false, true};+// stream (resolution, a desktop's display mode, 120 Hz, bitrate, region);+// sound; the controller and keyboard; updates last. A group starts at each+// kSettingsGroupStart.+constexpr int kSettingsOrder[kSettingRows] = {0, 8, 1, 13, 9, 10, 2, 11, 3, 4, 5, 6, 12, 7};+constexpr bool kSettingsGroupStart[kSettingRows] = {false, false, true, false, false, false, false,+ true, true, false, false, false, false, true};// The game settings' rows on screen (ids: 0 profile, 1 upscaler, 2// sharpness, 3 block smoothing, 4 resolution, 5 dead zone, 6 triggers, 7// confirm, 8 120 Hz, 9 keyboard keys, 10 back to the default).@@ -240,6 +241,7 @@ std::vector<SettingsRowPos> visibleSettingsRows(const UiCaps& caps) {case 4: return caps.triggerRumble || caps.adaptiveTriggers; // trigger vibration and its testercase 6: return caps.lightBar;case 9: return caps.highRefresh;+ case 13: return caps.desktopWindow;default: return true;}});@@ -1248,6 +1250,13 @@ void AppUi::setSettings(const SettingsChoice& choice) {dirty_ = true;}+void AppUi::setFullscreen(bool on) {+ std::lock_guard<std::mutex> lock(mutex_);+ if (settings_.fullscreen == on) return;+ settings_.fullscreen = on;+ dirty_ = true;+}+SettingsChoice AppUi::settings() const {std::lock_guard<std::mutex> lock(mutex_);return settings_;@@ -1394,6 +1403,8 @@ std::vector<std::string> AppUi::settingOptions(int row) const {// Updates: Cross acts, no list.} else if (row == 9) {out = {tr(Str::Deactivated), tr(Str::HighRefreshOn)};+ } else if (row == 13) {+ out = {tr(Str::DisplayWindow), tr(Str::DisplayFullscreen)};} else if (row == 10) {out.push_back(tr(Str::BitrateAuto));for (int mbps : kBitrateCaps) out.push_back(std::to_string(mbps) + " Mbps");@@ -1428,6 +1439,7 @@ int AppUi::settingSelected(int row) const {if (row == 6) return settings_.lightBarMode;if (row == 7) return 0;if (row == 9) return settings_.highRefresh ? 1 : 0;+ if (row == 13) return settings_.fullscreen ? 1 : 0;if (row == 10) {for (size_t i = 0; i < std::size(kBitrateCaps); ++i)if (kBitrateCaps[i] == settings_.maxBitrateMbps) return static_cast<int>(i) + 1;@@ -1467,6 +1479,10 @@ void AppUi::applySetting(int row, int index) {} else if (row == 7) {} else if (row == 9) {settings_.highRefresh = index == 1;+ } else if (row == 13) {+ // In force at once (handle() sends the settings): the window follows.+ if (settings_.fullscreen != (index == 1)) displayModeChanged_ = true;+ settings_.fullscreen = index == 1;} else if (row == 10) {settings_.maxBitrateMbps = index == 0 ? 0 : kBitrateCaps[index - 1];} else if (row == 11) {@@ -2409,6 +2425,15 @@ UiEvent AppUi::handle(const NavInput& in) {signOutHoldStart_ = 0;if (!in.touchpad) signOutLatched_ = false;}+ if (displayModeChanged_) {+ // A desktop's display mode applies (and is saved) as it is picked,+ // not when Settings closes.+ displayModeChanged_ = false;+ if (ev.action == Action::None) {+ ev.action = Action::SettingsChanged;+ ev.settings = settings_;+ }+ }return ev;}@@ -3485,7 +3510,7 @@ void AppUi::drawSettings(Canvas& c) {tr(Str::Deadzone), tr(Str::TriggerRumble), tr(Str::ConfirmButton),tr(Str::LightBar), tr(Str::Updates), tr(Str::LoginCountry),tr(Str::HighRefresh), tr(Str::BitrateCap), tr(Str::GameVolume),- tr(Str::KeyboardKeys)};+ tr(Str::KeyboardKeys), tr(Str::DisplayMode)};constexpr int kRowW = 1200, kRowH = 46, kGap = 5, kGroupGap = 16;Rect rows[kSettingRows]; // by row idint y = 236;diff --git a/src/ui/app_ui.h b/src/ui/app_ui.hindex 3784b69..a75f91e 100644--- a/src/ui/app_ui.h+++ b/src/ui/app_ui.h@@ -119,6 +119,7 @@ struct SettingsChoice {int maxBitrateMbps = 0; // 0 automatic, else 20 / 15 / 10 / 5int gameVolume = 100; // percent: 25 / 50 / 75 / 100 / 150input::KeyMap keyMap = input::defaultKeyMap(); // the keyboard as a player's controller+ bool fullscreen = true; // a desktop's window fullscreen (UiCaps::desktopWindow; F11 switches it too)};// What this system and its pads can do, filled in by the app from the pads'@@ -138,6 +139,10 @@ struct UiCaps {bool console = true; // "this console" and the PS5 menus' paths (else "this computer")bool openUrl = false; // a link on screen opens in the browser (Cross / Enter)bool selfUpdate = true; // Updates installs the new version (else Cross opens its page)+ // The app is a window on a desktop: the "Display mode" row (window or+ // fullscreen). The one row only a desktop has, so false by default: the+ // PS5's Settings stay as they are.+ bool desktopWindow = false;bool operator==(const UiCaps&) const = default;};@@ -156,8 +161,9 @@ std::vector<SettingsRowPos> visibleGameSettingsRows(const UiCaps& caps, bool cus// The largest stick dead zone Settings offers, in percent of the travel.constexpr int kMaxDeadzone = 30;-constexpr int kSettingRows = 13; // language, resolution, region, dead zone, triggers, confirm, light bar, updates,- // sign-in country, 120 Hz output, bitrate cap, game volume, keyboard keys+constexpr int kSettingRows = 14; // language, resolution, region, dead zone, triggers, confirm, light bar, updates,+ // sign-in country, 120 Hz output, bitrate cap, game volume, keyboard keys,+ // display mode (a desktop's window)// The countries "Sign in as another country" offers (xcloud::loginCountryAddress).constexpr const char* kLoginCountries[] = {"br", "jp", "kr", "pl", "us"};@@ -280,6 +286,9 @@ public:// another country (Square), and Settings (Options).void showRegionRefused(const std::string& message);void setSettings(const SettingsChoice& choice);+ // A desktop's window went fullscreen or back another way (F11 / Alt+Enter):+ // the Display mode row shows it.+ void setFullscreen(bool on);SettingsChoice settings() const; // what Settings holds now (the autoplay tests put it back)// Per-game settingsvoid setPerGameSettings(const std::map<std::string, app::GameProfile>& perGame);@@ -514,6 +523,7 @@ private:std::string error_;GameTile errorGame_; // showPlayError()'s game; empty for other errorsSettingsChoice settings_;+ bool displayModeChanged_ = false; // the Display mode row changed: handle() sends the settingsbool circleConfirms_ = false;PadSlots pads_{};std::map<std::string, Color> accents_; // tile art url -> its colourdiff --git a/src/ui/strings.cpp b/src/ui/strings.cppindex ead7839..80bd335 100644--- a/src/ui/strings.cpp+++ b/src/ui/strings.cpp@@ -292,6 +292,9 @@ constexpr Column kEnglish = {"%s available: download", // UpdateReadyPc"Menu: START + BACK or F12 · Xbox button: Guide or Home", // GestureHintButtons"START + BACK or F12: this menu · Guide or Home: Xbox button", // MenuButtonHint+ "Display mode", // DisplayMode+ "Window", // DisplayWindow+ "Fullscreen", // DisplayFullscreen};constexpr Column kPortugueseBR = {@@ -554,6 +557,9 @@ constexpr Column kPortugueseBR = {"%s disponível: baixar", // UpdateReadyPc"Menu: START + BACK ou F12 · Botão Xbox: Guide ou Home", // GestureHintButtons"START + BACK ou F12: este menu · Guide ou Home: botão Xbox", // MenuButtonHint+ "Modo de exibição", // DisplayMode+ "Janela", // DisplayWindow+ "Tela cheia", // DisplayFullscreen};constexpr Column kSpanish = {@@ -816,6 +822,9 @@ constexpr Column kSpanish = {"%s disponible: descargar", // UpdateReadyPc"Menú: START + BACK o F12 · Botón Xbox: Guide o Inicio", // GestureHintButtons"START + BACK o F12: este menú · Guide o Inicio: botón Xbox", // MenuButtonHint+ "Modo de pantalla", // DisplayMode+ "Ventana", // DisplayWindow+ "Pantalla completa", // DisplayFullscreen};constexpr Column kFrench = {@@ -1078,6 +1087,9 @@ constexpr Column kFrench = {"%s disponible : télécharger", // UpdateReadyPc"Menu : START + BACK ou F12 · Bouton Xbox : Guide ou Origine", // GestureHintButtons"START + BACK ou F12 : ce menu · Guide ou Origine : bouton Xbox", // MenuButtonHint+ "Mode d'affichage", // DisplayMode+ "Fenêtre", // DisplayWindow+ "Plein écran", // DisplayFullscreen};constexpr Column kGerman = {@@ -1340,6 +1352,9 @@ constexpr Column kGerman = {"%s verfügbar: herunterladen", // UpdateReadyPc"Menü: START + BACK oder F12 · Xbox-Taste: Guide oder Pos1", // GestureHintButtons"START + BACK oder F12: dieses Menü · Guide oder Pos1: Xbox-Taste", // MenuButtonHint+ "Anzeigemodus", // DisplayMode+ "Fenster", // DisplayWindow+ "Vollbild", // DisplayFullscreen};constexpr Column kItalian = {@@ -1602,6 +1617,9 @@ constexpr Column kItalian = {"%s disponibile: scarica", // UpdateReadyPc"Menu: START + BACK o F12 · Pulsante Xbox: Guide o Home", // GestureHintButtons"START + BACK o F12: questo menu · Guide o Home: pulsante Xbox", // MenuButtonHint+ "Modalità schermo", // DisplayMode+ "Finestra", // DisplayWindow+ "Schermo intero", // DisplayFullscreen};constexpr std::array<const Column*, kLangs> kTable = {&kEnglish, &kPortugueseBR, &kSpanish,diff --git a/src/ui/strings.h b/src/ui/strings.hindex 7f31caa..61b67de 100644--- a/src/ui/strings.h+++ b/src/ui/strings.h@@ -269,6 +269,9 @@ enum class Str {UpdateReadyPc, // Settings > Updates on a desktop: "%s" = the new version; Cross opens its pageGestureHintButtons, // GestureHint for pads without a touchpad: the buttons and keys that do the sameMenuButtonHint, // MenuGestureHint for pads without a touchpad+ DisplayMode, // Settings row on a desktop: the app in a window or fullscreen (F11 / Alt+Enter switch it too)+ DisplayWindow, // ... in a window+ DisplayFullscreen, // ... fullscreenCount};diff --git a/tests/test_main.cpp b/tests/test_main.cppindex aa22f50..ae15c39 100644--- a/tests/test_main.cpp+++ b/tests/test_main.cpp@@ -378,9 +378,12 @@ static void testPerGameSettings() {CHECK(consoleProf.sharpness == 3 && consoleProf.circleConfirms);// Save to disk and reload.+ CHECK(s.desktopFullscreen); // a desktop window starts fullscreen unless chosen otherwise+ s.desktopFullscreen = false;CHECK(s.save(path));xc::app::Settings reloaded;CHECK(reloaded.load(path));+ CHECK(!reloaded.desktopFullscreen);CHECK(reloaded.perGame.size() == 2);auto loadedP1 = reloaded.profileForGame("GAME1", "", &hasCustom);CHECK(hasCustom);@@ -1186,6 +1189,12 @@ static void testVisibleSettingsRows() {auto desk = ui::visibleSettingsRows(pc);CHECK((ids(desk) == std::vector<int>{0, 8, 1, 10, 2, 11, 3, 5, 12, 7}));CHECK((groups(desk) == std::vector<bool>{false, false, true, false, false, true, true, false, false, true}));+ // The desktop app's window: Display mode after the resolution, in the stream's group.+ ui::UiCaps win = pc;+ win.desktopWindow = true;+ auto w = ui::visibleSettingsRows(win);+ CHECK((ids(w) == std::vector<int>{0, 8, 1, 13, 10, 2, 11, 3, 5, 12, 7}));+ CHECK((groups(w) == std::vector<bool>{false, false, true, false, false, false, true, true, false, false, true}));ui::UiCaps xbox = pc; // an Xbox pad: impulse triggers, no light barxbox.triggerRumble = true;auto x = ids(ui::visibleSettingsRows(xbox));