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

Public Types

enum  GroupType
 

Public Member Functions

 SCN0GroupNode (GroupType t)
 
 SCN0GroupNode (string name)
 
override void RemoveChild (ResourceNode child)
 
override bool OnInitialize ()
 
override int OnCalculateSize (bool force)
 
override void OnRebuild (VoidPtr address, int length, bool force)
 
- 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

GroupType _type
 
int[] _dataLengths = {0, 0, 0, 0, 0}
 
VoidPtr[] _addrs = new VoidPtr[4]
 
- 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
 

Static Public Attributes

static readonly string[] _names
 
static readonly Type[] _types
 

Properties

override ResourceType ResourceFileType [get]
 
override string Name [get, set]
 
List< ResourceNodeUsedChildren [get]
 Returns a list of all non-null children. More...
 
- 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 Enumeration Documentation

◆ GroupType

20 {
21 LightSet,
22 AmbientLight,
23 Light,
24 Fog,
25 Camera
26 }

Constructor & Destructor Documentation

◆ SCN0GroupNode() [1/2]

BrawlLib.SSBB.ResourceNodes.SCN0GroupNode.SCN0GroupNode ( GroupType  t)
inline
63 {
64 _type = t;
65 }
GroupType _type
Definition: SCN0GroupNode.cs:17

◆ SCN0GroupNode() [2/2]

BrawlLib.SSBB.ResourceNodes.SCN0GroupNode.SCN0GroupNode ( string  name)
inline
68 {
69 int i = _names.IndexOf(name);
70 if (i >= 0 && i < 5)
71 {
72 _type = (GroupType) i;
73 }
74 }
static readonly string[] _names
Definition: SCN0GroupNode.cs:28
GroupType
Definition: SCN0GroupNode.cs:20

Member Function Documentation

◆ OnCalculateSize()

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

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

106 {
107 //Calculate resource group length.
108 //Null nodes are not included in the resource group.
109 _dataLengths[0] = ResourceGroup.Size + UsedChildren.Count * ResourceEntry.Size;
110
111 //Reset entry length
112 _dataLengths[1] = 0;
113
114 //Loop through each node and increase entry and data lengths
115 foreach (SCN0EntryNode n in Children)
116 {
117 //Add length of header and calculate data lengths
118 _dataLengths[1] += n.CalculateSize(true);
119
120 for (int i = 0; i < 3; i++)
121 {
122 _dataLengths[i + 2] += n._dataLengths[i];
123 }
124 }
125
126 return _dataLengths[0] + _dataLengths[1] + _dataLengths[2] + _dataLengths[3] + _dataLengths[4];
127 }
List< ResourceNode > Children
Definition: ResourceNode.cs:262
int[] _dataLengths
Definition: SCN0GroupNode.cs:103
Definition: Common.cs:472
const int Size
Definition: Common.cs:473

◆ OnInitialize()

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

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

98 {
99 return Group->_numEntries > 0;
100 }
bint _numEntries
Definition: Common.cs:384

◆ OnRebuild()

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

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

133 {
134 //Create resource group
135 ResourceGroup* group = (ResourceGroup*) address;
136 *group = new ResourceGroup(UsedChildren.Count);
137 ResourceEntry* entry = group->First;
138
139 //Loop through entries,
140 //set data offset in group,
141 //set data addresses to each entry
142 //rebuild entry, and increment data addresses
143 foreach (SCN0EntryNode n in Children)
144 {
145 //Null entries are not written to the resource group
146 if (n.Name != "<null>")
147 {
148 (entry++)->_dataOffset = (int) _addrs[0] - (int) group;
149 }
150
151 //Set data addresses to entry
152 for (int i = 0; i < 3; i++)
153 {
154 n._dataAddrs[i] = _addrs[i + 1];
155 }
156
157 //Rebuild entry
158 n.Rebuild(_addrs[0], n._calcSize, true);
159
160 //Increase data addresses
161 _addrs[0] += n._calcSize;
162 for (int i = 0; i < 3; i++)
163 {
164 _addrs[i + 1] += n._dataLengths[i];
165 }
166 }
167 }
VoidPtr[] _addrs
Definition: SCN0GroupNode.cs:130
List< ResourceNode > UsedChildren
Returns a list of all non-null children.
Definition: SCN0GroupNode.cs:218
Definition: Common.cs:380
ResourceEntry * First
Definition: Common.cs:405

◆ RemoveChild()

override void BrawlLib.SSBB.ResourceNodes.SCN0GroupNode.RemoveChild ( ResourceNode  child)
inlinevirtual

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

86 {
87 if (_children != null && _children.Count == 1 && _children.Contains(child))
88 {
89 _parent.RemoveChild(this);
90 }
91 else
92 {
93 base.RemoveChild(child);
94 }
95 }
ResourceNode _parent
Definition: ResourceNode.cs:142
List< ResourceNode > _children
Definition: ResourceNode.cs:143
virtual void RemoveChild(ResourceNode child)
Definition: ResourceNode.cs:746

Member Data Documentation

◆ _addrs

VoidPtr [] BrawlLib.SSBB.ResourceNodes.SCN0GroupNode._addrs = new VoidPtr[4]

◆ _dataLengths

int [] BrawlLib.SSBB.ResourceNodes.SCN0GroupNode._dataLengths = {0, 0, 0, 0, 0}

◆ _names

readonly string [] BrawlLib.SSBB.ResourceNodes.SCN0GroupNode._names
static
Initial value:
=
{
"LightSet(NW4R)",
"AmbLights(NW4R)",
"Lights(NW4R)",
"Fogs(NW4R)",
"Cameras(NW4R)"
}

◆ _type

GroupType BrawlLib.SSBB.ResourceNodes.SCN0GroupNode._type

◆ _types

readonly Type [] BrawlLib.SSBB.ResourceNodes.SCN0GroupNode._types
static
Initial value:
=
{
typeof(SCN0LightSetNode),
typeof(SCN0AmbientLightNode),
typeof(SCN0LightNode),
typeof(SCN0FogNode),
typeof(SCN0CameraNode)
}

Property Documentation

◆ Name

override string BrawlLib.SSBB.ResourceNodes.SCN0GroupNode.Name
getset
48 {
49 get => _names[(int) _type];
50 set
51 {
52 int i = _names.IndexOf(value);
53 if (i >= 0 && i < 5)
54 {
55 _type = (GroupType) i;
56 }
57
58 base.Name = value;
59 }
60 }

◆ ResourceFileType

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

◆ UsedChildren

List<ResourceNode> BrawlLib.SSBB.ResourceNodes.SCN0GroupNode.UsedChildren
get

Returns a list of all non-null children.

218 {
219 get
220 {
221 List<ResourceNode> l = new List<ResourceNode>();
222 foreach (SCN0EntryNode n in Children)
223 {
224 if (n.Name != "<null>")
225 {
226 l.Add(n);
227 }
228 }
229
230 return l;
231 }
232 }

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