Some cleanup. Start on gfbanm parsing
This commit is contained in:
parent
7e38484a3e
commit
1f37e182b5
@ -36,7 +36,7 @@ namespace FirstPlugin
|
||||
else if (f.Matches("FLIM")) return ".bclim";
|
||||
else if (f.Matches("FLAN")) return ".bflan";
|
||||
else if (f.Matches("FSEQ")) return ".bfseq";
|
||||
else if (f.Matches("VFXB")) return ".pctl";
|
||||
else if (f.Matches("VFXB")) return ".ptcl";
|
||||
else if (f.Matches("AAHS")) return ".sharc";
|
||||
else if (f.Matches("BAHS")) return ".sharcb";
|
||||
else if (f.Matches("BNTX")) return ".bntx";
|
||||
@ -46,7 +46,7 @@ namespace FirstPlugin
|
||||
else if (f.Matches("CFNT")) return ".bcfnt";
|
||||
else if (f.Matches("CSTM")) return ".bcstm";
|
||||
else if (f.Matches("FSTM")) return ".bfstm";
|
||||
else if (f.Matches("STM")) return ".bfsha";
|
||||
else if (f.Matches("STM")) return ".bstm";
|
||||
else if (f.Matches("CWAV")) return ".bcwav";
|
||||
else if (f.Matches("FWAV")) return ".bfwav";
|
||||
else if (f.Matches("CTPK")) return ".ctpk";
|
||||
@ -217,6 +217,9 @@ namespace FirstPlugin
|
||||
case ".bnsh":
|
||||
fileEntry.FileName = $"Shaders/{fileEntry.FileName}";
|
||||
break;
|
||||
case ".ptcl":
|
||||
fileEntry.FileName = $"Effects/{fileEntry.FileName}";
|
||||
break;
|
||||
default:
|
||||
fileEntry.FileName = $"OtherFiles/{fileEntry.FileName}";
|
||||
break;
|
||||
|
@ -19,7 +19,7 @@ namespace FirstPlugin
|
||||
|
||||
public bool CanSave { get; set; }
|
||||
public string[] Description { get; set; } = new string[] { "*CTR Model Binary" };
|
||||
public string[] Extension { get; set; } = new string[] { ".cmb" };
|
||||
public string[] Extension { get; set; } = new string[] { "*.cmb" };
|
||||
public string FileName { get; set; }
|
||||
public string FilePath { get; set; }
|
||||
public IFileInfo IFileInfo { get; set; }
|
||||
@ -1661,8 +1661,14 @@ namespace FirstPlugin
|
||||
public float BlendColorB { get; set; }
|
||||
public float BlendColorA { get; set; }
|
||||
|
||||
private byte[] data;
|
||||
|
||||
public void Read(FileReader reader, Header header, MaterialChunk materialChunkParent)
|
||||
{
|
||||
int materialSize = 0x15C;
|
||||
if (header.Version >= CMBVersion.MM3DS)
|
||||
materialSize = 0x16C;
|
||||
|
||||
TextureMaps = new TextureMap[3];
|
||||
TextureMaticies = new TextureMatrix[3];
|
||||
TextureCombiners = new List<TextureCombiner>();
|
||||
@ -1702,6 +1708,10 @@ namespace FirstPlugin
|
||||
TextureMaticies[j].Rotate = reader.ReadSingle();
|
||||
}
|
||||
|
||||
long dataPos = reader.Position;
|
||||
data = reader.ReadBytes(materialSize - (int)(dataPos - pos));
|
||||
reader.SeekBegin(dataPos);
|
||||
|
||||
uint unkColor0 = reader.ReadUInt32();
|
||||
|
||||
ConstantColors = new STColor[6];
|
||||
@ -1857,6 +1867,8 @@ namespace FirstPlugin
|
||||
writer.Write(TextureMaticies[j].Translate);
|
||||
writer.Write(TextureMaticies[j].Rotate);
|
||||
}
|
||||
|
||||
writer.Write(data);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
@ -1948,6 +1960,8 @@ namespace FirstPlugin
|
||||
|
||||
writer.WriteSignature(Magic);
|
||||
writer.Write(uint.MaxValue);//SectionSize
|
||||
writer.Write(Textures.Count);
|
||||
|
||||
for (int i = 0; i < Textures.Count; i++)
|
||||
Textures[i].Write(writer);
|
||||
|
||||
|
@ -63,6 +63,8 @@ namespace FirstPlugin.LuigisMansion3
|
||||
|
||||
private void SaveAction(object sender, EventArgs args)
|
||||
{
|
||||
return;
|
||||
|
||||
SaveFileDialog sfd = new SaveFileDialog();
|
||||
sfd.Filter = Utils.GetAllFilters(this);
|
||||
sfd.FileName = FileName;
|
||||
|
148
File_Format_Library/FileFormats/Pokemon/GFBANIM/GFBANM.cs
Normal file
148
File_Format_Library/FileFormats/Pokemon/GFBANIM/GFBANM.cs
Normal file
@ -0,0 +1,148 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Toolbox;
|
||||
using System.Windows.Forms;
|
||||
using Toolbox.Library;
|
||||
using Toolbox.Library.IO;
|
||||
using OpenTK;
|
||||
|
||||
namespace FirstPlugin
|
||||
{
|
||||
public class GFBANM : IFileFormat
|
||||
{
|
||||
public FileType FileType { get; set; } = FileType.Model;
|
||||
|
||||
public bool CanSave { get; set; }
|
||||
public string[] Description { get; set; } = new string[] { "MDL" };
|
||||
public string[] Extension { get; set; } = new string[] { "*.mdl" };
|
||||
public string FileName { get; set; }
|
||||
public string FilePath { get; set; }
|
||||
public IFileInfo IFileInfo { get; set; }
|
||||
|
||||
public bool Identify(System.IO.Stream stream)
|
||||
{
|
||||
return Utils.GetExtension(FileName) == ".gfbanm";
|
||||
}
|
||||
|
||||
public Type[] Types
|
||||
{
|
||||
get
|
||||
{
|
||||
List<Type> types = new List<Type>();
|
||||
return types.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
public void Load(System.IO.Stream stream)
|
||||
{
|
||||
using (var reader = new FileReader(stream))
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void Unload()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Save(System.IO.Stream stream)
|
||||
{
|
||||
}
|
||||
|
||||
public class Header
|
||||
{
|
||||
public Config config;
|
||||
|
||||
public void Read(FileReader reader)
|
||||
{
|
||||
reader.ReadUInt32();
|
||||
config = ParseSection<Config>(reader, this);
|
||||
}
|
||||
}
|
||||
|
||||
private static T ParseSection<T>(FileReader reader, Header header)
|
||||
where T : GFSection, new()
|
||||
{
|
||||
var layoutOffset = reader.ReadOffset(true, typeof(uint));
|
||||
var dataOffset = reader.ReadOffset(true, typeof(uint));
|
||||
|
||||
T section = new T();
|
||||
using (reader.TemporarySeek(layoutOffset, System.IO.SeekOrigin.Begin))
|
||||
{
|
||||
ushort layoutSize = reader.ReadUInt16();
|
||||
ushort layoutStride = reader.ReadUInt16();
|
||||
section.LayoutPointers = reader.ReadUInt16s((int)(layoutSize / 2));
|
||||
}
|
||||
|
||||
using (reader.TemporarySeek(dataOffset, System.IO.SeekOrigin.Begin))
|
||||
{
|
||||
section.Read(reader, header);
|
||||
}
|
||||
|
||||
return section;
|
||||
}
|
||||
|
||||
public class GFSection
|
||||
{
|
||||
public ushort[] LayoutPointers { get; set; }
|
||||
|
||||
public virtual void Read(FileReader reader, Header header)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class Config : GFSection
|
||||
{
|
||||
public int Unknown { get; set; }
|
||||
public uint NumKeyFrames { get; set; }
|
||||
public uint FramesPerSecond { get; set; }
|
||||
}
|
||||
|
||||
public class BoneList : GFSection
|
||||
{
|
||||
public List<Bone> Bones = new List<Bone>();
|
||||
public List<BoneDefaults> BoneDefaults = new List<BoneDefaults>();
|
||||
}
|
||||
|
||||
public class Bone
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public byte ScaleType { get; set; }
|
||||
}
|
||||
|
||||
public class BoneDefaults
|
||||
{
|
||||
public int Unknown { get; set; }
|
||||
|
||||
public Vector3 Scale { get; set; }
|
||||
public Vector4 Rotation { get; set; }
|
||||
public Vector3 Translation { get; set; }
|
||||
}
|
||||
|
||||
public class TriggerList
|
||||
{
|
||||
public List<Trigger> Triggers = new List<Trigger>();
|
||||
}
|
||||
|
||||
public class Trigger
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public int StartFrame { get; set; }
|
||||
public int EndFrame { get; set; }
|
||||
}
|
||||
|
||||
public class TriggerParameter
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public byte Type { get; set; }
|
||||
|
||||
//float, byte, int, string
|
||||
public object Value { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
@ -582,7 +582,8 @@ namespace FirstPlugin
|
||||
{
|
||||
TextureData texData = new TextureData(tex, BinaryTexFile);
|
||||
Nodes.Add(texData);
|
||||
Textures.Add(tex.Name, texData);
|
||||
if (!Textures.ContainsKey(tex.Name))
|
||||
Textures.Add(tex.Name, texData);
|
||||
}
|
||||
BinaryTexFile.Textures.Clear(); //We don't need these in memeory anymore
|
||||
BinaryTexFile.TextureDict.Clear();
|
||||
|
@ -355,6 +355,7 @@
|
||||
<Compile Include="FileFormats\NLG\PunchOutWii\PO_VertexAttribute.cs" />
|
||||
<Compile Include="FileFormats\Pikmin1\MOD.cs" />
|
||||
<Compile Include="FileFormats\Pikmin1\TXE.cs" />
|
||||
<Compile Include="FileFormats\Pokemon\GFBANIM\GFBANM.cs" />
|
||||
<Compile Include="FileFormats\Rom\3DS\NCSDStructs.cs" />
|
||||
<Compile Include="FileFormats\Rom\3DS\NCSD.cs" />
|
||||
<Compile Include="FileFormats\Rom\3DS\RomFS.cs" />
|
||||
@ -633,8 +634,8 @@
|
||||
<Compile Include="GUI\BMD\BMDModelImportSettings.Designer.cs">
|
||||
<DependentUpon>BMDModelImportSettings.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="FileFormats\GFBMDL\GFBMDL.cs" />
|
||||
<Compile Include="FileFormats\GFBMDL\GFBMDL_Wrappers.cs" />
|
||||
<Compile Include="FileFormats\Pokemon\GFBMDL\GFBMDL.cs" />
|
||||
<Compile Include="FileFormats\Pokemon\GFBMDL\GFBMDL_Wrappers.cs" />
|
||||
<Compile Include="FileFormats\GMX\GMX.cs" />
|
||||
<Compile Include="FileFormats\Hashes\SAHT.cs" />
|
||||
<Compile Include="FileFormats\MKAGPDX\MKAGPDX_Model.cs" />
|
||||
|
@ -60,6 +60,7 @@
|
||||
this.deleteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.copyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.copyDataAsTextToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.stPanel3 = new Toolbox.Library.Forms.STPanel();
|
||||
this.contextMenuStrip1.SuspendLayout();
|
||||
this.stPanel1.SuspendLayout();
|
||||
this.stTabControl1.SuspendLayout();
|
||||
@ -226,6 +227,7 @@
|
||||
this.columnHeader3});
|
||||
this.listViewCustom1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.listViewCustom1.FullRowSelect = true;
|
||||
this.listViewCustom1.HideSelection = false;
|
||||
this.listViewCustom1.Location = new System.Drawing.Point(0, 0);
|
||||
this.listViewCustom1.Name = "listViewCustom1";
|
||||
this.listViewCustom1.OwnerDraw = true;
|
||||
@ -252,6 +254,7 @@
|
||||
//
|
||||
// tabPage2
|
||||
//
|
||||
this.tabPage2.Controls.Add(this.stPanel3);
|
||||
this.tabPage2.Controls.Add(this.btnToXml);
|
||||
this.tabPage2.Controls.Add(this.stPanel2);
|
||||
this.tabPage2.Controls.Add(this.btnXmlToByaml);
|
||||
@ -305,50 +308,60 @@
|
||||
this.copyToolStripMenuItem,
|
||||
this.copyDataAsTextToolStripMenuItem});
|
||||
this.stContextMenuStrip1.Name = "stContextMenuStrip1";
|
||||
this.stContextMenuStrip1.Size = new System.Drawing.Size(181, 158);
|
||||
this.stContextMenuStrip1.Size = new System.Drawing.Size(166, 136);
|
||||
//
|
||||
// addItemToolStripMenuItem
|
||||
//
|
||||
this.addItemToolStripMenuItem.Name = "addItemToolStripMenuItem";
|
||||
this.addItemToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.addItemToolStripMenuItem.Size = new System.Drawing.Size(165, 22);
|
||||
this.addItemToolStripMenuItem.Text = "Add Item";
|
||||
this.addItemToolStripMenuItem.Click += new System.EventHandler(this.addNodeToolStripMenuItem_Click);
|
||||
//
|
||||
// editToolStripMenuItem
|
||||
//
|
||||
this.editToolStripMenuItem.Name = "editToolStripMenuItem";
|
||||
this.editToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.editToolStripMenuItem.Size = new System.Drawing.Size(165, 22);
|
||||
this.editToolStripMenuItem.Text = "Edit";
|
||||
this.editToolStripMenuItem.Click += new System.EventHandler(this.editValueNodeMenuItem_Click);
|
||||
//
|
||||
// renameToolStripMenuItem
|
||||
//
|
||||
this.renameToolStripMenuItem.Name = "renameToolStripMenuItem";
|
||||
this.renameToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.renameToolStripMenuItem.Size = new System.Drawing.Size(165, 22);
|
||||
this.renameToolStripMenuItem.Text = "Rename";
|
||||
this.renameToolStripMenuItem.Click += new System.EventHandler(this.renameToolStripMenuItem_Click);
|
||||
//
|
||||
// deleteToolStripMenuItem
|
||||
//
|
||||
this.deleteToolStripMenuItem.Name = "deleteToolStripMenuItem";
|
||||
this.deleteToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.deleteToolStripMenuItem.Size = new System.Drawing.Size(165, 22);
|
||||
this.deleteToolStripMenuItem.Text = "Delete";
|
||||
this.deleteToolStripMenuItem.Click += new System.EventHandler(this.deleteToolStripMenuItem_Click);
|
||||
//
|
||||
// copyToolStripMenuItem
|
||||
//
|
||||
this.copyToolStripMenuItem.Name = "copyToolStripMenuItem";
|
||||
this.copyToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.copyToolStripMenuItem.Size = new System.Drawing.Size(165, 22);
|
||||
this.copyToolStripMenuItem.Text = "Copy item as text";
|
||||
this.copyToolStripMenuItem.Click += new System.EventHandler(this.copyToolStripMenuItem_Click);
|
||||
//
|
||||
// copyDataAsTextToolStripMenuItem
|
||||
//
|
||||
this.copyDataAsTextToolStripMenuItem.Name = "copyDataAsTextToolStripMenuItem";
|
||||
this.copyDataAsTextToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.copyDataAsTextToolStripMenuItem.Size = new System.Drawing.Size(165, 22);
|
||||
this.copyDataAsTextToolStripMenuItem.Text = "Copy data as text";
|
||||
this.copyDataAsTextToolStripMenuItem.Click += new System.EventHandler(this.copyDataAsTextToolStripMenuItem_Click);
|
||||
//
|
||||
// stPanel3
|
||||
//
|
||||
this.stPanel3.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.stPanel3.Location = new System.Drawing.Point(15, 35);
|
||||
this.stPanel3.Name = "stPanel3";
|
||||
this.stPanel3.Size = new System.Drawing.Size(520, 328);
|
||||
this.stPanel3.TabIndex = 3;
|
||||
//
|
||||
// ByamlEditor
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
@ -404,5 +417,6 @@
|
||||
private Toolbox.Library.Forms.STButton btnToXml;
|
||||
private System.Windows.Forms.ToolStripMenuItem copyToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem copyDataAsTextToolStripMenuItem;
|
||||
private Toolbox.Library.Forms.STPanel stPanel3;
|
||||
}
|
||||
}
|
@ -92,7 +92,7 @@ namespace FirstPlugin
|
||||
ParseBymlFirstNode();
|
||||
|
||||
xmlEditor = new TextEditor();
|
||||
stPanel2.Controls.Add(xmlEditor);
|
||||
stPanel3.Controls.Add(xmlEditor);
|
||||
xmlEditor.Dock = DockStyle.Fill;
|
||||
xmlEditor.IsXML = true;
|
||||
}
|
||||
|
@ -347,6 +347,7 @@ namespace FirstPlugin
|
||||
Formats.Add(typeof(IGA_PAK));
|
||||
Formats.Add(typeof(MKAGPDX_Model));
|
||||
Formats.Add(typeof(GFBMDL));
|
||||
// Formats.Add(typeof(GFBANM));
|
||||
Formats.Add(typeof(Turbo.Course_MapCamera_bin));
|
||||
Formats.Add(typeof(SDF));
|
||||
Formats.Add(typeof(IStorage));
|
||||
|
@ -119,7 +119,7 @@ namespace Toolbox.Library.IO
|
||||
{
|
||||
using (TemporarySeek(position, System.IO.SeekOrigin.Begin))
|
||||
{
|
||||
Write((uint)endPosition - startPosition);
|
||||
Write((uint)(endPosition - startPosition));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -809,7 +809,7 @@ namespace Toolbox.Library
|
||||
else if (f.Matches("FLIM")) return ".bclim";
|
||||
else if (f.Matches("FLAN")) return ".bflan";
|
||||
else if (f.Matches("FSEQ")) return ".bfseq";
|
||||
else if (f.Matches("VFXB")) return ".pctl";
|
||||
else if (f.Matches("VFXB")) return ".ptcl";
|
||||
else if (f.Matches("AAHS")) return ".sharc";
|
||||
else if (f.Matches("BAHS")) return ".sharcb";
|
||||
else if (f.Matches("BNTX")) return ".bntx";
|
||||
|
Loading…
x
Reference in New Issue
Block a user