BrawlCrate v0.41
Wii File Editor
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Attributes | Properties | List of all members
BrawlLib.SSBB.ResourceNodes.StageTableNode Class Reference
Inheritance diagram for BrawlLib.SSBB.ResourceNodes.StageTableNode:
BrawlLib.SSBB.ResourceNodes.ARCEntryNode BrawlLib.SSBB.ResourceNodes.MultipleInterpretationIAttributeList BrawlLib.SSBB.ResourceNodes.U8EntryNode BrawlLib.SSBB.ResourceNodes.IAttributeList BrawlLib.SSBB.ResourceNodes.ResourceNode BrawlLib.SSBB.ResourceNodes.STDTNode

Public Member Functions

override int OnCalculateSize (bool force)
 
void SetFloat (int index, float value)
 
float GetFloat (int index)
 
void SetDegrees (int index, float value)
 
float GetDegrees (int index)
 
void SetInt (int index, int value)
 
int GetInt (int index)
 
void SetRGBAPixel (int index, string value)
 
void SetRGBAPixel (int index, RGBAPixel value)
 
RGBAPixel GetRGBAPixel (int index)
 
void SetHex (int index, string value)
 
string GetHex (int index)
 
void SetBytes (int index, params byte[] values)
 
string GetBytes (int index)
 
void SetShorts (int index, short value1, short value2)
 
string GetShorts (int index)
 
IEnumerable< AttributeInterpretationGetPossibleInterpretations ()
 
override void Replace (string fileName)
 
- Public Member Functions inherited from BrawlLib.SSBB.ResourceNodes.ARCEntryNode
bool isModelData ()
 
bool isTextureData ()
 
void UpdateName ()
 
override void Initialize (ResourceNode parent, DataSource origSource, DataSource uncompSource)
 
- Public Member Functions inherited from BrawlLib.SSBB.ResourceNodes.U8EntryNode
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 ()
 
IEnumerable< AttributeInterpretationGetPossibleInterpretations ()
 
- Public Member Functions inherited from BrawlLib.SSBB.ResourceNodes.IAttributeList
void SetFloat (int index, float value)
 
float GetFloat (int index)
 
void SetDegrees (int index, float value)
 
float GetDegrees (int index)
 
void SetInt (int index, int value)
 
int GetInt (int index)
 
void SetRGBAPixel (int index, string value)
 
void SetRGBAPixel (int index, RGBAPixel value)
 
RGBAPixel GetRGBAPixel (int index)
 
void SetHex (int index, string value)
 
string GetHex (int index)
 
void SetBytes (int index, params byte[] values)
 
string GetBytes (int index)
 
void SetShorts (int index, short value1, short value2)
 
string GetShorts (int index)
 
void SignalPropertyChange ()
 

Public Attributes

List< byte > EntryList = new List<byte>()
 
- 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
 

Protected Member Functions

virtual AttributeInterpretation GenerateDefaultInterpretation ()
 
virtual void ReadConfig ()
 
- 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 ()
 

Static Protected Attributes

static readonly List< AttributeInterpretationFormats = new List<AttributeInterpretation>()
 
static readonly HashSet< string > ConfigPathsRead = new HashSet<string>()
 

Properties

int NumEntries [get]
 The number of (four-byte) entries - i.e. the length in bytes divided by four. More...
 
virtual int Unknown0 [get, set]
 
virtual int Unknown1 [get, set]
 
virtual int Unknown2 [get, set]
 
- 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]
 
- Properties inherited from BrawlLib.SSBB.ResourceNodes.IAttributeList
int NumEntries [get]
 The number of (four-byte) entries - i.e. the length in bytes divided by four. More...
 

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 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

◆ GenerateDefaultInterpretation()

