Add Command Line Parameter to Override Mods #499
@ -114,7 +114,7 @@ namespace Ryujinx.Ava
|
|||||||
AppDomain.CurrentDomain.ProcessExit += (_, _) => Exit();
|
AppDomain.CurrentDomain.ProcessExit += (_, _) => Exit();
|
||||||
|
|
||||||
// Setup base data directory.
|
// Setup base data directory.
|
||||||
AppDataManager.Initialize(CommandLineState.BaseDirPathArg, CommandLineState.Mods);
|
AppDataManager.Initialize(CommandLineState.BaseDirPathArg, CommandLineState.OverrideMods);
|
||||||
|
|
||||||
// Initialize the configuration.
|
// Initialize the configuration.
|
||||||
ConfigurationState.Initialize();
|
ConfigurationState.Initialize();
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using Ryujinx.Common.Logging;
|
using Ryujinx.Common.Logging;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Ryujinx.Ava.Utilities
|
namespace Ryujinx.Ava.Utilities
|
||||||
@ -6,7 +7,7 @@ namespace Ryujinx.Ava.Utilities
|
|||||||
public static class CommandLineState
|
public static class CommandLineState
|
||||||
{
|
{
|
||||||
public static string[] Arguments { get; private set; }
|
public static string[] Arguments { get; private set; }
|
||||||
public static string[] Mods { get; private set; }
|
public static string[] OverrideMods { get; private set; }
|
||||||
|
|
||||||
public static bool? OverrideDockedMode { get; private set; }
|
public static bool? OverrideDockedMode { get; private set; }
|
||||||
public static bool? OverrideHardwareAcceleration { get; private set; }
|
public static bool? OverrideHardwareAcceleration { get; private set; }
|
||||||
@ -22,7 +23,6 @@ namespace Ryujinx.Ava.Utilities
|
|||||||
public static void ParseArguments(string[] args)
|
public static void ParseArguments(string[] args)
|
||||||
{
|
{
|
||||||
List<string> arguments = new();
|
List<string> arguments = new();
|
||||||
List<string> mods = new();
|
|
||||||
|
|
||||||
// Parse Arguments.
|
// Parse Arguments.
|
||||||
for (int i = 0; i < args.Length; ++i)
|
for (int i = 0; i < args.Length; ++i)
|
||||||
@ -82,36 +82,14 @@ namespace Ryujinx.Ava.Utilities
|
|||||||
break;
|
break;
|
||||||
case "-m":
|
case "-m":
|
||||||
case "--mod":
|
case "--mod":
|
||||||
int numMods;
|
|
||||||
if (i + 1 >= args.Length)
|
if (i + 1 >= args.Length)
|
||||||
{
|
{
|
||||||
Logger.Error?.Print(LogClass.Application, $"Argument '{arg}' expects a number of mods as next argument");
|
Logger.Error?.Print(LogClass.Application, $"Invalid option '{arg}'");
|
||||||
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!int.TryParse(args[++i], out numMods))
|
|
||||||
{
|
|
||||||
i--;
|
|
||||||
Logger.Error?.Print(LogClass.Application, $"Expected number of mods, got '{arg}'");
|
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i + numMods >= args.Length)
|
OverrideMods = args[++i].Split(',');
|
||||||
{
|
|
||||||
Logger.Error?.Print(LogClass.Application, $"The number of expected mods exceeds the number of command line arguments left");
|
|
||||||
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int j = i + 1; j <= i + numMods; j++)
|
|
||||||
{
|
|
||||||
mods.Add(args[j]);
|
|
||||||
|
|
||||||
Logger.Info?.Print(LogClass.Application, $"Enabled mod '{args[j]}' through cli");
|
|
||||||
}
|
|
||||||
|
|
||||||
i += numMods;
|
|
||||||
break;
|
break;
|
||||||
case "--docked-mode":
|
case "--docked-mode":
|
||||||
OverrideDockedMode = true;
|
OverrideDockedMode = true;
|
||||||
@ -142,7 +120,6 @@ namespace Ryujinx.Ava.Utilities
|
|||||||
}
|
}
|
||||||
|
|
||||||
Arguments = arguments.ToArray();
|
Arguments = arguments.ToArray();
|
||||||
Mods = mods.ToArray();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user