diff --git a/.vs/Switch_Toolbox/v15/.suo b/.vs/Switch_Toolbox/v15/.suo
index fb06e179..d0070a8d 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 a0318bc5..c02c851c 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 adc93bf4..84c0a411 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/BfresPlatformConverter.cs b/Switch_FileFormatsMain/FileFormats/BFRES/Bfres Structs/BfresPlatformConverter.cs
new file mode 100644
index 00000000..b8c362cb
--- /dev/null
+++ b/Switch_FileFormatsMain/FileFormats/BFRES/Bfres Structs/BfresPlatformConverter.cs
@@ -0,0 +1,137 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ResU = Syroot.NintenTools.Bfres;
+using ResNX = Syroot.NintenTools.NSW.Bfres;
+
+namespace FirstPlugin
+{
+ public class BfresPlatformConverter
+ {
+
+ public static ResNX.SkeletalAnim ConvertWiiUToSwitch(ResU.SkeletalAnim skeletalAnimU)
+ {
+ ResNX.SkeletalAnim ska = new ResNX.SkeletalAnim();
+ ska.Name = skeletalAnimU.Name;
+ ska.Path = skeletalAnimU.Path;
+ ska.FrameCount = skeletalAnimU.FrameCount;
+ ska.FlagsScale = ResNX.SkeletalAnimFlagsScale.None;
+
+ if (skeletalAnimU.FlagsScale.HasFlag(ResU.SkeletalAnimFlagsScale.Maya))
+ ska.FlagsScale = ResNX.SkeletalAnimFlagsScale.Maya;
+ if (skeletalAnimU.FlagsScale.HasFlag(ResU.SkeletalAnimFlagsScale.Softimage))
+ ska.FlagsScale = ResNX.SkeletalAnimFlagsScale.Softimage;
+ if (skeletalAnimU.FlagsScale.HasFlag(ResU.SkeletalAnimFlagsScale.Standard))
+ ska.FlagsScale = ResNX.SkeletalAnimFlagsScale.Standard;
+
+ ska.FrameCount = skeletalAnimU.FrameCount;
+ ska.BindIndices = skeletalAnimU.BindIndices;
+ ska.BakedSize = skeletalAnimU.BakedSize;
+ ska.Loop = skeletalAnimU.Loop;
+ ska.Baked = skeletalAnimU.Baked;
+ foreach (var boneAnimU in skeletalAnimU.BoneAnims)
+ {
+ var boneAnim = new ResNX.BoneAnim();
+ ska.BoneAnims.Add(boneAnim);
+ boneAnim.Name = boneAnimU.Name;
+ boneAnim.BeginRotate = boneAnimU.BeginRotate;
+ boneAnim.BeginTranslate = boneAnimU.BeginTranslate;
+ boneAnim.BeginBaseTranslate = boneAnimU.BeginBaseTranslate;
+ var baseData = new ResNX.BoneAnimData();
+ baseData.Translate = boneAnimU.BaseData.Translate;
+ baseData.Scale = boneAnimU.BaseData.Scale;
+ baseData.Rotate = boneAnimU.BaseData.Rotate;
+ baseData.Flags = boneAnimU.BaseData.Flags;
+ boneAnim.BaseData = baseData;
+ boneAnim.FlagsBase = (ResNX.BoneAnimFlagsBase)boneAnimU.FlagsBase;
+ boneAnim.FlagsCurve = (ResNX.BoneAnimFlagsCurve)boneAnimU.FlagsCurve;
+ boneAnim.FlagsTransform = (ResNX.BoneAnimFlagsTransform)boneAnimU.FlagsTransform;
+
+ foreach (var curveU in boneAnimU.Curves)
+ {
+ ResNX.AnimCurve curve = new ResNX.AnimCurve();
+ curve.AnimDataOffset = curveU.AnimDataOffset;
+ curve.CurveType = (ResNX.AnimCurveType)curveU.CurveType;
+ curve.Delta = curveU.Delta;
+ curve.EndFrame = curveU.EndFrame;
+ curve.Frames = curveU.Frames;
+ curve.Keys = curveU.Keys;
+ curve.KeyStepBoolData = curveU.KeyStepBoolData;
+ curve.KeyType = (ResNX.AnimCurveKeyType)curveU.KeyType;
+ curve.FrameType = (ResNX.AnimCurveFrameType)curveU.FrameType;
+ curve.StartFrame = curveU.StartFrame;
+ curve.Scale = curveU.Scale;
+ curve.Offset = (float)curveU.Offset;
+
+ boneAnim.Curves.Add(curve);
+ }
+ }
+
+ return ska;
+ }
+
+
+ public static ResU.SkeletalAnim ConvertSwitchToWiiU(ResNX.SkeletalAnim skeletalAnimNX)
+ {
+ ResU.SkeletalAnim ska = new ResU.SkeletalAnim();
+ ska.Name = skeletalAnimNX.Name;
+ ska.Path = skeletalAnimNX.Path;
+ ska.FrameCount = skeletalAnimNX.FrameCount;
+ ska.FlagsScale = ResU.SkeletalAnimFlagsScale.None;
+
+ if (skeletalAnimNX.FlagsScale.HasFlag(ResNX.SkeletalAnimFlagsScale.Maya))
+ ska.FlagsScale = ResU.SkeletalAnimFlagsScale.Maya;
+ if (skeletalAnimNX.FlagsScale.HasFlag(ResNX.SkeletalAnimFlagsScale.Softimage))
+ ska.FlagsScale = ResU.SkeletalAnimFlagsScale.Softimage;
+ if (skeletalAnimNX.FlagsScale.HasFlag(ResNX.SkeletalAnimFlagsScale.Standard))
+ ska.FlagsScale = ResU.SkeletalAnimFlagsScale.Standard;
+
+ ska.FrameCount = skeletalAnimNX.FrameCount;
+ ska.BindIndices = skeletalAnimNX.BindIndices;
+ ska.BakedSize = skeletalAnimNX.BakedSize;
+ ska.Loop = skeletalAnimNX.Loop;
+ ska.Baked = skeletalAnimNX.Baked;
+ foreach (var boneAnimNX in skeletalAnimNX.BoneAnims)
+ {
+ var boneAnimU = new ResU.BoneAnim();
+ ska.BoneAnims.Add(boneAnimU);
+ boneAnimU.Name = boneAnimNX.Name;
+ boneAnimU.BeginRotate = boneAnimNX.BeginRotate;
+ boneAnimU.BeginTranslate = boneAnimNX.BeginTranslate;
+ boneAnimU.BeginBaseTranslate = boneAnimNX.BeginBaseTranslate;
+ var baseData = new ResU.BoneAnimData();
+ baseData.Translate = boneAnimNX.BaseData.Translate;
+ baseData.Scale = boneAnimNX.BaseData.Scale;
+ baseData.Rotate = boneAnimNX.BaseData.Rotate;
+ baseData.Flags = boneAnimNX.BaseData.Flags;
+ boneAnimU.BaseData = baseData;
+ boneAnimU.FlagsBase = (ResU.BoneAnimFlagsBase)boneAnimNX.FlagsBase;
+ boneAnimU.FlagsCurve = (ResU.BoneAnimFlagsCurve)boneAnimNX.FlagsCurve;
+ boneAnimU.FlagsTransform = (ResU.BoneAnimFlagsTransform)boneAnimNX.FlagsTransform;
+
+ foreach (var curveNX in boneAnimNX.Curves)
+ {
+ ResU.AnimCurve curve = new ResU.AnimCurve();
+ curve.AnimDataOffset = curveNX.AnimDataOffset;
+ curve.CurveType = (ResU.AnimCurveType)curveNX.CurveType;
+ curve.Delta = curveNX.Delta;
+ curve.EndFrame = curveNX.EndFrame;
+ curve.Frames = curveNX.Frames;
+ curve.Keys = curveNX.Keys;
+ curve.KeyStepBoolData = curveNX.KeyStepBoolData;
+ curve.KeyType = (ResU.AnimCurveKeyType)curveNX.KeyType;
+ curve.FrameType = (ResU.AnimCurveFrameType)curveNX.FrameType;
+ curve.StartFrame = curveNX.StartFrame;
+ curve.Scale = curveNX.Scale;
+ curve.Offset = (float)curveNX.Offset;
+
+ boneAnimU.Curves.Add(curve);
+ }
+ }
+
+ return ska;
+ }
+ }
+}
diff --git a/Switch_FileFormatsMain/FileFormats/BFRES/Bfres Structs/SubFiles/FSKA.cs b/Switch_FileFormatsMain/FileFormats/BFRES/Bfres Structs/SubFiles/FSKA.cs
index 89b0187e..cbe0ea86 100644
--- a/Switch_FileFormatsMain/FileFormats/BFRES/Bfres Structs/SubFiles/FSKA.cs
+++ b/Switch_FileFormatsMain/FileFormats/BFRES/Bfres Structs/SubFiles/FSKA.cs
@@ -126,7 +126,7 @@ namespace Bfres.Structs
STSkeleton skeleton = GetActiveSkeleton();
if (SkeletalAnimU != null)
- BrawlboxHelper.FSKAConverter.Fska2Chr0(ConvertWiiUToSwitch(SkeletalAnimU), FileName);
+ BrawlboxHelper.FSKAConverter.Fska2Chr0(BfresPlatformConverter.ConvertWiiUToSwitch(SkeletalAnimU), FileName);
else
BrawlboxHelper.FSKAConverter.Fska2Chr0(SkeletalAnim, FileName);
@@ -217,7 +217,7 @@ namespace Bfres.Structs
{
var ska = new SkeletalAnim();
ska.Import(FileName);
- SkeletalAnimU = ConvertSwitchToWiiU(ska);
+ SkeletalAnimU = BfresPlatformConverter.ConvertSwitchToWiiU(ska);
SkeletalAnimU.Name = Text;
LoadAnim(SkeletalAnimU);
}
@@ -241,7 +241,7 @@ namespace Bfres.Structs
//Create a new wii u skeletal anim and try to convert it instead
var ska = new ResU.SkeletalAnim();
ska.Import(FileName, new ResU.ResFile());
- SkeletalAnim = ConvertWiiUToSwitch(ska);
+ SkeletalAnim = BfresPlatformConverter.ConvertWiiUToSwitch(ska);
SkeletalAnim.Name = Text;
LoadAnim(SkeletalAnim);
}
@@ -296,7 +296,7 @@ namespace Bfres.Structs
{
if (IsWiiU)
{
- SkeletalAnimU = ConvertSwitchToWiiU(FromGeneric(anims[i]));
+ SkeletalAnimU = BfresPlatformConverter.ConvertSwitchToWiiU(FromGeneric(anims[i]));
LoadAnim(SkeletalAnimU);
}
else
@@ -315,7 +315,7 @@ namespace Bfres.Structs
if (SkeletalAnimU != null)
{
- SkeletalAnimU = ConvertSwitchToWiiU(ska);
+ SkeletalAnimU = BfresPlatformConverter.ConvertSwitchToWiiU(ska);
LoadAnim(SkeletalAnimU);
}
else
@@ -615,129 +615,6 @@ namespace Bfres.Structs
return 0;
}
- public static SkeletalAnim ConvertWiiUToSwitch(ResU.SkeletalAnim skeletalAnimU)
- {
- SkeletalAnim ska = new SkeletalAnim();
- ska.Name = skeletalAnimU.Name;
- ska.Path = skeletalAnimU.Path;
- ska.FrameCount = skeletalAnimU.FrameCount;
- ska.FlagsScale = SkeletalAnimFlagsScale.None;
-
- if (skeletalAnimU.FlagsScale.HasFlag(ResU.SkeletalAnimFlagsScale.Maya))
- ska.FlagsScale = SkeletalAnimFlagsScale.Maya;
- if (skeletalAnimU.FlagsScale.HasFlag(ResU.SkeletalAnimFlagsScale.Softimage))
- ska.FlagsScale = SkeletalAnimFlagsScale.Softimage;
- if (skeletalAnimU.FlagsScale.HasFlag(ResU.SkeletalAnimFlagsScale.Standard))
- ska.FlagsScale = SkeletalAnimFlagsScale.Standard;
-
- ska.FrameCount = skeletalAnimU.FrameCount;
- ska.BindIndices = skeletalAnimU.BindIndices;
- ska.BakedSize = skeletalAnimU.BakedSize;
- ska.Loop = skeletalAnimU.Loop;
- ska.Baked = skeletalAnimU.Baked;
- foreach (var boneAnimU in skeletalAnimU.BoneAnims)
- {
- var boneAnim = new BoneAnim();
- ska.BoneAnims.Add(boneAnim);
- boneAnim.Name = boneAnimU.Name;
- boneAnim.BeginRotate = boneAnimU.BeginRotate;
- boneAnim.BeginTranslate = boneAnimU.BeginTranslate;
- boneAnim.BeginBaseTranslate = boneAnimU.BeginBaseTranslate;
- var baseData = new BoneAnimData();
- baseData.Translate = boneAnimU.BaseData.Translate;
- baseData.Scale = boneAnimU.BaseData.Scale;
- baseData.Rotate = boneAnimU.BaseData.Rotate;
- baseData.Flags = boneAnimU.BaseData.Flags;
- boneAnim.BaseData = baseData;
- boneAnim.FlagsBase = (BoneAnimFlagsBase)boneAnimU.FlagsBase;
- boneAnim.FlagsCurve = (BoneAnimFlagsCurve)boneAnimU.FlagsCurve;
- boneAnim.FlagsTransform = (BoneAnimFlagsTransform)boneAnimU.FlagsTransform;
-
- foreach (var curveU in boneAnimU.Curves)
- {
- AnimCurve curve = new AnimCurve();
- curve.AnimDataOffset = curveU.AnimDataOffset;
- curve.CurveType = (AnimCurveType)curveU.CurveType;
- curve.Delta = curveU.Delta;
- curve.EndFrame = curveU.EndFrame;
- curve.Frames = curveU.Frames;
- curve.Keys = curveU.Keys;
- curve.KeyStepBoolData = curveU.KeyStepBoolData;
- curve.KeyType = (AnimCurveKeyType)curveU.KeyType;
- curve.FrameType = (AnimCurveFrameType)curveU.FrameType;
- curve.StartFrame = curveU.StartFrame;
- curve.Scale = curveU.Scale;
- curve.Offset = (float)curveU.Offset;
-
- boneAnim.Curves.Add(curve);
- }
- }
-
- return ska;
- }
-
- public static ResU.SkeletalAnim ConvertSwitchToWiiU(SkeletalAnim skeletalAnimNX)
- {
- ResU.SkeletalAnim ska = new ResU.SkeletalAnim();
- ska.Name = skeletalAnimNX.Name;
- ska.Path = skeletalAnimNX.Path;
- ska.FrameCount = skeletalAnimNX.FrameCount;
- ska.FlagsScale = ResU.SkeletalAnimFlagsScale.None;
-
- if (skeletalAnimNX.FlagsScale.HasFlag(SkeletalAnimFlagsScale.Maya))
- ska.FlagsScale = ResU.SkeletalAnimFlagsScale.Maya;
- if (skeletalAnimNX.FlagsScale.HasFlag(SkeletalAnimFlagsScale.Softimage))
- ska.FlagsScale = ResU.SkeletalAnimFlagsScale.Softimage;
- if (skeletalAnimNX.FlagsScale.HasFlag(SkeletalAnimFlagsScale.Standard))
- ska.FlagsScale = ResU.SkeletalAnimFlagsScale.Standard;
-
- ska.FrameCount = skeletalAnimNX.FrameCount;
- ska.BindIndices = skeletalAnimNX.BindIndices;
- ska.BakedSize = skeletalAnimNX.BakedSize;
- ska.Loop = skeletalAnimNX.Loop;
- ska.Baked = skeletalAnimNX.Baked;
- foreach (var boneAnimNX in skeletalAnimNX.BoneAnims)
- {
- var boneAnimU = new ResU.BoneAnim();
- ska.BoneAnims.Add(boneAnimU);
- boneAnimU.Name = boneAnimNX.Name;
- boneAnimU.BeginRotate = boneAnimNX.BeginRotate;
- boneAnimU.BeginTranslate = boneAnimNX.BeginTranslate;
- boneAnimU.BeginBaseTranslate = boneAnimNX.BeginBaseTranslate;
- var baseData = new ResU.BoneAnimData();
- baseData.Translate = boneAnimNX.BaseData.Translate;
- baseData.Scale = boneAnimNX.BaseData.Scale;
- baseData.Rotate = boneAnimNX.BaseData.Rotate;
- baseData.Flags = boneAnimNX.BaseData.Flags;
- boneAnimU.BaseData = baseData;
- boneAnimU.FlagsBase = (ResU.BoneAnimFlagsBase)boneAnimNX.FlagsBase;
- boneAnimU.FlagsCurve = (ResU.BoneAnimFlagsCurve)boneAnimNX.FlagsCurve;
- boneAnimU.FlagsTransform = (ResU.BoneAnimFlagsTransform)boneAnimNX.FlagsTransform;
-
- foreach (var curveNX in boneAnimNX.Curves)
- {
- ResU.AnimCurve curve = new ResU.AnimCurve();
- curve.AnimDataOffset = curveNX.AnimDataOffset;
- curve.CurveType = (ResU.AnimCurveType)curveNX.CurveType;
- curve.Delta = curveNX.Delta;
- curve.EndFrame = curveNX.EndFrame;
- curve.Frames = curveNX.Frames;
- curve.Keys = curveNX.Keys;
- curve.KeyStepBoolData = curveNX.KeyStepBoolData;
- curve.KeyType = (ResU.AnimCurveKeyType)curveNX.KeyType;
- curve.FrameType = (ResU.AnimCurveFrameType)curveNX.FrameType;
- curve.StartFrame = curveNX.StartFrame;
- curve.Scale = curveNX.Scale;
- curve.Offset = (float)curveNX.Offset;
-
- boneAnimU.Curves.Add(curve);
- }
- }
-
- return ska;
- }
-
-
public FSKA(ResU.SkeletalAnim ska) { LoadAnim(ska); }
public FSKA(SkeletalAnim ska) { LoadAnim(ska); }
@@ -901,7 +778,7 @@ namespace Bfres.Structs
if (SkeletalAnimU != null)
{
var SkeletalAnimNX = BrawlboxHelper.FSKAConverter.Anim2Fska(FileName);
- SkeletalAnimU = ConvertSwitchToWiiU(SkeletalAnimNX);
+ SkeletalAnimU = BfresPlatformConverter.ConvertSwitchToWiiU(SkeletalAnimNX);
SkeletalAnimU.Name = Text;
LoadAnim(SkeletalAnimU);
}
@@ -918,7 +795,7 @@ namespace Bfres.Structs
if (IsWiiU)
{
var SkeletalAnimNX = BrawlboxHelper.FSKAConverter.Chr02Fska(FileName);
- SkeletalAnimU = ConvertSwitchToWiiU(SkeletalAnimNX);
+ SkeletalAnimU = BfresPlatformConverter.ConvertSwitchToWiiU(SkeletalAnimNX);
SkeletalAnimU.Name = Text;
LoadAnim(SkeletalAnimU);
}
diff --git a/Switch_FileFormatsMain/Switch_FileFormatsMain.csproj b/Switch_FileFormatsMain/Switch_FileFormatsMain.csproj
index 1b28bb38..1e96301b 100644
--- a/Switch_FileFormatsMain/Switch_FileFormatsMain.csproj
+++ b/Switch_FileFormatsMain/Switch_FileFormatsMain.csproj
@@ -219,6 +219,7 @@
+
diff --git a/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache b/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache
index 36767946..786b940c 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.csproj.CoreCompileInputs.cache b/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csproj.CoreCompileInputs.cache
index 336c1f09..96005eed 100644
--- a/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csproj.CoreCompileInputs.cache
+++ b/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csproj.CoreCompileInputs.cache
@@ -1 +1 @@
-0f3130142d6535028095bd6218f41b0b18c3297d
+257ba835e60e5df185147b3c27d6feb25ebe1d95
diff --git a/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csprojAssemblyReference.cache b/Switch_FileFormatsMain/obj/Release/Switch_FileFormatsMain.csprojAssemblyReference.cache
index 332d6c5d..4d30a5fa 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/Forms/ArchiveListPreviewForm.cs b/Switch_Toolbox_Library/Forms/ArchiveListPreviewForm.cs
index 0735a4e1..84727cd0 100644
--- a/Switch_Toolbox_Library/Forms/ArchiveListPreviewForm.cs
+++ b/Switch_Toolbox_Library/Forms/ArchiveListPreviewForm.cs
@@ -128,12 +128,10 @@ namespace Switch_Toolbox.Library.Forms
if (listViewCustom1.SelectedItems.Count > 0 && e.Button == MouseButtons.Right)
{
var item = listViewCustom1.SelectedItems[0];
- if (item.Tag is TreeNode)
+ if (item.Tag != null && item.Tag is TreeNode)
{
- // stContextMenuStrip1.Items.AddRange(((TreeNode)item.Tag).ContextMenuStrip.Items);
-
Point pt = listViewCustom1.PointToScreen(e.Location);
- stContextMenuStrip1.Show(pt);
+ ((TreeNode)item.Tag).ContextMenuStrip.Show(pt);
}
}
}