From 5cc0830c9bc64140a8e69fe63f8bf11f60d4de9d Mon Sep 17 00:00:00 2001 From: DarkShadow Date: Thu, 21 Mar 2024 00:20:37 +0200 Subject: [PATCH] Add initial support for other surface formats --- .../DDS_D3DTX_Converter/DirectX/DDS.cs | 317 +++++++++++++++++- .../DDS_D3DTX_Converter/ImageProperties.cs | 12 +- .../TelltaleD3DTX/D3DTX_V4.cs | 2 +- .../TelltaleD3DTX/D3DTX_V5.cs | 4 +- .../TelltaleD3DTX/D3DTX_V6.cs | 2 +- .../TelltaleD3DTX/D3DTX_V7.cs | 2 +- .../TelltaleD3DTX/D3DTX_V8.cs | 2 +- .../TelltaleD3DTX/D3DTX_V9.cs | 2 +- 8 files changed, 314 insertions(+), 29 deletions(-) diff --git a/DDS_D3DTX_Converter_GUI/DDS_D3DTX_Converter/DirectX/DDS.cs b/DDS_D3DTX_Converter_GUI/DDS_D3DTX_Converter/DirectX/DDS.cs index 423d4eb..18f9cb4 100644 --- a/DDS_D3DTX_Converter_GUI/DDS_D3DTX_Converter/DirectX/DDS.cs +++ b/DDS_D3DTX_Converter_GUI/DDS_D3DTX_Converter/DirectX/DDS.cs @@ -1,7 +1,10 @@ -using D3DTX_Converter.TelltaleEnums; +using CommunityToolkit.Mvvm.ComponentModel.__Internals; +using D3DTX_Converter.Main; +using D3DTX_Converter.TelltaleEnums; using D3DTX_Converter.TelltaleTypes; using D3DTX_Converter.Utilities; using DirectXTexNet; +using Microsoft.CodeAnalysis.CSharp.Syntax; using System; using System.Runtime.InteropServices; @@ -60,7 +63,7 @@ public static uint[] GetImageByteSizes(uint[,] mipResolutions, uint baseLinearSi { uint[] byteSizes = new uint[mipResolutions.GetLength(0)]; - for(int i = 0; i < byteSizes.Length; i++) + for (int i = 0; i < byteSizes.Length; i++) { uint mipWidth = mipResolutions[i, 0]; uint mipHeight = mipResolutions[i, 1]; @@ -298,6 +301,11 @@ public static DDS_HEADER GetHeaderFromBytes(byte[] byteArray) Marshal.Copy(byteArray, 0, ptr, size); + + //Initialize DDS_HEADER_DXT10 + DDS_HEADER_DXT10 dxt10HeaderObject = new(); + // dxt10HeaderObject.dxgiFormat = ; + headerObject = (DDS_HEADER)Marshal.PtrToStructure(ptr, headerObject.GetType()); Marshal.FreeHGlobal(ptr); @@ -362,21 +370,61 @@ public static DDS_HEADER GetPresetHeader() public static uint Get_FourCC_FromTellale(T3SurfaceFormat format) { - switch (format) + return format switch { - default: return ByteFunctions.Convert_String_To_UInt32("DXT1"); - case T3SurfaceFormat.eSurface_DXT1: return ByteFunctions.Convert_String_To_UInt32("DXT1"); - case T3SurfaceFormat.eSurface_DXT3: return ByteFunctions.Convert_String_To_UInt32("DXT3"); - case T3SurfaceFormat.eSurface_DXT5: return ByteFunctions.Convert_String_To_UInt32("DXT5"); - case T3SurfaceFormat.eSurface_DXN: return ByteFunctions.Convert_String_To_UInt32("ATI2"); - case T3SurfaceFormat.eSurface_DXT5A: return ByteFunctions.Convert_String_To_UInt32("ATI1"); - case T3SurfaceFormat.eSurface_BC4: return ByteFunctions.Convert_String_To_UInt32("BC4S"); - case T3SurfaceFormat.eSurface_BC5: return ByteFunctions.Convert_String_To_UInt32("BC5S"); - case T3SurfaceFormat.eSurface_A8: return ByteFunctions.Convert_String_To_UInt32("DX10"); - } + T3SurfaceFormat.eSurface_ARGB8 or + T3SurfaceFormat.eSurface_ARGB16 or + T3SurfaceFormat.eSurface_RGB565 or + T3SurfaceFormat.eSurface_ARGB1555 or + T3SurfaceFormat.eSurface_ARGB2101010 or + T3SurfaceFormat.eSurface_R16 or + T3SurfaceFormat.eSurface_RG16 or + T3SurfaceFormat.eSurface_RGBA16 or + T3SurfaceFormat.eSurface_RG8 or + T3SurfaceFormat.eSurface_RGBA8 or + T3SurfaceFormat.eSurface_R32 or + T3SurfaceFormat.eSurface_RG32 or + T3SurfaceFormat.eSurface_RGBA32 or + T3SurfaceFormat.eSurface_R8 or + T3SurfaceFormat.eSurface_RGBA8S or + T3SurfaceFormat.eSurface_A8 or + T3SurfaceFormat.eSurface_L8 or + T3SurfaceFormat.eSurface_AL8 or + T3SurfaceFormat.eSurface_L16 or + T3SurfaceFormat.eSurface_RG16S or + T3SurfaceFormat.eSurface_RGBA16S or + T3SurfaceFormat.eSurface_R16UI or + T3SurfaceFormat.eSurface_RG16UI or + T3SurfaceFormat.eSurface_R16F or + T3SurfaceFormat.eSurface_RG16F or + T3SurfaceFormat.eSurface_RGBA16F or + T3SurfaceFormat.eSurface_R32F or + T3SurfaceFormat.eSurface_RG32F or + T3SurfaceFormat.eSurface_RGBA32F or + T3SurfaceFormat.eSurface_RGBA1010102F or + T3SurfaceFormat.eSurface_RGB111110F or + T3SurfaceFormat.eSurface_RGB9E5F or + T3SurfaceFormat.eSurface_DepthPCF16 or + T3SurfaceFormat.eSurface_DepthPCF24 or + T3SurfaceFormat.eSurface_Depth16 or + T3SurfaceFormat.eSurface_Depth24 or + T3SurfaceFormat.eSurface_DepthStencil32 or + T3SurfaceFormat.eSurface_Depth32F or + T3SurfaceFormat.eSurface_Depth32F_Stencil8 or + T3SurfaceFormat.eSurface_Depth24F_Stencil8 => ByteFunctions.Convert_String_To_UInt32("DX10"), + T3SurfaceFormat.eSurface_DXT1 => ByteFunctions.Convert_String_To_UInt32("DXT1"), + T3SurfaceFormat.eSurface_DXT3 => ByteFunctions.Convert_String_To_UInt32("DXT3"), + T3SurfaceFormat.eSurface_DXT5 => ByteFunctions.Convert_String_To_UInt32("DXT5"), + T3SurfaceFormat.eSurface_DXN => ByteFunctions.Convert_String_To_UInt32("ATI2"), + T3SurfaceFormat.eSurface_DXT5A => ByteFunctions.Convert_String_To_UInt32("ATI1"), + T3SurfaceFormat.eSurface_BC4 => ByteFunctions.Convert_String_To_UInt32("BC4S"), + T3SurfaceFormat.eSurface_BC5 => ByteFunctions.Convert_String_To_UInt32("BC5S"), + _ => ByteFunctions.Convert_String_To_UInt32("DXT1"), + }; + } - public static T3SurfaceFormat Get_T3Format_FromFourCC(uint fourCC) + public static T3SurfaceFormat Get_T3Format_FromFourCC(uint fourCC, DDS_Master dds) { if (fourCC == ByteFunctions.Convert_String_To_UInt32("DXT1")) return T3SurfaceFormat.eSurface_DXT1; else if (fourCC == ByteFunctions.Convert_String_To_UInt32("DXT3")) return T3SurfaceFormat.eSurface_DXT3; @@ -385,20 +433,251 @@ public static T3SurfaceFormat Get_T3Format_FromFourCC(uint fourCC) else if (fourCC == ByteFunctions.Convert_String_To_UInt32("ATI1")) return T3SurfaceFormat.eSurface_DXT5A; else if (fourCC == ByteFunctions.Convert_String_To_UInt32("BC4S")) return T3SurfaceFormat.eSurface_BC4; else if (fourCC == ByteFunctions.Convert_String_To_UInt32("BC5S")) return T3SurfaceFormat.eSurface_BC5; - + else if (fourCC == ByteFunctions.Convert_String_To_UInt32("DX10")) return Parse_T3Format_FromDX10(dds.sourceFileData); else return T3SurfaceFormat.eSurface_DXT1; } + public static T3SurfaceFormat Parse_T3Format_FromDX10(byte[] data) + { + int startIndex = 128; + + int dxgi_format = BitConverter.ToInt32(data, startIndex); + + return dxgi_format switch + { + (int)DXGI_FORMAT.R8G8B8A8_UNORM_SRGB => T3SurfaceFormat.eSurface_ARGB8, + (int)DXGI_FORMAT.R8G8B8A8_UNORM => T3SurfaceFormat.eSurface_ARGB8, + (int)DXGI_FORMAT.R16G16B16A16_SNORM => T3SurfaceFormat.eSurface_ARGB16, + (int)DXGI_FORMAT.B5G6R5_UNORM => T3SurfaceFormat.eSurface_RGB565, + (int)DXGI_FORMAT.B5G5R5A1_UNORM => T3SurfaceFormat.eSurface_ARGB1555, + (int)DXGI_FORMAT.B4G4R4A4_UNORM => T3SurfaceFormat.eSurface_ARGB4, + (int)DXGI_FORMAT.R10G10B10A2_UNORM => T3SurfaceFormat.eSurface_ARGB2101010, + (int)DXGI_FORMAT.R16_UNORM => T3SurfaceFormat.eSurface_R16, + (int)DXGI_FORMAT.R16G16_UNORM => T3SurfaceFormat.eSurface_RG16, + (int)DXGI_FORMAT.R16G16B16A16_UNORM => T3SurfaceFormat.eSurface_RGBA16, + (int)DXGI_FORMAT.R8G8_UNORM => T3SurfaceFormat.eSurface_RG8, + //(int)DXGI_FORMAT.R8G8B8A8_UNORM => T3SurfaceFormat.eSurface_RGBA8, + //TODO FIX R32 (could be int here) + (int)DXGI_FORMAT.R32_FLOAT => T3SurfaceFormat.eSurface_R32, + (int)DXGI_FORMAT.R32G32_FLOAT => T3SurfaceFormat.eSurface_RG32, + (int)DXGI_FORMAT.R32G32B32A32_FLOAT => T3SurfaceFormat.eSurface_RGBA32, + (int)DXGI_FORMAT.R8_UNORM => T3SurfaceFormat.eSurface_R8, + (int)DXGI_FORMAT.R8G8B8A8_SNORM => T3SurfaceFormat.eSurface_RGBA8S, + (int)DXGI_FORMAT.A8_UNORM => T3SurfaceFormat.eSurface_A8, + //(int)DXGI_FORMAT.R8_UNORM =>T3SurfaceFormat.eSurface_L8, + //(int)DXGI_FORMAT.R8G8_UNORM => T3SurfaceFormat.eSurface_AL8, + //(int) DXGI_FORMAT.R16_UNORM => T3SurfaceFormat.eSurface_L16, + (int)DXGI_FORMAT.R16G16_SNORM => T3SurfaceFormat.eSurface_RG16S, + //(int)DXGI_FORMAT.R16G16B16A16_SNORM=>T3SurfaceFormat.eSurface_RGBA16S, + (int)DXGI_FORMAT.R16G16B16A16_UINT => T3SurfaceFormat.eSurface_R16UI, + (int)DXGI_FORMAT.R16_FLOAT => T3SurfaceFormat.eSurface_R16F, + (int)DXGI_FORMAT.R16G16B16A16_FLOAT => T3SurfaceFormat.eSurface_RGBA16F, + //(int)DXGI_FORMAT.R32_FLOAT => T3SurfaceFormat.eSurface_R32F, + //(int)DXGI_FORMAT.R32G32_FLOAT=>T3SurfaceFormat.eSurface_RG32F, + //(int)DXGI_FORMAT.R32G32B32A32_FLOAT=>T3SurfaceFormat.eSurface_RGBA32F, + //TODO SAME HERE, IS IT INT? + // (int)DXGI_FORMAT.R10G10B10A2_UNORM=>T3SurfaceFormat.eSurface_RGBA1010102F, + (int)DXGI_FORMAT.R11G11B10_FLOAT => T3SurfaceFormat.eSurface_RGB111110F, + (int)DXGI_FORMAT.R9G9B9E5_SHAREDEXP => T3SurfaceFormat.eSurface_RGB9E5F, + (int)DXGI_FORMAT.D16_UNORM => T3SurfaceFormat.eSurface_DepthPCF16, + (int)DXGI_FORMAT.D24_UNORM_S8_UINT => T3SurfaceFormat.eSurface_DepthPCF24, + //?? + //(int)DXGI_FORMAT.D16_UNORM =>T3SurfaceFormat.eSurface_Depth16, + //(int)DXGI_FORMAT.D24_UNORM_S8_UINT => T3SurfaceFormat.eSurface_Depth24, + (int)DXGI_FORMAT.D32_FLOAT_S8X24_UINT => T3SurfaceFormat.eSurface_DepthStencil32, + (int)DXGI_FORMAT.D32_FLOAT => T3SurfaceFormat.eSurface_Depth32F, + //(int)DXGI_FORMAT.D32_FLOAT_S8X24_UINT => T3SurfaceFormat.eSurface_Depth32F_Stencil8, + //(int)DXGI_FORMAT.D24_UNORM_S8_UINT =>T3SurfaceFormat.eSurface_Depth24F_Stencil8, + _ => T3SurfaceFormat.eSurface_Unknown, + }; + + } + public static DXGI_FORMAT GetSurfaceFormatAsDXGI(T3SurfaceFormat format, T3SurfaceGamma gamma = T3SurfaceGamma.eSurfaceGamma_sRGB) { - switch(format) + switch (format) { + + //In order of T3SurfaceFormat enum + default: return DXGI_FORMAT.BC1_UNORM; //just choose classic DXT1 if the format isn't known + //TODO + //--------------------ARGB8-------------------- + case T3SurfaceFormat.eSurface_ARGB8: + if (gamma == T3SurfaceGamma.eSurfaceGamma_sRGB) + return DXGI_FORMAT.R8G8B8A8_UNORM_SRGB; + else + return DXGI_FORMAT.R8G8B8A8_UNORM; + //TODO + //--------------------ARGB16-------------------- + case T3SurfaceFormat.eSurface_ARGB16: + return DXGI_FORMAT.R16G16B16A16_SNORM; + + //TODO + //--------------------RGB565-------------------- + case T3SurfaceFormat.eSurface_RGB565: + return DXGI_FORMAT.B5G6R5_UNORM; + + //TODO + //--------------------ARGB1555-------------------- + case T3SurfaceFormat.eSurface_ARGB1555: + return DXGI_FORMAT.B5G5R5A1_UNORM; + + //TODO + //--------------------ARGB4-------------------- + case T3SurfaceFormat.eSurface_ARGB4: + return DXGI_FORMAT.B4G4R4A4_UNORM; + + //TODO + //--------------------ARGB2101010-------------------- + case T3SurfaceFormat.eSurface_ARGB2101010: + return DXGI_FORMAT.R10G10B10A2_UNORM; + + //--------------------R16-------------------- + case T3SurfaceFormat.eSurface_R16: + return DXGI_FORMAT.R16_UNORM; + + //--------------------RG16-------------------- + case T3SurfaceFormat.eSurface_RG16: + return DXGI_FORMAT.R16G16_UNORM; + + //--------------------RGBA16-------------------- + case T3SurfaceFormat.eSurface_RGBA16: + return DXGI_FORMAT.R16G16B16A16_UNORM; + + //--------------------RG8-------------------- + case T3SurfaceFormat.eSurface_RG8: + return DXGI_FORMAT.R8G8_UNORM; + + //--------------------RGBA8-------------------- + case T3SurfaceFormat.eSurface_RGBA8: + if (gamma == T3SurfaceGamma.eSurfaceGamma_sRGB) + return DXGI_FORMAT.R8G8B8A8_UNORM_SRGB; + else + return DXGI_FORMAT.R8G8B8A8_UNORM; + + //TODO + //--------------------R32-------------------- + case T3SurfaceFormat.eSurface_R32: + return DXGI_FORMAT.R32_FLOAT; + + //TODO + //--------------------RG32-------------------- + case T3SurfaceFormat.eSurface_RG32: + return DXGI_FORMAT.R32G32_FLOAT; + + //TODO + //--------------------RGBA32-------------------- + case T3SurfaceFormat.eSurface_RGBA32: + return DXGI_FORMAT.R32G32B32A32_FLOAT; + + //TODO + //--------------------R8-------------------- + case T3SurfaceFormat.eSurface_R8: + return DXGI_FORMAT.R8_UNORM; + + //TODO + //--------------------RGBA8S-------------------- + case T3SurfaceFormat.eSurface_RGBA8S: + return DXGI_FORMAT.R8G8B8A8_SNORM; + + //--------------------A8-------------------- + case T3SurfaceFormat.eSurface_A8: + return DXGI_FORMAT.A8_UNORM; + + //--------------------L8-------------------- + case T3SurfaceFormat.eSurface_L8: + return DXGI_FORMAT.R8_UNORM; + + //--------------------AL8-------------------- + case T3SurfaceFormat.eSurface_AL8: + return DXGI_FORMAT.R8G8_UNORM; + + //--------------------R16-------------------- + case T3SurfaceFormat.eSurface_L16: + return DXGI_FORMAT.R16_UNORM; + + //--------------------RG16S-------------------- + case T3SurfaceFormat.eSurface_RG16S: + return DXGI_FORMAT.R16G16_SNORM; + + //--------------------RGBA16S-------------------- + case T3SurfaceFormat.eSurface_RGBA16S: + return DXGI_FORMAT.R16G16B16A16_SNORM; + + //--------------------RGBA16UI-------------------- + case T3SurfaceFormat.eSurface_R16UI: + return DXGI_FORMAT.R16G16B16A16_UINT; + + //--------------------RG16F-------------------- + case T3SurfaceFormat.eSurface_R16F: + return DXGI_FORMAT.R16_FLOAT; + + //--------------------RGBA16F-------------------- + case T3SurfaceFormat.eSurface_RGBA16F: + return DXGI_FORMAT.R16G16B16A16_FLOAT; + + //--------------------R32F-------------------- + case T3SurfaceFormat.eSurface_R32F: + return DXGI_FORMAT.R32_FLOAT; + + //--------------------RG32F-------------------- + case T3SurfaceFormat.eSurface_RG32F: + return DXGI_FORMAT.R32G32_FLOAT; + + //--------------------RGBA32F-------------------- + case T3SurfaceFormat.eSurface_RGBA32F: + return DXGI_FORMAT.R32G32B32A32_FLOAT; + + //--------------------RGBA1010102F-------------------- + case T3SurfaceFormat.eSurface_RGBA1010102F: + return DXGI_FORMAT.R10G10B10A2_UNORM; + + //--------------------RGB111110F-------------------- + case T3SurfaceFormat.eSurface_RGB111110F: + return DXGI_FORMAT.R11G11B10_FLOAT; + + //--------------------RGB9E5F-------------------- + case T3SurfaceFormat.eSurface_RGB9E5F: + return DXGI_FORMAT.R9G9B9E5_SHAREDEXP; + + //--------------------DepthPCF16-------------------- + case T3SurfaceFormat.eSurface_DepthPCF16: + return DXGI_FORMAT.D16_UNORM; + + //--------------------DepthPCF24-------------------- + case T3SurfaceFormat.eSurface_DepthPCF24: + return DXGI_FORMAT.D24_UNORM_S8_UINT; + + //--------------------Depth16-------------------- + case T3SurfaceFormat.eSurface_Depth16: + return DXGI_FORMAT.D16_UNORM; + + //--------------------Depth24-------------------- + case T3SurfaceFormat.eSurface_Depth24: + return DXGI_FORMAT.D24_UNORM_S8_UINT; + + //--------------------DepthStencil32-------------------- + case T3SurfaceFormat.eSurface_DepthStencil32: + return DXGI_FORMAT.D32_FLOAT_S8X24_UINT; + + //--------------------Depth32F-------------------- + case T3SurfaceFormat.eSurface_Depth32F: + return DXGI_FORMAT.D32_FLOAT; + + //--------------------Depth32F_Stencil8-------------------- + case T3SurfaceFormat.eSurface_Depth32F_Stencil8: + return DXGI_FORMAT.D32_FLOAT_S8X24_UINT; + + //--------------------Depth24F_Stencil8-------------------- + case T3SurfaceFormat.eSurface_Depth24F_Stencil8: + return DXGI_FORMAT.D24_UNORM_S8_UINT; + //--------------------DXT1-------------------- case T3SurfaceFormat.eSurface_BC1: - if(gamma == T3SurfaceGamma.eSurfaceGamma_sRGB) + if (gamma == T3SurfaceGamma.eSurfaceGamma_sRGB) return DXGI_FORMAT.BC1_UNORM_SRGB; else return DXGI_FORMAT.BC1_UNORM; @@ -451,6 +730,10 @@ public static DXGI_FORMAT GetSurfaceFormatAsDXGI(T3SurfaceFormat format, T3Surfa return DXGI_FORMAT.BC7_UNORM_SRGB; else return DXGI_FORMAT.BC7_UNORM; + + //--------------------UNKNOWN-------------------- + case T3SurfaceFormat.eSurface_Unknown: + return DXGI_FORMAT.UNKNOWN; } } } diff --git a/DDS_D3DTX_Converter_GUI/DDS_D3DTX_Converter/ImageProperties.cs b/DDS_D3DTX_Converter_GUI/DDS_D3DTX_Converter/ImageProperties.cs index 43e9d93..f9f1abf 100644 --- a/DDS_D3DTX_Converter_GUI/DDS_D3DTX_Converter/ImageProperties.cs +++ b/DDS_D3DTX_Converter_GUI/DDS_D3DTX_Converter/ImageProperties.cs @@ -46,7 +46,7 @@ public static ImageProperties GetImagePropertiesFromD3DTX(string filePath) MipMapCount = master.GetMipMapCount().ToString() }; } - + /// /// Gets the properties of the selected .dds file /// @@ -57,19 +57,21 @@ public static ImageProperties GetDdsProperties(string ddsFilePath) byte[] headerBytes = ByteFunctions.AllocateBytes(124, sourceFileData, 4); + //TODO: CHECK ALPHA IF IT'S CORRECT + var header = DDS.GetHeaderFromBytes(headerBytes); byte[] bytes = BitConverter.GetBytes(header.ddspf.dwFourCC); string result = System.Text.Encoding.UTF8.GetString(bytes); result.Reverse(); - + string hasAlpha = "False"; - if (header.ddspf.dwABitMask > 0) + if (header.ddspf.dwABitMask > 0) { hasAlpha = "True"; } - + return new ImageProperties { Name = Path.GetFileNameWithoutExtension(ddsFilePath), @@ -82,7 +84,7 @@ public static ImageProperties GetDdsProperties(string ddsFilePath) MipMapCount = header.dwMipMapCount.ToString() }; } - + /// /// Get the needed image properties from the selected file, excluding .dds and .d3dtx. /// diff --git a/DDS_D3DTX_Converter_GUI/DDS_D3DTX_Converter/TelltaleD3DTX/D3DTX_V4.cs b/DDS_D3DTX_Converter_GUI/DDS_D3DTX_Converter/TelltaleD3DTX/D3DTX_V4.cs index bafca31..920e3a5 100644 --- a/DDS_D3DTX_Converter_GUI/DDS_D3DTX_Converter/TelltaleD3DTX/D3DTX_V4.cs +++ b/DDS_D3DTX_Converter_GUI/DDS_D3DTX_Converter/TelltaleD3DTX/D3DTX_V4.cs @@ -288,7 +288,7 @@ public void ModifyD3DTX(DDS_Master dds) { mWidth = dds.header.dwWidth; mHeight = dds.header.dwHeight; - mSurfaceFormat = DDS.Get_T3Format_FromFourCC(dds.header.ddspf.dwFourCC); + mSurfaceFormat = DDS.Get_T3Format_FromFourCC(dds.header.ddspf.dwFourCC, dds); mNumMipLevels = dds.header.dwMipMapCount; List ddsData = new List(dds.textureData); //this is correct diff --git a/DDS_D3DTX_Converter_GUI/DDS_D3DTX_Converter/TelltaleD3DTX/D3DTX_V5.cs b/DDS_D3DTX_Converter_GUI/DDS_D3DTX_Converter/TelltaleD3DTX/D3DTX_V5.cs index 077e612..a0f645a 100644 --- a/DDS_D3DTX_Converter_GUI/DDS_D3DTX_Converter/TelltaleD3DTX/D3DTX_V5.cs +++ b/DDS_D3DTX_Converter_GUI/DDS_D3DTX_Converter/TelltaleD3DTX/D3DTX_V5.cs @@ -322,7 +322,7 @@ public void ModifyD3DTX(DDS_Master dds) { mWidth = dds.header.dwWidth; mHeight = dds.header.dwHeight; - mSurfaceFormat = DDS.Get_T3Format_FromFourCC(dds.header.ddspf.dwFourCC); + mSurfaceFormat = DDS.Get_T3Format_FromFourCC(dds.header.ddspf.dwFourCC, dds); //mDepth = dds.header.dwDepth; } @@ -389,7 +389,7 @@ public void WriteBinaryData(BinaryWriter writer) } } - public uint GetHeaderByteSize() + public uint GetHeaderByteSize() { uint totalSize = 0; diff --git a/DDS_D3DTX_Converter_GUI/DDS_D3DTX_Converter/TelltaleD3DTX/D3DTX_V6.cs b/DDS_D3DTX_Converter_GUI/DDS_D3DTX_Converter/TelltaleD3DTX/D3DTX_V6.cs index aa11a9f..1d23f45 100644 --- a/DDS_D3DTX_Converter_GUI/DDS_D3DTX_Converter/TelltaleD3DTX/D3DTX_V6.cs +++ b/DDS_D3DTX_Converter_GUI/DDS_D3DTX_Converter/TelltaleD3DTX/D3DTX_V6.cs @@ -296,7 +296,7 @@ public void ModifyD3DTX(DDS_Master dds) { mWidth = dds.header.dwWidth; mHeight = dds.header.dwHeight; - mSurfaceFormat = DDS.Get_T3Format_FromFourCC(dds.header.ddspf.dwFourCC); + mSurfaceFormat = DDS.Get_T3Format_FromFourCC(dds.header.ddspf.dwFourCC, dds); //mDepth = dds.header.dwDepth; } diff --git a/DDS_D3DTX_Converter_GUI/DDS_D3DTX_Converter/TelltaleD3DTX/D3DTX_V7.cs b/DDS_D3DTX_Converter_GUI/DDS_D3DTX_Converter/TelltaleD3DTX/D3DTX_V7.cs index ee6b34a..7617e38 100644 --- a/DDS_D3DTX_Converter_GUI/DDS_D3DTX_Converter/TelltaleD3DTX/D3DTX_V7.cs +++ b/DDS_D3DTX_Converter_GUI/DDS_D3DTX_Converter/TelltaleD3DTX/D3DTX_V7.cs @@ -355,7 +355,7 @@ public void ModifyD3DTX(DDS_Master dds) { mWidth = dds.header.dwWidth; mHeight = dds.header.dwHeight; - mSurfaceFormat = DDS.Get_T3Format_FromFourCC(dds.header.ddspf.dwFourCC); + mSurfaceFormat = DDS.Get_T3Format_FromFourCC(dds.header.ddspf.dwFourCC, dds); //mDepth = dds.header.dwDepth; } diff --git a/DDS_D3DTX_Converter_GUI/DDS_D3DTX_Converter/TelltaleD3DTX/D3DTX_V8.cs b/DDS_D3DTX_Converter_GUI/DDS_D3DTX_Converter/TelltaleD3DTX/D3DTX_V8.cs index 04a9396..ee8d1c1 100644 --- a/DDS_D3DTX_Converter_GUI/DDS_D3DTX_Converter/TelltaleD3DTX/D3DTX_V8.cs +++ b/DDS_D3DTX_Converter_GUI/DDS_D3DTX_Converter/TelltaleD3DTX/D3DTX_V8.cs @@ -372,7 +372,7 @@ public void ModifyD3DTX(DDS_Master dds) { mWidth = dds.header.dwWidth; mHeight = dds.header.dwHeight; - mSurfaceFormat = DDS.Get_T3Format_FromFourCC(dds.header.ddspf.dwFourCC); + mSurfaceFormat = DDS.Get_T3Format_FromFourCC(dds.header.ddspf.dwFourCC, dds); mDepth = dds.header.dwDepth; } diff --git a/DDS_D3DTX_Converter_GUI/DDS_D3DTX_Converter/TelltaleD3DTX/D3DTX_V9.cs b/DDS_D3DTX_Converter_GUI/DDS_D3DTX_Converter/TelltaleD3DTX/D3DTX_V9.cs index b83a9d9..2d3b2a4 100644 --- a/DDS_D3DTX_Converter_GUI/DDS_D3DTX_Converter/TelltaleD3DTX/D3DTX_V9.cs +++ b/DDS_D3DTX_Converter_GUI/DDS_D3DTX_Converter/TelltaleD3DTX/D3DTX_V9.cs @@ -339,7 +339,7 @@ public void ModifyD3DTX(DDS_Master dds, DDS_DirectXTexNet_ImageSection[] section { mWidth = dds.header.dwWidth; //THIS IS CORRECT mHeight = dds.header.dwHeight; //THIS IS CORRECT - mSurfaceFormat = DDS.Get_T3Format_FromFourCC(dds.header.ddspf.dwFourCC); //THIS IS CORRECT + mSurfaceFormat = DDS.Get_T3Format_FromFourCC(dds.header.ddspf.dwFourCC, dds); //THIS IS CORRECT mDepth = dds.header.dwDepth; //THIS IS CORRECT mNumMipLevels = dds.header.dwMipMapCount; //THIS IS CORRECT