virtual AttributeInterpretation BrawlLib.SSBB.ResourceNodes.StageTableNode.GenerateDefaultInterpretation ( )
inlineprotectedvirtual
279 {
281 int index = EntryOffset;
282
283 ResourceNode root = RootNode;
284
285 for (int i = 0; i < arr.Length; i++)
286 {
287 arr[i] = new AttributeInfo
288 {
289 _name = "0x" + index.ToString("X3")
290 };
291 //Guess what type the attribute is
292 uint u = BitConverter.ToUInt32(EntryList.ToArray(), i * 4);
293 int i32 = BitConverter.ToInt32(EntryList.ToArray(), i * 4);
294 float f = BitConverter.ToSingle(EntryList.ToArray(), i * 4);
295 RGBAPixel p = new RGBAPixel(u);
296 if (u == 0)
297 {
298 arr[i]._type = 0;
299 arr[i]._description = "Default: 0 (Could be int or float - be careful)";
300 }
301 else if (((u >> 24) & 0xFF) != 0 && i32 != -1 && !float.IsNaN(f))
302 {
303 float abs = Math.Abs(f);
304 if (abs > 0.0000001 && abs < 10000000 || float.IsInfinity(abs))
305 {
306 arr[i]._type = 0;
307 arr[i]._description = "Default (Float): " + f + " (0x" + u.ToString("X8") + ")";
308 }
309 else if ((p.R % 5 == 0 || p.R % 3 == 0) && (p.B % 5 == 0 || p.B % 3 == 0) &&
310 (p.G % 5 == 0 || p.G % 3 == 0) && (p.A == 0 || p.A == 255))
311 {
312 arr[i]._type = 3;
313 arr[i]._description = "Default (Color): " + p + " (0x" + u.ToString("X8") + ")";
314 arr[i]._name = arr[i]._name;
315 }
316 else
317 {
318 arr[i]._type = 4;
319 arr[i]._description = "Default (Unknown Type): (0x" + u.ToString("X8") + ")";
320 arr[i]._name = "~" + arr[i]._name;
321 }
322 }
323 else
324 {
325 arr[i]._type = 1;
326 arr[i]._description = "Default (Integer): " + u + " (0x" + u.ToString("X8") + ")";
327 arr[i]._name = "*" + arr[i]._name;
328 }
329
330 index += 4;
331 }
332
333 string temp = "";
334 if (root != this)
335 {
336 temp = "[" + FileIndex + "]";
337 }
338
339#if DEBUG
340 DirectoryInfo startingDirectory = new DirectoryInfo(Application.StartupPath);
341 string filename = Path.Combine(startingDirectory.Parent.Parent.Parent.Parent.Parent.FullName, "BrawlLib",
342 "InternalDocumentation", DocumentationSubDirectory,
343 root.Name.ToUpper().Replace("STG", "") + temp + ".txt");
344#else
345 string filename = Path.Combine(Application.StartupPath, "InternalDocumentation", DocumentationSubDirectory,
346 root.Name.ToUpper().Replace("STG", "") + temp + ".txt");
347#endif
348 return new AttributeInterpretation(arr, filename);
349 }
Definition: AttributeInfo.cs:9
string _name
Definition: AttributeInfo.cs:10
int _type
Definition: AttributeInfo.cs:12
string _description
Definition: AttributeInfo.cs:11
Definition: AttributeInfo.cs:23
short FileIndex
Definition: ARCNode.cs:902
string _name
Definition: ResourceNode.cs:139
ResourceNode RootNode
Definition: ResourceNode.cs:175
List< byte > EntryList
Definition: StageTableNode.cs:77
int NumEntries
The number of (four-byte) entries - i.e. the length in bytes divided by four.
Definition: StageTableNode.cs:25
Definition: PixelTypes.cs:327
byte R
Definition: PixelTypes.cs:330
override string ToString()
Definition: PixelTypes.cs:421
byte G
Definition: PixelTypes.cs:330
byte A
Definition: PixelTypes.cs:330
byte B
Definition: PixelTypes.cs:330

◆ GetBytes()

string BrawlLib.SSBB.ResourceNodes.StageTableNode.GetBytes ( int  index)
inline

Implements BrawlLib.SSBB.ResourceNodes.IAttributeList.

218 {
219 string bytes = "";
220 for (int curIndex = index * 4 + 3; curIndex >= index * 4; curIndex--)
221 {
222 bytes += EntryList[curIndex] + ", ";
223 }
224
225 return bytes.TrimEnd(' ', ',');
226 }

◆ GetDegrees()

float BrawlLib.SSBB.ResourceNodes.StageTableNode.GetDegrees ( int  index)
inline

Implements BrawlLib.SSBB.ResourceNodes.IAttributeList.

113 {
114 return BitConverter.ToSingle(EntryList.ToArray(), index * 4) * Maths._rad2degf;
115 }

