BrawlCrate v0.41
Wii File Editor
Loading...
Searching...
No Matches
Public Member Functions | Static Protected Member Functions | Properties | List of all members
BrawlCrate.NodeWrappers.TEX0Wrapper Class Reference
Inheritance diagram for BrawlCrate.NodeWrappers.TEX0Wrapper:
BrawlCrate.NodeWrappers.GenericWrapper BrawlCrate.NodeWrappers.BaseWrapper BrawlCrate.NodeWrappers.MultiSelectableWrapper

Public Member Functions

 TEX0Wrapper ()
 
override void OnReplace (string inStream)
 
void ReEncode ()
 
PAT0Node GeneratePAT0 (bool force)
 
void ConvertStocks ()
 
void ConvertToStock50 ()
 
void ConvertToStockDefault ()
 
- Public Member Functions inherited from BrawlCrate.NodeWrappers.GenericWrapper
 GenericWrapper (IWin32Window owner)
 
 GenericWrapper ()
 
virtual void Sort ()
 
void MoveUp ()
 
virtual void MoveUp (bool select)
 
void MoveDown ()
 
virtual void MoveDown (bool select)
 
void DeleteSelected ()
 
void ExportSelected ()
 
virtual string Export ()
 
virtual void OnExport (string outPath)
 
virtual void Replace ()
 
virtual void OnReplace (string inStream)
 
void Restore ()
 
virtual void Delete ()
 
void Rename ()
 
virtual ResourceNode Duplicate ()
 
virtual ResourceNode Duplicate (bool changeName)
 
- Public Member Functions inherited from BrawlCrate.NodeWrappers.BaseWrapper
void Link (ResourceNode res)
 
void Unlink ()
 

Static Protected Member Functions

static void ReEncodeAction (object sender, EventArgs e)
 
static void GeneratePAT0Action (object sender, EventArgs e)
 
static void ConvertStockAction (object sender, EventArgs e)
 
- Static Protected Member Functions inherited from BrawlCrate.NodeWrappers.GenericWrapper
static void MoveUpAction (object sender, EventArgs e)
 
static void MoveDownAction (object sender, EventArgs e)
 
static void ExportAction (object sender, EventArgs e)
 
static void ExportSelectedAction (object sender, EventArgs e)
 
static void DeleteSelectedAction (object sender, EventArgs e)
 
static void DuplicateAction (object sender, EventArgs e)
 
static void ReplaceAction (object sender, EventArgs e)
 
static void RestoreAction (object sender, EventArgs e)
 
static void DeleteAction (object sender, EventArgs e)
 
static void RenameAction (object sender, EventArgs e)
 
static void SortAction (object sender, EventArgs e)
 
- Static Protected Member Functions inherited from BrawlCrate.NodeWrappers.BaseWrapper
static T GetInstance< T > ()
 
static IEnumerable< T > GetInstances< T > ()
 

Properties

override ContextMenuStrip MultiSelectMenuStrip [get]
 
override string ExportFilter [get]
 
- Properties inherited from BrawlCrate.NodeWrappers.GenericWrapper
virtual ContextMenuStrip MultiSelectMenuStrip [get]
 
virtual string DefaultName [get]
 
virtual string ExportFilter [get]
 
virtual string ImportFilter [get]
 
virtual string ReplaceFilter [get]
 
- Properties inherited from BrawlCrate.NodeWrappers.BaseWrapper
ResourceNode Resource [get]
 
virtual ? Color DefaultBackColor [get]
 
virtual ? Color DefaultForeColor [get]
 
- Properties inherited from BrawlCrate.NodeWrappers.MultiSelectableWrapper
ContextMenuStrip MultiSelectMenuStrip [get]
 

Additional Inherited Members

- Static Public Member Functions inherited from BrawlCrate.NodeWrappers.BaseWrapper
static BaseWrapper[] GetAllNodes (BaseWrapper root)
 
static BaseWrapper Wrap (ResourceNode node)
 
