Skip to content

Commit

Permalink
Modified Command-Line Argument Logging to show Internal Arguments Only
Browse files Browse the repository at this point in the history
  • Loading branch information
HerpDerpinstine committed Sep 29, 2024
1 parent 3648e68 commit 86d1f5f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 6 additions & 2 deletions MelonLoader/Core.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,13 @@ internal static void WelcomeMessage()
var archString = MelonUtils.IsGame32Bit() ? "x86" : "x64";
MelonLogger.MsgDirect($"Game Arch: {archString}");
MelonLogger.MsgDirect("------------------------------");
MelonLogger.MsgDirect($"Command-Line: {string.Join(" ", MelonLaunchOptions.CommandLineArgs)}");
MelonLogger.MsgDirect("Command-Line: ");
foreach (var pair in MelonLaunchOptions.InternalArguments)
if (string.IsNullOrEmpty(pair.Value))
MelonLogger.MsgDirect($" {pair.Key}");
else
MelonLogger.MsgDirect($" {pair.Key} = {pair.Value}");
MelonLogger.MsgDirect("------------------------------");

MelonEnvironment.PrintEnvironment();
}

Expand Down
3 changes: 3 additions & 0 deletions MelonLoader/MelonLaunchOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public static class MelonLaunchOptions
/// </para>
/// </summary>
public static Dictionary<string, string> ExternalArguments { get; private set; } = new Dictionary<string, string>();
public static Dictionary<string, string> InternalArguments { get; private set; } = new Dictionary<string, string>();

/// <summary>
/// Array of All Command Line Arguments
Expand Down Expand Up @@ -64,6 +65,7 @@ internal static void Load()
// Parse Argumentless Commands
if (WithoutArg.TryGetValue(noPrefixCmd, out Action withoutArgFunc))
{
InternalArguments.Add(noPrefixCmd, null);
withoutArgFunc();
continue;
}
Expand All @@ -90,6 +92,7 @@ internal static void Load()
// Parse Argument Commands
if (WithArg.TryGetValue(noPrefixCmd, out Action<string> withArgFunc))
{
InternalArguments.Add(noPrefixCmd, cmdArg);
withArgFunc(cmdArg);
continue;
}
Expand Down

0 comments on commit 86d1f5f

Please sign in to comment.