diff --git a/BurnOutSharp/ProtectionType/Macrovision.CDilla.cs b/BurnOutSharp/ProtectionType/Macrovision.CDilla.cs
index 52d82b26..209eb8f1 100644
--- a/BurnOutSharp/ProtectionType/Macrovision.CDilla.cs
+++ b/BurnOutSharp/ProtectionType/Macrovision.CDilla.cs
@@ -33,8 +33,8 @@ namespace BurnOutSharp.ProtectionType
///
public partial class Macrovision
{
- ///
- public string CDillaCheckNewExecutable(string file, NewExecutable nex, bool includeDebug)
+ ///
+ internal string CDillaCheckNewExecutable(string file, NewExecutable nex, bool includeDebug)
{
// Check we have a valid executable
if (nex == null)
@@ -63,6 +63,7 @@ namespace BurnOutSharp.ProtectionType
return null;
}
+ ///
internal string CDillaCheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug)
{
// Get the sections from the executable, if possible
@@ -149,7 +150,7 @@ namespace BurnOutSharp.ProtectionType
return null;
}
- ///
+ ///
internal ConcurrentQueue CDillaCheckDirectoryPath(string path, IEnumerable files)
{
var matchers = new List
@@ -192,7 +193,7 @@ namespace BurnOutSharp.ProtectionType
return MatchUtil.GetAllMatches(files, matchers, any: false);
}
- ///
+ ///
internal string CDillaCheckFilePath(string path)
{
var matchers = new List
diff --git a/BurnOutSharp/ProtectionType/Macrovision.FLEXnet.cs b/BurnOutSharp/ProtectionType/Macrovision.FLEXnet.cs
index 1a811800..1603d30c 100644
--- a/BurnOutSharp/ProtectionType/Macrovision.FLEXnet.cs
+++ b/BurnOutSharp/ProtectionType/Macrovision.FLEXnet.cs
@@ -8,6 +8,7 @@ namespace BurnOutSharp.ProtectionType
///
public partial class Macrovision
{
+ ///
internal string FLEXnetCheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug)
{
// Get the sections from the executable, if possible
diff --git a/BurnOutSharp/ProtectionType/Macrovision.SafeCast.cs b/BurnOutSharp/ProtectionType/Macrovision.SafeCast.cs
index 9cf4c406..7c30bdbb 100644
--- a/BurnOutSharp/ProtectionType/Macrovision.SafeCast.cs
+++ b/BurnOutSharp/ProtectionType/Macrovision.SafeCast.cs
@@ -31,8 +31,8 @@ namespace BurnOutSharp.ProtectionType
///
public partial class Macrovision
{
- ///
- public string SafeCastCheckNewExecutable(string file, NewExecutable nex, bool includeDebug)
+ ///
+ internal string SafeCastCheckNewExecutable(string file, NewExecutable nex, bool includeDebug)
{
// Check we have a valid executable
if (nex == null)
@@ -48,6 +48,7 @@ namespace BurnOutSharp.ProtectionType
return null;
}
+ ///
internal string SafeCastCheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug)
{
// Get the sections from the executable, if possible
@@ -88,7 +89,7 @@ namespace BurnOutSharp.ProtectionType
return null;
}
- ///
+ ///
internal ConcurrentQueue SafeCastCheckDirectoryPath(string path, IEnumerable files)
{
var matchers = new List
@@ -110,7 +111,7 @@ namespace BurnOutSharp.ProtectionType
return MatchUtil.GetAllMatches(files, matchers, any: false);
}
- ///
+ ///
internal string SafeCastCheckFilePath(string path)
{
var matchers = new List
diff --git a/BurnOutSharp/ProtectionType/Macrovision.SafeDisc.cs b/BurnOutSharp/ProtectionType/Macrovision.SafeDisc.cs
index 2476713f..7c3c505b 100644
--- a/BurnOutSharp/ProtectionType/Macrovision.SafeDisc.cs
+++ b/BurnOutSharp/ProtectionType/Macrovision.SafeDisc.cs
@@ -30,6 +30,7 @@ namespace BurnOutSharp.ProtectionType
///
public partial class Macrovision
{
+ ///
internal string SafeDiscCheckPortableExecutable(string file, PortableExecutable pex, bool includeDebug)
{
// Get the sections from the executable, if possible
@@ -70,7 +71,7 @@ namespace BurnOutSharp.ProtectionType
return null;
}
- ///
+ ///
internal ConcurrentQueue SafeDiscCheckDirectoryPath(string path, IEnumerable files)
{
var matchers = new List
@@ -113,7 +114,7 @@ namespace BurnOutSharp.ProtectionType
// TODO: Research "splash16.bmp" and "splash256.bmp".
// Found to be present in every version of SafeDisc, possibly every single release.
- new PathMatchSet(new PathMatch("00000001.TMP", useEndsWith: true), GetSafeDisc00000001TMPVersion, "SafeDisc"),
+ //new PathMatchSet(new PathMatch("00000001.TMP", useEndsWith: true), GetSafeDisc00000001TMPVersion, "SafeDisc"),
// Found in many versions of SafeDisc, beginning in 2.05.030 and being used all the way until the final version 4.90.010. It is not always present, even in versions it has been used in. Found in Redump entries 56319 and 72195.
new PathMatchSet(new PathMatch("00000002.TMP", useEndsWith: true), "SafeDisc 2+"),
@@ -179,7 +180,7 @@ namespace BurnOutSharp.ProtectionType
return MatchUtil.GetAllMatches(files, matchers, any: false);
}
- ///
+ ///
internal string SafeDiscCheckFilePath(string path)
{
var matchers = new List
@@ -188,7 +189,7 @@ namespace BurnOutSharp.ProtectionType
new PathMatchSet(new PathMatch("CLCD32.DLL", useEndsWith: true), GetSafeDiscCLCD32Version, "SafeDisc"),
new PathMatchSet(new PathMatch("CLOKSPL.EXE", useEndsWith: true), GetSafeDiscCLOKSPLVersion, "SafeDisc"),
- new PathMatchSet(new PathMatch("00000001.TMP", useEndsWith: true), GetSafeDisc00000001TMPVersion, "SafeDisc"),
+ //new PathMatchSet(new PathMatch("00000001.TMP", useEndsWith: true), GetSafeDisc00000001TMPVersion, "SafeDisc"),
new PathMatchSet(new PathMatch("00000002.TMP", useEndsWith: true), "SafeDisc 2+"),
// TODO: Research "splash16.bmp" and "splash256.bmp".
@@ -350,27 +351,6 @@ namespace BurnOutSharp.ProtectionType
return $"{version}.{subVersion:00}.{subsubVersion:000}";
}
- internal static string GetSafeDisc00000001TMPVersion(string firstMatchedString, IEnumerable files)
- {
- if (string.IsNullOrEmpty(firstMatchedString) || !File.Exists(firstMatchedString))
- return string.Empty;
-
- // This file is present in most, if not all, SafeDisc protected discs. It seems to have very consistent file sizes, only being found to use three different file sizes in it's entire run.
- FileInfo fi = new FileInfo(firstMatchedString);
- switch (fi.Length)
- {
- // Found in Redump entries 37832 and 66005.
- case 20:
- return "1.00.025-1.41.001";
- // 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 null;
- }
- }
-
internal static string GetSafeDiscCLCD16Version(string firstMatchedString, IEnumerable files)
{
if (string.IsNullOrEmpty(firstMatchedString) || !File.Exists(firstMatchedString))
diff --git a/BurnOutSharp/ProtectionType/Macrovision.cs b/BurnOutSharp/ProtectionType/Macrovision.cs
index ee0df514..a7b00acd 100644
--- a/BurnOutSharp/ProtectionType/Macrovision.cs
+++ b/BurnOutSharp/ProtectionType/Macrovision.cs
@@ -145,16 +145,13 @@ namespace BurnOutSharp.ProtectionType
///
public string CheckFilePath(string path)
{
- // 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 Macrovision file checks
+ string macrovision = MacrovisionCheckFilePath(path);
+ if (!string.IsNullOrWhiteSpace(macrovision))
+ resultsList.Add(macrovision);
+
// Run C-Dilla file checks
string cDilla = CDillaCheckFilePath(path);
if (!string.IsNullOrWhiteSpace(cDilla))
@@ -173,28 +170,46 @@ namespace BurnOutSharp.ProtectionType
if (resultsList != null && resultsList.Count > 0)
return string.Join(", ", resultsList);
+ return null;
+ }
+
+ ///
+ internal string MacrovisionCheckFilePath(string path)
+ {
+ var matchers = new List
+ {
+ new PathMatchSet(new PathMatch("00000001.TMP", useEndsWith: true), Get00000001TMPVersion, string.Empty),
+ };
+
return MatchUtil.GetFirstMatch(path, matchers, any: true);
}
- static string Get00000001TMPVersion(string firstMatchedString, IEnumerable files)
+ internal static string Get00000001TMPVersion(string firstMatchedString, IEnumerable files)
{
if (string.IsNullOrEmpty(firstMatchedString) || !File.Exists(firstMatchedString))
return string.Empty;
+ // This file is present in most, if not all, SafeDisc protected discs. It seems to have very consistent file sizes, only being found to use three different file sizes in it's entire run.
// 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 37832 and 66005.
+ case 20:
+ return "SafeDisc 1.00.025-1.41.001";
// Found in Redump entries 30555 and 58573.
case 2_048:
- return "[Likely indicates either SafeDisc 1.45.011+ (CD) or CDS-300]";
+ return "Macrovision Protection File [Likely indicates either SafeDisc 1.45.011+ (CD) or CDS-300]";
+ // Found in Redump entries 11347 and 64255.
+ case 20_482_048:
+ return "SafeDisc 3+ (DVD)";
default:
return "(Unknown Version - Report this to us on GitHub)";
}
}
- static string GetMacrovisionVersion(string file, byte[] fileContent, List positions)
+ internal static string GetMacrovisionVersion(string file, byte[] fileContent, List positions)
{
int index = positions[0] + 20; // Begin reading after "BoG_ *90.0&!! Yy>" for old SafeDisc
int version = fileContent.ReadInt32(ref index);