static BaseWrapper Wrap (IWin32Window owner, ResourceNode node)
 
- Static Public Attributes inherited from BrawlCrate.NodeWrappers.BaseWrapper
static IWin32Window _owner
 
- Protected Member Functions inherited from BrawlCrate.NodeWrappers.BaseWrapper
 BaseWrapper ()
 
- Protected Attributes inherited from BrawlCrate.NodeWrappers.BaseWrapper
bool _discovered
 
ResourceNode _resource
 
- Static Protected Attributes inherited from BrawlCrate.NodeWrappers.BaseWrapper
static readonly ContextMenuStrip _emptyMenu = new ContextMenuStrip()
 

Constructor & Destructor Documentation

◆ TEX0Wrapper()

BrawlCrate.NodeWrappers.TEX0Wrapper.TEX0Wrapper ( )
inline
179 {
180 ContextMenuStrip = _menu;
181 }

Member Function Documentation

◆ ConvertStockAction()

static void BrawlCrate.NodeWrappers.TEX0Wrapper.ConvertStockAction ( object  sender,
EventArgs  e 
)
inlinestaticprotected
170 {
171 GetInstance<TEX0Wrapper>().ConvertStocks();
172 }

◆ ConvertStocks()

void BrawlCrate.NodeWrappers.TEX0Wrapper.ConvertStocks ( )
inline
244 {
245 if (Parent == null)
246 {
247 return;
248 }
249
252 {
253 // Check if this is part of a sequence
254 if (Regex.Match(_resource.Name, @"(\.\d+)?$").Success && _resource.Name.LastIndexOf(".") > 0 &&
255 _resource.Name.LastIndexOf(".") <= _resource.Name.Length && int.TryParse(
256 _resource.Name.Substring(_resource.Name.LastIndexOf(".") + 1,
257 _resource.Name.Length - (_resource.Name.LastIndexOf(".") + 1)), out int n))
258 {
259 if (_resource.Name.Substring(_resource.Name.LastIndexOf(".") + 1,
260 _resource.Name.Length - (_resource.Name.LastIndexOf(".") + 1)).Length == 3)
261 {
263 return;
264 }
265
266 if (_resource.Name.Substring(_resource.Name.LastIndexOf(".") + 1,
267 _resource.Name.Length - (_resource.Name.LastIndexOf(".") + 1)).Length == 4)
268 {
270 return;
271 }
272 }
273 }
274 }
ResourceNode _resource
Definition: BaseWrapper.cs:76
void ConvertToStockDefault()
Definition: TEX0Wrapper.cs:517
void ConvertToStock50()
Definition: TEX0Wrapper.cs:276
Definition: BRRESNode.cs:777
Definition: BRRESNode.cs:19
ResourceNode Parent
Definition: ResourceNode.cs:245
virtual string Name
Definition: ResourceNode.cs:223

◆ ConvertToStock50()

