From e4413542b2199894453c8ba6dc67a86ee5add7bd Mon Sep 17 00:00:00 2001 From: TSRBerry <20988865+TSRBerry@users.noreply.github.com> Date: Tue, 10 Jan 2023 00:59:23 +0100 Subject: [PATCH] Add command line arguments to override docked mode (#4239) * Add command line args for docked mode * Apply suggestions from code review Co-authored-by: Ac_K Co-authored-by: Ac_K --- Ryujinx.Ava/Program.cs | 8 +++++++- Ryujinx.Ui.Common/Helper/CommandLineState.cs | 7 +++++++ Ryujinx/Program.cs | 8 +++++++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Ryujinx.Ava/Program.cs b/Ryujinx.Ava/Program.cs index 1dc1a7bce1..010aff5148 100644 --- a/Ryujinx.Ava/Program.cs +++ b/Ryujinx.Ava/Program.cs @@ -6,8 +6,8 @@ using Ryujinx.Common; using Ryujinx.Common.Configuration; using Ryujinx.Common.GraphicsDriver; using Ryujinx.Common.Logging; -using Ryujinx.Common.SystemInterop; using Ryujinx.Common.SystemInfo; +using Ryujinx.Common.SystemInterop; using Ryujinx.Modules; using Ryujinx.SDL2.Common; using Ryujinx.Ui.Common; @@ -227,6 +227,12 @@ namespace Ryujinx.Ava ConfigurationState.Instance.Graphics.GraphicsBackend.Value = GraphicsBackend.Vulkan; } } + + // Check if docked mode was overriden. + if (CommandLineState.OverrideDockedMode.HasValue) + { + ConfigurationState.Instance.System.EnableDockedMode.Value = CommandLineState.OverrideDockedMode.Value; + } } private static void PrintSystemInfo() diff --git a/Ryujinx.Ui.Common/Helper/CommandLineState.cs b/Ryujinx.Ui.Common/Helper/CommandLineState.cs index cda4af4ed8..8ca7fba185 100644 --- a/Ryujinx.Ui.Common/Helper/CommandLineState.cs +++ b/Ryujinx.Ui.Common/Helper/CommandLineState.cs @@ -7,6 +7,7 @@ namespace Ryujinx.Ui.Common.Helper { public static string[] Arguments { get; private set; } + public static bool? OverrideDockedMode { get; private set; } public static string OverrideGraphicsBackend { get; private set; } public static string BaseDirPathArg { get; private set; } public static string Profile { get; private set; } @@ -69,6 +70,12 @@ namespace Ryujinx.Ui.Common.Helper OverrideGraphicsBackend = args[++i]; break; + case "--docked-mode": + OverrideDockedMode = true; + break; + case "--handheld-mode": + OverrideDockedMode = false; + break; default: LaunchPathArg = arg; break; diff --git a/Ryujinx/Program.cs b/Ryujinx/Program.cs index b1fedaade7..56352a4ced 100644 --- a/Ryujinx/Program.cs +++ b/Ryujinx/Program.cs @@ -3,8 +3,8 @@ using Ryujinx.Common; using Ryujinx.Common.Configuration; using Ryujinx.Common.GraphicsDriver; using Ryujinx.Common.Logging; -using Ryujinx.Common.SystemInterop; using Ryujinx.Common.SystemInfo; +using Ryujinx.Common.SystemInterop; using Ryujinx.Modules; using Ryujinx.SDL2.Common; using Ryujinx.Ui; @@ -271,6 +271,12 @@ namespace Ryujinx } } + // Check if docked mode was overriden. + if (CommandLineState.OverrideDockedMode.HasValue) + { + ConfigurationState.Instance.System.EnableDockedMode.Value = CommandLineState.OverrideDockedMode.Value; + } + // Logging system information. PrintSystemInfo();