◆ GetFloat()

float BrawlLib.SSBB.ResourceNodes.StageTableNode.GetFloat ( int  index)
inline

Implements BrawlLib.SSBB.ResourceNodes.IAttributeList.

94 {
95 return BitConverter.ToSingle(EntryList.ToArray(), index * 4);
96 }

◆ GetHex()

string BrawlLib.SSBB.ResourceNodes.StageTableNode.GetHex ( int  index)
inline

Implements BrawlLib.SSBB.ResourceNodes.IAttributeList.

192 {
193 string hex = "0x";
194 for (int curIndex = index * 4 + 3; curIndex >= index * 4; curIndex--)
195 {
196 hex += EntryList[curIndex].ToString("X2");
197 }
198
199 return hex;
200 }

◆ GetInt()

int BrawlLib.SSBB.ResourceNodes.StageTableNode.GetInt ( int  index)
inline

Implements BrawlLib.SSBB.ResourceNodes.IAttributeList.

132 {
133 return BitConverter.ToInt32(EntryList.ToArray(), index * 4);
134 }

◆ GetPossibleInterpretations()

IEnumerable< AttributeInterpretation > BrawlLib.SSBB.ResourceNodes.StageTableNode.GetPossibleInterpretations ( )
inline

Implements BrawlLib.SSBB.ResourceNodes.MultipleInterpretationIAttributeList.

249 {
250 ReadConfig();
251 ResourceNode root = this;
252 while (root.Parent != null)
253 {
254 root = root.Parent;
255 }
256
257 IEnumerable<AttributeInterpretation> q = from f in Formats
258 where NumEntries == f.NumEntries
259 select f;
260
261 bool any_match_name = q.Any(f => string.Equals(
262 Path.GetFileNameWithoutExtension(f.Filename),
263 root.Name.ToUpper().Replace("STG", "") + "[" + FileIndex + "]",
264 StringComparison.OrdinalIgnoreCase));
265 if (!any_match_name)
266 {
267 q = q.Concat(new[] {GenerateDefaultInterpretation()});
268 }
269
270 q = q.OrderBy(f => !string.Equals(
271 Path.GetFileNameWithoutExtension(f.Filename),
272 root.Name.ToUpper().Replace("STG", "") + "[" + FileIndex + "]",
273 StringComparison.OrdinalIgnoreCase));
274
275 return q;
276 }
static readonly List< AttributeInterpretation > Formats
Definition: StageTableNode.cs:351
virtual void ReadConfig()
Definition: StageTableNode.cs:354
virtual AttributeInterpretation GenerateDefaultInterpretation()
Definition: StageTableNode.cs:278

◆ GetRGBAPixel()

RGBAPixel BrawlLib.SSBB.ResourceNodes.StageTableNode.GetRGBAPixel ( int  index)
inline

Implements BrawlLib.SSBB.ResourceNodes.IAttributeList.

179 {
180 return BitConverter.ToUInt32(EntryList.ToArray(), index * 4); //((RGBAPixel*) AttributeAddress)[index];
181 }

◆ GetShorts()

string BrawlLib.SSBB.ResourceNodes.StageTableNode.GetShorts ( int  index)
inline

Implements BrawlLib.SSBB.ResourceNodes.IAttributeList.

243 {
244 return
245 $"{BitConverter.ToInt16(EntryList.ToArray(), index * 4 + 2)}, {BitConverter.ToInt16(EntryList.ToArray(), index * 4)}";
246 }

◆ OnCalculateSize()

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

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

73 {
74 return EntryOffset + EntryList.Count;
75 }

◆ ReadConfig()