void BrawlCrate.NodeWrappers.TEX0Wrapper.ConvertToStock50 ( )
inline
277 {
278 string matchName = _resource.Name.Substring(0, _resource.Name.LastIndexOf(".")) + ".";
279 string matchNameX = _resource.Name.Substring(0, _resource.Name.LastIndexOf(".")) + "X.";
280 List<TEX0Node> texList = new List<TEX0Node>();
281 for (int i = _resource.Parent.Children.Count - 1; i >= 0; i--)
282 {
283 if (!(_resource.Parent.Children[i] is TEX0Node))
284 {
285 continue;
286 }
287
289 if (tx0.Name.StartsWith(matchName) && tx0.Name.LastIndexOf(".") > 0 &&
290 tx0.Name.LastIndexOf(".") < tx0.Name.Length &&
291 int.TryParse(
292 tx0.Name.Substring(tx0.Name.LastIndexOf(".") + 1,
293 tx0.Name.Length - (tx0.Name.LastIndexOf(".") + 1)), out int x) && x >= 0)
294 {
295 if (x <= 0) // 0 edge case
296 {
297 tx0.texSortNum = 0;
298 }
299 else if (x == 475) // WarioMan edge case (should pre-program)
300 {
301 tx0.texSortNum = 9001 + x % 475;
302 }
303 else
304 {
305 tx0.texSortNum = (int) Math.Floor(((double) x - 1) / 10.0) * 50 + x % 10;
306
307 if (x % 10 == 0)
308 {
309 tx0.texSortNum += 10;
310 }
311
312 if (x >= 201 && x <= 205 || // Ganon Edge Case
313 x >= 351 && x <= 355 || // ROB Edge Case
314 x >= 381 && x <= 384 || // Wario Edge Case
315 x >= 411 && x <= 415 || // Toon Link Edge Case
316 x >= 471 && x <= 474) // Sonic Edge Case
317 {
318 tx0.texSortNum -= 40;
319 }
320 }
321
322 if (tx0.HasPalette)
323 {
324 tx0.GetPaletteNode().Name = "InfStc." + tx0.texSortNum.ToString("0000");
325 }
326
327 tx0.Name = "InfStc." + tx0.texSortNum.ToString("0000");
328 if (((BRRESNode) _resource.Parent?.Parent)?.GetFolder<PLT0Node>() != null &&
329 ((BRRESNode) _resource.Parent.Parent).GetFolder<PLT0Node>()
330 .FindChildrenByName("InfStc." + x.ToString("000")).Any())
331 {
332 foreach (PLT0Node p in ((BRRESNode) _resource.Parent.Parent).GetFolder<PLT0Node>()
334 "InfStc." + x.ToString("000")))
335 {
336 p.Remove();
337 }
338 }
339 }
340 else if (tx0.Name.StartsWith(matchNameX) && tx0.Name.LastIndexOf(".") > 0 &&
341 tx0.Name.LastIndexOf(".") < tx0.Name.Length &&
342 int.TryParse(
343 tx0.Name.Substring(tx0.Name.LastIndexOf(".") + 1,
344 tx0.Name.Length - (tx0.Name.LastIndexOf(".") + 1)), out int x2) && x2 >= 0)
345 {
346 if (tx0.HasPalette)
347 {
348 tx0.GetPaletteNode().Name = "InfStc." + x2.ToString("0000");
349 }
350
351 tx0.Name = "InfStc." + x2.ToString("0000");
352 if (((BRRESNode) _resource.Parent.Parent).GetFolder<PLT0Node>()
353 .FindChildrenByName("InfStcX." + x2.ToString("0000"))
354 .Count() > 0)
355 {
356 foreach (PLT0Node p in ((BRRESNode) _resource.Parent.Parent).GetFolder<PLT0Node>()
358 "InfStcX." +
359 x2.ToString("0000")))
360 {
361 p.Remove();
362 }
363 }
364 }
365 }
366
367 PAT0Node newPat0 = GeneratePAT0(true);
368 if (((BRRESNode) _resource.Parent.Parent).GetFolder<CHR0Node>() != null)
369 {
370 ResourceNode[] temp = ((BRRESNode) _resource.Parent.Parent).GetFolder<CHR0Node>()
371 .FindChildrenByName(newPat0.Name);
372 if (temp.Length > 0)
373 {
374 foreach (CHR0Node cn in temp)
375 {
376 cn.FrameCount = newPat0.FrameCount;
377 }
378 }
379 }
380
381 if (((BRRESNode) _resource.Parent.Parent).GetFolder<CLR0Node>() != null)
382 {
383 ResourceNode[] temp = ((BRRESNode) _resource.Parent.Parent).GetFolder<CLR0Node>()
384 .FindChildrenByName(newPat0.Name);
385 if (temp.Length > 0)
386 {
387 foreach (CLR0Node cn in temp)
388 {
389 cn.FrameCount = newPat0.FrameCount;
390 }
391 }
392 }
393
394 if (MessageBox.Show(
395 "Would you like to convert the InfFace portraits to the new system as well at this time?",
396 "Convert InfFace?", MessageBoxButtons.YesNo) == DialogResult.Yes)
397 {
398 string infFaceFolder = "";
399 bool autoFoundFolder = false;
400 if (Program.RootPath.EndsWith("\\info2\\info.pac", StringComparison.OrdinalIgnoreCase))
401 {
402 string autoFolder =
403 Program.RootPath.Substring(0, Program.RootPath.LastIndexOf("\\info2\\info.pac")) +
404 "\\info\\portrite";
405 if (Directory.Exists(autoFolder))
406 {
407 if (MessageBox.Show(
408 "The folder for InfFace was autodetected to be: \n" + autoFolder +
409 "\n\nIs this correct?", "InfFace Converter", MessageBoxButtons.YesNo) ==
410 DialogResult.Yes)
411 {
412 infFaceFolder = autoFolder;
413 autoFoundFolder = true;
414 }
415 }
416 }
417
418 if (!autoFoundFolder)
419 {
420 FolderBrowserDialog f = new FolderBrowserDialog
421 {
422 Description = "Select the \"portrite\" folder"
423 };
424 DialogResult dr = f.ShowDialog();
425 infFaceFolder = f.SelectedPath;
426 if (dr != DialogResult.OK || infFaceFolder == null || infFaceFolder == "")
427 {
428 return;
429 }
430 }
431
432 try
433 {
434 DirectoryInfo d = Directory.CreateDirectory(infFaceFolder);
435 DirectoryInfo d2 = Directory.CreateDirectory(infFaceFolder + '\\' + "temp");
436 Console.WriteLine(infFaceFolder);
437 int count = 0;
438 foreach (FileInfo infFace in d.GetFiles())
439 {
440 Console.WriteLine(infFaceFolder + '\\' + infFace.Name);
441 int properlength = infFace.Name.EndsWith(".brres", StringComparison.OrdinalIgnoreCase)
442 ? infFace.Name.Length - ".brres".Length
443 : infFace.Name.Length;
444 Console.WriteLine(infFace.Name.Substring(7, properlength - 7));
445 if (infFace.Name.StartsWith("InfFaceX") &&
446 infFace.Name.EndsWith(".brres", StringComparison.CurrentCultureIgnoreCase) &&
447 int.TryParse(infFace.Name.Substring(8, properlength - 8), out int x2) && x2 >= 0)
448 {
449 infFace.MoveTo(infFaceFolder + '\\' + "temp" + '\\' + "InfFace" + x2.ToString("0000") +
450 ".brres");
451 count++;
452 }
453 else if (!infFace.Name.StartsWith("InfFaceX") && infFace.Name.StartsWith("InfFace") &&
454 infFace.Name.EndsWith(".brres", StringComparison.CurrentCultureIgnoreCase) &&
455 int.TryParse(infFace.Name.Substring(7, properlength - 7), out int x) && x >= 0)
456 {
457 int n = x;
458 if (x <= 0) // 0 edge case
459 {
460 n = 0;
461 }
462 else if (x >= 661 && x <= 674) // WarioMan edge case (should pre-program)
463 {
464 n = 9001 + x % 661;
465 }
466 else
467 {
468 n = (int) Math.Floor(((double) x - 1) / 10.0) * 50 + x % 10;
469
470 if (x % 10 == 0)
471 {
472 n += 10;
473 }
474
475 if (x >= 201 && x <= 205 || // Ganon Edge Case
476 x >= 351 && x <= 355 || // ROB Edge Case
477 x >= 381 && x <= 384 || // Wario Edge Case
478 x >= 411 && x <= 415 || // Toon Link Edge Case
479 x >= 471 && x <= 474) // Sonic Edge Case
480 {
481 n -= 40;
482 }
483 }
484
485 infFace.MoveTo(infFaceFolder + '\\' + "temp" + '\\' + "InfFace" + n.ToString("0000") +
486 ".brres");
487 count++;
488 }
489 }
490
491 foreach (FileInfo infFace in d2.GetFiles())
492 {
493 infFace.MoveTo(infFaceFolder + '\\' + infFace.Name +
494 (infFace.Name.EndsWith(".brres", StringComparison.OrdinalIgnoreCase)
495 ? ""
496 : ".brres"));
497 }
498
499 d2.Delete();
500 if (count > 0)
501 {
502 MessageBox.Show("InfFace conversion successful!");
503 }
504 else
505 {
506 MessageBox.Show("No convertable InfFace portraits found in " + infFaceFolder);
507 }
508 }
509 catch (Exception e)
510 {
511 MessageBox.Show(e.Message);
512 return;
513 }
514 }
515 }
PAT0Node GeneratePAT0(bool force)
Definition: TEX0Wrapper.cs:227
Definition: CHR0Node.cs:17
Definition: CLR0Node.cs:14
Definition: PAT0Node.cs:16
override int FrameCount
Definition: PAT0Node.cs:36
Definition: PLT0Node.cs:12
Definition: ResourceNode.cs:129
virtual void Remove()
Definition: ResourceNode.cs:741
ResourceNode[] FindChildrenByName(string name)
Definition: ResourceNode.cs:1558
List< ResourceNode > Children
Definition: ResourceNode.cs:262
Definition: TEX0Node.cs:22
bool HasPalette
Definition: TEX0Node.cs:106
PLT0Node GetPaletteNode()
Definition: TEX0Node.cs:108
int texSortNum
Definition: TEX0Node.cs:43
override string Name
Definition: TEX0Node.cs:206

