BrawlCrate v0.41
Wii File Editor
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Properties | List of all members
BrawlLib.SSBB.ResourceNodes.SCN0EntryNode Class Reference
Inheritance diagram for BrawlLib.SSBB.ResourceNodes.SCN0EntryNode:
BrawlLib.SSBB.ResourceNodes.ResourceNode BrawlLib.SSBB.ResourceNodes.SCN0AmbientLightNode BrawlLib.SSBB.ResourceNodes.SCN0CameraNode BrawlLib.SSBB.ResourceNodes.SCN0FogNode BrawlLib.SSBB.ResourceNodes.SCN0LightNode BrawlLib.SSBB.ResourceNodes.SCN0LightSetNode

Public Member Functions

override bool OnInitialize ()
 
override void OnRebuild (VoidPtr address, int length, bool force)
 
IColorSource FindColorMatch (bool constant, int frameCount, int id)
 
int WriteColors (ref int flags, int bit, RGBAPixel solidColor, List< RGBAPixel > colors, bool constant, int frameCount, VoidPtr valueAddr, ref VoidPtr thisMatchAddr, VoidPtr thatMatchAddr, RGBAPixel *dataAddr)
 
void DecodeKeyframes (KeyframeArray kf, VoidPtr dataAddr, int flags, int fixedBit)
 Reads keyframes from an address and sets them in the keyframe array provided. More...
 
- 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 Member Functions

static void DecodeKeyframes (KeyframeArray kf, VoidPtr dataAddr)
 Reads keyframes at an address, starting with the keyframe array header. More...
 
static int EncodeKeyframes (KeyframeArray kf, VoidPtr dataAddr, VoidPtr offset, ref int flags, int fixedBit)
 
static int EncodeKeyframes (KeyframeArray kf, VoidPtr dataAddr, VoidPtr offset)
 
static int EncodeKeyframes (KeyframeArray kf, VoidPtr dataAddr)
 
- 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

int[] _dataLengths = {0, 0, 0}
 
VoidPtr[] _dataAddrs = new VoidPtr[3]
 
- 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

void ReadColors (uint flags, uint bit, ref RGBAPixel solidColor, ref List< RGBAPixel > colors, int frameCount, VoidPtr address, ref bool constant, ref int numEntries)
 
void CalcKeyLen (KeyframeArray keyframes)
 
- Protected Member Functions inherited from BrawlLib.SSBB.ResourceNodes.ResourceNode
void ForceReplacedEvent ()
 
virtual void MergeInternal ()
 

Properties

override bool AllowNullNames [get]
 
SCN0Node Scene [get]
 
int NodeIndex [get]
 