virtual void BrawlLib.SSBB.ResourceNodes.StageTableNode.ReadConfig ( )
inlineprotectedvirtual
355 {
356#if DEBUG
357 string startPath =
358 Path.Combine(new DirectoryInfo(Application.StartupPath).Parent.Parent.Parent.Parent.Parent.FullName,
359 "BrawlLib");
360#else
361 string startPath = Application.StartupPath;
362#endif
363 if (Directory.Exists(startPath + "\\InternalDocumentation"))
364 {
365 if (Directory.Exists(startPath + "\\InternalDocumentation\\" +
366 DocumentationSubDirectory))
367 {
368 foreach (string path in Directory.EnumerateFiles(
369 startPath + "\\InternalDocumentation\\" + DocumentationSubDirectory,
370 "*.txt"))
371 {
372 if (ConfigPathsRead.Contains(path))
373 {
374 continue;
375 }
376
377 ConfigPathsRead.Add(path);
378 try
379 {
380 Formats.Add(new AttributeInterpretation(path, EntryOffset));
381 }
382 catch (FormatException ex)
383 {
384 if (Properties.Settings.Default.HideMDL0Errors)
385 {
386 Console.Error.WriteLine(ex.Message);
387 }
388 else
389 {
390 MessageBox.Show(ex.Message);
391 }
392 }
393 }
394 }
395 }
396 }
static readonly HashSet< string > ConfigPathsRead
Definition: StageTableNode.cs:352

◆ Replace()

override void BrawlLib.SSBB.ResourceNodes.StageTableNode.Replace ( string  fileName)
inlinevirtual

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

399 {
400 EntryList.Clear();
401 base.Replace(fileName);
402 }

◆ SetBytes()

void BrawlLib.SSBB.ResourceNodes.StageTableNode.SetBytes ( int  index,
params byte[]  values 
)
inline

Implements BrawlLib.SSBB.ResourceNodes.IAttributeList.

203 {
204 if (values.Length < 4)
205 {
206 return;
207 }
208
209 int i = 0;
210 for (int curIndex = index * 4 + 3; curIndex >= index * 4; curIndex--, i++)
211 {
212 EntryList[curIndex] = values[i];
213 }
215 }

◆ SetDegrees()

void BrawlLib.SSBB.ResourceNodes.StageTableNode.SetDegrees ( int  index,
float  value 
)
inline

Implements BrawlLib.SSBB.ResourceNodes.IAttributeList.

99 {
100 float oldValue = BitConverter.ToSingle(EntryList.ToArray(), index * 4);
101 if (oldValue != value * Maths._deg2radf)
102 {
103 byte[] newValue = BitConverter.GetBytes(value * Maths._deg2radf);
104 EntryList[index * 4] = newValue[0];
105 EntryList[index * 4 + 1] = newValue[1];
106 EntryList[index * 4 + 2] = newValue[2];
107 EntryList[index * 4 + 3] = newValue[3];
109 }
110 }

◆ SetFloat()

void BrawlLib.SSBB.ResourceNodes.StageTableNode.SetFloat ( int  index,
float  value 
)
inline

Implements BrawlLib.SSBB.ResourceNodes.IAttributeList.

80 {
81 float oldValue = BitConverter.ToSingle(EntryList.ToArray(), index * 4);
82 if (oldValue != value)
83 {
84 byte[] newValue = BitConverter.GetBytes(value);
85 EntryList[index * 4] = newValue[0];
86 EntryList[index * 4 + 1] = newValue[1];
87 EntryList[index * 4 + 2] = newValue[2];
88 EntryList[index * 4 + 3] = newValue[3];
90 }
91 }

◆ SetHex()

void BrawlLib.SSBB.ResourceNodes.StageTableNode.SetHex ( int  index,
string  value 
)
inline

Implements BrawlLib.SSBB.ResourceNodes.IAttributeList.

184 {
185 string field0 = (value ?? "").Split(' ')[0];
186 int fromBase = field0.StartsWith("0x", StringComparison.OrdinalIgnoreCase) ? 16 : 10;
187 int temp = Convert.ToInt32(field0, fromBase);
188 SetInt(index, temp);
189 }
void SetInt(int index, int value)
Definition: StageTableNode.cs:117

◆ SetInt()

void BrawlLib.SSBB.ResourceNodes.StageTableNode.SetInt ( int  index,
int  value 
)
inline

Implements BrawlLib.SSBB.ResourceNodes.IAttributeList.

118 {
119 int oldValue = BitConverter.ToInt32(EntryList.ToArray(), index * 4);
120 if (oldValue != value)
121 {
122 byte[] newValue = BitConverter.GetBytes(value);
123 EntryList[index * 4] = newValue[0];
124 EntryList[index * 4 + 1] = newValue[1];
125 EntryList[index * 4 + 2] = newValue[2];
126 EntryList[index * 4 + 3] = newValue[3];
128 }
129 }

