Add Command Line Parameter to Override Mods #499

Closed
TheMetalStorm wants to merge 4 commits from cli-mods into master
2 changed files with 5 additions and 28 deletions
Showing only changes of commit 35f2382c08 - Show all commits

View File

@ -114,7 +114,7 @@ namespace Ryujinx.Ava
AppDomain.CurrentDomain.ProcessExit += (_, _) => Exit();
// Setup base data directory.
AppDataManager.Initialize(CommandLineState.BaseDirPathArg, CommandLineState.Mods);
AppDataManager.Initialize(CommandLineState.BaseDirPathArg, CommandLineState.OverrideMods);
// Initialize the configuration.
ConfigurationState.Initialize();

View File

@ -1,4 +1,5 @@
using Ryujinx.Common.Logging;
using System;
using System.Collections.Generic;
namespace Ryujinx.Ava.Utilities
@ -6,7 +7,7 @@ namespace Ryujinx.Ava.Utilities
public static class CommandLineState
{
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? OverrideHardwareAcceleration { get; private set; }
@ -22,7 +23,6 @@ namespace Ryujinx.Ava.Utilities
public static void ParseArguments(string[] args)
{
List<string> arguments = new();
List<string> mods = new();
// Parse Arguments.
for (int i = 0; i < args.Length; ++i)
@ -82,36 +82,14 @@ namespace Ryujinx.Ava.Utilities
break;
case "-m":
case "--mod":
int numMods;
if (i + 1 >= args.Length)
{
Logger.Error?.Print(LogClass.Application, $"Argument '{arg}' expects a number of mods as next argument");
continue;
}
if (!int.TryParse(args[++i], out numMods))
{
i--;
Logger.Error?.Print(LogClass.Application, $"Expected number of mods, got '{arg}'");
Logger.Error?.Print(LogClass.Application, $"Invalid option '{arg}'");
continue;
}
if (i + numMods >= args.Length)
{
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;
OverrideMods = args[++i].Split(',');
break;
case "--docked-mode":
OverrideDockedMode = true;
@ -142,7 +120,6 @@ namespace Ryujinx.Ava.Utilities
}
Arguments = arguments.ToArray();
Mods = mods.ToArray();
}
}
}