BrawlCrate v0.41
Wii File Editor
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Properties | List of all members
BrawlLib.SSBB.ResourceNodes.RSARNode Class Reference
Inheritance diagram for BrawlLib.SSBB.ResourceNodes.RSARNode:
BrawlLib.SSBB.ResourceNodes.NW4RArcEntryNode BrawlLib.SSBB.ResourceNodes.ARCEntryNode BrawlLib.SSBB.ResourceNodes.U8EntryNode 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)
 
override bool OnInitialize ()
 
- Public Member Functions inherited from BrawlLib.SSBB.ResourceNodes.ARCEntryNode
bool isModelData ()
 
bool isTextureData ()
 
void UpdateName ()
 
override void Initialize (ResourceNode parent, DataSource origSource, DataSource uncompSource)
 
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 ()
 

Public Attributes

List< RSAREntryNode >[] _infoCache = new List<RSAREntryNode>[5]
 
- 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
 

Properties

override ResourceType ResourceFileType [get]
 
override bool IsDirty [get, set]
 
ushort SeqSoundCount [get, set]
 
ushort SeqTrackCount [get, set]
 
ushort StrmSoundCount [get, set]
 
ushort StrmTrackCount [get, set]
 
ushort StrmChannelCount [get, set]
 
ushort WaveSoundCount [get, set]
 
ushort WaveTrackCount [get, set]
 
BindingList< RSARFileNodeFiles [get]
 
- Properties inherited from BrawlLib.SSBB.ResourceNodes.NW4RArcEntryNode
byte VersionMajor [get]
 
byte VersionMinor [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)
 
- 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

◆ OnCalculateSize()

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

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

