Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion RenderiteHook/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,37 @@ public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructio
public static string OnStartRenderer(string args)
{
CopyDoorstopFiles(Engine.Current.RenderSystem);
var newArgs = string.Join(' ', [args, .. Environment.GetCommandLineArgs().Skip(1)]);

var originalArgs = GetOriginalCommandLineArgs();
var newArgs = string.IsNullOrEmpty(originalArgs) ? args : args + " " + originalArgs;
Log.LogInfo($"Starting renderer with args: {newArgs}");
return newArgs;
}

private static string GetOriginalCommandLineArgs()
{
string str = Environment.CommandLine;

if (str.StartsWith("\"") && str.Length > 1)
{
int ix = str.IndexOf("\"", 1);
if (ix != -1)
{
str = str.Substring(ix + 1).TrimStart();
}
}
else
{
int ix = str.IndexOf(" ");
if (ix != -1)
{
str = str.Substring(ix + 1).TrimStart();
}
}

return str;
}

private static void CopyDoorstopFiles(RenderSystem renderSystem)
{
try
Expand Down