BrawlCrate v0.41
Wii File Editor
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | Properties | List of all members
BrawlLib.SSBB.ResourceNodes.ARCNode Class Reference
Inheritance diagram for BrawlLib.SSBB.ResourceNodes.ARCNode:
BrawlLib.SSBB.ResourceNodes.ARCEntryNode BrawlLib.SSBB.ResourceNodes.U8EntryNode BrawlLib.SSBB.ResourceNodes.ResourceNode

Public Member Functions

void SortChildrenByFileIndex ()
 
override void OnPopulate ()
 
override void Initialize (ResourceNode parent, DataSource origSource, DataSource uncompSource)
 
override bool OnInitialize ()
 
void ExtractToFolder (string outFolder)
 
void ExtractToFolder (string outFolder, string imageExtension)
 
void ExtractToFolder (string outFolder, string imageExtension, string modelExtension)
 
void ReplaceFromFolder (string inFolder)
 
void ReplaceFromFolder (string inFolder, string imageExtension)
 
override int OnCalculateSize (bool force)
 
int OnCalculateSize (bool force, bool rebuilding)
 
override void OnRebuild (VoidPtr address, int size, bool force)
 
override void Export (string outPath)
 
void ExportAsMRG (string path)
 
void ExportPair (string path)
 
void ExportMarioPast (string path)
 
void ExportMetalGear (string path)
 
void ExportVillage (string path)
 
void ExportTengan (string path)
 
void ExportPAC (string outPath)
 
void ExportPCS (string outPath)
 
- Public Member Functions inherited from BrawlLib.SSBB.ResourceNodes.ARCEntryNode
bool isModelData ()
 
bool isTextureData ()
 
void UpdateName ()
 
override void Initialize (ResourceNode parent, DataSource origSource, DataSource uncompSource)
 
- Public Member Functions inherited from BrawlLib.SSBB.ResourceNodes.U8EntryNode
override bool OnInitialize ()
 
- Public Member Functions inherited from BrawlLib.SSBB.ResourceNodes.ResourceNode
void OnRenamed ()
 
List< ResourceNodeGetChildrenRecursive ()
 Used primarily to get bone lists. Kept for all resource nodes for utility. More...
 
virtual void SignalPropertyChange ()
 
virtual void Dispose ()
 
void SelectChildAtIndex (int index)
 
void UpdateProperties ()
 
void UpdateCurrentControl ()
 
virtual bool MoveUp ()
 
virtual bool MoveDown ()
 
virtual void OnMoved ()
 
virtual void DoMoveDown ()
 
virtual void DoMoveDown (bool select)
 
virtual void DoMoveUp ()
 
virtual void DoMoveUp (bool select)
 
virtual bool AddUp ()
 
virtual bool AddDown ()
 
virtual bool ToParent ()
 
void Populate (int levels=-1)
 
virtual void OnPopulate ()
 
void Initialize (ResourceNode parent, FileMap source)
 
void Initialize (ResourceNode parent, VoidPtr address, int length)
 
void Initialize (ResourceNode parent, DataSource origSource)
 
virtual void Initialize (ResourceNode parent, DataSource origSource, DataSource uncompSource)
 
virtual bool OnInitialize ()
 
virtual void Restore ()
 
virtual void Remove ()
 
virtual void RemoveChild (ResourceNode child)
 
virtual void AddChild (ResourceNode child)
 
virtual void AddChild (ResourceNode child, bool change)
 
virtual void InsertChild (ResourceNode child, int index)
 
virtual void InsertChild (ResourceNode child, bool change, int index)
 
void SetSizeInternal (int size)
 
virtual void Replace (string fileName)
 
virtual void Replace (ResourceNode node)
 
virtual void Replace (string fileName, FileMapProtect prot, FileOptions options)
 
virtual void ReplaceRaw (VoidPtr address, int length)
 
virtual void ReplaceRaw (FileMap map)
 
virtual void Export (string outPath)
 
void Export (FileStream outStream)
 
virtual void ExportUncompressed (string outPath)
 
void ExportUncompressed (FileStream outStream)
 
virtual void Rebuild ()
 
virtual void Rebuild (bool force)
 
virtual void Rebuild (VoidPtr address, int length, bool force)
 
virtual void OnRebuild (VoidPtr address, int length, bool force)
 
virtual int CalculateSize (bool force)
 
virtual int OnCalculateSize (bool force)
 
void Merge ()
 
void Merge (bool forceBuild)
 
ResourceNode FindChildByType (string path, bool searchChildren, params ResourceType[] types)
 
ResourceNode FindChildByType (string path, bool searchChildren, StringComparison compare, params ResourceType[] types)
 
ResourceNode FindChild (string path)
 
ResourceNode FindChild (string path, bool searchChildren)
 
ResourceNode FindChild (string path, StringComparison compare)
 
