From bd8d28c59d53ecd63dc00288fd0bf220b09773ee Mon Sep 17 00:00:00 2001 From: Xpl0itR Date: Tue, 1 Dec 2020 22:02:27 +0000 Subject: [PATCH] Add option to start games in fullscreen mode (#1580) * Add option to start games in fullscreen mode * Add command line option * Use pascal case on menu item --- .../Configuration/ConfigurationFileFormat.cs | 7 ++++++- .../Configuration/ConfigurationState.cs | 20 ++++++++++++++++++- Ryujinx/Config.json | 5 +++-- Ryujinx/Program.cs | 10 ++++++++++ Ryujinx/Ui/MainWindow.cs | 19 +++++++++++++++++- Ryujinx/Ui/MainWindow.glade | 17 +++++++++++++++- Ryujinx/_schema.json | 11 ++++++++++ 7 files changed, 83 insertions(+), 6 deletions(-) diff --git a/Ryujinx.Common/Configuration/ConfigurationFileFormat.cs b/Ryujinx.Common/Configuration/ConfigurationFileFormat.cs index bfb1cdc1b..5618b2287 100644 --- a/Ryujinx.Common/Configuration/ConfigurationFileFormat.cs +++ b/Ryujinx.Common/Configuration/ConfigurationFileFormat.cs @@ -14,7 +14,7 @@ namespace Ryujinx.Configuration /// /// The current version of the file format /// - public const int CurrentVersion = 16; + public const int CurrentVersion = 17; public int Version { get; set; } @@ -188,6 +188,11 @@ namespace Ryujinx.Configuration /// public string CustomThemePath { get; set; } + /// + /// Start games in fullscreen mode + /// + public bool StartFullscreen { get; set; } + /// /// Enable or disable keyboard support (Independent from controllers binding) /// diff --git a/Ryujinx.Common/Configuration/ConfigurationState.cs b/Ryujinx.Common/Configuration/ConfigurationState.cs index 2d7251494..ef4a43372 100644 --- a/Ryujinx.Common/Configuration/ConfigurationState.cs +++ b/Ryujinx.Common/Configuration/ConfigurationState.cs @@ -1,4 +1,4 @@ -using Ryujinx.Common; +using Ryujinx.Common; using Ryujinx.Common.Configuration; using Ryujinx.Common.Configuration.Hid; using Ryujinx.Common.Logging; @@ -82,6 +82,11 @@ namespace Ryujinx.Configuration /// public ReactiveObject CustomThemePath { get; private set; } + /// + /// Start games in fullscreen mode + /// + public ReactiveObject StartFullscreen { get; private set; } + public UiSection() { GuiColumns = new Columns(); @@ -89,6 +94,7 @@ namespace Ryujinx.Configuration GameDirs = new ReactiveObject>(); EnableCustomTheme = new ReactiveObject(); CustomThemePath = new ReactiveObject(); + StartFullscreen = new ReactiveObject(); } } @@ -435,6 +441,7 @@ namespace Ryujinx.Configuration GameDirs = Ui.GameDirs, EnableCustomTheme = Ui.EnableCustomTheme, CustomThemePath = Ui.CustomThemePath, + StartFullscreen = Ui.StartFullscreen, EnableKeyboard = Hid.EnableKeyboard, Hotkeys = Hid.Hotkeys, KeyboardConfig = keyboardConfigList, @@ -490,6 +497,7 @@ namespace Ryujinx.Configuration Ui.GameDirs.Value = new List(); Ui.EnableCustomTheme.Value = false; Ui.CustomThemePath.Value = ""; + Ui.StartFullscreen.Value = false; Hid.EnableKeyboard.Value = false; Hid.Hotkeys.Value = new KeyboardHotkeys { @@ -744,6 +752,15 @@ namespace Ryujinx.Configuration configurationFileUpdated = true; } + if (configurationFileFormat.Version < 17) + { + Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 17."); + + configurationFileFormat.StartFullscreen = false; + + configurationFileUpdated = true; + } + List inputConfig = new List(); inputConfig.AddRange(configurationFileFormat.ControllerConfig); inputConfig.AddRange(configurationFileFormat.KeyboardConfig); @@ -792,6 +809,7 @@ namespace Ryujinx.Configuration Ui.GameDirs.Value = configurationFileFormat.GameDirs; Ui.EnableCustomTheme.Value = configurationFileFormat.EnableCustomTheme; Ui.CustomThemePath.Value = configurationFileFormat.CustomThemePath; + Ui.StartFullscreen.Value = configurationFileFormat.StartFullscreen; Hid.EnableKeyboard.Value = configurationFileFormat.EnableKeyboard; Hid.Hotkeys.Value = configurationFileFormat.Hotkeys; Hid.InputConfig.Value = inputConfig; diff --git a/Ryujinx/Config.json b/Ryujinx/Config.json index 6c6f9befa..293a8dca9 100644 --- a/Ryujinx/Config.json +++ b/Ryujinx/Config.json @@ -1,5 +1,5 @@ -{ - "version": 15, +{ + "version": 17, "res_scale": 1, "res_scale_custom": 1, "max_anisotropy": -1, @@ -47,6 +47,7 @@ "game_dirs": [], "enable_custom_theme": false, "custom_theme_path": "", + "start_fullscreen": false, "enable_keyboard": false, "hotkeys": { "toggle_vsync": "Tab" diff --git a/Ryujinx/Program.cs b/Ryujinx/Program.cs index 927ed80a1..12db52a39 100644 --- a/Ryujinx/Program.cs +++ b/Ryujinx/Program.cs @@ -25,6 +25,7 @@ namespace Ryujinx // Parse Arguments string launchPath = null; string baseDirPath = null; + bool startFullscreen = false; for (int i = 0; i < args.Length; ++i) { string arg = args[i]; @@ -39,6 +40,10 @@ namespace Ryujinx baseDirPath = args[++i]; } + else if (arg == "-f" || arg == "--fullscreen") + { + startFullscreen = true; + } else if (launchPath == null) { launchPath = arg; @@ -107,6 +112,11 @@ namespace Ryujinx ConfigurationState.Instance.ToFileFormat().SaveConfig(appDataConfigurationPath); } + if (startFullscreen) + { + ConfigurationState.Instance.Ui.StartFullscreen.Value = true; + } + PrintSystemInfo(); Application.Init(); diff --git a/Ryujinx/Ui/MainWindow.cs b/Ryujinx/Ui/MainWindow.cs index 639229487..b54ba6249 100644 --- a/Ryujinx/Ui/MainWindow.cs +++ b/Ryujinx/Ui/MainWindow.cs @@ -57,6 +57,7 @@ namespace Ryujinx.Ui [GUI] Box _statusBar; [GUI] MenuItem _stopEmulation; [GUI] MenuItem _fullScreen; + [GUI] CheckMenuItem _startFullScreen; [GUI] CheckMenuItem _favToggle; [GUI] MenuItem _firmwareInstallDirectory; [GUI] MenuItem _firmwareInstallFile; @@ -136,6 +137,11 @@ namespace Ryujinx.Ui ApplyTheme(); + if (ConfigurationState.Instance.Ui.StartFullscreen) + { + _startFullScreen.Active = true; + } + _stopEmulation.Sensitive = false; if (ConfigurationState.Instance.Ui.GuiColumns.FavColumn) _favToggle.Active = true; @@ -552,6 +558,10 @@ namespace Ryujinx.Ui { ToggleExtraWidgets(false); } + else if (ConfigurationState.Instance.Ui.StartFullscreen.Value) + { + FullScreen_Toggled(null, null); + } }); _glWidget.WaitEvent.WaitOne(); @@ -1164,7 +1174,7 @@ namespace Ryujinx.Ui } } - private void FullScreen_Toggled(object o, EventArgs args) + private void FullScreen_Toggled(object sender, EventArgs args) { bool fullScreenToggled = this.Window.State.HasFlag(Gdk.WindowState.Fullscreen); @@ -1182,6 +1192,13 @@ namespace Ryujinx.Ui } } + private void StartFullScreen_Toggled(object sender, EventArgs args) + { + ConfigurationState.Instance.Ui.StartFullscreen.Value = _startFullScreen.Active; + + SaveConfig(); + } + private void Settings_Pressed(object sender, EventArgs args) { SettingsWindow settingsWin = new SettingsWindow(_virtualFileSystem, _contentManager); diff --git a/Ryujinx/Ui/MainWindow.glade b/Ryujinx/Ui/MainWindow.glade index 1dbec2136..3b9348610 100644 --- a/Ryujinx/Ui/MainWindow.glade +++ b/Ryujinx/Ui/MainWindow.glade @@ -112,11 +112,26 @@ True + + + True + False + Start Games in Fullscreen Mode + True + + + + + + True + False + + True False - Stop emualtion of the current game and return to game selection + Stop emulation of the current game and return to game selection Stop Emulation True diff --git a/Ryujinx/_schema.json b/Ryujinx/_schema.json index 4401c03ca..1602b48a4 100644 --- a/Ryujinx/_schema.json +++ b/Ryujinx/_schema.json @@ -1379,6 +1379,17 @@ "description": "Path to custom GUI theme", "default": "" }, + "start_fullscreen": { + "$id": "#/properties/start_fullscreen", + "type": "boolean", + "title": "Start games in fullscreen mode", + "description": "Start games in fullscreen mode", + "default": false, + "examples": [ + true, + false + ] + }, "enable_keyboard": { "$id": "#/properties/enable_keyboard", "type": "boolean",