BrawlCrate v0.41
Wii File Editor
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Properties | List of all members
BrawlLib.SSBB.ResourceNodes.PAT0EntryNode Class Reference
Inheritance diagram for BrawlLib.SSBB.ResourceNodes.PAT0EntryNode:
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)
 
PAT0TextureNode 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

VoidPtr[] _dataAddrs
 
int _entryLen
 
int[] _dataLens
 
- 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]
 
- 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()

PAT0TextureNode BrawlLib.SSBB.ResourceNodes.PAT0EntryNode.CreateEntry ( )
inline
784 {
785 int value = 0;
786 foreach (PAT0TextureNode t in Children)
787 {
788 if (t._textureIndex == value)
789 {
790 value++;
791 }
792 }
793
794 if (value == 8)
795 {
796 return null;
797 }
798
799 PAT0TextureNode node = new PAT0TextureNode((PAT0Flags) 7, value);
800 AddChild(node);
801 node.CreateEntry();
802 return node;
803 }
virtual void AddChild(ResourceNode child)
Definition: ResourceNode.cs:757
List< ResourceNode > Children
Definition: ResourceNode.cs:262
PAT0Flags
Definition: PAT0.cs:9

◆ OnCalculateSize()

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

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

628 {
629 _dataLens = new int[Children.Count];
630 _dataAddrs = new VoidPtr[Children.Count];
631
632 _entryLen = PAT0Pattern.Size + Children.Count * 4;
633
634 foreach (PAT0TextureNode table in Children)
635 {
636 _dataLens[table.Index] = table.CalculateSize(true);
637 }
638
639 //Check to see if any children can be remapped.
640 foreach (PAT0TextureNode table in Children)
641 {
642 table.CompareToAll();
643 }
644
645 int size = 0;
646 foreach (int i in _dataLens)
647 {
648 if (i != -1)
649 {
650 size += i;
651 }
652 }
653
654 return size + _entryLen;
655 }
int _entryLen
Definition: PAT0Node.cs:658
int[] _dataLens
Definition: PAT0Node.cs:659
VoidPtr[] _dataAddrs
Definition: PAT0Node.cs:657
Definition: VoidPtr.cs:9

◆ OnInitialize()

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

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

577 {
578 if (_name == null && Header->_stringOffset != 0)
579 {
580 _name = Header->ResourceString;
581 }
582
583 uint flags = Header->_flags;
584 for (int i = 0; i < 8; i++)
585 {
586 texFlags[i] = (PAT0Flags) ((flags >> (i * 4)) & 0xF);
587 }
588
589 return true;
590 }
string _name
Definition: ResourceNode.cs:139

◆ OnPopulate()

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

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

593 {
594 int count = 0, index = 0;
595 foreach (PAT0Flags p in texFlags)
596 {
597 if (p.HasFlag(PAT0Flags.Enabled))
598 {
599 if (!p.HasFlag(PAT0Flags.FixedTexture))
600 {
601 new PAT0TextureNode(p, index).Initialize(this,
602 new DataSource(Header->GetTexTable(count), PAT0Texture.Size));
603 }
604 else
605 {
606 PAT0TextureNode t = new PAT0TextureNode(p, index) {textureCount = 1};
607 t._parent = this;
608 _children.Add(t);
609 PAT0TextureEntryNode entry = new PAT0TextureEntryNode
610 {
611 _frame = 0,
612 _texFileIndex = Header->GetIndex(count, false),
613 _pltFileIndex = Header->GetIndex(count, true),
614 _parent = t
615 };
616 t._children.Add(entry);
617 entry.GetStrings();
618 }
619
620 count++;
621 }
622
623 index++;
624 }
625 }
ResourceNode _parent
Definition: ResourceNode.cs:142
List< ResourceNode > _children
Definition: ResourceNode.cs:143
const int Size
Definition: PAT0.cs:246

◆ OnRebuild()

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

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

