diff --git a/.vs/Switch_Toolbox/v15/.suo b/.vs/Switch_Toolbox/v15/.suo index a8f28d1f..4cbc08b1 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 c5f478c1..9027ee5d 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-shm b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-shm index 05fdd8a0..f6def68b 100644 Binary files a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-shm and b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-shm differ diff --git a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal index e4d9c78f..e474c153 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/BFRES/Bfres Structs/SubFiles/FTEX.cs b/Switch_FileFormatsMain/FileFormats/BFRES/Bfres Structs/SubFiles/FTEX.cs index 29a3f2fd..0b946ae3 100644 --- a/Switch_FileFormatsMain/FileFormats/BFRES/Bfres Structs/SubFiles/FTEX.cs +++ b/Switch_FileFormatsMain/FileFormats/BFRES/Bfres Structs/SubFiles/FTEX.cs @@ -193,7 +193,7 @@ namespace Bfres.Structs if (texture != null && texture.MipCount == 1) ReplaceTexture(FileName, Format, texture.MipCount); else - ReplaceTexture(FileName, Format); + ReplaceTexture(FileName, Format, 0, null, false, false, false, texture.SwizzlePattern); } public void ReplaceTexture(string FileName, TEX_FORMAT DefaultFormat = TEX_FORMAT.UNKNOWN, uint MipMapCount = 0, TEX_FORMAT[] SupportedFormats = null, diff --git a/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache b/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache index e7b95548..44c0ecff 100644 Binary files a/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache and b/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache differ diff --git a/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csprojAssemblyReference.cache b/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csprojAssemblyReference.cache index c6690d1a..cc55940f 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/Swizzling/NewSwizzleCodeBackup.cs b/Switch_Toolbox_Library/Swizzling/NewSwizzleCodeBackup.cs index b64dba93..33b8ba0b 100644 --- a/Switch_Toolbox_Library/Swizzling/NewSwizzleCodeBackup.cs +++ b/Switch_Toolbox_Library/Swizzling/NewSwizzleCodeBackup.cs @@ -621,21 +621,22 @@ namespace Switch_Toolbox.Library blkHeight = 1; } - byte[] data = new byte[tex.data.Length]; - Array.Copy(tex.data, 0, data, 0, tex.data.Length); - var surfInfo = getSurfaceInfo((GX2SurfaceFormat)tex.format, tex.width, tex.height, tex.depth, (uint)tex.dim, (uint)tex.tileMode, (uint)tex.aa, 0); uint bpp = DIV_ROUND_UP(surfInfo.bpp, 8); if (tex.numArray == 0) tex.numArray = 1; + byte[] data = new byte[tex.data.Length]; + byte[] mipdata = new byte[tex.mipData.Length]; + uint mipCount = tex.numMips; if (tex.mipData == null || tex.mipData.Length <= 0) mipCount = 1; int dataOffset = 0; int mipDataOffset = 0; + int mipSpliceSize = 0; for (int arrayLevel = 0; arrayLevel < tex.depth; arrayLevel++) { @@ -658,17 +659,27 @@ namespace Switch_Toolbox.Library mipOffset = (tex.mipOffset[mipLevel - 1]); if (mipLevel == 1) + { mipOffset -= (uint)surfInfo.surfSize; + mipOffset += (uint)mipDataOffset; + mipSpliceSize += (int)mipOffset; + } + Console.WriteLine("mipOffset " + mipOffset); if (GetLevel) { surfInfo = getSurfaceInfo((GX2SurfaceFormat)tex.format, tex.width, tex.height, tex.depth, (uint)tex.dim, (uint)tex.tileMode, (uint)tex.aa, mipLevel); - data = new byte[surfInfo.sliceSize]; - Array.Copy(tex.mipData, (uint)mipDataOffset + mipOffset, data, 0, surfInfo.sliceSize); + + Array.Copy(tex.mipData, 0, mipdata, 0, tex.mipData.Length); + Array.Copy(tex.mipData, (int)mipOffset, mipdata, 0, (int)surfInfo.sliceSize); + data = mipdata; } } else if (GetLevel) + { + Array.Copy(tex.data, 0, data, 0, tex.data.Length); Array.Copy(tex.data, (uint)dataOffset, data, 0, size); + } if (GetLevel) { @@ -682,7 +693,7 @@ namespace Switch_Toolbox.Library } dataOffset += (int)surfInfo.sliceSize; - mipDataOffset += (int)surfInfo.sliceSize; + mipDataOffset += mipSpliceSize; } return null; }