diff --git a/CustomizeMii.sln b/CustomizeMii.sln index 68d9614..ff06a49 100644 --- a/CustomizeMii.sln +++ b/CustomizeMii.sln @@ -1,36 +1,42 @@  Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 +# Visual C# Express 2008 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CustomizeMii", "CustomizeMii\CustomizeMii.csproj", "{46B7F0BC-101B-4167-95AD-4C5D78AA0A20}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ForwardMii-Plugin", "ForwardMii-Plugin\ForwardMii-Plugin.csproj", "{20CB2CA7-6767-4758-97FA-97395F47CD6B}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ForwardMii", "ForwardMii\ForwardMii.csproj", "{20CB2CA7-6767-4758-97FA-97395F47CD6B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Helpers", "Helpers\Helpers.csproj", "{475F3ADF-B529-449F-89DA-BA5E8BE15DD5}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tester", "Tester\Tester.csproj", "{C020DE3A-F72B-47AD-A451-17B7586E4D21}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CustomizeMiiInstaller", "CustomizeMiiInstaller\CustomizeMiiInstaller.csproj", "{475F3ADF-B529-449F-89DA-BA5E8BE15DD5}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU + Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU + Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {46B7F0BC-101B-4167-95AD-4C5D78AA0A20}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {46B7F0BC-101B-4167-95AD-4C5D78AA0A20}.Debug|Any CPU.Build.0 = Debug|Any CPU + {46B7F0BC-101B-4167-95AD-4C5D78AA0A20}.Debug|x86.ActiveCfg = Debug|x86 + {46B7F0BC-101B-4167-95AD-4C5D78AA0A20}.Debug|x86.Build.0 = Debug|x86 {46B7F0BC-101B-4167-95AD-4C5D78AA0A20}.Release|Any CPU.ActiveCfg = Release|Any CPU {46B7F0BC-101B-4167-95AD-4C5D78AA0A20}.Release|Any CPU.Build.0 = Release|Any CPU + {46B7F0BC-101B-4167-95AD-4C5D78AA0A20}.Release|x86.ActiveCfg = Release|x86 + {46B7F0BC-101B-4167-95AD-4C5D78AA0A20}.Release|x86.Build.0 = Release|x86 {20CB2CA7-6767-4758-97FA-97395F47CD6B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {20CB2CA7-6767-4758-97FA-97395F47CD6B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {20CB2CA7-6767-4758-97FA-97395F47CD6B}.Debug|x86.ActiveCfg = Debug|x86 + {20CB2CA7-6767-4758-97FA-97395F47CD6B}.Debug|x86.Build.0 = Debug|x86 {20CB2CA7-6767-4758-97FA-97395F47CD6B}.Release|Any CPU.ActiveCfg = Release|Any CPU {20CB2CA7-6767-4758-97FA-97395F47CD6B}.Release|Any CPU.Build.0 = Release|Any CPU + {20CB2CA7-6767-4758-97FA-97395F47CD6B}.Release|x86.ActiveCfg = Release|x86 + {20CB2CA7-6767-4758-97FA-97395F47CD6B}.Release|x86.Build.0 = Release|x86 {475F3ADF-B529-449F-89DA-BA5E8BE15DD5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {475F3ADF-B529-449F-89DA-BA5E8BE15DD5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {475F3ADF-B529-449F-89DA-BA5E8BE15DD5}.Debug|x86.ActiveCfg = Debug|Any CPU {475F3ADF-B529-449F-89DA-BA5E8BE15DD5}.Release|Any CPU.ActiveCfg = Release|Any CPU {475F3ADF-B529-449F-89DA-BA5E8BE15DD5}.Release|Any CPU.Build.0 = Release|Any CPU - {C020DE3A-F72B-47AD-A451-17B7586E4D21}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C020DE3A-F72B-47AD-A451-17B7586E4D21}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C020DE3A-F72B-47AD-A451-17B7586E4D21}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C020DE3A-F72B-47AD-A451-17B7586E4D21}.Release|Any CPU.Build.0 = Release|Any CPU + {475F3ADF-B529-449F-89DA-BA5E8BE15DD5}.Release|x86.ActiveCfg = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/CustomizeMii/CustomizeMii.csproj b/CustomizeMii/CustomizeMii.csproj index 0c2048e..98a744a 100644 --- a/CustomizeMii/CustomizeMii.csproj +++ b/CustomizeMii/CustomizeMii.csproj @@ -48,12 +48,31 @@ prompt 4 + + true + bin\x86\Debug\ + DEBUG;TRACE + full + x86 + prompt + + + bin\x86\Release\ + TRACE + true + pdbonly + x86 + prompt + + + False + ..\CustomizeMiiInstaller\bin\Debug\CustomizeMiiInstaller.dll + - @@ -91,6 +110,13 @@ Form + + Form + + + CustomizeMii_Transmit.cs + + @@ -106,6 +132,9 @@ CustomizeMii_Main.cs + + CustomizeMii_Transmit.cs + ResXFileCodeGenerator Resources.Designer.cs @@ -144,6 +173,7 @@ + @@ -177,9 +207,9 @@ - + {20CB2CA7-6767-4758-97FA-97395F47CD6B} - ForwardMii-Plugin + ForwardMii diff --git a/CustomizeMii/CustomizeMii_BackgroundWorkers.cs b/CustomizeMii/CustomizeMii_BackgroundWorkers.cs index 6e3edc3..fc5453c 100644 --- a/CustomizeMii/CustomizeMii_BackgroundWorkers.cs +++ b/CustomizeMii/CustomizeMii_BackgroundWorkers.cs @@ -20,14 +20,19 @@ using System.ComponentModel; using System.Diagnostics; using System.IO; using BNS; +using System.Net.Sockets; namespace CustomizeMii { partial class CustomizeMii_Main { + private Stopwatch CreationTimer = new Stopwatch(); + private Stopwatch TransmitTimer = new Stopwatch(); + private TransmitInfo transmitInfo; public int sendWadReady = 0; private bool sendToWii = false; private bool internalSound; + private WadCreationInfo wadCreationInfo; void bwBannerReplace_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { @@ -529,7 +534,7 @@ namespace CustomizeMii } } - void bwCreateWad_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) + void bwTransmit_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { EventHandler EnableControls = new EventHandler(this.EnableControls); EventHandler Initialize = new EventHandler(this.Initialize); @@ -537,6 +542,219 @@ namespace CustomizeMii lbStatusText.Text = string.Empty; this.Invoke(EnableControls); this.Invoke(Initialize); + + if (transmitInfo.timeElapsed > 0) + { + System.Windows.Forms.DialogResult dlg; + + if (transmitInfo.usedCompression) + dlg = System.Windows.Forms.MessageBox.Show( + string.Format("Transmitted {0} kB in {1} milliseconds...\nCompression Ratio: {2}%\n\nDo you want to save the wad file?", + transmitInfo.transmittedLength, transmitInfo.timeElapsed, transmitInfo.compressionRatio), + "Save File?", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question); + else + dlg = System.Windows.Forms.MessageBox.Show( + string.Format("Transmitted {0} kB in {1} milliseconds...\n\nDo you want to save the wad file?", + transmitInfo.transmittedLength, transmitInfo.timeElapsed), + "Save File?", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question); + + if (dlg == System.Windows.Forms.DialogResult.Yes) + { + System.Windows.Forms.SaveFileDialog sfd = new System.Windows.Forms.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() == System.Windows.Forms.DialogResult.OK) + File.Copy(TempPath + "SendToWii.wad", sfd.FileName, true); + } + } + + try { File.Delete(TempPath + "SendToWii.wad"); } + catch { } + } + + void bwTransmit_ProgressChanged(object sender, ProgressChangedEventArgs e) + { + currentProgress.progressValue = e.ProgressPercentage; + currentProgress.progressState = (string)e.UserState; + + this.Invoke(ProgressUpdate); + } + + void bwTransmit_DoWork(object sender, DoWorkEventArgs e) + { + try + { + BackgroundWorker bwTransmit = sender as BackgroundWorker; + + //Insert wad into stub dol + string fileName = "CMiiInstaller.dol"; + byte[] fileData = CustomizeMiiInstaller.InstallerHelper.CreateInstaller(TempPath + "SendToWii.wad", (byte)wadCreationInfo.transmitIos).ToArray(); + + //Transmit installer + transmitInfo.timeElapsed = 0; TransmitTimer.Reset(); TransmitTimer.Start(); + bool compress = File.Exists(System.Windows.Forms.Application.StartupPath + "\\zlib1.dll"); + + if (!Environment.OSVersion.ToString().Contains("Windows")) + compress = false; + + if ((int)(wadCreationInfo.transmitProtocol) == 1) compress = false; + + TcpClient theClient = new TcpClient(); + + byte[] compFileData; + int Blocksize = 4 * 1024; + if (wadCreationInfo.transmitProtocol != TransmitProtocol.JODI) Blocksize = 16 * 1024; + byte[] buffer = new byte[4]; + string theIP = wadCreationInfo.transmitIp; + + bwTransmit.ReportProgress(0, "Connecting..."); + //StatusUpdate("Connecting..."); + try { theClient.Connect(theIP, 4299); } + catch (Exception ex) { theClient.Close(); throw new Exception("Connection Failed:\n" + ex.Message); } + NetworkStream theStream = theClient.GetStream(); + + bwTransmit.ReportProgress(0, "Connected... Sending Magic..."); + //StatusUpdate("Connected... Sending Magic..."); + buffer[0] = (byte)'H'; + buffer[1] = (byte)'A'; + buffer[2] = (byte)'X'; + buffer[3] = (byte)'X'; + try { theStream.Write(buffer, 0, 4); } + catch (Exception ex) { theStream.Close(); theClient.Close(); throw new Exception("Error sending Magic:\n" + ex.Message); } + + bwTransmit.ReportProgress(0, "Magic Sent... Sending Version Info..."); + //StatusUpdate("Magic Sent... Sending Version Info..."); + buffer[0] = 0; + buffer[1] = wadCreationInfo.transmitProtocol == TransmitProtocol.JODI ? (byte)5 : (byte)4; + buffer[2] = (byte)(((fileName.Length + 2) >> 8) & 0xff); + buffer[3] = (byte)((fileName.Length + 2) & 0xff); + + try { theStream.Write(buffer, 0, 4); } + catch (Exception ex) { theStream.Close(); theClient.Close(); throw new Exception("Error sending Version Info:\n" + ex.Message); } + + if (compress) + { + bwTransmit.ReportProgress(0, "Version Info Sent... Compressing File..."); + //StatusUpdate("Version Info Sent... Compressing File..."); + try { compFileData = TransmitMii.zlib.Compress(fileData); } + catch (Exception ex) + { + ErrorBox(ex.Message); + //Compression failed, let's continue without compression + compFileData = fileData; + fileData = new byte[0]; + } + + bwTransmit.ReportProgress(0, "Compressed File... Sending Filesize..."); + //StatusUpdate("Compressed File... Sending Filesize..."); + } + else + { + compFileData = fileData; + fileData = new byte[0]; + + bwTransmit.ReportProgress(0, "Version Info Sent... Sending Filesize..."); + //StatusUpdate("Version Info Sent... Sending Filesize..."); + } + + //First compressed filesize, then uncompressed filesize + buffer[0] = (byte)((compFileData.Length >> 24) & 0xff); + buffer[1] = (byte)((compFileData.Length >> 16) & 0xff); + buffer[2] = (byte)((compFileData.Length >> 8) & 0xff); + buffer[3] = (byte)(compFileData.Length & 0xff); + try { theStream.Write(buffer, 0, 4); } + catch (Exception ex) { theStream.Close(); theClient.Close(); throw new Exception("Error sending Filesize:\n" + ex.Message); } + + if (wadCreationInfo.transmitProtocol != TransmitProtocol.HAXX) + { + buffer[0] = (byte)((fileData.Length >> 24) & 0xff); + buffer[1] = (byte)((fileData.Length >> 16) & 0xff); + buffer[2] = (byte)((fileData.Length >> 8) & 0xff); + buffer[3] = (byte)(fileData.Length & 0xff); + try { theStream.Write(buffer, 0, 4); } + catch (Exception ex) { theStream.Close(); theClient.Close(); throw new Exception("Error sending Filesize:\n" + ex.Message); } + } + + bwTransmit.ReportProgress(0, "Filesize Sent... Sending File..."); + //StatusUpdate("Filesize Sent... Sending File..."); + int off = 0; + int cur = 0; + int count = compFileData.Length / Blocksize; + int left = compFileData.Length % Blocksize; + + try + { + do + { + bwTransmit.ReportProgress((cur + 1) * 100 / count, "Sending File..."); + //StatusUpdate("Sending File: " + ((cur + 1) * 100 / count).ToString() + "%"); + theStream.Write(compFileData, off, Blocksize); + off += Blocksize; + cur++; + } while (cur < count); + + if (left > 0) + { + theStream.Write(compFileData, off, compFileData.Length - off); + } + } + catch (Exception ex) { theStream.Close(); theClient.Close(); throw new Exception("Error sending File:\n" + ex.Message); } + + bwTransmit.ReportProgress(0, "File Sent... Sending Arguments..."); + //StatusUpdate("File Sent... Sending Arguments..."); + byte[] theArgs = new byte[fileName.Length + 2]; + for (int i = 0; i < fileName.Length; i++) { theArgs[i] = (byte)fileName.ToCharArray()[i]; } + try { theStream.Write(theArgs, 0, theArgs.Length); } + catch (Exception ex) { theStream.Close(); theClient.Close(); throw new Exception("Error sending Arguments:\n" + ex.Message); } + + theStream.Close(); + theClient.Close(); + + bwTransmit.ReportProgress(0, string.Empty); + //StatusUpdate(string.Empty); + + TransmitTimer.Stop(); + transmitInfo.timeElapsed = (int)TransmitTimer.ElapsedMilliseconds; + transmitInfo.usedCompression = compress; + transmitInfo.transmittedLength = Math.Round(compFileData.Length * 0.0009765625, 2); + if (compress && fileData.Length != 0) + transmitInfo.compressionRatio = (compFileData.Length * 100) / fileData.Length; + } + catch (Exception ex) + { + ErrorBox(ex.Message); + } + } + + void bwCreateWad_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) + { + if (!this.sendToWii) + { + EventHandler EnableControls = new EventHandler(this.EnableControls); + EventHandler Initialize = new EventHandler(this.Initialize); + pbProgress.Value = 100; + lbStatusText.Text = string.Empty; + this.Invoke(EnableControls); + this.Invoke(Initialize); + } + else + { + if (sendWadReady == 1) + { + //Start new BackgroundWorker to Transmit + BackgroundWorker bwTransmit = new BackgroundWorker(); + bwTransmit.WorkerReportsProgress = true; + bwTransmit.DoWork += new DoWorkEventHandler(bwTransmit_DoWork); + bwTransmit.ProgressChanged += new ProgressChangedEventHandler(bwTransmit_ProgressChanged); + bwTransmit.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bwTransmit_RunWorkerCompleted); + bwTransmit.RunWorkerAsync(); + } + } } void bwCreateWad_ProgressChanged(object sender, ProgressChangedEventArgs e) @@ -563,6 +781,9 @@ namespace CustomizeMii MakeBannerTplsTransparent(); MakeIconTplsTransparent(); + bwCreateWad.ReportProgress(3, "Fixing TPL Filters..."); + FixTpls(); + bwCreateWad.ReportProgress(5, "Packing icon.bin..."); byte[] iconbin; @@ -751,6 +972,8 @@ namespace CustomizeMii 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; + + wadCreationInfo = wadInfo; } catch (Exception ex) { diff --git a/CustomizeMii/CustomizeMii_DragDrop.cs b/CustomizeMii/CustomizeMii_DragDrop.cs index 81e62aa..95e3faa 100644 --- a/CustomizeMii/CustomizeMii_DragDrop.cs +++ b/CustomizeMii/CustomizeMii_DragDrop.cs @@ -1,4 +1,21 @@ -using System; +/* This file is part of CustomizeMii + * Copyright (C) 2009 Leathl + * + * CustomizeMii is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * CustomizeMii is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +using System; using System.ComponentModel; using System.IO; using System.Windows.Forms; diff --git a/CustomizeMii/CustomizeMii_Main.Designer.cs b/CustomizeMii/CustomizeMii_Main.Designer.cs index 5b1273b..5e9c36d 100644 --- a/CustomizeMii/CustomizeMii_Main.Designer.cs +++ b/CustomizeMii/CustomizeMii_Main.Designer.cs @@ -63,6 +63,7 @@ namespace CustomizeMii this.tbSourceWad = new System.Windows.Forms.TextBox(); this.lbSource = new System.Windows.Forms.Label(); this.tabTitle = new System.Windows.Forms.TabPage(); + this.llbTranslateChannel = new System.Windows.Forms.LinkLabel(); this.tbItalian = new System.Windows.Forms.TextBox(); this.tbFrench = new System.Windows.Forms.TextBox(); this.tbJapanese = new System.Windows.Forms.TextBox(); @@ -140,6 +141,7 @@ namespace CustomizeMii this.tabInstructions = new System.Windows.Forms.TabPage(); this.rtbInstructions = new System.Windows.Forms.RichTextBox(); this.tabCredits = new System.Windows.Forms.TabPage(); + this.label1 = new System.Windows.Forms.Label(); this.lbForwardMiiVersion = new System.Windows.Forms.Label(); this.panCredits = new System.Windows.Forms.Panel(); this.lbCreditThanks = new System.Windows.Forms.Label(); @@ -164,6 +166,10 @@ namespace CustomizeMii this.cmExtractBannerImages = new System.Windows.Forms.ToolStripMenuItem(); this.cmExtractIconImages = new System.Windows.Forms.ToolStripMenuItem(); this.cmExtractBothImages = new System.Windows.Forms.ToolStripMenuItem(); + this.tsExtractBrl = new System.Windows.Forms.ToolStripMenuItem(); + this.cmExtractBrlyt = new System.Windows.Forms.ToolStripMenuItem(); + this.cmExtractBrlan = new System.Windows.Forms.ToolStripMenuItem(); + this.cmExtractBothBrl = new System.Windows.Forms.ToolStripMenuItem(); this.cmSound = new System.Windows.Forms.ContextMenuStrip(this.components); this.cmLoadAudioFile = new System.Windows.Forms.ToolStripMenuItem(); this.cmConvertToBns = new System.Windows.Forms.ToolStripMenuItem(); @@ -377,6 +383,7 @@ namespace CustomizeMii // // tabTitle // + this.tabTitle.Controls.Add(this.llbTranslateChannel); this.tabTitle.Controls.Add(this.tbItalian); this.tabTitle.Controls.Add(this.tbFrench); this.tabTitle.Controls.Add(this.tbJapanese); @@ -402,6 +409,17 @@ namespace CustomizeMii this.tabTitle.Text = "Title"; this.tabTitle.UseVisualStyleBackColor = true; // + // llbTranslateChannel + // + this.llbTranslateChannel.AutoSize = true; + this.llbTranslateChannel.Location = new System.Drawing.Point(322, 42); + this.llbTranslateChannel.Name = "llbTranslateChannel"; + this.llbTranslateChannel.Size = new System.Drawing.Size(103, 13); + this.llbTranslateChannel.TabIndex = 17; + this.llbTranslateChannel.TabStop = true; + this.llbTranslateChannel.Text = "Translate \"Channel\""; + this.llbTranslateChannel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.llbTranslateChannel_LinkClicked); + // // tbItalian // this.tbItalian.Location = new System.Drawing.Point(301, 143); @@ -1213,6 +1231,7 @@ namespace CustomizeMii // // tabCredits // + this.tabCredits.Controls.Add(this.label1); this.tabCredits.Controls.Add(this.lbForwardMiiVersion); this.tabCredits.Controls.Add(this.panCredits); this.tabCredits.Controls.Add(this.llbUpdateAvailabe); @@ -1227,9 +1246,18 @@ namespace CustomizeMii this.tabCredits.Text = "About"; this.tabCredits.UseVisualStyleBackColor = true; // + // label1 + // + this.label1.Location = new System.Drawing.Point(0, 28); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(443, 13); + this.label1.TabIndex = 7; + this.label1.Text = "CustomizeMii Installer by WiiCrazy / I.R.on"; + this.label1.TextAlign = System.Drawing.ContentAlignment.TopCenter; + // // lbForwardMiiVersion // - this.lbForwardMiiVersion.Location = new System.Drawing.Point(0, 62); + this.lbForwardMiiVersion.Location = new System.Drawing.Point(0, 68); this.lbForwardMiiVersion.Name = "lbForwardMiiVersion"; this.lbForwardMiiVersion.Size = new System.Drawing.Size(443, 13); this.lbForwardMiiVersion.TabIndex = 6; @@ -1258,7 +1286,7 @@ namespace CustomizeMii // llbUpdateAvailabe // this.llbUpdateAvailabe.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, 62); + this.llbUpdateAvailabe.Location = new System.Drawing.Point(0, 67); this.llbUpdateAvailabe.Name = "llbUpdateAvailabe"; this.llbUpdateAvailabe.Size = new System.Drawing.Size(443, 13); this.llbUpdateAvailabe.TabIndex = 4; @@ -1270,18 +1298,19 @@ namespace CustomizeMii // // llbSite // - this.llbSite.Location = new System.Drawing.Point(0, 35); + this.llbSite.Location = new System.Drawing.Point(0, 47); this.llbSite.Name = "llbSite"; this.llbSite.Size = new System.Drawing.Size(443, 13); this.llbSite.TabIndex = 3; this.llbSite.TabStop = true; + this.llbSite.Tag = "Independent"; this.llbSite.Text = "http://customizemii.googlecode.com"; this.llbSite.TextAlign = System.Drawing.ContentAlignment.TopCenter; this.llbSite.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.llbSite_LinkClicked); // // lbCreditVersion // - this.lbCreditVersion.Location = new System.Drawing.Point(0, 13); + this.lbCreditVersion.Location = new System.Drawing.Point(0, 10); this.lbCreditVersion.Name = "lbCreditVersion"; this.lbCreditVersion.Size = new System.Drawing.Size(443, 13); this.lbCreditVersion.TabIndex = 1; @@ -1360,21 +1389,22 @@ namespace CustomizeMii this.cmExtractWad, this.cmExtractDol, this.tsExtractSound, - this.tsExtractImages}); + this.tsExtractImages, + this.tsExtractBrl}); this.cmOptionsExtract.Name = "cmOptionsExtract"; - this.cmOptionsExtract.Size = new System.Drawing.Size(153, 92); + this.cmOptionsExtract.Size = new System.Drawing.Size(183, 114); // // cmExtractWad // this.cmExtractWad.Name = "cmExtractWad"; - this.cmExtractWad.Size = new System.Drawing.Size(152, 22); + this.cmExtractWad.Size = new System.Drawing.Size(182, 22); this.cmExtractWad.Text = "WAD Contents"; this.cmExtractWad.Click += new System.EventHandler(this.cmExtractWad_Click); // // cmExtractDol // this.cmExtractDol.Name = "cmExtractDol"; - this.cmExtractDol.Size = new System.Drawing.Size(152, 22); + this.cmExtractDol.Size = new System.Drawing.Size(182, 22); this.cmExtractDol.Text = "DOL"; this.cmExtractDol.Click += new System.EventHandler(this.cmOptionsExtract_MouseClick); // @@ -1384,7 +1414,7 @@ namespace CustomizeMii this.cmExtractSoundAsBin, this.cmExtractSoundAsAudio}); this.tsExtractSound.Name = "tsExtractSound"; - this.tsExtractSound.Size = new System.Drawing.Size(152, 22); + this.tsExtractSound.Size = new System.Drawing.Size(182, 22); this.tsExtractSound.Text = "Sound"; // // cmExtractSoundAsBin @@ -1408,7 +1438,7 @@ namespace CustomizeMii this.cmExtractIconImages, this.cmExtractBothImages}); this.tsExtractImages.Name = "tsExtractImages"; - this.tsExtractImages.Size = new System.Drawing.Size(152, 22); + this.tsExtractImages.Size = new System.Drawing.Size(182, 22); this.tsExtractImages.Text = "Images"; // // cmExtractBannerImages @@ -1432,6 +1462,37 @@ namespace CustomizeMii this.cmExtractBothImages.Text = "Both"; this.cmExtractBothImages.Click += new System.EventHandler(this.cmOptionsExtract_MouseClick); // + // tsExtractBrl + // + this.tsExtractBrl.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.cmExtractBrlyt, + this.cmExtractBrlan, + this.cmExtractBothBrl}); + this.tsExtractBrl.Name = "tsExtractBrl"; + this.tsExtractBrl.Size = new System.Drawing.Size(182, 22); + this.tsExtractBrl.Text = "Layout && Animation"; + // + // cmExtractBrlyt + // + this.cmExtractBrlyt.Name = "cmExtractBrlyt"; + this.cmExtractBrlyt.Size = new System.Drawing.Size(109, 22); + this.cmExtractBrlyt.Text = "brlyt\'s"; + this.cmExtractBrlyt.Click += new System.EventHandler(this.cmOptionsExtract_MouseClick); + // + // cmExtractBrlan + // + this.cmExtractBrlan.Name = "cmExtractBrlan"; + this.cmExtractBrlan.Size = new System.Drawing.Size(109, 22); + this.cmExtractBrlan.Text = "brlan\'s"; + this.cmExtractBrlan.Click += new System.EventHandler(this.cmOptionsExtract_MouseClick); + // + // cmExtractBothBrl + // + this.cmExtractBothBrl.Name = "cmExtractBothBrl"; + this.cmExtractBothBrl.Size = new System.Drawing.Size(109, 22); + this.cmExtractBothBrl.Text = "Both"; + this.cmExtractBothBrl.Click += new System.EventHandler(this.cmOptionsExtract_MouseClick); + // // cmSound // this.cmSound.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -1648,6 +1709,12 @@ namespace CustomizeMii private System.Windows.Forms.Label lbForwardMiiVersion; private System.Windows.Forms.Label lbCreated; private System.Windows.Forms.Label lbCreatedValue; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.ToolStripMenuItem tsExtractBrl; + private System.Windows.Forms.ToolStripMenuItem cmExtractBrlyt; + private System.Windows.Forms.ToolStripMenuItem cmExtractBrlan; + private System.Windows.Forms.ToolStripMenuItem cmExtractBothBrl; + private System.Windows.Forms.LinkLabel llbTranslateChannel; } } diff --git a/CustomizeMii/CustomizeMii_Main.cs b/CustomizeMii/CustomizeMii_Main.cs index 9681c67..040cffb 100644 --- a/CustomizeMii/CustomizeMii_Main.cs +++ b/CustomizeMii/CustomizeMii_Main.cs @@ -45,7 +45,7 @@ namespace CustomizeMii #endregion #region Variables - public bool Mono = false; + public static bool Mono = false; 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\\"; @@ -80,7 +80,6 @@ namespace CustomizeMii private Progress currentProgress; private EventHandler ProgressUpdate; private int UnpackFolderErrorCount = 0; - private Stopwatch CreationTimer = new Stopwatch(); private List BannerTransparents = new List(); private List IconTransparents = new List(); private string Mp3Path; @@ -311,7 +310,9 @@ namespace CustomizeMii tTip.SetToolTip(btnBrlanExtract, "Extract the selected brlan file..."); tTip.SetToolTip(btnOptionsExtract, "Extract contents of the WAD..."); tTip.SetToolTip(btnForwarder, "Create a forwarder that will be inserted as a DOL..."); - + + tTip.SetToolTip(llbTranslateChannel, "Translates the word \"Channel\" to each language..."); + tTip.SetToolTip(cbLz77, "Use Lz77 compression for the banner.bin and icon.bin...\nIf the created WAD does not work, try it without compression first..."); tTip.SetToolTip(cbFailureChecks, "Turn off the security checks...\nNot recommended, you may get a bricking WAD..."); } @@ -324,7 +325,7 @@ namespace CustomizeMii return false; } - void rtbInstructions_LinkClicked(object sender, LinkClickedEventArgs e) + private void rtbInstructions_LinkClicked(object sender, LinkClickedEventArgs e) { try { @@ -385,10 +386,6 @@ namespace CustomizeMii gImg.DrawLine(Pens.Gray, new Point((int)separatorBtn, 0), new Point((int)separatorBtn, btnCreateWad.Height)); - //gImg.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixelGridFit; - //gImg.DrawString("Send", btnCreateWad.Font, Brushes.Black, new PointF(95, 10)); - //gImg.DrawString("Save", btnCreateWad.Font, Brushes.Black, new PointF(320, 10)); - Image tmpCreate = Properties.Resources.btnCreate; Image tmpSend = Properties.Resources.btnSend; gImg.DrawImage(ResizeImage(tmpCreate, tmpCreate.Width, tmpCreate.Height), new Point(280, 0)); @@ -398,33 +395,11 @@ namespace CustomizeMii } } - private void ErrorBox(string message) - { - BoxInvoker invoker = new BoxInvoker(this.errorBox); - this.Invoke(invoker, new object[] { message }); - } - - private void errorBox(string message) - { - MessageBox.Show(message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - - private void InfoBox(string message) - { - BoxInvoker invoker = new BoxInvoker(this.infoBox); - this.Invoke(invoker, new object[] { message }); - } - - private void infoBox(string message) - { - MessageBox.Show(message, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - private bool CheckInet() { try { - System.Net.IPHostEntry IpHost = System.Net.Dns.GetHostEntry("www.google.com"); + System.Net.IPHostEntry ipHost = System.Net.Dns.GetHostEntry("www.google.com"); return true; } catch @@ -444,220 +419,6 @@ namespace CustomizeMii } } - private void AddBannerTpls(object sender, EventArgs e) - { - try - { - string[] BannerTpls; - if (string.IsNullOrEmpty(BannerReplace)) - BannerTpls = Directory.GetFiles(TempUnpackBannerTplPath); - else - BannerTpls = Directory.GetFiles(TempBannerPath + "arc\\timg"); - - AddBannerTpls(BannerTpls); - } - catch { } - } - - private void AddIconTpls(object sender, EventArgs e) - { - try - { - string[] IconTpls; - if (string.IsNullOrEmpty(IconReplace)) - IconTpls = Directory.GetFiles(TempUnpackIconTplPath); - else - IconTpls = Directory.GetFiles(TempIconPath + "arc\\timg"); - - AddIconTpls(IconTpls); - } - catch { } - } - - private void AddBannerTpls(string[] tpls) - { - if (tpls.Length > 0) - { - lbxBannerTpls.Items.Clear(); - BannerTplPath = tpls[0].Remove(tpls[0].LastIndexOf('\\') + 1); - - for (int i = 0; i < tpls.Length; i++) - { - if (BannerTransparents.Contains(tpls[i].Remove(0, tpls[i].LastIndexOf('\\') + 1))) - lbxBannerTpls.Items.Add(tpls[i].Remove(0, tpls[i].LastIndexOf('\\') + 1) + " (Transparent)"); - else - lbxBannerTpls.Items.Add(tpls[i].Remove(0, tpls[i].LastIndexOf('\\') + 1)); - } - } - } - - private void AddIconTpls(string[] tpls) - { - if (tpls.Length > 0) - { - lbxIconTpls.Items.Clear(); - IconTplPath = tpls[0].Remove(tpls[0].LastIndexOf('\\') + 1); - - for (int i = 0; i < tpls.Length; i++) - { - if (IconTransparents.Contains(tpls[i].Remove(0, tpls[i].LastIndexOf('\\') + 1))) - lbxIconTpls.Items.Add(tpls[i].Remove(0, tpls[i].LastIndexOf('\\') + 1) + " (Transparent)"); - else - lbxIconTpls.Items.Add(tpls[i].Remove(0, tpls[i].LastIndexOf('\\') + 1)); - } - } - } - - private void AddBrlyts(object sender, EventArgs e) - { - try - { - string[] BannerBrlyt; - if (string.IsNullOrEmpty(BannerReplace)) - BannerBrlyt = Directory.GetFiles(TempUnpackBannerBrlytPath); - else - BannerBrlyt = Directory.GetFiles(TempBannerPath + "arc\\blyt"); - - string[] IconBrlyt; - if (string.IsNullOrEmpty(IconReplace)) - IconBrlyt = Directory.GetFiles(TempUnpackIconBrlytPath); - else - IconBrlyt = Directory.GetFiles(TempIconPath + "arc\\blyt"); - - AddBannerBrlyt(BannerBrlyt); - AddIconBrlyt(IconBrlyt); - - if (lbxBrlytBanner.SelectedIndex == -1 && lbxBrlytIcon.SelectedIndex == -1) - { - if (lbxBrlytBanner.Items.Count > 0) lbxBrlytBanner.SelectedIndex = 0; - else if (lbxBrlytIcon.Items.Count > 0) lbxBrlytIcon.SelectedIndex = 0; - } - } - catch { } - } - - private void AddBrlans(object sender, EventArgs e) - { - try - { - string[] BannerBrlan; - if (string.IsNullOrEmpty(BannerReplace)) - BannerBrlan = Directory.GetFiles(TempUnpackBannerBrlanPath); - else - BannerBrlan = Directory.GetFiles(TempBannerPath + "arc\\anim"); - - string[] IconBrlan; - if (string.IsNullOrEmpty(IconReplace)) - IconBrlan = Directory.GetFiles(TempUnpackIconBrlanPath); - else - IconBrlan = Directory.GetFiles(TempIconPath + "arc\\anim"); - - AddBannerBrlan(BannerBrlan); - AddIconBrlan(IconBrlan); - - if (lbxBrlanBanner.SelectedIndex == -1 && lbxBrlanIcon.SelectedIndex == -1) - { - if (lbxBrlanBanner.Items.Count > 0) lbxBrlanBanner.SelectedIndex = 0; - else if (lbxBrlanIcon.Items.Count > 0) lbxBrlanIcon.SelectedIndex = 0; - } - } - catch { } - } - - private void AddBannerBrlyt(string[] brlyt) - { - if (brlyt.Length > 0) - { - lbxBrlytBanner.Items.Clear(); - BannerBrlytPath = brlyt[0].Remove(brlyt[0].LastIndexOf('\\') + 1); - - for (int i = 0; i < brlyt.Length; i++) - { - lbxBrlytBanner.Items.Add(brlyt[i].Remove(0, brlyt[i].LastIndexOf('\\') + 1)); - } - } - } - - private void AddIconBrlyt(string[] brlyt) - { - if (brlyt.Length > 0) - { - lbxBrlytIcon.Items.Clear(); - IconBrlytPath = brlyt[0].Remove(brlyt[0].LastIndexOf('\\') + 1); - - for (int i = 0; i < brlyt.Length; i++) - { - lbxBrlytIcon.Items.Add(brlyt[i].Remove(0, brlyt[i].LastIndexOf('\\') + 1)); - } - } - } - - private void AddBannerBrlan(string[] brlan) - { - if (brlan.Length > 0) - { - lbxBrlanBanner.Items.Clear(); - BannerBrlanPath = brlan[0].Remove(brlan[0].LastIndexOf('\\') + 1); - - for (int i = 0; i < brlan.Length; i++) - { - lbxBrlanBanner.Items.Add(brlan[i].Remove(0, brlan[i].LastIndexOf('\\') + 1)); - } - } - } - - private void AddIconBrlan(string[] brlan) - { - if (brlan.Length > 0) - { - lbxBrlanIcon.Items.Clear(); - IconBrlanPath = brlan[0].Remove(brlan[0].LastIndexOf('\\') + 1); - - for (int i = 0; i < brlan.Length; i++) - { - lbxBrlanIcon.Items.Add(brlan[i].Remove(0, brlan[i].LastIndexOf('\\') + 1)); - } - } - } - - private void SetText(TextBox tb, string text) - { - SetTextInvoker invoker = new SetTextInvoker(this.SetText); - this.Invoke(invoker, text, tb); - } - - private void SetText(string text, TextBox tb) - { - tb.Text = text; - } - - private void SetLabel(Label lb, string text) - { - SetLabelInvoker invoker = new SetLabelInvoker(this.SetLabel); - this.Invoke(invoker, text, lb); - } - - private void SetLabel(string text, Label lb) - { - lb.Text = text; - } - - private string GetCurBannerPath() - { - if (string.IsNullOrEmpty(BannerReplace)) - return TempUnpackPath + "00000000.app_OUT\\meta\\banner.bin_OUT\\arc\\"; - else - return TempBannerPath + "arc\\"; - } - - private string GetCurIconPath() - { - if (string.IsNullOrEmpty(IconReplace)) - return TempUnpackPath + "00000000.app_OUT\\meta\\icon.bin_OUT\\arc\\"; - else - return TempIconPath + "arc\\"; - } - private void SetSourceWad(object sender, EventArgs e) { tbSourceWad.Text = SourceWad; @@ -756,7 +517,7 @@ namespace CustomizeMii } } - void tmrCredits_Tick(object sender, EventArgs e) + private 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); @@ -839,84 +600,6 @@ namespace CustomizeMii } } - private Image ResizeImage(Image img, int x, int y) - { - Image newimage = new Bitmap(x, y); - using (Graphics gfx = Graphics.FromImage(newimage)) - { - gfx.DrawImage(img, 0, 0, x, y); - } - return newimage; - } - - private void MakeBannerTplsTransparent() - { - foreach (string thisTpl in lbxBannerTpls.Items) - { - if (thisTpl.EndsWith("(Transparent)")) - { - string Tpl = BannerTplPath + thisTpl.Replace(" (Transparent)", string.Empty); - byte[] TplArray = Wii.Tools.LoadFileToByteArray(Tpl); - int Width = Wii.TPL.GetTextureWidth(TplArray); - int Height = Wii.TPL.GetTextureHeight(TplArray); - - Image Img = new Bitmap(Width, Height); - Wii.TPL.ConvertToTPL(Img, Tpl, 5); - } - } - } - - private void MakeIconTplsTransparent() - { - foreach (string thisTpl in lbxIconTpls.Items) - { - if (thisTpl.EndsWith("(Transparent)")) - { - string Tpl = IconTplPath + thisTpl.Replace(" (Transparent)", string.Empty); - byte[] TplArray = Wii.Tools.LoadFileToByteArray(Tpl); - int Width = Wii.TPL.GetTextureWidth(TplArray); - int Height = Wii.TPL.GetTextureHeight(TplArray); - - Image Img = new Bitmap(Width, Height); - Wii.TPL.ConvertToTPL(Img, Tpl, 5); - } - } - } - - private void EnableControls(object sender, EventArgs e) - { - for (int i = 0; i < tabControl.TabCount; i++) - { - if (tabControl.TabPages[i] != tabSource) - { - foreach (Control Ctrl in tabControl.TabPages[i].Controls) - { - if (Ctrl is Button) 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 ComboBox) Ctrl.Enabled = true; - } - } - } - } - - private void DisableControls(object sender, EventArgs e) - { - for (int i = 0; i < tabControl.TabCount; i++) - { - if (tabControl.TabPages[i] != tabSource) - { - foreach (Control Ctrl in tabControl.TabPages[i].Controls) - { - if (Ctrl is Button) 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 ComboBox) Ctrl.Enabled = false; - } - } - } - } - private void UpdateCheck() { if (CheckInet() == true) @@ -1012,9 +695,9 @@ namespace CustomizeMii { if (lbxBaseWads.SelectedIndex != -1) { - if (CheckInet() == true) + if (pbProgress.Value == 100) { - if (pbProgress.Value == 100) + if (CheckInet() == true) { #if Mono CommonKeyCheck(); @@ -1043,11 +726,10 @@ namespace CustomizeMii } } } - - } - else - { - ErrorBox("You're not connected to the Internet!"); + else + { + ErrorBox("You're not connected to the Internet!"); + } } } } @@ -2187,32 +1869,40 @@ namespace CustomizeMii { if (!string.IsNullOrEmpty(tbSourceWad.Text)) { - if (cbFailureChecks.Checked == true || FailureCheck() == true) + if (!File.Exists(Application.StartupPath + "\\CustomizeMiiInstaller.dll")) { - try + ErrorBox("The CustomizeMiiInstaller.dll wasn't found!"); + } + else + { + if (cbFailureChecks.Checked == true || FailureCheck() == true) { - WadCreationInfo wadInfo = new WadCreationInfo(); - wadInfo.outFile = TempPath + "SendToWii.wad"; - wadInfo.nandLoader = (WadCreationInfo.NandLoader)cmbNandLoader.SelectedIndex; - wadInfo.sendToWii = true; + CustomizeMii_Transmit cmt = new CustomizeMii_Transmit(); - 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); + if (cmt.ShowDialog() == DialogResult.OK) + { + try + { + WadCreationInfo wadInfo = new WadCreationInfo(); + wadInfo.outFile = TempPath + "SendToWii.wad"; + wadInfo.nandLoader = (WadCreationInfo.NandLoader)cmbNandLoader.SelectedIndex; + wadInfo.sendToWii = true; + wadInfo.transmitProtocol = (TransmitProtocol)cmt.Protocol; + wadInfo.transmitIp = cmt.IPAddress; + wadInfo.transmitIos = int.Parse(cmt.IOS); - // @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) - { - ErrorBox(ex.Message); + 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) + { + ErrorBox(ex.Message); + } + } } } } @@ -2934,6 +2624,46 @@ namespace CustomizeMii } catch (Exception ex) { ErrorBox(ex.Message); } } + else if (cmSender.OwnerItem == tsExtractBrl) + { + try + { + FolderBrowserDialog fbd = new FolderBrowserDialog(); + fbd.Description = "Select the path where the files will be extracted to."; + + if (fbd.ShowDialog() == DialogResult.OK) + { + if (cmSender == cmExtractBrlyt || cmSender == cmExtractBothBrl) + { + //Extract brlyts + string[] bannerFiles = Directory.GetFiles(GetCurBannerPath() + "blyt", "*.brlyt"); + string[] iconFiles = Directory.GetFiles(GetCurIconPath() + "blyt", "*.brlyt"); + + foreach (string thisFile in bannerFiles) + File.Copy(thisFile, fbd.SelectedPath + "\\" + Path.GetFileName(thisFile),true); + + foreach (string thisFile in iconFiles) + File.Copy(thisFile, fbd.SelectedPath + "\\" + Path.GetFileName(thisFile), true); + } + + if (cmSender == cmExtractBothBrl || cmSender == cmExtractBrlan) + { + //Extract brlans + string[] bannerFiles = Directory.GetFiles(GetCurBannerPath() + "anim", "*.brlan"); + string[] iconFiles = Directory.GetFiles(GetCurIconPath() + "anim", "*.brlan"); + + foreach (string thisFile in bannerFiles) + File.Copy(thisFile, fbd.SelectedPath + "\\" + Path.GetFileName(thisFile), true); + + foreach (string thisFile in iconFiles) + File.Copy(thisFile, fbd.SelectedPath + "\\" + Path.GetFileName(thisFile), true); + } + + InfoBox("Extracted files successfully!"); + } + } + catch (Exception ex) { ErrorBox(ex.Message); } + } else //DOL { try @@ -3163,5 +2893,49 @@ namespace CustomizeMii ErrorBox(ex.Message); } } + + private void llbTranslateChannel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + if (!tbAllLanguages.Text.ToLower().Contains("channel")) + { + tbAllLanguages.Focus(); + tbAllLanguages.SelectAll(); + return; + } + + string tempText = tbAllLanguages.Text; + int startIndex = tempText.ToLower().IndexOf("channel"); + + try + { + tbEnglish.Text = tempText.Remove(startIndex, 7).Insert(startIndex, "Channel"); + tbJapanese.Text = tempText.Remove(startIndex, 7).Insert(startIndex, "チャンネル"); + tbGerman.Text = tempText.Remove(startIndex, 7).Insert(startIndex, "Kanal"); + tbDutch.Text = tempText.Remove(startIndex, 7).Insert(startIndex, "Kanaal"); + + if (tempText[startIndex - 1] != ' ') tbFrench.Text = tempText.Remove(startIndex, 7).Insert(0, "Chaîne "); + 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 "); + else tbSpanish.Text = tempText.Remove(startIndex - 1, 8).Insert(0, "Canal "); + if (tempText[startIndex - 1] != ' ') tbItalian.Text = tempText.Remove(startIndex, 7).Insert(0, "Canale "); + else tbItalian.Text = tempText.Remove(startIndex - 1, 8).Insert(0, "Canale "); + + tbAllLanguages.Text = string.Empty; + } + catch (Exception ex) + { + tbAllLanguages.Text = tempText; + + tbEnglish.Text = string.Empty; + tbJapanese.Text = string.Empty; + tbGerman.Text = string.Empty; + tbFrench.Text = string.Empty; + tbSpanish.Text = string.Empty; + tbItalian.Text = string.Empty; + tbDutch.Text = string.Empty; + + ErrorBox(ex.Message); + } + } } } diff --git a/CustomizeMii/CustomizeMii_PrivateFunctions.cs b/CustomizeMii/CustomizeMii_PrivateFunctions.cs index 9977b09..1110d4d 100644 --- a/CustomizeMii/CustomizeMii_PrivateFunctions.cs +++ b/CustomizeMii/CustomizeMii_PrivateFunctions.cs @@ -1,4 +1,21 @@ -using System; +/* This file is part of CustomizeMii + * Copyright (C) 2009 Leathl + * + * CustomizeMii is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * CustomizeMii is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +using System; using System.Windows.Forms; using System.ComponentModel; using System.IO; @@ -8,6 +25,334 @@ namespace CustomizeMii { partial class CustomizeMii_Main { + private void FixTpls() + { + string[] bannerTpls = Directory.GetFiles(GetCurBannerPath() + "timg\\", "*.tpl"); + string[] iconTpls = Directory.GetFiles(GetCurIconPath() + "timg\\", "*.tpl"); + + foreach (string thisTpl in bannerTpls) + Wii.TPL.FixFilter(thisTpl); + + foreach (string thisTpl in iconTpls) + Wii.TPL.FixFilter(thisTpl); + } + + private void EnableControls(object sender, EventArgs e) + { + for (int i = 0; i < tabControl.TabCount; i++) + { + if (tabControl.TabPages[i] != tabSource) + { + foreach (Control Ctrl in tabControl.TabPages[i].Controls) + { + if (Ctrl is Button) 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 ComboBox) Ctrl.Enabled = true; + else if (Ctrl is LinkLabel && Ctrl.Tag != (object)"Independent") Ctrl.Enabled = true; + } + } + } + } + + private void DisableControls(object sender, EventArgs e) + { + for (int i = 0; i < tabControl.TabCount; i++) + { + if (tabControl.TabPages[i] != tabSource) + { + foreach (Control Ctrl in tabControl.TabPages[i].Controls) + { + if (Ctrl is Button) 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 ComboBox) Ctrl.Enabled = false; + else if (Ctrl is LinkLabel && Ctrl.Tag != (object)"Independent") Ctrl.Enabled = false; + } + } + } + } + + private Image ResizeImage(Image img, int x, int y) + { + Image newimage = new Bitmap(x, y); + using (Graphics gfx = Graphics.FromImage(newimage)) + { + gfx.DrawImage(img, 0, 0, x, y); + } + return newimage; + } + + private string GetCurBannerPath() + { + if (string.IsNullOrEmpty(BannerReplace)) + return TempUnpackPath + "00000000.app_OUT\\meta\\banner.bin_OUT\\arc\\"; + else + return TempBannerPath + "arc\\"; + } + + private string GetCurIconPath() + { + if (string.IsNullOrEmpty(IconReplace)) + return TempUnpackPath + "00000000.app_OUT\\meta\\icon.bin_OUT\\arc\\"; + else + return TempIconPath + "arc\\"; + } + + private void SetText(TextBox tb, string text) + { + SetTextInvoker invoker = new SetTextInvoker(this.SetText); + this.Invoke(invoker, text, tb); + } + + private void SetText(string text, TextBox tb) + { + tb.Text = text; + } + + private void SetLabel(Label lb, string text) + { + SetLabelInvoker invoker = new SetLabelInvoker(this.SetLabel); + this.Invoke(invoker, text, lb); + } + + private void SetLabel(string text, Label lb) + { + lb.Text = text; + } + + private void AddBannerTpls(object sender, EventArgs e) + { + try + { + string[] BannerTpls; + if (string.IsNullOrEmpty(BannerReplace)) + BannerTpls = Directory.GetFiles(TempUnpackBannerTplPath); + else + BannerTpls = Directory.GetFiles(TempBannerPath + "arc\\timg"); + + AddBannerTpls(BannerTpls); + } + catch { } + } + + private void AddIconTpls(object sender, EventArgs e) + { + try + { + string[] IconTpls; + if (string.IsNullOrEmpty(IconReplace)) + IconTpls = Directory.GetFiles(TempUnpackIconTplPath); + else + IconTpls = Directory.GetFiles(TempIconPath + "arc\\timg"); + + AddIconTpls(IconTpls); + } + catch { } + } + + private void AddBannerTpls(string[] tpls) + { + if (tpls.Length > 0) + { + lbxBannerTpls.Items.Clear(); + BannerTplPath = tpls[0].Remove(tpls[0].LastIndexOf('\\') + 1); + + for (int i = 0; i < tpls.Length; i++) + { + if (BannerTransparents.Contains(tpls[i].Remove(0, tpls[i].LastIndexOf('\\') + 1))) + lbxBannerTpls.Items.Add(tpls[i].Remove(0, tpls[i].LastIndexOf('\\') + 1) + " (Transparent)"); + else + lbxBannerTpls.Items.Add(tpls[i].Remove(0, tpls[i].LastIndexOf('\\') + 1)); + } + } + } + + private void AddIconTpls(string[] tpls) + { + if (tpls.Length > 0) + { + lbxIconTpls.Items.Clear(); + IconTplPath = tpls[0].Remove(tpls[0].LastIndexOf('\\') + 1); + + for (int i = 0; i < tpls.Length; i++) + { + if (IconTransparents.Contains(tpls[i].Remove(0, tpls[i].LastIndexOf('\\') + 1))) + lbxIconTpls.Items.Add(tpls[i].Remove(0, tpls[i].LastIndexOf('\\') + 1) + " (Transparent)"); + else + lbxIconTpls.Items.Add(tpls[i].Remove(0, tpls[i].LastIndexOf('\\') + 1)); + } + } + } + + private void AddBrlyts(object sender, EventArgs e) + { + try + { + string[] BannerBrlyt; + if (string.IsNullOrEmpty(BannerReplace)) + BannerBrlyt = Directory.GetFiles(TempUnpackBannerBrlytPath); + else + BannerBrlyt = Directory.GetFiles(TempBannerPath + "arc\\blyt"); + + string[] IconBrlyt; + if (string.IsNullOrEmpty(IconReplace)) + IconBrlyt = Directory.GetFiles(TempUnpackIconBrlytPath); + else + IconBrlyt = Directory.GetFiles(TempIconPath + "arc\\blyt"); + + AddBannerBrlyt(BannerBrlyt); + AddIconBrlyt(IconBrlyt); + + if (lbxBrlytBanner.SelectedIndex == -1 && lbxBrlytIcon.SelectedIndex == -1) + { + if (lbxBrlytBanner.Items.Count > 0) lbxBrlytBanner.SelectedIndex = 0; + else if (lbxBrlytIcon.Items.Count > 0) lbxBrlytIcon.SelectedIndex = 0; + } + } + catch { } + } + + private void AddBrlans(object sender, EventArgs e) + { + try + { + string[] BannerBrlan; + if (string.IsNullOrEmpty(BannerReplace)) + BannerBrlan = Directory.GetFiles(TempUnpackBannerBrlanPath); + else + BannerBrlan = Directory.GetFiles(TempBannerPath + "arc\\anim"); + + string[] IconBrlan; + if (string.IsNullOrEmpty(IconReplace)) + IconBrlan = Directory.GetFiles(TempUnpackIconBrlanPath); + else + IconBrlan = Directory.GetFiles(TempIconPath + "arc\\anim"); + + AddBannerBrlan(BannerBrlan); + AddIconBrlan(IconBrlan); + + if (lbxBrlanBanner.SelectedIndex == -1 && lbxBrlanIcon.SelectedIndex == -1) + { + if (lbxBrlanBanner.Items.Count > 0) lbxBrlanBanner.SelectedIndex = 0; + else if (lbxBrlanIcon.Items.Count > 0) lbxBrlanIcon.SelectedIndex = 0; + } + } + catch { } + } + + private void AddBannerBrlyt(string[] brlyt) + { + if (brlyt.Length > 0) + { + lbxBrlytBanner.Items.Clear(); + BannerBrlytPath = brlyt[0].Remove(brlyt[0].LastIndexOf('\\') + 1); + + for (int i = 0; i < brlyt.Length; i++) + { + lbxBrlytBanner.Items.Add(brlyt[i].Remove(0, brlyt[i].LastIndexOf('\\') + 1)); + } + } + } + + private void AddIconBrlyt(string[] brlyt) + { + if (brlyt.Length > 0) + { + lbxBrlytIcon.Items.Clear(); + IconBrlytPath = brlyt[0].Remove(brlyt[0].LastIndexOf('\\') + 1); + + for (int i = 0; i < brlyt.Length; i++) + { + lbxBrlytIcon.Items.Add(brlyt[i].Remove(0, brlyt[i].LastIndexOf('\\') + 1)); + } + } + } + + private void AddBannerBrlan(string[] brlan) + { + if (brlan.Length > 0) + { + lbxBrlanBanner.Items.Clear(); + BannerBrlanPath = brlan[0].Remove(brlan[0].LastIndexOf('\\') + 1); + + for (int i = 0; i < brlan.Length; i++) + { + lbxBrlanBanner.Items.Add(brlan[i].Remove(0, brlan[i].LastIndexOf('\\') + 1)); + } + } + } + + private void AddIconBrlan(string[] brlan) + { + if (brlan.Length > 0) + { + lbxBrlanIcon.Items.Clear(); + IconBrlanPath = brlan[0].Remove(brlan[0].LastIndexOf('\\') + 1); + + for (int i = 0; i < brlan.Length; i++) + { + lbxBrlanIcon.Items.Add(brlan[i].Remove(0, brlan[i].LastIndexOf('\\') + 1)); + } + } + } + + private void ErrorBox(string message) + { + BoxInvoker invoker = new BoxInvoker(this.errorBox); + this.Invoke(invoker, new object[] { message }); + } + + private void errorBox(string message) + { + MessageBox.Show(message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + private void InfoBox(string message) + { + BoxInvoker invoker = new BoxInvoker(this.infoBox); + this.Invoke(invoker, new object[] { message }); + } + + private void infoBox(string message) + { + MessageBox.Show(message, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + + private void MakeBannerTplsTransparent() + { + foreach (string thisTpl in lbxBannerTpls.Items) + { + if (thisTpl.EndsWith("(Transparent)")) + { + string Tpl = GetCurBannerPath() + "timg\\" + thisTpl.Replace(" (Transparent)", string.Empty); + byte[] TplArray = Wii.Tools.LoadFileToByteArray(Tpl); + int Width = Wii.TPL.GetTextureWidth(TplArray); + int Height = Wii.TPL.GetTextureHeight(TplArray); + + Image Img = new Bitmap(Width, Height); + Wii.TPL.ConvertToTPL(Img, Tpl, 5); + } + } + } + + private void MakeIconTplsTransparent() + { + foreach (string thisTpl in lbxIconTpls.Items) + { + if (thisTpl.EndsWith("(Transparent)")) + { + string Tpl = GetCurIconPath() + "timg\\" + thisTpl.Replace(" (Transparent)", string.Empty); + byte[] TplArray = Wii.Tools.LoadFileToByteArray(Tpl); + int Width = Wii.TPL.GetTextureWidth(TplArray); + int Height = Wii.TPL.GetTextureHeight(TplArray); + + Image Img = new Bitmap(Width, Height); + Wii.TPL.ConvertToTPL(Img, Tpl, 5); + } + } + } + private void AddTpl(ListBox lbx) { AddTpl(lbx, null); @@ -92,7 +437,7 @@ namespace CustomizeMii private void LoadChannel(string inputFile) { - if (this.Mono) CommonKeyCheck(); + if (Mono) CommonKeyCheck(); if (pbProgress.Value == 100) { diff --git a/CustomizeMii/CustomizeMii_Structs.cs b/CustomizeMii/CustomizeMii_Structs.cs index d4775e7..24946ba 100644 --- a/CustomizeMii/CustomizeMii_Structs.cs +++ b/CustomizeMii/CustomizeMii_Structs.cs @@ -14,9 +14,23 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - - namespace CustomizeMii + +namespace CustomizeMii { + public struct TransmitInfo + { + public bool usedCompression; + public double compressionRatio; + public double transmittedLength; + public int timeElapsed; + } + + public enum TransmitProtocol : int + { + JODI = 0, + HAXX = 1 + } + public struct BnsConversionInfo { public enum LoopType @@ -43,6 +57,10 @@ public string outFile; public NandLoader nandLoader; public bool sendToWii; + public TransmitProtocol transmitProtocol; + public string transmitIp; + public int transmitIos; + public bool saveAfterTransmit; } public struct Progress diff --git a/CustomizeMii/CustomizeMii_Transmit.Designer.cs b/CustomizeMii/CustomizeMii_Transmit.Designer.cs new file mode 100644 index 0000000..f399f19 --- /dev/null +++ b/CustomizeMii/CustomizeMii_Transmit.Designer.cs @@ -0,0 +1,168 @@ +/* This file is part of CustomizeMii + * Copyright (C) 2009 Leathl + * + * CustomizeMii is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * CustomizeMii is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +namespace CustomizeMii +{ + partial class CustomizeMii_Transmit + { + /// + /// Erforderliche Designervariable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Verwendete Ressourcen bereinigen. + /// + /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Vom Windows Form-Designer generierter Code + + /// + /// Erforderliche Methode für die Designerunterstützung. + /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. + /// + private void InitializeComponent() + { + this.lbProtocol = new System.Windows.Forms.Label(); + this.cmbProtocol = new System.Windows.Forms.ComboBox(); + this.lbIP = new System.Windows.Forms.Label(); + this.tbIP = new System.Windows.Forms.TextBox(); + this.lbIOS = new System.Windows.Forms.Label(); + this.tbIOS = new System.Windows.Forms.TextBox(); + this.btnTransmit = new System.Windows.Forms.Button(); + this.btnCancel = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // lbProtocol + // + this.lbProtocol.AutoSize = true; + this.lbProtocol.Location = new System.Drawing.Point(12, 16); + this.lbProtocol.Name = "lbProtocol"; + this.lbProtocol.Size = new System.Drawing.Size(49, 13); + this.lbProtocol.TabIndex = 0; + this.lbProtocol.Text = "Protocol:"; + // + // cmbProtocol + // + this.cmbProtocol.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cmbProtocol.FormattingEnabled = true; + this.cmbProtocol.Items.AddRange(new object[] { + "Homebrewchannel 1.0.5+ (JODI)", + "Homebrewchannel -1.0.4 (HAXX)"}); + this.cmbProtocol.Location = new System.Drawing.Point(67, 13); + this.cmbProtocol.Name = "cmbProtocol"; + this.cmbProtocol.Size = new System.Drawing.Size(194, 21); + this.cmbProtocol.TabIndex = 1; + // + // lbIP + // + this.lbIP.AutoSize = true; + this.lbIP.Location = new System.Drawing.Point(12, 48); + this.lbIP.Name = "lbIP"; + this.lbIP.Size = new System.Drawing.Size(61, 13); + this.lbIP.TabIndex = 2; + this.lbIP.Text = "IP Address:"; + // + // tbIP + // + this.tbIP.Location = new System.Drawing.Point(79, 45); + this.tbIP.Name = "tbIP"; + this.tbIP.Size = new System.Drawing.Size(182, 20); + this.tbIP.TabIndex = 3; + // + // lbIOS + // + this.lbIOS.AutoSize = true; + this.lbIOS.Location = new System.Drawing.Point(12, 78); + this.lbIOS.Name = "lbIOS"; + this.lbIOS.Size = new System.Drawing.Size(127, 13); + this.lbIOS.TabIndex = 4; + this.lbIOS.Text = "IOS to use for installation:"; + // + // tbIOS + // + this.tbIOS.Location = new System.Drawing.Point(145, 75); + this.tbIOS.Name = "tbIOS"; + this.tbIOS.Size = new System.Drawing.Size(116, 20); + this.tbIOS.TabIndex = 5; + this.tbIOS.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.tbIOS_KeyPress); + // + // btnTransmit + // + this.btnTransmit.Location = new System.Drawing.Point(15, 109); + this.btnTransmit.Name = "btnTransmit"; + this.btnTransmit.Size = new System.Drawing.Size(120, 23); + this.btnTransmit.TabIndex = 6; + this.btnTransmit.Text = "Transmit"; + this.btnTransmit.UseVisualStyleBackColor = true; + this.btnTransmit.Click += new System.EventHandler(this.btnTransmit_Click); + // + // btnCancel + // + this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.btnCancel.Location = new System.Drawing.Point(141, 109); + this.btnCancel.Name = "btnCancel"; + this.btnCancel.Size = new System.Drawing.Size(120, 23); + this.btnCancel.TabIndex = 6; + this.btnCancel.Text = "Cancel"; + this.btnCancel.UseVisualStyleBackColor = true; + this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); + // + // CustomizeMii_Transmit + // + this.AcceptButton = this.btnTransmit; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.btnCancel; + this.ClientSize = new System.Drawing.Size(273, 145); + this.Controls.Add(this.btnCancel); + this.Controls.Add(this.btnTransmit); + this.Controls.Add(this.tbIOS); + this.Controls.Add(this.lbIOS); + this.Controls.Add(this.tbIP); + this.Controls.Add(this.lbIP); + this.Controls.Add(this.cmbProtocol); + this.Controls.Add(this.lbProtocol); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; + this.Name = "CustomizeMii_Transmit"; + this.Text = "CustomizeMii_Transmit"; + this.Load += new System.EventHandler(this.CustomizeMii_Transmit_Load); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label lbProtocol; + private System.Windows.Forms.ComboBox cmbProtocol; + private System.Windows.Forms.Label lbIP; + private System.Windows.Forms.TextBox tbIP; + private System.Windows.Forms.Label lbIOS; + private System.Windows.Forms.TextBox tbIOS; + private System.Windows.Forms.Button btnTransmit; + private System.Windows.Forms.Button btnCancel; + } +} \ No newline at end of file diff --git a/CustomizeMii/CustomizeMii_Transmit.cs b/CustomizeMii/CustomizeMii_Transmit.cs new file mode 100644 index 0000000..57afe0d --- /dev/null +++ b/CustomizeMii/CustomizeMii_Transmit.cs @@ -0,0 +1,91 @@ +/* This file is part of CustomizeMii + * Copyright (C) 2009 Leathl + * + * CustomizeMii is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * CustomizeMii is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +using System.Text.RegularExpressions; +using System.Windows.Forms; + +namespace CustomizeMii +{ + public partial class CustomizeMii_Transmit : Form + { + public int Protocol { get { return cmbProtocol.SelectedIndex; } set { cmbProtocol.SelectedIndex = value; } } + public string IPAddress { get { return tbIP.Text; } set { tbIP.Text = value; } } + public string IOS { get { return tbIOS.Text; } set { tbIOS.Text = value; } } + + public CustomizeMii_Transmit() + { + InitializeComponent(); + this.CenterToParent(); + } + + private void CustomizeMii_Transmit_Load(object sender, System.EventArgs e) + { + try + { + cmbProtocol.SelectedIndex = Properties.Settings.Default.Protocol; + tbIP.Text = Properties.Settings.Default.IP; + tbIOS.Text = Properties.Settings.Default.IOS; + } + catch { } + } + + private void btnCancel_Click(object sender, System.EventArgs e) + { + this.DialogResult = DialogResult.Cancel; + this.Close(); + } + + private void btnTransmit_Click(object sender, System.EventArgs e) + { + string IpPattern = @"([01]?\d\d?|2[0-4]\d|25[0-5])\." + + @"([01]?\d\d?|2[0-4]\d|25[0-5])\." + + @"([01]?\d\d?|2[0-4]\d|25[0-5])\." + + @"([01]?\d\d?|2[0-4]\d|25[0-5])"; + Regex IpAdress = new Regex(IpPattern); + + if (IpAdress.IsMatch(tbIP.Text)) + { + int tmp = int.Parse(tbIOS.Text); + if (tmp > 0 && tmp < 255) + { + Properties.Settings.Default.Protocol = cmbProtocol.SelectedIndex; + Properties.Settings.Default.IP = tbIP.Text; + Properties.Settings.Default.IOS = tbIOS.Text; + Properties.Settings.Default.Save(); + + this.DialogResult = DialogResult.OK; + this.Close(); + } + else + { + tbIOS.Focus(); + tbIOS.SelectAll(); + } + } + else + { + tbIP.Focus(); + tbIP.SelectAll(); + } + } + + private void tbIOS_KeyPress(object sender, KeyPressEventArgs e) + { + e.Handled = !char.IsDigit(e.KeyChar) && e.KeyChar != '\b'; + } + } +} diff --git a/CustomizeMii/CustomizeMii_Transmit.resx b/CustomizeMii/CustomizeMii_Transmit.resx new file mode 100644 index 0000000..ff31a6d --- /dev/null +++ b/CustomizeMii/CustomizeMii_Transmit.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/CustomizeMii/CustomizeMii_zlib.cs b/CustomizeMii/CustomizeMii_zlib.cs new file mode 100644 index 0000000..4bf2508 --- /dev/null +++ b/CustomizeMii/CustomizeMii_zlib.cs @@ -0,0 +1,59 @@ +/* This file is part of TransmitMii + * Copyright (C) 2009 Leathl + * + * TransmitMii is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * TransmitMii is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +using System; +using System.IO; +using System.Runtime.InteropServices; + +namespace TransmitMii +{ + public static class zlib + { + public enum ZLibError : int + { + Z_OK = 0, + Z_STREAM_END = 1, + Z_NEED_DICT = 2, + Z_ERRNO = (-1), + Z_STREAM_ERROR = (-2), + Z_DATA_ERROR = (-3), + Z_MEM_ERROR = (-4), + Z_BUF_ERROR = (-5), + Z_VERSION_ERROR = (-6) + } + + [DllImport("zlib1.dll")] + private static extern ZLibError compress2(byte[] dest, ref int destLength, byte[] source, int sourceLength, int level); + + public static byte[] Compress(byte[] inFile) + { + ZLibError err; + byte[] outFile = new byte[inFile.Length]; + int outLength = -1; + + err = compress2(outFile, ref outLength, inFile, inFile.Length, 6); + + if (err == ZLibError.Z_OK && outLength > -1) + { + Array.Resize(ref outFile, outLength); + return outFile; + } + else + throw new Exception("An error occured while compressing! Code: " + err.ToString()); + } + } +} diff --git a/CustomizeMii/Properties/Resources.Designer.cs b/CustomizeMii/Properties/Resources.Designer.cs index b220131..2e3a4cb 100644 --- a/CustomizeMii/Properties/Resources.Designer.cs +++ b/CustomizeMii/Properties/Resources.Designer.cs @@ -1,4 +1,21 @@ -//------------------------------------------------------------------------------ +/* This file is part of CustomizeMii + * Copyright (C) 2009 Leathl + * + * CustomizeMii is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * CustomizeMii is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +//------------------------------------------------------------------------------ // // Dieser Code wurde von einem Tool generiert. // Laufzeitversion:2.0.50727.4927 diff --git a/CustomizeMii/Properties/Settings.Designer.cs b/CustomizeMii/Properties/Settings.Designer.cs index c26659c..85009d5 100644 --- a/CustomizeMii/Properties/Settings.Designer.cs +++ b/CustomizeMii/Properties/Settings.Designer.cs @@ -17,31 +17,63 @@ //------------------------------------------------------------------------------ // -// This code was generated by a tool. -// Runtime Version:2.0.50727.4927 +// Dieser Code wurde von einem Tool generiert. +// Laufzeitversion:2.0.50727.4927 // -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. +// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn +// der Code erneut generiert wird. // //------------------------------------------------------------------------------ -namespace CustomizeMii.Properties -{ - - +namespace CustomizeMii.Properties { + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase - { - + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default - { - get - { + + public static Settings Default { + get { return defaultInstance; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("0")] + public int Protocol { + get { + return ((int)(this["Protocol"])); + } + set { + this["Protocol"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string IP { + get { + return ((string)(this["IP"])); + } + set { + this["IP"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string IOS { + get { + return ((string)(this["IOS"])); + } + set { + this["IOS"] = value; + } + } } } diff --git a/CustomizeMii/Properties/Settings.settings b/CustomizeMii/Properties/Settings.settings index abf36c5..a5ec023 100644 --- a/CustomizeMii/Properties/Settings.settings +++ b/CustomizeMii/Properties/Settings.settings @@ -1,7 +1,15 @@  - - - - - - + + + + + 0 + + + + + + + + + \ No newline at end of file diff --git a/CustomizeMii/Readme.txt b/CustomizeMii/Readme.txt index 8aa5eed..dac638b 100644 --- a/CustomizeMii/Readme.txt +++ b/CustomizeMii/Readme.txt @@ -10,12 +10,14 @@ Thanks to icefire / Xuzz for the basic idea of this Application! Changelog: Version 2.1 + - Added CustomizeMii Installer (by WiiCrazy / I.R.on) + - Fixed rough edges (artifacts) on images (will be fixed automatically) - Replaced the TPL preview window with the one from ShowMiiWads for easier handling - Added loop prelistening to the BNS conversion window (only for wave files) - Added drag & drop ability cause the file dialogs kept bothering me - Improvement in startup speed (thanks shadow1643) - - Added Unix timestamp as footer (interesting to know when channels were created, huh?) - - Little improvements + - Added creation/last edited time (only for CustomizeMii 2.1+ channels) + - Little improvements and fixes Version 2.01 - Base WAD downloading works again @@ -69,6 +71,7 @@ The author can't be held responsible for any damages arising from the use of it. ----------------------------------------------------------------------------------------- Thanks: +WiiCrazy / I.R.on for CustomizeMii Installer Xuzz for his idea and hard work Xuzz, SquidMan, megazig, Matt_P, Omega and The Lemon Man for Wii.py SquidMan for Zetsubou diff --git a/CustomizeMii/Wii.cs b/CustomizeMii/Wii.cs index 6b65b12..81532f4 100644 --- a/CustomizeMii/Wii.cs +++ b/CustomizeMii/Wii.cs @@ -683,49 +683,6 @@ namespace Wii { string[] titles = new string[7]; - //Detection from footer is turned off, cause the footer - //can be easily edited and thus the titles in it could be simply wrong - - //int footer = GetFooterSize(wadfile); - //if (footer > 0) - //{ - // int footerpos = wadfile.Length - footer; - // int count = 0; - // int imetpos = 0; - - // if ((wadfile.Length - (wadfile.Length - footer)) < 250) return new string[7]; - - // for (int z = 0; z < 250; z++) - // { - // if (Convert.ToChar(wadfile[footerpos + z]) == 'I') - // if (Convert.ToChar(wadfile[footerpos + z + 1]) == 'M') - // if (Convert.ToChar(wadfile[footerpos + z + 2]) == 'E') - // if (Convert.ToChar(wadfile[footerpos + z + 3]) == 'T') - // { - // imetpos = footerpos + z; - // break; - // } - // } - - // int jappos = imetpos + 29; - - // for (int i = jappos; i < jappos + 588; i += 84) - // { - // for (int j = 0; j < 40; j += 2) - // { - // if (wadfile[i + j] != 0x00) - // { - // char temp = Convert.ToChar(wadfile[i + j]); - // titles[count] += temp; - // } - // } - - // count++; - // } - - // return titles; - //} - string[,] conts = GetContentInfo(wadfile); byte[] titlekey = GetTitleKey(wadfile); int nullapp = 0; @@ -741,36 +698,56 @@ namespace Wii if (contenthandle.Length < 400) return new string[7]; - for (int z = 0; z < 400; z++) + if (!channeltype.Contains("Downloaded")) { - if (Convert.ToChar(contenthandle[z]) == 'I') - if (Convert.ToChar(contenthandle[z + 1]) == 'M') - if (Convert.ToChar(contenthandle[z + 2]) == 'E') - if (Convert.ToChar(contenthandle[z + 3]) == 'T') - { - imetpos = z; - break; - } - } - - int jappos = imetpos + 29; - int count = 0; - - for (int i = jappos; i < jappos + 588; i += 84) - { - for (int j = 0; j < 40; j += 2) + for (int z = 0; z < 400; z++) { - if (contenthandle[i + j] != 0x00) + if (Convert.ToChar(contenthandle[z]) == 'I') + if (Convert.ToChar(contenthandle[z + 1]) == 'M') + if (Convert.ToChar(contenthandle[z + 2]) == 'E') + if (Convert.ToChar(contenthandle[z + 3]) == 'T') + { + imetpos = z; + break; + } + } + + int jappos = imetpos + 29; + int count = 0; + + for (int i = jappos; i < jappos + 588; i += 84) + { + for (int j = 0; j < 40; j += 2) { - char temp = BitConverter.ToChar(new byte[] { contenthandle[i + j], contenthandle[i + j - 1] }, 0); - titles[count] += temp; + if (contenthandle[i + j] != 0x00) + { + char temp = BitConverter.ToChar(new byte[] { contenthandle[i + j], contenthandle[i + j - 1] }, 0); + titles[count] += temp; + } + } + + count++; + } + + return titles; + } + else + { + //DLC's + for (int j = 97; j < 97 + 40; j += 2) + { + if (contenthandle[j] != 0x00) + { + char temp = BitConverter.ToChar(new byte[] { contenthandle[j], contenthandle[j - 1] }, 0); + titles[0] += temp; } } - count++; - } + for (int i = 1; i < 7; i++) + titles[i] = titles[0]; - return titles; + return titles; + } } else return new string[7]; } @@ -1557,45 +1534,45 @@ namespace Wii if (japchars.Length > count) { contenthandle[x + 29] = BitConverter.GetBytes(japchars[count])[0]; - contenthandle[x + 30] = BitConverter.GetBytes(japchars[count])[1]; + contenthandle[x + 28] = BitConverter.GetBytes(japchars[count])[1]; } - else { contenthandle[x + 29] = 0x00; } + else { contenthandle[x + 29] = 0x00; contenthandle[x + 28] = 0x00; } if (engchars.Length > count) { contenthandle[x + 29 + 84] = BitConverter.GetBytes(engchars[count])[0]; contenthandle[x + 29 + 84 - 1] = BitConverter.GetBytes(engchars[count])[1]; } - else { contenthandle[x + 29 + 84] = 0x00; } + else { contenthandle[x + 29 + 84] = 0x00; contenthandle[x + 29 + 84 - 1] = 0x00; } if (gerchars.Length > count) { contenthandle[x + 29 + 84 * 2] = BitConverter.GetBytes(gerchars[count])[0]; contenthandle[x + 29 + 84 * 2 - 1] = BitConverter.GetBytes(gerchars[count])[1]; } - else { contenthandle[x + 29 + 84 * 2] = 0x00; } + else { contenthandle[x + 29 + 84 * 2] = 0x00; contenthandle[x + 29 + 84 * 2 - 1] = 0x00; } if (frachars.Length > count) { contenthandle[x + 29 + 84 * 3] = BitConverter.GetBytes(frachars[count])[0]; contenthandle[x + 29 + 84 * 3 - 1] = BitConverter.GetBytes(frachars[count])[1]; } - else { contenthandle[x + 29 + 84 * 3] = 0x00; } + else { contenthandle[x + 29 + 84 * 3] = 0x00; contenthandle[x + 29 + 84 * 3 - 1] = 0x00; } if (spachars.Length > count) { contenthandle[x + 29 + 84 * 4] = BitConverter.GetBytes(spachars[count])[0]; contenthandle[x + 29 + 84 * 4 - 1] = BitConverter.GetBytes(spachars[count])[1]; } - else { contenthandle[x + 29 + 84 * 4] = 0x00; } + else { contenthandle[x + 29 + 84 * 4] = 0x00; contenthandle[x + 29 + 84 * 4 - 1] = 0x00; } if (itachars.Length > count) { contenthandle[x + 29 + 84 * 5] = BitConverter.GetBytes(itachars[count])[0]; contenthandle[x + 29 + 84 * 5 - 1] = BitConverter.GetBytes(itachars[count])[1]; } - else { contenthandle[x + 29 + 84 * 5] = 0x00; } + else { contenthandle[x + 29 + 84 * 5] = 0x00; contenthandle[x + 29 + 84 * 5 - 1] = 0x00; } if (dutchars.Length > count) { contenthandle[x + 29 + 84 * 6] = BitConverter.GetBytes(dutchars[count])[0]; contenthandle[x + 29 + 84 * 6 - 1] = BitConverter.GetBytes(dutchars[count])[1]; } - else { contenthandle[x + 29 + 84 * 6] = 0x00; } + else { contenthandle[x + 29 + 84 * 6] = 0x00; contenthandle[x + 29 + 84 * 6 - 1] = 0x00; } count++; } @@ -4232,6 +4209,30 @@ namespace Wii public class TPL { + /// + /// Fixes rough edges (artifacts), if necessary + /// + /// + public static void FixFilter(string tplFile) + { + using (FileStream fs = new FileStream(tplFile, FileMode.Open)) + { + fs.Seek(41, SeekOrigin.Begin); + if (fs.ReadByte() == 0x01) + { + fs.Seek(-1, SeekOrigin.Current); + fs.Write(new byte[] { 0x00, 0x00, 0x01 }, 0, 3); + } + + fs.Seek(45, SeekOrigin.Begin); + if (fs.ReadByte() == 0x01) + { + fs.Seek(-1, SeekOrigin.Current); + fs.Write(new byte[] { 0x00, 0x00, 0x01 }, 0, 3); + } + } + } + /// /// Converts a Tpl to a Bitmap /// @@ -4956,7 +4957,7 @@ namespace Wii UInt16 texwidth = (UInt16)img.Width; UInt32 texformat; UInt32 texdataoffset = 0x40; - byte[] rest = new byte[] { 00, 00, 00, 00, 00, 00, 00, 00, 00, 01, 00, 00, 00, 01, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00 }; + byte[] rest = new byte[] { 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 01, 00, 00, 00, 01, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00 }; //This should do it for our needs.. rest includes padding switch (format) @@ -5648,9 +5649,13 @@ namespace Wii { string wonum = tpls[i].Remove(tpls[i].LastIndexOf('.') - 1) + "00.tpl"; string wonum2 = tpls[i].Remove(tpls[i].LastIndexOf('.') - 2) + "00.tpl"; + string wonum3 = tpls[i].Remove(tpls[i].LastIndexOf('.') - 1) + "01.tpl"; + string wonum4 = tpls[i].Remove(tpls[i].LastIndexOf('.') - 2) + "01.tpl"; if (Tools.StringExistsInStringArray(wonum, brlytTpls) == false && - Tools.StringExistsInStringArray(wonum2, brlytTpls) == false) + Tools.StringExistsInStringArray(wonum2, brlytTpls) == false && + Tools.StringExistsInStringArray(wonum3, brlytTpls) == false && + Tools.StringExistsInStringArray(wonum4, brlytTpls) == false) { unuseds.Add(tpls[i]); missing = true; diff --git a/CustomizeMii/app.config b/CustomizeMii/app.config new file mode 100644 index 0000000..385be22 --- /dev/null +++ b/CustomizeMii/app.config @@ -0,0 +1,21 @@ + + + + +
+ + + + + + 0 + + + + + + + + + + \ No newline at end of file diff --git a/CustomizeMii/zlib1.dll b/CustomizeMii/zlib1.dll new file mode 100644 index 0000000..1cf8a47 Binary files /dev/null and b/CustomizeMii/zlib1.dll differ diff --git a/Helpers/Helpers.csproj b/CustomizeMiiInstaller/CustomizeMiiInstaller.csproj similarity index 91% rename from Helpers/Helpers.csproj rename to CustomizeMiiInstaller/CustomizeMiiInstaller.csproj index 65a6475..9f787c2 100644 --- a/Helpers/Helpers.csproj +++ b/CustomizeMiiInstaller/CustomizeMiiInstaller.csproj @@ -8,8 +8,8 @@ {475F3ADF-B529-449F-89DA-BA5E8BE15DD5} Library Properties - Helpers - Helpers + CustomizeMiiInstaller + CustomizeMiiInstaller v2.0 512 @@ -33,7 +33,6 @@ - diff --git a/Helpers/InstallerHelper.cs b/CustomizeMiiInstaller/InstallerHelper.cs similarity index 79% rename from Helpers/InstallerHelper.cs rename to CustomizeMiiInstaller/InstallerHelper.cs index 5d7fc79..df1f01d 100644 --- a/Helpers/InstallerHelper.cs +++ b/CustomizeMiiInstaller/InstallerHelper.cs @@ -1,11 +1,25 @@ -using System; -using System.Collections.Generic; -using System.Text; +/* This file is part of CustomizeMii + * Copyright (C) 2009 WiiCrazy / I.R.on + * + * CustomizeMii is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * CustomizeMii is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + using System.IO; using System.IO.Compression; using System.Security.Cryptography; -namespace Helpers +namespace CustomizeMiiInstaller { public class InstallerHelper { diff --git a/Helpers/Properties/AssemblyInfo.cs b/CustomizeMiiInstaller/Properties/AssemblyInfo.cs similarity index 58% rename from Helpers/Properties/AssemblyInfo.cs rename to CustomizeMiiInstaller/Properties/AssemblyInfo.cs index c6bff99..b214ada 100644 --- a/Helpers/Properties/AssemblyInfo.cs +++ b/CustomizeMiiInstaller/Properties/AssemblyInfo.cs @@ -1,15 +1,32 @@ -using System.Reflection; +/* This file is part of CustomizeMii + * Copyright (C) 2009 WiiCrazy / I.R.on + * + * CustomizeMii is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * CustomizeMii is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + + using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("Helpers")] +[assembly: AssemblyTitle("CustomizeMiiInstaller")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Irduco")] -[assembly: AssemblyProduct("Helpers")] +[assembly: AssemblyProduct("CustomizeMiiInstaller")] [assembly: AssemblyCopyright("Copyright © Irduco 2010")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/Helpers/Resources/CustomizeMiiInstaller.dol.z b/CustomizeMiiInstaller/Resources/CustomizeMiiInstaller.dol.z similarity index 100% rename from Helpers/Resources/CustomizeMiiInstaller.dol.z rename to CustomizeMiiInstaller/Resources/CustomizeMiiInstaller.dol.z diff --git a/CustomizeMiiInstaller/LICENSE.txt b/CustomizeMiiInstaller_Source/LICENSE.txt similarity index 100% rename from CustomizeMiiInstaller/LICENSE.txt rename to CustomizeMiiInstaller_Source/LICENSE.txt diff --git a/CustomizeMiiInstaller/Makefile b/CustomizeMiiInstaller_Source/Makefile similarity index 100% rename from CustomizeMiiInstaller/Makefile rename to CustomizeMiiInstaller_Source/Makefile diff --git a/CustomizeMiiInstaller/README.Orig.es.txt b/CustomizeMiiInstaller_Source/README.Orig.es.txt similarity index 100% rename from CustomizeMiiInstaller/README.Orig.es.txt rename to CustomizeMiiInstaller_Source/README.Orig.es.txt diff --git a/CustomizeMiiInstaller/README.Orig.txt b/CustomizeMiiInstaller_Source/README.Orig.txt similarity index 100% rename from CustomizeMiiInstaller/README.Orig.txt rename to CustomizeMiiInstaller_Source/README.Orig.txt diff --git a/CustomizeMiiInstaller/README.txt b/CustomizeMiiInstaller_Source/README.txt similarity index 100% rename from CustomizeMiiInstaller/README.txt rename to CustomizeMiiInstaller_Source/README.txt diff --git a/CustomizeMiiInstaller/data/background b/CustomizeMiiInstaller_Source/data/background similarity index 100% rename from CustomizeMiiInstaller/data/background rename to CustomizeMiiInstaller_Source/data/background diff --git a/CustomizeMiiInstaller/installer.pnproj b/CustomizeMiiInstaller_Source/installer.pnproj similarity index 100% rename from CustomizeMiiInstaller/installer.pnproj rename to CustomizeMiiInstaller_Source/installer.pnproj diff --git a/CustomizeMiiInstaller/installer.pnps b/CustomizeMiiInstaller_Source/installer.pnps similarity index 100% rename from CustomizeMiiInstaller/installer.pnps rename to CustomizeMiiInstaller_Source/installer.pnps diff --git a/CustomizeMiiInstaller/source/fat.c b/CustomizeMiiInstaller_Source/source/fat.c similarity index 100% rename from CustomizeMiiInstaller/source/fat.c rename to CustomizeMiiInstaller_Source/source/fat.c diff --git a/CustomizeMiiInstaller/source/fat.h b/CustomizeMiiInstaller_Source/source/fat.h similarity index 100% rename from CustomizeMiiInstaller/source/fat.h rename to CustomizeMiiInstaller_Source/source/fat.h diff --git a/CustomizeMiiInstaller/source/gui.c b/CustomizeMiiInstaller_Source/source/gui.c similarity index 100% rename from CustomizeMiiInstaller/source/gui.c rename to CustomizeMiiInstaller_Source/source/gui.c diff --git a/CustomizeMiiInstaller/source/gui.h b/CustomizeMiiInstaller_Source/source/gui.h similarity index 100% rename from CustomizeMiiInstaller/source/gui.h rename to CustomizeMiiInstaller_Source/source/gui.h diff --git a/CustomizeMiiInstaller/source/install.h b/CustomizeMiiInstaller_Source/source/install.h similarity index 100% rename from CustomizeMiiInstaller/source/install.h rename to CustomizeMiiInstaller_Source/source/install.h diff --git a/CustomizeMiiInstaller/source/libpng/png.h b/CustomizeMiiInstaller_Source/source/libpng/png.h similarity index 100% rename from CustomizeMiiInstaller/source/libpng/png.h rename to CustomizeMiiInstaller_Source/source/libpng/png.h diff --git a/CustomizeMiiInstaller/source/libpng/pngconf.h b/CustomizeMiiInstaller_Source/source/libpng/pngconf.h similarity index 100% rename from CustomizeMiiInstaller/source/libpng/pngconf.h rename to CustomizeMiiInstaller_Source/source/libpng/pngconf.h diff --git a/CustomizeMiiInstaller/source/libpng/pngu/pngu.c b/CustomizeMiiInstaller_Source/source/libpng/pngu/pngu.c similarity index 100% rename from CustomizeMiiInstaller/source/libpng/pngu/pngu.c rename to CustomizeMiiInstaller_Source/source/libpng/pngu/pngu.c diff --git a/CustomizeMiiInstaller/source/libpng/pngu/pngu.h b/CustomizeMiiInstaller_Source/source/libpng/pngu/pngu.h similarity index 100% rename from CustomizeMiiInstaller/source/libpng/pngu/pngu.h rename to CustomizeMiiInstaller_Source/source/libpng/pngu/pngu.h diff --git a/CustomizeMiiInstaller/source/menu.c b/CustomizeMiiInstaller_Source/source/menu.c similarity index 100% rename from CustomizeMiiInstaller/source/menu.c rename to CustomizeMiiInstaller_Source/source/menu.c diff --git a/CustomizeMiiInstaller/source/menu.h b/CustomizeMiiInstaller_Source/source/menu.h similarity index 100% rename from CustomizeMiiInstaller/source/menu.h rename to CustomizeMiiInstaller_Source/source/menu.h diff --git a/CustomizeMiiInstaller/source/restart.c b/CustomizeMiiInstaller_Source/source/restart.c similarity index 100% rename from CustomizeMiiInstaller/source/restart.c rename to CustomizeMiiInstaller_Source/source/restart.c diff --git a/CustomizeMiiInstaller/source/restart.h b/CustomizeMiiInstaller_Source/source/restart.h similarity index 100% rename from CustomizeMiiInstaller/source/restart.h rename to CustomizeMiiInstaller_Source/source/restart.h diff --git a/CustomizeMiiInstaller/source/sha1.c b/CustomizeMiiInstaller_Source/source/sha1.c similarity index 100% rename from CustomizeMiiInstaller/source/sha1.c rename to CustomizeMiiInstaller_Source/source/sha1.c diff --git a/CustomizeMiiInstaller/source/sha1.h b/CustomizeMiiInstaller_Source/source/sha1.h similarity index 100% rename from CustomizeMiiInstaller/source/sha1.h rename to CustomizeMiiInstaller_Source/source/sha1.h diff --git a/CustomizeMiiInstaller/source/stub.S b/CustomizeMiiInstaller_Source/source/stub.S similarity index 100% rename from CustomizeMiiInstaller/source/stub.S rename to CustomizeMiiInstaller_Source/source/stub.S diff --git a/CustomizeMiiInstaller/source/sys.c b/CustomizeMiiInstaller_Source/source/sys.c similarity index 100% rename from CustomizeMiiInstaller/source/sys.c rename to CustomizeMiiInstaller_Source/source/sys.c diff --git a/CustomizeMiiInstaller/source/sys.h b/CustomizeMiiInstaller_Source/source/sys.h similarity index 100% rename from CustomizeMiiInstaller/source/sys.h rename to CustomizeMiiInstaller_Source/source/sys.h diff --git a/CustomizeMiiInstaller/source/title.c b/CustomizeMiiInstaller_Source/source/title.c similarity index 100% rename from CustomizeMiiInstaller/source/title.c rename to CustomizeMiiInstaller_Source/source/title.c diff --git a/CustomizeMiiInstaller/source/title.h b/CustomizeMiiInstaller_Source/source/title.h similarity index 100% rename from CustomizeMiiInstaller/source/title.h rename to CustomizeMiiInstaller_Source/source/title.h diff --git a/CustomizeMiiInstaller/source/utils.h b/CustomizeMiiInstaller_Source/source/utils.h similarity index 100% rename from CustomizeMiiInstaller/source/utils.h rename to CustomizeMiiInstaller_Source/source/utils.h diff --git a/CustomizeMiiInstaller/source/video.c b/CustomizeMiiInstaller_Source/source/video.c similarity index 100% rename from CustomizeMiiInstaller/source/video.c rename to CustomizeMiiInstaller_Source/source/video.c diff --git a/CustomizeMiiInstaller/source/video.h b/CustomizeMiiInstaller_Source/source/video.h similarity index 100% rename from CustomizeMiiInstaller/source/video.h rename to CustomizeMiiInstaller_Source/source/video.h diff --git a/CustomizeMiiInstaller/source/wad-manager.c b/CustomizeMiiInstaller_Source/source/wad-manager.c similarity index 100% rename from CustomizeMiiInstaller/source/wad-manager.c rename to CustomizeMiiInstaller_Source/source/wad-manager.c diff --git a/CustomizeMiiInstaller/source/wad.c b/CustomizeMiiInstaller_Source/source/wad.c similarity index 100% rename from CustomizeMiiInstaller/source/wad.c rename to CustomizeMiiInstaller_Source/source/wad.c diff --git a/CustomizeMiiInstaller/source/wad.h b/CustomizeMiiInstaller_Source/source/wad.h similarity index 100% rename from CustomizeMiiInstaller/source/wad.h rename to CustomizeMiiInstaller_Source/source/wad.h diff --git a/CustomizeMiiInstaller/source/wpad.c b/CustomizeMiiInstaller_Source/source/wpad.c similarity index 100% rename from CustomizeMiiInstaller/source/wpad.c rename to CustomizeMiiInstaller_Source/source/wpad.c diff --git a/CustomizeMiiInstaller/source/wpad.h b/CustomizeMiiInstaller_Source/source/wpad.h similarity index 100% rename from CustomizeMiiInstaller/source/wpad.h rename to CustomizeMiiInstaller_Source/source/wpad.h diff --git a/ForwardMii-Plugin/ForwardMii.cs b/ForwardMii/ForwardMii.cs similarity index 100% rename from ForwardMii-Plugin/ForwardMii.cs rename to ForwardMii/ForwardMii.cs diff --git a/ForwardMii-Plugin/ForwardMii-Plugin.csproj b/ForwardMii/ForwardMii.csproj similarity index 84% rename from ForwardMii-Plugin/ForwardMii-Plugin.csproj rename to ForwardMii/ForwardMii.csproj index c1cf5fa..c79a5b8 100644 --- a/ForwardMii-Plugin/ForwardMii-Plugin.csproj +++ b/ForwardMii/ForwardMii.csproj @@ -32,6 +32,22 @@ prompt 4 + + true + bin\x86\Debug\ + DEBUG;TRACE + full + x86 + prompt + + + bin\x86\Release\ + TRACE + true + pdbonly + x86 + prompt + diff --git a/ForwardMii-Plugin/ForwardMii_BaseEdit.cs b/ForwardMii/ForwardMii_BaseEdit.cs similarity index 100% rename from ForwardMii-Plugin/ForwardMii_BaseEdit.cs rename to ForwardMii/ForwardMii_BaseEdit.cs diff --git a/ForwardMii-Plugin/ForwardMii_GX.cs b/ForwardMii/ForwardMii_GX.cs similarity index 100% rename from ForwardMii-Plugin/ForwardMii_GX.cs rename to ForwardMii/ForwardMii_GX.cs diff --git a/ForwardMii-Plugin/ForwardMii_SDSDHC.cs b/ForwardMii/ForwardMii_SDSDHC.cs similarity index 100% rename from ForwardMii-Plugin/ForwardMii_SDSDHC.cs rename to ForwardMii/ForwardMii_SDSDHC.cs diff --git a/ForwardMii-Plugin/License.txt b/ForwardMii/License.txt similarity index 100% rename from ForwardMii-Plugin/License.txt rename to ForwardMii/License.txt diff --git a/ForwardMii-Plugin/Properties/AssemblyInfo.cs b/ForwardMii/Properties/AssemblyInfo.cs similarity index 100% rename from ForwardMii-Plugin/Properties/AssemblyInfo.cs rename to ForwardMii/Properties/AssemblyInfo.cs diff --git a/ForwardMii-Plugin/Readme_ForwardMii.txt b/ForwardMii/Readme_ForwardMii.txt similarity index 100% rename from ForwardMii-Plugin/Readme_ForwardMii.txt rename to ForwardMii/Readme_ForwardMii.txt diff --git a/ForwardMii-Plugin/Resources/GX/Makefile b/ForwardMii/Resources/GX/Makefile similarity index 100% rename from ForwardMii-Plugin/Resources/GX/Makefile rename to ForwardMii/Resources/GX/Makefile diff --git a/ForwardMii-Plugin/Resources/GX/dolloader.c b/ForwardMii/Resources/GX/dolloader.c similarity index 100% rename from ForwardMii-Plugin/Resources/GX/dolloader.c rename to ForwardMii/Resources/GX/dolloader.c diff --git a/ForwardMii-Plugin/Resources/GX/dolloader.h b/ForwardMii/Resources/GX/dolloader.h similarity index 100% rename from ForwardMii-Plugin/Resources/GX/dolloader.h rename to ForwardMii/Resources/GX/dolloader.h diff --git a/ForwardMii-Plugin/Resources/GX/elf_abi.h b/ForwardMii/Resources/GX/elf_abi.h similarity index 100% rename from ForwardMii-Plugin/Resources/GX/elf_abi.h rename to ForwardMii/Resources/GX/elf_abi.h diff --git a/ForwardMii-Plugin/Resources/GX/elfloader.c b/ForwardMii/Resources/GX/elfloader.c similarity index 100% rename from ForwardMii-Plugin/Resources/GX/elfloader.c rename to ForwardMii/Resources/GX/elfloader.c diff --git a/ForwardMii-Plugin/Resources/GX/elfloader.h b/ForwardMii/Resources/GX/elfloader.h similarity index 100% rename from ForwardMii-Plugin/Resources/GX/elfloader.h rename to ForwardMii/Resources/GX/elfloader.h diff --git a/ForwardMii-Plugin/Resources/GX/fatmounter.c b/ForwardMii/Resources/GX/fatmounter.c similarity index 100% rename from ForwardMii-Plugin/Resources/GX/fatmounter.c rename to ForwardMii/Resources/GX/fatmounter.c diff --git a/ForwardMii-Plugin/Resources/GX/fatmounter.h b/ForwardMii/Resources/GX/fatmounter.h similarity index 100% rename from ForwardMii-Plugin/Resources/GX/fatmounter.h rename to ForwardMii/Resources/GX/fatmounter.h diff --git a/ForwardMii-Plugin/Resources/GX/filelist.h b/ForwardMii/Resources/GX/filelist.h similarity index 100% rename from ForwardMii-Plugin/Resources/GX/filelist.h rename to ForwardMii/Resources/GX/filelist.h diff --git a/ForwardMii-Plugin/Resources/GX/main.cpp b/ForwardMii/Resources/GX/main.cpp similarity index 100% rename from ForwardMii-Plugin/Resources/GX/main.cpp rename to ForwardMii/Resources/GX/main.cpp diff --git a/ForwardMii-Plugin/Resources/GX/video.cpp b/ForwardMii/Resources/GX/video.cpp similarity index 100% rename from ForwardMii-Plugin/Resources/GX/video.cpp rename to ForwardMii/Resources/GX/video.cpp diff --git a/ForwardMii-Plugin/Resources/GX/video.h b/ForwardMii/Resources/GX/video.h similarity index 100% rename from ForwardMii-Plugin/Resources/GX/video.h rename to ForwardMii/Resources/GX/video.h diff --git a/ForwardMii-Plugin/Resources/SDSDHC/10CharsTail.bin b/ForwardMii/Resources/SDSDHC/10CharsTail.bin similarity index 100% rename from ForwardMii-Plugin/Resources/SDSDHC/10CharsTail.bin rename to ForwardMii/Resources/SDSDHC/10CharsTail.bin diff --git a/ForwardMii-Plugin/Resources/SDSDHC/11CharsTail.bin b/ForwardMii/Resources/SDSDHC/11CharsTail.bin similarity index 100% rename from ForwardMii-Plugin/Resources/SDSDHC/11CharsTail.bin rename to ForwardMii/Resources/SDSDHC/11CharsTail.bin diff --git a/ForwardMii-Plugin/Resources/SDSDHC/12CharsTail.bin b/ForwardMii/Resources/SDSDHC/12CharsTail.bin similarity index 100% rename from ForwardMii-Plugin/Resources/SDSDHC/12CharsTail.bin rename to ForwardMii/Resources/SDSDHC/12CharsTail.bin diff --git a/ForwardMii-Plugin/Resources/SDSDHC/13CharsTail.bin b/ForwardMii/Resources/SDSDHC/13CharsTail.bin similarity index 100% rename from ForwardMii-Plugin/Resources/SDSDHC/13CharsTail.bin rename to ForwardMii/Resources/SDSDHC/13CharsTail.bin diff --git a/ForwardMii-Plugin/Resources/SDSDHC/14CharsTail.bin b/ForwardMii/Resources/SDSDHC/14CharsTail.bin similarity index 100% rename from ForwardMii-Plugin/Resources/SDSDHC/14CharsTail.bin rename to ForwardMii/Resources/SDSDHC/14CharsTail.bin diff --git a/ForwardMii-Plugin/Resources/SDSDHC/15CharsTail.bin b/ForwardMii/Resources/SDSDHC/15CharsTail.bin similarity index 100% rename from ForwardMii-Plugin/Resources/SDSDHC/15CharsTail.bin rename to ForwardMii/Resources/SDSDHC/15CharsTail.bin diff --git a/ForwardMii-Plugin/Resources/SDSDHC/16CharsTail.bin b/ForwardMii/Resources/SDSDHC/16CharsTail.bin similarity index 100% rename from ForwardMii-Plugin/Resources/SDSDHC/16CharsTail.bin rename to ForwardMii/Resources/SDSDHC/16CharsTail.bin diff --git a/ForwardMii-Plugin/Resources/SDSDHC/17CharsBase.bin b/ForwardMii/Resources/SDSDHC/17CharsBase.bin similarity index 100% rename from ForwardMii-Plugin/Resources/SDSDHC/17CharsBase.bin rename to ForwardMii/Resources/SDSDHC/17CharsBase.bin diff --git a/ForwardMii-Plugin/Resources/SDSDHC/17CharsTail.bin b/ForwardMii/Resources/SDSDHC/17CharsTail.bin similarity index 100% rename from ForwardMii-Plugin/Resources/SDSDHC/17CharsTail.bin rename to ForwardMii/Resources/SDSDHC/17CharsTail.bin diff --git a/ForwardMii-Plugin/Resources/SDSDHC/18CharsTail.bin b/ForwardMii/Resources/SDSDHC/18CharsTail.bin similarity index 100% rename from ForwardMii-Plugin/Resources/SDSDHC/18CharsTail.bin rename to ForwardMii/Resources/SDSDHC/18CharsTail.bin diff --git a/ForwardMii-Plugin/Resources/SDSDHC/3CharsBase.bin b/ForwardMii/Resources/SDSDHC/3CharsBase.bin similarity index 100% rename from ForwardMii-Plugin/Resources/SDSDHC/3CharsBase.bin rename to ForwardMii/Resources/SDSDHC/3CharsBase.bin diff --git a/ForwardMii-Plugin/Resources/SDSDHC/3CharsTail.bin b/ForwardMii/Resources/SDSDHC/3CharsTail.bin similarity index 100% rename from ForwardMii-Plugin/Resources/SDSDHC/3CharsTail.bin rename to ForwardMii/Resources/SDSDHC/3CharsTail.bin diff --git a/ForwardMii-Plugin/Resources/SDSDHC/4CharsTail.bin b/ForwardMii/Resources/SDSDHC/4CharsTail.bin similarity index 100% rename from ForwardMii-Plugin/Resources/SDSDHC/4CharsTail.bin rename to ForwardMii/Resources/SDSDHC/4CharsTail.bin diff --git a/ForwardMii-Plugin/Resources/SDSDHC/5CharsTail.bin b/ForwardMii/Resources/SDSDHC/5CharsTail.bin similarity index 100% rename from ForwardMii-Plugin/Resources/SDSDHC/5CharsTail.bin rename to ForwardMii/Resources/SDSDHC/5CharsTail.bin diff --git a/ForwardMii-Plugin/Resources/SDSDHC/6CharsBase.bin b/ForwardMii/Resources/SDSDHC/6CharsBase.bin similarity index 100% rename from ForwardMii-Plugin/Resources/SDSDHC/6CharsBase.bin rename to ForwardMii/Resources/SDSDHC/6CharsBase.bin diff --git a/ForwardMii-Plugin/Resources/SDSDHC/6CharsTail.bin b/ForwardMii/Resources/SDSDHC/6CharsTail.bin similarity index 100% rename from ForwardMii-Plugin/Resources/SDSDHC/6CharsTail.bin rename to ForwardMii/Resources/SDSDHC/6CharsTail.bin diff --git a/ForwardMii-Plugin/Resources/SDSDHC/7CharsTail.bin b/ForwardMii/Resources/SDSDHC/7CharsTail.bin similarity index 100% rename from ForwardMii-Plugin/Resources/SDSDHC/7CharsTail.bin rename to ForwardMii/Resources/SDSDHC/7CharsTail.bin diff --git a/ForwardMii-Plugin/Resources/SDSDHC/8CharsTail.bin b/ForwardMii/Resources/SDSDHC/8CharsTail.bin similarity index 100% rename from ForwardMii-Plugin/Resources/SDSDHC/8CharsTail.bin rename to ForwardMii/Resources/SDSDHC/8CharsTail.bin diff --git a/ForwardMii-Plugin/Resources/SDSDHC/9CharsTail.bin b/ForwardMii/Resources/SDSDHC/9CharsTail.bin similarity index 100% rename from ForwardMii-Plugin/Resources/SDSDHC/9CharsTail.bin rename to ForwardMii/Resources/SDSDHC/9CharsTail.bin diff --git a/Tester/Program.cs b/Tester/Program.cs deleted file mode 100644 index 4261480..0000000 --- a/Tester/Program.cs +++ /dev/null @@ -1,88 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Helpers; -using System.IO; -using System.IO.Compression; - -namespace Tester -{ - class Program - { - static void Main(string[] args) - { - string command = args[0]; - - if (command == "CSTUB") - { - Console.Out.WriteLine("Stub Compression>>"); - CompressStub(args[1], args[2]); - } - else if (command == "DSTUB") - { - Console.Out.WriteLine("Stub Decompression>>"); - DecompressStub(args[1], args[2]); - } - else if (command == "LOADC") - { - Console.Out.WriteLine("Installer creation>>"); - CreateInstaller(args[1], args[2]); - } - } - - static void CompressStub(string installerDol, string zippedResourceFileName) - { - using (FileStream fs = new FileStream(installerDol, FileMode.Open)) - { - using (FileStream fsOut = new FileStream(zippedResourceFileName, FileMode.Create)) - { - using (GZipStream gzip = new GZipStream(fsOut, CompressionMode.Compress)) - { - // Copy the source file into the compression stream. - byte[] buffer = new byte[4096]; - int numRead; - while ((numRead = fs.Read(buffer, 0, buffer.Length)) != 0) - { - gzip.Write(buffer, 0, numRead); - } - } - } - } - } - - public static void DecompressStub(string compressedInstallerDol, string decompressedInstallerDol) - { - // Get the stream of the source file. - using (FileStream inFile = new FileStream(compressedInstallerDol, FileMode.Open)) - { - //Create the decompressed file. - using (FileStream outFile = File.Create(decompressedInstallerDol)) - { - using (GZipStream Decompress = new GZipStream(inFile,CompressionMode.Decompress)) - { - //Copy the decompression stream into the output file. - byte[] buffer = new byte[4096]; - int numRead; - while ((numRead = Decompress.Read(buffer, 0, buffer.Length)) != 0) - { - outFile.Write(buffer, 0, numRead); - } - } - } - } - } - - static void CreateInstaller(string inWadFilename, string outDolFileName) - { - using (MemoryStream ms = InstallerHelper.CreateInstaller(inWadFilename, 249)) - { - using (FileStream fs = new FileStream(outDolFileName, FileMode.Create)) - { - ms.WriteTo(fs); - fs.Close(); - } - } - } - - } -} diff --git a/Tester/Properties/AssemblyInfo.cs b/Tester/Properties/AssemblyInfo.cs deleted file mode 100644 index 111c3ba..0000000 --- a/Tester/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Tester")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Irduco")] -[assembly: AssemblyProduct("Tester")] -[assembly: AssemblyCopyright("Copyright © Irduco 2010")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("891f8670-dc92-4f81-b010-62634af8b756")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Tester/Tester.csproj b/Tester/Tester.csproj deleted file mode 100644 index a17ff9b..0000000 --- a/Tester/Tester.csproj +++ /dev/null @@ -1,56 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {C020DE3A-F72B-47AD-A451-17B7586E4D21} - Exe - Properties - Tester - Tester - v2.0 - 512 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - {475F3ADF-B529-449F-89DA-BA5E8BE15DD5} - Helpers - - - - - \ No newline at end of file