ResourceNode FindChild (string path, bool searchChildren, StringComparison compare)
 
ResourceNode[] FindChildrenByClassType (string path, Type type)
 
ResourceNode[] FindChildrenByType (string path, ResourceType type)
 
ResourceNode[] FindChildrenByTypeInGroup (string path, ResourceType type, byte group)
 
ResourceNode[] FindChildrenByName (string name)
 
unsafe string FindName (string name)
 
ResourceNode FindEmbeddedIndex (int index)
 
virtual unsafe byte[] MD5 ()
 Find the MD5 checksum of this node's data. If this node doesn't have any data (BRESGroupNode, for example), this method will return null. More...
 
string MD5Str ()
 Get the result of the MD5() function as a string of hexadecimal digits. If MD5() returns null, this method will return an empty string. More...
 
ResourceNode PrevSibling ()
 
ResourceNode NextSibling ()
 
override string ToString ()
 
virtual void SortChildren ()
 

Static Public Attributes

static List< string > SpecialName
 

Properties

override ResourceType ResourceFileType [get]
 
override Type[] AllowedChildTypes [get]
 
override int MaxNameLength [get]
 
bool IsPair [get, set]
 
bool IsSubspace [get]
 
bool IsStage [get]
 
bool IsFighter [get]
 
bool IsItemTable [get]
 
string SpecialARC [get]
 
int NumModels [get]
 
int NumFacepoints [get]
 
int NumVertices [get]
 
int NumTriangles [get]
 
int NumNodes [get]
 
- Properties inherited from BrawlLib.SSBB.ResourceNodes.ARCEntryNode
override ResourceType ResourceFileType [get]
 
override string Compression [get, set]
 
ARCFileType FileType [get, set]
 
short FileIndex [get, set]
 
byte GroupID [get, set]
 
int AbsoluteIndex [get]
 
short RedirectIndex [get, set]
 
string RedirectTargetName [get]
 
string RedirectTarget [get, set]
 
ResourceNode RedirectNode [get]
 
- Properties inherited from BrawlLib.SSBB.ResourceNodes.U8EntryNode
int ParentIndex [get]
 
int ChildEndIndex [get]
 
int Type [get]
 
int ID [get]
 
- Properties inherited from BrawlLib.SSBB.ResourceNodes.ResourceNode
string FilePath [get]
 
string FileName [get]
 
string DirectoryName [get]
 
ResourceNode RootNode [get]
 
DataSource OriginalSource [get]
 
DataSource UncompressedSource [get]
 
DataSource WorkingSource [get]
 
DataSource WorkingUncompressed [get]
 
virtual bool HasChildren [get]
 
virtual ResourceType ResourceFileType [get]
 
string NodeType [get]
 
virtual string TreePathAbsolute [get]
 
virtual string TreePath [get]
 
virtual int Level [get]
 
virtual int MaxNameLength [get]
 
virtual bool AllowDuplicateNames [get]
 
virtual bool AllowNullNames [get]
 
virtual string Name [get, set]
 
ResourceNode Parent [get, set]
 
List< ResourceNodeChildren [get]
 
int Index [get]
 
int HexIndex [get]
 
bool IsCompressed [get]
 
bool HasChanged [get, set]
 
bool IsBranch [get]
 
bool HasMerged [get]
 
virtual bool AllowSaving [get, set]
 
virtual bool IsDirty [get, set]
 
virtual uint UncompressedSize [get]
 
virtual Type[] AllowedChildTypes [get]
 
virtual string Compression [get, set]
 
virtual bool RetainChildrenOnReplace [get]
 
virtual bool supportsCompression [get]
 
static MD5CryptoServiceProvider MD5Provider [get]
 

Additional Inherited Members

- Static Public Member Functions inherited from BrawlLib.SSBB.ResourceNodes.ResourceNode
static ResourceNode[] FindAllSubNodes (ResourceNode root)
 
static ResourceNode FindNode (ResourceNode root, string path, bool searchChildren, StringComparison compare)
 
- Public Attributes inherited from BrawlLib.SSBB.ResourceNodes.ARCEntryNode
ResourceType _resourceType = ResourceType.ARCEntry
 
- Public Attributes inherited from BrawlLib.SSBB.ResourceNodes.U8EntryNode
int _u8Parent
 
int _u8FirstNotChild
 
int _u8Type
 
int _u8Index
 
- Public Attributes inherited from BrawlLib.SSBB.ResourceNodes.ResourceNode
Form _mainForm
 
string _name
 
string _origPath
 
ResourceNode _parent
 
List< ResourceNode_children = new List<ResourceNode>()
 
int _calcSize
 
EventHandler UpdateControl
 
MoveEventHandler MovedDown
 
ResourceEventHandler Renamed
 
ResourceEventHandler PropertyChanged
 
ResourceEventHandler Replaced
 
ResourceEventHandler Restored
 
