diff --git a/BurnOutSharp/ProtectionType/CactusDataShield.cs b/BurnOutSharp/ProtectionType/CactusDataShield.cs index 1f9ff360..d2fd86dd 100644 --- a/BurnOutSharp/ProtectionType/CactusDataShield.cs +++ b/BurnOutSharp/ProtectionType/CactusDataShield.cs @@ -102,8 +102,8 @@ namespace BurnOutSharp.ProtectionType new PathMatchSet(new PathMatch("CDSPlayer.app", useEndsWith: true), GetVersion, "Cactus Data Shield"), new PathMatchSet(new PathMatch("wmmp.exe", useEndsWith: true), GetVersion, "Cactus Data Shield"), - // Present on CDS-300, as well as SafeDisc. This is likely due to both protections being created by Macrovision. - new PathMatchSet(new PathMatch("00000001.TMP", useEndsWith: true), Get00000001TMPVersion, "Cactus Data Shield 300 (Confirm presence of other CDS-300 files)"), + // The file "00000001.TMP" (with a filesize of 2,048 bytes) can be found in CDS-300, as well as SafeDisc. + // Due to this file being used in both protections, this file is detected within the general Macrovision checks. }; return MatchUtil.GetAllMatches(files, matchers, any: true); @@ -128,30 +128,13 @@ namespace BurnOutSharp.ProtectionType new PathMatchSet(new PathMatch("CDSPlayer.app", useEndsWith: true), "Cactus Data Shield 200"), new PathMatchSet(new PathMatch("wmmp.exe", useEndsWith: true), "Cactus Data Shield 200"), - // Present on CDS-300, as well as SafeDisc. This is likely due to both protections being created by Macrovision. - new PathMatchSet(new PathMatch("00000001.TMP", useEndsWith: true), Get00000001TMPVersion, "Cactus Data Shield 300"), + // The file "00000001.TMP" (with a filesize of 2,048 bytes) can be found in CDS-300, as well as SafeDisc. + // Due to this file being used in both protections, this file is detected within the general Macrovision checks. }; return MatchUtil.GetFirstMatch(path, matchers, any: true); } - public static string Get00000001TMPVersion(string firstMatchedString, IEnumerable files) - { - if (string.IsNullOrEmpty(firstMatchedString) || !File.Exists(firstMatchedString)) - return string.Empty; - - // This file is present on both CDS-300 and SafeDisc. - // Only one specific file size appears to be associated with CDS-300, so any files with a differing file size are discarded. If it is the correct file size, return it as valid. - FileInfo fi = new FileInfo(firstMatchedString); - switch (fi.Length) - { - case 2_048: - return "(Confirm presence of other CDS-300 files)"; - default: - return null; - } - } - // TODO: Simplify version checking. public static string GetVersion(string firstMatchedString, IEnumerable files) { diff --git a/BurnOutSharp/ProtectionType/Macrovision.SafeDisc.cs b/BurnOutSharp/ProtectionType/Macrovision.SafeDisc.cs index 07b4f817..2476713f 100644 --- a/BurnOutSharp/ProtectionType/Macrovision.SafeDisc.cs +++ b/BurnOutSharp/ProtectionType/Macrovision.SafeDisc.cs @@ -362,14 +362,12 @@ namespace BurnOutSharp.ProtectionType // Found in Redump entries 37832 and 66005. case 20: return "1.00.025-1.41.001"; - // Found in Redump entries 30555 and 58573. - case 2_048: - return "1.45.011+ (CD) (Confirm presence of other SafeDisc files)"; // Found in Redump entries 11347 and 64255. case 20_482_048: return "3+ (DVD)"; + // An unknown filesize may indicate a protection other than SafeDisc, due to Macrovision using this file throughout multiple protections. default: - return "Unknown Version (Report this to us on GitHub)"; + return null; } } @@ -752,6 +750,9 @@ namespace BurnOutSharp.ProtectionType // TODO: Further investigate versions 3.20.020-3.20.024, and verify that 3.20.024 doesn't use drvmgt.dll at all. case "ECB341AB36C5B3B912F568D347368A6A2DEF8D5F": return "3.20.020-3.20.022"; + // Found in Redump entries 53666, 76775, and 102301. + case "69C776F67EBD53CB5FD760B498B4A491BF22F293": + return "3.20.022"; // Found in Redump entries 15614, 79729, 83408, and 86196. // The presence of any drvmgt.dll file at all is notably missing in several games with SafeDisc versions 4.00.001-4.00.003, including Redump entries 33326, 51597, and 67927. case "E21FF43C2E663264D6CB11FBBC31EB1DCEE42B1A": diff --git a/BurnOutSharp/ProtectionType/Macrovision.cs b/BurnOutSharp/ProtectionType/Macrovision.cs index 633bcd9c..ee0df514 100644 --- a/BurnOutSharp/ProtectionType/Macrovision.cs +++ b/BurnOutSharp/ProtectionType/Macrovision.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; +using System.IO; using System.Linq; using BurnOutSharp.Interfaces; using BurnOutSharp.Matching; @@ -112,6 +113,12 @@ namespace BurnOutSharp.ProtectionType { // TODO: Add all common Macrovision directory path checks here + var matchers = new List + { + // Present in SafeDisc and CDS-300. + new PathMatchSet(new PathMatch("00000001.TMP", useEndsWith: true), Get00000001TMPVersion, "Macrovision Protection File"), + }; + ConcurrentQueue results = new ConcurrentQueue(); // Run C-Dilla directory checks @@ -132,7 +139,7 @@ namespace BurnOutSharp.ProtectionType if (results != null && results.Count > 0) return results; - return MatchUtil.GetAllMatches(files, null, any: false); + return MatchUtil.GetAllMatches(files, matchers, any: false); } /// @@ -140,6 +147,12 @@ namespace BurnOutSharp.ProtectionType { // TODO: Add all common Macrovision file path checks here + var matchers = new List + { + // Present in SafeDisc and CDS-300. + new PathMatchSet(new PathMatch("00000001.TMP", useEndsWith: true), Get00000001TMPVersion, "Macrovision Protection File"), + }; + List resultsList = new List(); // Run C-Dilla file checks @@ -160,7 +173,25 @@ namespace BurnOutSharp.ProtectionType if (resultsList != null && resultsList.Count > 0) return string.Join(", ", resultsList); - return MatchUtil.GetFirstMatch(path, null, any: true); + return MatchUtil.GetFirstMatch(path, matchers, any: true); + } + + static string Get00000001TMPVersion(string firstMatchedString, IEnumerable files) + { + if (string.IsNullOrEmpty(firstMatchedString) || !File.Exists(firstMatchedString)) + return string.Empty; + + // A rough estimate of the product and version can be gotten by checking the file size. + // One filesize is known to overlap with both SafeDisc and CDS-300, and so is detected separately here. + FileInfo fi = new FileInfo(firstMatchedString); + switch (fi.Length) + { + // Found in Redump entries 30555 and 58573. + case 2_048: + return "[Likely indicates either SafeDisc 1.45.011+ (CD) or CDS-300]"; + default: + return "(Unknown Version - Report this to us on GitHub)"; + } } static string GetMacrovisionVersion(string file, byte[] fileContent, List positions)