diff --git a/.vs/Switch_Toolbox/v15/.suo b/.vs/Switch_Toolbox/v15/.suo index ba173244..142d2874 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 8df24728..57fd6ab7 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 bbdc82d9..95b9d7d5 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 50b8b2af..4adac5a3 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/TMPK.cs b/Switch_FileFormatsMain/FileFormats/Archives/TMPK.cs index f160509b..3af6ff8d 100644 --- a/Switch_FileFormatsMain/FileFormats/Archives/TMPK.cs +++ b/Switch_FileFormatsMain/FileFormats/Archives/TMPK.cs @@ -123,6 +123,7 @@ namespace FirstPlugin writer.Write(files[i].FileData); } + writer.Close(); writer.Dispose(); } diff --git a/Switch_FileFormatsMain/YAML/YamlFmaa.cs b/Switch_FileFormatsMain/YAML/YamlFmaa.cs index f8074900..b0804920 100644 --- a/Switch_FileFormatsMain/YAML/YamlFmaa.cs +++ b/Switch_FileFormatsMain/YAML/YamlFmaa.cs @@ -1,12 +1,16 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text; +using System.IO; using System.Threading.Tasks; using Bfres.Structs; using SharpYaml; +using SharpYaml.Events; using SharpYaml.Serialization; +using SharpYaml.Serialization.Serializers; using Syroot.NintenTools.NSW.Bfres; +using System.Reflection; +using System.Text.RegularExpressions; namespace FirstPlugin { @@ -19,10 +23,12 @@ namespace FirstPlugin public bool Loop { get; set; } public int FrameCount { get; set; } - public List MaterialAnimConfigs = new List(); + public List MaterialAnimConfigs { get; set; } - public AnimConfig(MaterialAnim materialAnim) + public void ToYaml(MaterialAnim materialAnim) { + MaterialAnimConfigs = new List(); + Name = materialAnim.Name; Path = materialAnim.Path; FrameCount = materialAnim.FrameCount; @@ -133,7 +139,7 @@ namespace FirstPlugin int FrameCount = texturePatternCfg.CurveData.KeyFrames.Count; curve.Frames = new float[FrameCount]; - curve.Keys = new float[FrameCount, 0]; + curve.Keys = new float[FrameCount, 1]; int MaxFrame = 0; int MaxIndex = 0; @@ -201,12 +207,17 @@ namespace FirstPlugin public class ConstantTPConfig { - public string Texture; + public string Texture { get; set; } } public class CurveTPConfig { - public Dictionary KeyFrames = new Dictionary(); + public Dictionary KeyFrames { get; set; } + + public CurveTPConfig() + { + KeyFrames = new Dictionary(); + } } public class MatAnimConfig @@ -247,14 +258,15 @@ namespace FirstPlugin { var serializerSettings = new SerializerSettings() { - EmitTags = false + // EmitTags = false }; serializerSettings.DefaultStyle = YamlStyle.Any; serializerSettings.ComparerForKeySorting = null; + serializerSettings.RegisterTagMapping("AnimConfig", typeof(AnimConfig)); - var serializer = new Serializer(serializerSettings); - var config = serializer.Deserialize(Name); + var serializer = new Serializer( serializerSettings); + var config = serializer.Deserialize(File.ReadAllText(Name)); return ((AnimConfig)config).FromYaml(); } @@ -263,17 +275,21 @@ namespace FirstPlugin { var serializerSettings = new SerializerSettings() { - EmitTags = false + // EmitTags = false }; serializerSettings.DefaultStyle = YamlStyle.Any; serializerSettings.ComparerForKeySorting = null; + serializerSettings.RegisterTagMapping("AnimConfig", typeof(AnimConfig)); var MatAnim = anim.MaterialAnim; - var config = new AnimConfig(MatAnim); + var config = new AnimConfig(); + config.ToYaml(MatAnim); var serializer = new Serializer(serializerSettings); - return serializer.Serialize(config); + string yaml = serializer.Serialize(config, typeof(AnimConfig)); + + return yaml; } private void SetConfig() diff --git a/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache b/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache index 7c68c2cc..963839ac 100644 Binary files a/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache and b/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache differ