ResourceChildEventHandler ChildRemoved
 
bool _isPopulating
 
bool _replaced
 
- Protected Member Functions inherited from BrawlLib.SSBB.ResourceNodes.ARCEntryNode
virtual string GetName ()
 
virtual string GetName (string fileType)
 
- Protected Member Functions inherited from BrawlLib.SSBB.ResourceNodes.ResourceNode
void ForceReplacedEvent ()
 
virtual void MergeInternal ()
 
- Protected Attributes inherited from BrawlLib.SSBB.ResourceNodes.ARCEntryNode
ResourceNode redirectTargetNode
 
- Events inherited from BrawlLib.SSBB.ResourceNodes.ResourceNode
SelectEventHandler SelectChild
 
EventHandler UpdateProps
 
MoveEventHandler MovedUp
 
ResourceEventHandler Disposing
 
ResourceChildEventHandler ChildAdded
 
ResourceChildInsertEventHandler ChildInserted
 

Member Function Documentation

◆ Export()

override void BrawlLib.SSBB.ResourceNodes.ARCNode.Export ( string  outPath)
inlinevirtual

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

599 {
600 if (outPath.EndsWith(".pair", StringComparison.OrdinalIgnoreCase))
601 {
602 ExportPair(outPath);
603 }
604 else if (outPath.EndsWith(".mrg", StringComparison.OrdinalIgnoreCase))
605 {
606 ExportAsMRG(outPath);
607 }
608 else if (outPath.EndsWith(".pcs", StringComparison.OrdinalIgnoreCase))
609 {
610 ExportPCS(outPath);
611 }
612 else if (outPath.EndsWith(".mariopast", StringComparison.OrdinalIgnoreCase))
613 {
614 ExportMarioPast(outPath);
615 }
616 else if (outPath.EndsWith(".metalgear", StringComparison.OrdinalIgnoreCase))
617 {
618 ExportMetalGear(outPath);
619 }
620 else if (outPath.EndsWith(".village", StringComparison.OrdinalIgnoreCase))
621 {
622 ExportVillage(outPath);
623 }
624 else if (outPath.EndsWith(".tengan", StringComparison.OrdinalIgnoreCase))
625 {
626 ExportTengan(outPath);
627 }
628 else if (outPath.EndsWith(".pac", StringComparison.OrdinalIgnoreCase) && IsFighter &&
629 Properties.Settings.Default.AutoDecompressFighterPAC)
630 {
631 ExportPAC(outPath);
632 }
633 else
634 {
635 base.Export(outPath);
636 }
637 }
void ExportPAC(string outPath)
Definition: ARCNode.cs:801
void ExportTengan(string path)
Definition: ARCNode.cs:756
void ExportPCS(string outPath)
Definition: ARCNode.cs:807
void ExportVillage(string path)
Definition: ARCNode.cs:721
void ExportAsMRG(string path)
Definition: ARCNode.cs:639
void ExportPair(string path)
Definition: ARCNode.cs:649
bool IsFighter
Definition: ARCNode.cs:106
void ExportMarioPast(string path)
Definition: ARCNode.cs:661
void ExportMetalGear(string path)
Definition: ARCNode.cs:690

◆ ExportAsMRG()

void BrawlLib.SSBB.ResourceNodes.ARCNode.ExportAsMRG ( string  path)
inline
640 {
641 MRGNode node = new MRGNode
642 {
644 _changed = true
645 };
646 node.Export(path);
647 }
List< ResourceNode > _children
Definition: ResourceNode.cs:143
List< ResourceNode > Children
Definition: ResourceNode.cs:262

◆ ExportMarioPast()

void BrawlLib.SSBB.ResourceNodes.ARCNode.ExportMarioPast ( string  path)
inline
662 {
663 if (Path.HasExtension(path))
664 {
665 path = path.Substring(0, path.LastIndexOf('.'));
666 }
667
668 char aslIndicator = '\0';
669 // Check if ASL is used
670 if (path.Contains("_") && path.Length >= 2 && path[path.Length - 2] == '_')
671 {
672 aslIndicator = path.ToCharArray()[path.Length - 1];
673 }
674
675 path = path.Substring(0, path.LastIndexOf('\\'));
676 // Export with or without ASL depending on if the file used ASL or not
677 if (aslIndicator != '\0')
678 {
679 ExportPAC(path + "\\STGMARIOPAST_00_" + aslIndicator + ".pac");
680 ExportPAC(path + "\\STGMARIOPAST_01_" + aslIndicator + ".pac");
681 }
682 else
683 {
684 ExportPAC(path + "\\STGMARIOPAST_00.pac");
685 ExportPAC(path + "\\STGMARIOPAST_01.pac");
686 }
687 }

◆ ExportMetalGear()

