diff --git a/AssetStudio/Classes/Shader.cs b/AssetStudio/Classes/Shader.cs index 0bc6eef..07863df 100644 --- a/AssetStudio/Classes/Shader.cs +++ b/AssetStudio/Classes/Shader.cs @@ -578,7 +578,7 @@ namespace AssetStudio public UAVParameter[] m_UAVParams; public SamplerParameter[] m_Samplers; - public static bool HasGlobalLocalKeywordIndices(SerializedType type) => type.Match("E99740711222CD922E9A6F92FF1EB07A") || type.Match("450A058C218DAF000647948F2F59DA6D"); + public static bool HasGlobalLocalKeywordIndices(SerializedType type) => type.Match("E99740711222CD922E9A6F92FF1EB07A", "450A058C218DAF000647948F2F59DA6D"); public static bool HasInstancedStructuredBuffers(SerializedType type) => type.Match("E99740711222CD922E9A6F92FF1EB07A"); public SerializedSubProgram(ObjectReader reader) diff --git a/AssetStudio/Classes/Texture2D.cs b/AssetStudio/Classes/Texture2D.cs index e7c22ff..87f2d9d 100644 --- a/AssetStudio/Classes/Texture2D.cs +++ b/AssetStudio/Classes/Texture2D.cs @@ -63,7 +63,8 @@ namespace AssetStudio public ResourceReader image_data; public StreamingInfo m_StreamData; - private static bool HasGNFTexture(ObjectReader reader) => reader.serializedType.Match("1D52BB98AA5F54C67C22C39E8B2E400F"); + private static bool HasGNFTexture(SerializedType type) => type.Match("1D52BB98AA5F54C67C22C39E8B2E400F"); + private static bool HasExternalMipRelativeOffset(SerializedType type) => type.Match("1D52BB98AA5F54C67C22C39E8B2E400F", "5390A985F58D5524F95DB240E8789704"); public Texture2D(ObjectReader reader) : base(reader) { m_Width = reader.ReadInt32(); @@ -85,7 +86,7 @@ namespace AssetStudio if (version[0] > 2 || (version[0] == 2 && version[1] >= 6)) //2.6.0 and up { var m_IsReadable = reader.ReadBoolean(); - if (reader.Game.Type.IsGI() && HasGNFTexture(reader)) + if (reader.Game.Type.IsGI() && HasGNFTexture(reader.serializedType)) { var m_IsGNFTexture = reader.ReadBoolean(); } @@ -110,7 +111,7 @@ namespace AssetStudio var m_StreamingMipmaps = reader.ReadBoolean(); } reader.AlignStream(); - if (reader.Game.Type.IsGI() && HasGNFTexture(reader)) + if (reader.Game.Type.IsGI() && HasGNFTexture(reader.serializedType)) { var m_TextureGroup = reader.ReadInt32(); } @@ -137,7 +138,7 @@ namespace AssetStudio var image_data_size = reader.ReadInt32(); if (image_data_size == 0 && ((version[0] == 5 && version[1] >= 3) || version[0] > 5))//5.3.0 and up { - if (reader.Game.Type.IsGI() && HasGNFTexture(reader)) + if (reader.Game.Type.IsGI() && HasExternalMipRelativeOffset(reader.serializedType)) { var m_externalMipRelativeOffset = reader.ReadUInt32(); } diff --git a/AssetStudio/SerializedType.cs b/AssetStudio/SerializedType.cs index 81d44c9..63e38f5 100644 --- a/AssetStudio/SerializedType.cs +++ b/AssetStudio/SerializedType.cs @@ -18,7 +18,7 @@ namespace AssetStudio public string m_NameSpace; public string m_AsmName; - public bool Match(string hash) => Convert.ToHexString(m_OldTypeHash) == hash; + public bool Match(params string[] hashes) => hashes.Any(x => x == Convert.ToHexString(m_OldTypeHash)); public override string ToString() { var sb = new StringBuilder();