Fix bad LaserLok check

This commit is contained in:
Matt Nadareski
2023-01-04 20:22:20 -08:00
parent 1ead65126f
commit 6037be404c

View File

@@ -5,7 +5,6 @@ using System.IO;
using System.Linq;
using BurnOutSharp.Interfaces;
using BurnOutSharp.Matching;
using BurnOutSharp.Tools;
using BurnOutSharp.Wrappers;
namespace BurnOutSharp.ProtectionType
@@ -93,6 +92,12 @@ namespace BurnOutSharp.ProtectionType
};
containsCheck2 = pex.GetFirstSectionData(".text").FirstPosition(check2, out position2);
}
else
{
// Otherwise, we reset the containsCheck2 value
containsCheck2 = false;
}
if (containsCheck && containsCheck2)
return $"LaserLok {GetVersion(pex.GetFirstSectionData(".text"), position2)} {GetBuild(pex.GetFirstSectionData(".text"), true)} [Check disc for physical ring]" + (includeDebug ? $" (Index {position}, {position2})" : string.Empty);
@@ -184,6 +189,10 @@ namespace BurnOutSharp.ProtectionType
private static string GetVersion(byte[] sectionContent, int position)
{
// If we have invalid data
if (sectionContent == null)
return null;
return new string(new ArraySegment<byte>(sectionContent, position + 76, 4).Select(b => (char)b).ToArray());
}