mirror of
https://github.com/SabreTools/BinaryObjectScanner.git
synced 2026-02-11 05:35:15 +00:00
35 lines
1.3 KiB
C#
35 lines
1.3 KiB
C#
namespace BurnOutSharp.ProtectionType
|
|
{
|
|
public class Sysiphus
|
|
{
|
|
public static string CheckContents(byte[] fileContent, bool includePosition = false)
|
|
{
|
|
// "V SUHPISYSDVD"
|
|
byte[] check = new byte[] { 0x56, 0x20, 0x53, 0x55, 0x48, 0x50, 0x49, 0x53, 0x59, 0x53, 0x44, 0x56, 0x44 };
|
|
if (fileContent.Contains(check, out int position))
|
|
return $"Sysiphus DVD {GetVersion(fileContent, position)}" + (includePosition ? $" (Index {position})" : string.Empty);
|
|
|
|
// "V SUHPISYS"
|
|
check = new byte[] { 0x56, 0x20, 0x53, 0x55, 0x48, 0x50, 0x49, 0x53, 0x59, 0x53 };
|
|
if (fileContent.Contains(check, out position))
|
|
return $"Sysiphus {GetVersion(fileContent, position)}" + (includePosition ? $" (Index {position})" : string.Empty);
|
|
|
|
return null;
|
|
}
|
|
|
|
private static string GetVersion(byte[] fileContent, int position)
|
|
{
|
|
int index = position - 3;
|
|
char subVersion = (char)fileContent[index];
|
|
index++;
|
|
index++;
|
|
char version = (char)fileContent[index];
|
|
|
|
if (char.IsNumber(version) && char.IsNumber(subVersion))
|
|
return $"{version}.{subVersion}";
|
|
else
|
|
return "";
|
|
}
|
|
}
|
|
}
|