aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Ava
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.Ava')
-rw-r--r--Ryujinx.Ava/App.axaml.cs4
-rw-r--r--Ryujinx.Ava/Program.cs65
-rw-r--r--Ryujinx.Ava/Ui/ViewModels/SettingsViewModel.cs4
-rw-r--r--Ryujinx.Ava/Ui/Windows/MainWindow.axaml.cs5
4 files changed, 25 insertions, 53 deletions
diff --git a/Ryujinx.Ava/App.axaml.cs b/Ryujinx.Ava/App.axaml.cs
index 180c74b4..3ab1b7b8 100644
--- a/Ryujinx.Ava/App.axaml.cs
+++ b/Ryujinx.Ava/App.axaml.cs
@@ -10,6 +10,7 @@ using Ryujinx.Ava.Ui.Windows;
using Ryujinx.Common;
using Ryujinx.Common.Logging;
using Ryujinx.Ui.Common.Configuration;
+using Ryujinx.Ui.Common.Helper;
using System;
using System.Diagnostics;
using System.IO;
@@ -64,8 +65,7 @@ namespace Ryujinx.Ava
if (result == UserResult.Yes)
{
var path = Process.GetCurrentProcess().MainModule.FileName;
- var info = new ProcessStartInfo() { FileName = path, UseShellExecute = false };
- var proc = Process.Start(info);
+ var proc = Process.Start(path, CommandLineState.Arguments);
desktop.Shutdown();
Environment.Exit(0);
}
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()
diff --git a/Ryujinx.Ava/Ui/ViewModels/SettingsViewModel.cs b/Ryujinx.Ava/Ui/ViewModels/SettingsViewModel.cs
index f4807023..088bf3ac 100644
--- a/Ryujinx.Ava/Ui/ViewModels/SettingsViewModel.cs
+++ b/Ryujinx.Ava/Ui/ViewModels/SettingsViewModel.cs
@@ -21,14 +21,10 @@ using Ryujinx.HLE.HOS.Services.Time.TimeZone;
using Ryujinx.Input;
using Ryujinx.Ui.Common.Configuration;
using Ryujinx.Ui.Common.Configuration.System;
-using Silk.NET.Vulkan;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
-using System.Diagnostics;
using System.Linq;
-using System.Runtime.InteropServices;
-using System.Threading.Tasks;
using TimeZone = Ryujinx.Ava.Ui.Models.TimeZone;
namespace Ryujinx.Ava.Ui.ViewModels
diff --git a/Ryujinx.Ava/Ui/Windows/MainWindow.axaml.cs b/Ryujinx.Ava/Ui/Windows/MainWindow.axaml.cs
index ae79b1c9..774178d6 100644
--- a/Ryujinx.Ava/Ui/Windows/MainWindow.axaml.cs
+++ b/Ryujinx.Ava/Ui/Windows/MainWindow.axaml.cs
@@ -23,6 +23,7 @@ using Ryujinx.Modules;
using Ryujinx.Ui.App.Common;
using Ryujinx.Ui.Common;
using Ryujinx.Ui.Common.Configuration;
+using Ryujinx.Ui.Common.Helper;
using SixLabors.ImageSharp.PixelFormats;
using System;
using System.ComponentModel;
@@ -247,7 +248,7 @@ namespace Ryujinx.Ava.Ui.Windows
{
RendererControl.CreateVulkan();
}
-
+
AppHost = new AppHost(RendererControl, InputManager, path, VirtualFileSystem, ContentManager, AccountManager, _userChannelPersistence, this);
if (!AppHost.LoadGuestApplication().Result)
@@ -432,7 +433,7 @@ namespace Ryujinx.Ava.Ui.Windows
// Consider removing this at some point in the future when we don't need to worry about old saves.
VirtualFileSystem.FixExtraData(LibHacHorizonManager.RyujinxClient);
- AccountManager = new AccountManager(LibHacHorizonManager.RyujinxClient, Program.CommandLineProfile);
+ AccountManager = new AccountManager(LibHacHorizonManager.RyujinxClient, CommandLineState.Profile);
VirtualFileSystem.ReloadKeySet();