Add files for the new one.
Rework UI from scratch with proper themes and custom controls. MDI windows are now used for workspaces, comparing docs, and multiple usages. Tabs organise multiple workspaces and you can keep mdi windows maximized if you want to only use tabs. Themes currently include dark and white theme but plan to have XML files with list of color and styles
Alot of things optimized. UI is very fast and snappy now
Dae rigging fixed.
Dae bones can be imported.
Dae with textures can be imported and exported to a folder
Custom sampler editor for sampler data.
Texture refs, shader options, params, render info, and basically all material data can be added/removed and edited
User data editor
Update opengl framework by JuPaHe64 to the newest. Includes an origintation cube, multiple models in a scene, and many improvements
Skeleton can be viewed
GFPAK with some fixes in saving
NUTEXB has proper mip map viewing
PTCL Editor (Wii U and Switch). Can edit colors ( Wii U) and view textures. Also EFFN files in smash ultimate can be previewed
Files can be associated with the program and opened with on clicking them
ASTC textures can be viewed
UVs can be viewed. Includes wrap modes and also translating and scaling for some basic edits
Textures use a new editor. It includes channel viewing and some new editing options
Fixed black textures on some wii u bfres
Fixed saving sarcs in sarcs
Shortcut keys have been added in. CTRL + S can save the active file in the currently used window
Fix more issues with bfres crashing
File - New includes BNTX for creating new bntx files from scatch
Raw shader binaries can be extracted from bnsh and bfsha. Yuzu and Ryujinx can decompile these
Sharc files can have source data previewed and shader programs in XML
Aamp v1 and v2 data can be previewed. v1 can be edited and saved atm, v2 will be at a later update
Byaml uses it's own editor instead of a seperate window for easy saving within sarcs
Archives have a hex viewer
Dae exporting greatly improved and can export rigged meshes
Scene, shader param, srt, color, and texture pattern animations can all be previewed (in a list)
Memory usage is greatly improved
Narc (Nitro Archives) can be viewed and extracted.
Fixed importing TGA images
Support importing ASTC textures for bntx
Added in PBR lighting for bfres from my implimentaion in forge
Added gradient background for viewport. This can be edited in the settings
Added skybox background option for viewport. Can load cubemaps
Added grid with customizable cells for viewport.
DDS decompression no longer requires Direct X tex.
Zlib decompression has been improved for opening files that use it
Rigid bones are properly ordered on importing a mesh. May fix some exploding issues.
Endianness for KCL can be toggled for saving. Will be set to what it was using orignally
Tangents can be filled with a constant value. Will allow them to not cause seams nor flat lighting however normal maps may not work as good
Vertex buffers can be added and removed. Also re encoded
Parameters now use drop down panels with values for easier editing
Reworked the bone editor. Everything for a bone can be fully edited now besides the index, billboard index and parent index which get set automatically
Fixed animation scaling for skeletal animations finally!
Textures can be loaded in a tab now with thumbnail displaying for easy real time edits while previewing in the viewport
Fixed support for audio files to be big endian in BARS
Textures for switch now use their own folder. You can easily add textures to this and add textures to bfres that have no bntx. If there are no textures then the bfres will automatically not have one on save.
Animations are split into multiple sub sections for switch's material animation for easier access
Bfres for wii u has better binary exporting and is fully compatiable with Wexos Toolbox (to and from)
Every section can be added in as new for both wii u and switch.
Every section can be renamed properly and mostly everything can be edited. (Key frame editing and a more in depth curve editor later)
Added option to copy UV channel
Bone weights can be previewed
Tons of fixes for the switch bfres library with more games working. Splatoon 2 (more work now), BOTW, Kirby Star Allies, and more!
Fixed 3.3 Wii U bfres from not opening
Wii U Sharcfb files can have shader program data previewed (XML)
And possibly alot more things i missed! All this is still experimental but will improve over the next few weeks
2019-03-23 16:55:09 +00:00
using System ;
using System.Collections.Generic ;
using System.IO ;
2019-05-18 15:13:14 +00:00
using System.Linq ;
2019-05-27 22:00:03 +00:00
using System.ComponentModel ;
Add files for the new one.
Rework UI from scratch with proper themes and custom controls. MDI windows are now used for workspaces, comparing docs, and multiple usages. Tabs organise multiple workspaces and you can keep mdi windows maximized if you want to only use tabs. Themes currently include dark and white theme but plan to have XML files with list of color and styles
Alot of things optimized. UI is very fast and snappy now
Dae rigging fixed.
Dae bones can be imported.
Dae with textures can be imported and exported to a folder
Custom sampler editor for sampler data.
Texture refs, shader options, params, render info, and basically all material data can be added/removed and edited
User data editor
Update opengl framework by JuPaHe64 to the newest. Includes an origintation cube, multiple models in a scene, and many improvements
Skeleton can be viewed
GFPAK with some fixes in saving
NUTEXB has proper mip map viewing
PTCL Editor (Wii U and Switch). Can edit colors ( Wii U) and view textures. Also EFFN files in smash ultimate can be previewed
Files can be associated with the program and opened with on clicking them
ASTC textures can be viewed
UVs can be viewed. Includes wrap modes and also translating and scaling for some basic edits
Textures use a new editor. It includes channel viewing and some new editing options
Fixed black textures on some wii u bfres
Fixed saving sarcs in sarcs
Shortcut keys have been added in. CTRL + S can save the active file in the currently used window
Fix more issues with bfres crashing
File - New includes BNTX for creating new bntx files from scatch
Raw shader binaries can be extracted from bnsh and bfsha. Yuzu and Ryujinx can decompile these
Sharc files can have source data previewed and shader programs in XML
Aamp v1 and v2 data can be previewed. v1 can be edited and saved atm, v2 will be at a later update
Byaml uses it's own editor instead of a seperate window for easy saving within sarcs
Archives have a hex viewer
Dae exporting greatly improved and can export rigged meshes
Scene, shader param, srt, color, and texture pattern animations can all be previewed (in a list)
Memory usage is greatly improved
Narc (Nitro Archives) can be viewed and extracted.
Fixed importing TGA images
Support importing ASTC textures for bntx
Added in PBR lighting for bfres from my implimentaion in forge
Added gradient background for viewport. This can be edited in the settings
Added skybox background option for viewport. Can load cubemaps
Added grid with customizable cells for viewport.
DDS decompression no longer requires Direct X tex.
Zlib decompression has been improved for opening files that use it
Rigid bones are properly ordered on importing a mesh. May fix some exploding issues.
Endianness for KCL can be toggled for saving. Will be set to what it was using orignally
Tangents can be filled with a constant value. Will allow them to not cause seams nor flat lighting however normal maps may not work as good
Vertex buffers can be added and removed. Also re encoded
Parameters now use drop down panels with values for easier editing
Reworked the bone editor. Everything for a bone can be fully edited now besides the index, billboard index and parent index which get set automatically
Fixed animation scaling for skeletal animations finally!
Textures can be loaded in a tab now with thumbnail displaying for easy real time edits while previewing in the viewport
Fixed support for audio files to be big endian in BARS
Textures for switch now use their own folder. You can easily add textures to this and add textures to bfres that have no bntx. If there are no textures then the bfres will automatically not have one on save.
Animations are split into multiple sub sections for switch's material animation for easier access
Bfres for wii u has better binary exporting and is fully compatiable with Wexos Toolbox (to and from)
Every section can be added in as new for both wii u and switch.
Every section can be renamed properly and mostly everything can be edited. (Key frame editing and a more in depth curve editor later)
Added option to copy UV channel
Bone weights can be previewed
Tons of fixes for the switch bfres library with more games working. Splatoon 2 (more work now), BOTW, Kirby Star Allies, and more!
Fixed 3.3 Wii U bfres from not opening
Wii U Sharcfb files can have shader program data previewed (XML)
And possibly alot more things i missed! All this is still experimental but will improve over the next few weeks
2019-03-23 16:55:09 +00:00
using System.Windows.Forms ;
2019-07-16 21:35:21 +00:00
using Toolbox.Library.Forms ;
using Toolbox.Library.IO ;
2019-05-18 15:13:14 +00:00
using System.Text.RegularExpressions ;
Add files for the new one.
Rework UI from scratch with proper themes and custom controls. MDI windows are now used for workspaces, comparing docs, and multiple usages. Tabs organise multiple workspaces and you can keep mdi windows maximized if you want to only use tabs. Themes currently include dark and white theme but plan to have XML files with list of color and styles
Alot of things optimized. UI is very fast and snappy now
Dae rigging fixed.
Dae bones can be imported.
Dae with textures can be imported and exported to a folder
Custom sampler editor for sampler data.
Texture refs, shader options, params, render info, and basically all material data can be added/removed and edited
User data editor
Update opengl framework by JuPaHe64 to the newest. Includes an origintation cube, multiple models in a scene, and many improvements
Skeleton can be viewed
GFPAK with some fixes in saving
NUTEXB has proper mip map viewing
PTCL Editor (Wii U and Switch). Can edit colors ( Wii U) and view textures. Also EFFN files in smash ultimate can be previewed
Files can be associated with the program and opened with on clicking them
ASTC textures can be viewed
UVs can be viewed. Includes wrap modes and also translating and scaling for some basic edits
Textures use a new editor. It includes channel viewing and some new editing options
Fixed black textures on some wii u bfres
Fixed saving sarcs in sarcs
Shortcut keys have been added in. CTRL + S can save the active file in the currently used window
Fix more issues with bfres crashing
File - New includes BNTX for creating new bntx files from scatch
Raw shader binaries can be extracted from bnsh and bfsha. Yuzu and Ryujinx can decompile these
Sharc files can have source data previewed and shader programs in XML
Aamp v1 and v2 data can be previewed. v1 can be edited and saved atm, v2 will be at a later update
Byaml uses it's own editor instead of a seperate window for easy saving within sarcs
Archives have a hex viewer
Dae exporting greatly improved and can export rigged meshes
Scene, shader param, srt, color, and texture pattern animations can all be previewed (in a list)
Memory usage is greatly improved
Narc (Nitro Archives) can be viewed and extracted.
Fixed importing TGA images
Support importing ASTC textures for bntx
Added in PBR lighting for bfres from my implimentaion in forge
Added gradient background for viewport. This can be edited in the settings
Added skybox background option for viewport. Can load cubemaps
Added grid with customizable cells for viewport.
DDS decompression no longer requires Direct X tex.
Zlib decompression has been improved for opening files that use it
Rigid bones are properly ordered on importing a mesh. May fix some exploding issues.
Endianness for KCL can be toggled for saving. Will be set to what it was using orignally
Tangents can be filled with a constant value. Will allow them to not cause seams nor flat lighting however normal maps may not work as good
Vertex buffers can be added and removed. Also re encoded
Parameters now use drop down panels with values for easier editing
Reworked the bone editor. Everything for a bone can be fully edited now besides the index, billboard index and parent index which get set automatically
Fixed animation scaling for skeletal animations finally!
Textures can be loaded in a tab now with thumbnail displaying for easy real time edits while previewing in the viewport
Fixed support for audio files to be big endian in BARS
Textures for switch now use their own folder. You can easily add textures to this and add textures to bfres that have no bntx. If there are no textures then the bfres will automatically not have one on save.
Animations are split into multiple sub sections for switch's material animation for easier access
Bfres for wii u has better binary exporting and is fully compatiable with Wexos Toolbox (to and from)
Every section can be added in as new for both wii u and switch.
Every section can be renamed properly and mostly everything can be edited. (Key frame editing and a more in depth curve editor later)
Added option to copy UV channel
Bone weights can be previewed
Tons of fixes for the switch bfres library with more games working. Splatoon 2 (more work now), BOTW, Kirby Star Allies, and more!
Fixed 3.3 Wii U bfres from not opening
Wii U Sharcfb files can have shader program data previewed (XML)
And possibly alot more things i missed! All this is still experimental but will improve over the next few weeks
2019-03-23 16:55:09 +00:00
2019-07-16 21:35:21 +00:00
namespace Toolbox.Library
Add files for the new one.
Rework UI from scratch with proper themes and custom controls. MDI windows are now used for workspaces, comparing docs, and multiple usages. Tabs organise multiple workspaces and you can keep mdi windows maximized if you want to only use tabs. Themes currently include dark and white theme but plan to have XML files with list of color and styles
Alot of things optimized. UI is very fast and snappy now
Dae rigging fixed.
Dae bones can be imported.
Dae with textures can be imported and exported to a folder
Custom sampler editor for sampler data.
Texture refs, shader options, params, render info, and basically all material data can be added/removed and edited
User data editor
Update opengl framework by JuPaHe64 to the newest. Includes an origintation cube, multiple models in a scene, and many improvements
Skeleton can be viewed
GFPAK with some fixes in saving
NUTEXB has proper mip map viewing
PTCL Editor (Wii U and Switch). Can edit colors ( Wii U) and view textures. Also EFFN files in smash ultimate can be previewed
Files can be associated with the program and opened with on clicking them
ASTC textures can be viewed
UVs can be viewed. Includes wrap modes and also translating and scaling for some basic edits
Textures use a new editor. It includes channel viewing and some new editing options
Fixed black textures on some wii u bfres
Fixed saving sarcs in sarcs
Shortcut keys have been added in. CTRL + S can save the active file in the currently used window
Fix more issues with bfres crashing
File - New includes BNTX for creating new bntx files from scatch
Raw shader binaries can be extracted from bnsh and bfsha. Yuzu and Ryujinx can decompile these
Sharc files can have source data previewed and shader programs in XML
Aamp v1 and v2 data can be previewed. v1 can be edited and saved atm, v2 will be at a later update
Byaml uses it's own editor instead of a seperate window for easy saving within sarcs
Archives have a hex viewer
Dae exporting greatly improved and can export rigged meshes
Scene, shader param, srt, color, and texture pattern animations can all be previewed (in a list)
Memory usage is greatly improved
Narc (Nitro Archives) can be viewed and extracted.
Fixed importing TGA images
Support importing ASTC textures for bntx
Added in PBR lighting for bfres from my implimentaion in forge
Added gradient background for viewport. This can be edited in the settings
Added skybox background option for viewport. Can load cubemaps
Added grid with customizable cells for viewport.
DDS decompression no longer requires Direct X tex.
Zlib decompression has been improved for opening files that use it
Rigid bones are properly ordered on importing a mesh. May fix some exploding issues.
Endianness for KCL can be toggled for saving. Will be set to what it was using orignally
Tangents can be filled with a constant value. Will allow them to not cause seams nor flat lighting however normal maps may not work as good
Vertex buffers can be added and removed. Also re encoded
Parameters now use drop down panels with values for easier editing
Reworked the bone editor. Everything for a bone can be fully edited now besides the index, billboard index and parent index which get set automatically
Fixed animation scaling for skeletal animations finally!
Textures can be loaded in a tab now with thumbnail displaying for easy real time edits while previewing in the viewport
Fixed support for audio files to be big endian in BARS
Textures for switch now use their own folder. You can easily add textures to this and add textures to bfres that have no bntx. If there are no textures then the bfres will automatically not have one on save.
Animations are split into multiple sub sections for switch's material animation for easier access
Bfres for wii u has better binary exporting and is fully compatiable with Wexos Toolbox (to and from)
Every section can be added in as new for both wii u and switch.
Every section can be renamed properly and mostly everything can be edited. (Key frame editing and a more in depth curve editor later)
Added option to copy UV channel
Bone weights can be previewed
Tons of fixes for the switch bfres library with more games working. Splatoon 2 (more work now), BOTW, Kirby Star Allies, and more!
Fixed 3.3 Wii U bfres from not opening
Wii U Sharcfb files can have shader program data previewed (XML)
And possibly alot more things i missed! All this is still experimental but will improve over the next few weeks
2019-03-23 16:55:09 +00:00
{
2019-05-08 20:28:04 +00:00
public enum ArchiveFileState
{
Empty = 0 ,
Archived = 1 ,
Added = 2 ,
Replaced = 4 ,
Renamed = 8 ,
Deleted = 16
}
2019-08-06 21:35:18 +00:00
/// <summary>
/// A common archive format interface used to edit archive file formats
/// </summary>
2019-05-08 20:28:04 +00:00
public interface IArchiveFile
Add files for the new one.
Rework UI from scratch with proper themes and custom controls. MDI windows are now used for workspaces, comparing docs, and multiple usages. Tabs organise multiple workspaces and you can keep mdi windows maximized if you want to only use tabs. Themes currently include dark and white theme but plan to have XML files with list of color and styles
Alot of things optimized. UI is very fast and snappy now
Dae rigging fixed.
Dae bones can be imported.
Dae with textures can be imported and exported to a folder
Custom sampler editor for sampler data.
Texture refs, shader options, params, render info, and basically all material data can be added/removed and edited
User data editor
Update opengl framework by JuPaHe64 to the newest. Includes an origintation cube, multiple models in a scene, and many improvements
Skeleton can be viewed
GFPAK with some fixes in saving
NUTEXB has proper mip map viewing
PTCL Editor (Wii U and Switch). Can edit colors ( Wii U) and view textures. Also EFFN files in smash ultimate can be previewed
Files can be associated with the program and opened with on clicking them
ASTC textures can be viewed
UVs can be viewed. Includes wrap modes and also translating and scaling for some basic edits
Textures use a new editor. It includes channel viewing and some new editing options
Fixed black textures on some wii u bfres
Fixed saving sarcs in sarcs
Shortcut keys have been added in. CTRL + S can save the active file in the currently used window
Fix more issues with bfres crashing
File - New includes BNTX for creating new bntx files from scatch
Raw shader binaries can be extracted from bnsh and bfsha. Yuzu and Ryujinx can decompile these
Sharc files can have source data previewed and shader programs in XML
Aamp v1 and v2 data can be previewed. v1 can be edited and saved atm, v2 will be at a later update
Byaml uses it's own editor instead of a seperate window for easy saving within sarcs
Archives have a hex viewer
Dae exporting greatly improved and can export rigged meshes
Scene, shader param, srt, color, and texture pattern animations can all be previewed (in a list)
Memory usage is greatly improved
Narc (Nitro Archives) can be viewed and extracted.
Fixed importing TGA images
Support importing ASTC textures for bntx
Added in PBR lighting for bfres from my implimentaion in forge
Added gradient background for viewport. This can be edited in the settings
Added skybox background option for viewport. Can load cubemaps
Added grid with customizable cells for viewport.
DDS decompression no longer requires Direct X tex.
Zlib decompression has been improved for opening files that use it
Rigid bones are properly ordered on importing a mesh. May fix some exploding issues.
Endianness for KCL can be toggled for saving. Will be set to what it was using orignally
Tangents can be filled with a constant value. Will allow them to not cause seams nor flat lighting however normal maps may not work as good
Vertex buffers can be added and removed. Also re encoded
Parameters now use drop down panels with values for easier editing
Reworked the bone editor. Everything for a bone can be fully edited now besides the index, billboard index and parent index which get set automatically
Fixed animation scaling for skeletal animations finally!
Textures can be loaded in a tab now with thumbnail displaying for easy real time edits while previewing in the viewport
Fixed support for audio files to be big endian in BARS
Textures for switch now use their own folder. You can easily add textures to this and add textures to bfres that have no bntx. If there are no textures then the bfres will automatically not have one on save.
Animations are split into multiple sub sections for switch's material animation for easier access
Bfres for wii u has better binary exporting and is fully compatiable with Wexos Toolbox (to and from)
Every section can be added in as new for both wii u and switch.
Every section can be renamed properly and mostly everything can be edited. (Key frame editing and a more in depth curve editor later)
Added option to copy UV channel
Bone weights can be previewed
Tons of fixes for the switch bfres library with more games working. Splatoon 2 (more work now), BOTW, Kirby Star Allies, and more!
Fixed 3.3 Wii U bfres from not opening
Wii U Sharcfb files can have shader program data previewed (XML)
And possibly alot more things i missed! All this is still experimental but will improve over the next few weeks
2019-03-23 16:55:09 +00:00
{
bool CanAddFiles { get ; }
bool CanRenameFiles { get ; }
bool CanReplaceFiles { get ; }
bool CanDeleteFiles { get ; }
2019-07-18 22:05:27 +00:00
IEnumerable < ArchiveFileInfo > Files { get ; }
2019-05-08 20:28:04 +00:00
2019-07-18 22:05:27 +00:00
void ClearFiles ( ) ;
Add files for the new one.
Rework UI from scratch with proper themes and custom controls. MDI windows are now used for workspaces, comparing docs, and multiple usages. Tabs organise multiple workspaces and you can keep mdi windows maximized if you want to only use tabs. Themes currently include dark and white theme but plan to have XML files with list of color and styles
Alot of things optimized. UI is very fast and snappy now
Dae rigging fixed.
Dae bones can be imported.
Dae with textures can be imported and exported to a folder
Custom sampler editor for sampler data.
Texture refs, shader options, params, render info, and basically all material data can be added/removed and edited
User data editor
Update opengl framework by JuPaHe64 to the newest. Includes an origintation cube, multiple models in a scene, and many improvements
Skeleton can be viewed
GFPAK with some fixes in saving
NUTEXB has proper mip map viewing
PTCL Editor (Wii U and Switch). Can edit colors ( Wii U) and view textures. Also EFFN files in smash ultimate can be previewed
Files can be associated with the program and opened with on clicking them
ASTC textures can be viewed
UVs can be viewed. Includes wrap modes and also translating and scaling for some basic edits
Textures use a new editor. It includes channel viewing and some new editing options
Fixed black textures on some wii u bfres
Fixed saving sarcs in sarcs
Shortcut keys have been added in. CTRL + S can save the active file in the currently used window
Fix more issues with bfres crashing
File - New includes BNTX for creating new bntx files from scatch
Raw shader binaries can be extracted from bnsh and bfsha. Yuzu and Ryujinx can decompile these
Sharc files can have source data previewed and shader programs in XML
Aamp v1 and v2 data can be previewed. v1 can be edited and saved atm, v2 will be at a later update
Byaml uses it's own editor instead of a seperate window for easy saving within sarcs
Archives have a hex viewer
Dae exporting greatly improved and can export rigged meshes
Scene, shader param, srt, color, and texture pattern animations can all be previewed (in a list)
Memory usage is greatly improved
Narc (Nitro Archives) can be viewed and extracted.
Fixed importing TGA images
Support importing ASTC textures for bntx
Added in PBR lighting for bfres from my implimentaion in forge
Added gradient background for viewport. This can be edited in the settings
Added skybox background option for viewport. Can load cubemaps
Added grid with customizable cells for viewport.
DDS decompression no longer requires Direct X tex.
Zlib decompression has been improved for opening files that use it
Rigid bones are properly ordered on importing a mesh. May fix some exploding issues.
Endianness for KCL can be toggled for saving. Will be set to what it was using orignally
Tangents can be filled with a constant value. Will allow them to not cause seams nor flat lighting however normal maps may not work as good
Vertex buffers can be added and removed. Also re encoded
Parameters now use drop down panels with values for easier editing
Reworked the bone editor. Everything for a bone can be fully edited now besides the index, billboard index and parent index which get set automatically
Fixed animation scaling for skeletal animations finally!
Textures can be loaded in a tab now with thumbnail displaying for easy real time edits while previewing in the viewport
Fixed support for audio files to be big endian in BARS
Textures for switch now use their own folder. You can easily add textures to this and add textures to bfres that have no bntx. If there are no textures then the bfres will automatically not have one on save.
Animations are split into multiple sub sections for switch's material animation for easier access
Bfres for wii u has better binary exporting and is fully compatiable with Wexos Toolbox (to and from)
Every section can be added in as new for both wii u and switch.
Every section can be renamed properly and mostly everything can be edited. (Key frame editing and a more in depth curve editor later)
Added option to copy UV channel
Bone weights can be previewed
Tons of fixes for the switch bfres library with more games working. Splatoon 2 (more work now), BOTW, Kirby Star Allies, and more!
Fixed 3.3 Wii U bfres from not opening
Wii U Sharcfb files can have shader program data previewed (XML)
And possibly alot more things i missed! All this is still experimental but will improve over the next few weeks
2019-03-23 16:55:09 +00:00
bool AddFile ( ArchiveFileInfo archiveFileInfo ) ;
bool DeleteFile ( ArchiveFileInfo archiveFileInfo ) ;
}
2019-08-20 21:22:01 +00:00
2019-06-30 01:05:10 +00:00
public class ArchiveFileInfo : INode
Add files for the new one.
Rework UI from scratch with proper themes and custom controls. MDI windows are now used for workspaces, comparing docs, and multiple usages. Tabs organise multiple workspaces and you can keep mdi windows maximized if you want to only use tabs. Themes currently include dark and white theme but plan to have XML files with list of color and styles
Alot of things optimized. UI is very fast and snappy now
Dae rigging fixed.
Dae bones can be imported.
Dae with textures can be imported and exported to a folder
Custom sampler editor for sampler data.
Texture refs, shader options, params, render info, and basically all material data can be added/removed and edited
User data editor
Update opengl framework by JuPaHe64 to the newest. Includes an origintation cube, multiple models in a scene, and many improvements
Skeleton can be viewed
GFPAK with some fixes in saving
NUTEXB has proper mip map viewing
PTCL Editor (Wii U and Switch). Can edit colors ( Wii U) and view textures. Also EFFN files in smash ultimate can be previewed
Files can be associated with the program and opened with on clicking them
ASTC textures can be viewed
UVs can be viewed. Includes wrap modes and also translating and scaling for some basic edits
Textures use a new editor. It includes channel viewing and some new editing options
Fixed black textures on some wii u bfres
Fixed saving sarcs in sarcs
Shortcut keys have been added in. CTRL + S can save the active file in the currently used window
Fix more issues with bfres crashing
File - New includes BNTX for creating new bntx files from scatch
Raw shader binaries can be extracted from bnsh and bfsha. Yuzu and Ryujinx can decompile these
Sharc files can have source data previewed and shader programs in XML
Aamp v1 and v2 data can be previewed. v1 can be edited and saved atm, v2 will be at a later update
Byaml uses it's own editor instead of a seperate window for easy saving within sarcs
Archives have a hex viewer
Dae exporting greatly improved and can export rigged meshes
Scene, shader param, srt, color, and texture pattern animations can all be previewed (in a list)
Memory usage is greatly improved
Narc (Nitro Archives) can be viewed and extracted.
Fixed importing TGA images
Support importing ASTC textures for bntx
Added in PBR lighting for bfres from my implimentaion in forge
Added gradient background for viewport. This can be edited in the settings
Added skybox background option for viewport. Can load cubemaps
Added grid with customizable cells for viewport.
DDS decompression no longer requires Direct X tex.
Zlib decompression has been improved for opening files that use it
Rigid bones are properly ordered on importing a mesh. May fix some exploding issues.
Endianness for KCL can be toggled for saving. Will be set to what it was using orignally
Tangents can be filled with a constant value. Will allow them to not cause seams nor flat lighting however normal maps may not work as good
Vertex buffers can be added and removed. Also re encoded
Parameters now use drop down panels with values for easier editing
Reworked the bone editor. Everything for a bone can be fully edited now besides the index, billboard index and parent index which get set automatically
Fixed animation scaling for skeletal animations finally!
Textures can be loaded in a tab now with thumbnail displaying for easy real time edits while previewing in the viewport
Fixed support for audio files to be big endian in BARS
Textures for switch now use their own folder. You can easily add textures to this and add textures to bfres that have no bntx. If there are no textures then the bfres will automatically not have one on save.
Animations are split into multiple sub sections for switch's material animation for easier access
Bfres for wii u has better binary exporting and is fully compatiable with Wexos Toolbox (to and from)
Every section can be added in as new for both wii u and switch.
Every section can be renamed properly and mostly everything can be edited. (Key frame editing and a more in depth curve editor later)
Added option to copy UV channel
Bone weights can be previewed
Tons of fixes for the switch bfres library with more games working. Splatoon 2 (more work now), BOTW, Kirby Star Allies, and more!
Fixed 3.3 Wii U bfres from not opening
Wii U Sharcfb files can have shader program data previewed (XML)
And possibly alot more things i missed! All this is still experimental but will improve over the next few weeks
2019-03-23 16:55:09 +00:00
{
2019-07-29 20:48:24 +00:00
// Opens the file format automatically (may take longer to open the archive file)
2019-07-21 17:25:18 +00:00
[Browsable(false)]
2019-09-01 17:02:48 +00:00
public virtual bool OpenFileFormatOnLoad { get ; set ; }
2019-07-29 20:48:24 +00:00
[Browsable(false)]
// The source file. If an archive is in another archive, this is necessary to get the original path
2019-07-21 17:25:18 +00:00
public string SourceFile { get ; internal set ; }
2019-07-06 15:29:29 +00:00
[Browsable(false)]
public string ImageKey { get ; set ; }
[Browsable(false)]
public string SelectedImageKey { get ; set ; }
2019-06-18 20:27:36 +00:00
[Browsable(false)]
2019-06-14 21:23:02 +00:00
public STContextMenuStrip STContextMenuStrip ;
2019-06-18 20:27:36 +00:00
[Browsable(false)]
2019-05-12 00:51:23 +00:00
public virtual STToolStripItem [ ] Menus { get ; set ; }
2019-06-18 20:27:36 +00:00
[Browsable(false)]
2019-05-08 20:28:04 +00:00
public FileType FileDataType = FileType . Default ;
Add files for the new one.
Rework UI from scratch with proper themes and custom controls. MDI windows are now used for workspaces, comparing docs, and multiple usages. Tabs organise multiple workspaces and you can keep mdi windows maximized if you want to only use tabs. Themes currently include dark and white theme but plan to have XML files with list of color and styles
Alot of things optimized. UI is very fast and snappy now
Dae rigging fixed.
Dae bones can be imported.
Dae with textures can be imported and exported to a folder
Custom sampler editor for sampler data.
Texture refs, shader options, params, render info, and basically all material data can be added/removed and edited
User data editor
Update opengl framework by JuPaHe64 to the newest. Includes an origintation cube, multiple models in a scene, and many improvements
Skeleton can be viewed
GFPAK with some fixes in saving
NUTEXB has proper mip map viewing
PTCL Editor (Wii U and Switch). Can edit colors ( Wii U) and view textures. Also EFFN files in smash ultimate can be previewed
Files can be associated with the program and opened with on clicking them
ASTC textures can be viewed
UVs can be viewed. Includes wrap modes and also translating and scaling for some basic edits
Textures use a new editor. It includes channel viewing and some new editing options
Fixed black textures on some wii u bfres
Fixed saving sarcs in sarcs
Shortcut keys have been added in. CTRL + S can save the active file in the currently used window
Fix more issues with bfres crashing
File - New includes BNTX for creating new bntx files from scatch
Raw shader binaries can be extracted from bnsh and bfsha. Yuzu and Ryujinx can decompile these
Sharc files can have source data previewed and shader programs in XML
Aamp v1 and v2 data can be previewed. v1 can be edited and saved atm, v2 will be at a later update
Byaml uses it's own editor instead of a seperate window for easy saving within sarcs
Archives have a hex viewer
Dae exporting greatly improved and can export rigged meshes
Scene, shader param, srt, color, and texture pattern animations can all be previewed (in a list)
Memory usage is greatly improved
Narc (Nitro Archives) can be viewed and extracted.
Fixed importing TGA images
Support importing ASTC textures for bntx
Added in PBR lighting for bfres from my implimentaion in forge
Added gradient background for viewport. This can be edited in the settings
Added skybox background option for viewport. Can load cubemaps
Added grid with customizable cells for viewport.
DDS decompression no longer requires Direct X tex.
Zlib decompression has been improved for opening files that use it
Rigid bones are properly ordered on importing a mesh. May fix some exploding issues.
Endianness for KCL can be toggled for saving. Will be set to what it was using orignally
Tangents can be filled with a constant value. Will allow them to not cause seams nor flat lighting however normal maps may not work as good
Vertex buffers can be added and removed. Also re encoded
Parameters now use drop down panels with values for easier editing
Reworked the bone editor. Everything for a bone can be fully edited now besides the index, billboard index and parent index which get set automatically
Fixed animation scaling for skeletal animations finally!
Textures can be loaded in a tab now with thumbnail displaying for easy real time edits while previewing in the viewport
Fixed support for audio files to be big endian in BARS
Textures for switch now use their own folder. You can easily add textures to this and add textures to bfres that have no bntx. If there are no textures then the bfres will automatically not have one on save.
Animations are split into multiple sub sections for switch's material animation for easier access
Bfres for wii u has better binary exporting and is fully compatiable with Wexos Toolbox (to and from)
Every section can be added in as new for both wii u and switch.
Every section can be renamed properly and mostly everything can be edited. (Key frame editing and a more in depth curve editor later)
Added option to copy UV channel
Bone weights can be previewed
Tons of fixes for the switch bfres library with more games working. Splatoon 2 (more work now), BOTW, Kirby Star Allies, and more!
Fixed 3.3 Wii U bfres from not opening
Wii U Sharcfb files can have shader program data previewed (XML)
And possibly alot more things i missed! All this is still experimental but will improve over the next few weeks
2019-03-23 16:55:09 +00:00
2019-06-18 20:27:36 +00:00
//Wether or not to check the file magic to determine the type
//This sets the icons if there's no proper extension, and may add more special operations
//This should be disabled on larger archives!
[Browsable(false)]
public virtual bool CheckFileMagic { get ; set ; } = false ;
//Properties to show for the archive file when selected
[Browsable(false)]
public virtual object DisplayProperties { get ; set ; }
2019-06-22 11:57:26 +00:00
[Browsable(false)]
public virtual bool CanLoadFile { get ; set ; } = true ;
2019-11-10 21:37:21 +00:00
[Browsable(false)]
public ArchiveFileWrapper FileWrapper ;
public void UpdateWrapper ( )
{
if ( FileWrapper = = null ) return ;
FileWrapper . Text = Path . GetFileName ( FileName ) ;
}
2019-06-22 11:57:26 +00:00
2019-06-18 20:27:36 +00:00
[Browsable(false)]
2019-06-16 23:35:46 +00:00
public virtual IFileFormat OpenFile ( )
2019-06-01 21:49:39 +00:00
{
2019-09-05 20:24:03 +00:00
if ( FileFormat ! = null )
2019-08-29 19:45:32 +00:00
return FileFormat ;
2019-08-20 20:52:48 +00:00
if ( FileDataStream ! = null )
{
return STFileLoader . OpenFileFormat ( FileDataStream ,
2019-09-15 23:13:01 +00:00
IOExtensions . RemoveIllegaleFolderNameCharacters ( FileName ) , true , true ) ;
2019-08-20 20:52:48 +00:00
}
else
{
2019-09-15 23:13:01 +00:00
return STFileLoader . OpenFileFormat ( new MemoryStream ( FileData ) ,
2020-02-28 21:52:24 +00:00
IOExtensions . RemoveIllegaleFolderNameCharacters ( FileName ) , false , true ) ;
2019-08-20 20:52:48 +00:00
}
2019-06-01 21:49:39 +00:00
}
2019-06-18 20:27:36 +00:00
[Browsable(false)]
2019-06-16 23:35:46 +00:00
public bool IsSupportedFileFormat ( )
{
if ( FileData = = null | | FileData . Length < = 4 )
return false ;
using ( var stream = new MemoryStream ( FileData ) )
{
foreach ( IFileFormat fileFormat in FileManager . GetFileFormats ( ) )
{
fileFormat . FileName = FileName ;
if ( fileFormat . Identify ( stream ) )
return true ;
}
return false ;
}
}
2019-08-09 22:21:16 +00:00
[Browsable(false)]
2019-06-25 18:56:19 +00:00
public virtual Dictionary < string , string > ExtensionImageKeyLookup { get ; }
2019-06-16 23:35:46 +00:00
2019-11-23 00:55:48 +00:00
public virtual bool Replace ( )
2019-05-28 20:43:57 +00:00
{
2019-05-28 21:13:01 +00:00
string fileName = Path . GetFileName ( FileName . RemoveIllegaleFileNameCharacters ( ) ) ;
2019-05-28 20:53:02 +00:00
2019-05-28 20:43:57 +00:00
OpenFileDialog ofd = new OpenFileDialog ( ) ;
2019-05-28 20:53:02 +00:00
ofd . FileName = fileName ;
ofd . DefaultExt = Path . GetExtension ( fileName ) ;
2019-05-28 20:43:57 +00:00
ofd . Filter = "Raw Data (*.*)|*.*" ;
if ( ofd . ShowDialog ( ) = = DialogResult . OK )
{
FileData = File . ReadAllBytes ( ofd . FileName ) ;
2019-11-23 00:55:48 +00:00
return true ;
2019-05-28 20:43:57 +00:00
}
2019-11-23 00:55:48 +00:00
return false ;
2019-05-28 20:43:57 +00:00
}
public virtual void Export ( )
{
2019-07-14 22:17:45 +00:00
string fileName = Path . GetFileName ( FileName . RemoveIllegaleFolderNameCharacters ( ) ) ;
2019-05-28 20:46:33 +00:00
2019-05-28 20:43:57 +00:00
SaveFileDialog sfd = new SaveFileDialog ( ) ;
2019-05-28 20:46:33 +00:00
sfd . FileName = fileName ;
sfd . DefaultExt = Path . GetExtension ( fileName ) ;
2019-05-28 20:43:57 +00:00
sfd . Filter = "Raw Data (*.*)|*.*" ;
if ( sfd . ShowDialog ( ) = = DialogResult . OK )
{
2019-08-20 20:52:48 +00:00
if ( FileDataStream ! = null )
FileDataStream . ExportToFile ( sfd . FileName ) ;
else
File . WriteAllBytes ( sfd . FileName , FileData ) ;
2019-05-28 20:43:57 +00:00
}
}
2019-05-12 00:51:23 +00:00
2020-01-23 00:32:04 +00:00
public virtual string FileSize { get { return STMath . GetFileSize (
FileDataStream ! = null ? FileDataStream . Length : FileData . Length , 4 ) ; } }
Add files for the new one.
Rework UI from scratch with proper themes and custom controls. MDI windows are now used for workspaces, comparing docs, and multiple usages. Tabs organise multiple workspaces and you can keep mdi windows maximized if you want to only use tabs. Themes currently include dark and white theme but plan to have XML files with list of color and styles
Alot of things optimized. UI is very fast and snappy now
Dae rigging fixed.
Dae bones can be imported.
Dae with textures can be imported and exported to a folder
Custom sampler editor for sampler data.
Texture refs, shader options, params, render info, and basically all material data can be added/removed and edited
User data editor
Update opengl framework by JuPaHe64 to the newest. Includes an origintation cube, multiple models in a scene, and many improvements
Skeleton can be viewed
GFPAK with some fixes in saving
NUTEXB has proper mip map viewing
PTCL Editor (Wii U and Switch). Can edit colors ( Wii U) and view textures. Also EFFN files in smash ultimate can be previewed
Files can be associated with the program and opened with on clicking them
ASTC textures can be viewed
UVs can be viewed. Includes wrap modes and also translating and scaling for some basic edits
Textures use a new editor. It includes channel viewing and some new editing options
Fixed black textures on some wii u bfres
Fixed saving sarcs in sarcs
Shortcut keys have been added in. CTRL + S can save the active file in the currently used window
Fix more issues with bfres crashing
File - New includes BNTX for creating new bntx files from scatch
Raw shader binaries can be extracted from bnsh and bfsha. Yuzu and Ryujinx can decompile these
Sharc files can have source data previewed and shader programs in XML
Aamp v1 and v2 data can be previewed. v1 can be edited and saved atm, v2 will be at a later update
Byaml uses it's own editor instead of a seperate window for easy saving within sarcs
Archives have a hex viewer
Dae exporting greatly improved and can export rigged meshes
Scene, shader param, srt, color, and texture pattern animations can all be previewed (in a list)
Memory usage is greatly improved
Narc (Nitro Archives) can be viewed and extracted.
Fixed importing TGA images
Support importing ASTC textures for bntx
Added in PBR lighting for bfres from my implimentaion in forge
Added gradient background for viewport. This can be edited in the settings
Added skybox background option for viewport. Can load cubemaps
Added grid with customizable cells for viewport.
DDS decompression no longer requires Direct X tex.
Zlib decompression has been improved for opening files that use it
Rigid bones are properly ordered on importing a mesh. May fix some exploding issues.
Endianness for KCL can be toggled for saving. Will be set to what it was using orignally
Tangents can be filled with a constant value. Will allow them to not cause seams nor flat lighting however normal maps may not work as good
Vertex buffers can be added and removed. Also re encoded
Parameters now use drop down panels with values for easier editing
Reworked the bone editor. Everything for a bone can be fully edited now besides the index, billboard index and parent index which get set automatically
Fixed animation scaling for skeletal animations finally!
Textures can be loaded in a tab now with thumbnail displaying for easy real time edits while previewing in the viewport
Fixed support for audio files to be big endian in BARS
Textures for switch now use their own folder. You can easily add textures to this and add textures to bfres that have no bntx. If there are no textures then the bfres will automatically not have one on save.
Animations are split into multiple sub sections for switch's material animation for easier access
Bfres for wii u has better binary exporting and is fully compatiable with Wexos Toolbox (to and from)
Every section can be added in as new for both wii u and switch.
Every section can be renamed properly and mostly everything can be edited. (Key frame editing and a more in depth curve editor later)
Added option to copy UV channel
Bone weights can be previewed
Tons of fixes for the switch bfres library with more games working. Splatoon 2 (more work now), BOTW, Kirby Star Allies, and more!
Fixed 3.3 Wii U bfres from not opening
Wii U Sharcfb files can have shader program data previewed (XML)
And possibly alot more things i missed! All this is still experimental but will improve over the next few weeks
2019-03-23 16:55:09 +00:00
2019-06-18 20:27:36 +00:00
[Browsable(false)]
2019-05-18 17:36:39 +00:00
public IFileFormat FileFormat = null ; //Format attached for saving
Add files for the new one.
Rework UI from scratch with proper themes and custom controls. MDI windows are now used for workspaces, comparing docs, and multiple usages. Tabs organise multiple workspaces and you can keep mdi windows maximized if you want to only use tabs. Themes currently include dark and white theme but plan to have XML files with list of color and styles
Alot of things optimized. UI is very fast and snappy now
Dae rigging fixed.
Dae bones can be imported.
Dae with textures can be imported and exported to a folder
Custom sampler editor for sampler data.
Texture refs, shader options, params, render info, and basically all material data can be added/removed and edited
User data editor
Update opengl framework by JuPaHe64 to the newest. Includes an origintation cube, multiple models in a scene, and many improvements
Skeleton can be viewed
GFPAK with some fixes in saving
NUTEXB has proper mip map viewing
PTCL Editor (Wii U and Switch). Can edit colors ( Wii U) and view textures. Also EFFN files in smash ultimate can be previewed
Files can be associated with the program and opened with on clicking them
ASTC textures can be viewed
UVs can be viewed. Includes wrap modes and also translating and scaling for some basic edits
Textures use a new editor. It includes channel viewing and some new editing options
Fixed black textures on some wii u bfres
Fixed saving sarcs in sarcs
Shortcut keys have been added in. CTRL + S can save the active file in the currently used window
Fix more issues with bfres crashing
File - New includes BNTX for creating new bntx files from scatch
Raw shader binaries can be extracted from bnsh and bfsha. Yuzu and Ryujinx can decompile these
Sharc files can have source data previewed and shader programs in XML
Aamp v1 and v2 data can be previewed. v1 can be edited and saved atm, v2 will be at a later update
Byaml uses it's own editor instead of a seperate window for easy saving within sarcs
Archives have a hex viewer
Dae exporting greatly improved and can export rigged meshes
Scene, shader param, srt, color, and texture pattern animations can all be previewed (in a list)
Memory usage is greatly improved
Narc (Nitro Archives) can be viewed and extracted.
Fixed importing TGA images
Support importing ASTC textures for bntx
Added in PBR lighting for bfres from my implimentaion in forge
Added gradient background for viewport. This can be edited in the settings
Added skybox background option for viewport. Can load cubemaps
Added grid with customizable cells for viewport.
DDS decompression no longer requires Direct X tex.
Zlib decompression has been improved for opening files that use it
Rigid bones are properly ordered on importing a mesh. May fix some exploding issues.
Endianness for KCL can be toggled for saving. Will be set to what it was using orignally
Tangents can be filled with a constant value. Will allow them to not cause seams nor flat lighting however normal maps may not work as good
Vertex buffers can be added and removed. Also re encoded
Parameters now use drop down panels with values for easier editing
Reworked the bone editor. Everything for a bone can be fully edited now besides the index, billboard index and parent index which get set automatically
Fixed animation scaling for skeletal animations finally!
Textures can be loaded in a tab now with thumbnail displaying for easy real time edits while previewing in the viewport
Fixed support for audio files to be big endian in BARS
Textures for switch now use their own folder. You can easily add textures to this and add textures to bfres that have no bntx. If there are no textures then the bfres will automatically not have one on save.
Animations are split into multiple sub sections for switch's material animation for easier access
Bfres for wii u has better binary exporting and is fully compatiable with Wexos Toolbox (to and from)
Every section can be added in as new for both wii u and switch.
Every section can be renamed properly and mostly everything can be edited. (Key frame editing and a more in depth curve editor later)
Added option to copy UV channel
Bone weights can be previewed
Tons of fixes for the switch bfres library with more games working. Splatoon 2 (more work now), BOTW, Kirby Star Allies, and more!
Fixed 3.3 Wii U bfres from not opening
Wii U Sharcfb files can have shader program data previewed (XML)
And possibly alot more things i missed! All this is still experimental but will improve over the next few weeks
2019-03-23 16:55:09 +00:00
2019-06-18 20:27:36 +00:00
[Browsable(false)]
2019-08-08 01:53:59 +00:00
private byte [ ] _fileData = null ;
Add files for the new one.
Rework UI from scratch with proper themes and custom controls. MDI windows are now used for workspaces, comparing docs, and multiple usages. Tabs organise multiple workspaces and you can keep mdi windows maximized if you want to only use tabs. Themes currently include dark and white theme but plan to have XML files with list of color and styles
Alot of things optimized. UI is very fast and snappy now
Dae rigging fixed.
Dae bones can be imported.
Dae with textures can be imported and exported to a folder
Custom sampler editor for sampler data.
Texture refs, shader options, params, render info, and basically all material data can be added/removed and edited
User data editor
Update opengl framework by JuPaHe64 to the newest. Includes an origintation cube, multiple models in a scene, and many improvements
Skeleton can be viewed
GFPAK with some fixes in saving
NUTEXB has proper mip map viewing
PTCL Editor (Wii U and Switch). Can edit colors ( Wii U) and view textures. Also EFFN files in smash ultimate can be previewed
Files can be associated with the program and opened with on clicking them
ASTC textures can be viewed
UVs can be viewed. Includes wrap modes and also translating and scaling for some basic edits
Textures use a new editor. It includes channel viewing and some new editing options
Fixed black textures on some wii u bfres
Fixed saving sarcs in sarcs
Shortcut keys have been added in. CTRL + S can save the active file in the currently used window
Fix more issues with bfres crashing
File - New includes BNTX for creating new bntx files from scatch
Raw shader binaries can be extracted from bnsh and bfsha. Yuzu and Ryujinx can decompile these
Sharc files can have source data previewed and shader programs in XML
Aamp v1 and v2 data can be previewed. v1 can be edited and saved atm, v2 will be at a later update
Byaml uses it's own editor instead of a seperate window for easy saving within sarcs
Archives have a hex viewer
Dae exporting greatly improved and can export rigged meshes
Scene, shader param, srt, color, and texture pattern animations can all be previewed (in a list)
Memory usage is greatly improved
Narc (Nitro Archives) can be viewed and extracted.
Fixed importing TGA images
Support importing ASTC textures for bntx
Added in PBR lighting for bfres from my implimentaion in forge
Added gradient background for viewport. This can be edited in the settings
Added skybox background option for viewport. Can load cubemaps
Added grid with customizable cells for viewport.
DDS decompression no longer requires Direct X tex.
Zlib decompression has been improved for opening files that use it
Rigid bones are properly ordered on importing a mesh. May fix some exploding issues.
Endianness for KCL can be toggled for saving. Will be set to what it was using orignally
Tangents can be filled with a constant value. Will allow them to not cause seams nor flat lighting however normal maps may not work as good
Vertex buffers can be added and removed. Also re encoded
Parameters now use drop down panels with values for easier editing
Reworked the bone editor. Everything for a bone can be fully edited now besides the index, billboard index and parent index which get set automatically
Fixed animation scaling for skeletal animations finally!
Textures can be loaded in a tab now with thumbnail displaying for easy real time edits while previewing in the viewport
Fixed support for audio files to be big endian in BARS
Textures for switch now use their own folder. You can easily add textures to this and add textures to bfres that have no bntx. If there are no textures then the bfres will automatically not have one on save.
Animations are split into multiple sub sections for switch's material animation for easier access
Bfres for wii u has better binary exporting and is fully compatiable with Wexos Toolbox (to and from)
Every section can be added in as new for both wii u and switch.
Every section can be renamed properly and mostly everything can be edited. (Key frame editing and a more in depth curve editor later)
Added option to copy UV channel
Bone weights can be previewed
Tons of fixes for the switch bfres library with more games working. Splatoon 2 (more work now), BOTW, Kirby Star Allies, and more!
Fixed 3.3 Wii U bfres from not opening
Wii U Sharcfb files can have shader program data previewed (XML)
And possibly alot more things i missed! All this is still experimental but will improve over the next few weeks
2019-03-23 16:55:09 +00:00
2019-06-10 20:30:06 +00:00
//Full File Name
2019-06-18 20:27:36 +00:00
private string _fileName = string . Empty ;
[Browsable(false)]
2019-06-10 20:30:06 +00:00
public string FileName
{
get
{
return _fileName ;
}
set
{
_fileName = value ;
}
}
2019-06-18 20:27:36 +00:00
2019-09-03 01:02:32 +00:00
public static void SaveFileFormat ( ArchiveFileInfo archiveFile , IFileFormat fileFormat )
{
if ( fileFormat ! = null & & fileFormat . CanSave )
{
if ( archiveFile . FileDataStream ! = null )
{
var mem = new System . IO . MemoryStream ( ) ;
fileFormat . Save ( mem ) ;
archiveFile . FileDataStream = mem ;
//Reload file data
fileFormat . Load ( archiveFile . FileDataStream ) ;
}
else
{
var mem = new System . IO . MemoryStream ( ) ;
fileFormat . Save ( mem ) ;
archiveFile . FileData = STLibraryCompression . CompressFile ( mem . ToArray ( ) , fileFormat ) ;
}
}
}
2019-07-01 19:44:19 +00:00
public void SaveFileFormat ( )
{
if ( FileFormat ! = null & & FileFormat . CanSave )
2019-07-23 01:01:05 +00:00
{
2019-08-20 20:52:48 +00:00
if ( FileDataStream ! = null )
{
2020-02-12 22:50:10 +00:00
Console . WriteLine ( $"Updating FileDataStream " + ( FileDataStream is FileStream ) ) ;
if ( FileDataStream is FileStream )
FileDataStream . Close ( ) ;
2019-08-20 20:52:48 +00:00
var mem = new System . IO . MemoryStream ( ) ;
FileFormat . Save ( mem ) ;
FileDataStream = mem ;
//Reload file data
FileFormat . Load ( FileDataStream ) ;
}
else
{
var mem = new System . IO . MemoryStream ( ) ;
FileFormat . Save ( mem ) ;
FileData = STLibraryCompression . CompressFile ( mem . ToArray ( ) , FileFormat ) ;
}
2019-07-23 01:01:05 +00:00
}
2019-07-01 19:44:19 +00:00
}
2019-06-18 20:27:36 +00:00
[Browsable(false)]
2019-05-08 20:28:04 +00:00
public string Name { get ; set ; } = string . Empty ; //File Name (No Path)
2019-06-18 20:27:36 +00:00
[Browsable(false)]
2019-05-12 00:51:23 +00:00
public virtual byte [ ] FileData
Add files for the new one.
Rework UI from scratch with proper themes and custom controls. MDI windows are now used for workspaces, comparing docs, and multiple usages. Tabs organise multiple workspaces and you can keep mdi windows maximized if you want to only use tabs. Themes currently include dark and white theme but plan to have XML files with list of color and styles
Alot of things optimized. UI is very fast and snappy now
Dae rigging fixed.
Dae bones can be imported.
Dae with textures can be imported and exported to a folder
Custom sampler editor for sampler data.
Texture refs, shader options, params, render info, and basically all material data can be added/removed and edited
User data editor
Update opengl framework by JuPaHe64 to the newest. Includes an origintation cube, multiple models in a scene, and many improvements
Skeleton can be viewed
GFPAK with some fixes in saving
NUTEXB has proper mip map viewing
PTCL Editor (Wii U and Switch). Can edit colors ( Wii U) and view textures. Also EFFN files in smash ultimate can be previewed
Files can be associated with the program and opened with on clicking them
ASTC textures can be viewed
UVs can be viewed. Includes wrap modes and also translating and scaling for some basic edits
Textures use a new editor. It includes channel viewing and some new editing options
Fixed black textures on some wii u bfres
Fixed saving sarcs in sarcs
Shortcut keys have been added in. CTRL + S can save the active file in the currently used window
Fix more issues with bfres crashing
File - New includes BNTX for creating new bntx files from scatch
Raw shader binaries can be extracted from bnsh and bfsha. Yuzu and Ryujinx can decompile these
Sharc files can have source data previewed and shader programs in XML
Aamp v1 and v2 data can be previewed. v1 can be edited and saved atm, v2 will be at a later update
Byaml uses it's own editor instead of a seperate window for easy saving within sarcs
Archives have a hex viewer
Dae exporting greatly improved and can export rigged meshes
Scene, shader param, srt, color, and texture pattern animations can all be previewed (in a list)
Memory usage is greatly improved
Narc (Nitro Archives) can be viewed and extracted.
Fixed importing TGA images
Support importing ASTC textures for bntx
Added in PBR lighting for bfres from my implimentaion in forge
Added gradient background for viewport. This can be edited in the settings
Added skybox background option for viewport. Can load cubemaps
Added grid with customizable cells for viewport.
DDS decompression no longer requires Direct X tex.
Zlib decompression has been improved for opening files that use it
Rigid bones are properly ordered on importing a mesh. May fix some exploding issues.
Endianness for KCL can be toggled for saving. Will be set to what it was using orignally
Tangents can be filled with a constant value. Will allow them to not cause seams nor flat lighting however normal maps may not work as good
Vertex buffers can be added and removed. Also re encoded
Parameters now use drop down panels with values for easier editing
Reworked the bone editor. Everything for a bone can be fully edited now besides the index, billboard index and parent index which get set automatically
Fixed animation scaling for skeletal animations finally!
Textures can be loaded in a tab now with thumbnail displaying for easy real time edits while previewing in the viewport
Fixed support for audio files to be big endian in BARS
Textures for switch now use their own folder. You can easily add textures to this and add textures to bfres that have no bntx. If there are no textures then the bfres will automatically not have one on save.
Animations are split into multiple sub sections for switch's material animation for easier access
Bfres for wii u has better binary exporting and is fully compatiable with Wexos Toolbox (to and from)
Every section can be added in as new for both wii u and switch.
Every section can be renamed properly and mostly everything can be edited. (Key frame editing and a more in depth curve editor later)
Added option to copy UV channel
Bone weights can be previewed
Tons of fixes for the switch bfres library with more games working. Splatoon 2 (more work now), BOTW, Kirby Star Allies, and more!
Fixed 3.3 Wii U bfres from not opening
Wii U Sharcfb files can have shader program data previewed (XML)
And possibly alot more things i missed! All this is still experimental but will improve over the next few weeks
2019-03-23 16:55:09 +00:00
{
2019-07-01 19:44:19 +00:00
get { return _fileData ; }
2019-05-08 20:28:04 +00:00
set { _fileData = value ; }
Add files for the new one.
Rework UI from scratch with proper themes and custom controls. MDI windows are now used for workspaces, comparing docs, and multiple usages. Tabs organise multiple workspaces and you can keep mdi windows maximized if you want to only use tabs. Themes currently include dark and white theme but plan to have XML files with list of color and styles
Alot of things optimized. UI is very fast and snappy now
Dae rigging fixed.
Dae bones can be imported.
Dae with textures can be imported and exported to a folder
Custom sampler editor for sampler data.
Texture refs, shader options, params, render info, and basically all material data can be added/removed and edited
User data editor
Update opengl framework by JuPaHe64 to the newest. Includes an origintation cube, multiple models in a scene, and many improvements
Skeleton can be viewed
GFPAK with some fixes in saving
NUTEXB has proper mip map viewing
PTCL Editor (Wii U and Switch). Can edit colors ( Wii U) and view textures. Also EFFN files in smash ultimate can be previewed
Files can be associated with the program and opened with on clicking them
ASTC textures can be viewed
UVs can be viewed. Includes wrap modes and also translating and scaling for some basic edits
Textures use a new editor. It includes channel viewing and some new editing options
Fixed black textures on some wii u bfres
Fixed saving sarcs in sarcs
Shortcut keys have been added in. CTRL + S can save the active file in the currently used window
Fix more issues with bfres crashing
File - New includes BNTX for creating new bntx files from scatch
Raw shader binaries can be extracted from bnsh and bfsha. Yuzu and Ryujinx can decompile these
Sharc files can have source data previewed and shader programs in XML
Aamp v1 and v2 data can be previewed. v1 can be edited and saved atm, v2 will be at a later update
Byaml uses it's own editor instead of a seperate window for easy saving within sarcs
Archives have a hex viewer
Dae exporting greatly improved and can export rigged meshes
Scene, shader param, srt, color, and texture pattern animations can all be previewed (in a list)
Memory usage is greatly improved
Narc (Nitro Archives) can be viewed and extracted.
Fixed importing TGA images
Support importing ASTC textures for bntx
Added in PBR lighting for bfres from my implimentaion in forge
Added gradient background for viewport. This can be edited in the settings
Added skybox background option for viewport. Can load cubemaps
Added grid with customizable cells for viewport.
DDS decompression no longer requires Direct X tex.
Zlib decompression has been improved for opening files that use it
Rigid bones are properly ordered on importing a mesh. May fix some exploding issues.
Endianness for KCL can be toggled for saving. Will be set to what it was using orignally
Tangents can be filled with a constant value. Will allow them to not cause seams nor flat lighting however normal maps may not work as good
Vertex buffers can be added and removed. Also re encoded
Parameters now use drop down panels with values for easier editing
Reworked the bone editor. Everything for a bone can be fully edited now besides the index, billboard index and parent index which get set automatically
Fixed animation scaling for skeletal animations finally!
Textures can be loaded in a tab now with thumbnail displaying for easy real time edits while previewing in the viewport
Fixed support for audio files to be big endian in BARS
Textures for switch now use their own folder. You can easily add textures to this and add textures to bfres that have no bntx. If there are no textures then the bfres will automatically not have one on save.
Animations are split into multiple sub sections for switch's material animation for easier access
Bfres for wii u has better binary exporting and is fully compatiable with Wexos Toolbox (to and from)
Every section can be added in as new for both wii u and switch.
Every section can be renamed properly and mostly everything can be edited. (Key frame editing and a more in depth curve editor later)
Added option to copy UV channel
Bone weights can be previewed
Tons of fixes for the switch bfres library with more games working. Splatoon 2 (more work now), BOTW, Kirby Star Allies, and more!
Fixed 3.3 Wii U bfres from not opening
Wii U Sharcfb files can have shader program data previewed (XML)
And possibly alot more things i missed! All this is still experimental but will improve over the next few weeks
2019-03-23 16:55:09 +00:00
}
2019-08-09 22:21:16 +00:00
public virtual Stream FileDataStream
{
get
{
2019-08-20 20:52:48 +00:00
if ( _fileStream ! = null )
_fileStream . Position = 0 ;
2019-08-09 22:21:16 +00:00
return _fileStream ;
}
set { _fileStream = value ; }
}
protected Stream _fileStream = null ;
2019-06-18 20:27:36 +00:00
[Browsable(false)]
2019-05-08 20:28:04 +00:00
public ArchiveFileState State { get ; set ; } = ArchiveFileState . Empty ;
Add files for the new one.
Rework UI from scratch with proper themes and custom controls. MDI windows are now used for workspaces, comparing docs, and multiple usages. Tabs organise multiple workspaces and you can keep mdi windows maximized if you want to only use tabs. Themes currently include dark and white theme but plan to have XML files with list of color and styles
Alot of things optimized. UI is very fast and snappy now
Dae rigging fixed.
Dae bones can be imported.
Dae with textures can be imported and exported to a folder
Custom sampler editor for sampler data.
Texture refs, shader options, params, render info, and basically all material data can be added/removed and edited
User data editor
Update opengl framework by JuPaHe64 to the newest. Includes an origintation cube, multiple models in a scene, and many improvements
Skeleton can be viewed
GFPAK with some fixes in saving
NUTEXB has proper mip map viewing
PTCL Editor (Wii U and Switch). Can edit colors ( Wii U) and view textures. Also EFFN files in smash ultimate can be previewed
Files can be associated with the program and opened with on clicking them
ASTC textures can be viewed
UVs can be viewed. Includes wrap modes and also translating and scaling for some basic edits
Textures use a new editor. It includes channel viewing and some new editing options
Fixed black textures on some wii u bfres
Fixed saving sarcs in sarcs
Shortcut keys have been added in. CTRL + S can save the active file in the currently used window
Fix more issues with bfres crashing
File - New includes BNTX for creating new bntx files from scatch
Raw shader binaries can be extracted from bnsh and bfsha. Yuzu and Ryujinx can decompile these
Sharc files can have source data previewed and shader programs in XML
Aamp v1 and v2 data can be previewed. v1 can be edited and saved atm, v2 will be at a later update
Byaml uses it's own editor instead of a seperate window for easy saving within sarcs
Archives have a hex viewer
Dae exporting greatly improved and can export rigged meshes
Scene, shader param, srt, color, and texture pattern animations can all be previewed (in a list)
Memory usage is greatly improved
Narc (Nitro Archives) can be viewed and extracted.
Fixed importing TGA images
Support importing ASTC textures for bntx
Added in PBR lighting for bfres from my implimentaion in forge
Added gradient background for viewport. This can be edited in the settings
Added skybox background option for viewport. Can load cubemaps
Added grid with customizable cells for viewport.
DDS decompression no longer requires Direct X tex.
Zlib decompression has been improved for opening files that use it
Rigid bones are properly ordered on importing a mesh. May fix some exploding issues.
Endianness for KCL can be toggled for saving. Will be set to what it was using orignally
Tangents can be filled with a constant value. Will allow them to not cause seams nor flat lighting however normal maps may not work as good
Vertex buffers can be added and removed. Also re encoded
Parameters now use drop down panels with values for easier editing
Reworked the bone editor. Everything for a bone can be fully edited now besides the index, billboard index and parent index which get set automatically
Fixed animation scaling for skeletal animations finally!
Textures can be loaded in a tab now with thumbnail displaying for easy real time edits while previewing in the viewport
Fixed support for audio files to be big endian in BARS
Textures for switch now use their own folder. You can easily add textures to this and add textures to bfres that have no bntx. If there are no textures then the bfres will automatically not have one on save.
Animations are split into multiple sub sections for switch's material animation for easier access
Bfres for wii u has better binary exporting and is fully compatiable with Wexos Toolbox (to and from)
Every section can be added in as new for both wii u and switch.
Every section can be renamed properly and mostly everything can be edited. (Key frame editing and a more in depth curve editor later)
Added option to copy UV channel
Bone weights can be previewed
Tons of fixes for the switch bfres library with more games working. Splatoon 2 (more work now), BOTW, Kirby Star Allies, and more!
Fixed 3.3 Wii U bfres from not opening
Wii U Sharcfb files can have shader program data previewed (XML)
And possibly alot more things i missed! All this is still experimental but will improve over the next few weeks
2019-03-23 16:55:09 +00:00
}
2019-05-12 00:51:23 +00:00
2019-05-29 18:24:24 +00:00
public class ArchiveBase : TreeNodeCustom
{
public IArchiveFile ArchiveFile ; //The archive file being edited
public ArchiveBase ( IArchiveFile archiveFile )
{
ArchiveFile = archiveFile ;
}
}
2019-05-18 16:24:03 +00:00
//Wrapper for the archive file itself
2019-06-24 19:45:54 +00:00
public class ArchiveRootNodeWrapper : ArchiveBase , IContextMenuNode
2019-05-18 16:24:03 +00:00
{
2019-07-22 19:06:49 +00:00
//A list that links archive file infos to treenodes of varying types
public List < Tuple < ArchiveFileInfo , TreeNode > > FileNodes = new List < Tuple < ArchiveFileInfo , TreeNode > > ( ) ;
2019-07-18 20:42:27 +00:00
2019-05-27 22:00:03 +00:00
public virtual object PropertyDisplay { get ; set ; }
2019-05-29 18:24:24 +00:00
public ArchiveRootNodeWrapper ( string text , IArchiveFile archiveFile )
: base ( archiveFile )
2019-05-18 16:24:03 +00:00
{
Text = text ;
2019-08-09 22:21:16 +00:00
if ( archiveFile is IPropertyContainer )
PropertyDisplay = ( ( IPropertyContainer ) archiveFile ) . Property ;
else
PropertyDisplay = new GenericArchiveProperties ( archiveFile , text , this ) ;
2019-05-28 23:33:42 +00:00
}
2019-07-22 19:06:49 +00:00
public void AddFileNode ( ArchiveFileWrapper fileWrapper )
{
FileNodes . Add ( Tuple . Create ( fileWrapper . ArchiveFileInfo , ( TreeNode ) fileWrapper ) ) ;
2019-11-10 21:37:21 +00:00
fileWrapper . ArchiveFileInfo . FileWrapper = fileWrapper ;
2019-07-27 01:30:51 +00:00
string FullName = SetFullPath ( fileWrapper , this ) ;
if ( FullName ! = string . Empty )
{
Console . WriteLine ( $"Updating info {FullName}" ) ;
fileWrapper . ArchiveFileInfo . FileName = FullName ;
}
2019-07-22 19:06:49 +00:00
}
2019-06-24 19:45:54 +00:00
public ToolStripItem [ ] GetContextMenuItems ( )
2019-05-28 23:33:42 +00:00
{
2019-07-17 23:59:17 +00:00
var ToolStrips = new ToolStripItem [ ]
{
new STToolStripItem ( "Save" , SaveAction ) { Enabled = ( ( IFileFormat ) ArchiveFile ) . CanSave } ,
new STToolStripSeparator ( ) ,
2020-01-31 00:04:18 +00:00
new STToolStripItem ( "Repack" , RepackAction ) { Enabled = ArchiveFile . CanAddFiles } ,
2019-07-17 23:59:17 +00:00
new STToolStripItem ( "Extract All" , ExtractAllAction ) ,
new STToolStripSeparator ( ) ,
new STToolStripItem ( "Preview Archive" , PreviewAction ) ,
2019-07-18 22:16:45 +00:00
new STToolStripSeparator ( ) ,
new STToolStripItem ( "Add Folder" , AddFolderAction ) { Enabled = ArchiveFile . CanAddFiles } ,
new STToolStripItem ( "Add File" , AddFileAction ) { Enabled = ArchiveFile . CanAddFiles } ,
2019-11-19 02:10:54 +00:00
new STToolStripItem ( "Clear Files" , ClearAction ) { Enabled = ArchiveFile . CanDeleteFiles } ,
2019-06-24 19:45:54 +00:00
} ;
2019-07-17 23:59:17 +00:00
var toolStripList = ToolStrips . ToList ( ) ;
if ( ArchiveFile is IContextMenuNode )
{
toolStripList . AddRange ( ( ( IContextMenuNode ) ArchiveFile ) . GetContextMenuItems ( ) ) ;
}
return toolStripList . ToArray ( ) ;
2019-05-28 23:33:42 +00:00
}
2019-11-19 02:10:54 +00:00
private void ClearAction ( object sender , EventArgs args )
{
//Clear all nodes
for ( int i = 0 ; i < FileNodes . Count ; i + + )
ArchiveFile . DeleteFile ( FileNodes [ i ] . Item1 ) ;
Nodes . Clear ( ) ;
FileNodes . Clear ( ) ;
}
2019-07-18 22:16:45 +00:00
private void AddFolderAction ( object sender , EventArgs args )
{
2019-07-19 00:02:37 +00:00
Nodes . Add ( new ArchiveFolderNodeWrapper ( "NewFolder" , ArchiveFile , this ) ) ;
2019-07-18 22:16:45 +00:00
}
private void AddFileAction ( object sender , EventArgs args )
{
OpenFileDialog ofd = new OpenFileDialog ( ) ;
ofd . Filter = "Raw Data (*.*)|*.*" ;
ofd . Multiselect = true ;
if ( ofd . ShowDialog ( ) = = DialogResult . OK )
{
2019-07-22 19:06:49 +00:00
TreeHelper . AddFiles ( this , this , ofd . FileNames ) ;
2019-07-18 22:16:45 +00:00
}
}
2019-07-18 20:42:27 +00:00
public void UpdateFileNames ( )
{
if ( ! ArchiveFile . CanRenameFiles )
return ;
for ( int i = 0 ; i < FileNodes . Count ; i + + )
2019-07-22 19:06:49 +00:00
{
2019-07-24 19:10:05 +00:00
string NewName = SetFullPath ( FileNodes [ i ] . Item2 , this ) ;
if ( NewName ! = string . Empty )
FileNodes [ i ] . Item1 . FileName = NewName ;
2019-07-22 19:06:49 +00:00
}
2019-07-18 20:42:27 +00:00
}
2019-07-19 00:02:37 +00:00
private static string SetFullPath ( TreeNode node , TreeNode root )
2019-07-18 20:42:27 +00:00
{
2019-07-24 19:10:05 +00:00
if ( node . TreeView = = null ) {
return string . Empty ;
}
2019-07-21 18:58:57 +00:00
2019-07-18 20:42:27 +00:00
string nodePath = node . FullPath ;
int startIndex = nodePath . IndexOf ( root . Text ) ;
if ( startIndex > 0 )
nodePath = nodePath . Substring ( startIndex ) ;
string slash = Path . DirectorySeparatorChar . ToString ( ) ;
string slashAlt = Path . AltDirectorySeparatorChar . ToString ( ) ;
string SetPath = nodePath . Replace ( root . Text + slash , string . Empty ) . Replace ( slash ? ? "" , slashAlt ) ;
2019-07-24 19:10:05 +00:00
Console . WriteLine ( $"FullPath { node.FullPath}" ) ;
Console . WriteLine ( $"SetPath {SetPath}" ) ;
return SetPath ;
2019-07-18 20:42:27 +00:00
}
2019-05-28 23:33:42 +00:00
private void EnableContextMenu ( ToolStripItemCollection Items , string Key , bool Enabled )
{
foreach ( ToolStripItem item in Items )
{
if ( item . Text = = Key )
item . Enabled = Enabled ;
}
2019-05-18 16:24:03 +00:00
}
private void SaveAction ( object sender , EventArgs args )
2019-07-24 00:52:38 +00:00
{
Save ( "" , true ) ;
}
2019-07-24 19:10:05 +00:00
private void Save ( string FileName , bool UseDialog )
2019-05-18 16:24:03 +00:00
{
2019-07-18 20:42:27 +00:00
UpdateFileNames ( ) ;
2019-05-18 16:24:03 +00:00
//Archive files are IFIleFormats
var FileFormat = ( ( IFileFormat ) ArchiveFile ) ;
Cursor . Current = Cursors . WaitCursor ;
2019-07-24 00:52:38 +00:00
if ( UseDialog )
{
List < IFileFormat > formats = new List < IFileFormat > ( ) ;
formats . Add ( FileFormat ) ;
2019-05-18 16:24:03 +00:00
2019-07-24 00:52:38 +00:00
SaveFileDialog sfd = new SaveFileDialog ( ) ;
sfd . Filter = Utils . GetAllFilters ( formats ) ;
sfd . FileName = FileFormat . FileName ;
2019-05-18 16:24:03 +00:00
2019-07-24 00:52:38 +00:00
if ( sfd . ShowDialog ( ) = = DialogResult . OK )
FileName = sfd . FileName ;
else
return ;
2019-05-18 16:24:03 +00:00
}
2019-07-24 00:52:38 +00:00
STFileSaver . SaveFileFormat ( FileFormat , FileName ) ;
2019-05-18 16:24:03 +00:00
GC . Collect ( ) ;
}
2019-05-27 22:00:03 +00:00
2019-05-28 23:33:42 +00:00
private void ExtractAllAction ( object sender , EventArgs args )
{
TreeNode node = this ;
var ParentPath = string . Empty ;
if ( node . Parent ! = null ) //Archive can be attached to another archive
ParentPath = node . Parent . FullPath ;
TreeHelper . ExtractAllFiles ( ParentPath , Nodes ) ;
}
private void RepackAction ( object sender , EventArgs args )
{
2019-07-11 00:38:35 +00:00
FolderSelectDialog dlg = new FolderSelectDialog ( ) ;
if ( dlg . ShowDialog ( ) = = DialogResult . OK )
{
string FolderPath = dlg . SelectedPath ;
2019-07-17 20:14:55 +00:00
STProgressBar progressBar = new STProgressBar ( ) ;
progressBar . Task = "Reading Directory..." ;
progressBar . Value = 0 ;
progressBar . StartPosition = FormStartPosition . CenterScreen ;
progressBar . Show ( ) ;
progressBar . Refresh ( ) ;
var ProccessedFiles = TreeHelper . ReadFiles ( FolderPath ) ;
progressBar . Task = "Repacking Files..." ;
progressBar . Refresh ( ) ;
2019-07-18 22:05:27 +00:00
ArchiveFile . ClearFiles ( ) ;
2019-07-18 21:50:46 +00:00
2019-07-17 20:14:55 +00:00
for ( int i = 0 ; i < ProccessedFiles . Count ; i + + )
{
progressBar . Value = ( i * 100 ) / ProccessedFiles . Count ;
progressBar . Task = $"Packing {ProccessedFiles[i].Item1}" ;
progressBar . Refresh ( ) ;
ArchiveFile . AddFile ( new ArchiveFileInfo ( )
{
FileName = ProccessedFiles [ i ] . Item1 ,
FileData = File . ReadAllBytes ( ProccessedFiles [ i ] . Item2 ) ,
} ) ;
}
progressBar . Close ( ) ;
progressBar . Dispose ( ) ;
ProccessedFiles . Clear ( ) ;
GC . Collect ( ) ;
FillTreeNodes ( ) ;
2019-07-11 00:38:35 +00:00
}
2019-05-28 23:33:42 +00:00
}
private void PreviewAction ( object sender , EventArgs args )
{
2019-06-01 21:49:39 +00:00
ArchiveListPreviewForm previewFormatList = new ArchiveListPreviewForm ( ) ;
previewFormatList . LoadArchive ( ArchiveFile ) ;
previewFormatList . Show ( ) ;
2019-05-28 23:33:42 +00:00
}
2019-05-27 22:00:03 +00:00
public override void OnClick ( TreeView treeView )
{
2019-07-11 21:22:59 +00:00
STPropertyGrid editor = ( STPropertyGrid ) LibraryGUI . GetActiveContent ( typeof ( STPropertyGrid ) ) ;
2019-05-27 22:00:03 +00:00
if ( editor = = null )
{
editor = new STPropertyGrid ( ) ;
2019-07-11 21:22:59 +00:00
LibraryGUI . LoadEditor ( editor ) ;
2019-05-27 22:00:03 +00:00
}
editor . Text = Text ;
editor . Dock = DockStyle . Fill ;
editor . LoadProperty ( PropertyDisplay , OnPropertyChanged ) ;
}
public virtual void OnPropertyChanged ( ) {
Text = Name ;
}
public class GenericArchiveProperties
{
2019-08-06 23:02:09 +00:00
private ArchiveRootNodeWrapper rootNode ;
2019-05-27 22:00:03 +00:00
private IArchiveFile ArchiveFile ;
[Category("Archive Properties")]
public string Name { get ; set ; }
[Category("Archive Properties")]
[DisplayName("File Count")]
public int FileCount
{
2019-08-06 23:02:09 +00:00
get
{
return rootNode . FileNodes ! = null ? rootNode . FileNodes . Count : 0 ;
}
2019-05-27 22:00:03 +00:00
}
2019-08-06 23:02:09 +00:00
public GenericArchiveProperties ( IArchiveFile archiveFile , string text , ArchiveRootNodeWrapper root ) {
2019-05-27 22:00:03 +00:00
ArchiveFile = archiveFile ;
Name = text ;
2019-08-06 23:02:09 +00:00
rootNode = root ;
2019-05-27 22:00:03 +00:00
}
}
2019-06-24 19:45:54 +00:00
public void FillTreeNodes ( ) {
FillTreeNodes ( this , ArchiveFile ) ;
}
2019-06-30 15:14:51 +00:00
private void FillDirectory ( TreeNode parent , IEnumerable < INode > Nodes , IArchiveFile archiveFile )
2019-06-30 01:05:10 +00:00
{
foreach ( var node in Nodes )
{
2019-06-30 15:14:51 +00:00
if ( node is IDirectoryContainer )
{
2019-07-19 00:02:37 +00:00
var folder = new ArchiveFolderNodeWrapper ( node . Name , archiveFile , this ) ;
2019-06-30 15:14:51 +00:00
parent . Nodes . Add ( folder ) ;
2019-06-30 01:05:10 +00:00
2019-06-30 15:14:51 +00:00
if ( ( ( IDirectoryContainer ) node ) . Nodes ! = null )
FillDirectory ( folder , ( ( IDirectoryContainer ) node ) . Nodes , archiveFile ) ;
}
else if ( node is ArchiveFileInfo )
{
2019-07-22 19:06:49 +00:00
ArchiveFileWrapper wrapperFile = new ArchiveFileWrapper ( node . Name , ( ArchiveFileInfo ) node , this ) ;
2019-06-30 15:14:51 +00:00
wrapperFile . Name = node . Name ;
parent . Nodes . Add ( wrapperFile ) ;
2019-07-25 22:54:58 +00:00
AddFileNode ( wrapperFile ) ;
2019-06-30 15:14:51 +00:00
}
2019-06-30 01:05:10 +00:00
}
}
2019-06-24 19:45:54 +00:00
private void FillTreeNodes ( TreeNode root , IArchiveFile archiveFile )
{
Nodes . Clear ( ) ;
var rootText = root . Text ;
var rootTextLength = rootText . Length ;
2019-06-28 22:02:11 +00:00
var nodeFiles = archiveFile . Files ;
2019-06-24 19:45:54 +00:00
2019-06-30 01:05:10 +00:00
if ( archiveFile is IDirectoryContainer )
{
2019-06-30 15:14:51 +00:00
FillDirectory ( root , ( ( IDirectoryContainer ) archiveFile ) . Nodes , archiveFile ) ;
2019-06-30 01:05:10 +00:00
}
else //Else create directories by filename paths
2019-06-24 19:45:54 +00:00
{
2019-06-30 01:05:10 +00:00
foreach ( var node in archiveFile . Files )
2019-06-24 19:45:54 +00:00
{
2019-06-30 01:05:10 +00:00
if ( ! node . CanLoadFile )
continue ;
2019-07-21 17:25:18 +00:00
if ( ! ( ( IFileFormat ) archiveFile ) . IFileInfo . InArchive & & File . Exists ( ( ( IFileFormat ) archiveFile ) . FilePath ) )
node . SourceFile = ( ( IFileFormat ) archiveFile ) . FilePath ;
2019-06-30 01:05:10 +00:00
string nodeString = node . FileName ;
2019-06-24 19:45:54 +00:00
2019-06-30 01:05:10 +00:00
var roots = nodeString . Split ( new char [ ] { '/' } ,
StringSplitOptions . RemoveEmptyEntries ) ;
2019-06-24 19:45:54 +00:00
2019-06-30 01:05:10 +00:00
// The initial parent is the root node
var parentNode = root ;
var sb = new System . Text . StringBuilder ( rootText , nodeString . Length + rootTextLength ) ;
for ( int rootIndex = 0 ; rootIndex < roots . Length ; rootIndex + + )
{
// Build the node name
var parentName = roots [ rootIndex ] ;
sb . Append ( "/" ) ;
sb . Append ( parentName ) ;
var nodeName = sb . ToString ( ) ;
// Search for the node
var index = parentNode . Nodes . IndexOfKey ( nodeName ) ;
if ( index = = - 1 )
2019-06-24 19:45:54 +00:00
{
2019-06-30 01:05:10 +00:00
// Node was not found, add it
2019-07-19 00:02:37 +00:00
var folder = new ArchiveFolderNodeWrapper ( parentName , archiveFile , this ) ;
2019-06-30 01:05:10 +00:00
if ( rootIndex = = roots . Length - 1 )
{
2019-07-22 19:06:49 +00:00
ArchiveFileWrapper wrapperFile = new ArchiveFileWrapper ( parentName , node , this ) ;
2019-06-30 01:05:10 +00:00
wrapperFile . Name = nodeName ;
parentNode . Nodes . Add ( wrapperFile ) ;
parentNode = wrapperFile ;
2019-07-22 19:06:49 +00:00
AddFileNode ( wrapperFile ) ;
2019-06-30 01:05:10 +00:00
}
else
{
folder . Name = nodeName ;
parentNode . Nodes . Add ( folder ) ;
parentNode = folder ;
}
2019-06-24 19:45:54 +00:00
}
else
{
2019-06-30 01:05:10 +00:00
// Node was found, set that as parent and continue
parentNode = parentNode . Nodes [ index ] ;
2019-06-24 19:45:54 +00:00
}
}
}
}
}
2019-05-18 16:24:03 +00:00
}
//Wrapper for folders
2019-06-24 19:45:54 +00:00
public class ArchiveFolderNodeWrapper : ArchiveBase , IContextMenuNode
2019-05-18 15:13:14 +00:00
{
2019-07-19 00:02:37 +00:00
public ArchiveRootNodeWrapper RootNode ;
2019-05-27 22:00:03 +00:00
public virtual object PropertyDisplay { get ; set ; }
2019-05-18 15:22:18 +00:00
public bool CanReplace
{
set
{
if ( value )
ContextMenuStrip . Items [ 1 ] . Enabled = true ;
else
ContextMenuStrip . Items [ 1 ] . Enabled = false ;
}
}
public bool CanRename = false ;
public bool CanDelete
{
set
{
if ( value )
ContextMenuStrip . Items [ 2 ] . Enabled = true ;
else
ContextMenuStrip . Items [ 2 ] . Enabled = false ;
}
}
2019-07-19 00:02:37 +00:00
public ArchiveFolderNodeWrapper ( string text , IArchiveFile archiveFile , ArchiveRootNodeWrapper root ) : base ( archiveFile )
2019-05-18 15:13:14 +00:00
{
2019-07-19 00:02:37 +00:00
RootNode = root ;
2019-05-18 15:13:14 +00:00
Text = text ;
2019-05-27 22:00:03 +00:00
PropertyDisplay = new GenericFolderProperties ( ) ;
( ( GenericFolderProperties ) PropertyDisplay ) . Name = Text ;
2019-06-24 19:45:54 +00:00
// ReloadMenus(archiveFile);
2019-05-27 22:00:03 +00:00
}
2019-05-18 15:13:14 +00:00
2019-06-24 19:45:54 +00:00
public ToolStripItem [ ] GetContextMenuItems ( )
2019-05-27 22:00:03 +00:00
{
2019-06-24 19:45:54 +00:00
return new ToolStripItem [ ]
{
new STToolStripItem ( "Rename" , RenameAction ) { Enabled = ArchiveFile . CanRenameFiles } ,
new STToolStripItem ( "Extract Folder" , ExtractAction ) ,
2019-11-23 00:55:48 +00:00
new STToolStripItem ( "Replace Folder" , ReplaceAction ) { Enabled = ArchiveFile . CanReplaceFiles & & ArchiveFile . CanAddFiles } ,
2019-06-24 19:45:54 +00:00
new STToolStripItem ( "Delete Folder" , DeleteAction ) { Enabled = ArchiveFile . CanDeleteFiles } ,
new STToolStripSeparator ( ) ,
2019-07-18 22:16:45 +00:00
new STToolStripItem ( "Add Folder" , AddFolderAction ) { Enabled = ArchiveFile . CanAddFiles } ,
new STToolStripItem ( "Add File" , AddFileAction ) { Enabled = ArchiveFile . CanAddFiles } ,
2019-11-19 02:10:54 +00:00
new STToolStripItem ( "Clear Files" , ClearAction ) { Enabled = ArchiveFile . CanDeleteFiles } ,
2019-06-24 19:45:54 +00:00
} ;
2019-05-29 18:24:24 +00:00
}
2019-07-18 22:16:45 +00:00
private void AddFolderAction ( object sender , EventArgs args )
{
2019-07-19 00:02:37 +00:00
Nodes . Add ( new ArchiveFolderNodeWrapper ( "NewFolder" , ArchiveFile , RootNode ) ) ;
2019-07-18 22:16:45 +00:00
}
2019-05-29 18:24:24 +00:00
private void AddFileAction ( object sender , EventArgs args )
{
OpenFileDialog ofd = new OpenFileDialog ( ) ;
ofd . Filter = "Raw Data (*.*)|*.*" ;
ofd . Multiselect = true ;
if ( ofd . ShowDialog ( ) = = DialogResult . OK ) {
2019-07-22 19:06:49 +00:00
TreeHelper . AddFiles ( this , RootNode , ofd . FileNames ) ;
2019-05-29 18:24:24 +00:00
}
2019-05-18 15:13:14 +00:00
}
2019-11-19 02:10:54 +00:00
private void ClearAction ( object sender , EventArgs args )
{
foreach ( var node in TreeViewExtensions . Collect ( Nodes ) )
{
if ( node is ArchiveFileWrapper )
ArchiveFile . DeleteFile ( ( ( ArchiveFileWrapper ) node ) . ArchiveFileInfo ) ;
}
Nodes . Clear ( ) ;
}
2019-05-27 22:00:03 +00:00
public override void OnClick ( TreeView treeView )
{
2019-07-11 21:22:59 +00:00
STPropertyGrid editor = ( STPropertyGrid ) LibraryGUI . GetActiveContent ( typeof ( STPropertyGrid ) ) ;
2019-05-27 22:00:03 +00:00
if ( editor = = null )
{
editor = new STPropertyGrid ( ) ;
2019-07-11 21:22:59 +00:00
LibraryGUI . LoadEditor ( editor ) ;
2019-05-27 22:00:03 +00:00
}
editor . Text = Text ;
editor . Dock = DockStyle . Fill ;
editor . LoadProperty ( PropertyDisplay , OnPropertyChanged ) ;
}
public class GenericFolderProperties
{
[Category("Folder Properties")]
public string Name { get ; set ; }
}
public virtual void OnPropertyChanged ( ) {
Text = Name ;
}
2019-05-18 15:13:14 +00:00
private void ExtractAction ( object sender , EventArgs args )
{
TreeNode node = this ;
2019-05-28 23:33:42 +00:00
var ParentPath = string . Empty ;
2019-05-18 15:13:14 +00:00
if ( node . Parent ! = null )
ParentPath = node . Parent . FullPath ;
2019-05-28 23:33:42 +00:00
TreeHelper . ExtractAllFiles ( ParentPath , Nodes ) ;
2019-05-18 15:13:14 +00:00
}
2019-05-29 18:24:24 +00:00
private void RenameAction ( object sender , EventArgs args )
2019-05-18 15:13:14 +00:00
{
2019-05-29 18:24:24 +00:00
RenameDialog dialog = new RenameDialog ( ) ;
dialog . SetString ( Text ) ;
2019-05-18 15:22:18 +00:00
2019-07-18 20:42:27 +00:00
if ( dialog . ShowDialog ( ) = = DialogResult . OK )
{
Text = dialog . textBox1 . Text ;
}
2019-05-18 15:22:18 +00:00
}
2019-11-19 02:10:54 +00:00
private void ReplaceAction ( object sender , EventArgs args ) {
//Add folders and files from selected path
FolderSelectDialog ofd = new FolderSelectDialog ( ) ;
if ( ofd . ShowDialog ( ) = = DialogResult . OK ) {
//Clear all nodes
foreach ( var node in TreeViewExtensions . Collect ( Nodes ) )
{
if ( node is ArchiveFileWrapper )
ArchiveFile . DeleteFile ( ( ( ArchiveFileWrapper ) node ) . ArchiveFileInfo ) ;
}
Nodes . Clear ( ) ;
TreeHelper . AddFiles ( this , RootNode , Directory . GetFiles ( ofd . SelectedPath ) ) ;
}
2019-05-29 18:24:24 +00:00
}
2019-05-18 15:22:18 +00:00
2019-05-29 18:24:24 +00:00
private void DeleteAction ( object sender , EventArgs args ) {
TreeHelper . RemoveFolder ( this , ArchiveFile ) ;
2019-05-18 15:13:14 +00:00
}
}
2019-05-18 16:24:03 +00:00
//Wrapper for files
2019-06-24 19:45:54 +00:00
public class ArchiveFileWrapper : ArchiveBase , IContextMenuNode
2019-05-12 00:51:23 +00:00
{
2019-07-22 19:06:49 +00:00
public ArchiveRootNodeWrapper RootNode ;
2019-06-01 21:49:39 +00:00
public virtual ArchiveFileInfo ArchiveFileInfo { get ; set ; }
2019-07-22 19:06:49 +00:00
public ArchiveFileWrapper ( string text , ArchiveFileInfo archiveFileInfo , ArchiveRootNodeWrapper rootNode ) : base ( rootNode . ArchiveFile )
2019-05-12 00:51:23 +00:00
{
Text = text ;
2019-07-22 19:06:49 +00:00
RootNode = rootNode ;
2019-06-24 19:45:54 +00:00
// ReloadMenus(archiveFile);
2019-06-01 21:49:39 +00:00
ArchiveFileInfo = archiveFileInfo ;
2019-06-25 18:56:19 +00:00
string Extension = Utils . GetExtension ( text ) ;
2019-06-18 20:27:36 +00:00
if ( ArchiveFileInfo . CheckFileMagic )
2019-06-01 21:49:39 +00:00
{
2019-06-18 20:27:36 +00:00
Extension = FindMatch ( archiveFileInfo . FileData ) ;
}
2019-11-23 00:55:48 +00:00
2019-06-18 20:27:36 +00:00
switch ( Extension )
{
case ".bntx" : SetImageKey ( "bntx" ) ; break ;
case ".byaml" : SetImageKey ( "byaml" ) ; break ;
2019-06-25 18:56:19 +00:00
case ".byml" : SetImageKey ( "byaml" ) ; break ;
2019-06-18 20:27:36 +00:00
case ".aamp" : SetImageKey ( "aamp" ) ; break ;
case ".bfres" : SetImageKey ( "bfres" ) ; break ;
case ".sbfres" : SetImageKey ( "sbfres" ) ; break ;
2019-11-23 00:55:48 +00:00
case ".gfbmdl" : SetImageKey ( "model" ) ; break ;
2019-07-06 15:31:39 +00:00
case ".dds" :
case ".tga" :
2019-06-18 20:27:36 +00:00
case ".jpg" :
case ".jpeg" :
case ".tiff" :
case ".png" :
case ".gif" :
case ".astc" :
SetImageKey ( "texture" ) ; break ;
default : SetImageKey ( "fileBlank" ) ; break ;
2019-06-01 21:49:39 +00:00
}
2019-07-06 15:31:39 +00:00
if ( ArchiveFileInfo . ExtensionImageKeyLookup ! = null )
{
if ( ArchiveFileInfo . ExtensionImageKeyLookup . ContainsKey ( Extension ) )
SetImageKey ( ArchiveFileInfo . ExtensionImageKeyLookup [ Extension ] ) ;
}
2019-06-01 21:49:39 +00:00
}
private void SetImageKey ( string Key ) {
ImageKey = Key ;
SelectedImageKey = Key ;
}
private string FindMatch ( byte [ ] f )
{
if ( f . Matches ( "SARC" ) ) return ".szs" ;
else if ( f . Matches ( "Yaz" ) ) return ".szs" ;
else if ( f . Matches ( "YB" ) | | f . Matches ( "BY" ) ) return ".byaml" ;
else if ( f . Matches ( "FRES" ) ) return ".bfres" ;
else if ( f . Matches ( "Gfx2" ) ) return ".gtx" ;
else if ( f . Matches ( "FLYT" ) ) return ".bflyt" ;
else if ( f . Matches ( "CLAN" ) ) return ".bclan" ;
else if ( f . Matches ( "CLYT" ) ) return ".bclyt" ;
else if ( f . Matches ( "FLIM" ) ) return ".bclim" ;
else if ( f . Matches ( "FLAN" ) ) return ".bflan" ;
else if ( f . Matches ( "FSEQ" ) ) return ".bfseq" ;
2019-11-18 01:52:03 +00:00
else if ( f . Matches ( "VFXB" ) ) return ".ptcl" ;
2019-06-01 21:49:39 +00:00
else if ( f . Matches ( "AAHS" ) ) return ".sharc" ;
else if ( f . Matches ( "BAHS" ) ) return ".sharcb" ;
else if ( f . Matches ( "BNTX" ) ) return ".bntx" ;
else if ( f . Matches ( "BNSH" ) ) return ".bnsh" ;
else if ( f . Matches ( "FSHA" ) ) return ".bfsha" ;
else if ( f . Matches ( "FFNT" ) ) return ".bffnt" ;
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 ( "CWAV" ) ) return ".bcwav" ;
else if ( f . Matches ( "FWAV" ) ) return ".bfwav" ;
else if ( f . Matches ( "CTPK" ) ) return ".ctpk" ;
else if ( f . Matches ( "CGFX" ) ) return ".bcres" ;
else if ( f . Matches ( "AAMP" ) ) return ".aamp" ;
else if ( f . Matches ( "MsgStdBn" ) ) return ".msbt" ;
else if ( f . Matches ( "MsgPrjBn" ) ) return ".msbp" ;
else if ( f . Matches ( 0x00000004 ) ) return ".gfbanm" ;
else if ( f . Matches ( 0x00000014 ) ) return ".gfbanm" ;
else if ( f . Matches ( 0x00000018 ) ) return ".gfbanmcfg" ;
else if ( f . Matches ( 0x00000020 ) ) return ".gfbmdl" ;
else if ( f . Matches ( 0x00000044 ) ) return ".gfbpokecfg" ;
else return "" ;
2019-05-27 22:00:03 +00:00
}
2019-05-12 00:51:23 +00:00
2019-07-22 19:06:49 +00:00
public static ArchiveFileWrapper FromPath ( string FilePath , ArchiveRootNodeWrapper rootNode )
2019-05-27 22:00:03 +00:00
{
2019-06-01 21:49:39 +00:00
var ArchiveFileInfo = new ArchiveFileInfo ( ) ;
ArchiveFileInfo . FileName = FilePath ;
ArchiveFileInfo . FileData = File . ReadAllBytes ( FilePath ) ;
2019-07-22 19:06:49 +00:00
return new ArchiveFileWrapper ( Path . GetFileName ( FilePath ) , ArchiveFileInfo , rootNode ) ;
2019-05-27 22:00:03 +00:00
}
2019-06-24 19:45:54 +00:00
public ToolStripItem [ ] GetContextMenuItems ( )
2019-05-27 22:00:03 +00:00
{
2019-06-24 19:45:54 +00:00
return new ToolStripItem [ ]
{
new STToolStripItem ( "Rename" , RenameAction ) { Enabled = ArchiveFile . CanRenameFiles } ,
new STToolStripItem ( "Export Raw Data" , ExtractAction ) ,
new STToolStipMenuItem ( "Export Raw Data to File Location" , null , ExportToFileLocAction , Keys . Control | Keys . F ) ,
new STToolStripItem ( "Replace Raw Data" , ReplaceAction ) { Enabled = ArchiveFile . CanReplaceFiles } ,
new STToolStripSeparator ( ) ,
new STToolStipMenuItem ( "Open With Text Editor" , null , OpenTextEditorAction , Keys . Control | Keys . T ) ,
new STToolStripSeparator ( ) ,
new STToolStripItem ( "Delete" , DeleteAction ) { Enabled = ArchiveFile . CanDeleteFiles } ,
} ;
2019-05-12 00:51:23 +00:00
}
2019-06-09 17:51:04 +00:00
private void OpenTextEditorAction ( object sender , EventArgs args )
{
2019-07-11 21:22:59 +00:00
TextEditor editor = ( TextEditor ) LibraryGUI . GetActiveContent ( typeof ( TextEditor ) ) ;
2019-06-09 17:51:04 +00:00
if ( editor = = null )
{
editor = new TextEditor ( ) ;
2019-07-11 21:22:59 +00:00
LibraryGUI . LoadEditor ( editor ) ;
2019-06-09 17:51:04 +00:00
}
editor . Text = Text ;
editor . Dock = DockStyle . Fill ;
editor . FillEditor ( ArchiveFileInfo . FileData ) ;
}
2019-05-12 00:51:23 +00:00
private void ExtractAction ( object sender , EventArgs args )
{
ArchiveFileInfo . Export ( ) ;
}
2019-06-09 17:51:04 +00:00
private void ExportToFileLocAction ( object sender , EventArgs args )
{
2019-09-08 22:47:28 +00:00
string path = FileManager . GetSourcePath ( ( ( IFileFormat ) ArchiveFile ) ) ;
string folder = Path . GetDirectoryName ( path ) ;
string filePath = Path . Combine ( folder , Text ) ;
2019-08-20 20:52:48 +00:00
2019-06-09 17:51:04 +00:00
Cursor . Current = Cursors . WaitCursor ;
2019-08-20 20:52:48 +00:00
if ( ArchiveFileInfo . FileDataStream ! = null )
ArchiveFileInfo . FileDataStream . ExportToFile ( filePath ) ;
else
File . WriteAllBytes ( filePath , ArchiveFileInfo . FileData ) ;
2019-06-09 17:51:04 +00:00
Cursor . Current = Cursors . Default ;
}
2019-05-18 15:22:18 +00:00
private void DeleteAction ( object sender , EventArgs args )
{
2019-06-09 17:51:04 +00:00
DialogResult result = MessageBox . Show ( $"Are your sure you want to remove {Text}? This cannot be undone!" , "" , MessageBoxButtons . YesNo , MessageBoxIcon . Question ) ;
if ( result = = DialogResult . Yes )
{
2019-11-23 00:55:48 +00:00
bool isRemoved = ArchiveFile . DeleteFile ( ArchiveFileInfo ) ;
if ( ! isRemoved ) return ;
if ( Parent ! = null )
Parent . Nodes . Remove ( this ) ;
else if ( ArchiveFileInfo . FileFormat ! = null & &
ArchiveFileInfo . FileFormat is TreeNode )
{
var prevNode = ( TreeNode ) ArchiveFileInfo . FileFormat ;
var parent = prevNode . Parent ;
var index = parent . Nodes . IndexOf ( prevNode ) ;
parent . Nodes . RemoveAt ( index ) ;
}
2019-06-09 17:51:04 +00:00
}
2019-05-18 15:22:18 +00:00
}
2019-05-12 00:51:23 +00:00
private void ReplaceAction ( object sender , EventArgs args )
{
2019-11-23 00:55:48 +00:00
if ( ! ArchiveFile . CanReplaceFiles ) return ;
bool IsReplaced = ArchiveFileInfo . Replace ( ) ;
if ( ! IsReplaced ) return ;
if ( ArchiveFileInfo . FileFormat ! = null )
{
if ( ArchiveFileInfo . FileFormat is IArchiveFile )
{
}
if ( ArchiveFileInfo . FileFormat is TreeNode )
{
var prevNode = ( TreeNode ) ArchiveFileInfo . FileFormat ;
var parent = prevNode . Parent ;
2020-05-18 00:40:04 +00:00
if ( parent ! = null )
{
var index = parent . Nodes . IndexOf ( prevNode ) ;
parent . Nodes . RemoveAt ( index ) ;
parent . Nodes . Insert ( index , this ) ;
}
2019-11-23 00:55:48 +00:00
}
ArchiveFileInfo . FileFormat . Unload ( ) ;
ArchiveFileInfo . FileFormat = null ;
Nodes . Clear ( ) ;
OpenFileFormat ( TreeView ) ;
}
2019-08-14 20:36:19 +00:00
UpdateEditor ( ) ;
2019-05-12 00:51:23 +00:00
}
2019-07-29 20:48:24 +00:00
public override void OnDoubleMouseClick ( TreeView treeview ) {
2019-07-31 21:08:00 +00:00
OpenFileFormat ( treeview ) ;
2019-07-29 20:48:24 +00:00
}
2019-07-31 21:08:00 +00:00
public void OpenFileFormat ( TreeView treeview )
2019-05-12 00:51:23 +00:00
{
2019-06-01 21:49:39 +00:00
IFileFormat file = ArchiveFileInfo . OpenFile ( ) ;
2019-05-28 20:11:40 +00:00
if ( file = = null ) //Format not supported so return
return ;
2019-08-29 19:45:32 +00:00
if ( file . IFileInfo ! = null )
file . IFileInfo . ArchiveParent = ArchiveFile ;
2019-05-28 20:11:40 +00:00
if ( Utils . HasInterface ( file . GetType ( ) , typeof ( IEditor < > ) ) )
2019-08-29 19:45:32 +00:00
OpenControlDialog ( file ) ;
else if ( Utils . HasInterface ( file . GetType ( ) , typeof ( IEditorForm < > ) ) )
2019-05-28 20:11:40 +00:00
OpenFormDialog ( file ) ;
2019-06-24 19:45:54 +00:00
else if ( file is IArchiveFile )
{
var FileRoot = new ArchiveRootNodeWrapper ( file . FileName , ( IArchiveFile ) file ) ;
FileRoot . FillTreeNodes ( ) ;
2019-07-31 23:45:03 +00:00
if ( file is TreeNode ) //It can still be both, so add all it's nodes
{
foreach ( TreeNode n in ( ( TreeNode ) file ) . Nodes )
FileRoot . Nodes . Add ( n ) ;
}
2019-07-31 21:08:00 +00:00
ReplaceNode ( this . Parent , treeview , this , FileRoot , RootNode ) ;
2019-06-24 19:45:54 +00:00
}
2019-07-31 23:45:03 +00:00
else if ( file is TreeNode )
2019-08-12 19:19:30 +00:00
{
2019-07-31 23:45:03 +00:00
ReplaceNode ( this . Parent , treeview , this , ( TreeNode ) file , RootNode ) ;
2019-08-12 19:19:30 +00:00
}
ArchiveFileInfo . FileFormat = file ;
2019-05-12 00:51:23 +00:00
}
2019-08-29 19:45:32 +00:00
private static Form activeForm ;
public void OpenFormDialog ( IFileFormat fileFormat )
{
2019-08-29 20:33:23 +00:00
if ( activeForm ! = null & & ! activeForm . IsDisposed & & ! activeForm . Disposing )
2019-08-29 19:45:32 +00:00
{
activeForm . Text = ( ( ( IFileFormat ) fileFormat ) . FileName ) ;
System . Reflection . MethodInfo methodFill = fileFormat . GetType ( ) . GetMethod ( "FillEditor" ) ;
methodFill . Invoke ( fileFormat , new object [ 1 ] { activeForm } ) ;
}
else
{
activeForm = GetEditorForm ( fileFormat ) ;
activeForm . Text = ( ( ( IFileFormat ) fileFormat ) . FileName ) ;
2020-02-12 22:50:10 +00:00
if ( activeForm is IArchiveEditor )
( ( IArchiveEditor ) activeForm ) . UpdateArchiveFile + = OnFormSaved ;
2019-08-29 19:45:32 +00:00
activeForm . Show ( ) ;
}
2019-09-01 17:29:24 +00:00
}
2019-09-10 22:42:48 +00:00
private void OnFormSaved ( object sender , EventArgs args )
{
if ( ArchiveFileInfo . FileFormat = = null ) return ;
Console . WriteLine ( "OnFormSaved" ) ;
if ( ArchiveFileInfo . FileFormat . CanSave )
{
Console . WriteLine ( "SaveFileFormat" ) ;
ArchiveFileInfo . SaveFileFormat ( ) ;
UpdateEditor ( ) ;
}
}
2019-09-01 17:29:24 +00:00
private void OnFormClosed ( object sender , EventArgs args )
{
if ( ArchiveFileInfo . FileFormat = = null ) return ;
2019-08-29 19:45:32 +00:00
2019-09-01 17:29:24 +00:00
if ( activeForm . DialogResult = = DialogResult . OK )
2019-08-29 19:45:32 +00:00
{
2019-09-01 17:29:24 +00:00
if ( ArchiveFileInfo . FileFormat . CanSave )
2019-08-29 19:45:32 +00:00
{
ArchiveFileInfo . SaveFileFormat ( ) ;
UpdateEditor ( ) ;
}
2019-09-01 17:29:24 +00:00
}
2019-08-29 19:45:32 +00:00
}
private void OpenControlDialog ( IFileFormat fileFormat )
2019-05-28 20:11:40 +00:00
{
2019-08-29 19:45:32 +00:00
UserControl form = GetEditorControl ( fileFormat ) ;
2019-09-08 01:16:16 +00:00
2019-06-13 22:40:29 +00:00
form . Text = ( ( ( IFileFormat ) fileFormat ) . FileName ) ;
2019-07-11 21:22:59 +00:00
var parentForm = LibraryGUI . GetActiveForm ( ) ;
2019-05-28 20:11:40 +00:00
2019-06-13 22:40:29 +00:00
GenericEditorForm editorForm = new GenericEditorForm ( true , form ) ;
editorForm . FormClosing + = ( sender , e ) = > FormClosing ( sender , e , fileFormat ) ;
if ( editorForm . ShowDialog ( ) = = DialogResult . OK )
{
if ( fileFormat . CanSave )
{
2019-07-01 19:44:19 +00:00
ArchiveFileInfo . SaveFileFormat ( ) ;
2019-06-13 22:40:29 +00:00
UpdateEditor ( ) ;
}
}
2019-05-28 20:11:40 +00:00
}
private void FormClosing ( object sender , EventArgs args , IFileFormat fileFormat )
{
if ( ( ( Form ) sender ) . DialogResult ! = DialogResult . OK )
return ;
}
2019-08-29 19:45:32 +00:00
public Form GetEditorForm ( IFileFormat fileFormat )
{
Type objectType = fileFormat . GetType ( ) ;
foreach ( var inter in objectType . GetInterfaces ( ) )
{
if ( inter . IsGenericType & & inter . GetGenericTypeDefinition ( ) = = typeof ( IEditorForm < > ) )
{
System . Reflection . MethodInfo method = objectType . GetMethod ( "OpenForm" ) ;
return ( Form ) method . Invoke ( fileFormat , new object [ 0 ] ) ;
}
}
return null ;
}
public UserControl GetEditorControl ( IFileFormat fileFormat )
2019-05-28 20:11:40 +00:00
{
Type objectType = fileFormat . GetType ( ) ;
foreach ( var inter in objectType . GetInterfaces ( ) )
{
if ( inter . IsGenericType & & inter . GetGenericTypeDefinition ( ) = = typeof ( IEditor < > ) )
{
System . Reflection . MethodInfo method = objectType . GetMethod ( "OpenForm" ) ;
2019-09-08 01:16:16 +00:00
System . Reflection . MethodInfo methodFill = fileFormat . GetType ( ) . GetMethod ( "FillEditor" ) ;
var control = ( UserControl ) method . Invoke ( fileFormat , new object [ 0 ] ) ;
methodFill . Invoke ( fileFormat , new object [ 1 ] { control } ) ;
return control ;
2019-05-28 20:11:40 +00:00
}
}
return null ;
}
public override void OnClick ( TreeView treeView ) {
2019-06-10 00:03:56 +00:00
UpdateEditor ( ) ;
2019-05-28 20:11:40 +00:00
}
2019-06-10 00:03:56 +00:00
public void UpdateEditor ( )
2019-05-12 00:52:14 +00:00
{
2020-05-18 00:40:04 +00:00
if ( ArchiveFileInfo . FileFormat ! = null )
Console . WriteLine ( $"UpdateEditor {ArchiveFileInfo.FileFormat.FileName}" ) ;
2019-07-11 21:22:59 +00:00
ArchiveFilePanel editor = ( ArchiveFilePanel ) LibraryGUI . GetActiveContent ( typeof ( ArchiveFilePanel ) ) ;
2019-05-12 00:52:14 +00:00
if ( editor = = null )
{
2019-06-10 00:16:11 +00:00
editor = new ArchiveFilePanel ( ) ;
2019-06-10 00:03:56 +00:00
editor . Dock = DockStyle . Fill ;
2019-07-11 21:22:59 +00:00
LibraryGUI . LoadEditor ( editor ) ;
2019-05-12 00:52:14 +00:00
}
2019-06-10 00:03:56 +00:00
2019-08-29 19:45:32 +00:00
editor . LoadFile ( ArchiveFileInfo , ArchiveFile ) ;
2019-06-10 00:03:56 +00:00
editor . UpdateEditor ( ) ;
2019-05-12 00:52:14 +00:00
}
2019-07-31 21:08:00 +00:00
public static void ReplaceNode ( TreeNode node , TreeView treeview , ArchiveFileWrapper replaceNode , TreeNode NewNode , ArchiveRootNodeWrapper rootNode )
2019-05-12 00:51:23 +00:00
{
if ( NewNode = = null )
return ;
2019-07-22 19:06:49 +00:00
var fileInfo = replaceNode . ArchiveFileInfo ;
2019-07-31 21:08:00 +00:00
int index = 0 ;
if ( node = = null )
{
index = treeview . Nodes . IndexOf ( replaceNode ) ;
treeview . Nodes . RemoveAt ( index ) ;
treeview . Nodes . Insert ( index , NewNode ) ;
}
else
{
index = node . Nodes . IndexOf ( replaceNode ) ;
node . Nodes . RemoveAt ( index ) ;
node . Nodes . Insert ( index , NewNode ) ;
}
2019-06-09 00:19:55 +00:00
NewNode . ImageKey = replaceNode . ImageKey ;
NewNode . SelectedImageKey = replaceNode . SelectedImageKey ;
2019-06-09 17:51:04 +00:00
NewNode . Text = replaceNode . Text ;
2019-08-20 21:22:01 +00:00
NewNode . Tag = fileInfo ;
2019-07-24 19:10:05 +00:00
rootNode . FileNodes . RemoveAt ( index ) ;
rootNode . FileNodes . Insert ( index , Tuple . Create ( fileInfo , NewNode ) ) ;
2019-08-05 22:48:14 +00:00
if ( NewNode is ISingleTextureIconLoader )
{
ObjectEditor editor = LibraryGUI . GetObjectEditor ( ) ;
if ( editor ! = null ) //The editor isn't always in object editor so check
{
editor . UpdateTextureIcon ( ( ISingleTextureIconLoader ) NewNode ) ;
}
}
2019-05-12 00:51:23 +00:00
}
2019-05-29 18:24:24 +00:00
private void RenameAction ( object sender , EventArgs args )
{
RenameDialog dialog = new RenameDialog ( ) ;
dialog . SetString ( Text ) ;
if ( dialog . ShowDialog ( ) = = DialogResult . OK ) { Text = dialog . textBox1 . Text ; }
}
2019-05-12 00:51:23 +00:00
}
Add files for the new one.
Rework UI from scratch with proper themes and custom controls. MDI windows are now used for workspaces, comparing docs, and multiple usages. Tabs organise multiple workspaces and you can keep mdi windows maximized if you want to only use tabs. Themes currently include dark and white theme but plan to have XML files with list of color and styles
Alot of things optimized. UI is very fast and snappy now
Dae rigging fixed.
Dae bones can be imported.
Dae with textures can be imported and exported to a folder
Custom sampler editor for sampler data.
Texture refs, shader options, params, render info, and basically all material data can be added/removed and edited
User data editor
Update opengl framework by JuPaHe64 to the newest. Includes an origintation cube, multiple models in a scene, and many improvements
Skeleton can be viewed
GFPAK with some fixes in saving
NUTEXB has proper mip map viewing
PTCL Editor (Wii U and Switch). Can edit colors ( Wii U) and view textures. Also EFFN files in smash ultimate can be previewed
Files can be associated with the program and opened with on clicking them
ASTC textures can be viewed
UVs can be viewed. Includes wrap modes and also translating and scaling for some basic edits
Textures use a new editor. It includes channel viewing and some new editing options
Fixed black textures on some wii u bfres
Fixed saving sarcs in sarcs
Shortcut keys have been added in. CTRL + S can save the active file in the currently used window
Fix more issues with bfres crashing
File - New includes BNTX for creating new bntx files from scatch
Raw shader binaries can be extracted from bnsh and bfsha. Yuzu and Ryujinx can decompile these
Sharc files can have source data previewed and shader programs in XML
Aamp v1 and v2 data can be previewed. v1 can be edited and saved atm, v2 will be at a later update
Byaml uses it's own editor instead of a seperate window for easy saving within sarcs
Archives have a hex viewer
Dae exporting greatly improved and can export rigged meshes
Scene, shader param, srt, color, and texture pattern animations can all be previewed (in a list)
Memory usage is greatly improved
Narc (Nitro Archives) can be viewed and extracted.
Fixed importing TGA images
Support importing ASTC textures for bntx
Added in PBR lighting for bfres from my implimentaion in forge
Added gradient background for viewport. This can be edited in the settings
Added skybox background option for viewport. Can load cubemaps
Added grid with customizable cells for viewport.
DDS decompression no longer requires Direct X tex.
Zlib decompression has been improved for opening files that use it
Rigid bones are properly ordered on importing a mesh. May fix some exploding issues.
Endianness for KCL can be toggled for saving. Will be set to what it was using orignally
Tangents can be filled with a constant value. Will allow them to not cause seams nor flat lighting however normal maps may not work as good
Vertex buffers can be added and removed. Also re encoded
Parameters now use drop down panels with values for easier editing
Reworked the bone editor. Everything for a bone can be fully edited now besides the index, billboard index and parent index which get set automatically
Fixed animation scaling for skeletal animations finally!
Textures can be loaded in a tab now with thumbnail displaying for easy real time edits while previewing in the viewport
Fixed support for audio files to be big endian in BARS
Textures for switch now use their own folder. You can easily add textures to this and add textures to bfres that have no bntx. If there are no textures then the bfres will automatically not have one on save.
Animations are split into multiple sub sections for switch's material animation for easier access
Bfres for wii u has better binary exporting and is fully compatiable with Wexos Toolbox (to and from)
Every section can be added in as new for both wii u and switch.
Every section can be renamed properly and mostly everything can be edited. (Key frame editing and a more in depth curve editor later)
Added option to copy UV channel
Bone weights can be previewed
Tons of fixes for the switch bfres library with more games working. Splatoon 2 (more work now), BOTW, Kirby Star Allies, and more!
Fixed 3.3 Wii U bfres from not opening
Wii U Sharcfb files can have shader program data previewed (XML)
And possibly alot more things i missed! All this is still experimental but will improve over the next few weeks
2019-03-23 16:55:09 +00:00
}