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
This commit is contained in:
Xpl0itR 2020-12-01 22:02:27 +00:00 committed by GitHub
parent f6d88558b1
commit bd8d28c59d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 83 additions and 6 deletions

View file

@ -14,7 +14,7 @@ namespace Ryujinx.Configuration
/// <summary> /// <summary>
/// The current version of the file format /// The current version of the file format
/// </summary> /// </summary>
public const int CurrentVersion = 16; public const int CurrentVersion = 17;
public int Version { get; set; } public int Version { get; set; }
@ -188,6 +188,11 @@ namespace Ryujinx.Configuration
/// </summary> /// </summary>
public string CustomThemePath { get; set; } public string CustomThemePath { get; set; }
/// <summary>
/// Start games in fullscreen mode
/// </summary>
public bool StartFullscreen { get; set; }
/// <summary> /// <summary>
/// Enable or disable keyboard support (Independent from controllers binding) /// Enable or disable keyboard support (Independent from controllers binding)
/// </summary> /// </summary>

View file

@ -1,4 +1,4 @@
using Ryujinx.Common; using Ryujinx.Common;
using Ryujinx.Common.Configuration; using Ryujinx.Common.Configuration;
using Ryujinx.Common.Configuration.Hid; using Ryujinx.Common.Configuration.Hid;
using Ryujinx.Common.Logging; using Ryujinx.Common.Logging;
@ -82,6 +82,11 @@ namespace Ryujinx.Configuration
/// </summary> /// </summary>
public ReactiveObject<string> CustomThemePath { get; private set; } public ReactiveObject<string> CustomThemePath { get; private set; }
/// <summary>
/// Start games in fullscreen mode
/// </summary>
public ReactiveObject<bool> StartFullscreen { get; private set; }
public UiSection() public UiSection()
{ {
GuiColumns = new Columns(); GuiColumns = new Columns();
@ -89,6 +94,7 @@ namespace Ryujinx.Configuration
GameDirs = new ReactiveObject<List<string>>(); GameDirs = new ReactiveObject<List<string>>();
EnableCustomTheme = new ReactiveObject<bool>(); EnableCustomTheme = new ReactiveObject<bool>();
CustomThemePath = new ReactiveObject<string>(); CustomThemePath = new ReactiveObject<string>();
StartFullscreen = new ReactiveObject<bool>();
} }
} }
@ -435,6 +441,7 @@ namespace Ryujinx.Configuration
GameDirs = Ui.GameDirs, GameDirs = Ui.GameDirs,
EnableCustomTheme = Ui.EnableCustomTheme, EnableCustomTheme = Ui.EnableCustomTheme,
CustomThemePath = Ui.CustomThemePath, CustomThemePath = Ui.CustomThemePath,
StartFullscreen = Ui.StartFullscreen,
EnableKeyboard = Hid.EnableKeyboard, EnableKeyboard = Hid.EnableKeyboard,
Hotkeys = Hid.Hotkeys, Hotkeys = Hid.Hotkeys,
KeyboardConfig = keyboardConfigList, KeyboardConfig = keyboardConfigList,
@ -490,6 +497,7 @@ namespace Ryujinx.Configuration
Ui.GameDirs.Value = new List<string>(); Ui.GameDirs.Value = new List<string>();
Ui.EnableCustomTheme.Value = false; Ui.EnableCustomTheme.Value = false;
Ui.CustomThemePath.Value = ""; Ui.CustomThemePath.Value = "";
Ui.StartFullscreen.Value = false;
Hid.EnableKeyboard.Value = false; Hid.EnableKeyboard.Value = false;
Hid.Hotkeys.Value = new KeyboardHotkeys Hid.Hotkeys.Value = new KeyboardHotkeys
{ {
@ -744,6 +752,15 @@ namespace Ryujinx.Configuration
configurationFileUpdated = true; 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> inputConfig = new List<InputConfig>(); List<InputConfig> inputConfig = new List<InputConfig>();
inputConfig.AddRange(configurationFileFormat.ControllerConfig); inputConfig.AddRange(configurationFileFormat.ControllerConfig);
inputConfig.AddRange(configurationFileFormat.KeyboardConfig); inputConfig.AddRange(configurationFileFormat.KeyboardConfig);
@ -792,6 +809,7 @@ namespace Ryujinx.Configuration
Ui.GameDirs.Value = configurationFileFormat.GameDirs; Ui.GameDirs.Value = configurationFileFormat.GameDirs;
Ui.EnableCustomTheme.Value = configurationFileFormat.EnableCustomTheme; Ui.EnableCustomTheme.Value = configurationFileFormat.EnableCustomTheme;
Ui.CustomThemePath.Value = configurationFileFormat.CustomThemePath; Ui.CustomThemePath.Value = configurationFileFormat.CustomThemePath;
Ui.StartFullscreen.Value = configurationFileFormat.StartFullscreen;
Hid.EnableKeyboard.Value = configurationFileFormat.EnableKeyboard; Hid.EnableKeyboard.Value = configurationFileFormat.EnableKeyboard;
Hid.Hotkeys.Value = configurationFileFormat.Hotkeys; Hid.Hotkeys.Value = configurationFileFormat.Hotkeys;
Hid.InputConfig.Value = inputConfig; Hid.InputConfig.Value = inputConfig;

View file

@ -1,5 +1,5 @@
{ {
"version": 15, "version": 17,
"res_scale": 1, "res_scale": 1,
"res_scale_custom": 1, "res_scale_custom": 1,
"max_anisotropy": -1, "max_anisotropy": -1,
@ -47,6 +47,7 @@
"game_dirs": [], "game_dirs": [],
"enable_custom_theme": false, "enable_custom_theme": false,
"custom_theme_path": "", "custom_theme_path": "",
"start_fullscreen": false,
"enable_keyboard": false, "enable_keyboard": false,
"hotkeys": { "hotkeys": {
"toggle_vsync": "Tab" "toggle_vsync": "Tab"

View file

@ -25,6 +25,7 @@ namespace Ryujinx
// Parse Arguments // Parse Arguments
string launchPath = null; string launchPath = null;
string baseDirPath = null; string baseDirPath = null;
bool startFullscreen = false;
for (int i = 0; i < args.Length; ++i) for (int i = 0; i < args.Length; ++i)
{ {
string arg = args[i]; string arg = args[i];
@ -39,6 +40,10 @@ namespace Ryujinx
baseDirPath = args[++i]; baseDirPath = args[++i];
} }
else if (arg == "-f" || arg == "--fullscreen")
{
startFullscreen = true;
}
else if (launchPath == null) else if (launchPath == null)
{ {
launchPath = arg; launchPath = arg;
@ -107,6 +112,11 @@ namespace Ryujinx
ConfigurationState.Instance.ToFileFormat().SaveConfig(appDataConfigurationPath); ConfigurationState.Instance.ToFileFormat().SaveConfig(appDataConfigurationPath);
} }
if (startFullscreen)
{
ConfigurationState.Instance.Ui.StartFullscreen.Value = true;
}
PrintSystemInfo(); PrintSystemInfo();
Application.Init(); Application.Init();

View file

@ -57,6 +57,7 @@ namespace Ryujinx.Ui
[GUI] Box _statusBar; [GUI] Box _statusBar;
[GUI] MenuItem _stopEmulation; [GUI] MenuItem _stopEmulation;
[GUI] MenuItem _fullScreen; [GUI] MenuItem _fullScreen;
[GUI] CheckMenuItem _startFullScreen;
[GUI] CheckMenuItem _favToggle; [GUI] CheckMenuItem _favToggle;
[GUI] MenuItem _firmwareInstallDirectory; [GUI] MenuItem _firmwareInstallDirectory;
[GUI] MenuItem _firmwareInstallFile; [GUI] MenuItem _firmwareInstallFile;
@ -136,6 +137,11 @@ namespace Ryujinx.Ui
ApplyTheme(); ApplyTheme();
if (ConfigurationState.Instance.Ui.StartFullscreen)
{
_startFullScreen.Active = true;
}
_stopEmulation.Sensitive = false; _stopEmulation.Sensitive = false;
if (ConfigurationState.Instance.Ui.GuiColumns.FavColumn) _favToggle.Active = true; if (ConfigurationState.Instance.Ui.GuiColumns.FavColumn) _favToggle.Active = true;
@ -552,6 +558,10 @@ namespace Ryujinx.Ui
{ {
ToggleExtraWidgets(false); ToggleExtraWidgets(false);
} }
else if (ConfigurationState.Instance.Ui.StartFullscreen.Value)
{
FullScreen_Toggled(null, null);
}
}); });
_glWidget.WaitEvent.WaitOne(); _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); 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) private void Settings_Pressed(object sender, EventArgs args)
{ {
SettingsWindow settingsWin = new SettingsWindow(_virtualFileSystem, _contentManager); SettingsWindow settingsWin = new SettingsWindow(_virtualFileSystem, _contentManager);

View file

@ -112,11 +112,26 @@
<property name="use_underline">True</property> <property name="use_underline">True</property>
</object> </object>
</child> </child>
<child>
<object class="GtkCheckMenuItem" id="_startFullScreen">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Start Games in Fullscreen Mode</property>
<property name="use_underline">True</property>
<signal name="toggled" handler="StartFullScreen_Toggled" swapped="no"/>
</object>
</child>
<child>
<object class="GtkSeparatorMenuItem">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
</child>
<child> <child>
<object class="GtkMenuItem" id="_stopEmulation"> <object class="GtkMenuItem" id="_stopEmulation">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Stop emualtion of the current game and return to game selection</property> <property name="tooltip_text" translatable="yes">Stop emulation of the current game and return to game selection</property>
<property name="label" translatable="yes">Stop Emulation</property> <property name="label" translatable="yes">Stop Emulation</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<signal name="activate" handler="StopEmulation_Pressed" swapped="no"/> <signal name="activate" handler="StopEmulation_Pressed" swapped="no"/>

View file

@ -1379,6 +1379,17 @@
"description": "Path to custom GUI theme", "description": "Path to custom GUI theme",
"default": "" "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": { "enable_keyboard": {
"$id": "#/properties/enable_keyboard", "$id": "#/properties/enable_keyboard",
"type": "boolean", "type": "boolean",