mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-26 06:20:24 +00:00
Fix bntx texture format issues with R8G8_SNORM
This commit is contained in:
parent
6fbc1f81cf
commit
402c2cee5e
18 changed files with 22 additions and 18 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -172,7 +172,9 @@ namespace FirstPlugin
|
|||
foreach (var file in Files)
|
||||
file.FileData = null;
|
||||
|
||||
Files.Clear();
|
||||
Nodes.Clear();
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
IEnumerable<TreeNode> Collect(TreeNodeCollection nodes)
|
||||
|
|
|
@ -429,7 +429,7 @@ namespace FirstPlugin
|
|||
TEX_FORMAT.R8G8B8A8_UNORM_SRGB,
|
||||
TEX_FORMAT.R8G8_SNORM,
|
||||
TEX_FORMAT.B4G4R4A4_UNORM,
|
||||
TEX_FORMAT.ETC1,
|
||||
TEX_FORMAT.ETC1_UNORM,
|
||||
TEX_FORMAT.ETC1_A4,
|
||||
TEX_FORMAT.HIL08,
|
||||
TEX_FORMAT.L4,
|
||||
|
@ -636,7 +636,7 @@ namespace FirstPlugin
|
|||
Format = TEX_FORMAT.B5G6R5_UNORM;
|
||||
break;
|
||||
case SurfaceFormat.ETC1:
|
||||
Format = TEX_FORMAT.ETC1;
|
||||
Format = TEX_FORMAT.ETC1_UNORM;
|
||||
break;
|
||||
case SurfaceFormat.ETC1_A4:
|
||||
Format = TEX_FORMAT.ETC1_A4;
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace FirstPlugin
|
|||
{
|
||||
return new TEX_FORMAT[]
|
||||
{
|
||||
TEX_FORMAT.ETC1,
|
||||
TEX_FORMAT.ETC1_UNORM,
|
||||
TEX_FORMAT.ETC1_A4,
|
||||
|
||||
TEX_FORMAT.BC1_UNORM,
|
||||
|
@ -305,7 +305,7 @@ namespace FirstPlugin
|
|||
case BCLIMFormat.HILO8:
|
||||
return TEX_FORMAT.HIL08;
|
||||
case BCLIMFormat.ETC1:
|
||||
return TEX_FORMAT.ETC1;
|
||||
return TEX_FORMAT.ETC1_UNORM;
|
||||
case BCLIMFormat.ETC1A4:
|
||||
return TEX_FORMAT.ETC1_A4;
|
||||
case BCLIMFormat.RGB565:
|
||||
|
|
|
@ -914,9 +914,12 @@ namespace FirstPlugin
|
|||
case TEX_FORMAT.R8G8B8A8_UNORM_SRGB: return SurfaceFormat.R8_G8_B8_A8_SRGB;
|
||||
case TEX_FORMAT.R8G8B8A8_UNORM: return SurfaceFormat.R8_G8_B8_A8_UNORM;
|
||||
case TEX_FORMAT.R8_UNORM: return SurfaceFormat.R8_UNORM;
|
||||
case TEX_FORMAT.R8G8_UNORM: return SurfaceFormat.R8_G8_UNORM;
|
||||
case TEX_FORMAT.R8G8_UNORM: return SurfaceFormat.R8_G8_UNORM;
|
||||
case TEX_FORMAT.R8G8_SNORM: return SurfaceFormat.R8_G8_SNORM;
|
||||
case TEX_FORMAT.R32G8X24_FLOAT: return SurfaceFormat.R32_G8_X24_FLOAT;
|
||||
case TEX_FORMAT.B8G8R8X8_UNORM: return SurfaceFormat.B8_G8_R8_A8_UNORM; //Todo
|
||||
case TEX_FORMAT.ETC1_UNORM: return SurfaceFormat.ETC1_UNORM;
|
||||
case TEX_FORMAT.ETC1_SRGB: return SurfaceFormat.ETC1_SRGB;
|
||||
case TEX_FORMAT.ASTC_10x10_SRGB: return SurfaceFormat.ASTC_10x10_SRGB;
|
||||
case TEX_FORMAT.ASTC_10x10_UNORM: return SurfaceFormat.ASTC_10x10_UNORM;
|
||||
case TEX_FORMAT.ASTC_10x5_SRGB: return SurfaceFormat.ASTC_10x5_SRGB;
|
||||
|
@ -984,6 +987,9 @@ namespace FirstPlugin
|
|||
case SurfaceFormat.R8_G8_B8_A8_UNORM: return TEX_FORMAT.R8G8B8A8_UNORM;
|
||||
case SurfaceFormat.R8_UNORM: return TEX_FORMAT.R8_UNORM;
|
||||
case SurfaceFormat.R8_G8_UNORM: return TEX_FORMAT.R8G8_UNORM;
|
||||
case SurfaceFormat.R8_G8_SNORM: return TEX_FORMAT.R8G8_SNORM;
|
||||
case SurfaceFormat.ETC1_UNORM: return TEX_FORMAT.ETC1_UNORM;
|
||||
case SurfaceFormat.ETC1_SRGB: return TEX_FORMAT.ETC1_SRGB;
|
||||
case SurfaceFormat.R32_G8_X24_FLOAT: return TEX_FORMAT.R32G8X24_FLOAT;
|
||||
case SurfaceFormat.ASTC_10x10_SRGB: return TEX_FORMAT.ASTC_10x10_SRGB;
|
||||
case SurfaceFormat.ASTC_10x10_UNORM: return TEX_FORMAT.ASTC_10x10_UNORM;
|
||||
|
|
|
@ -54,7 +54,7 @@ namespace FirstPlugin
|
|||
TEX_FORMAT.A8_UNORM,
|
||||
TEX_FORMAT.LA4,
|
||||
TEX_FORMAT.A4,
|
||||
TEX_FORMAT.ETC1,
|
||||
TEX_FORMAT.ETC1_UNORM,
|
||||
TEX_FORMAT.ETC1_A4,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -161,7 +161,6 @@
|
|||
</Reference>
|
||||
<Reference Include="Syroot.NintenTools.NSW.Bntx">
|
||||
<HintPath>..\Toolbox\Lib\Syroot.NintenTools.NSW.Bntx.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Buffers">
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -293,7 +293,8 @@ namespace Switch_Toolbox.Library
|
|||
{ TEX_FORMAT.ASTC_12x10_SRGB, new FormatInfo(16, 12, 10, 1, TargetBuffer.Color) },
|
||||
{ TEX_FORMAT.ASTC_12x12_UNORM, new FormatInfo(16, 12, 12, 1, TargetBuffer.Color) },
|
||||
{ TEX_FORMAT.ASTC_12x12_SRGB, new FormatInfo(16, 12, 12, 1, TargetBuffer.Color) },
|
||||
{ TEX_FORMAT.ETC1, new FormatInfo(4, 1, 1, 1, TargetBuffer.Color) },
|
||||
{ TEX_FORMAT.ETC1_UNORM, new FormatInfo(4, 1, 1, 1, TargetBuffer.Color) },
|
||||
{ TEX_FORMAT.ETC1_SRGB, new FormatInfo(4, 1, 1, 1, TargetBuffer.Color) },
|
||||
{ TEX_FORMAT.ETC1_A4, new FormatInfo(8, 1, 1, 1, TargetBuffer.Color) },
|
||||
{ TEX_FORMAT.HIL08, new FormatInfo(16, 1, 1, 1, TargetBuffer.Color) },
|
||||
{ TEX_FORMAT.L4, new FormatInfo(4, 1, 1, 1, TargetBuffer.Color) },
|
||||
|
@ -390,7 +391,7 @@ namespace Switch_Toolbox.Library
|
|||
(int)width, (int)height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
|
||||
case TEX_FORMAT.BC5_SNORM:
|
||||
return DDSCompressor.DecompressBC5(data, (int)width, (int)height, true);
|
||||
case TEX_FORMAT.ETC1:
|
||||
case TEX_FORMAT.ETC1_UNORM:
|
||||
return BitmapExtension.GetBitmap(ETC1.ETC1Decompress(data, (int)width, (int)height, false),
|
||||
(int)width, (int)height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
|
||||
case TEX_FORMAT.ETC1_A4:
|
||||
|
|
|
@ -158,7 +158,8 @@ namespace Switch_Toolbox.Library
|
|||
ASTC_12x12_UNORM = 186,
|
||||
ASTC_12x12_SRGB = 187,
|
||||
|
||||
ETC1 = 230,
|
||||
ETC1_SRGB = 229,
|
||||
ETC1_UNORM = 230,
|
||||
ETC1_A4 = 231,
|
||||
L4 = 232,
|
||||
LA4 = 233,
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace Switch_Toolbox.Library
|
|||
case PICASurfaceFormat.LA4: return TEX_FORMAT.LA4;
|
||||
case PICASurfaceFormat.L4: return TEX_FORMAT.L4;
|
||||
case PICASurfaceFormat.A4: return TEX_FORMAT.A4;
|
||||
case PICASurfaceFormat.ETC1: return TEX_FORMAT.ETC1;
|
||||
case PICASurfaceFormat.ETC1: return TEX_FORMAT.ETC1_UNORM;
|
||||
case PICASurfaceFormat.ETC1A4: return TEX_FORMAT.ETC1_A4;
|
||||
default:
|
||||
throw new NotImplementedException("Unsupported format! " + format);
|
||||
|
@ -64,7 +64,7 @@ namespace Switch_Toolbox.Library
|
|||
case TEX_FORMAT.A8_UNORM: return PICASurfaceFormat.A8;
|
||||
case TEX_FORMAT.LA4: return PICASurfaceFormat.LA4;
|
||||
case TEX_FORMAT.A4: return PICASurfaceFormat.A4;
|
||||
case TEX_FORMAT.ETC1: return PICASurfaceFormat.ETC1;
|
||||
case TEX_FORMAT.ETC1_UNORM: return PICASurfaceFormat.ETC1;
|
||||
case TEX_FORMAT.ETC1_A4: return PICASurfaceFormat.ETC1A4;
|
||||
default:
|
||||
throw new NotImplementedException("Unsupported format! " + GenericFormat);
|
||||
|
@ -87,7 +87,7 @@ namespace Switch_Toolbox.Library
|
|||
|
||||
public static byte[] DecodeBlock(byte[] Input, int Width, int Height, TEX_FORMAT Format)
|
||||
{
|
||||
if (Format == TEX_FORMAT.ETC1 || Format == TEX_FORMAT.ETC1_A4)
|
||||
if (Format == TEX_FORMAT.ETC1_UNORM || Format == TEX_FORMAT.ETC1_A4)
|
||||
return ETC1.ETC1Decompress(Input, Width, Height, Format == TEX_FORMAT.ETC1_A4);
|
||||
|
||||
byte[] Output = new byte[Width * Height * 4];
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -2136,11 +2136,6 @@
|
|||
The raw bytes of texture data stored for each mip map
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Syroot.NintenTools.NSW.Bntx.Texture.Data">
|
||||
<summary>
|
||||
Gets or sets the raw texture data bytes.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Syroot.NintenTools.NSW.Bntx.Texture.Flags">
|
||||
<summary>
|
||||
Gets or sets info flags
|
||||
|
|
Loading…
Reference in a new issue