BrawlCrate v0.41
Wii File Editor
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Member Functions | Properties | List of all members
BrawlLib.SSBB.ResourceNodes.BRESEntryNode Class Reference
Inheritance diagram for BrawlLib.SSBB.ResourceNodes.BRESEntryNode:
BrawlLib.SSBB.ResourceNodes.ResourceNode BrawlLib.SSBB.ResourceNodes.MDL0Node BrawlLib.SSBB.ResourceNodes.NW4RAnimationNode BrawlLib.SSBB.ResourceNodes.PLT0Node BrawlLib.SSBB.ResourceNodes.TEX0Node BrawlLib.SSBB.ResourceNodes.CHR0Node BrawlLib.SSBB.ResourceNodes.CLR0Node BrawlLib.SSBB.ResourceNodes.PAT0Node BrawlLib.SSBB.ResourceNodes.SCN0Node BrawlLib.SSBB.ResourceNodes.SHP0Node BrawlLib.SSBB.ResourceNodes.SRT0Node BrawlLib.SSBB.ResourceNodes.VIS0Node

Public Member Functions

override bool OnInitialize ()
 
override void Export (string outPath)
 
override byte[] MD5 ()
 Find the MD5 checksum of this node's data. Before calculating the checksum, the data will be copied to a temporary area in memory and PostProcess will be run just as in Export(). 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 ()
 

Public Attributes

int _version
 
string _originalPath
 
- 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

virtual void OnVersionChanged (int previousVersion)
 
- Protected Member Functions inherited from BrawlLib.SSBB.ResourceNodes.ResourceNode
void ForceReplacedEvent ()
 
virtual void MergeInternal ()
 

Properties

virtual int DataAlign [get]
 
BRRESNode BRESNode [get]
 
virtual int[] SupportedVersions [get]
 
virtual string Tag [get]
 
int Version [get, set]
 
string OriginalPath [get, set]
 
UserDataCollection UserEntries [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)
 
- 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.BRESEntryNode.Export ( string  outPath)
inlinevirtual

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

Reimplemented in BrawlLib.SSBB.ResourceNodes.TEX0Node, and BrawlLib.SSBB.ResourceNodes.MDL0Node.

1125 {
1126 Rebuild();
1127
1128 StringTable table = new StringTable();
1129 GetStrings(table);
1130
1131 int dataLen = WorkingUncompressed.Length.Align(4);
1132 int size = dataLen + table.GetTotalSize();
1133
1134 using (FileStream stream = new FileStream(outPath, FileMode.OpenOrCreate, FileAccess.ReadWrite,
1135 FileShare.None, 8, FileOptions.RandomAccess))
1136 {
1137 stream.SetLength(size);
1138 using (FileMap map = FileMap.FromStream(stream))
1139 {
1141 table.WriteTable(map.Address + dataLen);
1142 PostProcess(null, map.Address, WorkingUncompressed.Length, table);
1143 }
1144 }
1145
1146 table.Clear();
1147 }
Definition: FileMap.cs:10
static FileMap FromStream(FileStream stream)
Definition: FileMap.cs:117
VoidPtr Address
Definition: FileMap.cs:16
Definition: Memory.cs:8
static void Move(VoidPtr dst, VoidPtr src, uint size)
Definition: Memory.cs:9
virtual void Rebuild()
Definition: ResourceNode.cs:987
DataSource WorkingUncompressed
Definition: ResourceNode.cs:183
int Length
Definition: ResourceNode.cs:32
VoidPtr Address
Definition: ResourceNode.cs:31

◆ MD5()

override byte[] BrawlLib.SSBB.ResourceNodes.BRESEntryNode.MD5 ( )
inlinevirtual

Find the MD5 checksum of this node's data. Before calculating the checksum, the data will be copied to a temporary area in memory and PostProcess will be run just as in Export().

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

1173 {
1175 {
1176 // skip bres fix
1177 return base.MD5();
1178 }
1179
1180 Rebuild();
1181
1182 StringTable table = new StringTable();
1183 GetStrings(table);
1184
1185 int dataLen = WorkingUncompressed.Length.Align(4);
1186 int size = dataLen + table.GetTotalSize();
1187
1188 byte[] datacopy = new byte[size];
1189 fixed (byte* ptr = datacopy)
1190 {
1192 table.WriteTable(ptr + dataLen);
1193 PostProcess(null, ptr, WorkingUncompressed.Length, table);
1194 }
1195
1196 return MD5Provider.ComputeHash(datacopy);
1197 }
static MD5CryptoServiceProvider MD5Provider
Definition: ResourceNode.cs:1659

