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

Public Member Functions

override bool OnInitialize ()
 
override void OnPopulate ()
 
override int OnCalculateSize (bool force)
 
override void OnRebuild (VoidPtr address, int length, bool force)
 
SHP0VertexSetNode FindOrCreateEntry (string name)
 
void CreateEntry ()
 
- 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 ()
 

Public Attributes

Bin32 _flags = 3
 
int _indexCount
 
int _fixedFlags
 
VoidPtr _dataAddr
 
int _dataLen
 
int _entryLen
 
- 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
 

Properties

override ResourceType ResourceFileType [get]
 
override Type[] AllowedChildTypes [get]
 
bool Enabled [get, set]
 
bool UpdateVertices [get, set]
 
bool UpdateNormals [get, set]
 
bool UpdateColors [get, set]
 
- 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)
 
- Protected Member Functions inherited from BrawlLib.SSBB.ResourceNodes.ResourceNode
void ForceReplacedEvent ()
 
virtual void MergeInternal ()
 
- Events inherited from BrawlLib.SSBB.ResourceNodes.ResourceNode
SelectEventHandler SelectChild
 
EventHandler UpdateProps
 
MoveEventHandler MovedUp
 
ResourceEventHandler Disposing
 
ResourceChildEventHandler ChildAdded
 
ResourceChildInsertEventHandler ChildInserted
 

Member Function Documentation

◆ CreateEntry()

void BrawlLib.SSBB.ResourceNodes.SHP0EntryNode.CreateEntry ( )
inline
688 {
689 SHP0VertexSetNode morph = new SHP0VertexSetNode(FindName("NewMorphTarget"));
690 AddChild(morph);
691 }
unsafe string FindName(string name)
Definition: ResourceNode.cs:1578
virtual void AddChild(ResourceNode child)
Definition: ResourceNode.cs:757

◆ FindOrCreateEntry()

SHP0VertexSetNode BrawlLib.SSBB.ResourceNodes.SHP0EntryNode.FindOrCreateEntry ( string  name)
inline
673 {
674 foreach (SHP0VertexSetNode t in Children)
675 {
676 if (t.Name == name)
677 {
678 return t;
679 }
680 }
681
682 SHP0VertexSetNode entry = new SHP0VertexSetNode(name);
683 AddChild(entry);
684 return entry;
685 }
List< ResourceNode > Children
Definition: ResourceNode.cs:262

◆ OnCalculateSize()

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

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

623 {
624 _entryLen = (0x14 + Children.Count * 6).Align(4);
625 _dataLen = 0;
626
627 foreach (SHP0VertexSetNode p in Children)
628 {
629 _dataLen += p.CalculateSize(true);
630 }
631
632 return _entryLen + _dataLen;
633 }
int _dataLen
Definition: SHP0Node.cs:614
int _entryLen
Definition: SHP0Node.cs:614

◆ OnInitialize()

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

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

563 {
564 if (_name == null && Header->_stringOffset != 0)
565 {
566 _name = Header->ResourceString;
567 }
568
569 _indices = new List<short>();
570 for (int i = 0; i < Header->_numIndices; i++)
571 {
572 _indices.Add(Header->Indicies[i]);
573 }
574
575 _flags = (uint) (int) Header->_flags;
576 _indexCount = Header->_numIndices;
577 _fixedFlags = Header->_fixedFlags;
578
579 return Header->_flags > 0;
580 }
string _name
Definition: ResourceNode.cs:139
int _indexCount
Definition: SHP0Node.cs:516
int _fixedFlags
Definition: SHP0Node.cs:516
Bin32 _flags
Definition: SHP0Node.cs:515

◆ OnPopulate()

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

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

