diff --git a/.vs/Toolbox/v15/.suo b/.vs/Toolbox/v15/.suo index 7df3d11a..594439d3 100644 Binary files a/.vs/Toolbox/v15/.suo and b/.vs/Toolbox/v15/.suo differ diff --git a/File_Format_Library/Actors/BotwActorLoader.cs b/File_Format_Library/Actors/BotwActorLoader.cs new file mode 100644 index 00000000..5e19aef1 --- /dev/null +++ b/File_Format_Library/Actors/BotwActorLoader.cs @@ -0,0 +1,230 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using Toolbox.Library; +using Toolbox.Library.Forms; +using System.IO; + +namespace FirstPlugin +{ + /// + /// A class that holds methods to load actor data for botw. + /// + public class BotwActorLoader + { + private static string ActorPath = $"/Actor/Pack/"; + private static string CachedActorsPath = $"/Pack/"; + + public enum ActorCategory + { + Armour, + Animal, + Weapon, + Item, + Enemy, + Npc, + } + + public class ActorDefineInfo + { + public string Name { get; set; } + + public ActorDefineInfo(string name) + { + Name = name; + } + } + + public static Dictionary ArmorActorDefine = new Dictionary() + { + {"001", new ActorDefineInfo("Hylian Tunic Set") }, + {"002",new ActorDefineInfo("Hylian Tunic Set Upgraded") }, + {"003",new ActorDefineInfo("Hylian Tunic Set Upgraded 2") }, + {"004",new ActorDefineInfo("Hylian Tunic Set Upgraded 3") }, + {"005",new ActorDefineInfo("Tunic of the Wild Set") }, + {"006",new ActorDefineInfo("Zora Set") }, + {"007",new ActorDefineInfo("Zora Set Upgraded") }, + {"008",new ActorDefineInfo("Desert Voe Set") }, + {"009",new ActorDefineInfo("Snowquill Set" )}, + {"011",new ActorDefineInfo("Flamebreaker Set") }, + {"012",new ActorDefineInfo("Stealth Set" )}, + {"014",new ActorDefineInfo("Climbing Gear Set" )}, + {"017",new ActorDefineInfo("Radiant Set" )}, + {"020",new ActorDefineInfo("Soldier's Armor Set" )}, + {"021",new ActorDefineInfo("Ancient Set") }, + {"022",new ActorDefineInfo("Bokoblin Mask") }, + {"024",new ActorDefineInfo("Diamond Circlet") }, + {"025",new ActorDefineInfo("Ruby Circlet") }, + {"026",new ActorDefineInfo("Sapphire Circlet") }, + {"027",new ActorDefineInfo("Topaz Circlet") }, + {"028",new ActorDefineInfo("Opal Circlet") }, + {"029",new ActorDefineInfo("Amber Circlet") }, + }; + + private ObjectEditor editor; + + public BotwActorLoader() + { + editor = new ObjectEditor(); + editor.Text = "Actor Editor BOTW"; + LibraryGUI.CreateMdiWindow(editor); + + LoadActors(); + } + + private void LoadActors() + { + //Setup a list of nodes based on category + TreeNode ArmourFolder = new TreeNode("Armours"); + TreeNode WeaponsFolder = new TreeNode("Weapons"); + TreeNode ItemsFolder = new TreeNode("Items"); + TreeNode EnemyFolder = new TreeNode("Enemies"); + + if (!Directory.Exists(Runtime.BotwGamePath)) + { + bool IsValid = NotifySetGamePath(); + if (!IsValid) //Give up loading it if it's wrong + return; + } + + //Load all our actors into a class + foreach (var file in Directory.GetFiles($"{Runtime.BotwGamePath}{ActorPath}")) + { + string name = Path.GetFileNameWithoutExtension(file); + + var actorType = name.Split('_').First(); + var actorID = name.Split('_').Skip(1).FirstOrDefault(); + var actorProperty = name.Split('_').Last(); + + if (actorType == "Armor") + { + if (ArmorActorDefine.ContainsKey(actorID)) + { + ActorDefineInfo info = ArmorActorDefine[actorID]; + + ActorEntry entry = new ActorEntry(); + entry.Text = info.Name; + entry.FilePath = file; + entry.FileName = name; + entry.Category = ActorCategory.Armour; + ArmourFolder.Nodes.Add(entry); + } + } + else if (actorType == "Animal") + { + + } + else if (actorType == "Npc") + { + + } + } + + //The game also caches certain actors to the pack folder at boot + + + if (ArmourFolder.Nodes.Count != 0) + editor.AddNode(ArmourFolder); + if (EnemyFolder.Nodes.Count != 0) + editor.AddNode(EnemyFolder); + if (ItemsFolder.Nodes.Count != 0) + editor.AddNode(ItemsFolder); + if (WeaponsFolder.Nodes.Count != 0) + editor.AddNode(WeaponsFolder); + } + + private bool NotifySetGamePath() + { + string dir = ""; + + var result = MessageBox.Show("Please set your game path for botw", "Actor Loader", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + if (result == DialogResult.OK) + { + FolderSelectDialog folderSelect = new FolderSelectDialog(); + if (folderSelect.ShowDialog() == DialogResult.OK) + { + dir = folderSelect.SelectedPath; + Runtime.BotwGamePath = dir; + Config.Save(); + } + } + + return IsValidDirectory(dir); + } + + private bool IsValidDirectory(string directory) + { + bool HasActors = Directory.Exists($"{directory}\\Actor"); + return HasActors ; + } + + /// + /// A container for multiple actors that link to each other. + /// + public class ActorCotainer : TreeNodeCustom + { + public List SubActors = new List(); + } + + public class ActorEntry : TreeNodeCustom + { + public string FileName { get; set; } + public string FilePath { get; set; } + + public ActorCategory Category { get; set; } + + public ActorParameters Parameters { get; set; } + public ActorModel Models { get; set; } + public ActorTextures Textures { get; set; } + + public void ReloadActorProperties() + { + Textures = new ActorTextures(); + Models = new ActorModel(); + Parameters = new ActorParameters(); + + //Load our texture paths if they exist + + } + + public override void OnClick(TreeView treeview) + { + + } + } + + public class ActorParameters + { + + } + + public class ActorTextures + { + /// + /// The file path for the main texture data (no mips for wii u) + /// For Switch this stores both + /// + public string FilePathTex1 { get; set; } + + /// + /// The file path for the mip map texture data (for wii u) + /// + public string FilePathTex2 { get; set; } + } + + public class ActorModel + { + /// + /// The file path that stores the model for an actor + /// + public string FilePathModel { get; set; } + + /// + /// The file path that stores the animation for an actor + /// + public string FilePathAnimation { get; set; } + } + } +} diff --git a/File_Format_Library/File_Format_Library.csproj b/File_Format_Library/File_Format_Library.csproj index ebec51f3..0a2cc47f 100644 --- a/File_Format_Library/File_Format_Library.csproj +++ b/File_Format_Library/File_Format_Library.csproj @@ -201,6 +201,7 @@ + @@ -296,6 +297,12 @@ + + UserControl + + + ActorEditorBotw.cs + UserControl diff --git a/File_Format_Library/GUI/ActorEditorBotw.Designer.cs b/File_Format_Library/GUI/ActorEditorBotw.Designer.cs new file mode 100644 index 00000000..bd8a8bc8 --- /dev/null +++ b/File_Format_Library/GUI/ActorEditorBotw.Designer.cs @@ -0,0 +1,37 @@ +namespace FirstPlugin.Forms +{ + partial class ActorEditorBotw + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + components = new System.ComponentModel.Container(); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + } + + #endregion + } +} diff --git a/File_Format_Library/GUI/ActorEditorBotw.cs b/File_Format_Library/GUI/ActorEditorBotw.cs new file mode 100644 index 00000000..fc686dff --- /dev/null +++ b/File_Format_Library/GUI/ActorEditorBotw.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using Toolbox.Library.Forms; + +namespace FirstPlugin.Forms +{ + public partial class ActorEditorBotw : STUserControl + { + public ActorEditorBotw() + { + InitializeComponent(); + } + } +} diff --git a/File_Format_Library/Main.cs b/File_Format_Library/Main.cs index 3dafa8e4..86403c4d 100644 --- a/File_Format_Library/Main.cs +++ b/File_Format_Library/Main.cs @@ -101,6 +101,15 @@ namespace FirstPlugin toolsExt[1] = new STToolStripItem("Mario Kart 8"); toolsExt[1].DropDownItems.Add(new STToolStripItem("Probe Light Converter", GenerateProbeLightBounds)); + + + // toolsExt[2] = new STToolStripItem("Breath Of The Wild"); + // toolsExt[2].DropDownItems.Add(new STToolStripItem("Actor Editor", ActorEditor)); + } + + private void ActorEditor(object sender, EventArgs args) + { + BotwActorLoader actorEditor = new BotwActorLoader(); } private void OpenKingdomSelector(object sender, EventArgs args) @@ -274,7 +283,7 @@ namespace FirstPlugin private Type[] LoadMenus() { List MenuItems = new List(); - // MenuItems.Add(typeof(MenuExt)); + MenuItems.Add(typeof(MenuExt)); return MenuItems.ToArray(); } diff --git a/Switch_Toolbox_Library/FileFormats/DDS.cs b/Switch_Toolbox_Library/FileFormats/DDS.cs index 68858410..a1f86071 100644 --- a/Switch_Toolbox_Library/FileFormats/DDS.cs +++ b/Switch_Toolbox_Library/FileFormats/DDS.cs @@ -18,7 +18,7 @@ using OpenTK.Graphics.OpenGL; namespace Toolbox.Library { //Data from https://github.com/jam1garner/Smash-Forge/blob/master/Smash%20Forge/Filetypes/Textures/DDS.cs - public class DDS : STGenericTexture, IFileFormat, ISingleTextureIconLoader, IContextMenuNode + public class DDS : STGenericTexture, IFileFormat, IContextMenuNode { public STGenericTexture IconTexture { get { return this; } } diff --git a/Switch_Toolbox_Library/Toolbox.Library.dll b/Switch_Toolbox_Library/Toolbox.Library.dll index ec3663ef..dbabffb6 100644 Binary files a/Switch_Toolbox_Library/Toolbox.Library.dll and b/Switch_Toolbox_Library/Toolbox.Library.dll differ diff --git a/Switch_Toolbox_Library/Toolbox.Library.pdb b/Switch_Toolbox_Library/Toolbox.Library.pdb index 26d31450..db87d843 100644 Binary files a/Switch_Toolbox_Library/Toolbox.Library.pdb and b/Switch_Toolbox_Library/Toolbox.Library.pdb differ