◆ OnInitialize()

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

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

Reimplemented in BrawlLib.SSBB.ResourceNodes.PLT0Node, BrawlLib.SSBB.ResourceNodes.TEX0Node, BrawlLib.SSBB.ResourceNodes.MDL0Node, and BrawlLib.SSBB.ResourceNodes.SCN0Node.

1108 {
1109 _userEntries = new UserDataCollection();
1110 _version = CommonHeader->_version;
1111 SetSizeInternal(CommonHeader->_size);
1112 if (WorkingUncompressed.Length >= 4 && !string.IsNullOrEmpty(Tag) && !WorkingUncompressed.Tag.Equals(Tag))
1113 {
1115 }
1116 return false;
1117 }
int _version
Definition: BRRESNode.cs:1045
virtual string Tag
Definition: BRRESNode.cs:1043
void SetSizeInternal(int size)
Definition: ResourceNode.cs:799
virtual void SignalPropertyChange()
Definition: ResourceNode.cs:313
string Tag
Definition: ResourceNode.cs:37
bint _version
Definition: BRES.cs:81
bint _size
Definition: BRES.cs:80

◆ OnVersionChanged()

virtual void BrawlLib.SSBB.ResourceNodes.BRESEntryNode.OnVersionChanged ( int  previousVersion)
inlineprotectedvirtual

Reimplemented in BrawlLib.SSBB.ResourceNodes.MDL0Node.

1104 {
1105 }

Member Data Documentation

◆ _originalPath

string BrawlLib.SSBB.ResourceNodes.BRESEntryNode._originalPath

◆ _version

int BrawlLib.SSBB.ResourceNodes.BRESEntryNode._version

Property Documentation

◆ BRESNode

BRRESNode BrawlLib.SSBB.ResourceNodes.BRESEntryNode.BRESNode
get

◆ DataAlign

virtual int BrawlLib.SSBB.ResourceNodes.BRESEntryNode.DataAlign
get

◆ OriginalPath

string BrawlLib.SSBB.ResourceNodes.BRESEntryNode.OriginalPath
getset
1081 {
1082 get => _originalPath;
1083 set
1084 {
1085 _originalPath = value;
1087 }
1088 }
string _originalPath
Definition: BRRESNode.cs:1046

◆ SupportedVersions

virtual int [] BrawlLib.SSBB.ResourceNodes.BRESEntryNode.SupportedVersions
get

◆ Tag

virtual string BrawlLib.SSBB.ResourceNodes.BRESEntryNode.Tag
get
1043{ get; }

◆ UserEntries

UserDataCollection BrawlLib.SSBB.ResourceNodes.BRESEntryNode.UserEntries
getset
1094 {
1095 get => _userEntries;
1096 set
1097 {
1098 _userEntries = value;
1100 }
1101 }

◆ Version

int BrawlLib.SSBB.ResourceNodes.BRESEntryNode.Version
getset
1052 {
1053 get => _version;
1054 set
1055 {
1056 if (SupportedVersions.Contains(value))
1057 {
1058 int previous = _version;
1059 _version = value;
1061 OnVersionChanged(previous);
1062 }
1063 else
1064 {
1065 string message =
1066 "The version entered for this node is either invalid or unsupported.\nSupported versions are: ";
1067 foreach (int i in SupportedVersions)
1068 {
1069 message += " " + i;
1070 }
1071
1072 MessageBox.Show(RootNode._mainForm, message, "Unsupported version", MessageBoxButtons.OK,
1073 MessageBoxIcon.Exclamation);
1074 }
1075 }
1076 }
virtual int[] SupportedVersions
Definition: BRRESNode.cs:1041
virtual void OnVersionChanged(int previousVersion)
Definition: BRRESNode.cs:1103
ResourceNode RootNode
Definition: ResourceNode.cs:175
Form _mainForm
Definition: ResourceNode.cs:130

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