void BrawlLib.SSBB.ResourceNodes.ARCNode.ExportMetalGear ( string  path)
inline
691 {
692 if (Path.HasExtension(path))
693 {
694 path = path.Substring(0, path.LastIndexOf('.'));
695 }
696
697 char aslIndicator = '\0';
698 // Check if ASL is used
699 if (path.Contains("_") && path.Length > 1 && path[path.Length - 2] == '_')
700 {
701 aslIndicator = path.ToCharArray()[path.Length - 1];
702 }
703
704 path = path.Substring(0, path.LastIndexOf('\\'));
705 // Export with or without ASL depending on if the file used ASL or not
706 if (aslIndicator != '\0')
707 {
708 ExportPAC(path + "\\STGMETALGEAR_00_" + aslIndicator + ".pac");
709 ExportPAC(path + "\\STGMETALGEAR_01_" + aslIndicator + ".pac");
710 ExportPAC(path + "\\STGMETALGEAR_02_" + aslIndicator + ".pac");
711 }
712 else
713 {
714 ExportPAC(path + "\\STGMETALGEAR_00.pac");
715 ExportPAC(path + "\\STGMETALGEAR_01.pac");
716 ExportPAC(path + "\\STGMETALGEAR_02.pac");
717 }
718 }

◆ ExportPAC()

void BrawlLib.SSBB.ResourceNodes.ARCNode.ExportPAC ( string  outPath)
inline
802 {
803 Rebuild();
804 ExportUncompressed(outPath);
805 }
virtual void Rebuild()
Definition: ResourceNode.cs:987
virtual void ExportUncompressed(string outPath)
Definition: ResourceNode.cs:947

◆ ExportPair()

void BrawlLib.SSBB.ResourceNodes.ARCNode.ExportPair ( string  path)
inline
650 {
651 if (Path.HasExtension(path))
652 {
653 path = path.Substring(0, path.LastIndexOf('.'));
654 }
655
656 ExportPAC(path + ".pac");
657 ExportPCS(path + ".pcs");
658 }

◆ ExportPCS()

void BrawlLib.SSBB.ResourceNodes.ARCNode.ExportPCS ( string  outPath)
inline
808 {
809 Rebuild();
810 if (_compression != CompressionType.None || !Properties.Settings.Default.AutoCompressFighterPCS)
811 {
812 base.Export(outPath);
813 }
814 else
815 {
816 using (FileStream inStream = new FileStream(Path.GetTempFileName(), FileMode.OpenOrCreate,
817 FileAccess.ReadWrite, FileShare.None, 0x8, FileOptions.SequentialScan | FileOptions.DeleteOnClose))
818 {
819 using (FileStream outStream = new FileStream(outPath, FileMode.OpenOrCreate, FileAccess.ReadWrite,
820 FileShare.None, 8, FileOptions.SequentialScan))
821 {
823 WorkingUncompressed.Length, inStream, this);
824 outStream.SetLength(inStream.Length);
825 using (FileMap map = FileMap.FromStream(inStream))
826 {
827 using (FileMap outMap = FileMap.FromStream(outStream))
828 {
829 Memory.Move(outMap.Address, map.Address, (uint) map.Length);
830 }
831 }
832 }
833 }
834 }
835 }
Definition: FileMap.cs:10
int Length
Definition: FileMap.cs:19
static FileMap FromStream(FileStream stream)
Definition: FileMap.cs:117
VoidPtr Address
Definition: FileMap.cs:16
Definition: Memory.cs:8
static void Move(VoidPtr dst, VoidPtr src, uint size)
Definition: Memory.cs:9
DataSource WorkingUncompressed
Definition: ResourceNode.cs:183
Definition: Compressor.cs:37
static void Compact(CompressionType type, VoidPtr srcAddr, int srcLen, Stream outStream, ResourceNode r)
Definition: Compressor.cs:233
CompressionType
Definition: CompressionHeader.cs:9
int Length
Definition: ResourceNode.cs:32
VoidPtr Address
Definition: ResourceNode.cs:31

◆ ExportTengan()

