mirror of
https://github.com/Jacobwasbeast/LegacyWeaveLoader.git
synced 2026-09-23 10:12:27 +00:00
runtime: add launcher-driven extensive symbol scan mode
This commit is contained in:
@@ -16,15 +16,18 @@ public static class Injector
|
||||
IntPtr ThreadHandle,
|
||||
int ProcessId);
|
||||
|
||||
public static InjectedProcess LaunchSuspended(string exePath, string? workingDir = null)
|
||||
public static InjectedProcess LaunchSuspended(string exePath, string? workingDir = null, string? extraArgs = null)
|
||||
{
|
||||
workingDir ??= Path.GetDirectoryName(exePath);
|
||||
string commandLine = $"\"{exePath}\"";
|
||||
if (!string.IsNullOrWhiteSpace(extraArgs))
|
||||
commandLine += " " + extraArgs;
|
||||
|
||||
var si = new STARTUPINFO { cb = Marshal.SizeOf<STARTUPINFO>() };
|
||||
|
||||
bool success = CreateProcess(
|
||||
exePath,
|
||||
null,
|
||||
commandLine,
|
||||
IntPtr.Zero,
|
||||
IntPtr.Zero,
|
||||
false,
|
||||
|
||||
@@ -24,11 +24,21 @@ class Program
|
||||
try
|
||||
{
|
||||
var config = Config.Load(configFile);
|
||||
bool extensiveSymbolScan = false;
|
||||
|
||||
if (args.Length > 0 && File.Exists(args[0]))
|
||||
foreach (string arg in args)
|
||||
{
|
||||
config.GameExePath = args[0];
|
||||
config.Save(configFile);
|
||||
if (arg == "--extensive-symbol-scan")
|
||||
{
|
||||
extensiveSymbolScan = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (File.Exists(arg))
|
||||
{
|
||||
config.GameExePath = arg;
|
||||
config.Save(configFile);
|
||||
}
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(config.GameExePath) || !File.Exists(config.GameExePath))
|
||||
@@ -72,8 +82,12 @@ class Program
|
||||
int modCount = Directory.GetFiles(modsDir, "*.dll").Length;
|
||||
Console.WriteLine($"Found {modCount} mod(s) in mods/");
|
||||
Console.WriteLine($"Launching {Path.GetFileName(config.GameExePath)}...");
|
||||
if (extensiveSymbolScan)
|
||||
Console.WriteLine("[..] Extensive symbol scan mode enabled");
|
||||
|
||||
var process = Injector.LaunchSuspended(config.GameExePath);
|
||||
var process = Injector.LaunchSuspended(
|
||||
config.GameExePath,
|
||||
extraArgs: extensiveSymbolScan ? "--extensive-symbol-scan" : null);
|
||||
Console.WriteLine($"[OK] Game process created (PID: {process.ProcessId})");
|
||||
Console.WriteLine($"[..] Injecting {RuntimeDllName}...");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user