diff --git a/.vs/Switch_Toolbox/v15/.suo b/.vs/Switch_Toolbox/v15/.suo index 6760c555..a6fbfd66 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 12fb0e58..91f66f91 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 47309e5a..64c75551 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/FMDL.cs b/Switch_FileFormatsMain/FileFormats/BFRES/Bfres Structs/SubFiles/FMDL.cs index 01d111bd..e8c2fa7a 100644 --- a/Switch_FileFormatsMain/FileFormats/BFRES/Bfres Structs/SubFiles/FMDL.cs +++ b/Switch_FileFormatsMain/FileFormats/BFRES/Bfres Structs/SubFiles/FMDL.cs @@ -683,7 +683,7 @@ namespace Bfres.Structs { FMAT fmat = new FMAT(); - if (resFileU != null) + if (IsWiiU) { fmat.MaterialU = new ResU.Material(); fmat.MaterialU.Import(settings.ExternalMaterialPath, resFileU); @@ -695,7 +695,6 @@ namespace Bfres.Structs fmat.Material.Import(settings.ExternalMaterialPath); fmat.ReadMaterial(fmat.Material); } - fmat.Text = mat.Text; //Setup placeholder textures @@ -761,7 +760,7 @@ namespace Bfres.Structs } } } - if (PluginRuntime.ftexContainers.Count > 0) + if (PluginRuntime.ftexContainers.Count > 0 && Parent != null) { foreach (var node in Parent.Parent.Nodes) { @@ -804,10 +803,10 @@ namespace Bfres.Structs List keyList = new List(materials.Keys); fmat.Text = Utils.RenameDuplicateString(keyList, fmat.Text); - if (resFileU != null) + if (IsWiiU) { fmat.MaterialU.Name = Text; - fmat.SetMaterial(fmat.MaterialU); + fmat.SetMaterial(fmat.MaterialU, resFileU); } else { @@ -842,7 +841,7 @@ namespace Bfres.Structs materials.Add(fmat.Text, fmat); Nodes["FmatFolder"].Nodes.Add(fmat); - if (resFileU != null) + if (IsWiiU) { fmat.MaterialU = new ResU.Material(); fmat.MaterialU.Name = "NewMaterial"; diff --git a/Switch_FileFormatsMain/FileFormats/BFRES/BfresWiiU.cs b/Switch_FileFormatsMain/FileFormats/BFRES/BfresWiiU.cs index dddab5ee..1aa64f6a 100644 --- a/Switch_FileFormatsMain/FileFormats/BFRES/BfresWiiU.cs +++ b/Switch_FileFormatsMain/FileFormats/BFRES/BfresWiiU.cs @@ -90,7 +90,7 @@ namespace FirstPlugin foreach (FMAT mat in fmdl.materials.Values) { - SetMaterial(mat, mat.MaterialU); + SetMaterial(mat, mat.MaterialU, fmdl.GetResFileU()); model.Materials.Add(mat.Text, mat.MaterialU); } return model; @@ -396,15 +396,7 @@ namespace FirstPlugin indx++; } } - public static void CreateNewMaterial(string Name) - { - FMAT mat = new FMAT(); - mat.Text = Name; - mat.MaterialU = new Material(); - - SetMaterial(mat, mat.MaterialU); - } - public static void SetMaterial(this FMAT m, Material mat) + public static void SetMaterial(this FMAT m, Material mat, ResFile ResFile) { mat.Name = m.Text; @@ -424,7 +416,7 @@ namespace FirstPlugin mat.ShaderParamData = ParamData; WriteRenderInfo(m, mat); - WriteTextureRefs(m, mat); + WriteTextureRefs(m, mat, ResFile); WriteShaderAssign(m.shaderassign, mat); } public static void ReadMaterial(this FMAT m, Material mat) @@ -715,7 +707,7 @@ namespace FirstPlugin m.renderinfo.Add(r); } } - public static void WriteTextureRefs(this FMAT m, Material mat) + public static void WriteTextureRefs(this FMAT m, Material mat, ResFile resFile) { mat.TextureRefs = new List(); mat.TextureRefs.Clear(); @@ -737,7 +729,7 @@ namespace FirstPlugin mat.Samplers.Add(textu.SamplerName, sampler); Texture texMapped = new Texture(); - m.GetResFileU().Textures.TryGetValue(textu.Name, out texMapped); + resFile.Textures.TryGetValue(textu.Name, out texMapped); texref.Texture = texMapped; mat.TextureRefs.Add(texref); diff --git a/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache b/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache index d151c061..75757d58 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 ebc155d6..3478313f 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 88b272b0..3609e569 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 e99270db..f9d2d322 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/IO/CompressionMenus.cs b/Switch_Toolbox_Library/IO/CompressionMenus.cs index d0293cd6..2c537e1b 100644 --- a/Switch_Toolbox_Library/IO/CompressionMenus.cs +++ b/Switch_Toolbox_Library/IO/CompressionMenus.cs @@ -76,6 +76,8 @@ namespace Switch_Toolbox.Library.IO public void CompressData(CompressionType CompressionType, byte[] data) { + MessageBox.Show(data.Length.ToString()); + switch (CompressionType) { case CompressionType.Yaz0: diff --git a/Switch_Toolbox_Library/IO/FileIO.cs b/Switch_Toolbox_Library/IO/FileIO.cs index 74f59fe8..f6326722 100644 --- a/Switch_Toolbox_Library/IO/FileIO.cs +++ b/Switch_Toolbox_Library/IO/FileIO.cs @@ -452,7 +452,11 @@ namespace Switch_Toolbox.Library.IO var stream = new MemoryStream(); using (var writer = new FileWriter(stream)) { + writer.Write(data.Length); + + + MessageBox.Show(data.Length.ToString()); byte[] buffer = LZ4.Frame.LZ4Frame.Compress(new MemoryStream(data), LZ4.Frame.LZ4MaxBlockSize.Auto, true, true, false, false, true); writer.Write(buffer, 0, buffer.Length); }