CustomizeMii 2.1

This commit is contained in:
leathl 2010-01-18 20:13:32 +00:00
parent aa39aaaffd
commit f1f598c218
21 changed files with 771 additions and 509 deletions

View File

@ -36,8 +36,10 @@ namespace CustomizeMii
void bwBannerReplace_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) void bwBannerReplace_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{ {
pbProgress.Value = 100; currentProgress.progressValue = 100;
lbStatusText.Text = string.Empty; currentProgress.progressState = " ";
this.Invoke(ProgressUpdate);
SetText(tbReplace, BannerReplace); SetText(tbReplace, BannerReplace);
} }
@ -104,8 +106,10 @@ namespace CustomizeMii
void bwIconReplace_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) void bwIconReplace_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{ {
pbProgress.Value = 100; currentProgress.progressValue = 100;
lbStatusText.Text = string.Empty; currentProgress.progressState = " ";
this.Invoke(ProgressUpdate);
SetText(tbReplace, IconReplace); SetText(tbReplace, IconReplace);
} }
@ -172,8 +176,10 @@ namespace CustomizeMii
void bwSoundReplace_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) void bwSoundReplace_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{ {
pbProgress.Value = 100; currentProgress.progressValue = 100;
lbStatusText.Text = string.Empty; currentProgress.progressState = " ";
this.Invoke(ProgressUpdate);
SetText(tbReplace, SoundReplace); SetText(tbReplace, SoundReplace);
} }
@ -252,9 +258,11 @@ namespace CustomizeMii
if (File.Exists(TempWavePath)) File.Delete(TempWavePath); if (File.Exists(TempWavePath)) File.Delete(TempWavePath);
lbStatusText.Text = string.Empty;
Mp3Path = string.Empty; Mp3Path = string.Empty;
pbProgress.Value = 100; currentProgress.progressValue = 100;
currentProgress.progressState = " ";
this.Invoke(ProgressUpdate);
} }
void bwConvertToBns_ProgressChanged(object sender, ProgressChangedEventArgs e) void bwConvertToBns_ProgressChanged(object sender, ProgressChangedEventArgs e)
@ -371,9 +379,11 @@ namespace CustomizeMii
} }
} }
lbStatusText.Text = string.Empty;
Mp3Path = string.Empty; Mp3Path = string.Empty;
pbProgress.Value = 100; currentProgress.progressValue = 100;
currentProgress.progressState = " ";
this.Invoke(ProgressUpdate);
} }
void bwConvertMp3_ProgressChanged(object sender, ProgressChangedEventArgs e) void bwConvertMp3_ProgressChanged(object sender, ProgressChangedEventArgs e)
@ -435,8 +445,10 @@ namespace CustomizeMii
void bwLoadChannel_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) void bwLoadChannel_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{ {
pbProgress.Value = 100; currentProgress.progressValue = 100;
lbStatusText.Text = string.Empty; currentProgress.progressState = " ";
this.Invoke(ProgressUpdate);
} }
void bwLoadChannel_ProgressChanged(object sender, ProgressChangedEventArgs e) void bwLoadChannel_ProgressChanged(object sender, ProgressChangedEventArgs e)
@ -538,13 +550,15 @@ namespace CustomizeMii
{ {
EventHandler EnableControls = new EventHandler(this.EnableControls); EventHandler EnableControls = new EventHandler(this.EnableControls);
EventHandler Initialize = new EventHandler(this.Initialize); EventHandler Initialize = new EventHandler(this.Initialize);
pbProgress.Value = 100; currentProgress.progressValue = 100;
lbStatusText.Text = string.Empty; currentProgress.progressState = " ";
this.Invoke(ProgressUpdate);
this.Invoke(EnableControls); this.Invoke(EnableControls);
this.Invoke(Initialize);
if (transmitInfo.timeElapsed > 0) if (transmitInfo.timeElapsed > 0)
{ {
this.Invoke(Initialize);
System.Windows.Forms.DialogResult dlg; System.Windows.Forms.DialogResult dlg;
if (transmitInfo.usedCompression) if (transmitInfo.usedCompression)
@ -737,8 +751,10 @@ namespace CustomizeMii
{ {
EventHandler EnableControls = new EventHandler(this.EnableControls); EventHandler EnableControls = new EventHandler(this.EnableControls);
EventHandler Initialize = new EventHandler(this.Initialize); EventHandler Initialize = new EventHandler(this.Initialize);
pbProgress.Value = 100; currentProgress.progressValue = 100;
lbStatusText.Text = string.Empty; currentProgress.progressState = " ";
this.Invoke(ProgressUpdate);
this.Invoke(EnableControls); this.Invoke(EnableControls);
this.Invoke(Initialize); this.Invoke(Initialize);
} }
@ -878,7 +894,7 @@ namespace CustomizeMii
{ {
CreateForwarderSimple(TempUnpackPath + "\\00000002.app"); CreateForwarderSimple(TempUnpackPath + "\\00000002.app");
} }
else if (tbDol.Text.StartsWith("Complex Forwarder:")) else if (tbDol.Text.StartsWith("Complex Forwarder"))
{ {
bwCreateWad.ReportProgress(82, "Compiling Forwarder..."); bwCreateWad.ReportProgress(82, "Compiling Forwarder...");
CreateForwarderComplex(TempUnpackPath + "\\00000002.app"); CreateForwarderComplex(TempUnpackPath + "\\00000002.app");
@ -968,7 +984,6 @@ namespace CustomizeMii
FileInfo fi = new FileInfo(wadInfo.outFile); FileInfo fi = new FileInfo(wadInfo.outFile);
double fileSize = Math.Round(fi.Length * 0.0009765625 * 0.0009765625, 2); double fileSize = Math.Round(fi.Length * 0.0009765625 * 0.0009765625, 2);
InfoBox(string.Format("Successfully created custom channel!\nTime elapsed: {0} ms\nFilesize: {1} MB\nApprox. Blocks: {2}", CreationTimer.ElapsedMilliseconds, fileSize, Wii.WadInfo.GetNandBlocks(wadInfo.outFile))); InfoBox(string.Format("Successfully created custom channel!\nTime elapsed: {0} ms\nFilesize: {1} MB\nApprox. Blocks: {2}", CreationTimer.ElapsedMilliseconds, fileSize, Wii.WadInfo.GetNandBlocks(wadInfo.outFile)));
} }
else sendWadReady = 1; else sendWadReady = 1;

View File

@ -45,8 +45,7 @@ namespace CustomizeMii
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.lbAppFolder = new System.Windows.Forms.Label(); this.tb1 = new System.Windows.Forms.TextBox();
this.tbAppFolder = new System.Windows.Forms.TextBox();
this.cbImage43 = new System.Windows.Forms.CheckBox(); this.cbImage43 = new System.Windows.Forms.CheckBox();
this.cbImage169 = new System.Windows.Forms.CheckBox(); this.cbImage169 = new System.Windows.Forms.CheckBox();
this.tbImage43 = new System.Windows.Forms.TextBox(); this.tbImage43 = new System.Windows.Forms.TextBox();
@ -56,28 +55,25 @@ namespace CustomizeMii
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.btnOK = new System.Windows.Forms.Button(); this.btnOK = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button(); this.btnCancel = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
this.tb2 = new System.Windows.Forms.TextBox();
this.tb3 = new System.Windows.Forms.TextBox();
this.tb4 = new System.Windows.Forms.TextBox();
this.SuspendLayout(); this.SuspendLayout();
// //
// lbAppFolder // tb1
// //
this.lbAppFolder.AutoSize = true; this.tb1.Location = new System.Drawing.Point(12, 62);
this.lbAppFolder.Location = new System.Drawing.Point(12, 17); this.tb1.Name = "tb1";
this.lbAppFolder.Name = "lbAppFolder"; this.tb1.Size = new System.Drawing.Size(334, 20);
this.lbAppFolder.Size = new System.Drawing.Size(107, 13); this.tb1.TabIndex = 1;
this.lbAppFolder.TabIndex = 0; this.tb1.Text = "SD:/apps/example/boot.dol";
this.lbAppFolder.Text = "Application Directory:";
//
// tbAppFolder
//
this.tbAppFolder.Location = new System.Drawing.Point(125, 14);
this.tbAppFolder.Name = "tbAppFolder";
this.tbAppFolder.Size = new System.Drawing.Size(221, 20);
this.tbAppFolder.TabIndex = 1;
// //
// cbImage43 // cbImage43
// //
this.cbImage43.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
this.cbImage43.AutoSize = true; this.cbImage43.AutoSize = true;
this.cbImage43.Location = new System.Drawing.Point(15, 111); this.cbImage43.Location = new System.Drawing.Point(15, 224);
this.cbImage43.Name = "cbImage43"; this.cbImage43.Name = "cbImage43";
this.cbImage43.Size = new System.Drawing.Size(73, 17); this.cbImage43.Size = new System.Drawing.Size(73, 17);
this.cbImage43.TabIndex = 3; this.cbImage43.TabIndex = 3;
@ -87,8 +83,9 @@ namespace CustomizeMii
// //
// cbImage169 // cbImage169
// //
this.cbImage169.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
this.cbImage169.AutoSize = true; this.cbImage169.AutoSize = true;
this.cbImage169.Location = new System.Drawing.Point(15, 141); this.cbImage169.Location = new System.Drawing.Point(15, 254);
this.cbImage169.Name = "cbImage169"; this.cbImage169.Name = "cbImage169";
this.cbImage169.Size = new System.Drawing.Size(79, 17); this.cbImage169.Size = new System.Drawing.Size(79, 17);
this.cbImage169.TabIndex = 3; this.cbImage169.TabIndex = 3;
@ -98,24 +95,27 @@ namespace CustomizeMii
// //
// tbImage43 // tbImage43
// //
this.tbImage43.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
this.tbImage43.Enabled = false; this.tbImage43.Enabled = false;
this.tbImage43.Location = new System.Drawing.Point(94, 109); this.tbImage43.Location = new System.Drawing.Point(94, 222);
this.tbImage43.Name = "tbImage43"; this.tbImage43.Name = "tbImage43";
this.tbImage43.Size = new System.Drawing.Size(171, 20); this.tbImage43.Size = new System.Drawing.Size(171, 20);
this.tbImage43.TabIndex = 4; this.tbImage43.TabIndex = 4;
// //
// tbImage169 // tbImage169
// //
this.tbImage169.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
this.tbImage169.Enabled = false; this.tbImage169.Enabled = false;
this.tbImage169.Location = new System.Drawing.Point(94, 138); this.tbImage169.Location = new System.Drawing.Point(94, 251);
this.tbImage169.Name = "tbImage169"; this.tbImage169.Name = "tbImage169";
this.tbImage169.Size = new System.Drawing.Size(171, 20); this.tbImage169.Size = new System.Drawing.Size(171, 20);
this.tbImage169.TabIndex = 5; this.tbImage169.TabIndex = 5;
// //
// btnBrowseImage43 // btnBrowseImage43
// //
this.btnBrowseImage43.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
this.btnBrowseImage43.Enabled = false; this.btnBrowseImage43.Enabled = false;
this.btnBrowseImage43.Location = new System.Drawing.Point(271, 109); this.btnBrowseImage43.Location = new System.Drawing.Point(271, 222);
this.btnBrowseImage43.Name = "btnBrowseImage43"; this.btnBrowseImage43.Name = "btnBrowseImage43";
this.btnBrowseImage43.Size = new System.Drawing.Size(75, 23); this.btnBrowseImage43.Size = new System.Drawing.Size(75, 23);
this.btnBrowseImage43.TabIndex = 6; this.btnBrowseImage43.TabIndex = 6;
@ -125,8 +125,9 @@ namespace CustomizeMii
// //
// btnBrowseImage169 // btnBrowseImage169
// //
this.btnBrowseImage169.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
this.btnBrowseImage169.Enabled = false; this.btnBrowseImage169.Enabled = false;
this.btnBrowseImage169.Location = new System.Drawing.Point(271, 138); this.btnBrowseImage169.Location = new System.Drawing.Point(271, 251);
this.btnBrowseImage169.Name = "btnBrowseImage169"; this.btnBrowseImage169.Name = "btnBrowseImage169";
this.btnBrowseImage169.Size = new System.Drawing.Size(75, 23); this.btnBrowseImage169.Size = new System.Drawing.Size(75, 23);
this.btnBrowseImage169.TabIndex = 6; this.btnBrowseImage169.TabIndex = 6;
@ -136,7 +137,8 @@ namespace CustomizeMii
// //
// label1 // label1
// //
this.label1.Location = new System.Drawing.Point(0, 55); this.label1.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
this.label1.Location = new System.Drawing.Point(0, 174);
this.label1.Name = "label1"; this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(358, 40); this.label1.Size = new System.Drawing.Size(358, 40);
this.label1.TabIndex = 7; this.label1.TabIndex = 7;
@ -146,7 +148,8 @@ namespace CustomizeMii
// //
// btnOK // btnOK
// //
this.btnOK.Location = new System.Drawing.Point(15, 179); this.btnOK.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
this.btnOK.Location = new System.Drawing.Point(15, 292);
this.btnOK.Name = "btnOK"; this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(160, 23); this.btnOK.Size = new System.Drawing.Size(160, 23);
this.btnOK.TabIndex = 8; this.btnOK.TabIndex = 8;
@ -156,8 +159,9 @@ namespace CustomizeMii
// //
// btnCancel // btnCancel
// //
this.btnCancel.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point(186, 179); this.btnCancel.Location = new System.Drawing.Point(186, 292);
this.btnCancel.Name = "btnCancel"; this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(160, 23); this.btnCancel.Size = new System.Drawing.Size(160, 23);
this.btnCancel.TabIndex = 8; this.btnCancel.TabIndex = 8;
@ -165,15 +169,51 @@ namespace CustomizeMii
this.btnCancel.UseVisualStyleBackColor = true; this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
// //
// label2
//
this.label2.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.label2.Location = new System.Drawing.Point(0, 14);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(358, 40);
this.label2.TabIndex = 7;
this.label2.Text = "The forwarder will try to load in this order.\r\nEntries must begin with \"SD:/\" or " +
"\"USB:/\" and end with \".dol\" or \".elf\"!\r\nYou may enter whatever path you want.";
this.label2.TextAlign = System.Drawing.ContentAlignment.TopCenter;
//
// tb2
//
this.tb2.Location = new System.Drawing.Point(12, 88);
this.tb2.Name = "tb2";
this.tb2.Size = new System.Drawing.Size(334, 20);
this.tb2.TabIndex = 1;
this.tb2.Text = "SD:/apps/example/boot.elf";
//
// tb3
//
this.tb3.Location = new System.Drawing.Point(12, 114);
this.tb3.Name = "tb3";
this.tb3.Size = new System.Drawing.Size(334, 20);
this.tb3.TabIndex = 1;
this.tb3.Text = "USB:/apps/example/boot.dol";
//
// tb4
//
this.tb4.Location = new System.Drawing.Point(12, 140);
this.tb4.Name = "tb4";
this.tb4.Size = new System.Drawing.Size(334, 20);
this.tb4.TabIndex = 1;
this.tb4.Text = "USB:/apps/example/boot.elf";
//
// CustomizeMii_ComplexForwarder // CustomizeMii_ComplexForwarder
// //
this.AcceptButton = this.btnOK; this.AcceptButton = this.btnOK;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.btnCancel; this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(358, 220); this.ClientSize = new System.Drawing.Size(358, 333);
this.Controls.Add(this.btnCancel); this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOK); this.Controls.Add(this.btnOK);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1); this.Controls.Add(this.label1);
this.Controls.Add(this.btnBrowseImage169); this.Controls.Add(this.btnBrowseImage169);
this.Controls.Add(this.btnBrowseImage43); this.Controls.Add(this.btnBrowseImage43);
@ -181,11 +221,14 @@ namespace CustomizeMii
this.Controls.Add(this.tbImage43); this.Controls.Add(this.tbImage43);
this.Controls.Add(this.cbImage169); this.Controls.Add(this.cbImage169);
this.Controls.Add(this.cbImage43); this.Controls.Add(this.cbImage43);
this.Controls.Add(this.tbAppFolder); this.Controls.Add(this.tb4);
this.Controls.Add(this.lbAppFolder); this.Controls.Add(this.tb3);
this.Controls.Add(this.tb2);
this.Controls.Add(this.tb1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "CustomizeMii_ComplexForwarder"; this.Name = "CustomizeMii_ComplexForwarder";
this.Text = "CustomizeMii_ComplexForwarder"; this.Text = "CustomizeMii_ComplexForwarder";
this.Load += new System.EventHandler(this.CustomizeMii_ComplexForwarder_Load);
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
@ -193,9 +236,8 @@ namespace CustomizeMii
#endregion #endregion
private System.Windows.Forms.Label lbAppFolder;
private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label1;
public System.Windows.Forms.TextBox tbAppFolder; public System.Windows.Forms.TextBox tb1;
public System.Windows.Forms.CheckBox cbImage43; public System.Windows.Forms.CheckBox cbImage43;
public System.Windows.Forms.CheckBox cbImage169; public System.Windows.Forms.CheckBox cbImage169;
public System.Windows.Forms.TextBox tbImage43; public System.Windows.Forms.TextBox tbImage43;
@ -204,5 +246,9 @@ namespace CustomizeMii
public System.Windows.Forms.Button btnBrowseImage169; public System.Windows.Forms.Button btnBrowseImage169;
private System.Windows.Forms.Button btnOK; private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.Button btnCancel; private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Label label2;
public System.Windows.Forms.TextBox tb2;
public System.Windows.Forms.TextBox tb3;
public System.Windows.Forms.TextBox tb4;
} }
} }

