diff --git a/.vs/Switch_Toolbox/v15/.suo b/.vs/Switch_Toolbox/v15/.suo index 94badcec..38179ed0 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 f2646aa7..e14ab363 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 3a2a0e83..48bbf325 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 3579f743..ca25279e 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/AAMP/AAMP.cs b/Switch_FileFormatsMain/FileFormats/AAMP/AAMP.cs index de87d92a..af45cc51 100644 --- a/Switch_FileFormatsMain/FileFormats/AAMP/AAMP.cs +++ b/Switch_FileFormatsMain/FileFormats/AAMP/AAMP.cs @@ -54,8 +54,8 @@ namespace FirstPlugin } } - aampv1.AampFile aampFileV1; - aampv2.AampFile aampFileV2; + public aampv1.AampFile aampFileV1; + public aampv2.AampFile aampFileV2; AampV1Editor aampEditorV1; AampV2Editor aampEditorV2; diff --git a/Switch_FileFormatsMain/FileFormats/BFRES/Bfres Structs/SubFiles/FMDL.cs b/Switch_FileFormatsMain/FileFormats/BFRES/Bfres Structs/SubFiles/FMDL.cs index 3c6d26dd..3e4af93c 100644 --- a/Switch_FileFormatsMain/FileFormats/BFRES/Bfres Structs/SubFiles/FMDL.cs +++ b/Switch_FileFormatsMain/FileFormats/BFRES/Bfres Structs/SubFiles/FMDL.cs @@ -452,32 +452,39 @@ namespace Bfres.Structs else Model.Export(FileName, GetResFile()); break; + case ".obj": + OBJ.ExportModel(FileName, this, GetTextures()); + break; default: - - List textures = new List(); - foreach (var mat in materials) - { - foreach (var texref in mat.Value.TextureMaps) - { - foreach (var bntx in PluginRuntime.bntxContainers) - { - if (bntx.Textures.ContainsKey(texref.Name)) - textures.Add(bntx.Textures[texref.Name]); - } - foreach (var ftexCont in PluginRuntime.ftexContainers) - { - if (ftexCont.ResourceNodes.ContainsKey(texref.Name)) - textures.Add((FTEX)ftexCont.ResourceNodes[texref.Name]); - } - } - } - AssimpSaver assimp = new AssimpSaver(); - assimp.SaveFromModel(this, FileName, textures, Skeleton, Skeleton.Node_Array.ToList()); + assimp.SaveFromModel(this, FileName, GetTextures(), Skeleton, Skeleton.Node_Array.ToList()); break; } } + private List GetTextures() + { + List textures = new List(); + foreach (var mat in materials) + { + foreach (var texref in mat.Value.TextureMaps) + { + foreach (var bntx in PluginRuntime.bntxContainers) + { + if (bntx.Textures.ContainsKey(texref.Name)) + textures.Add(bntx.Textures[texref.Name]); + } + foreach (var ftexCont in PluginRuntime.ftexContainers) + { + if (ftexCont.ResourceNodes.ContainsKey(texref.Name)) + textures.Add((FTEX)ftexCont.ResourceNodes[texref.Name]); + } + } + } + + return textures; + } + public override void Replace(string FileName) { AddOjects(FileName, GetResFile(), GetResFileU()); } diff --git a/Switch_FileFormatsMain/FileFormats/BFRES/Bfres Structs/SubFiles/FSHU.cs b/Switch_FileFormatsMain/FileFormats/BFRES/Bfres Structs/SubFiles/FSHU.cs index 0c85f037..b0976b5f 100644 --- a/Switch_FileFormatsMain/FileFormats/BFRES/Bfres Structs/SubFiles/FSHU.cs +++ b/Switch_FileFormatsMain/FileFormats/BFRES/Bfres Structs/SubFiles/FSHU.cs @@ -127,6 +127,9 @@ namespace Bfres.Structs AnimDataOffset = keyGroup.AnimDataOffset, Keys = keyGroup.Keys, }); + + if (paramInfo.Text.Contains("Color") || paramInfo.Text.Contains("color")) + paramInfo.Type = AnimationType.Color; } } } diff --git a/Switch_FileFormatsMain/FileFormats/Collision/KCL.cs b/Switch_FileFormatsMain/FileFormats/Collision/KCL.cs index b4a052c1..e4cf937b 100644 --- a/Switch_FileFormatsMain/FileFormats/Collision/KCL.cs +++ b/Switch_FileFormatsMain/FileFormats/Collision/KCL.cs @@ -680,9 +680,9 @@ namespace FirstPlugin Min.X = Math.Min(Min.X, vertex.pos.X); Min.Y = Math.Min(Min.Y, vertex.pos.Y); Min.Z = Math.Min(Min.Z, vertex.pos.Z); - Max.X = Math.Max(Min.X, vertex.pos.X); - Max.Y = Math.Max(Min.Y, vertex.pos.Y); - Max.Z = Math.Max(Min.Z, vertex.pos.Z); + Max.X = Math.Max(Max.X, vertex.pos.X); + Max.Y = Math.Max(Max.Y, vertex.pos.Y); + Max.Z = Math.Max(Max.Z, vertex.pos.Z); } } diff --git a/Switch_FileFormatsMain/FileFormats/Shader/SHARC.cs b/Switch_FileFormatsMain/FileFormats/Shader/SHARC.cs index c5ba9e6b..c18cf900 100644 --- a/Switch_FileFormatsMain/FileFormats/Shader/SHARC.cs +++ b/Switch_FileFormatsMain/FileFormats/Shader/SHARC.cs @@ -207,7 +207,7 @@ namespace FirstPlugin variationSymbolData.Read(reader); variationSymbolDataFull.Read(reader); - UniformBlocks.Read(reader, header.Version); + UniformBlocks.Read(reader, header.Version, true); if (header.Version <= 12) { diff --git a/Switch_FileFormatsMain/FileFormats/Shader/SHARCFB.cs b/Switch_FileFormatsMain/FileFormats/Shader/SHARCFB.cs index 30b5534a..0d0ce7e5 100644 --- a/Switch_FileFormatsMain/FileFormats/Shader/SHARCFB.cs +++ b/Switch_FileFormatsMain/FileFormats/Shader/SHARCFB.cs @@ -313,7 +313,6 @@ namespace FirstPlugin public class VariationMacro { public string Name { get; set; } - public string[] Values { get; set; } public string Value { get; set; } public void Read(FileReader reader, uint Version) @@ -321,38 +320,16 @@ namespace FirstPlugin var pos = reader.Position; uint SectionSize = reader.ReadUInt32(); - if (Version >= 13) - { - uint NameLength = reader.ReadUInt32(); - uint ValueCount = reader.ReadUInt32(); - Name = reader.ReadString((int)NameLength); - Value = reader.ReadString((int)ValueCount); + uint NameLength = reader.ReadUInt32(); + uint ValueLength = reader.ReadUInt32(); + Name = reader.ReadString((int)NameLength); + Value = reader.ReadString((int)ValueLength); - Values = new string[0]; - - Console.WriteLine("VariationMacro ------------------"); - Console.WriteLine(Name); - Console.WriteLine(Value); - Console.WriteLine("------------------"); - } - else - { - uint NameLength = reader.ReadUInt32(); - uint ValueCount = reader.ReadUInt32(); - uint Unk = reader.ReadUInt32(); - - Name = reader.ReadString((int)NameLength); - Values = reader.ReadStrings((int)ValueCount, Syroot.BinaryData.BinaryStringFormat.ZeroTerminated); - - foreach (string vl in Values) - Value += $" {vl}"; - - Console.WriteLine("VariationMacro ------------------"); - Console.WriteLine(Name); - Console.WriteLine(Value); - Console.WriteLine("------------------"); - } + Console.WriteLine("VariationMacro ------------------"); + Console.WriteLine(Name); + Console.WriteLine(Value); + Console.WriteLine("------------------"); reader.Seek(pos + SectionSize, System.IO.SeekOrigin.Begin); @@ -407,18 +384,22 @@ namespace FirstPlugin public class ShaderSymbolData { public List symbols = new List(); - public void Read(FileReader reader, uint Version = 12) + public void Read(FileReader reader, uint Version = 12, bool SkipReading = false) { var SectionPos = reader.Position; uint SectionSize = reader.ReadUInt32(); uint SectionCount = reader.ReadUInt32(); - for (int i = 0; i < SectionCount; i++) + if (!SkipReading) { - ShaderSymbol symbol = new ShaderSymbol(); - symbol.Read(reader, Version); - symbols.Add(symbol); + for (int i = 0; i < SectionCount; i++) + { + ShaderSymbol symbol = new ShaderSymbol(); + symbol.Read(reader, Version); + symbols.Add(symbol); + } } + reader.Seek(SectionPos + SectionSize, System.IO.SeekOrigin.Begin); } } diff --git a/Switch_FileFormatsMain/GL/BFRES_Render.cs b/Switch_FileFormatsMain/GL/BFRES_Render.cs index a5528536..62b6f438 100644 --- a/Switch_FileFormatsMain/GL/BFRES_Render.cs +++ b/Switch_FileFormatsMain/GL/BFRES_Render.cs @@ -183,6 +183,15 @@ namespace FirstPlugin private void DrawBoundingBoxes() { + var boundings = GetSelectionBox(); + + DrawableBoundingBox.DrawBoundingBox( + new Vector3(boundings.minX, boundings.minY, boundings.minZ), + new Vector3(boundings.maxX, boundings.maxY, boundings.maxZ) + ); + + return; + foreach (FMDL mdl in models) { foreach (FSHP m in mdl.shapes) @@ -1097,9 +1106,9 @@ namespace FirstPlugin Min.X = Math.Min(Min.X, vertex.pos.X); Min.Y = Math.Min(Min.Y, vertex.pos.Y); Min.Z = Math.Min(Min.Z, vertex.pos.Z); - Max.X = Math.Max(Min.X, vertex.pos.X); - Max.Y = Math.Max(Min.Y, vertex.pos.Y); - Max.Z = Math.Max(Min.Z, vertex.pos.Z); + Max.X = Math.Max(Max.X, vertex.pos.X); + Max.Y = Math.Max(Max.Y, vertex.pos.Y); + Max.Z = Math.Max(Max.Z, vertex.pos.Z); } } } diff --git a/Switch_FileFormatsMain/GUI/Byaml/CourseMuunt/CourseMuuntStructs.cs b/Switch_FileFormatsMain/GUI/Byaml/CourseMuunt/CourseMuuntStructs.cs index 45c76d66..f6d5fb3e 100644 --- a/Switch_FileFormatsMain/GUI/Byaml/CourseMuunt/CourseMuuntStructs.cs +++ b/Switch_FileFormatsMain/GUI/Byaml/CourseMuunt/CourseMuuntStructs.cs @@ -297,6 +297,7 @@ namespace FirstPlugin.Turbo.CourseMuuntStructs public List BfresObjects = new List(); public List KclObjects = new List(); + public List ParameterArchives = new List(); public void AddRenderableKcl(string FilePath) { @@ -319,5 +320,16 @@ namespace FirstPlugin.Turbo.CourseMuuntStructs if (bfres != null) BfresObjects.Add(bfres); } + + public void AddParameterArchive(string FilePath) + { + if (!System.IO.File.Exists(FilePath)) + return; + + AAMP aamp = (AAMP)Switch_Toolbox.Library.IO.STFileLoader.OpenFileFormat(FilePath); + + if (aamp != null) + ParameterArchives.Add(aamp); + } } } diff --git a/Switch_FileFormatsMain/GUI/Byaml/CourseMuunt/TurboMunntEditor.cs b/Switch_FileFormatsMain/GUI/Byaml/CourseMuunt/TurboMunntEditor.cs index 9d90bb0f..a9821952 100644 --- a/Switch_FileFormatsMain/GUI/Byaml/CourseMuunt/TurboMunntEditor.cs +++ b/Switch_FileFormatsMain/GUI/Byaml/CourseMuunt/TurboMunntEditor.cs @@ -10,6 +10,9 @@ using FirstPlugin.Turbo.CourseMuuntStructs; using GL_EditorFramework.EditorDrawables; using OpenTK; using OpenTK.Graphics.OpenGL; +using aampv1 = AampV1Library; +using aampv2 = AampV2Library; +using Switch_Toolbox.Library.Rendering; namespace FirstPlugin.Forms { @@ -53,19 +56,41 @@ namespace FirstPlugin.Forms CourseMuuntScene scene; + string CourseFolder; public void LoadCourseInfo(System.Collections.IEnumerable by, string FilePath) { - string CourseFolder = System.IO.Path.GetDirectoryName(FilePath); + CourseFolder = System.IO.Path.GetDirectoryName(FilePath); scene = new CourseMuuntScene(by); + //Add collsion (switch) if (File.Exists($"{CourseFolder}/course_kcl.szs")) scene.AddRenderableKcl($"{CourseFolder}/course_kcl.szs"); + + //Add collsion (wii u) if (File.Exists($"{CourseFolder}/course.kcl")) scene.AddRenderableKcl($"{CourseFolder}/course.kcl"); + //Add probe lighting config (wii u) + if (File.Exists($"{CourseFolder}/course.bglpbd")) + scene.AddParameterArchive($"{CourseFolder}/course.bglpbd"); + + //Add probe lighting config (switch) + if (File.Exists($"{CourseFolder}/course_bglpbd.szs")) + scene.AddParameterArchive($"{CourseFolder}/course_bglpbd.szs"); + + + //Add course model if (File.Exists($"{CourseFolder}/course_model.szs")) - { scene.AddRenderableBfres($"{CourseFolder}/course_model.szs"); + + foreach (AAMP aamp in scene.ParameterArchives) + { + if (aamp.aampFileV1 != null) + LoadParameters(aamp.aampFileV1); + else if (aamp.aampFileV2 != null) + LoadParameters(aamp.aampFileV2); + else + throw new Exception("Failed to load parameter file " + aamp.FileName); } viewport.AddDrawable(new GL_EditorFramework.EditorDrawables.SingleObject(new OpenTK.Vector3(0))); @@ -110,21 +135,163 @@ namespace FirstPlugin.Forms foreach (var kcl in scene.KclObjects) { - viewport.AddDrawable(kcl.Renderer); - treeView1.Nodes.Add(kcl); - kcl.Checked = true; + // viewport.AddDrawable(kcl.Renderer); + // treeView1.Nodes.Add(kcl); + // kcl.Checked = true; } foreach (var bfres in scene.BfresObjects) { - viewport.AddDrawable(bfres.BFRESRender); - treeView1.Nodes.Add(bfres); - bfres.Checked = true; + // viewport.AddDrawable(bfres.BFRESRender); + // treeView1.Nodes.Add(bfres); + // bfres.Checked = true; } IsLoaded = true; } + ProbeLighting probeLightingConfig; + + private void LoadParameters(aampv1.AampFile aamp) + { + if (aamp.EffectType == "Probe Data") + { + probeLightingConfig = new ProbeLighting(); + viewport.AddDrawable(probeLightingConfig); + var probeRoot = new ProbeLightingWrapper(probeLightingConfig); + treeView1.Nodes.Add(probeRoot); + + uint index = 0; + foreach (var val in aamp.RootNode.childParams) + { + var entry = new ProbeLighting.Entry(); + entry.Index = index++; + probeLightingConfig.Entries.Add(entry); + + probeRoot.Nodes.Add(new ProbeLightingEntryWrapper(entry)); + + foreach (var param in val.paramObjects) + { + switch (param.HashString) + { + case "param_obj": + foreach (var data in param.paramEntries) { + if (data.HashString == "index") entry.Index = (uint)data.Value; + if (data.HashString == "type") entry.Type = (uint)data.Value; + } + break; + case "grid": + entry.Grid = LoadGridData(param.paramEntries); + break; + case "sh_index_buffer": + LoadIndexBuffer(param.paramEntries, entry); + break; + case "sh_data_buffer": + LoadDataBuffer(param.paramEntries, entry); + break; + } + } + } + + aamp.Save($"{CourseFolder}/DEBUG_PROBE.aamp"); + + foreach (var entry in probeLightingConfig.Entries) + { + Console.WriteLine(entry.Name); + Console.WriteLine($"IndexType {entry.IndexType}"); + Console.WriteLine($"DataType {entry.DataType}"); + Console.WriteLine($"MaxIndexNum {entry.MaxIndexNum}"); + Console.WriteLine($"UsedIndexNum {entry.UsedIndexNum}"); + Console.WriteLine($"MaxShDataNum {entry.MaxShDataNum}"); + Console.WriteLine($"UsedShDataNum {entry.UsedShDataNum}"); + + Console.WriteLine($"AABB_Max_Position {entry.Grid.AABB_Max_Position}"); + Console.WriteLine($"AABB_Min_Position {entry.Grid.AABB_Min_Position}"); + Console.WriteLine($"Voxel_Step_Position {entry.Grid.Voxel_Step_Position}"); + + Console.WriteLine($"DataBuffer {entry.DataBuffer.Length}"); + Console.WriteLine($"IndexBuffer {entry.IndexBuffer.Length}"); + + } + + } + } + + private void LoadDataBuffer(aampv1.ParamEntry[] paramEntries, ProbeLighting.Entry probeEntry) + { + foreach (var entry in paramEntries) + { + if (entry.HashString == "type") + probeEntry.DataType = (uint)entry.Value; + if (entry.HashString == "used_data_num") + probeEntry.UsedShDataNum = (uint)entry.Value; + if (entry.HashString == "max_sh_data_num") + probeEntry.MaxShDataNum = (uint)entry.Value; + if (entry.HashString == "data_buffer") + { + if (entry.ParamType == aampv1.ParamType.BufferFloat) + probeEntry.DataBuffer = (float[])entry.Value; + } + } + } + + private void LoadIndexBuffer(aampv1.ParamEntry[] paramEntries, ProbeLighting.Entry probeEntry) + { + foreach (var entry in paramEntries) + { + if (entry.HashString == "type") + probeEntry.IndexType = (uint)entry.Value; + if (entry.HashString == "used_index_num") + probeEntry.UsedIndexNum = (uint)entry.Value; + if (entry.HashString == "max_index_num") + probeEntry.MaxIndexNum = (uint)entry.Value; + if (entry.HashString == "index_buffer") + { + if (entry.ParamType == aampv1.ParamType.BufferUint) + probeEntry.IndexBuffer = (uint[])entry.Value; + + //Experimental, just fill in indices + uint[] values = (uint[])entry.Value; + for (int i = 0; i < values.Length; i++) + { + values[i] = 0; + } + entry.Value = values; + } + } + } + + private ProbeLighting.Grid LoadGridData(aampv1.ParamEntry[] paramEntries) + { + ProbeLighting.Grid grid = new ProbeLighting.Grid(); + + var mainBfres = scene.BfresObjects[0]; + var boundings = mainBfres.BFRESRender.GetSelectionBox(); + + foreach (var entry in paramEntries) + { + if (entry.HashString == "aabb_min_pos") { + grid.AABB_Max_Position = Utils.ToVec3((Syroot.Maths.Vector3F)entry.Value); + + entry.Value = new Syroot.Maths.Vector3F(boundings.minX, boundings.minY, boundings.minZ); + } + if (entry.HashString == "aabb_max_pos") { + grid.AABB_Min_Position = Utils.ToVec3((Syroot.Maths.Vector3F)entry.Value); + + entry.Value = new Syroot.Maths.Vector3F(boundings.maxX, boundings.maxY, boundings.maxZ); + } + if (entry.HashString == "voxel_step_pos") + grid.Voxel_Step_Position = Utils.ToVec3((Syroot.Maths.Vector3F)entry.Value); + } + + return grid; + } + + private void LoadParameters(aampv2.AampFile aamp) + { + + } + private void AddPathDrawable(string Name, IEnumerable Groups, Color color, bool CanConnect = true) { @@ -190,16 +357,38 @@ namespace FirstPlugin.Forms private void viewIntroCameraToolStripMenuItem_Click(object sender, EventArgs e) { + //Sort list by camera number/id + scene.IntroCameras.Sort((x, y) => x.CameraNum.CompareTo(y.CameraNum)); + foreach (var camera in scene.IntroCameras) { var pathMove = scene.Paths[camera.Camera_Path]; var pathLookAt = scene.Paths[camera.Camera_AtPath]; + //The time elapsed for each point + int PathTime = camera.CameraTime / pathMove.PathPoints.Count; + + //Go through each point for (int p = 0; p < pathMove.PathPoints.Count; p++) { + //If lookat path is higher than the move path, break + if (pathLookAt.PathPoints.Count >= p) + break; + + //Set our points var pathMovePoint = pathMove.PathPoints[p]; var pathLookAtPoint = pathLookAt.PathPoints[p]; + for (int frame = 0; frame < PathTime; frame++) + { + if (viewport.GL_ControlModern != null) + { + viewport.GL_ControlModern.CameraEye = pathLookAtPoint.Translate; + viewport.GL_ControlModern.CameraTarget = pathMovePoint.Translate; + + viewport.UpdateViewport(); + } + } } } } @@ -216,6 +405,23 @@ namespace FirstPlugin.Forms { stPropertyGrid1.LoadProperty(scene, OnPropertyChanged); } + else if (node is ProbeLightingWrapper) + { + } + else if (node is ProbeLightingEntryWrapper) + { + var parent = (ProbeLightingWrapper)node.Parent; + + foreach (var child in parent.Nodes) + { + ( (ProbeLightingEntryWrapper)child).entry.Grid.GridColor = new Vector3(9, 0, 0); + } + + var probeEntry = (ProbeLightingEntryWrapper)node; + probeEntry.entry.Grid.GridColor = new Vector3(1,0,0); + + stPropertyGrid1.LoadProperty(probeEntry.entry, OnPropertyChanged); + } else if (node is PathCollectionNode) { foreach (var group in ((PathCollectionNode)node).Nodes) @@ -275,6 +481,8 @@ namespace FirstPlugin.Forms { if (node is PathPointNode) ((PathPointNode)node).OnChecked(IsChecked); + if (node is ProbeLightingEntryWrapper) + ((ProbeLightingEntryWrapper)node).OnChecked(IsChecked); } } } diff --git a/Switch_FileFormatsMain/GUI/Byaml/CourseMuunt/Wrappers/ProbeLightingEntryWrapper.cs b/Switch_FileFormatsMain/GUI/Byaml/CourseMuunt/Wrappers/ProbeLightingEntryWrapper.cs new file mode 100644 index 00000000..32ce0714 --- /dev/null +++ b/Switch_FileFormatsMain/GUI/Byaml/CourseMuunt/Wrappers/ProbeLightingEntryWrapper.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Switch_Toolbox.Library; +using Switch_Toolbox.Library.Rendering; + +namespace FirstPlugin.Turbo.CourseMuuntStructs +{ + public class ProbeLightingEntryWrapper : TreeNodeCustom + { + public ProbeLighting.Entry entry; + + public void OnChecked(bool IsChecked) + { + entry.IsVisable = IsChecked; + } + + public ProbeLightingEntryWrapper(ProbeLighting.Entry config) { + Text = config.Name; + Checked = true; + + entry = config; + } + } +} diff --git a/Switch_FileFormatsMain/GUI/Byaml/CourseMuunt/Wrappers/ProbeLightingWrapper.cs b/Switch_FileFormatsMain/GUI/Byaml/CourseMuunt/Wrappers/ProbeLightingWrapper.cs new file mode 100644 index 00000000..c7929626 --- /dev/null +++ b/Switch_FileFormatsMain/GUI/Byaml/CourseMuunt/Wrappers/ProbeLightingWrapper.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Switch_Toolbox.Library; +using Switch_Toolbox.Library.Rendering; + +namespace FirstPlugin.Turbo.CourseMuuntStructs +{ + public class ProbeLightingWrapper : TreeNodeCustom + { + public ProbeLighting ProbeLightingConfig; + + public ProbeLightingWrapper(ProbeLighting config) { + Text = "course.bglpbd (Probe Lighting)"; + ProbeLightingConfig = config; + Checked = true; + } + } +} diff --git a/Switch_FileFormatsMain/Switch_FileFormatsMain.csproj b/Switch_FileFormatsMain/Switch_FileFormatsMain.csproj index 2d76adea..f9fc6363 100644 --- a/Switch_FileFormatsMain/Switch_FileFormatsMain.csproj +++ b/Switch_FileFormatsMain/Switch_FileFormatsMain.csproj @@ -362,6 +362,8 @@ + + UserControl diff --git a/Switch_FileFormatsMain/obj/Release/AxInterop.WMPLib.dll b/Switch_FileFormatsMain/obj/Release/AxInterop.WMPLib.dll index 5227894d..87f0ddca 100644 Binary files a/Switch_FileFormatsMain/obj/Release/AxInterop.WMPLib.dll and b/Switch_FileFormatsMain/obj/Release/AxInterop.WMPLib.dll differ diff --git a/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache b/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache index 01df67bb..0f095666 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 9db4fe02..ceaf6b04 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 4b1500f1..ba4a55a1 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/FirstPlugin.Turbo.MK8MapCameraEditor.resources b/Switch_FileFormatsMain/obj/Release/FirstPlugin.Turbo.MK8MapCameraEditor.resources index 8f1a50cb..6c05a977 100644 Binary files a/Switch_FileFormatsMain/obj/Release/FirstPlugin.Turbo.MK8MapCameraEditor.resources and b/Switch_FileFormatsMain/obj/Release/FirstPlugin.Turbo.MK8MapCameraEditor.resources differ diff --git a/Switch_FileFormatsMain/obj/Release/Interop.WMPLib.dll b/Switch_FileFormatsMain/obj/Release/Interop.WMPLib.dll index e7e1357d..ec3e59fb 100644 Binary files a/Switch_FileFormatsMain/obj/Release/Interop.WMPLib.dll and b/Switch_FileFormatsMain/obj/Release/Interop.WMPLib.dll differ diff --git a/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csproj.CoreCompileInputs.cache b/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csproj.CoreCompileInputs.cache index 84ccf047..83df05ba 100644 --- a/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csproj.CoreCompileInputs.cache +++ b/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -303eb09c135d9731661be3be002bdbe8c1380569 +fb185deacd6b91f90d3d81f0920e25025a615d0b diff --git a/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csproj.GenerateResource.cache b/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csproj.GenerateResource.cache index a1ad2b85..d3283a1b 100644 Binary files a/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csproj.GenerateResource.cache and b/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csproj.GenerateResource.cache differ diff --git a/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csprojAssemblyReference.cache b/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csprojAssemblyReference.cache index d9690a78..f5e70b23 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/Assimp/AssimpSaver.cs b/Switch_Toolbox_Library/FileFormats/Assimp/AssimpSaver.cs index 7db97a6b..a14a1d1b 100644 --- a/Switch_Toolbox_Library/FileFormats/Assimp/AssimpSaver.cs +++ b/Switch_Toolbox_Library/FileFormats/Assimp/AssimpSaver.cs @@ -36,7 +36,7 @@ namespace Switch_Toolbox.Library if (ext == ".ply") formatID = "ply"; - if (v.ExportFile(scene, FileName, formatID)) + if (v.ExportFile(scene, FileName, formatID, PostProcessSteps.FlipUVs)) MessageBox.Show($"Exported {FileName} Successfuly!"); else MessageBox.Show($"Failed to export {FileName}!"); @@ -110,7 +110,7 @@ namespace Switch_Toolbox.Library else mesh.Bones[boneInd].VertexWeights.Add(new VertexWeight(vertexID, 1)); } - else if ( v.boneWeights[j] > 0) + else if (v.boneWeights.Count == 0 || v.boneWeights[j] > 0) mesh.Bones[boneInd].VertexWeights.Add(new VertexWeight(vertexID, 1)); } } diff --git a/Switch_Toolbox_Library/FileFormats/OBJ.cs b/Switch_Toolbox_Library/FileFormats/OBJ.cs new file mode 100644 index 00000000..3370d2bc --- /dev/null +++ b/Switch_Toolbox_Library/FileFormats/OBJ.cs @@ -0,0 +1,105 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.IO; +using OpenTK; + +namespace Switch_Toolbox.Library +{ + public class OBJ + { + public static void ExportModel(string FileName, STGenericModel Model, List Textures) + { + string fileNoExt = Path.GetFileNameWithoutExtension(FileName); + string fileMtlPath = FileName.Replace("obj", "mtl"); + + //Write model + StringBuilder writer = new StringBuilder(); + SaveMeshes(writer, Model, $"{fileNoExt}.mtl"); + File.WriteAllText(FileName, writer.ToString()); + + //Write materials + StringBuilder writerMtl = new StringBuilder(); + SaveMaterials(writerMtl, Model); + File.WriteAllText(fileMtlPath, writerMtl.ToString()); + } + + private static void SaveMeshes(StringBuilder writer, STGenericModel Model, string MtlName) + { + writer.AppendLine($"mtllib {MtlName}"); + + int VertexCount = 1; + foreach (STGenericObject mesh in Model.Nodes[0].Nodes) + { + writer.AppendLine($"o {mesh.Text}"); + writer.AppendLine($"g {mesh.Text}"); + + foreach (var v in mesh.vertices) + { + writer.AppendLine($"v {v.pos.X} {v.pos.Y} {v.pos.Z}"); + writer.AppendLine($"vn {v.nrm.X} {v.nrm.Y} {v.nrm.Z}"); + writer.AppendLine($"vt {v.uv0.X} {v.uv0.Y}"); + } + var mat = GetMaterial(mesh.MaterialIndex, Model); + + if (mat != null) + writer.AppendLine($"usemtl {mat.Text}"); + + for (int i = 0; i < mesh.faces.Count; i++) + { + int[] indices = new int[3] + { + mesh.faces[i++], + mesh.faces[i++], + mesh.faces[i] + }; + + writer.AppendLine($"f {indices[0] + VertexCount}/{indices[0] + VertexCount}/{indices[0] + VertexCount}" + + $" {indices[1] + VertexCount}/{indices[1] + VertexCount}/{indices[1] + VertexCount}" + + $" {indices[2] + VertexCount}/{indices[2] + VertexCount}/{indices[2] + VertexCount}"); + } + + VertexCount += mesh.vertices.Count; + } + } + + private static STGenericMaterial GetMaterial(int MaterialIndex, STGenericModel Model) + { + if (MaterialIndex < Model.Nodes[1].Nodes.Count) + return (STGenericMaterial)Model.Nodes[1].Nodes[MaterialIndex]; + else + return null; + } + + public static float Ns = -3.921569f; + public static Vector3 Ka = new Vector3(1.000000f, 1.000000f, 1.000000f); + public static Vector3 Kd = new Vector3(0.640000f, 0.640000f, 0.640000f); + public static Vector3 Ks = new Vector3(0.500000f, 0.500000f, 0.500000f); + public static Vector3 Ke = new Vector3(0.000000f, 0.000000f, 0.000000f); + public static float Ni = -1f; + public static float d = -1f; + public static float illum = 2; + + private static void SaveMaterials(StringBuilder writer, STGenericModel Model) + { + foreach (STGenericMaterial mat in Model.Nodes[1].Nodes) + { + writer.AppendLine($"newmtl {mat.Text}"); + writer.AppendLine($"Ns {Ns}"); + writer.AppendLine($"Ka {Ka.X} {Ka.Y} {Ka.Z}"); + writer.AppendLine($"Kd {Kd.X} {Kd.Y} {Kd.Z}"); + writer.AppendLine($"Ks {Ks.X} {Ks.Y} {Ks.Z}"); + writer.AppendLine($"Ke {Ke.X} {Ke.Y} {Ke.Z}"); + writer.AppendLine($"Ni {Ni}"); + writer.AppendLine($"d {d}"); + writer.AppendLine($"illum {illum}"); + + foreach (var tex in mat.TextureMaps) + { + if (tex.Type == STGenericMatTexture.TextureType.Diffuse) + writer.AppendLine($"map_Kd {tex.Name}.png"); + } + } + } + } +} diff --git a/Switch_Toolbox_Library/Rendering/DrawableBoundingBox.cs b/Switch_Toolbox_Library/Rendering/DrawableBoundingBox.cs new file mode 100644 index 00000000..17a0b3a3 --- /dev/null +++ b/Switch_Toolbox_Library/Rendering/DrawableBoundingBox.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using OpenTK.Graphics.OpenGL; +using OpenTK; + +namespace Switch_Toolbox.Library.Rendering +{ + public class DrawableBoundingBox + { + public static List GetBoundingVertices(Vector3 Min, Vector3 Max) + { + var vertices = new List(); + vertices.Add(new Vector3(Min.X, Min.Y, Min.Z)); + vertices.Add(new Vector3(Min.X, Min.Y, Max.Z)); + vertices.Add(new Vector3(Min.X, Max.Y, Min.Z)); + vertices.Add(new Vector3(Min.X, Max.Y, Max.Z)); + vertices.Add(new Vector3(Max.X, Min.Y, Min.Z)); + vertices.Add(new Vector3(Max.X, Min.Y, Max.Z)); + vertices.Add(new Vector3(Max.X, Max.Y, Min.Z)); + vertices.Add(new Vector3(Max.X, Max.Y, Max.Z)); + return vertices; + } + + public static void DrawBoundingBox(Vector3 Min, Vector3 Max) + { + var vertices = GetBoundingVertices(Min, Max); + + GL.Begin(PrimitiveType.LineLoop); + GL.Vertex3(vertices[0]); + GL.Vertex3(vertices[1]); + GL.Vertex3(vertices[3]); + GL.Vertex3(vertices[2]); + GL.End(); + + GL.Begin(PrimitiveType.LineLoop); + GL.Vertex3(vertices[4]); + GL.Vertex3(vertices[5]); + GL.Vertex3(vertices[7]); + GL.Vertex3(vertices[6]); + GL.End(); + + GL.Begin(PrimitiveType.Lines); + GL.Vertex3(vertices[0]); + GL.Vertex3(vertices[4]); + GL.Vertex3(vertices[1]); + GL.Vertex3(vertices[5]); + GL.Vertex3(vertices[3]); + GL.Vertex3(vertices[7]); + GL.Vertex3(vertices[2]); + GL.Vertex3(vertices[6]); + GL.End(); + } + } +} diff --git a/Switch_Toolbox_Library/Rendering/ProbeLighting.cs b/Switch_Toolbox_Library/Rendering/ProbeLighting.cs new file mode 100644 index 00000000..d65c5a82 --- /dev/null +++ b/Switch_Toolbox_Library/Rendering/ProbeLighting.cs @@ -0,0 +1,317 @@ +using System; +using System.Collections.Generic; +using OpenTK; +using OpenTK.Graphics.OpenGL; +using System.Text; +using System.Threading.Tasks; +using GL_EditorFramework.GL_Core; +using GL_EditorFramework.Interfaces; +using GL_EditorFramework.EditorDrawables; +using GL_EditorFramework; + +namespace Switch_Toolbox.Library.Rendering +{ + public class ProbeLighting : AbstractGlDrawable + { + public List Entries = new List(); + + public class Entry + { + public bool IsVisable = true; + + public string Name { get { return $"b_{Index}"; } } + + public uint Index = 0; + public uint Type = 0; + + public Grid Grid = new Grid(); + + //Index Buffer + public uint IndexType = 1; + public uint UsedIndexNum; + public uint MaxIndexNum; + public uint[] IndexBuffer = new uint[0]; + + + public ushort[] GetUint16BufferIndices() + { + if (!IsUint16Buffer()) + throw new Exception("Buffer not a ushort buffer!"); + + List Indices = new List(); + + //Read the buffer data back as ushort + for (int i = 0; i < IndexBuffer.Length; i++) + { + byte[] bytes = BitConverter.GetBytes(IndexBuffer[i]); + Indices.Add(BitConverter.ToUInt16(bytes, 0)); + Indices.Add(BitConverter.ToUInt16(bytes, 2)); + } + + return Indices.ToArray(); + } + + public bool IsUint16Buffer() + { + if (IndexBuffer.Length / 2 == UsedIndexNum) + return true; + else return false; + } + + public bool IsUint32Buffer() + { + if (IndexBuffer.Length == UsedIndexNum) + return true; + else return false; + } + + //Data Buffer + public uint DataType = 0; + public uint UsedShDataNum; + public uint MaxShDataNum; + public uint PerProbeNum = 27; + public float[] DataBuffer = new float[0]; + + public bool IsHalfFloatBuffer() + { + if ((DataBuffer.Length * PerProbeNum) / 2 == UsedShDataNum) + return true; + else return false; + } + + public bool IsFloatBuffer() + { + if ((DataBuffer.Length * PerProbeNum) == UsedShDataNum) + return true; + else return false; + } + + //Color data in the data buffer + public class ShereHermonic + { + //Usually 27 + public Vector3[] Coefficents; + + public ShereHermonic(int PerProbeNum) { + Coefficents = new Vector3[PerProbeNum]; + } + } + } + + public class Grid + { + public Vector3 GridColor; + + public Vector3 AABB_Max_Position; + public Vector3 AABB_Min_Position; + public Vector3 Voxel_Step_Position; + } + + protected static ShaderProgram ProbeSHShaderProgram; + + int vbo_position; + + public void Destroy() + { + bool buffersWereInitialized = vbo_position != 0; + if (!buffersWereInitialized) + return; + + GL.DeleteBuffer(vbo_position); + } + + public List GetProbeVertices(int index) + { + var entry = Entries[index]; + + var vertices = new List(); + + Vector3 Max = entry.Grid.AABB_Max_Position; + Vector3 Min = entry.Grid.AABB_Min_Position; + Vector3 Step = entry.Grid.AABB_Min_Position; + + float GridWidth = Min.X + Max.X; + float GirdHeight = Min.Y + Max.Y; + + /* //Draw Z plane + for (int x = 0; x < GridWidth; x++) + { + for (int y = 0; y < GirdHeight; y++) + { + Vector3 position = new Vector3(Min.X + (x / Step.X) * (Max.X - Min.X), + Min.Y + (y / Step.Y) * (Max.Y - Min.Y), + Max.Z); + + vertices.Add(position); + } + }*/ + + return vertices; + } + + public List GetBoundingVertices(int index) + { + var entry = Entries[index]; + + var vertices = new List(); + + Vector3 Max = entry.Grid.AABB_Max_Position; + Vector3 Min = entry.Grid.AABB_Min_Position; + + vertices.Add(new Vector3(Min.X, Min.Y, Min.Z)); + vertices.Add(new Vector3(Min.X, Min.Y, Max.Z)); + vertices.Add(new Vector3(Min.X, Max.Y, Min.Z)); + vertices.Add(new Vector3(Min.X, Max.Y, Max.Z)); + vertices.Add(new Vector3(Max.X, Min.Y, Min.Z)); + vertices.Add(new Vector3(Max.X, Min.Y, Max.Z)); + vertices.Add(new Vector3(Max.X, Max.Y, Min.Z)); + vertices.Add(new Vector3(Max.X, Max.Y, Max.Z)); + + return vertices; + } + + public static int CellAmount; + public static int CellSize; + + int CurrentIndex = 0; + + Vector3[] Vertices + { + get + { + return GetProbeVertices(CurrentIndex).ToArray(); + } + } + + public void UpdateVertexData() + { + Vector3[] vertices = Vertices; + + GL.GenBuffers(1, out vbo_position); + GL.BindBuffer(BufferTarget.ArrayBuffer, vbo_position); + GL.BufferData(BufferTarget.ArrayBuffer, + new IntPtr(vertices.Length * Vector3.SizeInBytes), + vertices, BufferUsageHint.StaticDraw); + } + + public override void Draw(GL_ControlModern control, Pass pass) + { + if (pass == Pass.TRANSPARENT) + return; + + bool buffersWereInitialized = vbo_position != 0; + if (!buffersWereInitialized) + UpdateVertexData(); + + if (!Runtime.OpenTKInitialized) + return; + + control.CurrentShader = ProbeSHShaderProgram; + control.UpdateModelMatrix(Matrix4.Identity); + + Matrix4 previewScale = Utils.TransformValues(Vector3.Zero, Vector3.Zero, Runtime.previewScale); + + ProbeSHShaderProgram.SetMatrix4x4("previewScale", ref previewScale); + + foreach (var entry in Entries) + { + if (!entry.IsVisable) + continue; + + Vector3[] vertices = GetBoundingVertices((int)entry.Index).ToArray(); + + Vector3 Max = entry.Grid.AABB_Max_Position; + Vector3 Min = entry.Grid.AABB_Min_Position; + Vector3 Step = entry.Grid.Voxel_Step_Position; + + float gridHeight = Min.Y + Max.Y; + float gridWidth = Min.X + Max.X; + float gridDepth = Min.Z + Max.Z; + + + //Draw bounding box + GL.Color3(entry.Grid.GridColor); + + GL.Begin(PrimitiveType.LineLoop); + GL.Vertex3(vertices[0]); + GL.Vertex3(vertices[1]); + GL.Vertex3(vertices[3]); + GL.Vertex3(vertices[2]); + GL.End(); + + GL.Begin(PrimitiveType.LineLoop); + GL.Vertex3(vertices[4]); + GL.Vertex3(vertices[5]); + GL.Vertex3(vertices[7]); + GL.Vertex3(vertices[6]); + GL.End(); + + GL.Begin(PrimitiveType.Lines); + GL.Vertex3(vertices[0]); + GL.Vertex3(vertices[4]); + GL.Vertex3(vertices[1]); + GL.Vertex3(vertices[5]); + GL.Vertex3(vertices[3]); + GL.Vertex3(vertices[7]); + GL.Vertex3(vertices[2]); + GL.Vertex3(vertices[6]); + GL.End(); + + ProbeSHShaderProgram.EnableVertexAttributes(); + Draw(ProbeSHShaderProgram); + ProbeSHShaderProgram.DisableVertexAttributes(); + } + + GL.UseProgram(0); + } + + private void Attributes(ShaderProgram shader) + { + GL.BindBuffer(BufferTarget.ArrayBuffer, vbo_position); + GL.VertexAttribPointer(shader.GetAttribute("vPosition"), 3, VertexAttribPointerType.Float, false, 12, 0); + } + private void Uniforms(ShaderProgram shader) + { + shader.SetVector3("gridColor", ColorUtility.ToVector3(System.Drawing.Color.Black)); + } + private void Draw(ShaderProgram shader) + { + Uniforms(shader); + Attributes(shader); + + GL.DrawArrays(PrimitiveType.Points, 0, Vertices.Length); + } + + public override void Draw(GL_ControlLegacy control, Pass pass) + { + + } + + public override void Prepare(GL_ControlModern control) + { + var Frag = new FragmentShader( + @"#version 330 + uniform vec3 gridColor; + void main(){ + gl_FragColor = vec4(gridColor, 1); + }"); + var Vert = new VertexShader( + @"#version 330 + in vec3 vPosition; + + uniform mat4 mtxMdl; + uniform mat4 mtxCam; + + void main(){ + gl_Position = mtxMdl * mtxCam * vec4(vPosition.xyz, 1); + }"); + + ProbeSHShaderProgram = new ShaderProgram(Frag, Vert); + } + + public override void Prepare(GL_ControlLegacy control) + { + + } + } +} diff --git a/Switch_Toolbox_Library/Switch_Toolbox_Library.csproj b/Switch_Toolbox_Library/Switch_Toolbox_Library.csproj index 19c9fd77..151ab931 100644 --- a/Switch_Toolbox_Library/Switch_Toolbox_Library.csproj +++ b/Switch_Toolbox_Library/Switch_Toolbox_Library.csproj @@ -204,6 +204,7 @@ + Form @@ -570,10 +571,12 @@ + + diff --git a/Switch_Toolbox_Library/Swizzling/GX2.cs b/Switch_Toolbox_Library/Swizzling/GX2.cs index 951b6068..82c4f541 100644 --- a/Switch_Toolbox_Library/Swizzling/GX2.cs +++ b/Switch_Toolbox_Library/Swizzling/GX2.cs @@ -754,7 +754,7 @@ namespace Switch_Toolbox.Library return swizzleSurf(width, height, depth, format_, tileMode, swizzle_, pitch, bpp, data, depthLevel, 1); } - private static byte[] swizzleSurf(uint width, uint height,uint depth, uint format, uint tileMode, uint swizzle_, + private static byte[] swizzleSurf(uint width, uint height, uint depth, uint format, uint tileMode, uint swizzle_, uint pitch, uint bitsPerPixel, byte[] data, int depthLevel, int swizzle) { uint bytesPerPixel = bitsPerPixel / 8; @@ -1154,7 +1154,7 @@ namespace Switch_Toolbox.Library uint macroTileIndexY = y / macroTileHeight; ulong macroTileOffset = (macroTileIndexX + macroTilesPerRow * macroTileIndexY) * macroTileBytes; - if (isBankSwappedTileMode(tileMode)) + if (isBankSwappedTileMode(tileMode) != 0) { bankSwapWidth = computeSurfaceBankSwappedWidth(tileMode, bpp, 1, pitch); swapIndex = macroTilePitch * macroTileIndexX / bankSwapWidth; @@ -1210,7 +1210,7 @@ namespace Switch_Toolbox.Library if (DebugSurface) Console.WriteLine("computeSurfaceMipLevelTileMode expTileMode " + expTileMode); - if (noRecursive || level == 0) + if (noRecursive != 0 || level == 0) return expTileMode; switch (bpp) @@ -1910,7 +1910,6 @@ namespace Switch_Toolbox.Library tileMode, padDims, (flags.value >> 4) & 1, - (flags.value >> 7) & 1, pitchAlign, heightAlign, microTileThickness); @@ -1996,7 +1995,6 @@ namespace Switch_Toolbox.Library tileMode, padDims, (flags.value >> 4) & 1, - (flags.value >> 7) & 1, pitchAlign, heightAlign, microTileThickness); @@ -2487,4 +2485,4 @@ namespace Switch_Toolbox.Library return pSurfOut; } } -} +} \ No newline at end of file diff --git a/Toolbox/Gl_EditorFramework.dll b/Toolbox/Gl_EditorFramework.dll index ea005a99..ec1e8777 100644 Binary files a/Toolbox/Gl_EditorFramework.dll and b/Toolbox/Gl_EditorFramework.dll differ diff --git a/Toolbox/Gl_EditorFramework.pdb b/Toolbox/Gl_EditorFramework.pdb index d9aef0a8..92a4698d 100644 Binary files a/Toolbox/Gl_EditorFramework.pdb and b/Toolbox/Gl_EditorFramework.pdb differ diff --git a/Updater/Program.cs b/Updater/Program.cs index 2de95f40..23b0fea1 100644 --- a/Updater/Program.cs +++ b/Updater/Program.cs @@ -78,7 +78,10 @@ namespace Updater continue; if (File.Exists(Path.Combine(folderDir, Path.GetFileName(file)))) + { + File.SetAttributes(file, FileAttributes.Normal); File.Delete(Path.Combine(folderDir, Path.GetFileName(file))); + } File.Move(file, Path.Combine(folderDir, Path.GetFileName(file))); } }