◆ ConvertToStockDefault()

void BrawlCrate.NodeWrappers.TEX0Wrapper.ConvertToStockDefault ( )
inline
518 {
519 string matchName = _resource.Name.Substring(0, _resource.Name.LastIndexOf(".")) + ".";
520 string matchNameX = _resource.Name.Substring(0, _resource.Name.LastIndexOf(".")) + "X.";
521 List<TEX0Node> texList = new List<TEX0Node>();
522 for (int i = 0; i < _resource.Parent.Children.Count; i++)
523 {
524 if (!(_resource.Parent.Children[i] is TEX0Node))
525 {
526 continue;
527 }
528
530 if (tx0.Name.StartsWith(matchName) && tx0.Name.LastIndexOf(".") > 0 &&
531 tx0.Name.LastIndexOf(".") < tx0.Name.Length &&
532 int.TryParse(
533 tx0.Name.Substring(tx0.Name.LastIndexOf(".") + 1,
534 tx0.Name.Length - (tx0.Name.LastIndexOf(".") + 1)), out int x) && x >= 0)
535 {
536 tx0.texSortNum = x;
537 if (x <= 0) // 0 edge case
538 {
539 tx0.texSortNum = 0;
540 if (tx0.HasPalette)
541 {
542 tx0.GetPaletteNode().Name = "InfStc." + tx0.texSortNum.ToString("000");
543 }
544
545 tx0.Name = "InfStc." + tx0.texSortNum.ToString("000");
546 if (((BRRESNode) _resource.Parent.Parent).GetFolder<PLT0Node>()
547 .FindChildrenByName("InfStc." + x.ToString("0000"))
548 .Count() > 0)
549 {
550 foreach (PLT0Node p in ((BRRESNode) _resource.Parent.Parent).GetFolder<PLT0Node>()
552 "InfStc." + x.ToString(
553 "0000")))
554 {
555 p.Remove();
556 }
557 }
558 }
559 else if (x == 9001) // WarioMan edge case (should pre-program)
560 {
561 tx0.texSortNum = 475 + x % 9001;
562 if (tx0.HasPalette)
563 {
564 tx0.GetPaletteNode().Name = "InfStc." + tx0.texSortNum.ToString("000");
565 }
566
567 tx0.Name = "InfStc." + tx0.texSortNum.ToString("000");
568 if (((BRRESNode) _resource.Parent.Parent).GetFolder<PLT0Node>()
569 .FindChildrenByName("InfStc." + x.ToString("0000"))
570 .Count() > 0)
571 {
572 foreach (PLT0Node p in ((BRRESNode) _resource.Parent.Parent).GetFolder<PLT0Node>()
574 "InfStc." + x.ToString(
575 "0000")))
576 {
577 p.Remove();
578 }
579 }
580 }
581 else if (x % 50 <= 10 && x % 50 != 0 ||
582 x >= 0961 && x <= 0965 || // Ganon Edge Case
583 x >= 1711 && x <= 1715 || // ROB Edge Case
584 x >= 1861 && x <= 1864 || // Wario Edge Case
585 x >= 2011 && x <= 2015 || // Toon Link Edge Case
586 x >= 2311 && x <= 2314) // Sonic Edge Case
587 {
588 tx0.texSortNum = (int) Math.Floor(((double) x + 1) / 50.0) * 10 + x % 10;
589
590 if (x % 10 == 0 ||
591 x >= 0961 && x <= 0965 || // Ganon Edge Case
592 x >= 1711 && x <= 1715 || // ROB Edge Case
593 x >= 1861 && x <= 1864 || // Wario Edge Case
594 x >= 2011 && x <= 2015 || // Toon Link Edge Case
595 x >= 2311 && x <= 2314) // Sonic Edge Case
596 {
597 tx0.texSortNum += 10;
598 }
599
600 if (tx0.HasPalette)
601 {
602 tx0.GetPaletteNode().Name = "InfStc." + tx0.texSortNum.ToString("000");
603 }
604
605 tx0.Name = "InfStc." + tx0.texSortNum.ToString("000");
606 if (((BRRESNode) _resource.Parent.Parent).GetFolder<PLT0Node>()
607 .FindChildrenByName("InfStc." + x.ToString("0000"))
608 .Count() > 0)
609 {
610 foreach (PLT0Node p in ((BRRESNode) _resource.Parent.Parent).GetFolder<PLT0Node>()
612 "InfStc." + x.ToString(
613 "0000")))
614 {
615 p.Remove();
616 }
617 }
618 }
619 else
620 {
621 if (tx0.HasPalette)
622 {
623 tx0.GetPaletteNode().Name = "InfStcX." + tx0.texSortNum.ToString("0000");
624 }
625
626 tx0.Name = "InfStcX." + tx0.texSortNum.ToString("0000");
627 if (((BRRESNode) _resource.Parent.Parent).GetFolder<PLT0Node>()
628 .FindChildrenByName("InfStc." + x.ToString("0000"))
629 .Count() > 0)
630 {
631 foreach (PLT0Node p in ((BRRESNode) _resource.Parent.Parent).GetFolder<PLT0Node>()
633 "InfStc." + x.ToString(
634 "0000")))
635 {
636 p.Remove();
637 }
638 }
639 }
640 }
641 }
642
643 PAT0Node newPat0 = GeneratePAT0(true);
644 if (((BRRESNode) _resource.Parent.Parent).GetFolder<CHR0Node>() != null)
645 {
646 ResourceNode[] temp = ((BRRESNode) _resource.Parent.Parent).GetFolder<CHR0Node>()
647 .FindChildrenByName(newPat0.Name);
648 if (temp.Length > 0)
649 {
650 foreach (CHR0Node cn in temp)
651 {
652 cn.FrameCount = newPat0.FrameCount;
653 }
654 }
655 }
656
657 if (((BRRESNode) _resource.Parent.Parent).GetFolder<CLR0Node>() != null)
658 {
659 ResourceNode[] temp = ((BRRESNode) _resource.Parent.Parent).GetFolder<CLR0Node>()
660 .FindChildrenByName(newPat0.Name);
661 if (temp.Length > 0)
662 {
663 foreach (CLR0Node cn in temp)
664 {
665 cn.FrameCount = newPat0.FrameCount;
666 }
667 }
668 }
669
670 if (MessageBox.Show(
671 "Would you like to convert the InfFace portraits to the new system as well at this time?",
672 "Convert InfFace?", MessageBoxButtons.YesNo) == DialogResult.Yes)
673 {
674 string infFaceFolder = "";
675 bool autoFoundFolder = false;
676 if (Program.RootPath.EndsWith("\\info2\\info.pac", StringComparison.OrdinalIgnoreCase))
677 {
678 string autoFolder =
679 Program.RootPath.Substring(0, Program.RootPath.LastIndexOf("\\info2\\info.pac")) +
680 "\\info\\portrite";
681 if (Directory.Exists(autoFolder))
682 {
683 if (MessageBox.Show(
684 "The folder for InfFace was autodetected to be: \n" + autoFolder +
685 "\n\nIs this correct?", "InfFace Converter", MessageBoxButtons.YesNo) ==
686 DialogResult.Yes)
687 {
688 infFaceFolder = autoFolder;
689 autoFoundFolder = true;
690 }
691 }
692 }
693
694 if (!autoFoundFolder)
695 {
696 FolderBrowserDialog f = new FolderBrowserDialog
697 {
698 Description = "Select the \"portrite\" folder"
699 };
700 DialogResult dr = f.ShowDialog();
701 infFaceFolder = f.SelectedPath;
702 if (dr != DialogResult.OK || infFaceFolder == null || infFaceFolder == "")
703 {
704 return;
705 }
706 }
707
708 try
709 {
710 DirectoryInfo d = Directory.CreateDirectory(infFaceFolder);
711 DirectoryInfo d2 = Directory.CreateDirectory(infFaceFolder + '\\' + "temp");
712 Console.WriteLine(infFaceFolder);
713 int count = 0;
714 foreach (FileInfo infFace in d.GetFiles().Reverse())
715 {
716 Console.WriteLine(infFaceFolder + '\\' + infFace.Name);
717 int properlength = infFace.Name.EndsWith(".brres", StringComparison.OrdinalIgnoreCase)
718 ? infFace.Name.Length - ".brres".Length
719 : infFace.Name.Length;
720
721 if (infFace.Name.StartsWith("InfFace") && !infFace.Name.StartsWith("InfFaceX") &&
722 infFace.Name.EndsWith(".brres", StringComparison.CurrentCultureIgnoreCase) &&
723 int.TryParse(infFace.Name.Substring(7, properlength - 7), out int x) && x >= 0)
724 {
725 int n = x;
726 if (x <= 0) // 0 edge case
727 {
728 n = 0;
729 infFace.MoveTo(infFaceFolder + '\\' + "temp" + '\\' + "InfFace" + n.ToString("000") +
730 ".brres");
731 }
732 else if (x >= 9001 && x <= 9014) // WarioMan edge case (should pre-program)
733 {
734 n = 661 + x % 9001;
735 infFace.MoveTo(infFaceFolder + '\\' + "temp" + '\\' + "InfFace" + n.ToString("000") +
736 ".brres");
737 }
738 else if (x % 50 <= 10 && x % 50 != 0 ||
739 x >= 0961 && x <= 0965 || // Ganon Edge Case
740 x >= 1711 && x <= 1715 || // ROB Edge Case
741 x >= 1861 && x <= 1864 || // Wario Edge Case
742 x >= 2011 && x <= 2015 || // Toon Link Edge Case
743 x >= 2311 && x <= 2314) // Sonic Edge Case
744 {
745 n = (int) Math.Floor(((double) x + 1) / 50.0) * 10 + x % 10;
746
747 if (x % 10 == 0 ||
748 x >= 0961 && x <= 0965 || // Ganon Edge Case
749 x >= 1711 && x <= 1715 || // ROB Edge Case
750 x >= 1861 && x <= 1864 || // Wario Edge Case
751 x >= 2011 && x <= 2015 || // Toon Link Edge Case
752 x >= 2311 && x <= 2314) // Sonic Edge Case
753 {
754 n += 10;
755 }
756
757 infFace.MoveTo(infFaceFolder + '\\' + "temp" + '\\' + "InfFace" + n.ToString("000") +
758 ".brres");
759 count++;
760 }
761 else
762 {
763 infFace.MoveTo(infFaceFolder + '\\' + "temp" + '\\' + "InfFaceX" + n.ToString("0000") +
764 ".brres");
765 count++;
766 }
767 }
768 }
769
770 foreach (FileInfo infFace in d2.GetFiles())
771 {
772 infFace.MoveTo(infFaceFolder + '\\' + infFace.Name +
773 (infFace.Name.EndsWith(".brres", StringComparison.OrdinalIgnoreCase)
774 ? ""
775 : ".brres"));
776 }
777
778 d2.Delete();
779 if (count > 0)
780 {
781 MessageBox.Show("InfFace conversion successful!");
782 }
783 else
784 {
785 MessageBox.Show("No convertable InfFace portraits found in " + infFaceFolder);
786 }
787 }
788 catch (Exception e)
789 {
790 MessageBox.Show(e.Message);
791 }
792 }
793 }

