diff --git a/EpicRerouter/ExeSide/Program.cs b/EpicRerouter/ExeSide/Program.cs index d28d10d7..47b1d8e3 100644 --- a/EpicRerouter/ExeSide/Program.cs +++ b/EpicRerouter/ExeSide/Program.cs @@ -1,5 +1,6 @@ using System; using System.IO; +using System.Linq; using System.Reflection; using System.Threading; using static EntitlementsManager; @@ -25,6 +26,8 @@ namespace EpicRerouter.ExeSide Console.WriteLine($"version = {Version}"); var managedDir = args[2]; Console.WriteLine($"managed dir = {managedDir}"); + var gameArgs = args.Skip(3).ToArray(); + Console.WriteLine($"game args = {string.Join(", ", gameArgs)}"); Console.WriteLine(); AppDomain.CurrentDomain.AssemblyResolve += (_, e) => diff --git a/EpicRerouter/ModSide/Interop.cs b/EpicRerouter/ModSide/Interop.cs index 68ef07cf..8915a846 100644 --- a/EpicRerouter/ModSide/Interop.cs +++ b/EpicRerouter/ModSide/Interop.cs @@ -1,6 +1,8 @@ using HarmonyLib; +using System; using System.Diagnostics; using System.IO; +using System.Linq; using System.Reflection; using UnityEngine; using static EntitlementsManager; @@ -31,6 +33,8 @@ namespace EpicRerouter.ModSide Log($"process path = {processPath}"); var gamePath = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(typeof(EpicPlatformManager).Assembly.Location)!, "..")); Log($"game path = {gamePath}"); + var workingDirectory = Path.Combine(gamePath, "Plugins", "x86_64"); + Log($"working dir = {workingDirectory}"); var args = new[] { Application.productName, @@ -38,11 +42,15 @@ namespace EpicRerouter.ModSide Path.Combine(gamePath, "Managed") }; Log($"args = {args.Join()}"); + var gameArgs = Environment.GetCommandLineArgs(); + Log($"game args = {gameArgs.Join()}"); var process = Process.Start(new ProcessStartInfo { FileName = processPath, - WorkingDirectory = Path.Combine(gamePath, "Plugins", "x86_64"), - Arguments = args.Join(x => $"\"{x}\"", " "), + WorkingDirectory = workingDirectory, + Arguments = args + .Concat(gameArgs) + .Join(x => $"\"{x}\"", " "), UseShellExecute = false }); process!.WaitForExit();