diff options
Diffstat (limited to 'Ryujinx.Ava/Program.cs')
-rw-r--r-- | Ryujinx.Ava/Program.cs | 65 |
1 files changed, 20 insertions, 45 deletions
diff --git a/Ryujinx.Ava/Program.cs b/Ryujinx.Ava/Program.cs index 61b184c6..053bccab 100644 --- a/Ryujinx.Ava/Program.cs +++ b/Ryujinx.Ava/Program.cs @@ -13,6 +13,7 @@ using Ryujinx.Common.SystemInfo; using Ryujinx.Modules; using Ryujinx.Ui.Common; using Ryujinx.Ui.Common.Configuration; +using Ryujinx.Ui.Common.Helper; using System; using System.IO; using System.Runtime.InteropServices; @@ -26,7 +27,6 @@ namespace Ryujinx.Ava public static double ActualScaleFactor { get; set; } public static string Version { get; private set; } public static string ConfigurationPath { get; private set; } - public static string CommandLineProfile { get; set; } public static bool PreviewerDetached { get; private set; } public static RenderTimer RenderTimer { get; private set; } @@ -87,46 +87,8 @@ namespace Ryujinx.Ava private static void Initialize(string[] args) { - // Parse Arguments. - string launchPathArg = null; - string baseDirPathArg = null; - bool startFullscreenArg = false; - - for (int i = 0; i < args.Length; ++i) - { - string arg = args[i]; - - if (arg == "-r" || arg == "--root-data-dir") - { - if (i + 1 >= args.Length) - { - Logger.Error?.Print(LogClass.Application, $"Invalid option '{arg}'"); - - continue; - } - - baseDirPathArg = args[++i]; - } - else if (arg == "-p" || arg == "--profile") - { - if (i + 1 >= args.Length) - { - Logger.Error?.Print(LogClass.Application, $"Invalid option '{arg}'"); - - continue; - } - - CommandLineProfile = args[++i]; - } - else if (arg == "-f" || arg == "--fullscreen") - { - startFullscreenArg = true; - } - else - { - launchPathArg = arg; - } - } + // Parse arguments + CommandLineState.ParseArguments(args); // Delete backup files after updating. Task.Run(Updater.CleanupUpdate); @@ -135,10 +97,10 @@ namespace Ryujinx.Ava // Hook unhandled exception and process exit events. AppDomain.CurrentDomain.UnhandledException += (object sender, UnhandledExceptionEventArgs e) => ProcessUnhandledException(e.ExceptionObject as Exception, e.IsTerminating); - AppDomain.CurrentDomain.ProcessExit += (object sender, EventArgs e) => Exit(); + AppDomain.CurrentDomain.ProcessExit += (object sender, EventArgs e) => Exit(); // Setup base data directory. - AppDataManager.Initialize(baseDirPathArg); + AppDataManager.Initialize(CommandLineState.BaseDirPathArg); // Initialize the configuration. ConfigurationState.Initialize(); @@ -173,9 +135,9 @@ namespace Ryujinx.Ava } } - if (launchPathArg != null) + if (CommandLineState.LaunchPathArg != null) { - MainWindow.DeferLoadApplication(launchPathArg, startFullscreenArg); + MainWindow.DeferLoadApplication(CommandLineState.LaunchPathArg, CommandLineState.StartFullscreenArg); } } @@ -215,6 +177,19 @@ namespace Ryujinx.Ava Logger.Warning?.PrintMsg(LogClass.Application, $"Failed to load config! Loading the default config instead.\nFailed config location {ConfigurationPath}"); } } + + // Check if graphics backend was overridden + if (CommandLineState.OverrideGraphicsBackend != null) + { + if (CommandLineState.OverrideGraphicsBackend.ToLower() == "opengl") + { + ConfigurationState.Instance.Graphics.GraphicsBackend.Value = GraphicsBackend.OpenGl; + } + else if (CommandLineState.OverrideGraphicsBackend.ToLower() == "vulkan") + { + ConfigurationState.Instance.Graphics.GraphicsBackend.Value = GraphicsBackend.Vulkan; + } + } } private static void PrintSystemInfo() |