diff --git a/File_Format_Library/FileFormats/Texture/TPL/TPL.cs b/File_Format_Library/FileFormats/Texture/TPL/TPL.cs index 52fbbbba..88d01f53 100644 --- a/File_Format_Library/FileFormats/Texture/TPL/TPL.cs +++ b/File_Format_Library/FileFormats/Texture/TPL/TPL.cs @@ -28,7 +28,8 @@ namespace FirstPlugin using (var reader = new FileReader(stream, true)) { reader.ByteOrder = Syroot.BinaryData.ByteOrder.BigEndian; - return reader.ReadUInt32() == 0x0020AF30 || Utils.GetExtension(FileName) == ".tpl"; + uint magic = reader.ReadUInt32(); + return magic == 0x0020AF30 || magic == 0x30AF2000 || Utils.GetExtension(FileName) == ".tpl"; } } diff --git a/File_Format_Library/FileFormats/Texture/TPL/TPL_IO.cs b/File_Format_Library/FileFormats/Texture/TPL/TPL_IO.cs index 4c888d4d..fe440837 100644 --- a/File_Format_Library/FileFormats/Texture/TPL/TPL_IO.cs +++ b/File_Format_Library/FileFormats/Texture/TPL/TPL_IO.cs @@ -17,12 +17,13 @@ namespace FirstPlugin public List Images = new List(); public bool IsV1 = false; + public bool IsBigEndian = true; public void Read(FileReader reader) { reader.SetByteOrder(true); uint Identifier = reader.ReadUInt32(); - if (Identifier != 0x0020AF30) { + if (Identifier != 0x0020AF30 && Identifier != 0x30AF2000) { IsV1 = true; reader.Position = 0; @@ -36,6 +37,8 @@ namespace FirstPlugin } } else { + IsBigEndian = Identifier == 0x0020AF30; + reader.SetByteOrder(IsBigEndian); uint ImageCount = reader.ReadUInt32(); uint ImageOffsetTable = reader.ReadUInt32(); for (int i = 0; i < ImageCount; i++) { @@ -61,7 +64,7 @@ namespace FirstPlugin public void Write(FileWriter writer) { - writer.SetByteOrder(true); + writer.SetByteOrder(IsBigEndian); if (IsV1) { writer.Write(Images.Count); for (int i = 0; i < Images.Count; i++)