void BrawlLib.SSBB.ResourceNodes.ARCNode.ExportTengan ( string  path)
inline
757 {
758 if (Path.HasExtension(path))
759 {
760 path = path.Substring(0, path.LastIndexOf('.'));
761 }
762
763 char aslIndicator = '\0';
764 // Check if ASL is used
765 if (path.Contains("_") && path.Length >= 2 && path[path.Length - 2] == '_')
766 {
767 aslIndicator = path.ToCharArray()[path.Length - 1];
768 }
769
770 // Check to make sure they meant this as ASL and not as a type indicator
771 if (path.LastIndexOf('\\') < path.Length - 1 &&
772 path.Substring(path.LastIndexOf('\\') + 1)
773 .StartsWith("STGTENGAN_", StringComparison.OrdinalIgnoreCase) &&
774 (aslIndicator == '1' || aslIndicator == '2' || aslIndicator == '3') &&
775 path.LastIndexOf('_') == path.IndexOf('_'))
776 {
777 if (MessageBox.Show(
778 "Would you like to use the detected '" + aslIndicator +
779 "' as the ASL indicator for the three files?", "", MessageBoxButtons.YesNo) != DialogResult.Yes)
780 {
781 aslIndicator = '\0';
782 }
783 }
784
785 path = path.Substring(0, path.LastIndexOf('\\'));
786 // Export with or without ASL depending on if the file used ASL or not
787 if (aslIndicator != '\0')
788 {
789 ExportPAC(path + "\\STGTENGAN_1_" + aslIndicator + ".pac");
790 ExportPAC(path + "\\STGTENGAN_2_" + aslIndicator + ".pac");
791 ExportPAC(path + "\\STGTENGAN_3_" + aslIndicator + ".pac");
792 }
793 else
794 {
795 ExportPAC(path + "\\STGTENGAN_1.pac");
796 ExportPAC(path + "\\STGTENGAN_2.pac");
797 ExportPAC(path + "\\STGTENGAN_3.pac");
798 }
799 }

◆ ExportVillage()

void BrawlLib.SSBB.ResourceNodes.ARCNode.ExportVillage ( string  path)
inline
722 {
723 if (Path.HasExtension(path))
724 {
725 path = path.Substring(0, path.LastIndexOf('.'));
726 }
727
728 char aslIndicator = '\0';
729 // Check if ASL is used
730 if (path.Contains("_") && path.Length >= 2 && path[path.Length - 2] == '_')
731 {
732 aslIndicator = path.ToCharArray()[path.Length - 1];
733 }
734
735 path = path.Substring(0, path.LastIndexOf('\\'));
736 // Export with or without ASL depending on if the file used ASL or not
737 if (aslIndicator != '\0')
738 {
739 ExportPAC(path + "\\STGVILLAGE_00_" + aslIndicator + ".pac");
740 ExportPAC(path + "\\STGVILLAGE_01_" + aslIndicator + ".pac");
741 ExportPAC(path + "\\STGVILLAGE_02_" + aslIndicator + ".pac");
742 ExportPAC(path + "\\STGVILLAGE_03_" + aslIndicator + ".pac");
743 ExportPAC(path + "\\STGVILLAGE_04_" + aslIndicator + ".pac");
744 }
745 else
746 {
747 ExportPAC(path + "\\STGVILLAGE_00.pac");
748 ExportPAC(path + "\\STGVILLAGE_01.pac");
749 ExportPAC(path + "\\STGVILLAGE_02.pac");
750 ExportPAC(path + "\\STGVILLAGE_03.pac");
751 ExportPAC(path + "\\STGVILLAGE_04.pac");
752 }
753 }

◆ ExtractToFolder() [1/3]

void BrawlLib.SSBB.ResourceNodes.ARCNode.ExtractToFolder ( string  outFolder)
inline
457 {
458 ExtractToFolder(outFolder, ".tex0", ".mdl0");
459 }
void ExtractToFolder(string outFolder)
Definition: ARCNode.cs:456

◆ ExtractToFolder() [2/3]

void BrawlLib.SSBB.ResourceNodes.ARCNode.ExtractToFolder ( string  outFolder,
string  imageExtension 
)
inline
462 {
463 ExtractToFolder(outFolder, imageExtension, ".mdl0");
464 }

◆ ExtractToFolder() [3/3]

void BrawlLib.SSBB.ResourceNodes.ARCNode.ExtractToFolder ( string  outFolder,
string  imageExtension,
string  modelExtension 
)
inline
467 {
468 if (!Directory.Exists(outFolder))
469 {
470 Directory.CreateDirectory(outFolder);
471 }
472
473 List<string> directChildrenExportedPaths = new List<string>();
474 foreach (ResourceNode entry in Children)
475 {
476 if (entry is ARCNode)
477 {
478 ((ARCNode) entry).ExtractToFolder(
479 Path.Combine(outFolder,
480 entry.Name == null ||
481 entry.Name.Contains("<Null>", StringComparison.InvariantCultureIgnoreCase)
482 ? "Null"
483 : entry.Name), imageExtension, modelExtension);
484 }
485 else if (entry is BRRESNode)
486 {
487 ((BRRESNode) entry).ExportToFolder(
488 Path.Combine(outFolder,
489 entry.Name == null ||
490 entry.Name.Contains("<Null>", StringComparison.InvariantCultureIgnoreCase)
491 ? "Null"
492 : entry.Name), imageExtension, modelExtension);
493 }
494 else
495 {
496 if (entry.WorkingSource.Length == 0)
497 {
498 continue;
499 }
500
501 string ext = FileFilters.GetDefaultExportAllExtension(entry.GetType());
502 string path = Path.Combine(outFolder, entry.Name + ext);
503
504 if (directChildrenExportedPaths.Contains(path))
505 {
506 throw new Exception(
507 $"There is more than one node underneath {Name} with the name {entry.Name}.");
508 }
509
510 directChildrenExportedPaths.Add(path);
511 entry.Export(path);
512 }
513 }
514 }

