Fix importing additional animations (from binary)
This commit is contained in:
parent
fff3d58cb3
commit
bd6627b030
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -35,7 +35,12 @@ namespace Bfres.Structs
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((BFRES)Parent).IsWiiU;
|
||||
if (Parent is BFRES)
|
||||
return ((BFRES)Parent).IsWiiU;
|
||||
else if (Parent.Parent is BFRES)
|
||||
return ((BFRES)Parent.Parent).IsWiiU;
|
||||
else
|
||||
return ((BFRES)Parent.Parent.Parent).IsWiiU;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -186,9 +186,9 @@ namespace Bfres.Structs
|
||||
string ext = Utils.GetExtension(FileName);
|
||||
if (ext == ".bfska")
|
||||
{
|
||||
if (GetResFileU() != null)
|
||||
if (resFileU != null)
|
||||
{
|
||||
SkeletalAnimU.Import(FileName, GetResFileU());
|
||||
SkeletalAnimU.Import(FileName, resFileU);
|
||||
SkeletalAnimU.Name = Text;
|
||||
LoadAnim(SkeletalAnimU);
|
||||
}
|
||||
@ -212,7 +212,7 @@ namespace Bfres.Structs
|
||||
{
|
||||
if (SkeletalAnimU != null)
|
||||
LoadAnimData(SkeletalAnimU);
|
||||
else
|
||||
else if (SkeletalAnim != null)
|
||||
LoadAnimData(SkeletalAnim);
|
||||
}
|
||||
|
||||
|
126
Switch_FileFormatsMain/FileFormats/Bin/KartParts.cs
Normal file
126
Switch_FileFormatsMain/FileFormats/Bin/KartParts.cs
Normal file
@ -0,0 +1,126 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Switch_Toolbox;
|
||||
using System.Windows.Forms;
|
||||
using Switch_Toolbox.Library;
|
||||
using Syroot.NintenTools.MarioKart8.BinData;
|
||||
using Syroot.NintenTools.MarioKart8;
|
||||
using System.IO;
|
||||
|
||||
|
||||
namespace FirstPlugin.Turbo
|
||||
{
|
||||
public class PartsBIN : TreeNodeFile, IFileFormat
|
||||
{
|
||||
public bool CanSave { get; set; }
|
||||
public string[] Description { get; set; } = new string[] { "Mario Kart 8 Kart Parts" };
|
||||
public string[] Extension { get; set; } = new string[] { "*.bin" };
|
||||
public string FileName { get; set; }
|
||||
public string FilePath { get; set; }
|
||||
public IFileInfo IFileInfo { get; set; }
|
||||
|
||||
public bool Identify(System.IO.Stream stream)
|
||||
{
|
||||
using (var reader = new Switch_Toolbox.Library.IO.FileReader(stream, true))
|
||||
{
|
||||
return reader.CheckSignature(4, "PRTS");
|
||||
}
|
||||
}
|
||||
|
||||
public Type[] Types
|
||||
{
|
||||
get
|
||||
{
|
||||
List<Type> types = new List<Type>();
|
||||
return types.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
public class TIRE
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class KART
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class GLIDER
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
BinFile binFile;
|
||||
public void Load(System.IO.Stream stream)
|
||||
{
|
||||
binFile = new BinFile(stream);
|
||||
|
||||
for (int sectionIndex = 0; sectionIndex < binFile.Sections.Count; sectionIndex++)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Dump the BIN file to CSV.
|
||||
using (FileStream streamF = new FileStream("test.csv", FileMode.Create, FileAccess.Write, FileShare.None))
|
||||
using (StreamWriter writer = new StreamWriter(streamF, Encoding.UTF8, 1024, true))
|
||||
{
|
||||
// Write file header information.
|
||||
Write(writer, 0, $"BIN File Report for", FileName);
|
||||
Write(writer, 0, "Identifier", binFile.Format);
|
||||
Write(writer, 0, "Section count", binFile.Sections.Count);
|
||||
Write(writer, 0, "Unknown", binFile.ID);
|
||||
writer.WriteLine();
|
||||
|
||||
int sectionIndex = 1;
|
||||
foreach (var section in GetDwordSectionData(binFile))
|
||||
{
|
||||
Write(writer, 0, $"Section {sectionIndex++}");
|
||||
Write(writer, 1, "Identifier", section.Name);
|
||||
Write(writer, 1, "Group count", section.ParamCount);
|
||||
Write(writer, 1, "Type", section.ID.ToString("X"));
|
||||
writer.WriteLine();
|
||||
|
||||
DwordSectionData sectionData = (DwordSectionData)section.Data;
|
||||
|
||||
for (int d = 0; d < sectionData.Data.Length; d++)
|
||||
{
|
||||
foreach (Dword[] element in sectionData.Data[d])
|
||||
{
|
||||
Write(writer, 1, String.Join('\t'.ToString(), element));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerable<Section> GetDwordSectionData(BinFile binFile)
|
||||
{
|
||||
foreach (Section section in binFile.Sections)
|
||||
{
|
||||
if (section.Data is DwordSectionData sectionData)
|
||||
yield return section;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static void Write(StreamWriter writer, int indent, params object[] values)
|
||||
{
|
||||
writer.WriteLine(new string('\t', indent) + String.Join('\t'.ToString(), values));
|
||||
}
|
||||
|
||||
|
||||
public void Unload()
|
||||
{
|
||||
|
||||
}
|
||||
public byte[] Save()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -153,8 +153,9 @@ namespace FirstPlugin
|
||||
Formats.Add(typeof(TMPK));
|
||||
|
||||
Formats.Add(typeof(Turbo.Course_MapCamera_bin));
|
||||
Formats.Add(typeof(Turbo.PartsBIN));
|
||||
|
||||
|
||||
|
||||
return Formats.ToArray();
|
||||
}
|
||||
#endregion
|
||||
|
@ -141,6 +141,9 @@
|
||||
<HintPath>..\Toolbox\Lib\Syroot.NintenTools.Bfres.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Syroot.NintenTools.MarioKart8">
|
||||
<HintPath>..\Toolbox\Lib\Syroot.NintenTools.MarioKart8.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Syroot.NintenTools.NSW.Bfres">
|
||||
<HintPath>..\Toolbox\Lib\Syroot.NintenTools.NSW.Bfres.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
@ -200,6 +203,7 @@
|
||||
<Compile Include="FileFormats\BFRES\BFRESAnimFolder.cs" />
|
||||
<Compile Include="FileFormats\BFRES\gfxEnum.cs" />
|
||||
<Compile Include="FileFormats\BFRES\GLEnumConverter.cs" />
|
||||
<Compile Include="FileFormats\Bin\KartParts.cs" />
|
||||
<Compile Include="FileFormats\Collision\KclFile.cs" />
|
||||
<Compile Include="FileFormats\Font\BFFNT.cs" />
|
||||
<Compile Include="FileFormats\Audio\Archives\BFGRP.cs" />
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1 +1 @@
|
||||
f116fcf22bd14b1cb853244a6978b4a40935e43b
|
||||
303eb09c135d9731661be3be002bdbe8c1380569
|
||||
|
Binary file not shown.
BIN
Toolbox/Lib/Syroot.NintenTools.MarioKart8.dll
Normal file
BIN
Toolbox/Lib/Syroot.NintenTools.MarioKart8.dll
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user