diff --git a/BurnOutSharp/ProtectionType/CenegaProtectDVD.cs b/BurnOutSharp/ProtectionType/CenegaProtectDVD.cs index dc58be4a..73ddef46 100644 --- a/BurnOutSharp/ProtectionType/CenegaProtectDVD.cs +++ b/BurnOutSharp/ProtectionType/CenegaProtectDVD.cs @@ -1,9 +1,16 @@ -using BurnOutSharp.ExecutableType.Microsoft.PE; +using System.Collections.Concurrent; +using System.Collections.Generic; +using BurnOutSharp.ExecutableType.Microsoft.PE; using BurnOutSharp.Interfaces; +using BurnOutSharp.Matching; namespace BurnOutSharp.ProtectionType { - public class CengaProtectDVD : IPortableExecutableCheck + /// + /// Cenega ProtectDVD is a protection seemingly created by the publisher Cenega for use with their games. + /// Games using this protection aren't able to be run from an ISO file, and presumably use DMI as a protection feature. + /// + public class CengaProtectDVD : IPathCheck, IPortableExecutableCheck { /// public string CheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug) @@ -13,12 +20,51 @@ namespace BurnOutSharp.ProtectionType if (sections == null) return null; - // Get the .cenega section, if it exists + // Get the .cenega section, if it exists. Seems to be found in the protected game executable (Redump entry 31422). bool cenegaSection = pex.ContainsSection(".cenega", exact: true); if (cenegaSection) return "Cenega ProtectDVD"; + // Get the .cenega0 through .cenega2 sections, if they exists. Found in cenega.dll (Redump entry 31422). + cenegaSection = pex.ContainsSection(".cenega0", exact: true); + if (cenegaSection) + return "Cenega ProtectDVD"; + + cenegaSection = pex.ContainsSection(".cenega1", exact: true); + if (cenegaSection) + return "Cenega ProtectDVD"; + + cenegaSection = pex.ContainsSection(".cenega2", exact: true); + if (cenegaSection) + return "Cenega ProtectDVD"; + return null; } + + /// + public ConcurrentQueue CheckDirectoryPath(string path, IEnumerable files) + { + var matchers = new List + { + // Seems likely to be present in most, if not all discs protected with Cenega ProtectDVD, but unable to confirm due to only having a small sample size. + // References the existence of a "ProtectDVD.dll", which has not yet been located (Redump entry 31422). + new PathMatchSet(new PathMatch("cenega.dll", useEndsWith: true), "Cenega ProtectDVD"), + }; + + return MatchUtil.GetAllMatches(files, matchers, any: true); + } + + /// + public string CheckFilePath(string path) + { + var matchers = new List + { + // Seems likely to be present in most, if not all discs protected with Cenega ProtectDVD, but unable to confirm due to only having a small sample size. + // References the existence of a "ProtectDVD.dll", which has not yet been located (Redump entry 31422). + new PathMatchSet(new PathMatch("cenega.dll", useEndsWith: true), "Cenega ProtectDVD"), + }; + + return MatchUtil.GetFirstMatch(path, matchers, any: true); + } } } diff --git a/README.md b/README.md index 3299f020..97d5adbd 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ Below is a list of protections detected by BurnOutSharp. The two columns explain | CD-Protector | False | True | Unconfirmed¹ | | CD-X | False | True | Unconfirmed¹ | | CDSHiELD SE | True | False | | -| Cenga ProtectDVD | True | False | | +| Cenga ProtectDVD | True | True | | | CodeLock / CodeLok / CopyLok | True | False | Partially unconfirmed² | | CopyKiller | True | True | Unconfirmed¹ | | Denuvo | True | False | |