◆ Initialize()

override void BrawlLib.SSBB.ResourceNodes.ARCNode.Initialize ( ResourceNode  parent,
DataSource  origSource,
DataSource  uncompSource 
)
inlinevirtual

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

395 {
396 base.Initialize(parent, origSource, uncompSource);
397 if (_origPath != null)
398 {
399 string path = Path.Combine(Path.GetDirectoryName(_origPath),
400 Path.GetFileNameWithoutExtension(_origPath));
401 _isPair = File.Exists(path + ".pac") && File.Exists(path + ".pcs");
402 }
403 }
string _origPath
Definition: ResourceNode.cs:139

◆ OnCalculateSize() [1/2]

override int BrawlLib.SSBB.ResourceNodes.ARCNode.OnCalculateSize ( bool  force)
inlinevirtual

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

543 {
544 return OnCalculateSize(force, true);
545 }
override int OnCalculateSize(bool force)
Definition: ARCNode.cs:542

◆ OnCalculateSize() [2/2]

int BrawlLib.SSBB.ResourceNodes.ARCNode.OnCalculateSize ( bool  force,
bool  rebuilding 
)
inline
548 {
549 int size = ARCHeader.Size + Children.Count * 0x20;
550 foreach (ResourceNode node in Children)
551 {
552 if (rebuilding)
553 {
554 size += node.CalculateSize(force).Align(0x20);
555 }
556 else if (!(node is RELNode))
557 {
558 size += node.OnCalculateSize(force).Align(0x20);
559 }
560 }
561
562 return size;
563 }

◆ OnInitialize()

override bool BrawlLib.SSBB.ResourceNodes.ARCNode.OnInitialize ( )
inlinevirtual

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

406 {
407 base.OnInitialize();
408 _name = Header->Name;
409 _isStage = false;
410 _isFighter = false;
411 _isItemTable = false;
412
413 if (RootNode == this)
414 {
415 if (_name.StartsWith("STG", StringComparison.OrdinalIgnoreCase))
416 {
417 _isStage = true;
418 Console.WriteLine(_name + " Generating MetaData");
419 }
420 else if (_name.StartsWith("FIT", StringComparison.OrdinalIgnoreCase))
421 {
422 _isFighter = true;
423 }
424 else if ((_name.Length == 6 || _name.Length == 7) && int.TryParse(_name.Substring(0, 6), out _))
425 {
426 _isStage = true;
427 _isSubspace = true;
428 }
429 }
430
431 if (_name.StartsWith("Itm", StringComparison.OrdinalIgnoreCase) &&
432 _name.EndsWith("Gen", StringComparison.OrdinalIgnoreCase))
433 {
434 _isItemTable = true;
435 }
436
437 if (Compression == "LZ77" && Header->_numFiles > 0)
438 {
439 if (_parent is ARCNode)
440 {
441 if (((ARCNode) _parent).IsStage && Properties.Settings.Default.AutoCompressStages)
442 {
443 // Console.WriteLine(_parent._name);
444 if (Enum.TryParse("ExtendedLZ77", out CompressionType type))
445 {
446 _compression = type;
448 }
449 }
450 }
451 }
452
453 return Header->_numFiles > 0;
454 }
override string Compression
Definition: ARCNode.cs:879
bool IsStage
Definition: ARCNode.cs:99
ResourceNode _parent
Definition: ResourceNode.cs:142
virtual void SignalPropertyChange()
Definition: ResourceNode.cs:313
string _name
Definition: ResourceNode.cs:139
ResourceNode RootNode
Definition: ResourceNode.cs:175
bushort _numFiles
Definition: ARC.cs:14
string Name
Definition: ARC.cs:31

◆ OnPopulate()

override void BrawlLib.SSBB.ResourceNodes.ARCNode.OnPopulate ( )
inlinevirtual

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

375 {
376 _originalHeaders.Clear();
377 ARCFileHeader* entry = Header->First;
378 for (int i = 0; i < Header->_numFiles; i++, entry = entry->Next)
379 {
380 DataSource source = new DataSource(entry->Data, entry->Length);
381 ResourceNode createdNode = entry->Length == 0
382 ? null
383 : NodeFactory.FromSource(this, source);
384 if (createdNode == null)
385 {
386 createdNode = new ARCEntryNode();
387 createdNode.Initialize(this, source);
388 }
389
390 _originalHeaders.Add(createdNode, *entry);
391 }
392 }
ARCFileHeader * Next
Definition: ARC.cs:109
ARCFileHeader * First
Definition: ARC.cs:56