583 {
584 for (int i = 0; i < _indexCount; i++)
585 {
586 string name;
587 if (_indices[i] < ((SHP0Node) Parent)._strings.Count && _indices[i] >= 0)
588 {
589 name = ((SHP0Node) Parent)._strings[_indices[i]];
590 }
591 else
592 {
593 name = "Unknown";
594 }
595
596 SHP0VertexSetNode n = new SHP0VertexSetNode(name);
597
598 if (((_fixedFlags >> i) & 1) == 0)
599 {
600 n.Initialize(this, new DataSource(Header->GetEntry(i), 0x14 + Header->_numIndices * 6));
601 }
602 else
603 {
604 n._isFixed = true;
605 _children.Add(n);
606 n._parent = this;
607
608 n.Keyframes[0] = ((bfloat*) Header->EntryOffset)[i];
609 }
610 }
611 }
List< ResourceNode > _children
Definition: ResourceNode.cs:143
ResourceNode Parent
Definition: ResourceNode.cs:245
Definition: BigEndianTypes.cs:109

◆ OnRebuild()

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

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

636 {
637 SHP0Entry* header = (SHP0Entry*) address;
638 VoidPtr addr = _dataAddr;
639 header->_numIndices = (short) Children.Count;
640 header->_nameIndex = (short) ((SHP0Node) Parent)._strings.IndexOf(Name);
641 header->_flags = (int) (uint) _flags;
642 header->_indiciesOffset = 0x14 + Children.Count * 4;
643 uint fixedflags = 0;
644 foreach (SHP0VertexSetNode p in Children)
645 {
646 p._dataAddr = addr;
647 header->Indicies[p.Index] = (short) ((SHP0Node) Parent)._strings.IndexOf(p.Name);
648 if (p._isFixed)
649 {
650 float value = 0;
651 KeyframeEntry kf;
652 if ((kf = p.Keyframes.GetKeyframe(0)) != null)
653 {
654 value = kf._value;
655 }
656
657 ((bfloat*) header->EntryOffset)[p.Index] = value;
658 fixedflags |= 1u << p.Index;
659 }
660 else
661 {
662 header->EntryOffset[p.Index] = (int) p._dataAddr - (int) &header->EntryOffset[p.Index];
663 p.Rebuild(p._dataAddr, p._calcSize, true);
664 }
665
666 addr += p._dataLen;
667 }
668
669 header->_fixedFlags = (int) fixedflags;
670 }
virtual string Name
Definition: ResourceNode.cs:223
VoidPtr _dataAddr
Definition: SHP0Node.cs:613
Definition: KeyframeCollection.cs:193
float _value
Definition: KeyframeCollection.cs:197
Definition: VoidPtr.cs:9

Member Data Documentation

◆ _dataAddr

VoidPtr BrawlLib.SSBB.ResourceNodes.SHP0EntryNode._dataAddr

◆ _dataLen

int BrawlLib.SSBB.ResourceNodes.SHP0EntryNode._dataLen

◆ _entryLen

int BrawlLib.SSBB.ResourceNodes.SHP0EntryNode._entryLen

◆ _fixedFlags

int BrawlLib.SSBB.ResourceNodes.SHP0EntryNode._fixedFlags

◆ _flags

Bin32 BrawlLib.SSBB.ResourceNodes.SHP0EntryNode._flags = 3

◆ _indexCount

int BrawlLib.SSBB.ResourceNodes.SHP0EntryNode._indexCount

Property Documentation

◆ AllowedChildTypes

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

◆ Enabled

bool BrawlLib.SSBB.ResourceNodes.SHP0EntryNode.Enabled
getset
520 {
521 get => _flags[0];
522 set
523 {
524 _flags[0] = value;
526 }
527 }
virtual void SignalPropertyChange()
Definition: ResourceNode.cs:313

◆ ResourceFileType

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

◆ UpdateColors

bool BrawlLib.SSBB.ResourceNodes.SHP0EntryNode.UpdateColors
getset
553 {
554 get => _flags[3];
555 set
556 {
557 _flags[3] = value;
559 }
560 }

◆ UpdateNormals

bool BrawlLib.SSBB.ResourceNodes.SHP0EntryNode.UpdateNormals
getset
542 {
543 get => _flags[2];
544 set
545 {
546 _flags[2] = value;
548 }
549 }

◆ UpdateVertices

bool BrawlLib.SSBB.ResourceNodes.SHP0EntryNode.UpdateVertices
getset
531 {
532 get => _flags[1];
533 set
534 {
535 _flags[1] = value;
537 }
538 }

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