mirror of
https://github.com/ryujinx-mirror/ryujinx.git
synced 2024-11-23 06:39:55 +00:00
Added a command line option (-c, --config) to load a configuration file through the command line parameters (#59)
This commit is contained in:
parent
68092bf00b
commit
49574a99f5
@ -165,6 +165,11 @@ namespace Ryujinx
|
|||||||
? appDataConfigurationPath
|
? appDataConfigurationPath
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(CommandLineState.OverrideConfigFile) && File.Exists(CommandLineState.OverrideConfigFile))
|
||||||
|
{
|
||||||
|
ConfigurationPath = CommandLineState.OverrideConfigFile;
|
||||||
|
}
|
||||||
|
|
||||||
if (ConfigurationPath == null)
|
if (ConfigurationPath == null)
|
||||||
{
|
{
|
||||||
// No configuration, we load the default values and save it to disk
|
// No configuration, we load the default values and save it to disk
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using Ryujinx.Common.Logging;
|
using Ryujinx.Common.Logging;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
namespace Ryujinx.UI.Common.Helper
|
namespace Ryujinx.UI.Common.Helper
|
||||||
{
|
{
|
||||||
@ -16,6 +17,7 @@ namespace Ryujinx.UI.Common.Helper
|
|||||||
public static string LaunchPathArg { get; private set; }
|
public static string LaunchPathArg { get; private set; }
|
||||||
public static string LaunchApplicationId { get; private set; }
|
public static string LaunchApplicationId { get; private set; }
|
||||||
public static bool StartFullscreenArg { get; private set; }
|
public static bool StartFullscreenArg { get; private set; }
|
||||||
|
public static string OverrideConfigFile { get; private set; }
|
||||||
|
|
||||||
public static void ParseArguments(string[] args)
|
public static void ParseArguments(string[] args)
|
||||||
{
|
{
|
||||||
@ -96,6 +98,29 @@ namespace Ryujinx.UI.Common.Helper
|
|||||||
case "--software-gui":
|
case "--software-gui":
|
||||||
OverrideHardwareAcceleration = false;
|
OverrideHardwareAcceleration = false;
|
||||||
break;
|
break;
|
||||||
|
case "-c":
|
||||||
|
case "--config":
|
||||||
|
if (i + 1 >= args.Length)
|
||||||
|
{
|
||||||
|
Logger.Error?.Print(LogClass.Application, $"Invalid option '{arg}'");
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
string configFile = args[++i];
|
||||||
|
|
||||||
|
if (Path.GetExtension(configFile).ToLower() != ".json")
|
||||||
|
{
|
||||||
|
Logger.Error?.Print(LogClass.Application, $"Invalid option '{arg}'");
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
OverrideConfigFile = configFile;
|
||||||
|
|
||||||
|
arguments.Add(arg);
|
||||||
|
arguments.Add(args[i]);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
LaunchPathArg = arg;
|
LaunchPathArg = arg;
|
||||||
break;
|
break;
|
||||||
|
@ -150,6 +150,11 @@ namespace Ryujinx.Ava
|
|||||||
ConfigurationPath = appDataConfigurationPath;
|
ConfigurationPath = appDataConfigurationPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(CommandLineState.OverrideConfigFile) && File.Exists(CommandLineState.OverrideConfigFile))
|
||||||
|
{
|
||||||
|
ConfigurationPath = CommandLineState.OverrideConfigFile;
|
||||||
|
}
|
||||||
|
|
||||||
if (ConfigurationPath == null)
|
if (ConfigurationPath == null)
|
||||||
{
|
{
|
||||||
// No configuration, we load the default values and save it to disk
|
// No configuration, we load the default values and save it to disk
|
||||||
|
Loading…
Reference in New Issue
Block a user