diff --git a/Engines/Evb/EvbDetectionHelper.cs b/Engines/Evb/EvbDetectionHelper.cs index 8f04c43..39bf941 100644 --- a/Engines/Evb/EvbDetectionHelper.cs +++ b/Engines/Evb/EvbDetectionHelper.cs @@ -92,6 +92,35 @@ namespace GameLauncher.Engines.Evb } } + /// + /// Returns true when the game directory already holds a completed EVB extraction. + /// + /// Once a game is unpacked, the original packed exe is renamed to "*.glbak" and the + /// unpacked files (including the real exe) live inside the game-local "_evb_extracted" + /// folder. At that point can no longer find a + /// top-level "*.exe", so this extra signal is required to keep recognizing the folder + /// as an EVB game (otherwise launch and icon resolution break after unpacking). + /// + /// Only a completed extraction (completion marker present) is accepted, so a normal + /// unpacked game without any EVB artifacts is never misclassified. + /// + public static bool IsExtracted(string gameDirectory) + { + if (string.IsNullOrWhiteSpace(gameDirectory) || !Directory.Exists(gameDirectory)) + { + return false; + } + + try + { + return EvbUnpackService.IsExtractionComplete(gameDirectory, out _); + } + catch + { + return false; + } + } + /// /// Parses the PE section table and checks for the EVB packer's section names. /// diff --git a/Engines/Evb/EvbDetector.cs b/Engines/Evb/EvbDetector.cs index 992bc85..e55d195 100644 --- a/Engines/Evb/EvbDetector.cs +++ b/Engines/Evb/EvbDetector.cs @@ -18,9 +18,16 @@ namespace GameLauncher.Engines.Evb public static class EvbDetector { /// - /// Returns true when the game directory holds an EVB packed executable. - /// A packed project file (*.evb) in the folder is also accepted as a - /// decisive signal, in addition to the PE-signature check. + /// Returns true when the game directory holds an EVB packed executable + /// (or a completed extraction of one). + /// + /// Accepts any of the following decisive signals: + /// 1. A packed project file (*.evb) in the folder. + /// 2. A top-level executable carrying a decisive EVB PE signature. + /// 3. An already-unpacked game (game-local "_evb_extracted" with a completion + /// marker). This is required because unpacking renames the original packed exe + /// to "*.glbak", after which the signature check alone would no longer detect + /// the game and its launch / icon resolution would break. /// public static bool IsEvbGame(string gameDirectory) { @@ -39,7 +46,13 @@ namespace GameLauncher.Engines.Evb } catch { - // Fall through to the executable signature check. + // Fall through to the remaining checks. + } + + // A completed extraction keeps the game recognized even without the packed exe. + if (EvbDetectionHelper.IsExtracted(gameDirectory)) + { + return true; } return EvbDetectionHelper.FindEvbPackedExecutable(gameDirectory) != null;