diff --git a/AssetStudio/AssetsManager.cs b/AssetStudio/AssetsManager.cs index 5b91ea47..eea5418d 100644 --- a/AssetStudio/AssetsManager.cs +++ b/AssetStudio/AssetsManager.cs @@ -156,7 +156,7 @@ private void LoadAssetsFromMemory(FileReader reader, string originalPath, string { var assetsFile = new SerializedFile(reader, this); assetsFile.originalPath = originalPath; - if (!string.IsNullOrEmpty(unityVersion) && assetsFile.header.m_Version < SerializedFileFormatVersion.kUnknown_7) + if (!string.IsNullOrEmpty(unityVersion) && assetsFile.header.m_Version < SerializedFileFormatVersion.Unknown_7) { assetsFile.SetVersion(unityVersion); } diff --git a/AssetStudio/BuildTarget.cs b/AssetStudio/BuildTarget.cs index 634ba2a3..742d86f3 100644 --- a/AssetStudio/BuildTarget.cs +++ b/AssetStudio/BuildTarget.cs @@ -8,7 +8,8 @@ namespace AssetStudio public enum BuildTarget { NoTarget = -2, - DashboardWidget = 1, + AnyPlayer = -1, + ValidPlayer = 1, StandaloneOSX = 2, StandaloneOSXPPC = 3, StandaloneOSXIntel = 4, @@ -19,8 +20,10 @@ public enum BuildTarget iOS = 9, PS3, XBOX360, + Broadcom = 12, Android = 13, StandaloneGLESEmu = 14, + StandaloneGLES20Emu = 15, NaCl = 16, StandaloneLinux = 17, FlashPlayer = 18, @@ -48,6 +51,8 @@ public enum BuildTarget GameCoreXboxSeries, GameCoreXboxOne, PS5, + EmbeddedLinux, + QNX, UnknownPlatform = 9999 } } diff --git a/AssetStudio/BundleFile.cs b/AssetStudio/BundleFile.cs index 48c85d23..aea03afb 100644 --- a/AssetStudio/BundleFile.cs +++ b/AssetStudio/BundleFile.cs @@ -1,9 +1,36 @@ using K4os.Compression.LZ4; +using System; using System.IO; using System.Linq; namespace AssetStudio { + [Flags] + public enum ArchiveFlags + { + CompressionTypeMask = 0x3f, + BlocksAndDirectoryInfoCombined = 0x40, + BlocksInfoAtTheEnd = 0x80, + OldWebPluginCompatibility = 0x100, + BlockInfoNeedPaddingAtStart = 0x200 + } + + [Flags] + public enum StorageBlockFlags + { + CompressionTypeMask = 0x3f, + Streamed = 0x40 + } + + public enum CompressionType + { + None, + Lzma, + Lz4, + Lz4HC, + Lzham + } + public class BundleFile { public class Header @@ -15,14 +42,14 @@ public class Header public long size; public uint compressedBlocksInfoSize; public uint uncompressedBlocksInfoSize; - public uint flags; + public ArchiveFlags flags; } public class StorageBlock { public uint compressedSize; public uint uncompressedSize; - public ushort flags; + public StorageBlockFlags flags; } public class Node @@ -77,7 +104,6 @@ public BundleFile(FileReader reader) private void ReadHeaderAndBlocksInfo(EndianBinaryReader reader) { - var isCompressed = m_Header.signature == "UnityWeb"; if (m_Header.version >= 4) { var hash = reader.ReadBytes(16); @@ -94,7 +120,6 @@ private void ReadHeaderAndBlocksInfo(EndianBinaryReader reader) { compressedSize = reader.ReadUInt32(), uncompressedSize = reader.ReadUInt32(), - flags = (ushort)(isCompressed ? 1 : 0) }; if (i == levelCount - 1) { @@ -131,10 +156,11 @@ private Stream CreateBlocksStream(string path) private void ReadBlocksAndDirectory(EndianBinaryReader reader, Stream blocksStream) { + var isCompressed = m_Header.signature == "UnityWeb"; foreach (var blockInfo in m_BlocksInfo) { var uncompressedBytes = reader.ReadBytes((int)blockInfo.compressedSize); - if (blockInfo.flags == 1) + if (isCompressed) { using (var memoryStream = new MemoryStream(uncompressedBytes)) { @@ -194,7 +220,7 @@ private void ReadHeader(EndianBinaryReader reader) m_Header.size = reader.ReadInt64(); m_Header.compressedBlocksInfoSize = reader.ReadUInt32(); m_Header.uncompressedBlocksInfoSize = reader.ReadUInt32(); - m_Header.flags = reader.ReadUInt32(); + m_Header.flags = (ArchiveFlags)reader.ReadUInt32(); if (m_Header.signature != "UnityFS") { reader.ReadByte(); @@ -208,28 +234,28 @@ private void ReadBlocksInfoAndDirectory(EndianBinaryReader reader) { reader.AlignStream(16); } - var start = reader.Position; - if ((m_Header.flags & 0x80) != 0) //kArchiveBlocksInfoAtTheEnd + if ((m_Header.flags & ArchiveFlags.BlocksInfoAtTheEnd) != 0) { var position = reader.Position; reader.Position = reader.BaseStream.Length - m_Header.compressedBlocksInfoSize; blocksInfoBytes = reader.ReadBytes((int)m_Header.compressedBlocksInfoSize); reader.Position = position; } - else //0x40 kArchiveBlocksAndDirectoryInfoCombined + else //0x40 BlocksAndDirectoryInfoCombined { blocksInfoBytes = reader.ReadBytes((int)m_Header.compressedBlocksInfoSize); } MemoryStream blocksInfoUncompresseddStream; var uncompressedSize = m_Header.uncompressedBlocksInfoSize; - switch (m_Header.flags & 0x3F) //kArchiveCompressionTypeMask + var compressionType = (CompressionType)(m_Header.flags & ArchiveFlags.CompressionTypeMask); + switch (compressionType) { - default: //None + case CompressionType.None: { blocksInfoUncompresseddStream = new MemoryStream(blocksInfoBytes); break; } - case 1: //LZMA + case CompressionType.Lzma: { blocksInfoUncompresseddStream = new MemoryStream((int)(uncompressedSize)); using (var blocksInfoCompressedStream = new MemoryStream(blocksInfoBytes)) @@ -239,8 +265,8 @@ private void ReadBlocksInfoAndDirectory(EndianBinaryReader reader) blocksInfoUncompresseddStream.Position = 0; break; } - case 2: //LZ4 - case 3: //LZ4HC + case CompressionType.Lz4: + case CompressionType.Lz4HC: { var uncompressedBytes = new byte[uncompressedSize]; var numWrite = LZ4Codec.Decode(blocksInfoBytes, uncompressedBytes); @@ -251,6 +277,8 @@ private void ReadBlocksInfoAndDirectory(EndianBinaryReader reader) blocksInfoUncompresseddStream = new MemoryStream(uncompressedBytes); break; } + default: + throw new IOException($"Unsupported compression type {compressionType}"); } using (var blocksInfoReader = new EndianBinaryReader(blocksInfoUncompresseddStream)) { @@ -263,7 +291,7 @@ private void ReadBlocksInfoAndDirectory(EndianBinaryReader reader) { uncompressedSize = blocksInfoReader.ReadUInt32(), compressedSize = blocksInfoReader.ReadUInt32(), - flags = blocksInfoReader.ReadUInt16() + flags = (StorageBlockFlags)blocksInfoReader.ReadUInt16() }; } @@ -280,30 +308,31 @@ private void ReadBlocksInfoAndDirectory(EndianBinaryReader reader) }; } } - //https://issuetracker.unity3d.com/issues/files-within-assetbundles-do-not-start-on-aligned-boundaries-breaking-patching-on-nintendo-switch - var blockSize = m_BlocksInfo.Sum(x => x.compressedSize); - var padding = reader.BaseStream.Length - start - m_Header.compressedBlocksInfoSize - blockSize; - reader.Position += padding; + if ((m_Header.flags & ArchiveFlags.BlockInfoNeedPaddingAtStart) != 0) + { + reader.AlignStream(16); + } } private void ReadBlocks(EndianBinaryReader reader, Stream blocksStream) { foreach (var blockInfo in m_BlocksInfo) { - switch (blockInfo.flags & 0x3F) //kStorageBlockCompressionTypeMask + var compressionType = (CompressionType)(blockInfo.flags & StorageBlockFlags.CompressionTypeMask); + switch (compressionType) { - default: //None + case CompressionType.None: { reader.BaseStream.CopyTo(blocksStream, blockInfo.compressedSize); break; } - case 1: //LZMA + case CompressionType.Lzma: { SevenZipHelper.StreamDecompress(reader.BaseStream, blocksStream, blockInfo.compressedSize, blockInfo.uncompressedSize); break; } - case 2: //LZ4 - case 3: //LZ4HC + case CompressionType.Lz4: + case CompressionType.Lz4HC: { var compressedSize = (int)blockInfo.compressedSize; var compressedBytes = BigArrayPool.Shared.Rent(compressedSize); @@ -320,6 +349,8 @@ private void ReadBlocks(EndianBinaryReader reader, Stream blocksStream) BigArrayPool.Shared.Return(uncompressedBytes); break; } + default: + throw new IOException($"Unsupported compression type {compressionType}"); } } blocksStream.Position = 0; diff --git a/AssetStudio/Classes/AnimationClip.cs b/AssetStudio/Classes/AnimationClip.cs index 8b9967c4..95a381a5 100644 --- a/AssetStudio/Classes/AnimationClip.cs +++ b/AssetStudio/Classes/AnimationClip.cs @@ -909,9 +909,9 @@ public AnimationEvent(ObjectReader reader) public enum AnimationType { - kLegacy = 1, - kGeneric = 2, - kHumanoid = 3 + Legacy = 1, + Generic = 2, + Humanoid = 3 }; public sealed class AnimationClip : NamedObject @@ -945,7 +945,7 @@ public AnimationClip(ObjectReader reader) : base(reader) else if (version[0] >= 4)//4.0 and up { m_AnimationType = (AnimationType)reader.ReadInt32(); - if (m_AnimationType == AnimationType.kLegacy) + if (m_AnimationType == AnimationType.Legacy) m_Legacy = true; } else diff --git a/AssetStudio/Classes/AudioClip.cs b/AssetStudio/Classes/AudioClip.cs index 4dcf2683..90a226c5 100644 --- a/AssetStudio/Classes/AudioClip.cs +++ b/AssetStudio/Classes/AudioClip.cs @@ -9,7 +9,7 @@ namespace AssetStudio public sealed class AudioClip : NamedObject { public int m_Format; - public AudioType m_Type; + public FMODSoundType m_Type; public bool m_3D; public bool m_UseHardware; @@ -36,7 +36,7 @@ public AudioClip(ObjectReader reader) : base(reader) if (version[0] < 5) { m_Format = reader.ReadInt32(); - m_Type = (AudioType)reader.ReadInt32(); + m_Type = (FMODSoundType)reader.ReadInt32(); m_3D = reader.ReadBoolean(); m_UseHardware = reader.ReadBoolean(); reader.AlignStream(); @@ -92,34 +92,51 @@ public AudioClip(ObjectReader reader) : base(reader) } } - public enum AudioType + public enum FMODSoundType { - UNKNOWN, - ACC, - AIFF, + UNKNOWN = 0, + ACC = 1, + AIFF = 2, + ASF = 3, + AT3 = 4, + CDDA = 5, + DLS = 6, + FLAC = 7, + FSB = 8, + GCADPCM = 9, IT = 10, + MIDI = 11, MOD = 12, - MPEG, - OGGVORBIS, + MPEG = 13, + OGGVORBIS = 14, + PLAYLIST = 15, + RAW = 16, S3M = 17, + SF2 = 18, + USER = 19, WAV = 20, - XM, - XMA, - VAG, - AUDIOQUEUE + XM = 21, + XMA = 22, + VAG = 23, + AUDIOQUEUE = 24, + XWMA = 25, + BCWAV = 26, + AT9 = 27, + VORBIS = 28, + MEDIA_FOUNDATION = 29 } public enum AudioCompressionFormat { - PCM, - Vorbis, - ADPCM, - MP3, - VAG, - HEVAG, - XMA, - AAC, - GCADPCM, - ATRAC9 + PCM = 0, + Vorbis = 1, + ADPCM = 2, + MP3 = 3, + PSMVAG = 4, + HEVAG = 5, + XMA = 6, + AAC = 7, + GCADPCM = 8, + ATRAC9 = 9 } } diff --git a/AssetStudio/Classes/Mesh.cs b/AssetStudio/Classes/Mesh.cs index 0a2369d9..c936d143 100644 --- a/AssetStudio/Classes/Mesh.cs +++ b/AssetStudio/Classes/Mesh.cs @@ -396,14 +396,14 @@ public BlendShapeData(ObjectReader reader) } } - public enum GfxPrimitiveType : int + public enum GfxPrimitiveType { - kPrimitiveTriangles = 0, - kPrimitiveTriangleStrip = 1, - kPrimitiveQuads = 2, - kPrimitiveLines = 3, - kPrimitiveLineStrip = 4, - kPrimitivePoints = 5, + Triangles = 0, + TriangleStrip = 1, + Quads = 2, + Lines = 3, + LineStrip = 4, + Points = 5 }; public class SubMesh @@ -1060,7 +1060,7 @@ private void GetTriangles() } var indexCount = m_SubMesh.indexCount; var topology = m_SubMesh.topology; - if (topology == GfxPrimitiveType.kPrimitiveTriangles) + if (topology == GfxPrimitiveType.Triangles) { for (int i = 0; i < indexCount; i += 3) { @@ -1069,7 +1069,7 @@ private void GetTriangles() m_Indices.Add(m_IndexBuffer[firstIndex + i + 2]); } } - else if (version[0] < 4 || topology == GfxPrimitiveType.kPrimitiveTriangleStrip) + else if (version[0] < 4 || topology == GfxPrimitiveType.TriangleStrip) { // de-stripify : uint triIndex = 0; @@ -1100,7 +1100,7 @@ private void GetTriangles() //fix indexCount m_SubMesh.indexCount = triIndex; } - else if (topology == GfxPrimitiveType.kPrimitiveQuads) + else if (topology == GfxPrimitiveType.Quads) { for (int q = 0; q < indexCount; q += 4) { @@ -1193,44 +1193,44 @@ public static class MeshHelper { public enum VertexChannelFormat { - kChannelFormatFloat, - kChannelFormatFloat16, - kChannelFormatColor, - kChannelFormatByte, - kChannelFormatUInt32 + Float, + Float16, + Color, + Byte, + UInt32 } public enum VertexFormat2017 { - kVertexFormatFloat, - kVertexFormatFloat16, - kVertexFormatColor, - kVertexFormatUNorm8, - kVertexFormatSNorm8, - kVertexFormatUNorm16, - kVertexFormatSNorm16, - kVertexFormatUInt8, - kVertexFormatSInt8, - kVertexFormatUInt16, - kVertexFormatSInt16, - kVertexFormatUInt32, - kVertexFormatSInt32 + Float, + Float16, + Color, + UNorm8, + SNorm8, + UNorm16, + SNorm16, + UInt8, + SInt8, + UInt16, + SInt16, + UInt32, + SInt32 } public enum VertexFormat { - kVertexFormatFloat, - kVertexFormatFloat16, - kVertexFormatUNorm8, - kVertexFormatSNorm8, - kVertexFormatUNorm16, - kVertexFormatSNorm16, - kVertexFormatUInt8, - kVertexFormatSInt8, - kVertexFormatUInt16, - kVertexFormatSInt16, - kVertexFormatUInt32, - kVertexFormatSInt32 + Float, + Float16, + UNorm8, + SNorm8, + UNorm16, + SNorm16, + UInt8, + SInt8, + UInt16, + SInt16, + UInt32, + SInt32 } public static VertexFormat ToVertexFormat(int format, int[] version) @@ -1239,16 +1239,16 @@ public static VertexFormat ToVertexFormat(int format, int[] version) { switch ((VertexChannelFormat)format) { - case VertexChannelFormat.kChannelFormatFloat: - return VertexFormat.kVertexFormatFloat; - case VertexChannelFormat.kChannelFormatFloat16: - return VertexFormat.kVertexFormatFloat16; - case VertexChannelFormat.kChannelFormatColor: //in 4.x is size 4 - return VertexFormat.kVertexFormatUNorm8; - case VertexChannelFormat.kChannelFormatByte: - return VertexFormat.kVertexFormatUInt8; - case VertexChannelFormat.kChannelFormatUInt32: //in 5.x - return VertexFormat.kVertexFormatUInt32; + case VertexChannelFormat.Float: + return VertexFormat.Float; + case VertexChannelFormat.Float16: + return VertexFormat.Float16; + case VertexChannelFormat.Color: //in 4.x is size 4 + return VertexFormat.UNorm8; + case VertexChannelFormat.Byte: + return VertexFormat.UInt8; + case VertexChannelFormat.UInt32: //in 5.x + return VertexFormat.UInt32; default: throw new ArgumentOutOfRangeException(nameof(format), format, null); } @@ -1257,31 +1257,31 @@ public static VertexFormat ToVertexFormat(int format, int[] version) { switch ((VertexFormat2017)format) { - case VertexFormat2017.kVertexFormatFloat: - return VertexFormat.kVertexFormatFloat; - case VertexFormat2017.kVertexFormatFloat16: - return VertexFormat.kVertexFormatFloat16; - case VertexFormat2017.kVertexFormatColor: - case VertexFormat2017.kVertexFormatUNorm8: - return VertexFormat.kVertexFormatUNorm8; - case VertexFormat2017.kVertexFormatSNorm8: - return VertexFormat.kVertexFormatSNorm8; - case VertexFormat2017.kVertexFormatUNorm16: - return VertexFormat.kVertexFormatUNorm16; - case VertexFormat2017.kVertexFormatSNorm16: - return VertexFormat.kVertexFormatSNorm16; - case VertexFormat2017.kVertexFormatUInt8: - return VertexFormat.kVertexFormatUInt8; - case VertexFormat2017.kVertexFormatSInt8: - return VertexFormat.kVertexFormatSInt8; - case VertexFormat2017.kVertexFormatUInt16: - return VertexFormat.kVertexFormatUInt16; - case VertexFormat2017.kVertexFormatSInt16: - return VertexFormat.kVertexFormatSInt16; - case VertexFormat2017.kVertexFormatUInt32: - return VertexFormat.kVertexFormatUInt32; - case VertexFormat2017.kVertexFormatSInt32: - return VertexFormat.kVertexFormatSInt32; + case VertexFormat2017.Float: + return VertexFormat.Float; + case VertexFormat2017.Float16: + return VertexFormat.Float16; + case VertexFormat2017.Color: + case VertexFormat2017.UNorm8: + return VertexFormat.UNorm8; + case VertexFormat2017.SNorm8: + return VertexFormat.SNorm8; + case VertexFormat2017.UNorm16: + return VertexFormat.UNorm16; + case VertexFormat2017.SNorm16: + return VertexFormat.SNorm16; + case VertexFormat2017.UInt8: + return VertexFormat.UInt8; + case VertexFormat2017.SInt8: + return VertexFormat.SInt8; + case VertexFormat2017.UInt16: + return VertexFormat.UInt16; + case VertexFormat2017.SInt16: + return VertexFormat.SInt16; + case VertexFormat2017.UInt32: + return VertexFormat.UInt32; + case VertexFormat2017.SInt32: + return VertexFormat.SInt32; default: throw new ArgumentOutOfRangeException(nameof(format), format, null); } @@ -1297,20 +1297,20 @@ public static uint GetFormatSize(VertexFormat format) { switch (format) { - case VertexFormat.kVertexFormatFloat: - case VertexFormat.kVertexFormatUInt32: - case VertexFormat.kVertexFormatSInt32: + case VertexFormat.Float: + case VertexFormat.UInt32: + case VertexFormat.SInt32: return 4u; - case VertexFormat.kVertexFormatFloat16: - case VertexFormat.kVertexFormatUNorm16: - case VertexFormat.kVertexFormatSNorm16: - case VertexFormat.kVertexFormatUInt16: - case VertexFormat.kVertexFormatSInt16: + case VertexFormat.Float16: + case VertexFormat.UNorm16: + case VertexFormat.SNorm16: + case VertexFormat.UInt16: + case VertexFormat.SInt16: return 2u; - case VertexFormat.kVertexFormatUNorm8: - case VertexFormat.kVertexFormatSNorm8: - case VertexFormat.kVertexFormatUInt8: - case VertexFormat.kVertexFormatSInt8: + case VertexFormat.UNorm8: + case VertexFormat.SNorm8: + case VertexFormat.UInt8: + case VertexFormat.SInt8: return 1u; default: throw new ArgumentOutOfRangeException(nameof(format), format, null); @@ -1319,7 +1319,7 @@ public static uint GetFormatSize(VertexFormat format) public static bool IsIntFormat(VertexFormat format) { - return format >= VertexFormat.kVertexFormatUInt8; + return format >= VertexFormat.UInt8; } public static float[] BytesToFloatArray(byte[] inputBytes, VertexFormat format) @@ -1331,22 +1331,22 @@ public static float[] BytesToFloatArray(byte[] inputBytes, VertexFormat format) { switch (format) { - case VertexFormat.kVertexFormatFloat: + case VertexFormat.Float: result[i] = BitConverter.ToSingle(inputBytes, i * 4); break; - case VertexFormat.kVertexFormatFloat16: + case VertexFormat.Float16: result[i] = Half.ToHalf(inputBytes, i * 2); break; - case VertexFormat.kVertexFormatUNorm8: + case VertexFormat.UNorm8: result[i] = inputBytes[i] / 255f; break; - case VertexFormat.kVertexFormatSNorm8: + case VertexFormat.SNorm8: result[i] = Math.Max((sbyte)inputBytes[i] / 127f, -1f); break; - case VertexFormat.kVertexFormatUNorm16: + case VertexFormat.UNorm16: result[i] = BitConverter.ToUInt16(inputBytes, i * 2) / 65535f; break; - case VertexFormat.kVertexFormatSNorm16: + case VertexFormat.SNorm16: result[i] = Math.Max(BitConverter.ToInt16(inputBytes, i * 2) / 32767f, -1f); break; } @@ -1363,16 +1363,16 @@ public static int[] BytesToIntArray(byte[] inputBytes, VertexFormat format) { switch (format) { - case VertexFormat.kVertexFormatUInt8: - case VertexFormat.kVertexFormatSInt8: + case VertexFormat.UInt8: + case VertexFormat.SInt8: result[i] = inputBytes[i]; break; - case VertexFormat.kVertexFormatUInt16: - case VertexFormat.kVertexFormatSInt16: + case VertexFormat.UInt16: + case VertexFormat.SInt16: result[i] = BitConverter.ToInt16(inputBytes, i * 2); break; - case VertexFormat.kVertexFormatUInt32: - case VertexFormat.kVertexFormatSInt32: + case VertexFormat.UInt32: + case VertexFormat.SInt32: result[i] = BitConverter.ToInt32(inputBytes, i * 4); break; } diff --git a/AssetStudio/Classes/PPtr.cs b/AssetStudio/Classes/PPtr.cs index 4849e9c7..a9ec6d63 100644 --- a/AssetStudio/Classes/PPtr.cs +++ b/AssetStudio/Classes/PPtr.cs @@ -13,7 +13,7 @@ public sealed class PPtr where T : Object public PPtr(ObjectReader reader) { m_FileID = reader.ReadInt32(); - m_PathID = reader.m_Version < SerializedFileFormatVersion.kUnknown_14 ? reader.ReadInt32() : reader.ReadInt64(); + m_PathID = reader.m_Version < SerializedFileFormatVersion.Unknown_14 ? reader.ReadInt32() : reader.ReadInt64(); assetsFile = reader.assetsFile; } diff --git a/AssetStudio/Classes/Shader.cs b/AssetStudio/Classes/Shader.cs index e5c67547..0d80c5ad 100644 --- a/AssetStudio/Classes/Shader.cs +++ b/AssetStudio/Classes/Shader.cs @@ -56,15 +56,14 @@ public SamplerParameter(BinaryReader reader) } public enum TextureDimension { - kTexDimUnknown = -1, - kTexDimNone = 0, - kTexDimAny = 1, - kTexDim2D = 2, - kTexDim3D = 3, - kTexDimCUBE = 4, - kTexDim2DArray = 5, - kTexDimCubeArray = 6, - kTexDimForce32Bit = 2147483647 + Unknown = -1, + None = 0, + Any = 1, + Tex2D = 2, + Tex3D = 3, + Cube = 4, + Tex2DArray = 5, + CubeArray = 6 }; public class SerializedTextureProperty @@ -81,11 +80,12 @@ public SerializedTextureProperty(BinaryReader reader) public enum SerializedPropertyType { - kColor = 0, - kVector = 1, - kFloat = 2, - kRange = 3, - kTexture = 4 + Color = 0, + Vector = 1, + Float = 2, + Range = 3, + Texture = 4, + Int = 5 }; public class SerializedProperty @@ -195,11 +195,11 @@ public SerializedShaderVectorValue(BinaryReader reader) public enum FogMode { - kFogUnknown = -1, - kFogDisabled = 0, - kFogLinear = 1, - kFogExp = 2, - kFogExp2 = 3 + Unknown = -1, + Disabled = 0, + Linear = 1, + Exp = 2, + Exp2 = 3 }; public class SerializedShaderState @@ -453,38 +453,39 @@ public UAVParameter(BinaryReader reader) public enum ShaderGpuProgramType { - kShaderGpuProgramUnknown = 0, - kShaderGpuProgramGLLegacy = 1, - kShaderGpuProgramGLES31AEP = 2, - kShaderGpuProgramGLES31 = 3, - kShaderGpuProgramGLES3 = 4, - kShaderGpuProgramGLES = 5, - kShaderGpuProgramGLCore32 = 6, - kShaderGpuProgramGLCore41 = 7, - kShaderGpuProgramGLCore43 = 8, - kShaderGpuProgramDX9VertexSM20 = 9, - kShaderGpuProgramDX9VertexSM30 = 10, - kShaderGpuProgramDX9PixelSM20 = 11, - kShaderGpuProgramDX9PixelSM30 = 12, - kShaderGpuProgramDX10Level9Vertex = 13, - kShaderGpuProgramDX10Level9Pixel = 14, - kShaderGpuProgramDX11VertexSM40 = 15, - kShaderGpuProgramDX11VertexSM50 = 16, - kShaderGpuProgramDX11PixelSM40 = 17, - kShaderGpuProgramDX11PixelSM50 = 18, - kShaderGpuProgramDX11GeometrySM40 = 19, - kShaderGpuProgramDX11GeometrySM50 = 20, - kShaderGpuProgramDX11HullSM50 = 21, - kShaderGpuProgramDX11DomainSM50 = 22, - kShaderGpuProgramMetalVS = 23, - kShaderGpuProgramMetalFS = 24, - kShaderGpuProgramSPIRV = 25, - kShaderGpuProgramConsoleVS = 26, - kShaderGpuProgramConsoleFS = 27, - kShaderGpuProgramConsoleHS = 28, - kShaderGpuProgramConsoleDS = 29, - kShaderGpuProgramConsoleGS = 30, - kShaderGpuProgramRayTracing = 31, + Unknown = 0, + GLLegacy = 1, + GLES31AEP = 2, + GLES31 = 3, + GLES3 = 4, + GLES = 5, + GLCore32 = 6, + GLCore41 = 7, + GLCore43 = 8, + DX9VertexSM20 = 9, + DX9VertexSM30 = 10, + DX9PixelSM20 = 11, + DX9PixelSM30 = 12, + DX10Level9Vertex = 13, + DX10Level9Pixel = 14, + DX11VertexSM40 = 15, + DX11VertexSM50 = 16, + DX11PixelSM40 = 17, + DX11PixelSM50 = 18, + DX11GeometrySM40 = 19, + DX11GeometrySM50 = 20, + DX11HullSM50 = 21, + DX11DomainSM50 = 22, + MetalVS = 23, + MetalFS = 24, + SPIRV = 25, + ConsoleVS = 26, + ConsoleFS = 27, + ConsoleHS = 28, + ConsoleDS = 29, + ConsoleGS = 30, + RayTracing = 31, + PS5NGGC = 32 }; public class SerializedProgramParameters @@ -713,9 +714,9 @@ public SerializedProgram(ObjectReader reader) public enum PassType { - kPassTypeNormal = 0, - kPassTypeUse = 1, - kPassTypeGrab = 2 + Normal = 0, + Use = 1, + Grab = 2 }; public class SerializedPass @@ -922,32 +923,32 @@ public SerializedShader(ObjectReader reader) public enum ShaderCompilerPlatform { - kShaderCompPlatformNone = -1, - kShaderCompPlatformGL = 0, - kShaderCompPlatformD3D9 = 1, - kShaderCompPlatformXbox360 = 2, - kShaderCompPlatformPS3 = 3, - kShaderCompPlatformD3D11 = 4, - kShaderCompPlatformGLES20 = 5, - kShaderCompPlatformNaCl = 6, - kShaderCompPlatformFlash = 7, - kShaderCompPlatformD3D11_9x = 8, - kShaderCompPlatformGLES3Plus = 9, - kShaderCompPlatformPSP2 = 10, - kShaderCompPlatformPS4 = 11, - kShaderCompPlatformXboxOne = 12, - kShaderCompPlatformPSM = 13, - kShaderCompPlatformMetal = 14, - kShaderCompPlatformOpenGLCore = 15, - kShaderCompPlatformN3DS = 16, - kShaderCompPlatformWiiU = 17, - kShaderCompPlatformVulkan = 18, - kShaderCompPlatformSwitch = 19, - kShaderCompPlatformXboxOneD3D12 = 20, - kShaderCompPlatformGameCoreXboxOne = 21, - kShaderCompPlatformGameCoreScarlett = 22, - kShaderCompPlatformPS5 = 23, - kShaderCompPlatformPS5NGGC = 24, + None = -1, + GL = 0, + D3D9 = 1, + Xbox360 = 2, + PS3 = 3, + D3D11 = 4, + GLES20 = 5, + NaCl = 6, + Flash = 7, + D3D11_9x = 8, + GLES3Plus = 9, + PSP2 = 10, + PS4 = 11, + XboxOne = 12, + PSM = 13, + Metal = 14, + OpenGLCore = 15, + N3DS = 16, + WiiU = 17, + Vulkan = 18, + Switch = 19, + XboxOneD3D12 = 20, + GameCoreXboxOne = 21, + GameCoreScarlett = 22, + PS5 = 23, + PS5NGGC = 24 }; public class Shader : NamedObject diff --git a/AssetStudio/Classes/Sprite.cs b/AssetStudio/Classes/Sprite.cs index 6e3c6534..752794f5 100644 --- a/AssetStudio/Classes/Sprite.cs +++ b/AssetStudio/Classes/Sprite.cs @@ -18,23 +18,23 @@ public SecondarySpriteTexture(ObjectReader reader) public enum SpritePackingRotation { - kSPRNone = 0, - kSPRFlipHorizontal = 1, - kSPRFlipVertical = 2, - kSPRRotate180 = 3, - kSPRRotate90 = 4 + None = 0, + FlipHorizontal = 1, + FlipVertical = 2, + Rotate180 = 3, + Rotate90 = 4 }; public enum SpritePackingMode { - kSPMTight = 0, - kSPMRectangle + Tight = 0, + Rectangle }; public enum SpriteMeshType { - kSpriteMeshTypeFullRect, - kSpriteMeshTypeTight + FullRect, + Tight }; public class SpriteSettings diff --git a/AssetStudio/Classes/Texture2D.cs b/AssetStudio/Classes/Texture2D.cs index 73d40503..af90baf0 100644 --- a/AssetStudio/Classes/Texture2D.cs +++ b/AssetStudio/Classes/Texture2D.cs @@ -151,8 +151,10 @@ public enum TextureFormat RGB24, RGBA32, ARGB32, - RGB565 = 7, - R16 = 9, + ARGBFloat, + RGB565, + BGR24, + R16, DXT1, DXT3, DXT5, @@ -166,7 +168,8 @@ public enum TextureFormat RGBAFloat, YUY2, RGB9e5Float, - BC6H = 24, + RGBFloat, + BC6H, BC7, BC4, BC5, diff --git a/AssetStudio/SerializedFile.cs b/AssetStudio/SerializedFile.cs index 41f8d901..76174186 100644 --- a/AssetStudio/SerializedFile.cs +++ b/AssetStudio/SerializedFile.cs @@ -45,7 +45,7 @@ public SerializedFile(FileReader reader, AssetsManager assetsManager) header.m_Version = (SerializedFileFormatVersion)reader.ReadUInt32(); header.m_DataOffset = reader.ReadUInt32(); - if (header.m_Version >= SerializedFileFormatVersion.kUnknown_9) + if (header.m_Version >= SerializedFileFormatVersion.Unknown_9) { header.m_Endianess = reader.ReadByte(); header.m_Reserved = reader.ReadBytes(3); @@ -57,7 +57,7 @@ public SerializedFile(FileReader reader, AssetsManager assetsManager) m_FileEndianess = reader.ReadByte(); } - if (header.m_Version >= SerializedFileFormatVersion.kLargeFilesSupport) + if (header.m_Version >= SerializedFileFormatVersion.LargeFilesSupport) { header.m_MetadataSize = reader.ReadUInt32(); header.m_FileSize = reader.ReadInt64(); @@ -70,12 +70,12 @@ public SerializedFile(FileReader reader, AssetsManager assetsManager) { reader.Endian = EndianType.LittleEndian; } - if (header.m_Version >= SerializedFileFormatVersion.kUnknown_7) + if (header.m_Version >= SerializedFileFormatVersion.Unknown_7) { unityVersion = reader.ReadStringToNull(); SetVersion(unityVersion); } - if (header.m_Version >= SerializedFileFormatVersion.kUnknown_8) + if (header.m_Version >= SerializedFileFormatVersion.Unknown_8) { m_TargetPlatform = (BuildTarget)reader.ReadInt32(); if (!Enum.IsDefined(typeof(BuildTarget), m_TargetPlatform)) @@ -83,7 +83,7 @@ public SerializedFile(FileReader reader, AssetsManager assetsManager) m_TargetPlatform = BuildTarget.UnknownPlatform; } } - if (header.m_Version >= SerializedFileFormatVersion.kHasTypeTreeHashes) + if (header.m_Version >= SerializedFileFormatVersion.HasTypeTreeHashes) { m_EnableTypeTree = reader.ReadBoolean(); } @@ -96,7 +96,7 @@ public SerializedFile(FileReader reader, AssetsManager assetsManager) m_Types.Add(ReadSerializedType(false)); } - if (header.m_Version >= SerializedFileFormatVersion.kUnknown_7 && header.m_Version < SerializedFileFormatVersion.kUnknown_14) + if (header.m_Version >= SerializedFileFormatVersion.Unknown_7 && header.m_Version < SerializedFileFormatVersion.Unknown_14) { bigIDEnabled = reader.ReadInt32(); } @@ -113,7 +113,7 @@ public SerializedFile(FileReader reader, AssetsManager assetsManager) { objectInfo.m_PathID = reader.ReadInt64(); } - else if (header.m_Version < SerializedFileFormatVersion.kUnknown_14) + else if (header.m_Version < SerializedFileFormatVersion.Unknown_14) { objectInfo.m_PathID = reader.ReadInt32(); } @@ -123,7 +123,7 @@ public SerializedFile(FileReader reader, AssetsManager assetsManager) objectInfo.m_PathID = reader.ReadInt64(); } - if (header.m_Version >= SerializedFileFormatVersion.kLargeFilesSupport) + if (header.m_Version >= SerializedFileFormatVersion.LargeFilesSupport) objectInfo.byteStart = reader.ReadInt64(); else objectInfo.byteStart = reader.ReadUInt32(); @@ -131,7 +131,7 @@ public SerializedFile(FileReader reader, AssetsManager assetsManager) objectInfo.byteStart += header.m_DataOffset; objectInfo.byteSize = reader.ReadUInt32(); objectInfo.typeID = reader.ReadInt32(); - if (header.m_Version < SerializedFileFormatVersion.kRefactoredClassId) + if (header.m_Version < SerializedFileFormatVersion.RefactoredClassId) { objectInfo.classID = reader.ReadUInt16(); objectInfo.serializedType = m_Types.Find(x => x.classID == objectInfo.typeID); @@ -142,24 +142,24 @@ public SerializedFile(FileReader reader, AssetsManager assetsManager) objectInfo.serializedType = type; objectInfo.classID = type.classID; } - if (header.m_Version < SerializedFileFormatVersion.kHasScriptTypeIndex) + if (header.m_Version < SerializedFileFormatVersion.HasScriptTypeIndex) { objectInfo.isDestroyed = reader.ReadUInt16(); } - if (header.m_Version >= SerializedFileFormatVersion.kHasScriptTypeIndex && header.m_Version < SerializedFileFormatVersion.kRefactorTypeData) + if (header.m_Version >= SerializedFileFormatVersion.HasScriptTypeIndex && header.m_Version < SerializedFileFormatVersion.RefactorTypeData) { var m_ScriptTypeIndex = reader.ReadInt16(); if (objectInfo.serializedType != null) objectInfo.serializedType.m_ScriptTypeIndex = m_ScriptTypeIndex; } - if (header.m_Version == SerializedFileFormatVersion.kSupportsStrippedObject || header.m_Version == SerializedFileFormatVersion.kRefactoredClassId) + if (header.m_Version == SerializedFileFormatVersion.SupportsStrippedObject || header.m_Version == SerializedFileFormatVersion.RefactoredClassId) { objectInfo.stripped = reader.ReadByte(); } m_Objects.Add(objectInfo); } - if (header.m_Version >= SerializedFileFormatVersion.kHasScriptTypeIndex) + if (header.m_Version >= SerializedFileFormatVersion.HasScriptTypeIndex) { int scriptCount = reader.ReadInt32(); m_ScriptTypes = new List(scriptCount); @@ -167,7 +167,7 @@ public SerializedFile(FileReader reader, AssetsManager assetsManager) { var m_ScriptType = new LocalSerializedObjectIdentifier(); m_ScriptType.localSerializedFileIndex = reader.ReadInt32(); - if (header.m_Version < SerializedFileFormatVersion.kUnknown_14) + if (header.m_Version < SerializedFileFormatVersion.Unknown_14) { m_ScriptType.localIdentifierInFile = reader.ReadInt32(); } @@ -185,11 +185,11 @@ public SerializedFile(FileReader reader, AssetsManager assetsManager) for (int i = 0; i < externalsCount; i++) { var m_External = new FileIdentifier(); - if (header.m_Version >= SerializedFileFormatVersion.kUnknown_6) + if (header.m_Version >= SerializedFileFormatVersion.Unknown_6) { var tempEmpty = reader.ReadStringToNull(); } - if (header.m_Version >= SerializedFileFormatVersion.kUnknown_5) + if (header.m_Version >= SerializedFileFormatVersion.Unknown_5) { m_External.guid = new Guid(reader.ReadBytes(16)); m_External.type = reader.ReadInt32(); @@ -199,7 +199,7 @@ public SerializedFile(FileReader reader, AssetsManager assetsManager) m_Externals.Add(m_External); } - if (header.m_Version >= SerializedFileFormatVersion.kSupportsRefObject) + if (header.m_Version >= SerializedFileFormatVersion.SupportsRefObject) { int refTypesCount = reader.ReadInt32(); m_RefTypes = new List(refTypesCount); @@ -209,7 +209,7 @@ public SerializedFile(FileReader reader, AssetsManager assetsManager) } } - if (header.m_Version >= SerializedFileFormatVersion.kUnknown_5) + if (header.m_Version >= SerializedFileFormatVersion.Unknown_5) { userInformation = reader.ReadStringToNull(); } @@ -235,23 +235,23 @@ private SerializedType ReadSerializedType(bool isRefType) type.classID = reader.ReadInt32(); - if (header.m_Version >= SerializedFileFormatVersion.kRefactoredClassId) + if (header.m_Version >= SerializedFileFormatVersion.RefactoredClassId) { type.m_IsStrippedType = reader.ReadBoolean(); } - if (header.m_Version >= SerializedFileFormatVersion.kRefactorTypeData) + if (header.m_Version >= SerializedFileFormatVersion.RefactorTypeData) { type.m_ScriptTypeIndex = reader.ReadInt16(); } - if (header.m_Version >= SerializedFileFormatVersion.kHasTypeTreeHashes) + if (header.m_Version >= SerializedFileFormatVersion.HasTypeTreeHashes) { if (isRefType && type.m_ScriptTypeIndex >= 0) { type.m_ScriptID = reader.ReadBytes(16); } - else if ((header.m_Version < SerializedFileFormatVersion.kRefactoredClassId && type.classID < 0) || (header.m_Version >= SerializedFileFormatVersion.kRefactoredClassId && type.classID == 114)) + else if ((header.m_Version < SerializedFileFormatVersion.RefactoredClassId && type.classID < 0) || (header.m_Version >= SerializedFileFormatVersion.RefactoredClassId && type.classID == 114)) { type.m_ScriptID = reader.ReadBytes(16); } @@ -262,7 +262,7 @@ private SerializedType ReadSerializedType(bool isRefType) { type.m_Type = new TypeTree(); type.m_Type.m_Nodes = new List(); - if (header.m_Version >= SerializedFileFormatVersion.kUnknown_12 || header.m_Version == SerializedFileFormatVersion.kUnknown_10) + if (header.m_Version >= SerializedFileFormatVersion.Unknown_12 || header.m_Version == SerializedFileFormatVersion.Unknown_10) { TypeTreeBlobRead(type.m_Type); } @@ -270,7 +270,7 @@ private SerializedType ReadSerializedType(bool isRefType) { ReadTypeTree(type.m_Type); } - if (header.m_Version >= SerializedFileFormatVersion.kStoresTypeDependencies) + if (header.m_Version >= SerializedFileFormatVersion.StoresTypeDependencies) { if (isRefType) { @@ -296,17 +296,17 @@ private void ReadTypeTree(TypeTree m_Type, int level = 0) typeTreeNode.m_Type = reader.ReadStringToNull(); typeTreeNode.m_Name = reader.ReadStringToNull(); typeTreeNode.m_ByteSize = reader.ReadInt32(); - if (header.m_Version == SerializedFileFormatVersion.kUnknown_2) + if (header.m_Version == SerializedFileFormatVersion.Unknown_2) { var variableCount = reader.ReadInt32(); } - if (header.m_Version != SerializedFileFormatVersion.kUnknown_3) + if (header.m_Version != SerializedFileFormatVersion.Unknown_3) { typeTreeNode.m_Index = reader.ReadInt32(); } typeTreeNode.m_TypeFlags = reader.ReadInt32(); typeTreeNode.m_Version = reader.ReadInt32(); - if (header.m_Version != SerializedFileFormatVersion.kUnknown_3) + if (header.m_Version != SerializedFileFormatVersion.Unknown_3) { typeTreeNode.m_MetaFlag = reader.ReadInt32(); } @@ -334,7 +334,7 @@ private void TypeTreeBlobRead(TypeTree m_Type) typeTreeNode.m_ByteSize = reader.ReadInt32(); typeTreeNode.m_Index = reader.ReadInt32(); typeTreeNode.m_MetaFlag = reader.ReadInt32(); - if (header.m_Version >= SerializedFileFormatVersion.kTypeTreeNodeWithTypeFlags) + if (header.m_Version >= SerializedFileFormatVersion.TypeTreeNodeWithTypeFlags) { typeTreeNode.m_RefTypeHash = reader.ReadUInt64(); } diff --git a/AssetStudio/SerializedFileFormatVersion.cs b/AssetStudio/SerializedFileFormatVersion.cs index fab3bcbb..fc853b86 100644 --- a/AssetStudio/SerializedFileFormatVersion.cs +++ b/AssetStudio/SerializedFileFormatVersion.cs @@ -8,80 +8,80 @@ namespace AssetStudio { public enum SerializedFileFormatVersion { - kUnsupported = 1, - kUnknown_2 = 2, - kUnknown_3 = 3, + Unsupported = 1, + Unknown_2 = 2, + Unknown_3 = 3, /// /// 1.2.0 to 2.0.0 /// - kUnknown_5 = 5, + Unknown_5 = 5, /// /// 2.1.0 to 2.6.1 /// - kUnknown_6 = 6, + Unknown_6 = 6, /// /// 3.0.0b /// - kUnknown_7 = 7, + Unknown_7 = 7, /// /// 3.0.0 to 3.4.2 /// - kUnknown_8 = 8, + Unknown_8 = 8, /// /// 3.5.0 to 4.7.2 /// - kUnknown_9 = 9, + Unknown_9 = 9, /// /// 5.0.0aunk1 /// - kUnknown_10 = 10, + Unknown_10 = 10, /// /// 5.0.0aunk2 /// - kHasScriptTypeIndex = 11, + HasScriptTypeIndex = 11, /// /// 5.0.0aunk3 /// - kUnknown_12 = 12, + Unknown_12 = 12, /// /// 5.0.0aunk4 /// - kHasTypeTreeHashes = 13, + HasTypeTreeHashes = 13, /// /// 5.0.0unk /// - kUnknown_14 = 14, + Unknown_14 = 14, /// /// 5.0.1 to 5.4.0 /// - kSupportsStrippedObject = 15, + SupportsStrippedObject = 15, /// /// 5.5.0a /// - kRefactoredClassId = 16, + RefactoredClassId = 16, /// /// 5.5.0unk to 2018.4 /// - kRefactorTypeData = 17, + RefactorTypeData = 17, /// /// 2019.1a /// - kRefactorShareableTypeTreeData = 18, + RefactorShareableTypeTreeData = 18, /// /// 2019.1unk /// - kTypeTreeNodeWithTypeFlags = 19, + TypeTreeNodeWithTypeFlags = 19, /// /// 2019.2 /// - kSupportsRefObject = 20, + SupportsRefObject = 20, /// /// 2019.3 to 2019.4 /// - kStoresTypeDependencies = 21, + StoresTypeDependencies = 21, /// /// 2020.1 to x /// - kLargeFilesSupport = 22 + LargeFilesSupport = 22 } } diff --git a/AssetStudioGUI/AssetStudioGUIForm.cs b/AssetStudioGUI/AssetStudioGUIForm.cs index 95a83169..b46c70f1 100644 --- a/AssetStudioGUI/AssetStudioGUIForm.cs +++ b/AssetStudioGUI/AssetStudioGUIForm.cs @@ -816,40 +816,40 @@ private void PreviewAudioClip(AssetItem assetItem, AudioClip m_AudioClip) { switch (m_AudioClip.m_Type) { - case AudioType.ACC: + case FMODSoundType.ACC: assetItem.InfoText += "Acc"; break; - case AudioType.AIFF: + case FMODSoundType.AIFF: assetItem.InfoText += "AIFF"; break; - case AudioType.IT: + case FMODSoundType.IT: assetItem.InfoText += "Impulse tracker"; break; - case AudioType.MOD: + case FMODSoundType.MOD: assetItem.InfoText += "Protracker / Fasttracker MOD"; break; - case AudioType.MPEG: + case FMODSoundType.MPEG: assetItem.InfoText += "MP2/MP3 MPEG"; break; - case AudioType.OGGVORBIS: + case FMODSoundType.OGGVORBIS: assetItem.InfoText += "Ogg vorbis"; break; - case AudioType.S3M: + case FMODSoundType.S3M: assetItem.InfoText += "ScreamTracker 3"; break; - case AudioType.WAV: + case FMODSoundType.WAV: assetItem.InfoText += "Microsoft WAV"; break; - case AudioType.XM: + case FMODSoundType.XM: assetItem.InfoText += "FastTracker 2 XM"; break; - case AudioType.XMA: + case FMODSoundType.XMA: assetItem.InfoText += "Xbox360 XMA"; break; - case AudioType.VAG: + case FMODSoundType.VAG: assetItem.InfoText += "PlayStation Portable ADPCM"; break; - case AudioType.AUDIOQUEUE: + case FMODSoundType.AUDIOQUEUE: assetItem.InfoText += "iPhone"; break; default: @@ -873,7 +873,7 @@ private void PreviewAudioClip(AssetItem assetItem, AudioClip m_AudioClip) case AudioCompressionFormat.MP3: assetItem.InfoText += "MP3"; break; - case AudioCompressionFormat.VAG: + case AudioCompressionFormat.PSMVAG: assetItem.InfoText += "PlayStation Portable ADPCM"; break; case AudioCompressionFormat.HEVAG: diff --git a/AssetStudioUtility/AudioClipConverter.cs b/AssetStudioUtility/AudioClipConverter.cs index 5e146371..458334e5 100644 --- a/AssetStudioUtility/AudioClipConverter.cs +++ b/AssetStudioUtility/AudioClipConverter.cs @@ -94,29 +94,29 @@ public string GetExtensionName() { switch (m_AudioClip.m_Type) { - case AudioType.ACC: + case FMODSoundType.ACC: return ".m4a"; - case AudioType.AIFF: + case FMODSoundType.AIFF: return ".aif"; - case AudioType.IT: + case FMODSoundType.IT: return ".it"; - case AudioType.MOD: + case FMODSoundType.MOD: return ".mod"; - case AudioType.MPEG: + case FMODSoundType.MPEG: return ".mp3"; - case AudioType.OGGVORBIS: + case FMODSoundType.OGGVORBIS: return ".ogg"; - case AudioType.S3M: + case FMODSoundType.S3M: return ".s3m"; - case AudioType.WAV: + case FMODSoundType.WAV: return ".wav"; - case AudioType.XM: + case FMODSoundType.XM: return ".xm"; - case AudioType.XMA: + case FMODSoundType.XMA: return ".wav"; - case AudioType.VAG: + case FMODSoundType.VAG: return ".vag"; - case AudioType.AUDIOQUEUE: + case FMODSoundType.AUDIOQUEUE: return ".fsb"; } @@ -133,7 +133,7 @@ public string GetExtensionName() return ".fsb"; case AudioCompressionFormat.MP3: return ".fsb"; - case AudioCompressionFormat.VAG: + case AudioCompressionFormat.PSMVAG: return ".fsb"; case AudioCompressionFormat.HEVAG: return ".fsb"; @@ -159,13 +159,13 @@ public bool IsSupport { switch (m_AudioClip.m_Type) { - case AudioType.AIFF: - case AudioType.IT: - case AudioType.MOD: - case AudioType.S3M: - case AudioType.XM: - case AudioType.XMA: - case AudioType.AUDIOQUEUE: + case FMODSoundType.AIFF: + case FMODSoundType.IT: + case FMODSoundType.MOD: + case FMODSoundType.S3M: + case FMODSoundType.XM: + case FMODSoundType.XMA: + case FMODSoundType.AUDIOQUEUE: return true; default: return false; diff --git a/AssetStudioUtility/ShaderConverter.cs b/AssetStudioUtility/ShaderConverter.cs index 5ee257d5..ba346d51 100644 --- a/AssetStudioUtility/ShaderConverter.cs +++ b/AssetStudioUtility/ShaderConverter.cs @@ -109,17 +109,17 @@ private static string ConvertSerializedPass(SerializedPass m_Passe, ShaderCompil var sb = new StringBuilder(); switch (m_Passe.m_Type) { - case PassType.kPassTypeNormal: + case PassType.Normal: sb.Append(" Pass "); break; - case PassType.kPassTypeUse: + case PassType.Use: sb.Append(" UsePass "); break; - case PassType.kPassTypeGrab: + case PassType.Grab: sb.Append(" GrabPass "); break; } - if (m_Passe.m_Type == PassType.kPassTypeUse) + if (m_Passe.m_Type == PassType.Use) { sb.Append($"\"{m_Passe.m_UseName}\"\n"); } @@ -127,7 +127,7 @@ private static string ConvertSerializedPass(SerializedPass m_Passe, ShaderCompil { sb.Append("{\n"); - if (m_Passe.m_Type == PassType.kPassTypeGrab) + if (m_Passe.m_Type == PassType.Grab) { if (!string.IsNullOrEmpty(m_Passe.m_TextureName)) { @@ -358,7 +358,7 @@ private static string ConvertSerializedShaderState(SerializedShaderState m_State sb.Append(" }\n"); } - if (m_State.fogMode != FogMode.kFogUnknown || + if (m_State.fogMode != FogMode.Unknown || m_State.fogColor.x.val != 0f || m_State.fogColor.y.val != 0f || m_State.fogColor.z.val != 0f || @@ -368,21 +368,21 @@ private static string ConvertSerializedShaderState(SerializedShaderState m_State m_State.fogEnd.val != 0f) { sb.Append(" Fog {\n"); - if (m_State.fogMode != FogMode.kFogUnknown) + if (m_State.fogMode != FogMode.Unknown) { sb.Append(" Mode "); switch (m_State.fogMode) { - case FogMode.kFogDisabled: + case FogMode.Disabled: sb.Append("Off"); break; - case FogMode.kFogLinear: + case FogMode.Linear: sb.Append("Linear"); break; - case FogMode.kFogExp: + case FogMode.Exp: sb.Append("Exp"); break; - case FogMode.kFogExp2: + case FogMode.Exp2: sb.Append("Exp2"); break; } @@ -674,37 +674,37 @@ private static string ConvertSerializedProperty(SerializedProperty m_Prop) sb.Append($"{m_Prop.m_Name} (\"{m_Prop.m_Description}\", "); switch (m_Prop.m_Type) { - case SerializedPropertyType.kColor: + case SerializedPropertyType.Color: sb.Append("Color"); break; - case SerializedPropertyType.kVector: + case SerializedPropertyType.Vector: sb.Append("Vector"); break; - case SerializedPropertyType.kFloat: + case SerializedPropertyType.Float: sb.Append("Float"); break; - case SerializedPropertyType.kRange: + case SerializedPropertyType.Range: sb.Append($"Range({m_Prop.m_DefValue[1]}, {m_Prop.m_DefValue[2]})"); break; - case SerializedPropertyType.kTexture: + case SerializedPropertyType.Texture: switch (m_Prop.m_DefTexture.m_TexDim) { - case TextureDimension.kTexDimAny: + case TextureDimension.Any: sb.Append("any"); break; - case TextureDimension.kTexDim2D: + case TextureDimension.Tex2D: sb.Append("2D"); break; - case TextureDimension.kTexDim3D: + case TextureDimension.Tex3D: sb.Append("3D"); break; - case TextureDimension.kTexDimCUBE: + case TextureDimension.Cube: sb.Append("Cube"); break; - case TextureDimension.kTexDim2DArray: + case TextureDimension.Tex2DArray: sb.Append("2DArray"); break; - case TextureDimension.kTexDimCubeArray: + case TextureDimension.CubeArray: sb.Append("CubeArray"); break; } @@ -713,15 +713,15 @@ private static string ConvertSerializedProperty(SerializedProperty m_Prop) sb.Append(") = "); switch (m_Prop.m_Type) { - case SerializedPropertyType.kColor: - case SerializedPropertyType.kVector: + case SerializedPropertyType.Color: + case SerializedPropertyType.Vector: sb.Append($"({m_Prop.m_DefValue[0]},{m_Prop.m_DefValue[1]},{m_Prop.m_DefValue[2]},{m_Prop.m_DefValue[3]})"); break; - case SerializedPropertyType.kFloat: - case SerializedPropertyType.kRange: + case SerializedPropertyType.Float: + case SerializedPropertyType.Range: sb.Append(m_Prop.m_DefValue[0]); break; - case SerializedPropertyType.kTexture: + case SerializedPropertyType.Texture: sb.Append($"\"{m_Prop.m_DefTexture.m_DefaultName}\" {{ }}"); break; default: @@ -735,64 +735,65 @@ private static bool CheckGpuProgramUsable(ShaderCompilerPlatform platform, Shade { switch (platform) { - case ShaderCompilerPlatform.kShaderCompPlatformGL: - return programType == ShaderGpuProgramType.kShaderGpuProgramGLLegacy; - case ShaderCompilerPlatform.kShaderCompPlatformD3D9: - return programType == ShaderGpuProgramType.kShaderGpuProgramDX9VertexSM20 - || programType == ShaderGpuProgramType.kShaderGpuProgramDX9VertexSM30 - || programType == ShaderGpuProgramType.kShaderGpuProgramDX9PixelSM20 - || programType == ShaderGpuProgramType.kShaderGpuProgramDX9PixelSM30; - case ShaderCompilerPlatform.kShaderCompPlatformXbox360: - case ShaderCompilerPlatform.kShaderCompPlatformPS3: - case ShaderCompilerPlatform.kShaderCompPlatformPSP2: - case ShaderCompilerPlatform.kShaderCompPlatformPS4: - case ShaderCompilerPlatform.kShaderCompPlatformXboxOne: - case ShaderCompilerPlatform.kShaderCompPlatformN3DS: - case ShaderCompilerPlatform.kShaderCompPlatformWiiU: - case ShaderCompilerPlatform.kShaderCompPlatformSwitch: - case ShaderCompilerPlatform.kShaderCompPlatformXboxOneD3D12: - case ShaderCompilerPlatform.kShaderCompPlatformGameCoreXboxOne: - case ShaderCompilerPlatform.kShaderCompPlatformGameCoreScarlett: - case ShaderCompilerPlatform.kShaderCompPlatformPS5: - case ShaderCompilerPlatform.kShaderCompPlatformPS5NGGC: - return programType == ShaderGpuProgramType.kShaderGpuProgramConsoleVS - || programType == ShaderGpuProgramType.kShaderGpuProgramConsoleFS - || programType == ShaderGpuProgramType.kShaderGpuProgramConsoleHS - || programType == ShaderGpuProgramType.kShaderGpuProgramConsoleDS - || programType == ShaderGpuProgramType.kShaderGpuProgramConsoleGS; - case ShaderCompilerPlatform.kShaderCompPlatformD3D11: - return programType == ShaderGpuProgramType.kShaderGpuProgramDX11VertexSM40 - || programType == ShaderGpuProgramType.kShaderGpuProgramDX11VertexSM50 - || programType == ShaderGpuProgramType.kShaderGpuProgramDX11PixelSM40 - || programType == ShaderGpuProgramType.kShaderGpuProgramDX11PixelSM50 - || programType == ShaderGpuProgramType.kShaderGpuProgramDX11GeometrySM40 - || programType == ShaderGpuProgramType.kShaderGpuProgramDX11GeometrySM50 - || programType == ShaderGpuProgramType.kShaderGpuProgramDX11HullSM50 - || programType == ShaderGpuProgramType.kShaderGpuProgramDX11DomainSM50; - case ShaderCompilerPlatform.kShaderCompPlatformGLES20: - return programType == ShaderGpuProgramType.kShaderGpuProgramGLES; - case ShaderCompilerPlatform.kShaderCompPlatformNaCl: //Obsolete + case ShaderCompilerPlatform.GL: + return programType == ShaderGpuProgramType.GLLegacy; + case ShaderCompilerPlatform.D3D9: + return programType == ShaderGpuProgramType.DX9VertexSM20 + || programType == ShaderGpuProgramType.DX9VertexSM30 + || programType == ShaderGpuProgramType.DX9PixelSM20 + || programType == ShaderGpuProgramType.DX9PixelSM30; + case ShaderCompilerPlatform.Xbox360: + case ShaderCompilerPlatform.PS3: + case ShaderCompilerPlatform.PSP2: + case ShaderCompilerPlatform.PS4: + case ShaderCompilerPlatform.XboxOne: + case ShaderCompilerPlatform.N3DS: + case ShaderCompilerPlatform.WiiU: + case ShaderCompilerPlatform.Switch: + case ShaderCompilerPlatform.XboxOneD3D12: + case ShaderCompilerPlatform.GameCoreXboxOne: + case ShaderCompilerPlatform.GameCoreScarlett: + case ShaderCompilerPlatform.PS5: + return programType == ShaderGpuProgramType.ConsoleVS + || programType == ShaderGpuProgramType.ConsoleFS + || programType == ShaderGpuProgramType.ConsoleHS + || programType == ShaderGpuProgramType.ConsoleDS + || programType == ShaderGpuProgramType.ConsoleGS; + case ShaderCompilerPlatform.PS5NGGC: + return programType == ShaderGpuProgramType.PS5NGGC; + case ShaderCompilerPlatform.D3D11: + return programType == ShaderGpuProgramType.DX11VertexSM40 + || programType == ShaderGpuProgramType.DX11VertexSM50 + || programType == ShaderGpuProgramType.DX11PixelSM40 + || programType == ShaderGpuProgramType.DX11PixelSM50 + || programType == ShaderGpuProgramType.DX11GeometrySM40 + || programType == ShaderGpuProgramType.DX11GeometrySM50 + || programType == ShaderGpuProgramType.DX11HullSM50 + || programType == ShaderGpuProgramType.DX11DomainSM50; + case ShaderCompilerPlatform.GLES20: + return programType == ShaderGpuProgramType.GLES; + case ShaderCompilerPlatform.NaCl: //Obsolete throw new NotSupportedException(); - case ShaderCompilerPlatform.kShaderCompPlatformFlash: //Obsolete + case ShaderCompilerPlatform.Flash: //Obsolete throw new NotSupportedException(); - case ShaderCompilerPlatform.kShaderCompPlatformD3D11_9x: - return programType == ShaderGpuProgramType.kShaderGpuProgramDX10Level9Vertex - || programType == ShaderGpuProgramType.kShaderGpuProgramDX10Level9Pixel; - case ShaderCompilerPlatform.kShaderCompPlatformGLES3Plus: - return programType == ShaderGpuProgramType.kShaderGpuProgramGLES31AEP - || programType == ShaderGpuProgramType.kShaderGpuProgramGLES31 - || programType == ShaderGpuProgramType.kShaderGpuProgramGLES3; - case ShaderCompilerPlatform.kShaderCompPlatformPSM: //Unknown + case ShaderCompilerPlatform.D3D11_9x: + return programType == ShaderGpuProgramType.DX10Level9Vertex + || programType == ShaderGpuProgramType.DX10Level9Pixel; + case ShaderCompilerPlatform.GLES3Plus: + return programType == ShaderGpuProgramType.GLES31AEP + || programType == ShaderGpuProgramType.GLES31 + || programType == ShaderGpuProgramType.GLES3; + case ShaderCompilerPlatform.PSM: //Unknown throw new NotSupportedException(); - case ShaderCompilerPlatform.kShaderCompPlatformMetal: - return programType == ShaderGpuProgramType.kShaderGpuProgramMetalVS - || programType == ShaderGpuProgramType.kShaderGpuProgramMetalFS; - case ShaderCompilerPlatform.kShaderCompPlatformOpenGLCore: - return programType == ShaderGpuProgramType.kShaderGpuProgramGLCore32 - || programType == ShaderGpuProgramType.kShaderGpuProgramGLCore41 - || programType == ShaderGpuProgramType.kShaderGpuProgramGLCore43; - case ShaderCompilerPlatform.kShaderCompPlatformVulkan: - return programType == ShaderGpuProgramType.kShaderGpuProgramSPIRV; + case ShaderCompilerPlatform.Metal: + return programType == ShaderGpuProgramType.MetalVS + || programType == ShaderGpuProgramType.MetalFS; + case ShaderCompilerPlatform.OpenGLCore: + return programType == ShaderGpuProgramType.GLCore32 + || programType == ShaderGpuProgramType.GLCore41 + || programType == ShaderGpuProgramType.GLCore43; + case ShaderCompilerPlatform.Vulkan: + return programType == ShaderGpuProgramType.SPIRV; default: throw new NotSupportedException(); } @@ -802,55 +803,55 @@ public static string GetPlatformString(ShaderCompilerPlatform platform) { switch (platform) { - case ShaderCompilerPlatform.kShaderCompPlatformGL: + case ShaderCompilerPlatform.GL: return "openGL"; - case ShaderCompilerPlatform.kShaderCompPlatformD3D9: + case ShaderCompilerPlatform.D3D9: return "d3d9"; - case ShaderCompilerPlatform.kShaderCompPlatformXbox360: + case ShaderCompilerPlatform.Xbox360: return "xbox360"; - case ShaderCompilerPlatform.kShaderCompPlatformPS3: + case ShaderCompilerPlatform.PS3: return "ps3"; - case ShaderCompilerPlatform.kShaderCompPlatformD3D11: + case ShaderCompilerPlatform.D3D11: return "d3d11"; - case ShaderCompilerPlatform.kShaderCompPlatformGLES20: + case ShaderCompilerPlatform.GLES20: return "gles"; - case ShaderCompilerPlatform.kShaderCompPlatformNaCl: + case ShaderCompilerPlatform.NaCl: return "glesdesktop"; - case ShaderCompilerPlatform.kShaderCompPlatformFlash: + case ShaderCompilerPlatform.Flash: return "flash"; - case ShaderCompilerPlatform.kShaderCompPlatformD3D11_9x: + case ShaderCompilerPlatform.D3D11_9x: return "d3d11_9x"; - case ShaderCompilerPlatform.kShaderCompPlatformGLES3Plus: + case ShaderCompilerPlatform.GLES3Plus: return "gles3"; - case ShaderCompilerPlatform.kShaderCompPlatformPSP2: + case ShaderCompilerPlatform.PSP2: return "psp2"; - case ShaderCompilerPlatform.kShaderCompPlatformPS4: + case ShaderCompilerPlatform.PS4: return "ps4"; - case ShaderCompilerPlatform.kShaderCompPlatformXboxOne: + case ShaderCompilerPlatform.XboxOne: return "xboxone"; - case ShaderCompilerPlatform.kShaderCompPlatformPSM: + case ShaderCompilerPlatform.PSM: return "psm"; - case ShaderCompilerPlatform.kShaderCompPlatformMetal: + case ShaderCompilerPlatform.Metal: return "metal"; - case ShaderCompilerPlatform.kShaderCompPlatformOpenGLCore: + case ShaderCompilerPlatform.OpenGLCore: return "glcore"; - case ShaderCompilerPlatform.kShaderCompPlatformN3DS: + case ShaderCompilerPlatform.N3DS: return "n3ds"; - case ShaderCompilerPlatform.kShaderCompPlatformWiiU: + case ShaderCompilerPlatform.WiiU: return "wiiu"; - case ShaderCompilerPlatform.kShaderCompPlatformVulkan: + case ShaderCompilerPlatform.Vulkan: return "vulkan"; - case ShaderCompilerPlatform.kShaderCompPlatformSwitch: + case ShaderCompilerPlatform.Switch: return "switch"; - case ShaderCompilerPlatform.kShaderCompPlatformXboxOneD3D12: + case ShaderCompilerPlatform.XboxOneD3D12: return "xboxone_d3d12"; - case ShaderCompilerPlatform.kShaderCompPlatformGameCoreXboxOne: + case ShaderCompilerPlatform.GameCoreXboxOne: return "xboxone"; - case ShaderCompilerPlatform.kShaderCompPlatformGameCoreScarlett: + case ShaderCompilerPlatform.GameCoreScarlett: return "xbox_scarlett"; - case ShaderCompilerPlatform.kShaderCompPlatformPS5: + case ShaderCompilerPlatform.PS5: return "ps5"; - case ShaderCompilerPlatform.kShaderCompPlatformPS5NGGC: + case ShaderCompilerPlatform.PS5NGGC: return "ps5_nggc"; default: return "unknown"; @@ -996,36 +997,36 @@ public string Export() { switch (m_ProgramType) { - case ShaderGpuProgramType.kShaderGpuProgramGLLegacy: - case ShaderGpuProgramType.kShaderGpuProgramGLES31AEP: - case ShaderGpuProgramType.kShaderGpuProgramGLES31: - case ShaderGpuProgramType.kShaderGpuProgramGLES3: - case ShaderGpuProgramType.kShaderGpuProgramGLES: - case ShaderGpuProgramType.kShaderGpuProgramGLCore32: - case ShaderGpuProgramType.kShaderGpuProgramGLCore41: - case ShaderGpuProgramType.kShaderGpuProgramGLCore43: + case ShaderGpuProgramType.GLLegacy: + case ShaderGpuProgramType.GLES31AEP: + case ShaderGpuProgramType.GLES31: + case ShaderGpuProgramType.GLES3: + case ShaderGpuProgramType.GLES: + case ShaderGpuProgramType.GLCore32: + case ShaderGpuProgramType.GLCore41: + case ShaderGpuProgramType.GLCore43: sb.Append(Encoding.UTF8.GetString(m_ProgramCode)); break; - case ShaderGpuProgramType.kShaderGpuProgramDX9VertexSM20: - case ShaderGpuProgramType.kShaderGpuProgramDX9VertexSM30: - case ShaderGpuProgramType.kShaderGpuProgramDX9PixelSM20: - case ShaderGpuProgramType.kShaderGpuProgramDX9PixelSM30: + case ShaderGpuProgramType.DX9VertexSM20: + case ShaderGpuProgramType.DX9VertexSM30: + case ShaderGpuProgramType.DX9PixelSM20: + case ShaderGpuProgramType.DX9PixelSM30: { /*var shaderBytecode = new ShaderBytecode(m_ProgramCode); sb.Append(shaderBytecode.Disassemble());*/ sb.Append("// shader disassembly not supported on DXBC"); break; } - case ShaderGpuProgramType.kShaderGpuProgramDX10Level9Vertex: - case ShaderGpuProgramType.kShaderGpuProgramDX10Level9Pixel: - case ShaderGpuProgramType.kShaderGpuProgramDX11VertexSM40: - case ShaderGpuProgramType.kShaderGpuProgramDX11VertexSM50: - case ShaderGpuProgramType.kShaderGpuProgramDX11PixelSM40: - case ShaderGpuProgramType.kShaderGpuProgramDX11PixelSM50: - case ShaderGpuProgramType.kShaderGpuProgramDX11GeometrySM40: - case ShaderGpuProgramType.kShaderGpuProgramDX11GeometrySM50: - case ShaderGpuProgramType.kShaderGpuProgramDX11HullSM50: - case ShaderGpuProgramType.kShaderGpuProgramDX11DomainSM50: + case ShaderGpuProgramType.DX10Level9Vertex: + case ShaderGpuProgramType.DX10Level9Pixel: + case ShaderGpuProgramType.DX11VertexSM40: + case ShaderGpuProgramType.DX11VertexSM50: + case ShaderGpuProgramType.DX11PixelSM40: + case ShaderGpuProgramType.DX11PixelSM50: + case ShaderGpuProgramType.DX11GeometrySM40: + case ShaderGpuProgramType.DX11GeometrySM50: + case ShaderGpuProgramType.DX11HullSM50: + case ShaderGpuProgramType.DX11DomainSM50: { /*int start = 6; if (m_Version == 201509030) // 5.3 @@ -1039,8 +1040,8 @@ public string Export() sb.Append("// shader disassembly not supported on DXBC"); break; } - case ShaderGpuProgramType.kShaderGpuProgramMetalVS: - case ShaderGpuProgramType.kShaderGpuProgramMetalFS: + case ShaderGpuProgramType.MetalVS: + case ShaderGpuProgramType.MetalFS: using (var reader = new BinaryReader(new MemoryStream(m_ProgramCode))) { var fourCC = reader.ReadUInt32(); @@ -1054,7 +1055,7 @@ public string Export() sb.Append(Encoding.UTF8.GetString(buff)); } break; - case ShaderGpuProgramType.kShaderGpuProgramSPIRV: + case ShaderGpuProgramType.SPIRV: try { sb.Append(SpirVShaderConverter.Convert(m_ProgramCode)); @@ -1064,11 +1065,11 @@ public string Export() sb.Append($"// disassembly error {e.Message}\n"); } break; - case ShaderGpuProgramType.kShaderGpuProgramConsoleVS: - case ShaderGpuProgramType.kShaderGpuProgramConsoleFS: - case ShaderGpuProgramType.kShaderGpuProgramConsoleHS: - case ShaderGpuProgramType.kShaderGpuProgramConsoleDS: - case ShaderGpuProgramType.kShaderGpuProgramConsoleGS: + case ShaderGpuProgramType.ConsoleVS: + case ShaderGpuProgramType.ConsoleFS: + case ShaderGpuProgramType.ConsoleHS: + case ShaderGpuProgramType.ConsoleDS: + case ShaderGpuProgramType.ConsoleGS: sb.Append(Encoding.UTF8.GetString(m_ProgramCode)); break; default: diff --git a/AssetStudioUtility/SpriteHelper.cs b/AssetStudioUtility/SpriteHelper.cs index 62e1ebab..db1ac99f 100644 --- a/AssetStudioUtility/SpriteHelper.cs +++ b/AssetStudioUtility/SpriteHelper.cs @@ -58,23 +58,23 @@ private static Image CutImage(Sprite m_Sprite, Texture2D m_Texture2D, Re //RotateAndFlip switch (settingsRaw.packingRotation) { - case SpritePackingRotation.kSPRFlipHorizontal: + case SpritePackingRotation.FlipHorizontal: spriteImage.Mutate(x => x.Flip(FlipMode.Horizontal)); break; - case SpritePackingRotation.kSPRFlipVertical: + case SpritePackingRotation.FlipVertical: spriteImage.Mutate(x => x.Flip(FlipMode.Vertical)); break; - case SpritePackingRotation.kSPRRotate180: + case SpritePackingRotation.Rotate180: spriteImage.Mutate(x => x.Rotate(180)); break; - case SpritePackingRotation.kSPRRotate90: + case SpritePackingRotation.Rotate90: spriteImage.Mutate(x => x.Rotate(270)); break; } } //Tight - if (settingsRaw.packingMode == SpritePackingMode.kSPMTight) + if (settingsRaw.packingMode == SpritePackingMode.Tight) { try {