From 499f9888b1b766a3250d95304f1d337efb866479 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Wed, 8 Mar 2023 09:40:19 -0500 Subject: [PATCH] Create helper for Macrovision version mapping --- .../ProtectionType/Macrovision.SafeDisc.cs | 91 ------------- BurnOutSharp/ProtectionType/Macrovision.cs | 120 +++++++++++++++--- 2 files changed, 99 insertions(+), 112 deletions(-) diff --git a/BurnOutSharp/ProtectionType/Macrovision.SafeDisc.cs b/BurnOutSharp/ProtectionType/Macrovision.SafeDisc.cs index 8f14d614..7d4e742f 100644 --- a/BurnOutSharp/ProtectionType/Macrovision.SafeDisc.cs +++ b/BurnOutSharp/ProtectionType/Macrovision.SafeDisc.cs @@ -266,97 +266,6 @@ namespace BurnOutSharp.ProtectionType internal static string GetSafeDisc320to4xVersion(string file, byte[] fileContent, List positions) => "3.20-4.xx [version expunged]"; - internal static string GetSafeDiscVersion(string file, byte[] fileContent, List positions) - { - // TODO: Figure out how to properly distinguish SafeDisc and SafeCast since both use - // the same generic BoG_ string. The current combination check doesn't seem consistent - - // Known SafeDisc versions: - // 1.00.025 (Redump entry 66005). - // 1.00.026 (Redump entries 1882 and 30049). - // 1.00.030 (Redump entries 31575 and 41923). - // 1.00.032 (Redump entries 1883 and 42114). - // 1.00.035 (Redump entries 36223 and 40771). - // 1.01.034 (Redump entries 42155 and 47574). - // 1.01.038 (Redump entry 51459). - // 1.01.043 (Redump entries 34562 and 63304). - // 1.01.044 (Redump entries 61731 and 81619). - // 1.01.045 (Currently only found in a pirate compilation disc: IA item "cdrom-classic-fond-58"). - // 1.06.000 (Redump entries 29073 and 31149). - // 1.07.000 (Redump entries 9718 and 46756). - // 1.09.000 (Redump entries 12885 and 66210). - // 1.11.000 (Redump entries 37523 and 66586). - // 1.20.000 (Redump entries 21154 and 37982). - // 1.20.001 (Redump entry 37920). - // 1.30.010 (Redump entries 31526 and 55080). - // 1.35.000 (Redump entries 9617 and 49552). - // 1.40.004 (Redump entries 2595 and 30121). - // 1.41.000 (Redump entries 44350 and 63323). - // 1.41.001 (Redump entries 37832 and 42091). - // 1.45.011 (Redump entries 30555 and 55078). - // 1.50.020 (Redump entries 28810 and 62935). - // 2.05.030 (Redump entries 72195 and 73502). - // 2.10.030 (Redump entries 38541 and 59462 and 81096). - // 2.30.030 (Redump entries 55823 and 79476). - // 2.30.031 (Redump entries 15312 and 48863). - // 2.30.033 (Redump entries 9819 and 53658). - // 2.40.010 (Redump entries 9846 and 65642). - // 2.40.011 (Redump entries 23786 and 37478). - // 2.51.020 (Redump entries 30022 and 75014). - // 2.51.021 (Redump entries 31666 and 66852). - // 2.60.052 (Redump entries 2064 and 47047). - // 2.70.030 (Redump entries 13048 and 35385). - // 2.72.000 (Redump entries 48101 and 64198). - // 2.80.010 (Redump entries 32783 and 72743). - // 2.80.011 (Redump entries 39273 and 59351). - // 2.90.040 (Redump entries 52606 and 62505). - // 3.10.020 (Redump entries 13230 and 68204). - // 3.15.010 (Redump entries 36511 and 74338). - // 3.15.011 (Redump entries 15383 and 35512). - // 3.20.020 (Redump entries 30404 and 56748). - // 3.20.022 (Redump entries 58625 and 91552). - // 3.20.024 (CD: Redump entries 20729 and 63813. DVD: Redump entries 20728 and 64255). - // 4.00.000 (CD: Redump entries 35382 and 79729. DVD: Redump entry 74520). - // 4.00.001 (CD: Redump entries 8842 and 83017. DVD: Redump entries 15614 and 38143). - // 4.00.002 (CD: Redump entries 42034 and 71646. DVD: Redump entries 78980 and 86196). - // 4.00.003 (CD: Redump entries 60021 and 68551. DVD: Redump entries 51597 and 83408). - // 4.50.000 (CD: Redump entries 58990 and 80776. DVD: Redump entries 65569 and 76813). - // 4.60.000 (CD: Redump entries 45686 and 46765. DVD: Redump entries 45469 and 50682). - // 4.70.000 (CD: Redump entry 56320. DVD: Redump entries 34783 and 66403). - // 4.80.000 (CD: Redump entries 64145 and 78543. DVD: No samples so far). - // 4.81.000 (CD: No samples so far. DVD: Redump entries 52523 and 76346). - // 4.85.000 (CD: No samples so far. DVD: Redump entries 20434 and 31766). - // 4.90.000 (CD: No samples so far. DVD: Redump entries 56319 and 66333). - // 4.90.010 (CD: Redump entries 58573 and 78976. DVD: redump entries 11347 and 29069). - - // Known SafeCast versions: - // 2.11.010 (Redump entry 83145). - // 2.16.050 (IA items "cdrom-turbotax-2002", "TurboTax_Deluxe_Tax_Year_2002_for_Wndows_2.00R_Intuit_2002_352282", and "TurboTax_Premier_Tax_Year_2002_for_Windows_v02.00Z-R_Intuit_352283_2002"). - // 2.42.000 (found in "Dreamweaver MX 2004 v7.0.1" according to https://web.archive.org/web/20210331144912/https://protectionid.net/). - // 2.50.030 (found in "ArcSoft Media Card Companion v1.0" according to https://web.archive.org/web/20210331144912/https://protectionid.net/). - // 2.51.000 (found in "Autodesk Inventor Professional v9.0" according to https://web.archive.org/web/20210331144912/https://protectionid.net/). - // 2.60.030 (found in "Data Becker Web To Date v3.1" according to https://web.archive.org/web/20210331144912/https://protectionid.net/). - // 2.67.010 (found in "Adobe Photoshop CS2" according to https://web.archive.org/web/20210331144912/https://protectionid.net/). - - int index = positions[0] + 20; // Begin reading after "BoG_ *90.0&!! Yy>" for old SafeDisc - int version = fileContent.ReadInt32(ref index); - int subVersion = fileContent.ReadInt32(ref index); - int subsubVersion = fileContent.ReadInt32(ref index); - - if (version != 0) - return $"{version}.{subVersion:00}.{subsubVersion:000}"; - - index = positions[0] + 18 + 14; // Begin reading after "BoG_ *90.0&!! Yy>" for newer SafeDisc - version = fileContent.ReadInt32(ref index); - subVersion = fileContent.ReadInt32(ref index); - subsubVersion = fileContent.ReadInt32(ref index); - - if (version == 0) - return string.Empty; - - return $"{version}.{subVersion:00}.{subsubVersion:000}"; - } - 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 c4d8ef42..2895ef3b 100644 --- a/BurnOutSharp/ProtectionType/Macrovision.cs +++ b/BurnOutSharp/ProtectionType/Macrovision.cs @@ -220,27 +220,6 @@ namespace BurnOutSharp.ProtectionType } } - 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); - int subVersion = fileContent.ReadInt32(ref index); - int subsubVersion = fileContent.ReadInt32(ref index); - - if (version != 0) - return $"{version}.{subVersion:00}.{subsubVersion:000}"; - - index = positions[0] + 18 + 14; // Begin reading after "BoG_ *90.0&!! Yy>" for newer SafeDisc - version = fileContent.ReadInt32(ref index); - subVersion = fileContent.ReadInt32(ref index); - subsubVersion = fileContent.ReadInt32(ref index); - - if (version == 0) - return string.Empty; - - return $"{version}.{subVersion:00}.{subsubVersion:000}"; - } - private string CheckSectionForProtection(string file, bool includeDebug, List sectionStrings, byte[] sectionRaw) { // Get the section strings, if they exist @@ -266,6 +245,105 @@ namespace BurnOutSharp.ProtectionType return MatchUtil.GetFirstMatch(file, sectionRaw, matchers, includeDebug); } + 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); + int subVersion = fileContent.ReadInt32(ref index); + int subsubVersion = fileContent.ReadInt32(ref index); + + if (version != 0) + return $"{version}.{subVersion:00}.{subsubVersion:000}"; + + index = positions[0] + 18 + 14; // Begin reading after "BoG_ *90.0&!! Yy>" for newer SafeDisc + version = fileContent.ReadInt32(ref index); + subVersion = fileContent.ReadInt32(ref index); + subsubVersion = fileContent.ReadInt32(ref index); + + if (version == 0) + return string.Empty; + + return $"{version}.{subVersion:00}.{subsubVersion:000}"; + } + + private static string VersionToProduct(string version) + { + switch (version) + { + // SafeCast + case "2.11.010": // Redump entry 83145 + case "2.16.050": // IA items "cdrom-turbotax-2002", "TurboTax_Deluxe_Tax_Year_2002_for_Wndows_2.00R_Intuit_2002_352282", and "TurboTax_Premier_Tax_Year_2002_for_Windows_v02.00Z-R_Intuit_352283_2002" + case "2.42.000": // Found in "Dreamweaver MX 2004 v7.0.1" according to https://web.archive.org/web/20210331144912/https://protectionid.net/ + case "2.50.030": // Found in "ArcSoft Media Card Companion v1.0" according to https://web.archive.org/web/20210331144912/https://protectionid.net/ + case "2.51.000": // Found in "Autodesk Inventor Professional v9.0" according to https://web.archive.org/web/20210331144912/https://protectionid.net/ + case "2.60.030": // Found in "Data Becker Web To Date v3.1" according to https://web.archive.org/web/20210331144912/https://protectionid.net/ + case "2.67.010": // Found in "Adobe Photoshop CS2" according to https://web.archive.org/web/20210331144912/https://protectionid.net/ + return "SafeCast"; + + // SafeDisc + case "1.00.025": // Redump entry 66005 + case "1.00.026": // Redump entries 1882 and 30049 + case "1.00.030": // Redump entries 31575 and 41923 + case "1.00.032": // Redump entries 1883 and 42114 + case "1.00.035": // Redump entries 36223 and 40771 + case "1.01.034": // Redump entries 42155 and 47574 + case "1.01.038": // Redump entry 51459 + case "1.01.043": // Redump entries 34562 and 63304 + case "1.01.044": // Redump entries 61731 and 81619 + case "1.01.045": // Currently only found in a pirate compilation disc: IA item "cdrom-classic-fond-58" + case "1.06.000": // Redump entries 29073 and 31149 + case "1.07.000": // Redump entries 9718 and 46756 + case "1.09.000": // Redump entries 12885 and 66210 + case "1.11.000": // Redump entries 37523 and 66586 + case "1.20.000": // Redump entries 21154 and 37982 + case "1.20.001": // Redump entry 37920 + case "1.30.010": // Redump entries 31526 and 55080 + case "1.35.000": // Redump entries 9617 and 49552 + case "1.40.004": // Redump entries 2595 and 30121 + case "1.41.000": // Redump entries 44350 and 63323 + case "1.41.001": // Redump entries 37832 and 42091 + case "1.45.011": // Redump entries 30555 and 55078 + case "1.50.020": // Redump entries 28810 and 62935 + case "2.05.030": // Redump entries 72195 and 73502 + case "2.10.030": // Redump entries 38541, 59462, and 81096 + case "2.30.030": // Redump entries 55823 and 79476 + case "2.30.031": // Redump entries 15312 and 48863 + case "2.30.033": // Redump entries 9819 and 53658 + case "2.40.010": // Redump entries 9846 and 65642 + case "2.40.011": // Redump entries 23786 and 37478 + case "2.51.020": // Redump entries 30022 and 75014 + case "2.51.021": // Redump entries 31666 and 66852 + case "2.60.052": // Redump entries 2064 and 47047 + case "2.70.030": // Redump entries 13048 and 35385 + case "2.72.000": // Redump entries 48101 and 64198 + case "2.80.010": // Redump entries 32783 and 72743 + case "2.80.011": // Redump entries 39273 and 59351 + case "2.90.040": // Redump entries 52606 and 62505 + case "3.10.020": // Redump entries 13230 and 68204 + case "3.15.010": // Redump entries 36511 and 74338 + case "3.15.011": // Redump entries 15383 and 35512 + case "3.20.020": // Redump entries 30404 and 56748 + case "3.20.022": // Redump entries 58625 and 91552 + case "3.20.024": // CD: Redump entries 20729 and 63813. DVD: Redump entries 20728 and 64255 + case "4.00.000": // CD: Redump entries 35382 and 79729. DVD: Redump entry 74520 + case "4.00.001": // CD: Redump entries 8842 and 83017. DVD: Redump entries 15614 and 38143 + case "4.00.002": // CD: Redump entries 42034 and 71646. DVD: Redump entries 78980 and 86196 + case "4.00.003": // CD: Redump entries 60021 and 68551. DVD: Redump entries 51597 and 83408 + case "4.50.000": // CD: Redump entries 58990 and 80776. DVD: Redump entries 65569 and 76813 + case "4.60.000": // CD: Redump entries 45686 and 46765. DVD: Redump entries 45469 and 50682 + case "4.70.000": // CD: Redump entry 56320. DVD: Redump entries 34783 and 66403 + case "4.80.000": // CD: Redump entries 64145 and 78543. DVD: No samples so far + case "4.81.000": // CD: No samples so far. DVD: Redump entries 52523 and 76346 + case "4.85.000": // CD: No samples so far. DVD: Redump entries 20434 and 31766 + case "4.90.000": // CD: No samples so far. DVD: Redump entries 56319 and 66333 + case "4.90.010": // CD: Redump entries 58573 and 78976. DVD: redump entries 11347 and 29069 + return "SafeDisc"; + + default: + return "Macrovision Protected Application"; + } + } + private List CleanResultList(List resultsList) { // If we have an invalid result list