From 86b639b04f6298293ca185041820f6754d9549aa Mon Sep 17 00:00:00 2001 From: TheRogueArchivist <24215969+TheRogueArchivist@users.noreply.github.com> Date: Thu, 3 Oct 2024 08:42:39 -0600 Subject: [PATCH] Add Kalypso Launcher support (#324) * Add Kalypso Launcher support * Small changes to Kalypso Launcher * More minor Kalypso Launcher changes --- .../Protection/KalypsoLauncher.cs | 90 +++++++++++++++++++ README.md | 1 + 2 files changed, 91 insertions(+) create mode 100644 BinaryObjectScanner/Protection/KalypsoLauncher.cs diff --git a/BinaryObjectScanner/Protection/KalypsoLauncher.cs b/BinaryObjectScanner/Protection/KalypsoLauncher.cs new file mode 100644 index 00000000..f9db47cf --- /dev/null +++ b/BinaryObjectScanner/Protection/KalypsoLauncher.cs @@ -0,0 +1,90 @@ +#if NET40_OR_GREATER || NETCOREAPP +using System.Collections.Concurrent; +#endif +using System.Collections.Generic; +using System.Linq; +using BinaryObjectScanner.Interfaces; +using SabreTools.Matching; +using SabreTools.Serialization.Wrappers; + +namespace BinaryObjectScanner.Protection +{ + /// + /// Kalypso Launcher is a launcher used by Kalypso Media games. It is responsible for game activation via product keys. + /// Several Kalypso developed games are available on Steam, but the launcher isn't able to be (officially) disabled: https://www.reddit.com/r/RailwayEmpire/comments/nktojh/skip_kalypso_launcher_from_steam/ + /// Assumed to be present on all Kalypso Media games on PC since at least 2011 (as it is present in Redump entry 95617), though this needs to be confirmed. + /// The internal name of the Kalypso Launcher may be "Styx", as it is present as the File Description and Product Name in various versions of "KalypsoLauncher.dll". + /// Kalypso FAQ, which includes information about Kalypso Launcher: https://www.kalypsomedia.com/us/frequently-asked-questions + /// It was introduced in or before January 2011, based on this forum post introducing it: https://web.archive.org/web/20120524150700/http://forum.kalypsomedia.com/showthread.php?tid=7909 + /// + /// Known versions: + /// 1.2.0.12: Found in Redump entry 95617. + /// 2.0.4.2: Newest version as of 3/10/2024, downloaded from updating the installed game from Redump entry 95617. + /// + public class KalypsoLauncher : IPathCheck, IPortableExecutableCheck + { + + /// + public string? CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) + { + // Get the sections from the executable, if possible + var sections = pex.Model.SectionTable; + if (sections == null) + return null; + + // TODO: Investigate if there are any viable checks for the game EXE itself. + // "Styx" is found as the File Description and Product Name in "KalypsoLauncher.dll", but checks aren't included due to the risk of false positives. + + var name = pex.InternalName; + + // Found in "KalypsoLauncher.dll" in Redump entry 95617. + if (name?.Contains("KalypsoLauncher.dll") == true) + return $"Kalypso Launcher {pex.GetInternalVersion()}"; + + name = pex.OriginalFilename; + + // Found in "KalypsoLauncher.dll" in Redump entry 95617. + if (name?.Contains("KalypsoLauncher.dll") == true) + return $"Kalypso Launcher {pex.GetInternalVersion()}"; + + // Get the .text section strings, if they exist + var strs = pex.GetFirstSectionStrings(".rdata"); + if (strs != null) + { + // Found in "TFT.exe" in Redump entry 95617. + if (strs.Any(s => s.Contains("@KalypsoLauncherXml"))) + return "Kalypso Launcher"; + } + + return null; + } + + /// +#if NET20 || NET35 + public Queue CheckDirectoryPath(string path, IEnumerable? files) +#else + public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable? files) +#endif + { + var matchers = new List + { + // Found in Redump entry 95617. + new(new FilePathMatch("KalypsoLauncher.dll"), "Kalypso Launcher"), + }; + + return MatchUtil.GetAllMatches(files, matchers, any: true); + } + + /// + public string? CheckFilePath(string path) + { + var matchers = new List + { + // Found in Redump entry 95617. + new(new FilePathMatch("KalypsoLauncher.dll"), "Kalypso Launcher"), + }; + + return MatchUtil.GetFirstMatch(path, matchers, any: true); + } + } +} diff --git a/README.md b/README.md index 2369b1ab..c9078b49 100644 --- a/README.md +++ b/README.md @@ -96,6 +96,7 @@ Below is a list of protections detected by BinaryObjectScanner. The two columns | IndyVCD | False | True | Unconfirmed¹ | | INTENIUM Trial & Buy Protection | True | False | | | JoWood X-Prot (v1/v2) / Xtreme-Protector | True | False | | +| Kalypso Launcher | True | True | | | ~~Key2Audio~~ | True | True | Existing checks found to actually be indicators of OpenMG, not key2Audio specifically. | | Key-Lock (Dongle) | True | False | Unconfirmed¹ | | LabelGate CD | True | True | Currently only LabelGate CD2 is detected. |