425 {
426 _entryList.Clear();
427 _entryList._files = Files;
428 _converter = new RSARConverter();
429
430 List<string> unusedFolders = new List<string>();
431 foreach (ResourceNode n in Children)
432 {
433 if (n is RSARFolderNode)
434 {
435 ((RSARFolderNode) n).GetStrings(null, 0, _entryList, ref unusedFolders);
436 }
437 else
438 {
439 (n as RSAREntryNode)?.GetStrings(null, 0, _entryList);
440 }
441 }
442
443 if (unusedFolders.Count > 0)
444 {
445 MessageBox.Show(_mainForm,
446 string.Format("The following path{0} ha{1} no entries and will be lost:\n" +
447 unusedFolders.Aggregate((current, next) => current + "\n" + next),
448 unusedFolders.Count > 1 ? "s" : "",
449 unusedFolders.Count > 1 ? "ve" : "s"),
450 "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
451 }
452
453 _entryList.SortStrings();
454
455 return _converter.CalculateSize(_entryList, this);
456 }
BindingList< RSARFileNode > Files
Definition: RSARNode.cs:174
Form _mainForm
Definition: ResourceNode.cs:130
List< ResourceNode > Children
Definition: ResourceNode.cs:262
Definition: RSARConverter.cs:12
void Clear()
Definition: RSARConverter.cs:463

◆ OnInitialize()

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

Reimplemented from BrawlLib.SSBB.ResourceNodes.NW4RArcEntryNode.

177 {
178 base.OnInitialize();
179
180 if (_name == null)
181 {
182 if (_origPath != null)
183 {
184 _name = Path.GetFileNameWithoutExtension(_origPath);
185 }
186 else
187 {
188 _name = "Sound Archive";
189 }
190 }
191
192 _files = new BindingList<RSARFileNode>();
193 _children = new List<ResourceNode>();
194
195 //Retrieve all files to attach to entries
196 GetFiles();
197 OnPopulate();
198 return true;
199 }
override void OnPopulate()
Definition: RSARNode.cs:202
List< ResourceNode > _children
Definition: ResourceNode.cs:143
string _origPath
Definition: ResourceNode.cs:139
string _name
Definition: ResourceNode.cs:139

◆ OnPopulate()

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

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

203 {
204 //Enumerate entries, attaching them to the files.
205 RSARHeader* rsar = Header;
206 SYMBHeader* symb = rsar->SYMBBlock;
207 sbyte* offset = (sbyte*) symb + 8;
208 buint* stringOffsets = symb->StringOffsets;
209
210 VoidPtr baseAddr = (VoidPtr) rsar->INFOBlock + 8;
211 ruint* typeList = (ruint*) baseAddr;
212
213 //Iterate through group types
214 for (int i = 0; i < 5; i++)
215 {
216 Type t = null;
217 switch (i)
218 {
219 case 0:
220 t = typeof(RSARSoundNode);
221 break;
222 case 1:
223 t = typeof(RSARBankNode);
224 break;
225 case 2:
226 t = typeof(RSARPlayerInfoNode);
227 break;
228 case 3: continue; //Files
229 case 4:
230 t = typeof(RSARGroupNode);
231 break; //Last group entry has no name
232 }
233
234 _infoCache[i] = new List<RSAREntryNode>();
235 RuintList* list = (RuintList*) ((uint) baseAddr + typeList[i]);
236 sbyte* str, end;
237
238 for (int x = 0; x < list->_numEntries; x++)
239 {
240 VoidPtr addr = list->Get(baseAddr, x);
241
242 ResourceNode parent = this;
243 RSAREntryNode n = Activator.CreateInstance(t) as RSAREntryNode;
244 n._origSource = n._uncompSource = new DataSource(addr, 0);
245
246 if (n.StringId >= 0)
247 {
248 str = offset + stringOffsets[n.StringId];
249
250 for (end = str; *end != 0; end++)
251 {
252 ;
253 }
254
255 while (--end > str && *end != '_')
256 {
257 ;
258 }
259
260 if (end > str)
261 {
262 parent = CreatePath(parent, str, (int) end - (int) str);
263 n._name = new string(end + 1);
264 }
265 else
266 {
267 n._name = new string(str);
268 }
269 }
270 else
271 {
272 n._name = null;
273 }
274
275 n._infoIndex = x;
276 n.Initialize(parent, addr, 0);
277 _infoCache[i].Add(n);
278 }
279
280 _ftr = *(INFOFooter*) ((uint) baseAddr + typeList[5]);
281
282 foreach (RSARFileNode n in Files)
283 {
284 if (!(n is RSARExtFileNode))
285 {
286 n.GetName();
287 }
288 }
289 }
290 }
List< RSAREntryNode >[] _infoCache
Definition: RSARNode.cs:169
int Type
Definition: U8Node.cs:400
Definition: VoidPtr.cs:9
Definition: BigEndianTypes.cs:59
buint * StringOffsets
Definition: RSAR.cs:101
Definition: Common.cs:285
VoidPtr Get(VoidPtr offset, int index)
Definition: Common.cs:310
bint _numEntries
Definition: Common.cs:288
Definition: Common.cs:232

◆ OnRebuild()

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

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

459 {
460 int symbLen, infoLen, fileLen;
461
462 RSARHeader* rsar = (RSARHeader*) address;
463 SYMBHeader* symb = (SYMBHeader*) (address + 0x40);
464 INFOHeader* info;
465 FILEHeader* data;
466
467 info = (INFOHeader*) ((int) symb + (symbLen = _converter.EncodeSYMBBlock(symb, _entryList, this)));
468 data = (FILEHeader*) ((int) info + (infoLen = _converter.EncodeINFOBlock(info, _entryList, this)));
469 fileLen = _converter.EncodeFILEBlock(data, address, _entryList, this);
470
471 rsar->Set(symbLen, infoLen, fileLen, VersionMinor);
472
473 _entryList.Clear();
474 }
byte VersionMinor
Definition: NW4RNode.cs:35

Member Data Documentation

◆ _infoCache

List<RSAREntryNode> [] BrawlLib.SSBB.ResourceNodes.RSARNode._infoCache = new List<RSAREntryNode>[5]

Property Documentation

◆ Files

BindingList<RSARFileNode> BrawlLib.SSBB.ResourceNodes.RSARNode.Files
get

◆ IsDirty

override bool BrawlLib.SSBB.ResourceNodes.RSARNode.IsDirty
getset
20 {
21 get
22 {
23 if (!AllowSaving)
24 {
25 return false;
26 }
27
28 if (HasChanged)
29 {
30 return true;
31 }
32
33 if (_children != null)
34 {
35 foreach (ResourceNode n in _children)
36 {
37 if (n.HasChanged || n.IsBranch || n.IsDirty)
38 {
39 return true;
40 }
41 }
42 }
43
44 if (Files != null)
45 {
46 foreach (var n in Files)
47 {
48 if (n.HasChanged || n.IsBranch || n.IsDirty)
49 {
50 return true;
51 }
52 }
53 }
54
55 return false;
56 }
57 set
58 {
59 _changed = value;
60 if (_children != null)
61 {
62 foreach (ResourceNode r in Children)
63 {
64 if (r._children != null)
65 {
66 r.IsDirty = value;
67 }
68 else
69 {
70 r._changed = value;
71 }
72 }
73 }
74
75 if (Files != null)
76 {
77 foreach (var r in Files)
78 {
79 if (r._children != null)
80 {
81 r.IsDirty = value;
82 }
83 else
84 {
85 r._changed = value;
86 }
87 }
88 }
89 }
90 }
bool HasChanged
Definition: ResourceNode.cs:308
virtual bool AllowSaving
Definition: ResourceNode.cs:328

◆ ResourceFileType

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

◆ SeqSoundCount

ushort BrawlLib.SSBB.ResourceNodes.RSARNode.SeqSoundCount
getset
94 {
95 get => _ftr._seqSoundCount;
96 set
97 {
98 _ftr._seqSoundCount = value;
100 }
101 }
virtual void SignalPropertyChange()
Definition: ResourceNode.cs:313

◆ SeqTrackCount

ushort BrawlLib.SSBB.ResourceNodes.RSARNode.SeqTrackCount
getset
105 {
106 get => _ftr._seqTrackCount;
107 set
108 {
109 _ftr._seqTrackCount = value;
111 }
112 }

◆ StrmChannelCount

ushort BrawlLib.SSBB.ResourceNodes.RSARNode.StrmChannelCount
getset
138 {
139 get => _ftr._strmChannelCount;
140 set
141 {
142 _ftr._strmChannelCount = value;
144 }
145 }

◆ StrmSoundCount

ushort BrawlLib.SSBB.ResourceNodes.RSARNode.StrmSoundCount
getset
116 {
117 get => _ftr._strmSoundCount;
118 set
119 {
120 _ftr._strmSoundCount = value;
122 }
123 }

◆ StrmTrackCount

ushort BrawlLib.SSBB.ResourceNodes.RSARNode.StrmTrackCount
getset
127 {
128 get => _ftr._strmTrackCount;
129 set
130 {
131 _ftr._strmTrackCount = value;
133 }
134 }

◆ WaveSoundCount

ushort BrawlLib.SSBB.ResourceNodes.RSARNode.WaveSoundCount
getset
149 {
150 get => _ftr._waveSoundCount;
151 set
152 {
153 _ftr._waveSoundCount = value;
155 }
156 }

◆ WaveTrackCount

ushort BrawlLib.SSBB.ResourceNodes.RSARNode.WaveTrackCount
getset
160 {
161 get => _ftr._waveTrackCount;
162 set
163 {
164 _ftr._waveTrackCount = value;
166 }
167 }

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