◆ GeneratePAT0()

PAT0Node BrawlCrate.NodeWrappers.TEX0Wrapper.GeneratePAT0 ( bool  force)
inline
228 {
229 if (Parent == null)
230 {
231 return null;
232 }
233
234 var newPat0 = ((TEX0Node) _resource).GeneratePAT0(force);
235 if (newPat0 != null && !force)
236 {
238 }
239
240 return newPat0;
241 }
Definition: MainForm.cs:34
void TargetResource(ResourceNode n)
Definition: MainForm.cs:521
static MainForm Instance
Definition: MainForm.cs:36

◆ GeneratePAT0Action()

static void BrawlCrate.NodeWrappers.TEX0Wrapper.GeneratePAT0Action ( object  sender,
EventArgs  e 
)
inlinestaticprotected
165 {
166 GetInstance<TEX0Wrapper>().GeneratePAT0(false);
167 }

◆ OnReplace()

override void BrawlCrate.NodeWrappers.TEX0Wrapper.OnReplace ( string  inStream)
inlinevirtual

Reimplemented from BrawlCrate.NodeWrappers.GenericWrapper.

186 {
187 if (inStream.EndsWith(".tex0", StringComparison.OrdinalIgnoreCase) || !inStream.Contains("."))
188 {
189 base.OnReplace(inStream);
190 }
191 else
192 {
194 {
195 dlg.ImageSource = inStream;
197 }
198 }
199 }
ResourceNode Resource
Definition: BaseWrapper.cs:77
Definition: TextureConverterDialog.cs:24
DialogResult ShowDialog(IWin32Window owner, BRRESNode parent)
Definition: TextureConverterDialog.cs:164

