VrSharp.PvrTexture.PvrTexture.IsValidGbix C# (CSharp) Method

IsValidGbix() private static method

Checks for and validates GBIX headers as well as PVRT.

See also: IsValidPvrt

private static IsValidGbix ( byte source, int offset, int length ) : bool
source byte Byte array containing the data.
offset int The offset in the byte array to start at.
length int The expected length of the data minus the preceding header sizes.
return bool
        private static bool IsValidGbix(byte[] source, int offset, int length)
        {
            if (!PTMethods.Contains(source, offset, gbixFourCC))
            {
                return false;
            }

            // Immediately after the "GBIX" part of the GBIX header, there is
            // an offset indicating where the PVRT header begins relative to 0x08.
            int pvrtOffset = BitConverter.ToInt32(source, offset + 0x04) + 8;
            return IsValidPvrt(source, offset + pvrtOffset, length - pvrtOffset);
        }