diff --git a/.vs/Switch_Toolbox/v15/.suo b/.vs/Switch_Toolbox/v15/.suo index 70ae5749..137782d3 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 eae0fb32..445df248 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 1c9557eb..a052d547 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 f44f956d..3cbcea49 100644 --- a/Switch_FileFormatsMain/FileFormats/BFRES/Bfres Structs/SubFiles/FTEX.cs +++ b/Switch_FileFormatsMain/FileFormats/BFRES/Bfres Structs/SubFiles/FTEX.cs @@ -392,7 +392,7 @@ namespace Bfres.Structs if (!IsEdited && Tex1 != null && Tex1.Contains(".Tex1")) { string Tex2 = Tex1.Replace(".Tex1", ".Tex2"); - Console.WriteLine(Tex2); + Console.WriteLine(Tex2 + " " + System.IO.File.Exists(Tex2)); if (System.IO.File.Exists(Tex2)) { @@ -407,8 +407,12 @@ namespace Bfres.Structs { resFile2 = new ResFile(Tex2); } + + Console.WriteLine((resFile2.Textures.ContainsKey(texture.Name))); + if (resFile2.Textures.ContainsKey(texture.Name)) { + MipCount = texture.MipCount; texture.MipData = resFile2.Textures[texture.Name].MipData; texture.MipOffsets = resFile2.Textures[texture.Name].MipOffsets; surf.mipData = resFile2.Textures[texture.Name].MipData; diff --git a/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache b/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache index 8686753f..67cc0c2a 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/FirstPlugin.Plg.dll b/Switch_FileFormatsMain/obj/Release/FirstPlugin.Plg.dll index 79806152..5aba5d76 100644 Binary files a/Switch_FileFormatsMain/obj/Release/FirstPlugin.Plg.dll and b/Switch_FileFormatsMain/obj/Release/FirstPlugin.Plg.dll differ diff --git a/Switch_FileFormatsMain/obj/Release/FirstPlugin.Plg.pdb b/Switch_FileFormatsMain/obj/Release/FirstPlugin.Plg.pdb index 51344e40..8fb8463b 100644 Binary files a/Switch_FileFormatsMain/obj/Release/FirstPlugin.Plg.pdb and b/Switch_FileFormatsMain/obj/Release/FirstPlugin.Plg.pdb differ diff --git a/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csprojAssemblyReference.cache b/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csprojAssemblyReference.cache index bc8a1780..0c692760 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/GTX.cs b/Switch_Toolbox_Library/Swizzling/GTX.cs index bc574b3c..c043f015 100644 --- a/Switch_Toolbox_Library/Swizzling/GTX.cs +++ b/Switch_Toolbox_Library/Swizzling/GTX.cs @@ -432,6 +432,9 @@ namespace Switch_Toolbox.Library public static List> Decode(GX2Surface tex, string DebugTextureName = "") { + if (tex.data.Length <= 0) + throw new Exception("Invalid GX2 surface data. Make sure to not open Tex2 files if this is one. Those will load automatically next to Tex1!"); + Console.WriteLine("DECODING TEX " + DebugTextureName); var surfdEBUG = getSurfaceInfo((GX2SurfaceFormat)tex.format, tex.width, tex.height, tex.depth, (uint)tex.dim, (uint)tex.tileMode, (uint)tex.aa, 0);