int RealIndex [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

- Events inherited from BrawlLib.SSBB.ResourceNodes.ResourceNode
SelectEventHandler SelectChild
 
EventHandler UpdateProps
 
MoveEventHandler MovedUp
 
ResourceEventHandler Disposing
 
ResourceChildEventHandler ChildAdded
 
ResourceChildInsertEventHandler ChildInserted
 

Member Function Documentation

◆ CalcKeyLen()

void BrawlLib.SSBB.ResourceNodes.SCN0EntryNode.CalcKeyLen ( KeyframeArray  keyframes)
inlineprotected
424 {
425 if (keyframes._keyCount > 1)
426 {
427 _dataLengths[0] += SCN0KeyframesHeader.Size + keyframes._keyCount * SCN0KeyframeStruct.Size + 4;
428 }
429 }
int[] _dataLengths
Definition: SCN0GroupNode.cs:256

◆ DecodeKeyframes() [1/2]

static void BrawlLib.SSBB.ResourceNodes.SCN0EntryNode.DecodeKeyframes ( KeyframeArray  kf,
VoidPtr  dataAddr 
)
inlinestatic

Reads keyframes at an address, starting with the keyframe array header.

Parameters
kfThe array to set decoded frames to.
dataAddrThe address of the keyframe array header.
456 {
457 SCN0KeyframesHeader* header = (SCN0KeyframesHeader*) dataAddr;
458 SCN0KeyframeStruct* entry = header->Data;
459 for (int i = 0; i < header->_numFrames; i++, entry++)
460 {
461 kf.SetFrameValue((int) entry->_index, entry->_value, true)._tangent = entry->_tangent;
462 }
463 }
KeyframeEntry SetFrameValue(int index, float value, bool parsing=false)
Definition: KeyframeCollection.cs:556
bfloat _value
Definition: SCN0.cs:566
bfloat _index
Definition: SCN0.cs:566
bfloat _tangent
Definition: SCN0.cs:566
SCN0KeyframeStruct * Data
Definition: SCN0.cs:559
bushort _numFrames
Definition: SCN0.cs:539

◆ DecodeKeyframes() [2/2]

void BrawlLib.SSBB.ResourceNodes.SCN0EntryNode.DecodeKeyframes ( KeyframeArray  kf,
VoidPtr  dataAddr,
int  flags,
int  fixedBit 
)
inline

Reads keyframes from an address and sets them in the keyframe array provided.

Parameters
kfThe array to set decoded frames to.
dataAddrThe address of the OFFSET to the data.
flagsThe flags used to determine if the value is constant.
fixedBitThe bit located in the flags that determines if the value is constant.
439 {
440 if ((flags & fixedBit) != 0)
441 {
442 kf[0] = *(bfloat*) dataAddr;
443 }
444 else
445 {
446 DecodeKeyframes(kf, dataAddr + *(bint*) dataAddr);
447 }
448 }
void DecodeKeyframes(KeyframeArray kf, VoidPtr dataAddr, int flags, int fixedBit)
Reads keyframes from an address and sets them in the keyframe array provided.
Definition: SCN0GroupNode.cs:438
Definition: BigEndianTypes.cs:109
Definition: BigEndianTypes.cs:9

◆ EncodeKeyframes() [1/3]

static int BrawlLib.SSBB.ResourceNodes.SCN0EntryNode.EncodeKeyframes ( KeyframeArray  kf,
VoidPtr  dataAddr 
)
inlinestatic
486 {
487 VoidPtr start = dataAddr;
488 SCN0KeyframesHeader* header = (SCN0KeyframesHeader*) dataAddr;
489 *header = new SCN0KeyframesHeader(kf._keyCount);
490 KeyframeEntry frame, root = kf._keyRoot;
491
492 SCN0KeyframeStruct* entry = header->Data;
493 for (frame = root._next; frame._index != -1; frame = frame._next)
494 {
495 *entry++ = new SCN0KeyframeStruct(frame._tangent, frame._index, frame._value);
496 }
497
498 *(bint*) entry = 0;
499 dataAddr = (VoidPtr) entry + 4;
500 return dataAddr - start;
501 }
Definition: KeyframeCollection.cs:193
int _index
Definition: KeyframeCollection.cs:194
float _value
Definition: KeyframeCollection.cs:197
float _tangent
Definition: KeyframeCollection.cs:198
KeyframeEntry _next
Definition: KeyframeCollection.cs:195
Definition: VoidPtr.cs:9

◆ EncodeKeyframes() [2/3]

static int BrawlLib.SSBB.ResourceNodes.SCN0EntryNode.EncodeKeyframes ( KeyframeArray  kf,
VoidPtr  dataAddr,
VoidPtr  offset 
)
inlinestatic
480 {
481 *(bint*) offset = (int) dataAddr - (int) offset;
482 return EncodeKeyframes(kf, dataAddr);
483 }
static int EncodeKeyframes(KeyframeArray kf, VoidPtr dataAddr, VoidPtr offset, ref int flags, int fixedBit)
Definition: SCN0GroupNode.cs:465

◆ EncodeKeyframes() [3/3]

static int BrawlLib.SSBB.ResourceNodes.SCN0EntryNode.EncodeKeyframes ( KeyframeArray  kf,
VoidPtr  dataAddr,
VoidPtr  offset,
ref int  flags,
int  fixedBit 
)
inlinestatic
467 {
468 if (kf._keyCount > 1)
469 {
470 flags &= ~fixedBit;
471 return EncodeKeyframes(kf, dataAddr, offset);
472 }
473
474 flags |= fixedBit;
475 *(bfloat*) offset = kf._keyRoot._next._value;
476 return 0;
477 }

◆ FindColorMatch()

IColorSource BrawlLib.SSBB.ResourceNodes.SCN0EntryNode.FindColorMatch ( bool  constant,
int  frameCount,
int  id 
)
inline
315 {
316 IColorSource match = null;
317 IColorSource s = this as IColorSource;
318 if (!constant && s != null)
319 {
320 foreach (IColorSource n in ((ResourceNode) s).Parent.Children)
321 {
322 if (n == s)
323 {
324 break;
325 }
326
327 if (!n.GetColorConstant(id))
328 {
329 for (int i = 0; i <= frameCount; i++)
330 {
331 if (n.GetColor(i, id) != s.GetColor(i, id))
332 {
333 break;
334 }
335
336 if (i == frameCount)
337 {
338 match = n;
339 }
340 }
341 }
342
343 if (match != null)
344 {
345 break;
346 }
347 }
348 }
349
350 return match;
351 }
ResourceNode Parent
Definition: ResourceNode.cs:245
List< ResourceNode > Children
Definition: ResourceNode.cs:262
Definition: IColorSource.cs:4
ARGBPixel GetColor(int index, int id)

◆ OnInitialize()

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

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

Reimplemented in BrawlLib.SSBB.ResourceNodes.SCN0LightNode, and BrawlLib.SSBB.ResourceNodes.SCN0LightSetNode.

273 {
274 if (!_replaced && _name == null)
275 {
276 if (Header->_stringOffset != 0)
277 {
278 _name = Header->ResourceString;
279 }
280 else
281 {
282 _name = "<null>";
283 }
284 }
285
286 SetSizeInternal(Header->_length);
287
288 return false;
289 }
bool _replaced
Definition: ResourceNode.cs:827
void SetSizeInternal(int size)
Definition: ResourceNode.cs:799
string _name
Definition: ResourceNode.cs:139
bint _length
Definition: SCN0.cs:224
bint _stringOffset
Definition: SCN0.cs:226
string ResourceString
Definition: SCN0.cs:241

◆ OnRebuild()

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

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

Reimplemented in BrawlLib.SSBB.ResourceNodes.SCN0LightNode, and BrawlLib.SSBB.ResourceNodes.SCN0LightSetNode.

292 {
293 SCN0CommonHeader* header = (SCN0CommonHeader*) address;
294 header->_length = length;
295 }

◆ ReadColors()

void BrawlLib.SSBB.ResourceNodes.SCN0EntryNode.ReadColors ( uint  flags,
uint  bit,
ref RGBAPixel  solidColor,
ref List< RGBAPixel colors,
int  frameCount,
VoidPtr  address,
ref bool  constant,
ref int  numEntries 
)
inlineprotected
405 {
406 colors = new List<RGBAPixel>();
407 if (constant = (flags & bit) != 0)
408 {
409 solidColor = *(RGBAPixel*) address;
410 numEntries = 0;
411 }
412 else
413 {
414 numEntries = frameCount + 1;
415 RGBAPixel* addr = (RGBAPixel*) (address + *(bint*) address);
416 for (int x = 0; x < numEntries; x++)
417 {
418 colors.Add(*addr++);
419 }
420 }
421 }
Definition: PixelTypes.cs:327

◆ WriteColors()

int BrawlLib.SSBB.ResourceNodes.SCN0EntryNode.WriteColors ( ref int  flags,
int  bit,
RGBAPixel  solidColor,
List< RGBAPixel colors,
bool  constant,
int  frameCount,
VoidPtr  valueAddr,
ref VoidPtr  thisMatchAddr,
VoidPtr  thatMatchAddr,
RGBAPixel dataAddr 
)
inline
363 {
364 if (!constant)
365 {
366 flags &= ~bit;
367 thisMatchAddr = dataAddr;
368 if (thatMatchAddr == null)
369 {
370 VoidPtr start = dataAddr;
371 *(bint*) valueAddr = (int) dataAddr - (int) valueAddr;
372 for (int x = 0; x <= frameCount; x++)
373 {
374 if (x < colors.Count)
375 {
376 *dataAddr++ = colors[x];
377 }
378 else
379 {
380 *dataAddr++ = new RGBAPixel();
381 }
382 }
383
384 return dataAddr - start;
385 }
386
387 *(bint*) valueAddr = (int) thatMatchAddr - (int) valueAddr;
388 return 0;
389 }
390
391 flags |= bit;
392 *(RGBAPixel*) valueAddr = solidColor;
393 return 0;
394 }

Member Data Documentation

◆ _dataAddrs

VoidPtr [] BrawlLib.SSBB.ResourceNodes.SCN0EntryNode._dataAddrs = new VoidPtr[3]

◆ _dataLengths

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

Property Documentation

◆ AllowNullNames

override bool BrawlLib.SSBB.ResourceNodes.SCN0EntryNode.AllowNullNames
get

◆ NodeIndex

int BrawlLib.SSBB.ResourceNodes.SCN0EntryNode.NodeIndex
get

◆ RealIndex

int BrawlLib.SSBB.ResourceNodes.SCN0EntryNode.RealIndex
get

◆ Scene

SCN0Node BrawlLib.SSBB.ResourceNodes.SCN0EntryNode.Scene
get
242 {
243 get
244 {
245 ResourceNode n = _parent;
246 while (!(n is SCN0Node) && n != null)
247 {
248 n = n._parent;
249 }
250
251 return n as SCN0Node;
252 }
253 }
ResourceNode _parent
Definition: ResourceNode.cs:142

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