◆ OnRebuild()

override void BrawlLib.SSBB.ResourceNodes.ARCNode.OnRebuild ( VoidPtr  address,
int  size,
bool  force 
)
inlinevirtual

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

566 {
567 if (RedirectNode != null)
568 {
569 _redirectIndex = (short?) (RedirectNode as ARCEntryNode)?.AbsoluteIndex ?? -1;
570 }
571
572 ARCHeader* header = (ARCHeader*) address;
573 *header = new ARCHeader((ushort) Children.Count, Name);
574
575 ARCFileHeader* entry = header->First;
576 foreach (ResourceNode child in Children)
577 {
578 if (child is ARCEntryNode node)
579 {
580 *entry = new ARCFileHeader(node.FileType, node.FileIndex, node._calcSize, node.GroupID,
581 node._redirectIndex);
582 }
583 else if (_originalHeaders.TryGetValue(child, out ARCFileHeader origHeader))
584 {
585 *entry = new ARCFileHeader(origHeader.FileType, origHeader.Index, child._calcSize,
586 origHeader.GroupIndex, origHeader.ID);
587 }
588 else
589 {
590 throw new NotSupportedException("Cannot build a new ARCFileHeader for this node (not supported)");
591 }
592
593 child.Rebuild(entry->Data, entry->Length, force);
594 entry = entry->Next;
595 }
596 }
ResourceNode RedirectNode
Definition: ARCNode.cs:1026
virtual string Name
Definition: ResourceNode.cs:223
int Length
Definition: ARC.cs:124
VoidPtr Data
Definition: ARC.cs:108
Definition: ARC.cs:8

◆ ReplaceFromFolder() [1/2]

void BrawlLib.SSBB.ResourceNodes.ARCNode.ReplaceFromFolder ( string  inFolder)
inline
517 {
518 ReplaceFromFolder(inFolder, ".tex0");
519 }
void ReplaceFromFolder(string inFolder)
Definition: ARCNode.cs:516

◆ ReplaceFromFolder() [2/2]

void BrawlLib.SSBB.ResourceNodes.ARCNode.ReplaceFromFolder ( string  inFolder,
string  imageExtension 
)
inline
522 {
523 DirectoryInfo dir = new DirectoryInfo(inFolder);
524 DirectoryInfo[] dirs;
525 foreach (ResourceNode entry in Children)
526 {
527 if (entry is ARCNode)
528 {
529 dirs = dir.GetDirectories(entry.Name);
530 if (dirs.Length > 0)
531 {
532 ((ARCNode) entry).ReplaceFromFolder(dirs[0].FullName, imageExtension);
533 }
534 }
535 else
536 {
537 (entry as BRRESNode)?.ReplaceFromFolder(inFolder, imageExtension);
538 }
539 }
540 }

◆ SortChildrenByFileIndex()

void BrawlLib.SSBB.ResourceNodes.ARCNode.SortChildrenByFileIndex ( )
inline
364 {
365 if (Children == null || Children.Count <= 0)
366 {
367 return;
368 }
369
370 _children = _children.OrderBy(o => (o as ARCEntryNode)?.FileIndex ?? -1).ToList();
372 }
short FileIndex
Definition: ARCNode.cs:902

Member Data Documentation

◆ SpecialName

List<string> BrawlLib.SSBB.ResourceNodes.ARCNode.SpecialName
static

Property Documentation

◆ AllowedChildTypes

override Type [] BrawlLib.SSBB.ResourceNodes.ARCNode.AllowedChildTypes
get

◆ IsFighter

bool BrawlLib.SSBB.ResourceNodes.ARCNode.IsFighter
get

◆ IsItemTable

bool BrawlLib.SSBB.ResourceNodes.ARCNode.IsItemTable
get

◆ IsPair

bool BrawlLib.SSBB.ResourceNodes.ARCNode.IsPair
getset
82 {
83 get => _isPair;
84 set => _isPair = value;
85 }

◆ IsStage

bool BrawlLib.SSBB.ResourceNodes.ARCNode.IsStage
get

◆ IsSubspace

bool BrawlLib.SSBB.ResourceNodes.ARCNode.IsSubspace
get

◆ MaxNameLength

override int BrawlLib.SSBB.ResourceNodes.ARCNode.MaxNameLength
get

◆ NumFacepoints

int BrawlLib.SSBB.ResourceNodes.ARCNode.NumFacepoints
get
200 {
201 get
202 {
203 if (Properties.Settings.Default.CompatibilityMode)
204 {
205 return -1;
206 }
207
208 if (_children == null)
209 {
210 Populate();
211 if (_children == null)
212 {
213 return 0;
214 }
215 }
216
217 int count = 0;
218 foreach (ResourceNode c in Children)
219 {
220 if (c is ARCEntryNode b)
221 {
222 if (b is BRRESNode node)
223 {
224 count += node.NumFacepoints;
225 }
226 else if (b is ARCNode arcNode && arcNode.NumModels > -1)
227 {
228 count += arcNode.NumFacepoints;
229 }
230 }
231 }
232
233 return count;
234 }
235 }
void Populate(int levels=-1)
Definition: ResourceNode.cs:613