662 {
663 PAT0Pattern* header = (PAT0Pattern*) address;
664
665 int x = 0;
666 foreach (int i in _dataLens)
667 {
668 if (i == -1)
669 {
670 _dataAddrs[x] =
671 ((PAT0EntryNode) Parent.Children[((PAT0TextureNode) Children[x])._matIndex])._dataAddrs[
672 ((PAT0TextureNode) Children[x])._texIndex];
673 }
674
675 x++;
676 }
677
678 uint flags = 0;
679 foreach (PAT0TextureNode table in Children)
680 {
681 table._texFlags |= PAT0Flags.Enabled;
682 if (table.Children.Count > 1)
683 {
684 table._texFlags &= ~PAT0Flags.FixedTexture;
685 }
686 else
687 {
688 table._texFlags |= PAT0Flags.FixedTexture;
689 }
690
691 bool hasTex = false, hasPlt = false;
692
693 //foreach (PAT0TextureEntryNode e in table.Children)
694 //{
695 // if (e.Texture != null)
696 // hasTex = true;
697 // if (e.Palette != null)
698 // hasPlt = true;
699 //}
700
701 hasTex = table._hasTex;
702 hasPlt = table._hasPlt;
703
704 if (!hasTex)
705 {
706 table._texFlags &= ~PAT0Flags.HasTexture;
707 }
708 else
709 {
710 table._texFlags |= PAT0Flags.HasTexture;
711 }
712
713 if (!hasPlt)
714 {
715 table._texFlags &= ~PAT0Flags.HasPalette;
716 }
717 else
718 {
719 table._texFlags |= PAT0Flags.HasPalette;
720 }
721
722 if (table.Children.Count > 1)
723 {
724 header->SetTexTableOffset(table.Index, _dataAddrs[table.Index]);
725 if (table._rebuild)
726 {
727 table.Rebuild(_dataAddrs[table.Index],
728 PAT0TextureTable.Size + PAT0Texture.Size * table.Children.Count, true);
729 }
730 }
731 else
732 {
733 PAT0TextureEntryNode entry = (PAT0TextureEntryNode) table.Children[0];
734 PAT0Node node = (PAT0Node) Parent;
735
736 short i = 0;
737 if (table._hasTex && !string.IsNullOrEmpty(entry.Texture))
738 {
739 i = (short) node._textureFiles.IndexOf(entry.Texture);
740 }
741
742 if (i < 0)
743 {
744 entry._texFileIndex = 0;
745 }
746 else
747 {
748 entry._texFileIndex = (ushort) i;
749 }
750
751 i = 0;
752 if (table._hasPlt && !string.IsNullOrEmpty(entry.Palette))
753 {
754 i = (short) node._paletteFiles.IndexOf(entry.Palette);
755 }
756
757 if (i < 0)
758 {
759 entry._pltFileIndex = 0;
760 }
761 else
762 {
763 entry._pltFileIndex = (ushort) i;
764 }
765
766 header->SetIndex(table.Index, entry._texFileIndex, false);
767 header->SetIndex(table.Index, entry._pltFileIndex, true);
768 }
769
770 flags = (flags & ~((uint) 0xF << (table._textureIndex * 4))) |
771 ((uint) table._texFlags << (table._textureIndex * 4));
772 }
773
774 header->_flags = flags;
775 }
ResourceNode Parent
Definition: ResourceNode.cs:245
const int Size
Definition: PAT0.cs:223

Member Data Documentation

◆ _dataAddrs

VoidPtr [] BrawlLib.SSBB.ResourceNodes.PAT0EntryNode._dataAddrs

◆ _dataLens

int [] BrawlLib.SSBB.ResourceNodes.PAT0EntryNode._dataLens

◆ _entryLen

int BrawlLib.SSBB.ResourceNodes.PAT0EntryNode._entryLen

Property Documentation

◆ AllowedChildTypes

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

◆ ResourceFileType

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

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