◆ ReEncode()

void BrawlCrate.NodeWrappers.TEX0Wrapper.ReEncode ( )
inline
202 {
203 PLT0Node plt = null;
204 if (((TEX0Node) _resource).HasPalette)
205 {
206 plt = ((TEX0Node) _resource).GetPaletteNode();
207 }
208
210 {
211 dlg.LoadImages((Resource as TEX0Node).GetImage(0));
213 }
214
215 if (plt != null && !((TEX0Node) _resource).HasPalette)
216 {
217 plt.Dispose();
218 plt.Remove();
219 }
220 }
bool LoadImages(string path)
Definition: TextureConverterDialog.cs:415
virtual void Dispose()
Definition: ResourceNode.cs:430

◆ ReEncodeAction()

static void BrawlCrate.NodeWrappers.TEX0Wrapper.ReEncodeAction ( object  sender,
EventArgs  e 
)
inlinestaticprotected
160 {
161 GetInstance<TEX0Wrapper>().ReEncode();
162 }

Property Documentation

◆ ExportFilter

override string BrawlCrate.NodeWrappers.TEX0Wrapper.ExportFilter
get

◆ MultiSelectMenuStrip

override ContextMenuStrip BrawlCrate.NodeWrappers.TEX0Wrapper.MultiSelectMenuStrip
get

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