diff --git a/Helpers.cs b/Helpers.cs index 791c7d3..291060d 100644 --- a/Helpers.cs +++ b/Helpers.cs @@ -364,14 +364,23 @@ public static async Task WaitBeforeInjectionAsync(StatusContext ctx, int waitTim public static bool IsUnrealExecutable(string gameExe) { var ueSuffixes = ImmutableArray.Create("-WinGDK-Shipping", "-Win64-Shipping"); + var uePathSuffixes = ImmutableArray.Create("\\Binaries\\Win64", "\\Binaries\\WinGDK"); - return ueSuffixes.Any(elem => Path.GetFileNameWithoutExtension(gameExe).EndsWith(elem)); + return ueSuffixes.Any(elem => Path.GetFileNameWithoutExtension(gameExe).EndsWith(elem)) + || uePathSuffixes.Any(elem => (Path.GetDirectoryName(gameExe) ?? "").EndsWith(elem)); } public static string? TryFindMainExecutable(string gameExe) { if (IsUnrealExecutable(gameExe)) return gameExe; - var mainExeGlobs = ImmutableArray.Create("*\\Binaries\\Win64\\*-Win64-Shipping.exe", "*\\Binaries\\WinGDK\\*-WinGDK-Shipping.exe"); + var exeBaseName = Path.GetFileNameWithoutExtension(gameExe); + + var mainExeGlobs = ImmutableArray.Create( + "*\\Binaries\\Win64\\*-Win64-Shipping.exe", + "*\\Binaries\\WinGDK\\*-WinGDK-Shipping.exe", + $"*\\Binaries\\Win64\\{exeBaseName}.exe", + $"*\\Binaries\\WinGDK\\{exeBaseName}.exe" + ); var matcher = new Matcher(); matcher.AddIncludePatterns(mainExeGlobs);