From fef8460f08fe9e5f26a1b02efc2a52f6c19cc810 Mon Sep 17 00:00:00 2001 From: Skyth <19259897+blueskythlikesclouds@users.noreply.github.com> Date: Fri, 11 Oct 2019 21:50:08 +0300 Subject: [PATCH] Fix PAC file naming & update credits --- .../FileFormats/HedgehogEngine/PACx.cs | 50 +-- README.md | 325 +++++++++--------- Toolbox/GUI/Credits.resx | 263 +++++++------- 3 files changed, 324 insertions(+), 314 deletions(-) diff --git a/File_Format_Library/FileFormats/HedgehogEngine/PACx.cs b/File_Format_Library/FileFormats/HedgehogEngine/PACx.cs index 2762b613..ee94e14a 100644 --- a/File_Format_Library/FileFormats/HedgehogEngine/PACx.cs +++ b/File_Format_Library/FileFormats/HedgehogEngine/PACx.cs @@ -105,8 +105,7 @@ namespace HedgehogLibrary PacNodeTree tree = new PacNodeTree(); tree.Read(reader, header3); - var rootNode = tree.RootNode; - LoadTree(rootNode); + LoadTree(tree); } else { @@ -172,8 +171,7 @@ namespace HedgehogLibrary PacNodeTree tree = new PacNodeTree(); tree.Read(reader, header3); - var rootNode = tree.RootNode; - LoadTree(rootNode, splitName); + LoadTree(tree); if (header3.SplitCount != 0) { @@ -307,23 +305,33 @@ namespace HedgehogLibrary // PAC has splits HasSplit = 5 } - - public void LoadTree(PacNode node, string fullPath = "") + + private void LoadNode(PacNode node, string fullPath) { - bool IsFile = node.HasData && node.Data != null; + if (!string.IsNullOrEmpty(node.Name)) + fullPath += node.Name; - if (IsFile) + if (node.HasData && node.Data is byte[]) { - FileEntry newNode = new FileEntry(node); - newNode.FileName = $"{fullPath}.{newNode.Name}"; - files.Add(newNode); + var fileEntry = new FileEntry(node); + fileEntry.FileName = $"{fullPath}.{node.Extension}"; + fileEntry.Name = fileEntry.FileName; + files.Add(fileEntry); } + else if (node.HasData && node.Data is PacNodeTree) + { + LoadTree((PacNodeTree)node.Data); + } + else + { + foreach (var childNode in node.Children) + LoadNode(childNode, fullPath); + } + } - if (node.Name != "Node" && node.Name != null) - fullPath += $"/{node.Name}"; - - for (int i = 0; i < node.Children.Count; i++) - LoadTree(node.Children[i], fullPath); + public void LoadTree(PacNodeTree nodeTree) + { + LoadNode(nodeTree.RootNode, string.Empty); } public class FileEntry : ArchiveFileInfo @@ -331,7 +339,7 @@ namespace HedgehogLibrary public FileEntry(PacNode node) { Name = node.Name; - FileData = node.Data; + FileData = node.Data as byte[]; if (node.Name == null) Name = "File Node"; if (FileData == null) FileData = new byte[0]; } @@ -360,11 +368,12 @@ namespace HedgehogLibrary { public HeaderV3 PacFile; - public byte[] Data; + public object Data; public PacNodeTree ParentTree; public string Name { get; set; } public bool HasData { get; set; } + public string Extension { get; set; } public List Children = new List(); public DataType DataType; @@ -421,8 +430,7 @@ namespace HedgehogLibrary if (extensionOffset != 0) { reader.SeekBegin((long)extensionOffset); - string extension = reader.ReadZeroTerminatedString(); - Name += extension; + Extension = reader.ReadZeroTerminatedString(); } if (dataBlockOffset != 0) @@ -436,7 +444,7 @@ namespace HedgehogLibrary reader.SeekBegin((long)dataOffset); PacNodeTree tree = new PacNodeTree(); tree.Read(reader, PacFile); - Children.Add(tree.RootNode); + Data = tree; } } if (childIndicesOffset != 0) diff --git a/README.md b/README.md index 2cc384b6..fd3d01cc 100644 --- a/README.md +++ b/README.md @@ -1,162 +1,163 @@ -# Switch-Toolbox -A tool to edit many formats of Nintendo Switch and Wii U. - -## Changelog 1.0 Experimental / BETA -https://docs.google.com/spreadsheets/d/16JLhGBJL5U5hpKWspL-pzYIaRL23X1YKEmia6pbsGbc/edit#gid=1386834576 - -## Releases -https:/c/github.com/KillzXGaming/Switch-Toolbox/releases - -## Discord -https://discord.gg/eyvGXWP - -## Features - -This tool currently features: -- BFRES - - Fully supports Wii U and Switch. - - Model importing (dae, fbx, obj, and csv) - - Material editing (Render info, texture mapping, parameters, etc) - - Material copying - - Animation and model sub section can be exported/imported. - - Can delete, add, replace individual objects from an fmdl. - - Can create new sub sections and data - - Can preview skeletal, SRT, param, texture pattern, and bone visual animations. (Param ones will vary) - - Can export and import fully rigged models with bone support. - - Can convert gif files to texture pattern animations. Very WIP atm. - -Can Edit Formats -- BFRES -- BNTX -- NUTEXB -- XTX -- GTX -- SARC -- BARS -- KCL -- BFLIM -- GFPAK -- BEA -- AAMP (Wii U and Switch) -- BYAML/BYML (Wii U, 3DS, and Switch) -- PTCL (Wii U, 3DS, and Switch) -- TMPK -- PAK/IGA (Crash Bandicoot/Crash Team Racing) -- IGZ Textures (Crash Bandicoot/Crash Team Racing) -- BFFNT (Textures only) - -Can Preview - -- BCRES - - Models, materials, and textures. -- BFSHA - - Can view options, samplers, attributes, and uniform blocks. -- BNSH - - Can extract shader vertex and fragment shaders from variations/programs -- SHARCFB and SHARC - - Basic preview of some shader program data. - - Can edit both v1 and v2 AAMP (Wii U and Switch) -- EFC - - Can preview effect tables and link PTCL. -- NUT - - Can preview NTWU, NTP3, and NTWD variants. Editng will be soon -- MSBT - - Very basic previewing. -- MP3, OGG, IDSP, HPS, WAV, BFWAV, BFSTM, BCWAV, BCWAV - - Can listen to audio and convert between certain formats. Thanks to VGAudio and CSCore -- NARC -- SP2 (Team Sonic Racing) -- GFMDL -- TEX (3DS) -- NUSHDB (Switch Namco Shaders) -- SDF (Snow Drop Engine) -- NCA -- NSP -- IStorage -- NXARC -- LZARC -- IGA .pak -- RARC -- GMX (TPHD Models) -- MKAGPDX Model .bin files -- MKAGPDX Archive .pac files -- ME01 and SA01 archives. -- Luigi's Mansion 2 Dark Moon (archives, models, and textures) -- TPL -- TXE -- BTI -- G1T -- CMB (OOT3D, MM3D, LM3DS) -- CTXB (OOT3D, MM3D, LM3DS) -- GAR (OOT3D, MM3D, LM3DS) -- ZSI (OOT3D, MM3D) -- BinGZ (Hyrule Warriors) -- PAC (Sonic Forces) -- Gamecube ISOs (file system) - - -## Tutorials -https://github.com/KillzXGaming/Switch-Toolbox/wiki - -## Issues or Requests -https://github.com/KillzXGaming/Switch-Toolbox/issues - -## Building -To build make sure you have Visual Studio installed (I use 2017, older versions may not work) and open the .sln. Then build the solution as release. It should compile properly on the latest. - -In the event that the tool cannot compile, check references. All the libraries are stored in Switch-Toolbox/Lib folder. - -## Credits - -- Smash Forge Devs (SMG, Ploaj, jam1garner, smb123w64gb, etc) for some code ported over. Specifically animation stuff and some rendering. -- Assimp devs for their massive asset library! -- Wexos (helped figure out a few things, ie format list to assign each attribute) -- JuPaHe64 for the base 3D renderer. -- Every File Explorer devs (Gericom) for Yaz0 and bitmap font stuff -- Exelix for Byaml, Sarc and KCL library -- Syroot for helpful IO extensions and libraries -- GDKChan for PICA shaders stuff used with bcres, structs for bcres, and some DDS decode methods -- AboodXD for some foundation stuff with exelix's SARC library, Wii U (GPU7) and Switch (Tegra X1) textures swizzling, reading/converting uncompressed types for DDS, and documentation for GTX, XTX, and BNTX -- MelonSpeedruns for logo. -- BrawlBox team for brawl libaries used for brres parsing. -- Sage of Mirrors for SuperBMDLib. -- Ambrosia for BTI and TXE support. -- Kuriimu for some IO and file parsing help - -## Resources -- [Treeview Icons by icons8](https://icons8.com/) -- Smash Forge (Currently placeholders) - -## Documentation (File Formats) -- http://mk8.tockdom.com/wiki/ -- https://wiki.oatmealdome.me/Category:File_formats -- https://github.com/Kinnay/Nintendo-File-Formats/wiki -- http://Avsys.xyz/wiki/Category:File_Formats - -## Libraries -- [SuperBMDLib] (https://github.com/Sage-of-Mirrors/SuperBMD) -- [Brawl Lib (for brres section conversion)](https://github.com/libertyernie/brawltools) -- [Exelix (Sarc, kcl, and byml libraries)](https://github.com/exelix11/EditorCore/tree/master/FileFormatPlugins) -- [ZstdNet (Compression)](https://github.com/skbkontur/ZstdNet) -- [Be.HexEditor by Bernhard Elbl](https://sourceforge.net/projects/hexbox/) -- GL EditorFramwork by jupahe64 -- [WeifenLuo for docking suite](http://dockpanelsuite.com/) -- [SF Graphics by SMG (Experimental](https://github.com/ScanMountGoat/SFGraphics) (currently just a placeholder for shader workflow and some useful things) -- [Audio & MIDI library](https://github.com/naudio/NAudio) -- [VGAudio](https://github.com/Thealexbarney/VGAudio) -- [CSCore](https://github.com/filoe/cscore) -- [Assimp](https://bitbucket.org/Starnick/assimpnet/src/master/) -- [OpenTK](https://github.com/opentk/opentk) -- [BezelEngineArchive Library](https://github.com/KillzXGaming/BEA-Library-Editor) -- [Syroot BinaryData](https://gitlab.com/Syroot/BinaryData) -- [Syroot Maths](https://gitlab.com/Syroot/Maths) -- [Syroot Bfres Library (Wii U)](https://gitlab.com/Syroot/NintenTools.Bfres) -- [LibHac](https://github.com/Thealexbarney/LibHac) - -## Helpful Tools -- https://github.com/IcySon55/Kuriimu - -License - in Switch_Toolbox\Lib\Licenses - - Please note if you do not want your library used or if i'm missing credits! +# Switch-Toolbox +A tool to edit many formats of Nintendo Switch and Wii U. + +## Changelog 1.0 Experimental / BETA +https://docs.google.com/spreadsheets/d/16JLhGBJL5U5hpKWspL-pzYIaRL23X1YKEmia6pbsGbc/edit#gid=1386834576 + +## Releases +https:/c/github.com/KillzXGaming/Switch-Toolbox/releases + +## Discord +https://discord.gg/eyvGXWP + +## Features + +This tool currently features: +- BFRES + - Fully supports Wii U and Switch. + - Model importing (dae, fbx, obj, and csv) + - Material editing (Render info, texture mapping, parameters, etc) + - Material copying + - Animation and model sub section can be exported/imported. + - Can delete, add, replace individual objects from an fmdl. + - Can create new sub sections and data + - Can preview skeletal, SRT, param, texture pattern, and bone visual animations. (Param ones will vary) + - Can export and import fully rigged models with bone support. + - Can convert gif files to texture pattern animations. Very WIP atm. + +Can Edit Formats +- BFRES +- BNTX +- NUTEXB +- XTX +- GTX +- SARC +- BARS +- KCL +- BFLIM +- GFPAK +- BEA +- AAMP (Wii U and Switch) +- BYAML/BYML (Wii U, 3DS, and Switch) +- PTCL (Wii U, 3DS, and Switch) +- TMPK +- PAK/IGA (Crash Bandicoot/Crash Team Racing) +- IGZ Textures (Crash Bandicoot/Crash Team Racing) +- BFFNT (Textures only) + +Can Preview + +- BCRES + - Models, materials, and textures. +- BFSHA + - Can view options, samplers, attributes, and uniform blocks. +- BNSH + - Can extract shader vertex and fragment shaders from variations/programs +- SHARCFB and SHARC + - Basic preview of some shader program data. + - Can edit both v1 and v2 AAMP (Wii U and Switch) +- EFC + - Can preview effect tables and link PTCL. +- NUT + - Can preview NTWU, NTP3, and NTWD variants. Editng will be soon +- MSBT + - Very basic previewing. +- MP3, OGG, IDSP, HPS, WAV, BFWAV, BFSTM, BCWAV, BCWAV + - Can listen to audio and convert between certain formats. Thanks to VGAudio and CSCore +- NARC +- SP2 (Team Sonic Racing) +- GFMDL +- TEX (3DS) +- NUSHDB (Switch Namco Shaders) +- SDF (Snow Drop Engine) +- NCA +- NSP +- IStorage +- NXARC +- LZARC +- IGA .pak +- RARC +- GMX (TPHD Models) +- MKAGPDX Model .bin files +- MKAGPDX Archive .pac files +- ME01 and SA01 archives. +- Luigi's Mansion 2 Dark Moon (archives, models, and textures) +- TPL +- TXE +- BTI +- G1T +- CMB (OOT3D, MM3D, LM3DS) +- CTXB (OOT3D, MM3D, LM3DS) +- GAR (OOT3D, MM3D, LM3DS) +- ZSI (OOT3D, MM3D) +- BinGZ (Hyrule Warriors) +- PAC (Sonic Forces) +- Gamecube ISOs (file system) + + +## Tutorials +https://github.com/KillzXGaming/Switch-Toolbox/wiki + +## Issues or Requests +https://github.com/KillzXGaming/Switch-Toolbox/issues + +## Building +To build make sure you have Visual Studio installed (I use 2017, older versions may not work) and open the .sln. Then build the solution as release. It should compile properly on the latest. + +In the event that the tool cannot compile, check references. All the libraries are stored in Switch-Toolbox/Lib folder. + +## Credits + +- Smash Forge Devs (SMG, Ploaj, jam1garner, smb123w64gb, etc) for some code ported over. Specifically animation stuff and some rendering. +- Assimp devs for their massive asset library! +- Wexos (helped figure out a few things, ie format list to assign each attribute) +- JuPaHe64 for the base 3D renderer. +- Every File Explorer devs (Gericom) for Yaz0 and bitmap font stuff +- Exelix for Byaml, Sarc and KCL library +- Syroot for helpful IO extensions and libraries +- GDKChan for PICA shaders stuff used with bcres, structs for bcres, and some DDS decode methods +- AboodXD for some foundation stuff with exelix's SARC library, Wii U (GPU7) and Switch (Tegra X1) textures swizzling, reading/converting uncompressed types for DDS, and documentation for GTX, XTX, and BNTX +- MelonSpeedruns for logo. +- BrawlBox team for brawl libaries used for brres parsing. +- Sage of Mirrors for SuperBMDLib. +- Ambrosia for BTI and TXE support. +- Kuriimu for some IO and file parsing help +- Skyth and Radfordhound for PAC documentation + +## Resources +- [Treeview Icons by icons8](https://icons8.com/) +- Smash Forge (Currently placeholders) + +## Documentation (File Formats) +- http://mk8.tockdom.com/wiki/ +- https://wiki.oatmealdome.me/Category:File_formats +- https://github.com/Kinnay/Nintendo-File-Formats/wiki +- http://Avsys.xyz/wiki/Category:File_Formats + +## Libraries +- [SuperBMDLib] (https://github.com/Sage-of-Mirrors/SuperBMD) +- [Brawl Lib (for brres section conversion)](https://github.com/libertyernie/brawltools) +- [Exelix (Sarc, kcl, and byml libraries)](https://github.com/exelix11/EditorCore/tree/master/FileFormatPlugins) +- [ZstdNet (Compression)](https://github.com/skbkontur/ZstdNet) +- [Be.HexEditor by Bernhard Elbl](https://sourceforge.net/projects/hexbox/) +- GL EditorFramwork by jupahe64 +- [WeifenLuo for docking suite](http://dockpanelsuite.com/) +- [SF Graphics by SMG (Experimental](https://github.com/ScanMountGoat/SFGraphics) (currently just a placeholder for shader workflow and some useful things) +- [Audio & MIDI library](https://github.com/naudio/NAudio) +- [VGAudio](https://github.com/Thealexbarney/VGAudio) +- [CSCore](https://github.com/filoe/cscore) +- [Assimp](https://bitbucket.org/Starnick/assimpnet/src/master/) +- [OpenTK](https://github.com/opentk/opentk) +- [BezelEngineArchive Library](https://github.com/KillzXGaming/BEA-Library-Editor) +- [Syroot BinaryData](https://gitlab.com/Syroot/BinaryData) +- [Syroot Maths](https://gitlab.com/Syroot/Maths) +- [Syroot Bfres Library (Wii U)](https://gitlab.com/Syroot/NintenTools.Bfres) +- [LibHac](https://github.com/Thealexbarney/LibHac) + +## Helpful Tools +- https://github.com/IcySon55/Kuriimu + +License + in Switch_Toolbox\Lib\Licenses + + Please note if you do not want your library used or if i'm missing credits! diff --git a/Toolbox/GUI/Credits.resx b/Toolbox/GUI/Credits.resx index 7ac5d9dc..8d635d1d 100644 --- a/Toolbox/GUI/Credits.resx +++ b/Toolbox/GUI/Credits.resx @@ -1,132 +1,133 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - Smash Forge Devs (SMG, Ploaj, jam1garner, smb123w64gb, etc) for some code ported over. Specifically animation stuff and some rendering. -- Assimp devs for their massive asset library! -- Wexos (helped figure out a few things, ie format list to assign each attribute) -- JuPaHe64 for the base 3D renderer and timeline control. -- Every File Explorer devs (Gericom) for Yaz0 stuff -- Exelix for Byaml, Sarc and KCL library -- Syroot for helpful IO extensions and libraies -- GDK Chan for some DDS decode methods -- AboodXD for BNTX texture swizzling -- MelonSpeedruns for logo. - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + - Smash Forge Devs (SMG, Ploaj, jam1garner, smb123w64gb, etc) for some code ported over. Specifically animation stuff and some rendering. +- Assimp devs for their massive asset library! +- Wexos (helped figure out a few things, ie format list to assign each attribute) +- JuPaHe64 for the base 3D renderer and timeline control. +- Every File Explorer devs (Gericom) for Yaz0 stuff +- Exelix for Byaml, Sarc and KCL library +- Syroot for helpful IO extensions and libraies +- GDK Chan for some DDS decode methods +- AboodXD for BNTX texture swizzling +- MelonSpeedruns for logo. +- Skyth and Radfordhound for PAC documentation + \ No newline at end of file