From a3094ef4717eca10a1d9e5a9019e6b914efff950 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Wed, 18 Jul 2018 12:06:25 -0700 Subject: [PATCH] Add antimod detection (2/3) --- BurnOutSharp/ProtectionFind.cs | 32 +++++++++++++++++++++++++++++--- README.md | 2 +- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/BurnOutSharp/ProtectionFind.cs b/BurnOutSharp/ProtectionFind.cs index 99b8d03e..5fa02e7e 100644 --- a/BurnOutSharp/ProtectionFind.cs +++ b/BurnOutSharp/ProtectionFind.cs @@ -99,6 +99,10 @@ namespace BurnOutSharp if (ProtectDVDVideo(path, files)) protections[path] = "Protect DVD-Video"; + // PSX Anti-modchip + if (PSXAntiModchip(path, files)) + protections[path] = "PlayStation Anti-modchip"; + // Zzxzz if (Directory.Exists(Path.Combine(path, "Zzxzz"))) protections[path] = "Zzxzz"; @@ -691,6 +695,31 @@ namespace BurnOutSharp return false; } + private static bool PSXAntiModchip(string path, string[] files) + { + if (files.Where(s => s.ToLower().EndsWith(".cnf")).Count() > 0) + { + foreach (string file in files) + { + try + { + // Load the current file and check for specialty strings first + StreamReader sr = new StreamReader(file, Encoding.Default); + string FileContent = sr.ReadToEnd(); + sr.Close(); + + if (FileContent.Contains(" SOFTWARE TERMINATED\nCONSOLE MAY HAVE BEEN MODIFIED\n CALL 1-888-780-7690") + || FileContent.Contains("強制終了しました。\n本体が改造されている\nおそれがあります。")) + return true; + + } + catch { } + } + } + + return false; + } + #endregion #region Version detections @@ -1157,9 +1186,6 @@ namespace BurnOutSharp // Origin mapping.Add("OriginSetup.exe", "Origin"); - // PSX LibCrypt - TODO: That's... not accurate - mapping.Add(".cnf", "PSX LibCrypt"); - // SafeCast mapping.Add("cdac11ba.exe", "SafeCast"); diff --git a/README.md b/README.md index 19e1bc76..454ac971 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ Below is a list of the protections that can be detected using this code: - Origin (partial) - ProtectDisc - Protect DVD-Video -- PSX LibCrypt (partial) +- PlayStation Anti-modchip (En/Jp, not "Red Hand") - Ring PROTECH - SafeCast - SafeDisc (all versions)