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

Public Member Functions

override bool OnInitialize ()
 
override void OnRebuild (VoidPtr address, int length, bool force)
 
override int OnCalculateSize (bool force)
 
override void Export (string outPath)
 
- 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 ()
 

Properties

override ResourceType ResourceFileType [get]
 
int[][] Entries [get, set]
 
string[] Strings [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)
 
- 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 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

◆ Export()

override void BrawlLib.SSBB.ResourceNodes.CEStringNode.Export ( string  outPath)
inlinevirtual

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

668 {
669 uint dataLen = (uint) OnCalculateSize(true);
670 using (FileStream stream = new FileStream(outPath, FileMode.OpenOrCreate, FileAccess.ReadWrite,
671 FileShare.None, 8, FileOptions.RandomAccess))
672 {
673 stream.SetLength(dataLen);
674 using (FileMap map = FileMap.FromStream(stream))
675 {
676 Rebuild(map.Address, (int) dataLen, true);
677 }
678 }
679 }
Definition: FileMap.cs:10
static FileMap FromStream(FileStream stream)
Definition: FileMap.cs:117
VoidPtr Address
Definition: FileMap.cs:16
override int OnCalculateSize(bool force)
Definition: CENode.cs:638
virtual void Rebuild()
Definition: ResourceNode.cs:987

◆ OnCalculateSize()

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

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

639 {
640 int size = 0x10;
641 foreach (int[] array in Entries)
642 {
643 foreach (int entry in array)
644 {
645 size += 0x4;
646 }
647 }
648
649 foreach (string s in Strings)
650 {
651 size += s.Length; // + 0x1;
652 }
653
654 if (Strings.Length > 1)
655 {
656 size += Strings.Length - 1;
657 }
658
659 if (size % 0x10 != 0)
660 {
661 return size + 0x10 - size % 0x10;
662 }
663
664 return size;
665 }
string[] Strings
Definition: CENode.cs:548
int[][] Entries
Definition: CENode.cs:536

◆ OnInitialize()

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

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

558 {
559 if (_name == null || _name == "")
560 {
561 _name = "StringEntry" + Parent.Children.IndexOf(this);
562 }
563
564 entries = new int[Header->_numEntries][];
565 for (int i = 0; i < entries.Length; i++)
566 {
567 entries[i] = new int[2];
568 }
569
570 for (int i = 0, j = 0; j < Header->_numEntries; i += 0x2, j++)
571 {
572 entries[j][0] = Header->Entries[i];
573 entries[j][1] = Header->Entries[i + 1];
574 }
575
576 strings = GetStrings();
577 unk1 = Header->_unk1;
578 unk2 = Header->_unk2;
579 unk3 = Header->_unk3;
580 return false;
581 }
string _name
Definition: ResourceNode.cs:139
ResourceNode Parent
Definition: ResourceNode.cs:245
List< ResourceNode > Children
Definition: ResourceNode.cs:262
bint _unk1
Definition: AI.cs:140
bint _unk3
Definition: AI.cs:142
bint _numEntries
Definition: AI.cs:139
bint * Entries
Definition: AI.cs:155
bint _unk2
Definition: AI.cs:141

◆ OnRebuild()

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

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

605 {
606 CEString* strings = (CEString*) address;
607 strings->_numEntries = Strings.Length;
608 strings->_unk1 = unk1;
609 strings->_unk2 = unk2;
610 strings->_unk3 = unk3;
611 for (int i = 0, j = 0; j < Entries.Length; i += 0x2, j++)
612 {
613 strings->Entries[i] = Entries[j][0];
614 strings->Entries[i + 1] = Entries[j][1];
615 }
616
617 byte* word = (byte*) &strings->Entries[strings->_numEntries * 2];
618 List<byte[]> ByteStrLine = new List<byte[]>();
619 Encoding sjisEnc = Encoding.GetEncoding("Shift_JIS");
620 foreach (string s in Strings)
621 {
622 ByteStrLine.Add(sjisEnc.GetBytes(s));
623 }
624
625 foreach (byte[] bline in ByteStrLine)
626 {
627 foreach (byte b in bline)
628 {
629 *word = b;
630 word++;
631 }
632
633 *word = 0x0;
634 word++;
635 }
636 }
Definition: AI.cs:138

Property Documentation

◆ Entries

int [][] BrawlLib.SSBB.ResourceNodes.CEStringNode.Entries
getset
536 {
537 get => entries;
538 set
539 {
540 entries = value;
542 }
543 }
virtual void SignalPropertyChange()
Definition: ResourceNode.cs:313

◆ ResourceFileType

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

◆ Strings

string [] BrawlLib.SSBB.ResourceNodes.CEStringNode.Strings
getset
548 {
549 get => strings;
550 set
551 {
552 strings = value;
554 }
555 }

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