◆ SetRGBAPixel() [1/2]

void BrawlLib.SSBB.ResourceNodes.StageTableNode.SetRGBAPixel ( int  index,
RGBAPixel  value 
)
inline

Implements BrawlLib.SSBB.ResourceNodes.IAttributeList.

164 {
165 RGBAPixel pOld = BitConverter.ToUInt32(EntryList.ToArray(), index * 4);
166
167 if (pOld != value)
168 {
169 byte[] newValue = BitConverter.GetBytes(value);
170 EntryList[index * 4] = newValue[3];
171 EntryList[index * 4 + 1] = newValue[2];
172 EntryList[index * 4 + 2] = newValue[1];
173 EntryList[index * 4 + 3] = newValue[0];
175 }
176 }

◆ SetRGBAPixel() [2/2]

void BrawlLib.SSBB.ResourceNodes.StageTableNode.SetRGBAPixel ( int  index,
string  value 
)
inline

Implements BrawlLib.SSBB.ResourceNodes.IAttributeList.

137 {
138 RGBAPixel p = new RGBAPixel();
139 RGBAPixel pOld = BitConverter.ToUInt32(EntryList.ToArray(), index * 4);
140
141 char[] delims = {',', 'R', 'G', 'B', 'A', ':', ' '};
142 string[] arr = value.Split(delims, StringSplitOptions.RemoveEmptyEntries);
143
144 if (arr.Length == 4)
145 {
146 byte.TryParse(arr[0], out p.R);
147 byte.TryParse(arr[1], out p.G);
148 byte.TryParse(arr[2], out p.B);
149 byte.TryParse(arr[3], out p.A);
150 }
151
152 if (pOld != p)
153 {
154 byte[] newValue = BitConverter.GetBytes(p);
155 EntryList[index * 4] = newValue[3];
156 EntryList[index * 4 + 1] = newValue[2];
157 EntryList[index * 4 + 2] = newValue[1];
158 EntryList[index * 4 + 3] = newValue[0];
160 }
161 }

◆ SetShorts()

void BrawlLib.SSBB.ResourceNodes.StageTableNode.SetShorts ( int  index,
short  value1,
short  value2 
)
inline

Implements BrawlLib.SSBB.ResourceNodes.IAttributeList.

229 {
230 if (!GetShorts(index).Equals($"{value1}, {value2}"))
231 {
232 byte[] newValue = BitConverter.GetBytes(value2);
233 EntryList[index * 4] = newValue[0];
234 EntryList[index * 4 + 1] = newValue[1];
235 newValue = BitConverter.GetBytes(value1);
236 EntryList[index * 4 + 2] = newValue[0];
237 EntryList[index * 4 + 3] = newValue[1];
239 }
240 }
string GetShorts(int index)
Definition: StageTableNode.cs:242

Member Data Documentation

◆ ConfigPathsRead

readonly HashSet<string> BrawlLib.SSBB.ResourceNodes.StageTableNode.ConfigPathsRead = new HashSet<string>()
staticprotected

◆ EntryList

List<byte> BrawlLib.SSBB.ResourceNodes.StageTableNode.EntryList = new List<byte>()

◆ Formats

readonly List<AttributeInterpretation> BrawlLib.SSBB.ResourceNodes.StageTableNode.Formats = new List<AttributeInterpretation>()
staticprotected

Property Documentation

◆ NumEntries

int BrawlLib.SSBB.ResourceNodes.StageTableNode.NumEntries
get

The number of (four-byte) entries - i.e. the length in bytes divided by four.

Implements BrawlLib.SSBB.ResourceNodes.IAttributeList.

◆ Unknown0

virtual int BrawlLib.SSBB.ResourceNodes.StageTableNode.Unknown0
getset
29 {
30 get => unk0;
31 set
32 {
33 unk0 = value;
35 }
36 }

◆ Unknown1

virtual int BrawlLib.SSBB.ResourceNodes.StageTableNode.Unknown1
getset
40 {
41 get => unk1;
42 set
43 {
44 unk1 = value;
46 }
47 }

◆ Unknown2

virtual int BrawlLib.SSBB.ResourceNodes.StageTableNode.Unknown2
getset
51 {
52 get => unk2;
53 set
54 {
55 unk2 = value;
57 }
58 }

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