View File

@ -31,6 +31,10 @@ namespace CustomizeMii
public CustomizeMii_ComplexForwarder() public CustomizeMii_ComplexForwarder()
{ {
InitializeComponent(); InitializeComponent();
}
private void CustomizeMii_ComplexForwarder_Load(object sender, EventArgs e)
{
this.CenterToParent(); this.CenterToParent();
} }
@ -54,18 +58,21 @@ namespace CustomizeMii
private void btnOK_Click(object sender, EventArgs e) private void btnOK_Click(object sender, EventArgs e)
{ {
if (string.IsNullOrEmpty(tbAppFolder.Text)) TextBox[] tbs = new TextBox[] { tb1, tb2, tb3, tb4 };
foreach (TextBox tbThis in tbs)
{ {
tbAppFolder.Focus(); if ((!tbThis.Text.StartsWith("USB:/") && !tbThis.Text.StartsWith("SD:/")) ||
} (!tbThis.Text.EndsWith(".dol") && !tbThis.Text.EndsWith(".elf")))
else { tbThis.Focus(); tbThis.SelectAll(); return; }
{
if (!File.Exists(tbImage43.Text)) tbImage43.Text = string.Empty;
if (!File.Exists(tbImage169.Text)) tbImage169.Text = string.Empty;
this.DialogResult = DialogResult.OK;
this.Close();
} }
tb1.Focus();
if (!File.Exists(tbImage43.Text)) tbImage43.Text = string.Empty;
if (!File.Exists(tbImage169.Text)) tbImage169.Text = string.Empty;
this.DialogResult = DialogResult.OK;
this.Close();
} }
private void btnBrowse_Click(object sender, EventArgs e) private void btnBrowse_Click(object sender, EventArgs e)

View File

@ -25,14 +25,16 @@ namespace CustomizeMii
internal class Complex internal class Complex
{ {
private string thisAppFolder; private string path1 = "SD:/apps/example/boot.dol";
private bool elfFirst = false; private string path2 = "SD:/apps/example/boot.elf";
private bool usbFirst = false; private string path3 = "USB:/apps/example/boot.dol";
private string path4 = "USB:/apps/example/boot.elf";
private string image43; private string image43;
private string image169; private string image169;
public string AppFolder { get { return thisAppFolder; } set { thisAppFolder = value; } } public string Path1 { get { return path1; } set { path1 = value; } }
public bool ElfFirst { get { return elfFirst; } set { elfFirst = value; } } public string Path2 { get { return path2; } set { path2 = value; } }
public bool UsbFirst { get { return usbFirst; } set { usbFirst = value; } } public string Path3 { get { return path3; } set { path3 = value; } }
public string Path4 { get { return path4; } set { path4 = value; } }
public string Image43 { get { return image43; } set { image43 = value; } } public string Image43 { get { return image43; } set { image43 = value; } }
public string Image169 { get { return image169; } set { image169 = value; } } public string Image169 { get { return image169; } set { image169 = value; } }
@ -43,15 +45,16 @@ namespace CustomizeMii
public void Save(string Destination) public void Save(string Destination)
{ {
GXForwarder Forwarder = new GXForwarder(thisAppFolder, usbFirst, elfFirst, image43, image169); GXForwarder Forwarder = new GXForwarder(image43, image169, path1, path2, path3, path4);
Forwarder.Save(Destination, true); Forwarder.Save(Destination, true);
} }
public void Clear() public void Clear()
{ {
thisAppFolder = string.Empty; path1 = "SD:/apps/example/boot.dol";
elfFirst = false; path2 = "SD:/apps/example/boot.elf";
usbFirst = false; path3 = "USB:/apps/example/boot.dol";
path4 = "USB:/apps/example/boot.elf";
image43 = string.Empty; image43 = string.Empty;
image169 = string.Empty; image169 = string.Empty;
} }

View File

@ -47,6 +47,7 @@ namespace CustomizeMii
private void CustomizeMii_InputBox_Load(object sender, EventArgs e) private void CustomizeMii_InputBox_Load(object sender, EventArgs e)
{ {
this.CenterToParent(); this.CenterToParent();
if (this.Location.X == 0 && this.Location.Y == 0) this.CenterToScreen();
} }
private void btnExit_Click(object sender, EventArgs e) private void btnExit_Click(object sender, EventArgs e)

View File

@ -141,11 +141,11 @@ namespace CustomizeMii
this.tabInstructions = new System.Windows.Forms.TabPage(); this.tabInstructions = new System.Windows.Forms.TabPage();
this.rtbInstructions = new System.Windows.Forms.RichTextBox(); this.rtbInstructions = new System.Windows.Forms.RichTextBox();
this.tabCredits = new System.Windows.Forms.TabPage(); this.tabCredits = new System.Windows.Forms.TabPage();
this.label1 = new System.Windows.Forms.Label(); this.lbCreditInstaller = new System.Windows.Forms.Label();
this.lbForwardMiiVersion = new System.Windows.Forms.Label(); this.lbForwardMiiVersion = new System.Windows.Forms.Label();
this.panCredits = new System.Windows.Forms.Panel(); this.panCredits = new System.Windows.Forms.Panel();
this.lbCreditThanks = new System.Windows.Forms.Label(); this.lbCreditThanks = new System.Windows.Forms.Label();
this.llbUpdateAvailabe = new System.Windows.Forms.LinkLabel(); this.llbUpdateAvailable = new System.Windows.Forms.LinkLabel();
this.llbSite = new System.Windows.Forms.LinkLabel(); this.llbSite = new System.Windows.Forms.LinkLabel();
this.lbCreditVersion = new System.Windows.Forms.Label(); this.lbCreditVersion = new System.Windows.Forms.Label();
this.lbCreditInfo = new System.Windows.Forms.Label(); this.lbCreditInfo = new System.Windows.Forms.Label();
@ -412,6 +412,7 @@ namespace CustomizeMii
// llbTranslateChannel // llbTranslateChannel
// //
this.llbTranslateChannel.AutoSize = true; this.llbTranslateChannel.AutoSize = true;
this.llbTranslateChannel.Enabled = false;
this.llbTranslateChannel.Location = new System.Drawing.Point(322, 42); this.llbTranslateChannel.Location = new System.Drawing.Point(322, 42);
this.llbTranslateChannel.Name = "llbTranslateChannel"; this.llbTranslateChannel.Name = "llbTranslateChannel";
this.llbTranslateChannel.Size = new System.Drawing.Size(103, 13); this.llbTranslateChannel.Size = new System.Drawing.Size(103, 13);
@ -555,6 +556,7 @@ namespace CustomizeMii
this.tbAllLanguages.Name = "tbAllLanguages"; this.tbAllLanguages.Name = "tbAllLanguages";
this.tbAllLanguages.Size = new System.Drawing.Size(311, 20); this.tbAllLanguages.Size = new System.Drawing.Size(311, 20);
this.tbAllLanguages.TabIndex = 1; this.tbAllLanguages.TabIndex = 1;
this.tbAllLanguages.TextChanged += new System.EventHandler(this.tbAllLanguages_TextChanged);
// //
// lbAllLanguages // lbAllLanguages
// //
@ -639,8 +641,8 @@ namespace CustomizeMii
this.lbOptionsOptional.Name = "lbOptionsOptional"; this.lbOptionsOptional.Name = "lbOptionsOptional";
this.lbOptionsOptional.Size = new System.Drawing.Size(457, 34); this.lbOptionsOptional.Size = new System.Drawing.Size(457, 34);
this.lbOptionsOptional.TabIndex = 10; this.lbOptionsOptional.TabIndex = 10;
this.lbOptionsOptional.Text = "These are optional. Fill them in only if you want to change them.\r\nIf you want a " + this.lbOptionsOptional.Text = "These are optional. Fill them in only if you want to change them.\r\nIt is highly r" +
"looped sound, set the loop points first (e.g. with Wavosaur)."; "ecommended to convert your sound to BNS.";
this.lbOptionsOptional.TextAlign = System.Drawing.ContentAlignment.TopCenter; this.lbOptionsOptional.TextAlign = System.Drawing.ContentAlignment.TopCenter;
// //
// btnBrowseSound // btnBrowseSound
@ -1231,10 +1233,10 @@ namespace CustomizeMii
// //
// tabCredits // tabCredits
// //
this.tabCredits.Controls.Add(this.label1); this.tabCredits.Controls.Add(this.lbCreditInstaller);
this.tabCredits.Controls.Add(this.lbForwardMiiVersion); this.tabCredits.Controls.Add(this.lbForwardMiiVersion);
this.tabCredits.Controls.Add(this.panCredits); this.tabCredits.Controls.Add(this.panCredits);
this.tabCredits.Controls.Add(this.llbUpdateAvailabe); this.tabCredits.Controls.Add(this.llbUpdateAvailable);
this.tabCredits.Controls.Add(this.llbSite); this.tabCredits.Controls.Add(this.llbSite);
this.tabCredits.Controls.Add(this.lbCreditVersion); this.tabCredits.Controls.Add(this.lbCreditVersion);
this.tabCredits.Controls.Add(this.lbCreditInfo); this.tabCredits.Controls.Add(this.lbCreditInfo);
@ -1246,14 +1248,14 @@ namespace CustomizeMii
this.tabCredits.Text = "About"; this.tabCredits.Text = "About";
this.tabCredits.UseVisualStyleBackColor = true; this.tabCredits.UseVisualStyleBackColor = true;
// //
// label1 // lbCreditInstaller
// //
this.label1.Location = new System.Drawing.Point(0, 28); this.lbCreditInstaller.Location = new System.Drawing.Point(0, 28);
this.label1.Name = "label1"; this.lbCreditInstaller.Name = "lbCreditInstaller";
this.label1.Size = new System.Drawing.Size(443, 13); this.lbCreditInstaller.Size = new System.Drawing.Size(443, 13);
this.label1.TabIndex = 7; this.lbCreditInstaller.TabIndex = 7;
this.label1.Text = "CustomizeMii Installer by WiiCrazy / I.R.on"; this.lbCreditInstaller.Text = "CustomizeMii Installer X by WiiCrazy / I.R.on";
this.label1.TextAlign = System.Drawing.ContentAlignment.TopCenter; this.lbCreditInstaller.TextAlign = System.Drawing.ContentAlignment.TopCenter;
// //
// lbForwardMiiVersion // lbForwardMiiVersion
// //
@ -1283,18 +1285,18 @@ namespace CustomizeMii
this.lbCreditThanks.Text = resources.GetString("lbCreditThanks.Text"); this.lbCreditThanks.Text = resources.GetString("lbCreditThanks.Text");
this.lbCreditThanks.TextAlign = System.Drawing.ContentAlignment.TopCenter; this.lbCreditThanks.TextAlign = System.Drawing.ContentAlignment.TopCenter;
// //
// llbUpdateAvailabe // llbUpdateAvailable
// //
this.llbUpdateAvailabe.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.llbUpdateAvailable.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.llbUpdateAvailabe.Location = new System.Drawing.Point(0, 67); this.llbUpdateAvailable.Location = new System.Drawing.Point(0, 67);
this.llbUpdateAvailabe.Name = "llbUpdateAvailabe"; this.llbUpdateAvailable.Name = "llbUpdateAvailable";
this.llbUpdateAvailabe.Size = new System.Drawing.Size(443, 13); this.llbUpdateAvailable.Size = new System.Drawing.Size(443, 13);
this.llbUpdateAvailabe.TabIndex = 4; this.llbUpdateAvailable.TabIndex = 4;
this.llbUpdateAvailabe.TabStop = true; this.llbUpdateAvailable.TabStop = true;
this.llbUpdateAvailabe.Text = "Version X is availabe, get it here!"; this.llbUpdateAvailable.Text = "Version X is available, get it here!";
this.llbUpdateAvailabe.TextAlign = System.Drawing.ContentAlignment.TopCenter; this.llbUpdateAvailable.TextAlign = System.Drawing.ContentAlignment.TopCenter;
this.llbUpdateAvailabe.Visible = false; this.llbUpdateAvailable.Visible = false;
this.llbUpdateAvailabe.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.llbUpdateAvailabe_LinkClicked); this.llbUpdateAvailable.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.llbUpdateAvailable_LinkClicked);
// //
// llbSite // llbSite
// //
@ -1673,7 +1675,7 @@ namespace CustomizeMii
private System.Windows.Forms.Label lbBrlanActions; private System.Windows.Forms.Label lbBrlanActions;
private System.Windows.Forms.Label lbBrlytWarning; private System.Windows.Forms.Label lbBrlytWarning;
private System.Windows.Forms.Label lbBrlanWarning; private System.Windows.Forms.Label lbBrlanWarning;
private System.Windows.Forms.LinkLabel llbUpdateAvailabe; private System.Windows.Forms.LinkLabel llbUpdateAvailable;
private System.Windows.Forms.Button btnDeleteBanner; private System.Windows.Forms.Button btnDeleteBanner;
private System.Windows.Forms.Button btnAddBanner; private System.Windows.Forms.Button btnAddBanner;
private System.Windows.Forms.Button btnAddIcon; private System.Windows.Forms.Button btnAddIcon;
@ -1709,7 +1711,7 @@ namespace CustomizeMii
private System.Windows.Forms.Label lbForwardMiiVersion; private System.Windows.Forms.Label lbForwardMiiVersion;
private System.Windows.Forms.Label lbCreated; private System.Windows.Forms.Label lbCreated;
private System.Windows.Forms.Label lbCreatedValue; private System.Windows.Forms.Label lbCreatedValue;
private System.Windows.Forms.Label label1; private System.Windows.Forms.Label lbCreditInstaller;
private System.Windows.Forms.ToolStripMenuItem tsExtractBrl; private System.Windows.Forms.ToolStripMenuItem tsExtractBrl;
private System.Windows.Forms.ToolStripMenuItem cmExtractBrlyt; private System.Windows.Forms.ToolStripMenuItem cmExtractBrlyt;
private System.Windows.Forms.ToolStripMenuItem cmExtractBrlan; private System.Windows.Forms.ToolStripMenuItem cmExtractBrlan;

