protected void GetTextureDefinitions_Retail()
        {
            _TextureDefinitions = new VRMTextureDefinition[_TextureCount];

            try
            {
                long         texStart = _HeaderLength;
                FileStream   iStream  = new FileStream(_FilePath, FileMode.Open, FileAccess.Read);
                BinaryReader iReader  = new BinaryReader(iStream);

                iStream.Seek(texStart, SeekOrigin.Begin);

                for (int textureNum = 0; textureNum < _TextureCount; textureNum++)
                {
                    _TextureDefinitions[textureNum] = new VRMTextureDefinition();
                    // get the texture-wide information
                    _TextureDefinitions[textureNum].Offset = iStream.Position;
                    //iStream.Seek(texStart, SeekOrigin.Begin);
                    _TextureDefinitions[textureNum].Flags1 = iReader.ReadUInt16();
                    byte val2 = iReader.ReadByte();
                    byte val3 = iReader.ReadByte();
                    //if (val3 == 0)
                    //{
                    //    throw new TextureFileException("Texture type was 0.");
                    //}
                    switch (val2)
                    {
                    case 0:
                        _TextureDefinitions[textureNum].BPP = 16;
                        break;

                    case 17:
                        _TextureDefinitions[textureNum].BPP = 32;
                        break;
                    }
                    _TextureDefinitions[textureNum].Type = val3;
                    switch (_TextureDefinitions[textureNum].Type)
                    {
                    case 0:
                        _TextureDefinitions[textureNum].Format = VRMFormat.PS2_ARGB;
                        break;

                    case 2:
                    // 6 seems to work too for PAL Raziel.
                    // Fallthrough.
                    case 6:
                        _TextureDefinitions[textureNum].Format = VRMFormat.PS2_8Bit_Indexed;
                        break;

                    default:
                        throw new NotImplementedException("Support for type '" + _TextureDefinitions[textureNum].Type.ToString() +
                                                          "' files is not yet implemented.");
                    }
                    ushort val4 = iReader.ReadUInt16();
                    ushort val5 = iReader.ReadUInt16();
                    _TextureDefinitions[textureNum].Width  = val4;
                    _TextureDefinitions[textureNum].Height = val5;
                    uint   val6  = iReader.ReadUInt32();
                    byte   val7a = iReader.ReadByte();
                    byte   val7b = iReader.ReadByte();
                    ushort val7c = iReader.ReadUInt16();
                    uint   val8  = iReader.ReadUInt32();
                    uint   val9  = iReader.ReadUInt32();
                    uint   val10 = iReader.ReadUInt32();
                    uint   val11 = iReader.ReadUInt32();

                    int subTexCount = val7a + 1;

                    _TextureDefinitions[textureNum].SubTextures = new VRMSubTextureDefinition[subTexCount];

                    long subTextureOffset = iStream.Position;
                    long subTextureLength = 0;
                    uint subTextureType   = 0;

                    int subSize = iReader.ReadUInt16();
                    iStream.Seek(2, SeekOrigin.Current);

                    switch (_TextureDefinitions[textureNum].Format)
                    {
                    case VRMFormat.PS2_8Bit_Indexed:
                        // get the palette first
                        long paletteSize = (long)(_TextureBlockSize * subSize);
                        subTextureLength = paletteSize + _SubTextureHeaderLength;
                        // not doing anything with this yet
                        uint paletteVal1 = iReader.ReadUInt32();
                        // skip the rest of the header
                        iStream.Seek(8, SeekOrigin.Current);

                        VRMPaletteDefinition pal = new VRMPaletteDefinition();
                        pal.Offset = subTextureOffset;
                        pal.Length = subTextureLength;
                        switch (paletteSize)
                        {
                        case 512:
                            pal.BPP = 16;
                            break;

                        case 1024:
                            pal.BPP = 32;
                            break;
                        }
                        _TextureDefinitions[textureNum].Palette = pal;
                        iStream.Seek(subTextureLength - _SubTextureHeaderLength, SeekOrigin.Current);
                        subTextureOffset = iStream.Position;
                        subSize          = iReader.ReadUInt16();
                        iStream.Seek(2, SeekOrigin.Current);
                        break;

                    default:
                        break;
                    }

                    int mipMapWidth  = _TextureDefinitions[textureNum].Width;
                    int mipMapHeight = _TextureDefinitions[textureNum].Height;
                    for (int subTexNum = 0; subTexNum < subTexCount; subTexNum++)
                    {
                        long subTextureSize = (long)(_TextureBlockSize * subSize);
                        subTextureLength = subTextureSize + _SubTextureHeaderLength;
                        uint subTextureVal1 = iReader.ReadUInt32();
                        subTextureType = subTextureVal1;
                        // skip the rest of the header
                        iStream.Seek(8, SeekOrigin.Current);

                        VRMSubTextureDefinition subTex = new VRMSubTextureDefinition();
                        subTex.Offset = subTextureOffset;
                        subTex.Length = subTextureLength;
                        subTex.Type   = subTextureType;
                        subTex.Width  = mipMapWidth;
                        subTex.Height = mipMapHeight;
                        _TextureDefinitions[textureNum].SubTextures[subTexNum] = subTex;

                        iStream.Seek(subTextureLength - _SubTextureHeaderLength, SeekOrigin.Current);
                        if (iStream.Position < iStream.Length)
                        {
                            subTextureOffset = iStream.Position;
                            subSize          = iReader.ReadUInt16();
                            iStream.Seek(2, SeekOrigin.Current);
                            mipMapWidth  = (mipMapWidth / 2);
                            mipMapHeight = (mipMapHeight / 2);
                        }
                    }
                    iStream.Seek(-4, SeekOrigin.Current);
                    _TextureDefinitions[textureNum].Length = iStream.Position - _TextureDefinitions[textureNum].Offset;
                }

                iReader.Close();
                iStream.Close();
            }
            catch (Exception ex)
            {
                throw new TextureFileException("Error enumerating textures.", ex);
            }
        }
        protected void GetTextureDefinitions_NTSCDemo()
        {
            _TextureDefinitions = new VRMTextureDefinition[_TextureCount];

            try
            {
                long         texStart = _HeaderLength;
                FileStream   iStream  = new FileStream(_FilePath, FileMode.Open, FileAccess.Read);
                BinaryReader iReader  = new BinaryReader(iStream);

                iStream.Seek(texStart, SeekOrigin.Begin);

                for (int textureNum = 0; textureNum < _TextureCount; textureNum++)
                {
                    _TextureDefinitions[textureNum] = new VRMTextureDefinition();
                    // get the texture-wide information
                    _TextureDefinitions[textureNum].Offset = iStream.Position;
                    //iStream.Seek(texStart, SeekOrigin.Begin);
                    _TextureDefinitions[textureNum].Flags1 = iReader.ReadUInt16();
                    byte val2 = iReader.ReadByte();
                    byte val3 = iReader.ReadByte();
                    //if (val3 == 0)
                    //{
                    //    throw new TextureFileException("Texture type was 0.");
                    //}
                    switch (val2)
                    {
                    case 0:
                        _TextureDefinitions[textureNum].BPP = 16;
                        break;

                    case 17:
                        _TextureDefinitions[textureNum].BPP = 32;
                        break;
                    }
                    _TextureDefinitions[textureNum].Type = val3;
                    switch (_TextureDefinitions[textureNum].Type)
                    {
                    case 0:
                        _TextureDefinitions[textureNum].Format = VRMFormat.PS2_ARGB;
                        break;

                    case 2:
                    // 6 seems to work too for PAL Raziel.
                    // Fallthrough.
                    case 6:
                        _TextureDefinitions[textureNum].Format = VRMFormat.PS2_8Bit_Indexed;
                        break;

                    default:
                        throw new NotImplementedException("Support for type '" + _TextureDefinitions[textureNum].Type.ToString() +
                                                          "' files is not yet implemented.");
                    }
                    ushort val4 = iReader.ReadUInt16();
                    ushort val5 = iReader.ReadUInt16();
                    _TextureDefinitions[textureNum].Width  = val4;
                    _TextureDefinitions[textureNum].Height = val5;
                    ushort val6a = iReader.ReadUInt16();
                    ushort val6b = iReader.ReadUInt16();
                    ushort val6c = iReader.ReadUInt16();
                    // (6a + 6b + 6c) * 4 = pallette length?
                    // ^^Probably not.  Looks like fixed length of 0x200.
                    ushort val7c = iReader.ReadUInt16();

                    // 0x4000 // 0x80 * 0x80 // (length * height) / 1
                    // 0x1000 // 0x40 * 0x40 // (length * height) / 2
                    // 0x0400 // 0x20 * 0x20 // (length * height) / 4
                    // 0x0100 // 0x10 * 0x10 // (length * height) / 8
                    // 0x0040 // 0x08 * 0x08 // (length * height) / 16
                    // 0x0010 // 0x04 * 0x04 // (length * height) / 32
                    // =
                    // 0x5550

                    //int subTexCount = (_TextureDefinitions[textureNum].Format == VRMFormat.PS2_8Bit_Indexed) ? val6c + 1 : 1;
                    // AMF 29/07/14 - Safe to use val6c + 1 for everything afterall?
                    int subTexCount = val6c + 1;

                    _TextureDefinitions[textureNum].SubTextures = new VRMSubTextureDefinition[subTexCount];

                    long subTextureOffset = iStream.Position;
                    long subTextureLength = 0;
                    uint subTextureType   = 0;

                    switch (_TextureDefinitions[textureNum].Format)
                    {
                    case VRMFormat.PS2_8Bit_Indexed:
                        VRMPaletteDefinition pal = new VRMPaletteDefinition();
                        pal.Offset = subTextureOffset;
                        pal.Length = 0x200;
                        pal.BPP    = 16;
                        iStream.Seek(pal.Length, SeekOrigin.Current);
                        //pal.Length = subTextureLength;
                        //switch (paletteSize)
                        //{
                        //    case 512:
                        //        pal.BPP = 16;
                        //        break;
                        //    case 1024:
                        //        pal.BPP = 32;
                        //        break;
                        //}
                        _TextureDefinitions[textureNum].Palette = pal;
                        subTextureOffset = iStream.Position;
                        break;

                    default:
                        break;
                    }

                    int mipMapWidth  = _TextureDefinitions[textureNum].Width;
                    int mipMapHeight = _TextureDefinitions[textureNum].Height;
                    for (int subTexNum = 0; subTexNum < subTexCount; subTexNum++)
                    {
                        if (_TextureDefinitions[textureNum].Format == VRMFormat.PS2_8Bit_Indexed)
                        {
                            subTextureLength = mipMapWidth * mipMapHeight;
                        }
                        else
                        {
                            subTextureLength = (_TextureDefinitions[textureNum].BPP >> 3) * mipMapWidth * mipMapHeight;
                        }

                        VRMSubTextureDefinition subTex = new VRMSubTextureDefinition();
                        subTex.Offset = subTextureOffset;
                        subTex.Length = subTextureLength;
                        subTex.Type   = subTextureType; // ?
                        subTex.Width  = mipMapWidth;
                        subTex.Height = mipMapHeight;
                        _TextureDefinitions[textureNum].SubTextures[subTexNum] = subTex;

                        iStream.Seek(subTextureLength, SeekOrigin.Current);
                        if (iStream.Position < iStream.Length)
                        {
                            subTextureOffset = iStream.Position;
                            mipMapWidth      = (mipMapWidth / 2);
                            mipMapHeight     = (mipMapHeight / 2);
                        }
                    }
                    _TextureDefinitions[textureNum].Length = iStream.Position - _TextureDefinitions[textureNum].Offset;
                }

                iReader.Close();
                iStream.Close();
            }
            catch (Exception ex)
            {
                throw new TextureFileException("Error enumerating textures.", ex);
            }
        }