◆ NumModels

int BrawlLib.SSBB.ResourceNodes.ARCNode.NumModels
get
159 {
160 get
161 {
162 if (Properties.Settings.Default.CompatibilityMode)
163 {
164 return -1;
165 }
166
167 if (_children == null)
168 {
169 Populate();
170 if (_children == null)
171 {
172 return 0;
173 }
174 }
175
176 int count = 0;
177 foreach (ResourceNode c in Children)
178 {
179 if (c is ARCEntryNode b)
180 {
181 if (b is BRRESNode brresNode)
182 {
183 count += brresNode.NumModels;
184 }
185 else if (b is ARCNode node && node.NumModels > -1)
186 {
187 count += node.NumModels;
188 }
189 }
190 }
191
192 return count;
193 }
194 }

◆ NumNodes

int BrawlLib.SSBB.ResourceNodes.ARCNode.NumNodes
get
322 {
323 get
324 {
325 if (Properties.Settings.Default.CompatibilityMode)
326 {
327 return -1;
328 }
329
330 if (_children == null)
331 {
332 Populate();
333 if (_children == null)
334 {
335 return 0;
336 }
337 }
338
339 int count = 0;
340 foreach (ResourceNode c in Children)
341 {
342 if (c is ARCEntryNode b)
343 {
344 if (b is BRRESNode node)
345 {
346 count += node.NumNodes;
347 }
348 else if (b is ARCNode arcNode && arcNode.NumModels > -1)
349 {
350 count += arcNode.NumNodes;
351 }
352 }
353 }
354
355 return count;
356 }
357 }

◆ NumTriangles

int BrawlLib.SSBB.ResourceNodes.ARCNode.NumTriangles
get
282 {
283 get
284 {
285 if (Properties.Settings.Default.CompatibilityMode)
286 {
287 return -1;
288 }
289
290 if (_children == null)
291 {
292 Populate();
293 if (_children == null)
294 {
295 return 0;
296 }
297 }
298
299 int count = 0;
300 foreach (ResourceNode c in Children)
301 {
302 if (c is ARCEntryNode b)
303 {
304 if (b is BRRESNode node)
305 {
306 count += node.NumTriangles;
307 }
308 else if (b is ARCNode arcNode && arcNode.NumModels > -1)
309 {
310 count += arcNode.NumTriangles;
311 }
312 }
313 }
314
315 return count;
316 }
317 }

◆ NumVertices

int BrawlLib.SSBB.ResourceNodes.ARCNode.NumVertices
get
242 {
243 get
244 {
245 if (Properties.Settings.Default.CompatibilityMode)
246 {
247 return -1;
248 }
249
250 if (_children == null)
251 {
252 Populate();
253 if (_children == null)
254 {
255 return 0;
256 }
257 }
258
259 int count = 0;
260 foreach (ResourceNode c in Children)
261 {
262 if (c is ARCEntryNode b)
263 {
264 if (b is BRRESNode node)
265 {
266 count += node.NumVertices;
267 }
268 else if (b is ARCNode arcNode && arcNode.NumModels > -1)
269 {
270 count += arcNode.NumVertices;
271 }
272 }
273 }
274
275 return count;
276 }
277 }

◆ ResourceFileType

override ResourceType BrawlLib.SSBB.ResourceNodes.ARCNode.ResourceFileType
get

◆ SpecialARC

string BrawlLib.SSBB.ResourceNodes.ARCNode.SpecialARC
get
119 {
120 get
121 {
122 if (IsFighter)
123 {
124 return "Fighter";
125 }
126
127 if (IsStage)
128 {
129 if (IsSubspace)
130 {
131 return "Subspace Stage";
132 }
133
134 return "Stage";
135 }
136
137 if (IsItemTable)
138 {
139 return "Item Table";
140 }
141
142 if (Parent is ARCNode)
143 {
144 if (((ARCNode) Parent).SpecialARC.EndsWith("SubNode") ||
145 ((ARCNode) Parent).SpecialARC.Equals("<None>"))
146 {
147 return ((ARCNode) Parent).SpecialARC;
148 }
149
150 return ((ARCNode) Parent).SpecialARC + " SubNode";
151 }
152
153 return "<None>";
154 }
155 }
bool IsSubspace
Definition: ARCNode.cs:92
string SpecialARC
Definition: ARCNode.cs:119
bool IsItemTable
Definition: ARCNode.cs:113
ResourceNode Parent
Definition: ResourceNode.cs:245

The documentation for this class was generated from the following file: