From ad58ccbb76f644e28ae3b5341fb953e7c71e1338 Mon Sep 17 00:00:00 2001 From: leathl Date: Wed, 30 Dec 2009 17:39:41 +0000 Subject: [PATCH] CustomizeMii 2.01 git-svn-id: svn://localhost/Users/andi/Downloads/code/trunk@16 eddbe33b-e435-4246-ac25-f5eb65f9a13c --- CustomizeMii/CustomizeMii.csproj | 2 +- .../CustomizeMii_BackgroundWorkers.cs | 17 +-- CustomizeMii/CustomizeMii_Main.Designer.cs | 20 +-- CustomizeMii/CustomizeMii_Main.cs | 137 ++++-------------- CustomizeMii/CustomizeMii_Main.resx | 4 +- CustomizeMii/CustomizeMii_Structs.cs | 1 - CustomizeMii/Readme.txt | 4 +- 7 files changed, 39 insertions(+), 146 deletions(-) diff --git a/CustomizeMii/CustomizeMii.csproj b/CustomizeMii/CustomizeMii.csproj index 23abde7..dde6bca 100644 --- a/CustomizeMii/CustomizeMii.csproj +++ b/CustomizeMii/CustomizeMii.csproj @@ -27,7 +27,7 @@ false true 0 - 2.1.0.%2a + 2.0.0.%2a false true diff --git a/CustomizeMii/CustomizeMii_BackgroundWorkers.cs b/CustomizeMii/CustomizeMii_BackgroundWorkers.cs index b1694a3..47060c6 100644 --- a/CustomizeMii/CustomizeMii_BackgroundWorkers.cs +++ b/CustomizeMii/CustomizeMii_BackgroundWorkers.cs @@ -25,8 +25,6 @@ namespace CustomizeMii { partial class CustomizeMii_Main { - public int sendWadReady = 0; - private bool sendToWii = false; private bool internalSound; void bwBannerReplace_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) @@ -544,9 +542,6 @@ namespace CustomizeMii EventHandler DisableControls = new EventHandler(this.DisableControls); this.Invoke(DisableControls); - this.sendToWii = wadInfo.sendToWii; - sendWadReady = 0; - bwCreateWad.ReportProgress(0, "Making TPLs transparent"); MakeBannerTplsTransparent(); MakeIconTplsTransparent(); @@ -730,19 +725,13 @@ namespace CustomizeMii bwCreateWad.ReportProgress(100, " "); CreationTimer.Stop(); - if (!sendToWii) - { - FileInfo fi = new FileInfo(wadInfo.outFile); - double fileSize = Math.Round(fi.Length * 0.0009765625 * 0.0009765625, 2); + FileInfo fi = new FileInfo(wadInfo.outFile); + 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))); - } - else sendWadReady = 1; + 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))); } catch (Exception ex) { - sendWadReady = -1; CreationTimer.Stop(); EventHandler EnableControls = new EventHandler(this.EnableControls); this.Invoke(EnableControls); diff --git a/CustomizeMii/CustomizeMii_Main.Designer.cs b/CustomizeMii/CustomizeMii_Main.Designer.cs index b92307f..9837a68 100644 --- a/CustomizeMii/CustomizeMii_Main.Designer.cs +++ b/CustomizeMii/CustomizeMii_Main.Designer.cs @@ -167,7 +167,6 @@ namespace CustomizeMii this.cmDol = new System.Windows.Forms.ContextMenuStrip(this.components); this.cmLoadDol = new System.Windows.Forms.ToolStripMenuItem(); this.cmDolFromSource = new System.Windows.Forms.ToolStripMenuItem(); - this.panCredits = new System.Windows.Forms.Panel(); this.tabControl.SuspendLayout(); this.tabSource.SuspendLayout(); this.tabTitle.SuspendLayout(); @@ -183,7 +182,6 @@ namespace CustomizeMii this.cmOptionsExtract.SuspendLayout(); this.cmSound.SuspendLayout(); this.cmDol.SuspendLayout(); - this.panCredits.SuspendLayout(); this.SuspendLayout(); // // btnCreateWad @@ -315,7 +313,6 @@ namespace CustomizeMii this.lbxBaseWads.FormattingEnabled = true; this.lbxBaseWads.Items.AddRange(new object[] { "Static Base", - "Genesis Plus GX", "MPlayer CE (No Wii)", "MPlayer CE (With Wii)", "Snes9xGX", @@ -1188,9 +1185,9 @@ namespace CustomizeMii // // tabCredits // - this.tabCredits.Controls.Add(this.panCredits); this.tabCredits.Controls.Add(this.llbUpdateAvailabe); this.tabCredits.Controls.Add(this.llbSite); + this.tabCredits.Controls.Add(this.lbCreditThanks); this.tabCredits.Controls.Add(this.lbCreditVersion); this.tabCredits.Controls.Add(this.lbCreditInfo); this.tabCredits.Location = new System.Drawing.Point(4, 22); @@ -1227,9 +1224,9 @@ namespace CustomizeMii // // lbCreditThanks // - this.lbCreditThanks.Location = new System.Drawing.Point(8, 0); + this.lbCreditThanks.Location = new System.Drawing.Point(0, 91); this.lbCreditThanks.Name = "lbCreditThanks"; - this.lbCreditThanks.Size = new System.Drawing.Size(427, 150); + this.lbCreditThanks.Size = new System.Drawing.Size(443, 79); this.lbCreditThanks.TabIndex = 2; this.lbCreditThanks.Text = resources.GetString("lbCreditThanks.Text"); this.lbCreditThanks.TextAlign = System.Drawing.ContentAlignment.TopCenter; @@ -1431,15 +1428,6 @@ namespace CustomizeMii this.cmDolFromSource.Text = "Take From Source WAD"; this.cmDolFromSource.Click += new System.EventHandler(this.cmDolFromSource_Click); // - // panCredits - // - this.panCredits.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; - this.panCredits.Controls.Add(this.lbCreditThanks); - this.panCredits.Location = new System.Drawing.Point(0, 94); - this.panCredits.Name = "panCredits"; - this.panCredits.Size = new System.Drawing.Size(443, 79); - this.panCredits.TabIndex = 5; - // // CustomizeMii_Main // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -1478,7 +1466,6 @@ namespace CustomizeMii this.cmOptionsExtract.ResumeLayout(false); this.cmSound.ResumeLayout(false); this.cmDol.ResumeLayout(false); - this.panCredits.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); @@ -1606,7 +1593,6 @@ namespace CustomizeMii private System.Windows.Forms.ContextMenuStrip cmDol; private System.Windows.Forms.ToolStripMenuItem cmLoadDol; private System.Windows.Forms.ToolStripMenuItem cmDolFromSource; - private System.Windows.Forms.Panel panCredits; } } diff --git a/CustomizeMii/CustomizeMii_Main.cs b/CustomizeMii/CustomizeMii_Main.cs index 0b1cec0..b9483eb 100644 --- a/CustomizeMii/CustomizeMii_Main.cs +++ b/CustomizeMii/CustomizeMii_Main.cs @@ -36,11 +36,10 @@ namespace CustomizeMii { public partial class CustomizeMii_Main : Form { - const string version = "2.1"; //Hint for myself: Never use a char in the Version (UpdateCheck)! + const string version = "2.01"; //Hint for myself: Never use a char in the Version (UpdateCheck)! const int SoundMaxLength = 30; //In seconds const int SoundWarningLength = 20; //In seconds const int BnsWarningLength = 45; //In seconds - const int CreditsScrollSpeed = 85; //Timer Intervall for the scrolling Credits public static string TempPath = Path.GetTempPath() + "CustomizeMii_Temp\\XXX\\"; public static string TempWadPath = Path.GetTempPath() + "CustomizeMii_Temp\\XXX\\TempWad.wad"; public static string TempUnpackPath = Path.GetTempPath() + "CustomizeMii_Temp\\XXX\\Unpack\\"; @@ -58,8 +57,8 @@ namespace CustomizeMii public static string TempUnpackBannerBrlanPath = Path.GetTempPath() + "CustomizeMii_Temp\\XXX\\Unpack\\00000000.app_OUT\\meta\\banner.bin_OUT\\arc\\anim\\"; public static string TempUnpackIconBrlanPath = Path.GetTempPath() + "CustomizeMii_Temp\\XXX\\Unpack\\00000000.app_OUT\\meta\\icon.bin_OUT\\arc\\anim\\"; public static string[] ButtonTexts = new string[] { "Image", "Create WAD!", "Fire!", "Go Go Go!", "Let's do it!", "What are you waitin' for?", "I want my Channel!", "Houston, We've Got a Problem!", "Error, please contact anyone!", "Isn't she sweet?", "Is that milk?", "In your face!", "_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_", "Take me to a higher place!", "What's goin' on?", "I'm a Button!", "Click!", "Today's date is " + DateTime.Now.ToShortDateString(), "Launch Time: " + DateTime.Now.ToLongTimeString(), string.Format("My name is {0}", Environment.UserName) }; - public static string[] SourceWadUrls = new string[] { "http://wadder.net/bases/StaticBase.wad", "http://wadder.net/bases/GenesisGX.wad", "http://wadder.net/bases/MP-CE-Std.wad", "http://wadder.net/bases/MP-CE-Ext.wad", "http://wadder.net/bases/SNES9XGX.wad", "http://wadder.net/bases/FCEUGX-wilsoff.wad", "http://wadder.net/bases/FCEUGX.wad", "http://wadder.net/bases/Wii64.wad", "http://wadder.net/bases/WiiSXFull.wad", "http://wadder.net/bases/WiiSXRetro.wad", "http://wadder.net/bases/WADderBase1.wad", "http://wadder.net/bases/WADderBase2.wad", "http://wadder.net/bases/WADderBase3.wad", "http://wadder.net/bases/UniiLoader.wad", "http://wadder.net/bases/BackupChannel.wad" }; - public static string[] SourceWadPreviewUrls = new string[] { "http://www.youtube.com/watch?v=pFNKldTYQq0", "http://www.youtube.com/watch?v=p9A6iEQvv9w", "http://www.youtube.com/watch?v=Up1RZebUc_U", "http://www.youtube.com/watch?v=Up1RZebUc_U", "http://www.youtube.com/watch?v=P-Mxd6DMvFY", "http://www.youtube.com/watch?v=wrbrg-DH_h4", "http://www.youtube.com/watch?v=MfiVbQaiXw8", "http://www.youtube.com/watch?v=krCQ2J7ZH8Y", "http://www.youtube.com/watch?v=rZC1DKUM6QI", "http://www.youtube.com/watch?v=Uiy8w-bp1kI", "http://www.youtube.com/watch?v=BbSYCSI8tz8", "http://www.youtube.com/watch?v=PIFZevHQ8lQ", "http://www.youtube.com/watch?v=OIhvDNjphhc", "http://www.youtube.com/watch?v=KLcncEArQLY&NR=1", "http://www.youtube.com/watch?v=xE_EgdCRV1I" }; + public static string[] SourceWadUrls = new string[] { "StaticBase.wad", "MPlayer_CE_Short.wad", "MPlayer_CE_Long.wad", "Snes9xGX.wad", "FCE_Ultra_wilsoff.wad", "FCE_Ultra_Leathl.wad", "Wii64.wad", "WiiSX_Full.wad", "WiiSX_Retro.wad", "WADder_Base_1.wad", "WADder_Base_2.wad", "WADder_Base_3.wad", "UniiLoader.wad", "Backup_Channel.wad" }; + public static string[] SourceWadPreviewUrls = new string[] { "http://www.youtube.com/watch?v=pFNKldTYQq0", "http://www.youtube.com/watch?v=Up1RZebUc_U", "http://www.youtube.com/watch?v=Up1RZebUc_U", "http://www.youtube.com/watch?v=P-Mxd6DMvFY", "http://www.youtube.com/watch?v=wrbrg-DH_h4", "http://www.youtube.com/watch?v=MfiVbQaiXw8", "http://www.youtube.com/watch?v=krCQ2J7ZH8Y", "http://www.youtube.com/watch?v=rZC1DKUM6QI", "http://www.youtube.com/watch?v=Uiy8w-bp1kI", "http://www.youtube.com/watch?v=BbSYCSI8tz8", "http://www.youtube.com/watch?v=PIFZevHQ8lQ", "http://www.youtube.com/watch?v=OIhvDNjphhc", "http://www.youtube.com/watch?v=KLcncEArQLY&NR=1", "http://www.youtube.com/watch?v=xE_EgdCRV1I" }; private string BannerTplPath = string.Empty; private string IconTplPath = string.Empty; private string SourceWad = string.Empty; @@ -83,8 +82,6 @@ namespace CustomizeMii private Forwarder.Complex ComplexForwarder = new Forwarder.Complex(); private delegate void BoxInvoker(string message); private delegate void SetTextInvoker(string text, TextBox tb); - double separatorBtn; - Timer tmrCredits = new Timer(); public CustomizeMii_Main() { @@ -163,8 +160,6 @@ namespace CustomizeMii btnBrowseSound.Text = "Browse..."; rtbInstructions.Rtf = Properties.Resources.Instructions; rtbInstructions.LinkClicked += new LinkClickedEventHandler(rtbInstructions_LinkClicked); - tmrCredits.Interval = CreditsScrollSpeed; - tmrCredits.Tick += new EventHandler(tmrCredits_Tick); #if !Debug DisableControls(null, null); @@ -262,7 +257,7 @@ namespace CustomizeMii private void SetToolTips() { ToolTip TTip = new ToolTip(); - TTip.SetToolTip(btnCreateWad, "Save WAD or send it directly to the Wii..."); + TTip.SetToolTip(btnCreateWad, "Create WAD..."); TTip.SetToolTip(btnBrowseSource, "Browse for a WAD that is used as a Base..."); TTip.SetToolTip(btnLoadBaseWad, "Load the selected Base WAD..."); TTip.SetToolTip(btnPreviewBaseWad, "Preview the selected Base WAD, a Browserwindow will be opened..."); @@ -344,34 +339,14 @@ namespace CustomizeMii private void SetButtonText() { - //Random Randomizer = new Random(); - //btnCreateWad.Text = ButtonTexts[Randomizer.Next(0, ButtonTexts.Length - 1)]; + Random Randomizer = new Random(); + btnCreateWad.Text = ButtonTexts[Randomizer.Next(0, ButtonTexts.Length - 1)]; - //if (btnCreateWad.Text == "Image") - //{ - // btnCreateWad.Text = string.Empty; - // btnCreateWad.Image = Properties.Resources.btnCreateWad; - //} - - btnCreateWad.Text = string.Empty; - - Image tmpImg = new Bitmap(btnCreateWad.Width, btnCreateWad.Height); - Graphics gImg = Graphics.FromImage(tmpImg); - - gImg.Clear(Color.Transparent); - - separatorBtn = btnCreateWad.Width * 0.5; - - gImg.DrawLine(Pens.Gray, new Point((int)separatorBtn, 0), new Point((int)separatorBtn, btnCreateWad.Height)); - - string sSend = "Send"; - string sSave = "Save"; - - gImg.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixelGridFit; - gImg.DrawString(sSend, btnCreateWad.Font, Brushes.Black, new PointF(95, 10)); - gImg.DrawString(sSave, btnCreateWad.Font, Brushes.Black, new PointF(320, 10)); - - btnCreateWad.Image = tmpImg; + if (btnCreateWad.Text == "Image") + { + btnCreateWad.Text = string.Empty; + btnCreateWad.Image = Properties.Resources.btnCreateWad; + } } private void ErrorBox(string message) @@ -690,8 +665,6 @@ namespace CustomizeMii private void tabControl_Selecting(object sender, TabControlCancelEventArgs e) { - tmrCredits.Stop(); - if (tabControl.SelectedTab == tabBanner) { lbxBannerTpls.SelectedIndex = -1; @@ -714,17 +687,6 @@ namespace CustomizeMii { AddBrlans(null, null); } - else if (tabControl.SelectedTab == tabCredits) - { - lbCreditThanks.Location = new Point(lbCreditThanks.Location.X, panCredits.Height); - tmrCredits.Start(); - } - } - - void tmrCredits_Tick(object sender, EventArgs e) - { - if (lbCreditThanks.Location.Y == -130) lbCreditThanks.Location = new Point(lbCreditThanks.Location.X, panCredits.Height); - lbCreditThanks.Location = new Point(lbCreditThanks.Location.X, lbCreditThanks.Location.Y - 1); } private void lbStatusText_TextChanged(object sender, EventArgs e) @@ -1003,7 +965,7 @@ namespace CustomizeMii { try { - SourceWad = SourceWadUrls[lbxBaseWads.SelectedIndex]; + 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); @@ -2228,22 +2190,30 @@ namespace CustomizeMii private void btnCreateWad_Click(object sender, EventArgs e) { - Point mousePos = MousePosition; - - if (mousePos.X < (this.Location.X + btnCreateWad.Location.X + Math.Ceiling(separatorBtn) + 3)) + if (pbProgress.Value == 100) { - if (pbProgress.Value == 100) + if (!string.IsNullOrEmpty(tbSourceWad.Text)) { - if (!string.IsNullOrEmpty(tbSourceWad.Text)) + if (cbFailureChecks.Checked == true || FailureCheck() == true) { - if (cbFailureChecks.Checked == true || FailureCheck() == true) + SaveFileDialog sfd = new SaveFileDialog(); + sfd.Filter = "Wii Channels|*.wad"; + + if (!string.IsNullOrEmpty(tbAllLanguages.Text)) + sfd.FileName = tbAllLanguages.Text + " - " + tbTitleID.Text.ToUpper() + ".wad"; + else + sfd.FileName = tbEnglish.Text + " - " + tbTitleID.Text.ToUpper() + ".wad"; + + if (sfd.ShowDialog() == DialogResult.OK) { try { + CreationTimer.Reset(); + CreationTimer.Start(); + WadCreationInfo wadInfo = new WadCreationInfo(); - wadInfo.outFile = TempPath + "SendToWii.wad"; + wadInfo.outFile = sfd.FileName; wadInfo.nandLoader = (WadCreationInfo.NandLoader)cmbNandLoader.SelectedIndex; - wadInfo.sendToWii = true; BackgroundWorker bwCreateWad = new BackgroundWorker(); bwCreateWad.DoWork += new DoWorkEventHandler(bwCreateWad_DoWork); @@ -2251,65 +2221,16 @@ namespace CustomizeMii bwCreateWad.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bwCreateWad_RunWorkerCompleted); bwCreateWad.WorkerReportsProgress = true; bwCreateWad.RunWorkerAsync(wadInfo); - - // @WiiCrazy: The WAD will be saved to >> TempTempPath + "SendToWii.wad" << - // here. Now a loop that waits for the BackgroundWorker to finish and then opens - // a new window (wiiload - window or whatever) ?! - // If it finishes successfully, the variable >> sendWadReady << will turn into 1, - // if it errors, it will turn into -1, as long as it's running it is 0. } catch (Exception ex) { + CreationTimer.Stop(); ErrorBox(ex.Message); } } } } } - else - { - if (pbProgress.Value == 100) - { - if (!string.IsNullOrEmpty(tbSourceWad.Text)) - { - if (cbFailureChecks.Checked == true || FailureCheck() == true) - { - SaveFileDialog sfd = new SaveFileDialog(); - sfd.Filter = "Wii Channels|*.wad"; - - if (!string.IsNullOrEmpty(tbAllLanguages.Text)) - sfd.FileName = tbAllLanguages.Text + " - " + tbTitleID.Text.ToUpper() + ".wad"; - else - sfd.FileName = tbEnglish.Text + " - " + tbTitleID.Text.ToUpper() + ".wad"; - - if (sfd.ShowDialog() == DialogResult.OK) - { - try - { - CreationTimer.Reset(); - CreationTimer.Start(); - - WadCreationInfo wadInfo = new WadCreationInfo(); - wadInfo.outFile = sfd.FileName; - wadInfo.nandLoader = (WadCreationInfo.NandLoader)cmbNandLoader.SelectedIndex; - - BackgroundWorker bwCreateWad = new BackgroundWorker(); - bwCreateWad.DoWork += new DoWorkEventHandler(bwCreateWad_DoWork); - bwCreateWad.ProgressChanged += new ProgressChangedEventHandler(bwCreateWad_ProgressChanged); - bwCreateWad.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bwCreateWad_RunWorkerCompleted); - bwCreateWad.WorkerReportsProgress = true; - bwCreateWad.RunWorkerAsync(wadInfo); - } - catch (Exception ex) - { - CreationTimer.Stop(); - ErrorBox(ex.Message); - } - } - } - } - } - } } private void lbxBrlytBanner_SelectedIndexChanged(object sender, EventArgs e) diff --git a/CustomizeMii/CustomizeMii_Main.resx b/CustomizeMii/CustomizeMii_Main.resx index 0ca0828..1cafef5 100644 --- a/CustomizeMii/CustomizeMii_Main.resx +++ b/CustomizeMii/CustomizeMii_Main.resx @@ -123,9 +123,7 @@ Xuzz for his idea and hard work Xuzz, SquidMan, megazig, Matt_P, Omega and The Lemon Man for Wii.py SquidMan for Zetsubou Andre Perrot for gbalzss -comex and Waninkoko for both their NAND Loader -djdynamite123 for the forwarder base files (ForwardMii-Plugin) -The USB Loader GX Team for their forwarder source (ForwardMii-Plugin) +comex and Waninkoko for both their NAND Loader 16, 7 diff --git a/CustomizeMii/CustomizeMii_Structs.cs b/CustomizeMii/CustomizeMii_Structs.cs index d4775e7..c5a1c97 100644 --- a/CustomizeMii/CustomizeMii_Structs.cs +++ b/CustomizeMii/CustomizeMii_Structs.cs @@ -42,7 +42,6 @@ public string outFile; public NandLoader nandLoader; - public bool sendToWii; } public struct Progress diff --git a/CustomizeMii/Readme.txt b/CustomizeMii/Readme.txt index f0e14aa..7261d96 100644 --- a/CustomizeMii/Readme.txt +++ b/CustomizeMii/Readme.txt @@ -9,8 +9,8 @@ Thanks to icefire / Xuzz for the basic idea of this Application! ----------------------------------------------------------------------------------------- Changelog: -Version 2.1 - - +Version 2.01 + - Base WAD downloading works again Version 2.0 - Added BNS conversion (Mono and Stereo, with and without loop)