View File

@ -25,7 +25,6 @@ using System.Diagnostics;
using System.Drawing; using System.Drawing;
using System.IO; using System.IO;
using System.Net; using System.Net;
using System.Text.RegularExpressions;
using System.Windows.Forms; using System.Windows.Forms;
#if !Mono #if !Mono
@ -159,6 +158,9 @@ namespace CustomizeMii
{ {
this.Text = this.Text.Replace("X", version); this.Text = this.Text.Replace("X", version);
this.lbCreditVersion.Text = this.lbCreditVersion.Text.Replace("X", version); this.lbCreditVersion.Text = this.lbCreditVersion.Text.Replace("X", version);
if (File.Exists(Application.StartupPath + "\\CustomizeMiiInstaller.dll"))
this.lbCreditInstaller.Text = this.lbCreditInstaller.Text.Replace("X", GetInstallerVersion());
else this.lbCreditInstaller.Text = this.lbCreditInstaller.Text.Replace(" X", string.Empty);
if (Directory.Exists(TempPath)) Directory.Delete(TempPath, true); if (Directory.Exists(TempPath)) Directory.Delete(TempPath, true);
ProgressUpdate = new EventHandler(this.UpdateProgress); ProgressUpdate = new EventHandler(this.UpdateProgress);
SetButtonText(); SetButtonText();
@ -194,7 +196,7 @@ namespace CustomizeMii
{ {
try try
{ {
lbForwardMiiVersion.Text = lbForwardMiiVersion.Text.Replace("X", ForwardMii_Plugin.GetVersion()); lbForwardMiiVersion.Text = lbForwardMiiVersion.Text.Replace("X", GetForwardMiiVersion());
lbForwardMiiVersion.Visible = true; lbForwardMiiVersion.Visible = true;
} }
catch { } catch { }
@ -414,6 +416,7 @@ namespace CustomizeMii
if (!string.IsNullOrEmpty(currentProgress.progressState)) if (!string.IsNullOrEmpty(currentProgress.progressState))
{ {
if (currentProgress.progressState == " ") currentProgress.progressState = string.Empty;
lbStatusText.Text = currentProgress.progressState; lbStatusText.Text = currentProgress.progressState;
currentProgress.progressState = string.Empty; currentProgress.progressState = string.Empty;
} }
@ -424,66 +427,6 @@ namespace CustomizeMii
tbSourceWad.Text = SourceWad; tbSourceWad.Text = SourceWad;
} }
private void ForwarderDialogSimple()
{
CustomizeMii_InputBox ib = new CustomizeMii_InputBox(false);
ib.Size = new Size(ib.Size.Width, 120);
ib.lbInfo.Text = "Enter the application folder where the forwarder will point to (3-18 chars)";
ib.tbInput.MaxLength = 18;
ib.btnExit.Text = "Close";
ib.cbElf.Visible = true;
ib.tbInput.Text = SimpleForwarder.AppFolder;
ib.cbElf.Checked = SimpleForwarder.ForwardToElf;
if (ib.ShowDialog() == DialogResult.OK)
{
SimpleForwarder.ForwardToElf = ib.cbElf.Checked;
SimpleForwarder.AppFolder = ib.Input;
SetText(tbDol, string.Format("Simple Forwarder: \"SD:\\apps\\{0}\\boot.{1}\"",
SimpleForwarder.AppFolder, SimpleForwarder.ForwardToElf == true ? "elf" : "dol"));
btnBrowseDol.Text = "Clear";
}
}
private void ForwarderDialogComplex()
{
CustomizeMii_ComplexForwarder cf = new CustomizeMii_ComplexForwarder();
cf.tbAppFolder.Text = ComplexForwarder.AppFolder;
//cf.rbSD.Checked = !ComplexForwarder.UsbFirst;
//cf.rbUSB.Checked = ComplexForwarder.UsbFirst;
//cf.rbDOL.Checked = !ComplexForwarder.ElfFirst;
//cf.rbELF.Checked = ComplexForwarder.ElfFirst;
if (!string.IsNullOrEmpty(ComplexForwarder.Image43))
{
cf.cbImage43.Checked = true;
cf.tbImage43.Enabled = true;
cf.btnBrowseImage43.Enabled = true;
cf.tbImage43.Text = ComplexForwarder.Image43;
}
if (!string.IsNullOrEmpty(ComplexForwarder.Image169))
{
cf.cbImage169.Checked = true;
cf.tbImage169.Enabled = true;
cf.btnBrowseImage169.Enabled = true;
cf.tbImage169.Text = ComplexForwarder.Image169;
}
if (cf.ShowDialog() == DialogResult.OK)
{
ComplexForwarder.AppFolder = cf.tbAppFolder.Text;
//ComplexForwarder.UsbFirst = cf.rbUSB.Checked;
//ComplexForwarder.ElfFirst = cf.rbELF.Checked;
ComplexForwarder.Image43 = cf.tbImage43.Text;
ComplexForwarder.Image169 = cf.tbImage169.Text;
SetText(tbDol, string.Format("Complex Forwarder: \"{0}\"", ComplexForwarder.AppFolder));
}
}
private void tabControl_Selecting(object sender, TabControlCancelEventArgs e) private void tabControl_Selecting(object sender, TabControlCancelEventArgs e)
{ {
tmrCredits.Stop(); tmrCredits.Stop();
@ -617,13 +560,14 @@ namespace CustomizeMii
if (newVersion > thisVersion) if (newVersion > thisVersion)
{ {
llbUpdateAvailabe.Text = llbUpdateAvailabe.Text.Replace("X", NewVersion); llbUpdateAvailable.Text = llbUpdateAvailable.Text.Replace("X", NewVersion);
llbUpdateAvailabe.Visible = true; llbUpdateAvailable.Visible = true;
lbForwardMiiVersion.Tag = "Update"; lbForwardMiiVersion.Tag = "Update";
lbForwardMiiVersion.Visible = false;
if (MessageBox.Show("Version " + NewVersion + if (MessageBox.Show("Version " + NewVersion +
" is availabe.\nDo you want the download page to be opened?", " is available.\nDo you want the download page to be opened?",
"Update availabe", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == "Update available", MessageBoxButtons.YesNo, MessageBoxIcon.Information) ==
DialogResult.Yes) DialogResult.Yes)
{ {
Process.Start("http://code.google.com/p/customizemii/downloads/list"); Process.Start("http://code.google.com/p/customizemii/downloads/list");
@ -634,6 +578,11 @@ namespace CustomizeMii
} }
} }
private string GetInstallerVersion()
{
return CustomizeMiiInstaller.CustomizeMiiInstaller_Plugin.GetVersion();
}
#if !Mono #if !Mono
private string GetForwardMiiVersion() private string GetForwardMiiVersion()
{ {
@ -661,8 +610,8 @@ namespace CustomizeMii
if (newVersion > thisVersion) if (newVersion > thisVersion)
{ {
if (MessageBox.Show("Version " + NewVersion + if (MessageBox.Show("Version " + NewVersion +
" of the ForwardMii-Plugin is availabe.\nDo you want the download page to be opened?", " of the ForwardMii-Plugin is available.\nDo you want the download page to be opened?",
"ForwardMii Update availabe", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == "ForwardMii Update available", MessageBoxButtons.YesNo, MessageBoxIcon.Information) ==
DialogResult.Yes) DialogResult.Yes)
{ {
Process.Start("http://code.google.com/p/customizemii/downloads/list"); Process.Start("http://code.google.com/p/customizemii/downloads/list");
@ -705,25 +654,11 @@ namespace CustomizeMii
if (tbSourceWad.Text != SourceWadUrls[lbxBaseWads.SelectedIndex]) if (tbSourceWad.Text != SourceWadUrls[lbxBaseWads.SelectedIndex])
{ {
try SourceWad = "http://customizemii.googlecode.com/svn/branches/Base_WADs/" + SourceWadUrls[lbxBaseWads.SelectedIndex];
{ tbSourceWad.Text = SourceWad;
SourceWad = "http://customizemii.googlecode.com/svn/branches/Base_WADs/" + SourceWadUrls[lbxBaseWads.SelectedIndex];
tbSourceWad.Text = SourceWad;
WebClient Client = new WebClient();
Client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(Client_DownloadProgressChanged);
Client.DownloadFileCompleted += new AsyncCompletedEventHandler(Client_DownloadFileCompleted);
lbStatusText.Text = "Downloading Base WAD..."; System.Threading.Thread dlThread = new System.Threading.Thread(new System.Threading.ThreadStart(DownloadBaseWad));
pbProgress.Value = 0; dlThread.Start();
if (!Directory.Exists(TempWadPath.Remove(TempWadPath.LastIndexOf('\\'))))
Directory.CreateDirectory(TempWadPath.Remove(TempWadPath.LastIndexOf('\\')));
Client.DownloadFileAsync(new Uri(SourceWad), TempWadPath);
}
catch (Exception ex)
{
tbSourceWad.Text = string.Empty;
ErrorBox(ex.Message);
}
} }
} }
else else
@ -734,15 +669,41 @@ namespace CustomizeMii
} }
} }
void DownloadBaseWad()
{
try
{
WebClient Client = new WebClient();
Client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(Client_DownloadProgressChanged);
Client.DownloadFileCompleted += new AsyncCompletedEventHandler(Client_DownloadFileCompleted);
currentProgress.progressState = "Downloading Base WAD...";
currentProgress.progressValue= 0;
this.Invoke(ProgressUpdate);
if (!Directory.Exists(TempWadPath.Remove(TempWadPath.LastIndexOf('\\'))))
Directory.CreateDirectory(TempWadPath.Remove(TempWadPath.LastIndexOf('\\')));
Client.DownloadFileAsync(new Uri(SourceWad), TempWadPath);
}
catch (Exception ex)
{
SetText(tbSourceWad, string.Empty);
ErrorBox(ex.Message);
}
}
void Client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e) void Client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
{ {
pbProgress.Value = e.ProgressPercentage; currentProgress.progressValue = e.ProgressPercentage;
currentProgress.progressState = "Downloading Base WAD...";
this.Invoke(ProgressUpdate);
} }
void Client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e) void Client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
{ {
pbProgress.Value = 100; currentProgress.progressValue = 0;
lbStatusText.Text = string.Empty; currentProgress.progressState = string.Empty;
this.Invoke(ProgressUpdate);
if (File.Exists(TempWadPath)) if (File.Exists(TempWadPath))
{ {
@ -781,7 +742,7 @@ namespace CustomizeMii
catch (Exception ex) { ErrorBox(ex.Message); } catch (Exception ex) { ErrorBox(ex.Message); }
} }
else else
InfoBox("There's no preview of this channel availabe, sorry!"); InfoBox("There's no preview of this channel available, sorry!");
} }
else else
{ {
@ -1332,211 +1293,6 @@ namespace CustomizeMii
} }
} }
private bool FailureCheck()
{
try
{
//Check Unpack Folder
if (CheckUnpackFolder() == false)
{
if (UnpackFolderErrorCount > 0)
{
ErrorBox("Something's wrong with the temporary files.\nYou may have to start again." +
"\n\nIf this message keeps bothering you, please report as much information " +
"as possible at the issue tracker: http://code.google.com/p/customizemii/issues/list");
}
else
{
ErrorBox("Something's wrong with the temporary files.\nYou may have to start again.");
}
UnpackFolderErrorCount++;
return false;
}
//Check Channel Title Boxes
if (!(!string.IsNullOrEmpty(tbAllLanguages.Text) ||
(!string.IsNullOrEmpty(tbEnglish.Text) &&
!string.IsNullOrEmpty(tbJapanese.Text) &&
!string.IsNullOrEmpty(tbGerman.Text) &&
!string.IsNullOrEmpty(tbFrench.Text) &&
!string.IsNullOrEmpty(tbSpanish.Text) &&
!string.IsNullOrEmpty(tbItalian.Text) &&
!string.IsNullOrEmpty(tbDutch.Text))))
{
ErrorBox("You must either enter a general Channel Title or one for each language!");
return false;
}
//Check Title ID Length + Chars
if (tbTitleID.Text.Length != 4)
{
ErrorBox("The Title ID must be 4 characters long!"); return false;
}
Regex allowedchars = new Regex("[A-Z0-9]{4}$");
if (!allowedchars.IsMatch(tbTitleID.Text.ToUpper()))
{
ErrorBox("Please enter a valid Title ID!"); return false;
}
//Check brlan files
string[] ValidBrlans = new string[] { "banner.brlan", "icon.brlan", "banner_loop.brlan", "icon_loop.brlan", "banner_start.brlan", "icon_start.brlan" };
foreach (string thisBrlan in lbxBrlanBanner.Items)
{
if (!Wii.Tools.StringExistsInStringArray(thisBrlan.ToLower(), ValidBrlans))
{
ErrorBox(thisBrlan + " is not a valid brlan filename!");
return false;
}
}
foreach (string thisBrlan in lbxBrlanIcon.Items)
{
if (!Wii.Tools.StringExistsInStringArray(thisBrlan.ToLower(), ValidBrlans))
{
ErrorBox(thisBrlan + " is not a valid brlan filename!");
return false;
}
}
//Check TPLs
List<string> BannerTpls = new List<string>();
List<string> IconTpls = new List<string>();
foreach (string thisTpl in lbxBannerTpls.Items) BannerTpls.Add(thisTpl.Replace(" (Transparent)", string.Empty));
foreach (string thisTpl in lbxIconTpls.Items) IconTpls.Add(thisTpl.Replace(" (Transparent)", string.Empty));
string[] BannerBrlytPath;
string[] IconBrlytPath;
if (string.IsNullOrEmpty(BannerReplace))
BannerBrlytPath = Directory.GetFiles(TempUnpackBannerBrlytPath);
else
BannerBrlytPath = Directory.GetFiles(TempBannerPath + "arc\\blyt");
if (string.IsNullOrEmpty(IconReplace))
IconBrlytPath = Directory.GetFiles(TempUnpackIconBrlytPath);
else
IconBrlytPath = Directory.GetFiles(TempIconPath + "arc\\blyt");
string[] BannerMissing;
string[] BannerUnused;
string[] IconMissing;
string[] IconUnused;
//Check for missing TPLs
if (Wii.Brlyt.CheckForMissingTpls(BannerBrlytPath[0], BannerTpls.ToArray(), out BannerMissing) == true)
{
ErrorBox("The following Banner TPLs are required by the banner.brlyt, but missing:\n\n" + string.Join("\n", BannerMissing));
return false;
}
if (Wii.Brlyt.CheckForMissingTpls(IconBrlytPath[0], IconTpls.ToArray(), out IconMissing) == true)
{
ErrorBox("The following Icon TPLs are required by the icon.brlyt, but missing:\n\n" + string.Join("\n", IconMissing));
return false;
}
//Check Sound length
int soundLength = 0;
if (!string.IsNullOrEmpty(tbSound.Text) && string.IsNullOrEmpty(SoundReplace))
{
if (!tbSound.Text.ToLower().EndsWith(".bns") && !tbSound.Text.StartsWith("BNS:"))
{
string SoundFile = tbSound.Text;
if (tbSound.Text.ToLower().EndsWith(".mp3")) SoundFile = TempWavePath;
soundLength = Wii.Sound.GetWaveLength(SoundFile);
if (soundLength > SoundMaxLength)
{
ErrorBox(string.Format("Your Sound is longer than {0} seconds and thus not supported.\nIt is recommended to use a Sound shorter than {1} seconds, the maximum length is {0} seconds!", SoundMaxLength, SoundWarningLength));
return false;
}
}
}
/*Errors till here..
From here only Warnings!*/
if (soundLength > SoundWarningLength)
{
if (MessageBox.Show(string.Format("Your Sound is longer than {0} seconds.\nIt is recommended to use Sounds that are shorter than {0} seconds!\nDo you still want to continue?", SoundWarningLength), "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
return false;
}
//Check BNS sound length
if (tbSound.Text.StartsWith("BNS:") || tbSound.Text.ToLower().EndsWith(".bns"))
{
string bnsFile = tbSound.Text;
if (tbSound.Text.StartsWith("BNS:")) bnsFile = TempBnsPath;
int bnsLength = Wii.Sound.GetBnsLength(bnsFile);
if (bnsLength > BnsWarningLength)
{
if (MessageBox.Show(string.Format("Your BNS Sound is longer than {0} seconds.\nIt is recommended to use Sounds that are shorter than {0} seconds!\nDo you still want to continue?", BnsWarningLength), "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
return false;
}
}
//Check if brlyt or brlan were changed
if (BrlytChanged == true && BrlanChanged == false)
{
if (MessageBox.Show("You have changed the brlyt, but didn't change the brlan.\nAre you sure this is correct?", "brlyt Changed", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
return false;
}
else if (BrlanChanged == true && BrlytChanged == false)
{
if (MessageBox.Show("You have changed the brlan, but didn't change the brlyt.\nAre you sure this is correct?", "brlan Changed", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
return false;
}
//Check for unused TPLs (Do this at the end of the failure checks, because we don't want a
// MessageBox asking if unused TPLs should be deleted and after that any error)
if (Wii.Brlyt.CheckForUnusedTpls(BannerBrlytPath[0], BannerTpls.ToArray(), out BannerUnused) == true)
{
DialogResult dlgresult = MessageBox.Show(
"The following Banner TPLs are unused by the banner.brlyt:\n\n" +
string.Join("\n", BannerUnused) +
"\n\nDo you want them to be deleted before the WAD is being created? (Saves space!)",
"Delete unused TPLs?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
if (dlgresult == DialogResult.Yes)
{
foreach (string thisTpl in BannerUnused)
{
if (string.IsNullOrEmpty(BannerReplace))
File.Delete(TempUnpackBannerTplPath + thisTpl);
else
File.Delete(TempBannerPath + "arc\\timg\\" + thisTpl);
}
}
else if (dlgresult == DialogResult.Cancel) return false;
}
if (Wii.Brlyt.CheckForUnusedTpls(IconBrlytPath[0], IconTpls.ToArray(), out IconUnused) == true)
{
DialogResult dlgresult = MessageBox.Show(
"The following Icon TPLs are unused by the icon.brlyt:\n\n" +
string.Join("\n", IconUnused) +
"\n\nDo you want them to be deleted before the WAD is being created? (Saves memory!)",
"Delete unused TPLs?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
if (dlgresult == DialogResult.Yes)
{
foreach (string thisTpl in IconUnused)
{
if (string.IsNullOrEmpty(IconReplace))
File.Delete(TempUnpackIconTplPath + thisTpl);
else
File.Delete(TempIconPath + "arc\\timg\\" + thisTpl);
}
}
else if (dlgresult == DialogResult.Cancel) return false;
}
return true;
}
catch (Exception ex)
{
ErrorBox(ex.Message);
return false;
}
}
private bool CheckUnpackFolder() private bool CheckUnpackFolder()
{ {
try try
@ -1871,7 +1627,7 @@ namespace CustomizeMii
{ {
if (!File.Exists(Application.StartupPath + "\\CustomizeMiiInstaller.dll")) if (!File.Exists(Application.StartupPath + "\\CustomizeMiiInstaller.dll"))
{ {
ErrorBox("The CustomizeMiiInstaller.dll wasn't found!"); ErrorBox("CustomizeMiiInstaller.dll wasn't found!");
} }
else else
{ {
@ -2276,11 +2032,11 @@ namespace CustomizeMii
} }
} }
private void llbUpdateAvailabe_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) private void llbUpdateAvailable_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{ {
try try
{ {
llbUpdateAvailabe.LinkVisited = true; llbUpdateAvailable.LinkVisited = true;
Process.Start("http://code.google.com/p/customizemii/downloads/list"); Process.Start("http://code.google.com/p/customizemii/downloads/list");
} }
catch (Exception ex) { ErrorBox(ex.Message); } catch (Exception ex) { ErrorBox(ex.Message); }
@ -2296,7 +2052,7 @@ namespace CustomizeMii
{ {
string TplName = lbxBannerTpls.SelectedItem.ToString().Replace(" (Transparent)", string.Empty); string TplName = lbxBannerTpls.SelectedItem.ToString().Replace(" (Transparent)", string.Empty);
string CurBannerPath = GetCurBannerPath(); string CurBannerPath = GetCurBannerPath();
string[] brlytTpls = Wii.Brlyt.GetBrlytTpls(CurBannerPath + "blyt\\banner.brlyt"); string[] brlytTpls = Wii.Brlyt.GetBrlytTpls(CurBannerPath + "blyt\\banner.brlyt", (File.Exists(CurBannerPath + "anim\\banner.brlan")) ? CurBannerPath + "anim\\banner.brlan" : CurBannerPath + "anim\\banner_loop.brlan");
if (!Wii.Tools.StringExistsInStringArray(TplName, brlytTpls) || cbFailureChecks.Checked) if (!Wii.Tools.StringExistsInStringArray(TplName, brlytTpls) || cbFailureChecks.Checked)
{ {
@ -2335,7 +2091,7 @@ namespace CustomizeMii
string TplName = lbxIconTpls.SelectedItem.ToString().Replace(" (Transparent)", string.Empty); string TplName = lbxIconTpls.SelectedItem.ToString().Replace(" (Transparent)", string.Empty);
string CurIconPath = GetCurIconPath(); string CurIconPath = GetCurIconPath();
string[] brlytTpls = Wii.Brlyt.GetBrlytTpls(CurIconPath + "blyt\\icon.brlyt"); string[] brlytTpls = Wii.Brlyt.GetBrlytTpls(CurIconPath + "blyt\\icon.brlyt", CurIconPath + "anim\\icon.brlan");
if (!Wii.Tools.StringExistsInStringArray(TplName, brlytTpls) || cbFailureChecks.Checked) if (!Wii.Tools.StringExistsInStringArray(TplName, brlytTpls) || cbFailureChecks.Checked)
{ {
@ -2380,7 +2136,7 @@ namespace CustomizeMii
if (lbBrlytActions.Text == "Banner") if (lbBrlytActions.Text == "Banner")
{ {
string CurBannerPath = GetCurBannerPath(); string CurBannerPath = GetCurBannerPath();
string[] brlytTpls = Wii.Brlyt.GetBrlytTpls(CurBannerPath + "blyt\\banner.brlyt"); string[] brlytTpls = Wii.Brlyt.GetBrlytTpls(CurBannerPath + "blyt\\banner.brlyt", (File.Exists(CurBannerPath + "anim\\banner.brlan")) ? CurBannerPath + "anim\\banner.brlan" : CurBannerPath + "anim\\banner_loop.brlan");
MessageBox.Show("These are the TPLs required by your banner.brlyt:\n\n" + MessageBox.Show("These are the TPLs required by your banner.brlyt:\n\n" +
string.Join("\n", brlytTpls), "TPLs specified in banner.brlyt", MessageBoxButtons.OK, string.Join("\n", brlytTpls), "TPLs specified in banner.brlyt", MessageBoxButtons.OK,
@ -2389,7 +2145,7 @@ namespace CustomizeMii
else else
{ {
string CurIconPath = GetCurIconPath(); string CurIconPath = GetCurIconPath();
string[] brlytTpls = Wii.Brlyt.GetBrlytTpls(CurIconPath + "blyt\\icon.brlyt"); string[] brlytTpls = Wii.Brlyt.GetBrlytTpls(CurIconPath + "blyt\\icon.brlyt", CurIconPath + "anim\\icon.brlan");
MessageBox.Show("These are the TPLs required by your icon.brlyt:\n\n" + MessageBox.Show("These are the TPLs required by your icon.brlyt:\n\n" +
string.Join("\n", brlytTpls), "TPLs specified in icon.brlyt", MessageBoxButtons.OK, string.Join("\n", brlytTpls), "TPLs specified in icon.brlyt", MessageBoxButtons.OK,
@ -2489,7 +2245,7 @@ namespace CustomizeMii
} }
else else
{ {
if (MessageBox.Show("You don't have the ForwardMii.dll in your application folder.\nYou can download it on the project page, do you want the page to be opened?", "Plugin not availabe", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) if (MessageBox.Show("You don't have the ForwardMii.dll in your application folder.\nYou can download it on the project page, do you want the page to be opened?", "Plugin not available", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
{ {
Process.Start("http://code.google.com/p/customizemii/downloads/list"); Process.Start("http://code.google.com/p/customizemii/downloads/list");
} }
@ -2504,7 +2260,21 @@ namespace CustomizeMii
if (cmSender == cmSimpleForwarder) if (cmSender == cmSimpleForwarder)
ForwarderDialogSimple(); ForwarderDialogSimple();
else else
ForwarderDialogComplex(); {
try
{
if (double.Parse(GetForwardMiiVersion()) < 1.1)
{
ErrorBox("Version 1.1 or higher of the ForwardMii.dll is required!");
return;
}
ForwarderDialogComplex();
}
catch (Exception ex)
{
ErrorBox(ex.Message);
}
}
} }
private void btnOptionsExtract_Click(object sender, EventArgs e) private void btnOptionsExtract_Click(object sender, EventArgs e)
@ -2913,12 +2683,24 @@ namespace CustomizeMii
tbGerman.Text = tempText.Remove(startIndex, 7).Insert(startIndex, "Kanal"); tbGerman.Text = tempText.Remove(startIndex, 7).Insert(startIndex, "Kanal");
tbDutch.Text = tempText.Remove(startIndex, 7).Insert(startIndex, "Kanaal"); tbDutch.Text = tempText.Remove(startIndex, 7).Insert(startIndex, "Kanaal");
if (tempText[startIndex - 1] != ' ') tbFrench.Text = tempText.Remove(startIndex, 7).Insert(0, "Chaîne "); try
else tbFrench.Text = tempText.Remove(startIndex - 1, 8).Insert(0, "Chaîne "); {
if (tempText[startIndex - 1] != ' ') tbSpanish.Text = tempText.Remove(startIndex, 7).Insert(0, "Canal "); if (tempText[startIndex - 1] != ' ') tbFrench.Text = tempText.Remove(startIndex, 7).Insert(0, "Chaîne ");
else tbSpanish.Text = tempText.Remove(startIndex - 1, 8).Insert(0, "Canal "); else tbFrench.Text = tempText.Remove(startIndex - 1, 8).Insert(0, "Chaîne ");
if (tempText[startIndex - 1] != ' ') tbItalian.Text = tempText.Remove(startIndex, 7).Insert(0, "Canale "); }
else tbItalian.Text = tempText.Remove(startIndex - 1, 8).Insert(0, "Canale "); catch { tbFrench.Text = tempText.Remove(startIndex, 7).Insert(0, "Chaîne"); }
try
{
if (tempText[startIndex - 1] != ' ') tbSpanish.Text = tempText.Remove(startIndex, 7).Insert(0, "Canal ");
else tbSpanish.Text = tempText.Remove(startIndex - 1, 8).Insert(0, "Canal ");
}
catch { tbSpanish.Text = tempText.Remove(startIndex, 7).Insert(0, "Canal"); }
try
{
if (tempText[startIndex - 1] != ' ') tbItalian.Text = tempText.Remove(startIndex, 7).Insert(0, "Canale ");
else tbItalian.Text = tempText.Remove(startIndex - 1, 8).Insert(0, "Canale ");
}
catch { tbItalian.Text = tempText.Remove(startIndex, 7).Insert(0, "Canale"); }
tbAllLanguages.Text = string.Empty; tbAllLanguages.Text = string.Empty;
} }
@ -2937,5 +2719,10 @@ namespace CustomizeMii
ErrorBox(ex.Message); ErrorBox(ex.Message);
} }
} }
private void tbAllLanguages_TextChanged(object sender, EventArgs e)
{
llbTranslateChannel.Enabled = tbAllLanguages.Text.ToLower().Contains("channel");
}
} }
} }

View File

@ -120,6 +120,7 @@
<data name="lbCreditThanks.Text" xml:space="preserve"> <data name="lbCreditThanks.Text" xml:space="preserve">
<value>Thanks: <value>Thanks:
Xuzz for his idea and hard work Xuzz for his idea and hard work
WiiCrazy / I.R.on for CustomizeMii Installer
Xuzz, SquidMan, megazig, Matt_P, Omega and The Lemon Man for Wii.py Xuzz, SquidMan, megazig, Matt_P, Omega and The Lemon Man for Wii.py
SquidMan for Zetsubou SquidMan for Zetsubou
Andre Perrot for gbalzss Andre Perrot for gbalzss

View File

@ -26,6 +26,7 @@ namespace CustomizeMii
{ {
public string startTPL; public string startTPL;
public bool startIcon = false; public bool startIcon = false;
private Image[,] images;
public CustomizeMii_Preview() public CustomizeMii_Preview()
{ {
@ -87,6 +88,11 @@ namespace CustomizeMii
cbIcon.Items.Add((object)picname); cbIcon.Items.Add((object)picname);
} }
if (bannerpics.Length > iconpics.Length)
images = new Image[2, bannerpics.Length];
else
images = new Image[2, iconpics.Length];
try try
{ {
if (startIndex != -1) if (startIndex != -1)
@ -105,19 +111,35 @@ namespace CustomizeMii
{ {
if (cbBanner.SelectedIndex != -1) if (cbBanner.SelectedIndex != -1)
{ {
byte[] tpl; //byte[] tpl;
if (string.IsNullOrEmpty(CustomizeMii_Main.BannerReplace)) //if (string.IsNullOrEmpty(CustomizeMii_Main.BannerReplace))
tpl = Wii.Tools.LoadFileToByteArray(CustomizeMii_Main.TempUnpackBannerTplPath + cbBanner.SelectedItem.ToString() + ".tpl"); // tpl = Wii.Tools.LoadFileToByteArray(CustomizeMii_Main.TempUnpackBannerTplPath + cbBanner.SelectedItem.ToString() + ".tpl");
else tpl = Wii.Tools.LoadFileToByteArray(CustomizeMii_Main.BannerTplPath + cbBanner.SelectedItem.ToString() + ".tpl"); //else tpl = Wii.Tools.LoadFileToByteArray(CustomizeMii_Main.BannerTplPath + cbBanner.SelectedItem.ToString() + ".tpl");
lbSize.Text = Wii.TPL.GetTextureWidth(tpl).ToString() + " x " + Wii.TPL.GetTextureHeight(tpl).ToString(); //lbSize.Text = Wii.TPL.GetTextureWidth(tpl).ToString() + " x " + Wii.TPL.GetTextureHeight(tpl).ToString();
lbFormat.Text = Wii.TPL.GetTextureFormatName(tpl); //lbFormat.Text = Wii.TPL.GetTextureFormatName(tpl);
Image tmpImg = Wii.TPL.ConvertFromTPL(tpl); //Image tmpImg = Wii.TPL.ConvertFromTPL(tpl);
pbPic.Image = tmpImg; //pbPic.Image = tmpImg;
cbIcon.SelectedIndex = -1; //cbIcon.SelectedIndex = -1;
if (images[0, cbBanner.SelectedIndex] == null)
{
byte[] tpl;
if (string.IsNullOrEmpty(CustomizeMii_Main.BannerReplace))
tpl = Wii.Tools.LoadFileToByteArray(CustomizeMii_Main.TempUnpackBannerTplPath + cbBanner.SelectedItem.ToString() + ".tpl");
else tpl = Wii.Tools.LoadFileToByteArray(CustomizeMii_Main.BannerTplPath + cbBanner.SelectedItem.ToString() + ".tpl");
lbSize.Text = Wii.TPL.GetTextureWidth(tpl).ToString() + " x " + Wii.TPL.GetTextureHeight(tpl).ToString();
lbFormat.Text = Wii.TPL.GetTextureFormatName(tpl);
images[0, cbBanner.SelectedIndex] = Wii.TPL.ConvertFromTPL(tpl);
}
pbPic.Image = images[0, cbBanner.SelectedIndex];
} }
} }
@ -125,19 +147,35 @@ namespace CustomizeMii
{ {
if (cbIcon.SelectedIndex != -1) if (cbIcon.SelectedIndex != -1)
{ {
byte[] tpl; //byte[] tpl;
if (string.IsNullOrEmpty(CustomizeMii_Main.IconReplace)) //if (string.IsNullOrEmpty(CustomizeMii_Main.IconReplace))
tpl = Wii.Tools.LoadFileToByteArray(CustomizeMii_Main.TempUnpackIconTplPath + cbIcon.SelectedItem.ToString() + ".tpl"); // tpl = Wii.Tools.LoadFileToByteArray(CustomizeMii_Main.TempUnpackIconTplPath + cbIcon.SelectedItem.ToString() + ".tpl");
else tpl = Wii.Tools.LoadFileToByteArray(CustomizeMii_Main.IconTplPath + cbIcon.SelectedItem.ToString() + ".tpl"); //else tpl = Wii.Tools.LoadFileToByteArray(CustomizeMii_Main.IconTplPath + cbIcon.SelectedItem.ToString() + ".tpl");
lbSize.Text = Wii.TPL.GetTextureWidth(tpl).ToString() + " x " + Wii.TPL.GetTextureHeight(tpl).ToString();
lbFormat.Text = Wii.TPL.GetTextureFormatName(tpl);
Image tmpImg = Wii.TPL.ConvertFromTPL(tpl); //lbSize.Text = Wii.TPL.GetTextureWidth(tpl).ToString() + " x " + Wii.TPL.GetTextureHeight(tpl).ToString();
pbPic.Image = tmpImg; //lbFormat.Text = Wii.TPL.GetTextureFormatName(tpl);
cbBanner.SelectedIndex = -1; //Image tmpImg = Wii.TPL.ConvertFromTPL(tpl);
//pbPic.Image = tmpImg;
//cbBanner.SelectedIndex = -1;
if (images[1, cbIcon.SelectedIndex] == null)
{
byte[] tpl;
if (string.IsNullOrEmpty(CustomizeMii_Main.IconReplace))
tpl = Wii.Tools.LoadFileToByteArray(CustomizeMii_Main.TempUnpackIconTplPath + cbIcon.SelectedItem.ToString() + ".tpl");
else tpl = Wii.Tools.LoadFileToByteArray(CustomizeMii_Main.IconTplPath + cbIcon.SelectedItem.ToString() + ".tpl");
lbSize.Text = Wii.TPL.GetTextureWidth(tpl).ToString() + " x " + Wii.TPL.GetTextureHeight(tpl).ToString();
lbFormat.Text = Wii.TPL.GetTextureFormatName(tpl);
images[1, cbIcon.SelectedIndex] = Wii.TPL.ConvertFromTPL(tpl);
}
pbPic.Image = images[1, cbIcon.SelectedIndex];
} }
} }

View File

@ -16,15 +16,306 @@
*/ */
using System; using System;
using System.Windows.Forms; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.IO;
using System.Drawing; using System.Drawing;
using System.IO;
using System.Text.RegularExpressions;
using System.Windows.Forms;
namespace CustomizeMii namespace CustomizeMii
{ {
partial class CustomizeMii_Main partial class CustomizeMii_Main
{ {
private bool FailureCheck()
{
try
{
currentProgress.progressValue = 100;
currentProgress.progressState = "Error Checks...";
this.Invoke(ProgressUpdate);
//Check Unpack Folder
if (CheckUnpackFolder() == false)
{
if (UnpackFolderErrorCount > 0)
{
ErrorBox("Something's wrong with the temporary files.\nYou may have to start again." +
"\n\nIf this message keeps bothering you, please report as much information " +
"as possible at the issue tracker: http://code.google.com/p/customizemii/issues/list");
}
else
{
ErrorBox("Something's wrong with the temporary files.\nYou may have to start again.");
}
UnpackFolderErrorCount++;
return false;
}
//Check Channel Title Boxes
if (!(!string.IsNullOrEmpty(tbAllLanguages.Text) ||
(!string.IsNullOrEmpty(tbEnglish.Text) &&
!string.IsNullOrEmpty(tbJapanese.Text) &&
!string.IsNullOrEmpty(tbGerman.Text) &&
!string.IsNullOrEmpty(tbFrench.Text) &&
!string.IsNullOrEmpty(tbSpanish.Text) &&
!string.IsNullOrEmpty(tbItalian.Text) &&
!string.IsNullOrEmpty(tbDutch.Text))))
{
ErrorBox("You must either enter a general Channel Title or one for each language!");
return false;
}
//Check Title ID Length + Chars
if (tbTitleID.Text.Length != 4)
{
ErrorBox("The Title ID must be 4 characters long!"); return false;
}
Regex allowedchars = new Regex("[A-Z0-9]{4}$");
if (!allowedchars.IsMatch(tbTitleID.Text.ToUpper()))
{
ErrorBox("Please enter a valid Title ID!"); return false;
}
//Check brlan files
string[] ValidBrlans = new string[] { "banner.brlan", "icon.brlan", "banner_loop.brlan", "icon_loop.brlan", "banner_start.brlan", "icon_start.brlan" };
foreach (string thisBrlan in lbxBrlanBanner.Items)
{
if (!Wii.Tools.StringExistsInStringArray(thisBrlan.ToLower(), ValidBrlans))
{
ErrorBox(thisBrlan + " is not a valid brlan filename!");
return false;
}
}
foreach (string thisBrlan in lbxBrlanIcon.Items)
{
if (!Wii.Tools.StringExistsInStringArray(thisBrlan.ToLower(), ValidBrlans))
{
ErrorBox(thisBrlan + " is not a valid brlan filename!");
return false;
}
}
//Check TPLs
List<string> BannerTpls = new List<string>();
List<string> IconTpls = new List<string>();
foreach (string thisTpl in lbxBannerTpls.Items) BannerTpls.Add(thisTpl.Replace(" (Transparent)", string.Empty));
foreach (string thisTpl in lbxIconTpls.Items) IconTpls.Add(thisTpl.Replace(" (Transparent)", string.Empty));
string[] BannerBrlytPath;
string[] BannerBrlanPath;
string[] IconBrlytPath;
string[] IconBrlanPath;
if (string.IsNullOrEmpty(BannerReplace))
{
BannerBrlytPath = Directory.GetFiles(TempUnpackBannerBrlytPath);
BannerBrlanPath = Directory.GetFiles(TempUnpackBannerBrlanPath);
}
else
{
BannerBrlytPath = Directory.GetFiles(TempBannerPath + "arc\\blyt");
BannerBrlanPath = Directory.GetFiles(TempBannerPath + "arc\\anim");
}
if (string.IsNullOrEmpty(IconReplace))
{
IconBrlytPath = Directory.GetFiles(TempUnpackIconBrlytPath);
IconBrlanPath = Directory.GetFiles(TempUnpackIconBrlanPath);
}
else
{
IconBrlytPath = Directory.GetFiles(TempIconPath + "arc\\blyt");
IconBrlanPath = Directory.GetFiles(TempIconPath + "arc\\anim");
}
string[] BannerMissing;
string[] BannerUnused;
string[] IconMissing;
string[] IconUnused;
//Check for missing TPLs
if (Wii.Brlyt.CheckForMissingTpls(BannerBrlytPath[0], BannerBrlanPath[0], BannerTpls.ToArray(), out BannerMissing) == true)
{
ErrorBox("The following Banner TPLs are required by the banner.brlyt, but missing:\n\n" + string.Join("\n", BannerMissing));
return false;
}
if (Wii.Brlyt.CheckForMissingTpls(IconBrlytPath[0], IconBrlanPath[0], IconTpls.ToArray(), out IconMissing) == true)
{
ErrorBox("The following Icon TPLs are required by the icon.brlyt, but missing:\n\n" + string.Join("\n", IconMissing));
return false;
}
//Check Sound length
int soundLength = 0;
if (!string.IsNullOrEmpty(tbSound.Text) && string.IsNullOrEmpty(SoundReplace))
{
if (!tbSound.Text.ToLower().EndsWith(".bns") && !tbSound.Text.StartsWith("BNS:"))
{
string SoundFile = tbSound.Text;
if (tbSound.Text.ToLower().EndsWith(".mp3")) SoundFile = TempWavePath;
soundLength = Wii.Sound.GetWaveLength(SoundFile);
if (soundLength > SoundMaxLength)
{
ErrorBox(string.Format("Your Sound is longer than {0} seconds and thus not supported.\nIt is recommended to use a Sound shorter than {1} seconds, the maximum length is {0} seconds!", SoundMaxLength, SoundWarningLength));
return false;
}
}
}
/*Errors till here..
From here only Warnings!*/
if (soundLength > SoundWarningLength)
{
if (MessageBox.Show(string.Format("Your Sound is longer than {0} seconds.\nIt is recommended to use Sounds that are shorter than {0} seconds!\nDo you still want to continue?", SoundWarningLength), "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
return false;
}
//Check BNS sound length
if (tbSound.Text.StartsWith("BNS:") || tbSound.Text.ToLower().EndsWith(".bns"))
{
string bnsFile = tbSound.Text;
if (tbSound.Text.StartsWith("BNS:")) bnsFile = TempBnsPath;
int bnsLength = Wii.Sound.GetBnsLength(bnsFile);
if (bnsLength > BnsWarningLength)
{
if (MessageBox.Show(string.Format("Your BNS Sound is longer than {0} seconds.\nIt is recommended to use Sounds that are shorter than {0} seconds!\nDo you still want to continue?", BnsWarningLength), "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
return false;
}
}
//Check if brlyt or brlan were changed
if (BrlytChanged == true && BrlanChanged == false)
{
if (MessageBox.Show("You have changed the brlyt, but didn't change the brlan.\nAre you sure this is correct?", "brlyt Changed", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
return false;
}
else if (BrlanChanged == true && BrlytChanged == false)
{
if (MessageBox.Show("You have changed the brlan, but didn't change the brlyt.\nAre you sure this is correct?", "brlan Changed", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
return false;
}
//Check for unused TPLs (Do this at the end of the failure checks, because we don't want a
// MessageBox asking if unused TPLs should be deleted and after that any error)
if (Wii.Brlyt.CheckForUnusedTpls(BannerBrlytPath[0], BannerBrlanPath[0], BannerTpls.ToArray(), out BannerUnused) == true)
{
DialogResult dlgresult = MessageBox.Show(
"The following Banner TPLs are unused by the banner.brlyt:\n\n" +
string.Join("\n", BannerUnused) +
"\n\nDo you want them to be deleted before the WAD is being created? (Saves space!)",
"Delete unused TPLs?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
if (dlgresult == DialogResult.Yes)
{
foreach (string thisTpl in BannerUnused)
{
if (string.IsNullOrEmpty(BannerReplace))
File.Delete(TempUnpackBannerTplPath + thisTpl);
else
File.Delete(TempBannerPath + "arc\\timg\\" + thisTpl);
}
}
else if (dlgresult == DialogResult.Cancel) return false;
}
if (Wii.Brlyt.CheckForUnusedTpls(IconBrlytPath[0], IconBrlanPath[0], IconTpls.ToArray(), out IconUnused) == true)
{
DialogResult dlgresult = MessageBox.Show(
"The following Icon TPLs are unused by the icon.brlyt:\n\n" +
string.Join("\n", IconUnused) +
"\n\nDo you want them to be deleted before the WAD is being created? (Saves memory!)",
"Delete unused TPLs?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
if (dlgresult == DialogResult.Yes)
{
foreach (string thisTpl in IconUnused)
{
if (string.IsNullOrEmpty(IconReplace))
File.Delete(TempUnpackIconTplPath + thisTpl);
else
File.Delete(TempIconPath + "arc\\timg\\" + thisTpl);
}
}
else if (dlgresult == DialogResult.Cancel) return false;
}
currentProgress.progressState = " ";
currentProgress.progressValue = 100;
this.Invoke(ProgressUpdate);
return true;
}
catch (Exception ex)
{
ErrorBox(ex.Message);
return false;
}
}
private void ForwarderDialogSimple()
{
CustomizeMii_InputBox ib = new CustomizeMii_InputBox(false);
ib.Size = new Size(ib.Size.Width, 120);
ib.lbInfo.Text = "Enter the application folder where the forwarder will point to (3-18 chars)";
ib.tbInput.MaxLength = 18;
ib.btnExit.Text = "Cancel";
ib.cbElf.Visible = true;
ib.tbInput.Text = SimpleForwarder.AppFolder;
ib.cbElf.Checked = SimpleForwarder.ForwardToElf;
if (ib.ShowDialog() == DialogResult.OK)
{
SimpleForwarder.ForwardToElf = ib.cbElf.Checked;
SimpleForwarder.AppFolder = ib.Input;
SetText(tbDol, string.Format("Simple Forwarder: \"SD:\\apps\\{0}\\boot.{1}\"",
SimpleForwarder.AppFolder, SimpleForwarder.ForwardToElf == true ? "elf" : "dol"));
btnBrowseDol.Text = "Clear";
}
}
private void ForwarderDialogComplex()
{
CustomizeMii_ComplexForwarder cf = new CustomizeMii_ComplexForwarder();
cf.tb1.Text = ComplexForwarder.Path1;
cf.tb2.Text = ComplexForwarder.Path2;
cf.tb3.Text = ComplexForwarder.Path3;
cf.tb4.Text = ComplexForwarder.Path4;
if (!string.IsNullOrEmpty(ComplexForwarder.Image43))
{
cf.cbImage43.Checked = true;
cf.tbImage43.Enabled = true;
cf.btnBrowseImage43.Enabled = true;
cf.tbImage43.Text = ComplexForwarder.Image43;
}
if (!string.IsNullOrEmpty(ComplexForwarder.Image169))
{
cf.cbImage169.Checked = true;
cf.tbImage169.Enabled = true;
cf.btnBrowseImage169.Enabled = true;
cf.tbImage169.Text = ComplexForwarder.Image169;
}
if (cf.ShowDialog() == DialogResult.OK)
{
ComplexForwarder.Path1 = cf.tb1.Text;
ComplexForwarder.Path2 = cf.tb2.Text;
ComplexForwarder.Path3 = cf.tb3.Text;
ComplexForwarder.Path4 = cf.tb4.Text;
ComplexForwarder.Image43 = cf.tbImage43.Text;
ComplexForwarder.Image169 = cf.tbImage169.Text;
SetText(tbDol, string.Format("Complex Forwarder"));
btnBrowseDol.Text = "Clear";
}
}
private void FixTpls() private void FixTpls()
{ {
string[] bannerTpls = Directory.GetFiles(GetCurBannerPath() + "timg\\", "*.tpl"); string[] bannerTpls = Directory.GetFiles(GetCurBannerPath() + "timg\\", "*.tpl");
@ -49,7 +340,7 @@ namespace CustomizeMii
else if ((Ctrl is TextBox) && (Ctrl.Tag != (object)"Disabled")) Ctrl.Enabled = true; else if ((Ctrl is TextBox) && (Ctrl.Tag != (object)"Disabled")) Ctrl.Enabled = true;
else if (Ctrl is CheckBox && Ctrl.Tag != (object)"Independent") Ctrl.Enabled = true; else if (Ctrl is CheckBox && Ctrl.Tag != (object)"Independent") Ctrl.Enabled = true;
else if (Ctrl is ComboBox) Ctrl.Enabled = true; else if (Ctrl is ComboBox) Ctrl.Enabled = true;
else if (Ctrl is LinkLabel && Ctrl.Tag != (object)"Independent") Ctrl.Enabled = true; //else if (Ctrl is LinkLabel && Ctrl.Tag != (object)"Independent") Ctrl.Enabled = true;
} }
} }
} }
@ -67,7 +358,7 @@ namespace CustomizeMii
else if ((Ctrl is TextBox) && (Ctrl.Tag != (object)"Disabled")) Ctrl.Enabled = false; else if ((Ctrl is TextBox) && (Ctrl.Tag != (object)"Disabled")) Ctrl.Enabled = false;
else if (Ctrl is CheckBox && Ctrl.Tag != (object)"Independent") Ctrl.Enabled = false; else if (Ctrl is CheckBox && Ctrl.Tag != (object)"Independent") Ctrl.Enabled = false;
else if (Ctrl is ComboBox) Ctrl.Enabled = false; else if (Ctrl is ComboBox) Ctrl.Enabled = false;
else if (Ctrl is LinkLabel && Ctrl.Tag != (object)"Independent") Ctrl.Enabled = false; //else if (Ctrl is LinkLabel && Ctrl.Tag != (object)"Independent") Ctrl.Enabled = false;
} }
} }
} }
@ -384,7 +675,8 @@ namespace CustomizeMii
if (lbx == lbxBannerTpls) CurPath = GetCurBannerPath(); if (lbx == lbxBannerTpls) CurPath = GetCurBannerPath();
else CurPath = GetCurIconPath(); else CurPath = GetCurIconPath();
string[] brlytTpls = Wii.Brlyt.GetBrlytTpls(CurPath + string.Format("blyt\\{0}.brlyt", lbx == lbxBannerTpls ? "banner" : "icon")); string[] brlytTpls = Wii.Brlyt.GetBrlytTpls(CurPath + string.Format("blyt\\{0}.brlyt", lbx == lbxBannerTpls ? "banner" : "icon"),
CurPath + string.Format("anim\\{0}.brlan", lbx == lbxBannerTpls ? (File.Exists(CurPath + "anim\\banner.brlan")) ? "banner" : "banner_loop" : "icon"));
string TplName = Path.GetFileNameWithoutExtension(inputFile) + ".tpl"; string TplName = Path.GetFileNameWithoutExtension(inputFile) + ".tpl";
int TplFormat = 6; int TplFormat = 6;

View File

@ -69,8 +69,8 @@ namespace CustomizeMii
this.cmbProtocol.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cmbProtocol.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbProtocol.FormattingEnabled = true; this.cmbProtocol.FormattingEnabled = true;
this.cmbProtocol.Items.AddRange(new object[] { this.cmbProtocol.Items.AddRange(new object[] {
"Homebrewchannel 1.0.5+ (JODI)", "Homebrew Channel 1.0.5+ (JODI)",
"Homebrewchannel -1.0.4 (HAXX)"}); "Homebrew Channel -1.0.4 (HAXX)"});
this.cmbProtocol.Location = new System.Drawing.Point(67, 13); this.cmbProtocol.Location = new System.Drawing.Point(67, 13);
this.cmbProtocol.Name = "cmbProtocol"; this.cmbProtocol.Name = "cmbProtocol";
this.cmbProtocol.Size = new System.Drawing.Size(194, 21); this.cmbProtocol.Size = new System.Drawing.Size(194, 21);

View File

@ -29,11 +29,12 @@ namespace CustomizeMii
public CustomizeMii_Transmit() public CustomizeMii_Transmit()
{ {
InitializeComponent(); InitializeComponent();
this.CenterToParent();
} }
private void CustomizeMii_Transmit_Load(object sender, System.EventArgs e) private void CustomizeMii_Transmit_Load(object sender, System.EventArgs e)
{ {
this.CenterToParent();
try try
{ {
cmbProtocol.SelectedIndex = Properties.Settings.Default.Protocol; cmbProtocol.SelectedIndex = Properties.Settings.Default.Protocol;

View File

@ -39,9 +39,11 @@ CHANNEL INFORMATION
You may want to change the channel information, i.e. the title and ID. You may want to change the channel information, i.e. the title and ID.
Let's change the channel title first. It's the text that will be displayed when you hold your cursor Let's change the channel title first. It's the text that will be displayed when you hold your cursor
over the channel. Goto the "Title" tab and fill a title for all languages. If you want to change the over the channel. Goto the "Title" tab and enter a title for all languages. If you want to change the
title for a specific language, just use the language's textbox. If you want a different title for every title for a specific language, just use the language's textbox. If you want a different title for every
language, you don't need to fill in a title for all languages. language, you don't need to fill in a title for all languages.
You may also use the translate "Channel" button. Enter the english name in the all languages textbox
(e.g. "MPlayer Channel"). Click translate and it will be automatically translated to each language.
Now, the title ID. Open the "Options" tab and you'll see a textbox for the ID. The ID is 4 characters long Now, the title ID. Open the "Options" tab and you'll see a textbox for the ID. The ID is 4 characters long
and only contains letters and numerics. Lower case letters will automatically converted to upper case. and only contains letters and numerics. Lower case letters will automatically converted to upper case.
Change it to a unique(!) ID, because channels will overwrite existing channles with the same ID! Change it to a unique(!) ID, because channels will overwrite existing channles with the same ID!
@ -120,15 +122,17 @@ That's it, here's nothing left to do.
CREATING THE WAD CREATING THE WAD (OR SENDING IT TO THE WII)
Well, your channel should be ready to be created. Well, your channel should be ready to be created.
Goto the "Options" tab and check the Lz77 checkbox, if you want to compress your channel to safe some Wii memory. Just click on the create WAD button.
If your channel doesn't work, first try it again without compression.
Now just click on the create WAD button (The big one with the different text each startup).
CustomizeMii will do some failure checks and if all went fine, a save dialog will pop up. CustomizeMii will do some failure checks and if all went fine, a save dialog will pop up.
If you get an error or warning, read the message carefully. It should give you enough information to fix If you get an error or warning, read the message carefully. It should give you enough information to fix
the problem yourself. the problem yourself.
You can also send the Channel directly to the Wii. For it to work, the Channel must be less than 4 MB of space.
Make sure the Homebrew Channel is running and connected. Click the send WAD button. Choose a protocol
and enter your Wii's IP and the IOS to use for installation. Click on transmit to start the creation and
transmission process. After the channel was sent, you will be asked if you want to save the Channel.
So, if you got down to here, you're done by now. Please, if you find any bugs or have suggestions, take some So, if you got down to here, you're done by now. Please, if you find any bugs or have suggestions, take some
seconds to report them at the issue tracker: http://code.google.com/p/customizemii/issues/list seconds to report them at the issue tracker: http://code.google.com/p/customizemii/issues/list

View File

@ -24,7 +24,7 @@ using System.Resources;
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, // Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die mit einer Assembly verknüpft sind. // die mit einer Assembly verknüpft sind.
[assembly: AssemblyTitle("CustomizeMii")] [assembly: AssemblyTitle("CustomizeMii")]
[assembly: AssemblyDescription("CustomizeMii is a custom channel creator for the Wii")] [assembly: AssemblyDescription("A custom channel creator for the Wii")]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CustomizeMii")] [assembly: AssemblyProduct("CustomizeMii")]

View File

@ -17,7 +17,11 @@ Version 2.1
- Added drag & drop ability cause the file dialogs kept bothering me - Added drag & drop ability cause the file dialogs kept bothering me
- Improvement in startup speed (thanks shadow1643) - Improvement in startup speed (thanks shadow1643)
- Added creation/last edited time (only for CustomizeMii 2.1+ channels) - Added creation/last edited time (only for CustomizeMii 2.1+ channels)
- Added a button to translate the word "Channel" to every language
- Improved detection of required TPLs
- Little improvements and fixes - Little improvements and fixes
- Changed the complex forwarder to be more configurable (choose any path you want)
- ForwardMii is now bundled with CustomizeMii
Version 2.01 Version 2.01
- Base WAD downloading works again - Base WAD downloading works again
@ -71,8 +75,8 @@ The author can't be held responsible for any damages arising from the use of it.
----------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------
Thanks: Thanks:
WiiCrazy / I.R.on for CustomizeMii Installer
Xuzz for his idea and hard work Xuzz for his idea and hard work
WiiCrazy / I.R.on for CustomizeMii Installer
Xuzz, SquidMan, megazig, Matt_P, Omega and The Lemon Man for Wii.py Xuzz, SquidMan, megazig, Matt_P, Omega and The Lemon Man for Wii.py
SquidMan for Zetsubou SquidMan for Zetsubou
Andre Perrot for gbalzss Andre Perrot for gbalzss

View File

@ -41,17 +41,15 @@ banner/icon/sound of WAD A!\par
\par \par
You may want to change the channel information, i.e. the title and ID.\par You may want to change the channel information, i.e. the title and ID.\par
Let's change the channel title first. It's the text that will be displayed when you hold your cursor\par Let's change the channel title first. It's the text that will be displayed when you hold your cursor\par
over the channel. Goto the "Title" tab and fill a title for all languages. If you want to change the\par over the channel. Goto the "Title" tab and enter a title for all languages. If you want to change the\par
title for a specific language, just use the language's textbox. If you want a different title for every\par title for a specific language, just use the language's textbox. If you want a different title for every\par
language, you don't need to fill in a title for all languages.\par language, you don't need to fill in a title for all languages.\par
You may also use the translate "Channel" button. Enter the english name in the all languages textbox\par
(e.g. "MPlayer Channel"). Click translate and it will be automatically translated to each language.\par
Now, the title ID. Open the "Options" tab and you'll see a textbox for the ID. The ID is 4 characters long\par Now, the title ID. Open the "Options" tab and you'll see a textbox for the ID. The ID is 4 characters long\par
and only contains letters and numerics. Lower case letters will automatically converted to upper case.\par and only contains letters and numerics. Lower case letters will automatically converted to upper case.\par
Change it to a unique(!) ID, because channels will overwrite existing channles with the same ID!\par Change it to a unique(!) ID, because channels will overwrite existing channles with the same ID!\par
\par \par
I recommend not to use any title ID beginning with the following characters, because official channels\par
use these and thus your channel may overwrite them:\par
C, E, F, H, J, L, M, N, P, Q, W\par
\par
\par \par
\par \par
\b INSERTING A NEW DOL\b0\par \b INSERTING A NEW DOL\b0\par
@ -125,12 +123,14 @@ That's it, here's nothing left to do.\par
\b CREATING THE WAD\b0\par \b CREATING THE WAD\b0\par
\par \par
Well, your channel should be ready to be created.\par Well, your channel should be ready to be created.\par
Goto the "Options" tab and check the Lz77 checkbox, if you want to compress your channel to safe some Wii memory.\par Just click on the create WAD button.\par
If your channel doesn't work, first try it again without compression.\par
Now just click on the create WAD button (The big one with the different text each startup).\par
CustomizeMii will do some failure checks and if all went fine, a save dialog will pop up.\par CustomizeMii will do some failure checks and if all went fine, a save dialog will pop up.\par
If you get an error or warning, read the message carefully. It should give you enough information to fix\par If you get an error or warning, read the message carefully. It should give you enough information to fix\par
the problem yourself.\par the problem yourself.\par
You can also send the Channel directly to the Wii. For it to work, the Channel must be less than 4 MB of space.\par
Make sure the Homebrew Channel is running and connected. Click the send WAD button. Choose a protocol\par
and enter your Wii's IP and the IOS to use for installation. Click on transmit to start the creation and\par
transmission process. After the channel was sent, you will be asked if you want to save the Channel.\par
\par \par
So, if you got down to here, you're done by now. Please, if you find any bugs or have suggestions, take some\par So, if you got down to here, you're done by now. Please, if you find any bugs or have suggestions, take some\par
seconds to report them at the issue tracker: {\field{\*\fldinst{HYPERLINK "http://code.google.com/p/customizemii/issues/list"}}{\fldrslt{\ul\cf2 http://code.google.com/p/customizemii/issues/list}}}\lang7\i\f0\fs17\par seconds to report them at the issue tracker: {\field{\*\fldinst{HYPERLINK "http://code.google.com/p/customizemii/issues/list"}}{\fldrslt{\ul\cf2 http://code.google.com/p/customizemii/issues/list}}}\lang7\i\f0\fs17\par

View File

@ -5615,10 +5615,11 @@ namespace Wii
/// <param name="tpls"></param> /// <param name="tpls"></param>
/// <param name="missingtpls"></param> /// <param name="missingtpls"></param>
/// <returns></returns> /// <returns></returns>
public static bool CheckForMissingTpls(string brlyt, string[] tpls, out string[] missingtpls) public static bool CheckForMissingTpls(string brlyt, string brlan, string[] tpls, out string[] missingtpls)
{ {
byte[] brlytArray = Tools.LoadFileToByteArray(brlyt); byte[] brlytArray = Tools.LoadFileToByteArray(brlyt);
return CheckForMissingTpls(brlytArray, tpls, out missingtpls); byte[] brlanArray = Tools.LoadFileToByteArray(brlan);
return CheckForMissingTpls(brlytArray, brlanArray, tpls, out missingtpls);
} }
/// <summary> /// <summary>
@ -5629,10 +5630,10 @@ namespace Wii
/// <param name="tpls"></param> /// <param name="tpls"></param>
/// <param name="missingtpls"></param> /// <param name="missingtpls"></param>
/// <returns></returns> /// <returns></returns>
public static bool CheckForMissingTpls(byte[] brlyt, string[] tpls, out string[] missingtpls) public static bool CheckForMissingTpls(byte[] brlyt, byte[] brlan, string[] tpls, out string[] missingtpls)
{ {
List<string> missings = new List<string>(); List<string> missings = new List<string>();
string[] brlytTpls = GetBrlytTpls(brlyt); string[] brlytTpls = GetBrlytTpls(brlyt, brlan);
bool missing = false; bool missing = false;
for (int i = 0; i < brlytTpls.Length; i++) for (int i = 0; i < brlytTpls.Length; i++)
@ -5656,10 +5657,11 @@ namespace Wii
/// <param name="tpls"></param> /// <param name="tpls"></param>
/// <param name="unusedtpls"></param> /// <param name="unusedtpls"></param>
/// <returns></returns> /// <returns></returns>
public static bool CheckForUnusedTpls(string brlyt, string[] tpls, out string[] unusedtpls) public static bool CheckForUnusedTpls(string brlyt, string brlan, string[] tpls, out string[] unusedtpls)
{ {
byte[] brlytArray = Tools.LoadFileToByteArray(brlyt); byte[] brlytArray = Tools.LoadFileToByteArray(brlyt);
return CheckForUnusedTpls(brlytArray, tpls, out unusedtpls); byte[] brlanArray = Tools.LoadFileToByteArray(brlan);
return CheckForUnusedTpls(brlytArray, brlanArray, tpls, out unusedtpls);
} }
/// <summary> /// <summary>
@ -5670,10 +5672,10 @@ namespace Wii
/// <param name="tpls"></param> /// <param name="tpls"></param>
/// <param name="unusedtpls"></param> /// <param name="unusedtpls"></param>
/// <returns></returns> /// <returns></returns>
public static bool CheckForUnusedTpls(byte[] brlyt, string[] tpls, out string[] unusedtpls) public static bool CheckForUnusedTpls(byte[] brlyt, byte[] brlan, string[] tpls, out string[] unusedtpls)
{ {
List<string> unuseds = new List<string>(); List<string> unuseds = new List<string>();
string[] brlytTpls = GetBrlytTpls(brlyt); string[] brlytTpls = GetBrlytTpls(brlyt, brlan);
bool missing = false; bool missing = false;
for (int i = 0; i < tpls.Length; i++) for (int i = 0; i < tpls.Length; i++)
@ -5705,10 +5707,11 @@ namespace Wii
/// </summary> /// </summary>
/// <param name="brlyt"></param> /// <param name="brlyt"></param>
/// <returns></returns> /// <returns></returns>
public static string[] GetBrlytTpls(string brlyt) public static string[] GetBrlytTpls(string brlyt, string brlan)
{ {
byte[] temp = Tools.LoadFileToByteArray(brlyt); byte[] temp = Tools.LoadFileToByteArray(brlyt);
return GetBrlytTpls(temp); byte[] temp2 = Tools.LoadFileToByteArray(brlan);
return GetBrlytTpls(temp, temp2);
} }
/// <summary> /// <summary>
@ -5716,7 +5719,7 @@ namespace Wii
/// </summary> /// </summary>
/// <param name="brlyt"></param> /// <param name="brlyt"></param>
/// <returns></returns> /// <returns></returns>
public static string[] GetBrlytTpls(byte[] brlyt) public static string[] GetBrlytTpls(byte[] brlyt, byte[] brlan)
{ {
int texcount = Tools.HexStringToInt(brlyt[44].ToString("x2") + brlyt[45].ToString("x2")); int texcount = Tools.HexStringToInt(brlyt[44].ToString("x2") + brlyt[45].ToString("x2"));
int texnamepos = 48 + (texcount * 8); int texnamepos = 48 + (texcount * 8);
@ -5734,9 +5737,71 @@ namespace Wii
texnamepos++; texnamepos++;
} }
//Lets also get brlan tpls (frame animations)
string[] brlanTpls = GetBrlanTpls(brlan);
foreach (string thisTpl in brlanTpls)
{
if (thisTpl.EndsWith(".tpl"))
{
if (!Tpls.Contains(thisTpl))
Tpls.Add(thisTpl);
}
}
return Tpls.ToArray(); return Tpls.ToArray();
} }
/// <summary>
/// Returns the name of all Tpls specified in the brlan
/// </summary>
/// <param name="brlyt"></param>
/// <returns></returns>
public static string[] GetBrlanTpls(string brlan)
{
byte[] temp = Tools.LoadFileToByteArray(brlan);
return GetBrlanTpls(temp);
}
/// <summary>
/// Returns the name of all Tpls specified in the brlan
/// </summary>
/// <param name="brlyt"></param>
/// <returns></returns>
public static string[] GetBrlanTpls(byte[] brlan)
{
List<string> tpls = new List<string>();
int texcount = Tools.HexStringToInt(brlan[28].ToString("x2") + brlan[29].ToString("x2"));
int pailen;
if (brlan[32] == 0x00 && brlan[33] == 0x00 && brlan[34] == 0x00 && brlan[35] == 0x00)
pailen = Tools.HexStringToInt(brlan[36].ToString("x2") + brlan[37].ToString("x2") + brlan[38].ToString("x2") + brlan[39].ToString("x2"));
else
pailen = Tools.HexStringToInt(brlan[32].ToString("x2") + brlan[33].ToString("x2") + brlan[34].ToString("x2") + brlan[35].ToString("x2"));
int texnameendpos = 16 + pailen;
for (int i = texnameendpos; i > 0; i--)
{
if (brlan[i] != 0x00)
{ texnameendpos = i + 1; break; }
}
for (int i = 0; i < texcount; i++)
{
List<char> thisTex = new List<char>();
while (brlan[texnameendpos] != 0x00)
{
thisTex.Add((char)brlan[texnameendpos--]);
}
thisTex.Reverse();
tpls.Add(new string(thisTex.ToArray()));
texnameendpos--;
}
tpls.Reverse();
return tpls.ToArray();
}
/// <summary> /// <summary>
/// Returns true, if the given Tpl is specified in the brlyt. /// Returns true, if the given Tpl is specified in the brlyt.
/// TplName must end with ".tpl"! /// TplName must end with ".tpl"!
@ -5744,9 +5809,9 @@ namespace Wii
/// <param name="brlyt"></param> /// <param name="brlyt"></param>
/// <param name="TplName"></param> /// <param name="TplName"></param>
/// <returns></returns> /// <returns></returns>
public static bool IsTplInBrlyt(byte[] brlyt, string TplName) public static bool IsTplInBrlyt(byte[] brlyt, byte[] brlan, string TplName)
{ {
string[] brlytTpls = GetBrlytTpls(brlyt); string[] brlytTpls = GetBrlytTpls(brlyt, brlan);
bool exists = Array.Exists(brlytTpls, Tpl => Tpl == TplName); bool exists = Array.Exists(brlytTpls, Tpl => Tpl == TplName);
return exists; return exists;
} }

View File

@ -22,6 +22,16 @@ using System.Security.Cryptography;
namespace CustomizeMiiInstaller namespace CustomizeMiiInstaller
{ {
public class CustomizeMiiInstaller_Plugin
{
const string version = "1.0";
public static string GetVersion()
{
return version;
}
}
public class InstallerHelper public class InstallerHelper
{ {
public static MemoryStream CreateInstaller(string wadFile, byte iosToUse) public static MemoryStream CreateInstaller(string wadFile, byte iosToUse)

View File

@ -21,7 +21,7 @@ namespace ForwardMii
{ {
public class ForwardMii_Plugin public class ForwardMii_Plugin
{ {
const string version = "1.02"; //Hint for myself: Never use a char in the Version (UpdateCheck)! const string version = "1.1"; //Hint for myself: Never use a char in the Version (UpdateCheck)!
public static string GetVersion() public static string GetVersion()
{ {

View File

@ -29,14 +29,16 @@ namespace ForwardMii
public class GXForwarder public class GXForwarder
{ {
private readonly string TempDir = Path.GetTempPath() + "ForwardMii_Temp\\" + Guid.NewGuid() + "\\"; private readonly string TempDir = Path.GetTempPath() + "ForwardMii_Temp\\" + Guid.NewGuid() + "\\";
private string thisAppFolder; private string path1;
private bool elfFirst = false; private string path2;
private bool usbFirst = false; private string path3;
private string path4;
private string image43; private string image43;
private string image169; private string image169;
public string AppFolder { get { return thisAppFolder; } set { thisAppFolder = value; } } public string Path1 { get { return path1; } set { path1 = value; } }
public bool ElfFirst { get { return elfFirst; } set { elfFirst = value; } } public string Path2 { get { return path2; } set { path2 = value; } }
public bool UsbFirst { get { return usbFirst; } set { usbFirst = value; } } public string Path3 { get { return path3; } set { path3 = value; } }
public string Path4 { get { return path4; } set { path4 = value; } }
public string Image43 { get { return image43; } set { image43 = value; } } public string Image43 { get { return image43; } set { image43 = value; } }
public string Image169 { get { return image169; } set { image169 = value; } } public string Image169 { get { return image169; } set { image169 = value; } }
@ -45,50 +47,32 @@ namespace ForwardMii
} }
public GXForwarder(string AppFolder) public GXForwarder(params string[] paths)
{ {
if (ForwardMii_Plugin.CheckDevKit() == false) throw new Exception("DevkitPro or one of it's components wasn't found!"); if (ForwardMii_Plugin.CheckDevKit() == false) throw new Exception("DevkitPro or one of it's components wasn't found!");
thisAppFolder = AppFolder; path1 = paths[0];
path2 = paths[1];
path3 = paths[2];
path4 = paths[3];
} }
public GXForwarder(string AppFolder, bool UsbFirst) public GXForwarder(string Image43, string Image169, params string[] paths)
{ {
if (ForwardMii_Plugin.CheckDevKit() == false) throw new Exception("DevkitPro or one of it's components wasn't found!"); if (ForwardMii_Plugin.CheckDevKit() == false) throw new Exception("DevkitPro or one of it's components wasn't found!");
thisAppFolder = AppFolder; path1 = paths[0];
usbFirst = UsbFirst; path2 = paths[1];
} path3 = paths[2];
path4 = paths[3];
public GXForwarder(string AppFolder, string Image43, string Image169)
{
if (ForwardMii_Plugin.CheckDevKit() == false) throw new Exception("DevkitPro or one of it's components wasn't found!");
thisAppFolder = AppFolder;
image43 = Image43; image43 = Image43;
image169 = Image169; image169 = Image169;
} }
public GXForwarder(string AppFolder, bool UsbFirst, bool ElfFirst)
{
if (ForwardMii_Plugin.CheckDevKit() == false) throw new Exception("DevkitPro or one of it's components wasn't found!");
thisAppFolder = AppFolder;
usbFirst = UsbFirst;
elfFirst = ElfFirst;
}
public GXForwarder(string AppFolder, bool UsbFirst, bool ElfFirst, string Image43, string Image169)
{
if (ForwardMii_Plugin.CheckDevKit() == false) throw new Exception("DevkitPro or one of it's components wasn't found!");
thisAppFolder = AppFolder;
image43 = Image43;
image169 = Image169;
usbFirst = UsbFirst;
elfFirst = ElfFirst;
}
public void Clear() public void Clear()
{ {
thisAppFolder = string.Empty; path1 = string.Empty;
elfFirst = false; path2 = string.Empty;
usbFirst = false; path3 = string.Empty;
path4 = string.Empty;
image43 = string.Empty; image43 = string.Empty;
image169 = string.Empty; image169 = string.Empty;
} }
@ -254,12 +238,14 @@ namespace ForwardMii
for (int i = 0; i < lines.Length; i++) for (int i = 0; i < lines.Length; i++)
{ {
if (lines[i].Contains("appfolder")) if (lines[i].Contains("---path1---"))
lines[i] = lines[i].Replace("appfolder", thisAppFolder); lines[i] = lines[i].Replace("---path1---", path1);
else if (lines[i].Contains("#define USB_FIRST")) else if (lines[i].Contains("---path2---"))
lines[i] = lines[i].Replace("false", usbFirst.ToString().ToLower()); lines[i] = lines[i].Replace("---path2---", path2);
else if (lines[i].Contains("#define ELF_FIRST")) else if (lines[i].Contains("---path3---"))
lines[i] = lines[i].Replace("false", elfFirst.ToString().ToLower()); lines[i] = lines[i].Replace("---path3---", path3);
else if (lines[i].Contains("---path4---"))
lines[i] = lines[i].Replace("---path4---", path4);
} }
using (FileStream fs = new FileStream(TempDir + "source\\main.cpp", FileMode.Create)) using (FileStream fs = new FileStream(TempDir + "source\\main.cpp", FileMode.Create))

View File

@ -43,10 +43,10 @@
#define USB_FIRST false #define USB_FIRST false
#define ELF_FIRST false #define ELF_FIRST false
#define SD_DOL "SD:/apps/appfolder/boot.dol" #define SD_DOL "---path1---"
#define SD_ELF "SD:/apps/appfolder/boot.elf" #define SD_ELF "---path2---"
#define USB_DOL "USB:/apps/appfolder/boot.dol" #define USB_DOL "---path3---"
#define USB_ELF "USB:/apps/appfolder/boot.elf" #define USB_ELF "---path4---"
static PNGUPROP imgProp; static PNGUPROP imgProp;
static IMGCTX ctx; static IMGCTX ctx;