From 3bda890f7b00e26a692b686a29bc5f6fb1a27755 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Wed, 2 Oct 2019 20:34:23 +0100 Subject: [PATCH] Add Engine.LaunchWrapper launch argument for mod switching. --- OpenRA.Game/Game.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/OpenRA.Game/Game.cs b/OpenRA.Game/Game.cs index 03de13ec0b..1ccdb57396 100644 --- a/OpenRA.Game/Game.cs +++ b/OpenRA.Game/Game.cs @@ -41,6 +41,7 @@ namespace OpenRA public static ICursor Cursor; public static bool HideCursor; static WorldRenderer worldRenderer; + static string modLaunchWrapper; internal static OrderManager OrderManager; static Server.Server server; @@ -351,6 +352,8 @@ namespace OpenRA foreach (var mod in Mods) Console.WriteLine("\t{0}: {1} ({2})", mod.Key, mod.Value.Metadata.Title, mod.Value.Metadata.Version); + modLaunchWrapper = args.GetValue("Engine.LaunchWrapper", null); + ExternalMods = new ExternalMods(); Manifest currentMod; @@ -509,8 +512,15 @@ namespace OpenRA { try { + var path = mod.LaunchPath; var args = launchArguments != null ? mod.LaunchArgs.Append(launchArguments) : mod.LaunchArgs; - var p = Process.Start(mod.LaunchPath, args.Select(a => "\"" + a + "\"").JoinWith(" ")); + if (modLaunchWrapper != null) + { + path = modLaunchWrapper; + args = new[] { mod.LaunchPath }.Concat(args); + } + + var p = Process.Start(path, args.Select(a => "\"" + a + "\"").JoinWith(" ")); if (p == null || p.HasExited) onFailed(); else