diff --git a/.vs/Switch_Toolbox/v15/.suo b/.vs/Switch_Toolbox/v15/.suo index 671aafc4..e81f881b 100644 Binary files a/.vs/Switch_Toolbox/v15/.suo and b/.vs/Switch_Toolbox/v15/.suo differ diff --git a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide index 0f99323a..81c72a14 100644 Binary files a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide and b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide differ diff --git a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal index d6698ef6..987e8826 100644 Binary files a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal and b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal differ diff --git a/Switch_FileFormatsMain/FileFormats/Archives/SDF.cs b/Switch_FileFormatsMain/FileFormats/Archives/SDF.cs index d48c3edd..fac1db2c 100644 --- a/Switch_FileFormatsMain/FileFormats/Archives/SDF.cs +++ b/Switch_FileFormatsMain/FileFormats/Archives/SDF.cs @@ -196,6 +196,7 @@ namespace FirstPlugin public ulong DdsType; public bool UseDDS; public bool IsCompressed = false; + public bool IsSwizzled = false; public override byte[] FileData { @@ -209,11 +210,12 @@ namespace FirstPlugin public override IFileFormat OpenFile() { + byte[] Data = FileData; var FileFormat = STFileLoader.OpenFileFormat( - IOExtensions.RemoveIllegaleFolderNameCharacters(FileName), FileData, true); + IOExtensions.RemoveIllegaleFolderNameCharacters(FileName), Data, true); if (FileFormat is DDS) - ((DDS)FileFormat).SwitchSwizzle = true; + ((DDS)FileFormat).SwitchSwizzle = IsSwizzled; return FileFormat; } @@ -245,16 +247,27 @@ namespace FirstPlugin if (UseDDS) { + // Data.Add(SDFParent.block2Array[DdsType].Data.Take((int)SDFParent.block2Array[DdsType].UsedBytes).ToArray()); bool IsDX10 = false; using (var filereader = new FileReader(SDFParent.block2Array[DdsType].Data)) { filereader.Position = 84; IsDX10 = filereader.ReadString(4) == "DX10"; - if (IsDX10) + if (IsDX10) + { + if (SDFParent.block2Array[DdsType].UsedBytes > 0x94) + IsSwizzled = true; + Data.Add(SDFParent.block2Array[DdsType].Data.Take((int)0x94).ToArray()); + } else + { + if (SDFParent.block2Array[DdsType].UsedBytes > 0x80) + IsSwizzled = true; + Data.Add(SDFParent.block2Array[DdsType].Data.Take((int)0x80).ToArray()); + } } } diff --git a/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csprojAssemblyReference.cache b/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csprojAssemblyReference.cache index 34202499..b80c57f9 100644 Binary files a/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csprojAssemblyReference.cache and b/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csprojAssemblyReference.cache differ diff --git a/Switch_Toolbox_Library/FileFormats/DDS.cs b/Switch_Toolbox_Library/FileFormats/DDS.cs index 44510922..ee7894af 100644 --- a/Switch_Toolbox_Library/FileFormats/DDS.cs +++ b/Switch_Toolbox_Library/FileFormats/DDS.cs @@ -776,7 +776,7 @@ namespace Switch_Toolbox.Library public override byte[] GetImageData(int ArrayLevel = 0, int MipLevel = 0) { if (IsAtscFormat(Format)) - SwitchSwizzle = true; + SwitchSwizzle = false; if (SwitchSwizzle) return TegraX1Swizzle.GetImageData(this, bdata, ArrayLevel, MipLevel);