diff --git a/CustomizeMii.sln b/CustomizeMii.sln index ff06a49..30c2e80 100644 --- a/CustomizeMii.sln +++ b/CustomizeMii.sln @@ -1,6 +1,6 @@  -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual C# Express 2008 +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CustomizeMii", "CustomizeMii\CustomizeMii.csproj", "{46B7F0BC-101B-4167-95AD-4C5D78AA0A20}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ForwardMii", "ForwardMii\ForwardMii.csproj", "{20CB2CA7-6767-4758-97FA-97395F47CD6B}" diff --git a/CustomizeMii/CustomizeMii.csproj b/CustomizeMii/CustomizeMii.csproj index aec19f2..bcb3a9e 100644 --- a/CustomizeMii/CustomizeMii.csproj +++ b/CustomizeMii/CustomizeMii.csproj @@ -1,5 +1,5 @@  - + Debug AnyCPU @@ -12,8 +12,6 @@ CustomizeMii v2.0 512 - - Resources\CustomizeMii.ico false publish\ @@ -30,6 +28,10 @@ 2.1.0.%2a false true + + + 3.5 + true @@ -39,6 +41,7 @@ DEBUG;TRACE prompt 4 + AllRules.ruleset pdbonly @@ -47,6 +50,7 @@ TRACE prompt 4 + AllRules.ruleset true @@ -56,6 +60,7 @@ x86 prompt true + AllRules.ruleset bin\x86\Release\ @@ -64,8 +69,12 @@ pdbonly x86 prompt + AllRules.ruleset + + .\lControls.dll + False .\libWiiSharp.dll @@ -74,6 +83,7 @@ + @@ -107,16 +117,21 @@ CustomizeMii_InputBox.cs + + Form + + + CustomizeMii_PaletteFormatBox.cs + Form Form - + CustomizeMii_Transmit.cs - @@ -132,6 +147,9 @@ CustomizeMii_Main.cs + + CustomizeMii_PaletteFormatBox.cs + CustomizeMii_Transmit.cs @@ -176,7 +194,6 @@ - diff --git a/CustomizeMii/CustomizeMii.csproj.user b/CustomizeMii/CustomizeMii.csproj.user index 21068da..814c6cb 100644 --- a/CustomizeMii/CustomizeMii.csproj.user +++ b/CustomizeMii/CustomizeMii.csproj.user @@ -1,4 +1,5 @@ - + + publish\ diff --git a/CustomizeMii/CustomizeMii_BnsConvert.cs b/CustomizeMii/CustomizeMii_BnsConvert.cs index d8e8a5e..91c8ff8 100644 --- a/CustomizeMii/CustomizeMii_BnsConvert.cs +++ b/CustomizeMii/CustomizeMii_BnsConvert.cs @@ -227,7 +227,7 @@ namespace CustomizeMii else { wave = new Wave((string)e.Argument); } - try { this.sampleCount = wave.SampleCount; } + try { this.sampleCount = wave.NumSamples; } catch { } try { bitDepth = wave.BitDepth; } @@ -236,13 +236,13 @@ namespace CustomizeMii try { sampleRate = wave.SampleRate; } catch { sampleRate = -1; } - try { channelCount = wave.ChannelCount; } + try { channelCount = wave.NumChannels; } catch { channelCount = -1; } try { dataFormat = wave.DataFormat; } catch { dataFormat = -1; } - try { loopCount = wave.LoopCount; } + try { loopCount = wave.NumLoops; } catch { loopCount = -1; } try { loopStart = wave.LoopStart; } @@ -389,12 +389,17 @@ namespace CustomizeMii Wave wave; if (cbSourceSound.Checked) - { wave = new Wave(sourceSound); - } - else wave = new Wave(tbAudioFile.Text); + else + wave = new Wave(tbAudioFile.Text); - sPlayer = new SoundPlayer(wave.TrimStart(loopStart)); + wave.TrimStart(loopStart); + MemoryStream waveFile = wave.ToMemoryStream(); + wave.Dispose(); + + waveFile.Seek(0, SeekOrigin.Begin); + + sPlayer = new SoundPlayer(waveFile); sPlayer.PlayLooping(); btnPlay.Text = "Stop"; diff --git a/CustomizeMii/CustomizeMii_Main.Designer.cs b/CustomizeMii/CustomizeMii_Main.Designer.cs index 167e6c7..ae1f1f9 100644 --- a/CustomizeMii/CustomizeMii_Main.Designer.cs +++ b/CustomizeMii/CustomizeMii_Main.Designer.cs @@ -45,7 +45,6 @@ namespace CustomizeMii /// private void InitializeComponent() { - this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CustomizeMii_Main)); this.btnCreateWad = new System.Windows.Forms.Button(); this.tabControl = new System.Windows.Forms.TabControl(); @@ -84,10 +83,9 @@ namespace CustomizeMii this.tbAllLanguages = new System.Windows.Forms.TextBox(); this.lbAllLanguages = new System.Windows.Forms.Label(); this.tabOptions = new System.Windows.Forms.TabPage(); + this.cbSecurityChecksOff = new lControls.CheckLED(); this.btnOptionsExtract = new System.Windows.Forms.Button(); this.btnForwarder = new System.Windows.Forms.Button(); - this.cbSecurityChecksOff = new System.Windows.Forms.CheckBox(); - this.cbLz77 = new System.Windows.Forms.CheckBox(); this.lbOptionsOptional = new System.Windows.Forms.Label(); this.btnBrowseSound = new System.Windows.Forms.Button(); this.tbSound = new System.Windows.Forms.TextBox(); @@ -103,7 +101,6 @@ namespace CustomizeMii this.lbTitleID = new System.Windows.Forms.Label(); this.tabBanner = new System.Windows.Forms.TabPage(); this.llbBannerMultiReplace = new System.Windows.Forms.LinkLabel(); - this.cbBannerMakeTransparent = new System.Windows.Forms.CheckBox(); this.cmbFormatBanner = new System.Windows.Forms.ComboBox(); this.lbFormatBanner = new System.Windows.Forms.Label(); this.btnPreviewBanner = new System.Windows.Forms.Button(); @@ -114,7 +111,6 @@ namespace CustomizeMii this.lbxBannerTpls = new System.Windows.Forms.ListBox(); this.tabIcon = new System.Windows.Forms.TabPage(); this.llbIconMultiReplace = new System.Windows.Forms.LinkLabel(); - this.cbIconMakeTransparent = new System.Windows.Forms.CheckBox(); this.cmbFormatIcon = new System.Windows.Forms.ComboBox(); this.lbFormatIcon = new System.Windows.Forms.Label(); this.btnPreviewIcon = new System.Windows.Forms.Button(); @@ -154,16 +150,17 @@ namespace CustomizeMii this.llbUpdateAvailable = new System.Windows.Forms.LinkLabel(); this.llbSite = new System.Windows.Forms.LinkLabel(); this.lbCreditVersion = new System.Windows.Forms.Label(); - this.cmTpls = new System.Windows.Forms.ContextMenuStrip(this.components); + this.cmTpls = new System.Windows.Forms.ContextMenuStrip(); this.cmRename = new System.Windows.Forms.ToolStripMenuItem(); + this.cmResize = new System.Windows.Forms.ToolStripMenuItem(); this.ssMain = new System.Windows.Forms.StatusStrip(); this.lbStatus = new System.Windows.Forms.ToolStripStatusLabel(); this.lbStatusText = new System.Windows.Forms.ToolStripStatusLabel(); this.pbProgress = new System.Windows.Forms.ToolStripProgressBar(); - this.cmForwarder = new System.Windows.Forms.ContextMenuStrip(this.components); + this.cmForwarder = new System.Windows.Forms.ContextMenuStrip(); this.cmSimpleForwarder = new System.Windows.Forms.ToolStripMenuItem(); this.cmComplexForwarder = new System.Windows.Forms.ToolStripMenuItem(); - this.cmOptionsExtract = new System.Windows.Forms.ContextMenuStrip(this.components); + this.cmOptionsExtract = new System.Windows.Forms.ContextMenuStrip(); this.cmExtractWad = new System.Windows.Forms.ToolStripMenuItem(); this.cmExtractDol = new System.Windows.Forms.ToolStripMenuItem(); this.tsExtractSound = new System.Windows.Forms.ToolStripMenuItem(); @@ -177,13 +174,16 @@ namespace CustomizeMii 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.cmSound = new System.Windows.Forms.ContextMenuStrip(); this.cmLoadAudioFile = new System.Windows.Forms.ToolStripMenuItem(); this.cmConvertToBns = new System.Windows.Forms.ToolStripMenuItem(); - this.cmDol = new System.Windows.Forms.ContextMenuStrip(this.components); + this.cmMakeSilent = new System.Windows.Forms.ToolStripMenuItem(); + this.cmDol = new System.Windows.Forms.ContextMenuStrip(); this.cmLoadDol = new System.Windows.Forms.ToolStripMenuItem(); this.cmDolFromSource = new System.Windows.Forms.ToolStripMenuItem(); - this.cmResize = new System.Windows.Forms.ToolStripMenuItem(); + this.cbLz77 = new lControls.CheckLED(); + this.cbBannerMakeTransparent = new lControls.CheckLED(); + this.cbIconMakeTransparent = new lControls.CheckLED(); this.tabControl.SuspendLayout(); this.tabSource.SuspendLayout(); this.tabTitle.SuspendLayout(); @@ -597,10 +597,10 @@ namespace CustomizeMii // // tabOptions // + this.tabOptions.Controls.Add(this.cbLz77); + this.tabOptions.Controls.Add(this.cbSecurityChecksOff); this.tabOptions.Controls.Add(this.btnOptionsExtract); this.tabOptions.Controls.Add(this.btnForwarder); - this.tabOptions.Controls.Add(this.cbSecurityChecksOff); - this.tabOptions.Controls.Add(this.cbLz77); this.tabOptions.Controls.Add(this.lbOptionsOptional); this.tabOptions.Controls.Add(this.btnBrowseSound); this.tabOptions.Controls.Add(this.tbSound); @@ -622,6 +622,19 @@ namespace CustomizeMii this.tabOptions.Text = "Options"; this.tabOptions.UseVisualStyleBackColor = true; // + // cbSecurityChecksOff + // + this.cbSecurityChecksOff.AutoSize = true; + this.cbSecurityChecksOff.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.cbSecurityChecksOff.LedColor = lControls.CheckLED.LEDColor.Green; + this.cbSecurityChecksOff.Location = new System.Drawing.Point(266, 180); + this.cbSecurityChecksOff.Name = "cbSecurityChecksOff"; + this.cbSecurityChecksOff.Size = new System.Drawing.Size(169, 17); + this.cbSecurityChecksOff.TabIndex = 15; + this.cbSecurityChecksOff.Tag = "Independent"; + this.cbSecurityChecksOff.Text = "/!\\ Turn off security checks /!\\"; + this.cbSecurityChecksOff.UseVisualStyleBackColor = true; + // // btnOptionsExtract // this.btnOptionsExtract.Location = new System.Drawing.Point(360, 47); @@ -642,29 +655,6 @@ namespace CustomizeMii this.btnForwarder.UseVisualStyleBackColor = true; this.btnForwarder.Click += new System.EventHandler(this.btnForwarder_Click); // - // cbSecurityChecksOff - // - this.cbSecurityChecksOff.AutoSize = true; - this.cbSecurityChecksOff.Location = new System.Drawing.Point(263, 180); - this.cbSecurityChecksOff.Name = "cbSecurityChecksOff"; - this.cbSecurityChecksOff.Size = new System.Drawing.Size(172, 17); - this.cbSecurityChecksOff.TabIndex = 12; - this.cbSecurityChecksOff.Tag = "Independent"; - this.cbSecurityChecksOff.Text = "/!\\ Turn off security checks /!\\"; - this.cbSecurityChecksOff.UseVisualStyleBackColor = true; - // - // cbLz77 - // - this.cbLz77.AutoSize = true; - this.cbLz77.Checked = true; - this.cbLz77.CheckState = System.Windows.Forms.CheckState.Checked; - this.cbLz77.Location = new System.Drawing.Point(11, 180); - this.cbLz77.Name = "cbLz77"; - this.cbLz77.Size = new System.Drawing.Size(134, 17); - this.cbLz77.TabIndex = 11; - this.cbLz77.Text = "Use Lz77 Compression"; - this.cbLz77.UseVisualStyleBackColor = true; - // // lbOptionsOptional // this.lbOptionsOptional.Location = new System.Drawing.Point(-7, 8); @@ -797,8 +787,8 @@ namespace CustomizeMii // // tabBanner // - this.tabBanner.Controls.Add(this.llbBannerMultiReplace); this.tabBanner.Controls.Add(this.cbBannerMakeTransparent); + this.tabBanner.Controls.Add(this.llbBannerMultiReplace); this.tabBanner.Controls.Add(this.cmbFormatBanner); this.tabBanner.Controls.Add(this.lbFormatBanner); this.tabBanner.Controls.Add(this.btnPreviewBanner); @@ -826,17 +816,6 @@ namespace CustomizeMii this.llbBannerMultiReplace.Text = "Multi Replace"; this.llbBannerMultiReplace.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.llbMultiReplace_LinkClicked); // - // cbBannerMakeTransparent - // - this.cbBannerMakeTransparent.AutoSize = true; - this.cbBannerMakeTransparent.Location = new System.Drawing.Point(11, 189); - this.cbBannerMakeTransparent.Name = "cbBannerMakeTransparent"; - this.cbBannerMakeTransparent.Size = new System.Drawing.Size(113, 17); - this.cbBannerMakeTransparent.TabIndex = 6; - this.cbBannerMakeTransparent.Text = "Make Transparent"; - this.cbBannerMakeTransparent.UseVisualStyleBackColor = true; - this.cbBannerMakeTransparent.CheckedChanged += new System.EventHandler(this.cbBannerMakeTransparent_CheckedChanged); - // // cmbFormatBanner // this.cmbFormatBanner.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; @@ -926,15 +905,15 @@ namespace CustomizeMii this.lbxBannerTpls.Size = new System.Drawing.Size(343, 173); this.lbxBannerTpls.Sorted = true; this.lbxBannerTpls.TabIndex = 0; - this.lbxBannerTpls.MouseUp += new System.Windows.Forms.MouseEventHandler(this.lbxBannerTpls_MouseUp); this.lbxBannerTpls.SelectedIndexChanged += new System.EventHandler(this.lbxBannerTpls_SelectedIndexChanged); this.lbxBannerTpls.DragDrop += new System.Windows.Forms.DragEventHandler(this.lbxBannerTpls_DragDrop); this.lbxBannerTpls.DragEnter += new System.Windows.Forms.DragEventHandler(this.lbxBannerTpls_DragEnter); + this.lbxBannerTpls.MouseUp += new System.Windows.Forms.MouseEventHandler(this.lbxBannerTpls_MouseUp); // // tabIcon // - this.tabIcon.Controls.Add(this.llbIconMultiReplace); this.tabIcon.Controls.Add(this.cbIconMakeTransparent); + this.tabIcon.Controls.Add(this.llbIconMultiReplace); this.tabIcon.Controls.Add(this.cmbFormatIcon); this.tabIcon.Controls.Add(this.lbFormatIcon); this.tabIcon.Controls.Add(this.btnPreviewIcon); @@ -962,17 +941,6 @@ namespace CustomizeMii this.llbIconMultiReplace.Text = "Multi Replace"; this.llbIconMultiReplace.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.llbMultiReplace_LinkClicked); // - // cbIconMakeTransparent - // - this.cbIconMakeTransparent.AutoSize = true; - this.cbIconMakeTransparent.Location = new System.Drawing.Point(11, 189); - this.cbIconMakeTransparent.Name = "cbIconMakeTransparent"; - this.cbIconMakeTransparent.Size = new System.Drawing.Size(113, 17); - this.cbIconMakeTransparent.TabIndex = 12; - this.cbIconMakeTransparent.Text = "Make Transparent"; - this.cbIconMakeTransparent.UseVisualStyleBackColor = true; - this.cbIconMakeTransparent.CheckedChanged += new System.EventHandler(this.cbIconMakeTransparent_CheckedChanged); - // // cmbFormatIcon // this.cmbFormatIcon.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; @@ -1062,10 +1030,10 @@ namespace CustomizeMii this.lbxIconTpls.Size = new System.Drawing.Size(343, 173); this.lbxIconTpls.Sorted = true; this.lbxIconTpls.TabIndex = 6; - this.lbxIconTpls.MouseUp += new System.Windows.Forms.MouseEventHandler(this.lbxIconTpls_MouseUp); this.lbxIconTpls.SelectedIndexChanged += new System.EventHandler(this.lbxIconTpls_SelectedIndexChanged); this.lbxIconTpls.DragDrop += new System.Windows.Forms.DragEventHandler(this.lbxIconTpls_DragDrop); this.lbxIconTpls.DragEnter += new System.Windows.Forms.DragEventHandler(this.lbxIconTpls_DragEnter); + this.lbxIconTpls.MouseUp += new System.Windows.Forms.MouseEventHandler(this.lbxIconTpls_MouseUp); // // tabBrlyt // @@ -1405,7 +1373,7 @@ namespace CustomizeMii this.cmRename, this.cmResize}); this.cmTpls.Name = "cmTpls"; - this.cmTpls.Size = new System.Drawing.Size(153, 70); + this.cmTpls.Size = new System.Drawing.Size(118, 48); // // cmRename // @@ -1414,6 +1382,13 @@ namespace CustomizeMii this.cmRename.Text = "Rename"; this.cmRename.Click += new System.EventHandler(this.cmRename_Click); // + // cmResize + // + this.cmResize.Name = "cmResize"; + this.cmResize.Size = new System.Drawing.Size(117, 22); + this.cmResize.Text = "Resize"; + this.cmResize.Click += new System.EventHandler(this.cmResize_Click); + // // ssMain // this.ssMain.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -1584,9 +1559,10 @@ namespace CustomizeMii // this.cmSound.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.cmLoadAudioFile, - this.cmConvertToBns}); + this.cmConvertToBns, + this.cmMakeSilent}); this.cmSound.Name = "cmSound"; - this.cmSound.Size = new System.Drawing.Size(159, 48); + this.cmSound.Size = new System.Drawing.Size(159, 92); // // cmLoadAudioFile // @@ -1602,6 +1578,13 @@ namespace CustomizeMii this.cmConvertToBns.Text = "Convert To BNS"; this.cmConvertToBns.Click += new System.EventHandler(this.cmConvertToBns_Click); // + // cmMakeSilent + // + this.cmMakeSilent.Name = "cmMakeSilent"; + this.cmMakeSilent.Size = new System.Drawing.Size(158, 22); + this.cmMakeSilent.Text = "Make Silent"; + this.cmMakeSilent.Click += new System.EventHandler(this.cmMakeSilent_Click); + // // cmDol // this.cmDol.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -1624,12 +1607,45 @@ namespace CustomizeMii this.cmDolFromSource.Text = "Take From Source WAD"; this.cmDolFromSource.Click += new System.EventHandler(this.cmDolFromSource_Click); // - // cmResize + // cbLz77 // - this.cmResize.Name = "cmResize"; - this.cmResize.Size = new System.Drawing.Size(152, 22); - this.cmResize.Text = "Resize"; - this.cmResize.Click += new System.EventHandler(this.cmResize_Click); + this.cbLz77.AutoSize = true; + this.cbLz77.Checked = true; + this.cbLz77.CheckState = System.Windows.Forms.CheckState.Checked; + this.cbLz77.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.cbLz77.LedColor = lControls.CheckLED.LEDColor.Green; + this.cbLz77.Location = new System.Drawing.Point(11, 180); + this.cbLz77.Name = "cbLz77"; + this.cbLz77.Size = new System.Drawing.Size(131, 17); + this.cbLz77.TabIndex = 16; + this.cbLz77.Text = "Use Lz77 Compression"; + this.cbLz77.UseVisualStyleBackColor = true; + // + // cbBannerMakeTransparent + // + this.cbBannerMakeTransparent.AutoSize = true; + this.cbBannerMakeTransparent.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.cbBannerMakeTransparent.LedColor = lControls.CheckLED.LEDColor.Green; + this.cbBannerMakeTransparent.Location = new System.Drawing.Point(11, 189); + this.cbBannerMakeTransparent.Name = "cbBannerMakeTransparent"; + this.cbBannerMakeTransparent.Size = new System.Drawing.Size(110, 17); + this.cbBannerMakeTransparent.TabIndex = 8; + this.cbBannerMakeTransparent.Text = "Make Transparent"; + this.cbBannerMakeTransparent.UseVisualStyleBackColor = true; + this.cbBannerMakeTransparent.CheckedChanged += new System.EventHandler(this.cbBannerMakeTransparent_CheckedChanged); + // + // cbIconMakeTransparent + // + this.cbIconMakeTransparent.AutoSize = true; + this.cbIconMakeTransparent.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.cbIconMakeTransparent.LedColor = lControls.CheckLED.LEDColor.Green; + this.cbIconMakeTransparent.Location = new System.Drawing.Point(11, 189); + this.cbIconMakeTransparent.Name = "cbIconMakeTransparent"; + this.cbIconMakeTransparent.Size = new System.Drawing.Size(110, 17); + this.cbIconMakeTransparent.TabIndex = 14; + this.cbIconMakeTransparent.Text = "Make Transparent"; + this.cbIconMakeTransparent.UseVisualStyleBackColor = true; + this.cbIconMakeTransparent.CheckedChanged += new System.EventHandler(this.cbIconMakeTransparent_CheckedChanged); // // CustomizeMii_Main // @@ -1645,10 +1661,10 @@ namespace CustomizeMii this.Name = "CustomizeMii_Main"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "CustomizeMii X by Leathl"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.CustomizeMii_Main_FormClosing); this.Load += new System.EventHandler(this.CustomizeMii_Main_Load); this.DragDrop += new System.Windows.Forms.DragEventHandler(this.CustomizeMii_Main_DragDrop); this.DragEnter += new System.Windows.Forms.DragEventHandler(this.CustomizeMii_Main_DragEnter); - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.CustomizeMii_Main_FormClosing); this.tabControl.ResumeLayout(false); this.tabSource.ResumeLayout(false); this.tabSource.PerformLayout(); @@ -1745,7 +1761,6 @@ namespace CustomizeMii private System.Windows.Forms.ComboBox cmbReplace; private System.Windows.Forms.TextBox tbReplace; private System.Windows.Forms.Button btnBrowseReplace; - private System.Windows.Forms.CheckBox cbLz77; private System.Windows.Forms.LinkLabel llbSite; private System.Windows.Forms.TabPage tabBrlyt; private System.Windows.Forms.TabPage tabBrlan; @@ -1773,11 +1788,8 @@ namespace CustomizeMii private System.Windows.Forms.Button btnAddIcon; private System.Windows.Forms.Button btnDeleteIcon; private System.Windows.Forms.Button btnBrlytListTpls; - private System.Windows.Forms.CheckBox cbBannerMakeTransparent; - private System.Windows.Forms.CheckBox cbIconMakeTransparent; private System.Windows.Forms.TabPage tabInstructions; private System.Windows.Forms.RichTextBox rtbInstructions; - private System.Windows.Forms.CheckBox cbSecurityChecksOff; private System.Windows.Forms.Button btnForwarder; private System.Windows.Forms.ContextMenuStrip cmForwarder; private System.Windows.Forms.ToolStripMenuItem cmSimpleForwarder; @@ -1818,6 +1830,11 @@ namespace CustomizeMii private System.Windows.Forms.ContextMenuStrip cmTpls; private System.Windows.Forms.ToolStripMenuItem cmRename; private System.Windows.Forms.ToolStripMenuItem cmResize; + private System.Windows.Forms.ToolStripMenuItem cmMakeSilent; + private lControls.CheckLED cbSecurityChecksOff; + private lControls.CheckLED cbLz77; + private lControls.CheckLED cbBannerMakeTransparent; + private lControls.CheckLED cbIconMakeTransparent; } } diff --git a/CustomizeMii/CustomizeMii_Main.cs b/CustomizeMii/CustomizeMii_Main.cs index c4865ac..4c3e68d 100644 --- a/CustomizeMii/CustomizeMii_Main.cs +++ b/CustomizeMii/CustomizeMii_Main.cs @@ -31,7 +31,7 @@ namespace CustomizeMii public partial class CustomizeMii_Main : Form { #region Constants - private const string version = "3.0"; //Hint for myself: Never use a char in the Version (UpdateCheck)! + private const string version = "3.1"; //Hint for myself: Never use a char in the Version (UpdateCheck)! private const int soundMaxLength = 40; //In seconds private const int soundWarningLength = 25; //In seconds private const int bnsWarningLength = 45; //In seconds @@ -768,7 +768,7 @@ namespace CustomizeMii { int format = cmbFormatBanner.SelectedIndex; - if (format < 7) + if (format < 9) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "PNG|*.png|JPG|*.jpg|GIF|*.gif|BMP|*.bmp|TPL|*.tpl|All|*.png;*.jpg;*.gif;*.bmp;*.tpl"; @@ -797,33 +797,59 @@ namespace CustomizeMii img.Height != tmpTpl.GetTextureSize(0).Height) img = resizeImage(img, tmpTpl.GetTextureSize(0).Width, tmpTpl.GetTextureSize(0).Height); + TPL_PaletteFormat pFormat = TPL_PaletteFormat.RGB5A3; + switch (format) { - case 6: //I4 - format = 0; + case 6: + format = (int)TPL_TextureFormat.I4; break; - case 5: //I8 - format = 1; + case 5: + format = (int)TPL_TextureFormat.I8; break; - case 4: //IA4 - format = 2; + case 4: + format = (int)TPL_TextureFormat.IA4; break; - case 3: //IA8 - format = 3; + case 3: + format = (int)TPL_TextureFormat.IA8; break; case 1: - format = 4; + format = (int)TPL_TextureFormat.RGB565; break; case 2: - format = 5; + format = (int)TPL_TextureFormat.RGB5A3; + break; + case 7: + format = (int)TPL_TextureFormat.CI4; + + CustomizeMii_PaletteFormatBox pfb = new CustomizeMii_PaletteFormatBox(); + pfb.ShowDialog(); + + pFormat = pfb.PaletteFormat; + break; + case 8: + format = (int)TPL_TextureFormat.CI8; + + CustomizeMii_PaletteFormatBox pfb2 = new CustomizeMii_PaletteFormatBox(); + pfb2.ShowDialog(); + + pFormat = pfb2.PaletteFormat; + break; + case 9: + format = (int)TPL_TextureFormat.CI14X2; + + CustomizeMii_PaletteFormatBox pfb3 = new CustomizeMii_PaletteFormatBox(); + pfb3.ShowDialog(); + + pFormat = pfb3.PaletteFormat; break; default: - format = 6; + format = (int)TPL_TextureFormat.RGBA8; break; } tmpTpl.RemoveTexture(0); - tmpTpl.AddTexture(img, (TPL_Format)format); + tmpTpl.AddTexture(img, (TPL_TextureFormat)format, pFormat); if (string.IsNullOrEmpty(replacedBanner)) bannerBin.ReplaceFile(bannerBin.GetNodeIndex(tplName), tmpTpl.ToByteArray()); @@ -918,7 +944,7 @@ namespace CustomizeMii { int format = cmbFormatIcon.SelectedIndex; - if (format < 7) + if (format < 9) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "PNG|*.png|JPG|*.jpg|GIF|*.gif|BMP|*.bmp|TPL|*.tpl|All|*.png;*.jpg;*.gif;*.bmp;*.tpl"; @@ -947,33 +973,59 @@ namespace CustomizeMii img.Height != tmpTpl.GetTextureSize(0).Height) img = resizeImage(img, tmpTpl.GetTextureSize(0).Width, tmpTpl.GetTextureSize(0).Height); + TPL_PaletteFormat pFormat = TPL_PaletteFormat.RGB5A3; + switch (format) { - case 6: //I4 - format = 0; + case 6: + format = (int)TPL_TextureFormat.I4; break; - case 5: //I8 - format = 1; + case 5: + format = (int)TPL_TextureFormat.I8; break; - case 4: //IA4 - format = 2; + case 4: + format = (int)TPL_TextureFormat.IA4; break; - case 3: //IA8 - format = 3; + case 3: + format = (int)TPL_TextureFormat.IA8; break; case 1: - format = 4; + format = (int)TPL_TextureFormat.RGB565; break; case 2: - format = 5; + format = (int)TPL_TextureFormat.RGB5A3; + break; + case 7: + format = (int)TPL_TextureFormat.CI4; + + CustomizeMii_PaletteFormatBox pfb = new CustomizeMii_PaletteFormatBox(); + pfb.ShowDialog(); + + pFormat = pfb.PaletteFormat; + break; + case 8: + format = (int)TPL_TextureFormat.CI8; + + CustomizeMii_PaletteFormatBox pfb2 = new CustomizeMii_PaletteFormatBox(); + pfb2.ShowDialog(); + + pFormat = pfb2.PaletteFormat; + break; + case 9: + format = (int)TPL_TextureFormat.CI14X2; + + CustomizeMii_PaletteFormatBox pfb3 = new CustomizeMii_PaletteFormatBox(); + pfb3.ShowDialog(); + + pFormat = pfb3.PaletteFormat; break; default: - format = 6; + format = (int)TPL_TextureFormat.RGBA8; break; } tmpTpl.RemoveTexture(0); - tmpTpl.AddTexture(img, (TPL_Format)format); + tmpTpl.AddTexture(img, (TPL_TextureFormat)format, pFormat); if (string.IsNullOrEmpty(replacedIcon)) iconBin.ReplaceFile(iconBin.GetNodeIndex(tplName), tmpTpl.ToByteArray()); @@ -1902,19 +1954,19 @@ namespace CustomizeMii if (cmSender.Name.ToLower() == "cmextractsoundasbin") { sfd.Filter = "BIN|*.bin"; sfd.FileName = "sound.bin"; } else if (cmSender.Name.ToLower() == "cmextractsoundasaudio") { - if (soundFile[0] == 'R' && soundFile[1] == 'I' && soundFile[2] == 'F' && soundFile[3] == 'F') + if (soundFile[32] == 'R' && soundFile[33] == 'I' && soundFile[34] == 'F' && soundFile[35] == 'F') { sfd.Filter = "Wave|*.wav"; sfd.FileName = "sound.wav"; } - else if (soundFile[0] == 'B' && soundFile[1] == 'N' && soundFile[2] == 'S' && soundFile[3] == ' ') - { sfd.Filter = "BNS|*.bns"; sfd.FileName = "sound.bns"; } - else if (soundFile[0] == 'F' && soundFile[1] == 'O' && soundFile[2] == 'R' && soundFile[3] == 'M') + else if (soundFile[32] == 'B' && soundFile[33] == 'N' && soundFile[34] == 'S' && soundFile[35] == ' ') + { sfd.Filter = "Wave|*.wav"; sfd.FileName = "sound.wav"; } + else if (soundFile[32] == 'F' && soundFile[33] == 'O' && soundFile[34] == 'R' && soundFile[35] == 'M') { sfd.Filter = "AIFF|*.aif;*.aiff"; sfd.FileName = "sound.aif"; } - else if (soundFile[0] == 'L' && soundFile[1] == 'Z' && soundFile[2] == '7' && soundFile[3] == '7') + else if (soundFile[32] == 'L' && soundFile[33] == 'Z' && soundFile[34] == '7' && soundFile[35] == '7') { - if (soundFile[9] == 'R' && soundFile[10] == 'I' && soundFile[11] == 'F' && soundFile[12] == 'F') + if (soundFile[41] == 'R' && soundFile[42] == 'I' && soundFile[43] == 'F' && soundFile[44] == 'F') { sfd.Filter = "Wave|*.wav"; sfd.FileName = "sound.wav"; } - else if (soundFile[9] == 'B' && soundFile[10] == 'N' && soundFile[11] == 'S' && soundFile[12] == ' ') - { sfd.Filter = "BNS|*.bns"; sfd.FileName = "sound.bns"; } - else if (soundFile[9] == 'F' && soundFile[10] == 'O' && soundFile[11] == 'R' && soundFile[12] == 'M') + else if (soundFile[41] == 'B' && soundFile[42] == 'N' && soundFile[43] == 'S' && soundFile[44] == ' ') + { sfd.Filter = "Wave|*.wav"; sfd.FileName = "sound.wave"; } + else if (soundFile[41] == 'F' && soundFile[42] == 'O' && soundFile[43] == 'R' && soundFile[44] == 'M') { sfd.Filter = "AIFF|*.aif;*.aiff"; sfd.FileName = "sound.aif"; } else throw new Exception("Unsupported Audio Format!"); } @@ -1937,7 +1989,15 @@ namespace CustomizeMii if (Lz77.IsLz77Compressed(soundFile)) { Lz77 l = new Lz77(); soundFile = l.Decompress(soundFile); } - File.WriteAllBytes(sfd.FileName, soundFile); + if (soundFile[0] == 'B' && soundFile[1] == 'N' && soundFile[2] == 'S' && soundFile[3] == ' ') + { + Wave w = BNS.BnsToWave(soundFile); + w.Save(sfd.FileName); + w.Dispose(); + } + else + File.WriteAllBytes(sfd.FileName, soundFile); + infoBox(string.Format("The sound.bin was successfully converted to {0}!", Path.GetFileName(sfd.FileName))); } } @@ -2421,7 +2481,7 @@ namespace CustomizeMii else tmpTpl = TPL.Load(newIconBin.Data[newIconBin.GetNodeIndex(tplName)]); - TPL_Format tplFormat = tmpTpl.GetTextureFormat(0); + TPL_TextureFormat tplFormat = tmpTpl.GetTextureFormat(0); Image newImg = resizeImage(tmpTpl.ExtractTexture(0), newSize.Width, newSize.Height); tmpTpl.RemoveTexture(0); @@ -2446,5 +2506,18 @@ namespace CustomizeMii } catch (Exception ex) { errorBox(ex.Message); } } + + private void cmMakeSilent_Click(object sender, EventArgs e) + { + Wave w = new Wave(1, 8, 500, new byte[] { 0x80, 0x80, 0x80, 0x80, 0x80 }); + newSoundBin = Headers.IMD5.AddHeader(w.ToByteArray()); + w.Dispose(); + + replacedSound = "Silence"; + setControlText(tbSound, "Silence"); + btnBrowseSound.Text = "Clear"; + + if (cmbReplace.SelectedIndex == 2) setControlText(tbReplace, string.Empty); + } } } diff --git a/CustomizeMii/CustomizeMii_Main.resx b/CustomizeMii/CustomizeMii_Main.resx index 0fc55f9..4a4efb4 100644 --- a/CustomizeMii/CustomizeMii_Main.resx +++ b/CustomizeMii/CustomizeMii_Main.resx @@ -131,22 +131,22 @@ The USB Loader GX Team for their forwarder source wilsoff for helping me debugging 3.0 - 566, 7 + 559, 14 - 16, 7 + 17, 12 - 105, 7 + 104, 12 - 228, 7 + 230, 12 - 376, 7 + 369, 15 - 479, 7 + 474, 13 42 diff --git a/CustomizeMii/CustomizeMii_PaletteFormatBox.Designer.cs b/CustomizeMii/CustomizeMii_PaletteFormatBox.Designer.cs new file mode 100644 index 0000000..69b1f50 --- /dev/null +++ b/CustomizeMii/CustomizeMii_PaletteFormatBox.Designer.cs @@ -0,0 +1,100 @@ +namespace CustomizeMii +{ + partial class CustomizeMii_PaletteFormatBox + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.btnIA8 = new System.Windows.Forms.Button(); + this.btnRGB5A3 = new System.Windows.Forms.Button(); + this.btnRGB565 = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // label1 + // + this.label1.Location = new System.Drawing.Point(12, 9); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(307, 83); + this.label1.TabIndex = 0; + this.label1.Text = "You\'re converting to an indexed format, please choose a format\r\nfor the Palette:\r" + + "\n\r\nIA8: Black & White + Alpha\r\nRGB5A3: Color + Alpha\r\nRGB565: Color"; + // + // btnIA8 + // + this.btnIA8.Location = new System.Drawing.Point(12, 101); + this.btnIA8.Name = "btnIA8"; + this.btnIA8.Size = new System.Drawing.Size(75, 23); + this.btnIA8.TabIndex = 1; + this.btnIA8.Text = "IA8"; + this.btnIA8.UseVisualStyleBackColor = true; + this.btnIA8.Click += new System.EventHandler(this.btnIA8_Click); + // + // btnRGB5A3 + // + this.btnRGB5A3.Location = new System.Drawing.Point(128, 101); + this.btnRGB5A3.Name = "btnRGB5A3"; + this.btnRGB5A3.Size = new System.Drawing.Size(75, 23); + this.btnRGB5A3.TabIndex = 1; + this.btnRGB5A3.Text = "RGB5A3"; + this.btnRGB5A3.UseVisualStyleBackColor = true; + this.btnRGB5A3.Click += new System.EventHandler(this.btnRGB5A3_Click); + // + // btnRGB565 + // + this.btnRGB565.Location = new System.Drawing.Point(244, 101); + this.btnRGB565.Name = "btnRGB565"; + this.btnRGB565.Size = new System.Drawing.Size(75, 23); + this.btnRGB565.TabIndex = 1; + this.btnRGB565.Text = "RGB565"; + this.btnRGB565.UseVisualStyleBackColor = true; + this.btnRGB565.Click += new System.EventHandler(this.btnRGB565_Click); + // + // CustomizeMii_PaletteFormatBox + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(331, 137); + this.Controls.Add(this.btnRGB565); + this.Controls.Add(this.btnRGB5A3); + this.Controls.Add(this.btnIA8); + this.Controls.Add(this.label1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; + this.Name = "CustomizeMii_PaletteFormatBox"; + this.Text = "CustomizeMii_PaletteFormatBox"; + this.Load += new System.EventHandler(this.CustomizeMii_PaletteFormatBox_Load); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Button btnIA8; + private System.Windows.Forms.Button btnRGB5A3; + private System.Windows.Forms.Button btnRGB565; + } +} \ No newline at end of file diff --git a/CustomizeMii/CustomizeMii_PaletteFormatBox.cs b/CustomizeMii/CustomizeMii_PaletteFormatBox.cs new file mode 100644 index 0000000..1892cbd --- /dev/null +++ b/CustomizeMii/CustomizeMii_PaletteFormatBox.cs @@ -0,0 +1,40 @@ +using System.Windows.Forms; +using libWiiSharp; + +namespace CustomizeMii +{ + public partial class CustomizeMii_PaletteFormatBox : Form + { + private TPL_PaletteFormat pFormat = TPL_PaletteFormat.RGB5A3; + + public TPL_PaletteFormat PaletteFormat { get { return pFormat; } } + + public CustomizeMii_PaletteFormatBox() + { + InitializeComponent(); + } + + private void btnIA8_Click(object sender, System.EventArgs e) + { + pFormat = TPL_PaletteFormat.IA8; + this.Close(); + } + + private void btnRGB5A3_Click(object sender, System.EventArgs e) + { + pFormat = TPL_PaletteFormat.RGB5A3; + this.Close(); + } + + private void btnRGB565_Click(object sender, System.EventArgs e) + { + pFormat = TPL_PaletteFormat.RGB565; + this.Close(); + } + + private void CustomizeMii_PaletteFormatBox_Load(object sender, System.EventArgs e) + { + CenterToParent(); + } + } +} diff --git a/CustomizeMii/CustomizeMii_PaletteFormatBox.resx b/CustomizeMii/CustomizeMii_PaletteFormatBox.resx new file mode 100644 index 0000000..5ea0895 --- /dev/null +++ b/CustomizeMii/CustomizeMii_PaletteFormatBox.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_Preview.Designer.cs b/CustomizeMii/CustomizeMii_Preview.Designer.cs index 623bf40..efc2b7e 100644 --- a/CustomizeMii/CustomizeMii_Preview.Designer.cs +++ b/CustomizeMii/CustomizeMii_Preview.Designer.cs @@ -45,7 +45,6 @@ namespace CustomizeMii /// private void InitializeComponent() { - this.components = new System.ComponentModel.Container(); this.Panel = new System.Windows.Forms.Panel(); this.cbCheckerBoard = new System.Windows.Forms.CheckBox(); this.btnReplace = new System.Windows.Forms.Button(); @@ -60,7 +59,7 @@ namespace CustomizeMii this.lbSize = new System.Windows.Forms.Label(); this.lbSizeText = new System.Windows.Forms.Label(); this.pbPic = new System.Windows.Forms.PictureBox(); - this.cmFormat = new System.Windows.Forms.ContextMenuStrip(this.components); + this.cmFormat = new System.Windows.Forms.ContextMenuStrip(); this.cmRGBA8 = new System.Windows.Forms.ToolStripMenuItem(); this.cmRGB565 = new System.Windows.Forms.ToolStripMenuItem(); this.cmRGB5A3 = new System.Windows.Forms.ToolStripMenuItem(); @@ -78,6 +77,23 @@ namespace CustomizeMii this.cmToI8 = new System.Windows.Forms.ToolStripMenuItem(); this.cmToI4 = new System.Windows.Forms.ToolStripMenuItem(); this.lbNoPreview = new System.Windows.Forms.Label(); + this.cmCI8 = new System.Windows.Forms.ToolStripMenuItem(); + this.cmCI4 = new System.Windows.Forms.ToolStripMenuItem(); + this.cmCI8RGB5A3 = new System.Windows.Forms.ToolStripMenuItem(); + this.cmCI8RGB565 = new System.Windows.Forms.ToolStripMenuItem(); + this.cmCI8IA8 = new System.Windows.Forms.ToolStripMenuItem(); + this.cmCI4RGB5A3 = new System.Windows.Forms.ToolStripMenuItem(); + this.cmCI4RGB565 = new System.Windows.Forms.ToolStripMenuItem(); + this.cmCI4IA8 = new System.Windows.Forms.ToolStripMenuItem(); + this.lbTip = new System.Windows.Forms.Label(); + this.cmToCI8 = new System.Windows.Forms.ToolStripMenuItem(); + this.cmToCI4 = new System.Windows.Forms.ToolStripMenuItem(); + this.cmToCI8RGB5A3 = new System.Windows.Forms.ToolStripMenuItem(); + this.cmToCI8RGB565 = new System.Windows.Forms.ToolStripMenuItem(); + this.cmToCI8IA8 = new System.Windows.Forms.ToolStripMenuItem(); + this.cmToCI4RGB5A3 = new System.Windows.Forms.ToolStripMenuItem(); + this.cmToCI4RGB565 = new System.Windows.Forms.ToolStripMenuItem(); + this.cmToCI4IA8 = new System.Windows.Forms.ToolStripMenuItem(); this.Panel.SuspendLayout(); this.panel1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pbPic)).BeginInit(); @@ -182,6 +198,7 @@ namespace CustomizeMii // // panel1 // + this.panel1.Controls.Add(this.lbTip); this.panel1.Controls.Add(this.lbFormat); this.panel1.Controls.Add(this.lbFormatText); this.panel1.Controls.Add(this.lbSize); @@ -196,7 +213,7 @@ namespace CustomizeMii // this.lbFormat.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.lbFormat.AutoSize = true; - this.lbFormat.Location = new System.Drawing.Point(756, 5); + this.lbFormat.Location = new System.Drawing.Point(729, 5); this.lbFormat.Name = "lbFormat"; this.lbFormat.Size = new System.Drawing.Size(43, 13); this.lbFormat.TabIndex = 3; @@ -205,7 +222,7 @@ namespace CustomizeMii // lbFormatText // this.lbFormatText.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.lbFormatText.Location = new System.Drawing.Point(550, 5); + this.lbFormatText.Location = new System.Drawing.Point(523, 5); this.lbFormatText.Name = "lbFormatText"; this.lbFormatText.RightToLeft = System.Windows.Forms.RightToLeft.No; this.lbFormatText.Size = new System.Drawing.Size(205, 13); @@ -252,23 +269,25 @@ namespace CustomizeMii this.cmIA4, this.cmI8, this.cmI4, + this.cmCI8, + this.cmCI4, this.toolStripSeparator1, this.cmChangeFormat}); this.cmFormat.Name = "cmFormat"; - this.cmFormat.Size = new System.Drawing.Size(234, 186); + this.cmFormat.Size = new System.Drawing.Size(267, 252); // // cmRGBA8 // this.cmRGBA8.Name = "cmRGBA8"; - this.cmRGBA8.Size = new System.Drawing.Size(233, 22); + this.cmRGBA8.Size = new System.Drawing.Size(266, 22); this.cmRGBA8.Tag = "rgba8"; - this.cmRGBA8.Text = "As RGBA8 (High Quality)"; + this.cmRGBA8.Text = "As RGBA8 (High Quality with Alpha)"; this.cmRGBA8.Click += new System.EventHandler(this.cmFormat_Click); // // cmRGB565 // this.cmRGB565.Name = "cmRGB565"; - this.cmRGB565.Size = new System.Drawing.Size(233, 22); + this.cmRGB565.Size = new System.Drawing.Size(266, 22); this.cmRGB565.Tag = "rgb565"; this.cmRGB565.Text = "As RGB565 (Moderate Quality)"; this.cmRGB565.Click += new System.EventHandler(this.cmFormat_Click); @@ -276,15 +295,15 @@ namespace CustomizeMii // cmRGB5A3 // this.cmRGB5A3.Name = "cmRGB5A3"; - this.cmRGB5A3.Size = new System.Drawing.Size(233, 22); + this.cmRGB5A3.Size = new System.Drawing.Size(266, 22); this.cmRGB5A3.Tag = "rgb5a3"; - this.cmRGB5A3.Text = "As RGB5A3 (Low Quality)"; + this.cmRGB5A3.Text = "As RGB5A3 (Low Quality with Alpha)"; this.cmRGB5A3.Click += new System.EventHandler(this.cmFormat_Click); // // cmIA8 // this.cmIA8.Name = "cmIA8"; - this.cmIA8.Size = new System.Drawing.Size(233, 22); + this.cmIA8.Size = new System.Drawing.Size(266, 22); this.cmIA8.Tag = "ia8"; this.cmIA8.Text = "As IA8 (B/W with Alpha)"; this.cmIA8.Click += new System.EventHandler(this.cmFormat_Click); @@ -292,7 +311,7 @@ namespace CustomizeMii // cmIA4 // this.cmIA4.Name = "cmIA4"; - this.cmIA4.Size = new System.Drawing.Size(233, 22); + this.cmIA4.Size = new System.Drawing.Size(266, 22); this.cmIA4.Tag = "ia4"; this.cmIA4.Text = "As IA4 (B/W with Alpha)"; this.cmIA4.Click += new System.EventHandler(this.cmFormat_Click); @@ -300,7 +319,7 @@ namespace CustomizeMii // cmI8 // this.cmI8.Name = "cmI8"; - this.cmI8.Size = new System.Drawing.Size(233, 22); + this.cmI8.Size = new System.Drawing.Size(266, 22); this.cmI8.Tag = "i8"; this.cmI8.Text = "As I8 (B/W)"; this.cmI8.Click += new System.EventHandler(this.cmFormat_Click); @@ -308,7 +327,7 @@ namespace CustomizeMii // cmI4 // this.cmI4.Name = "cmI4"; - this.cmI4.Size = new System.Drawing.Size(233, 22); + this.cmI4.Size = new System.Drawing.Size(266, 22); this.cmI4.Tag = "i4"; this.cmI4.Text = "As I4 (B/W)"; this.cmI4.Click += new System.EventHandler(this.cmFormat_Click); @@ -316,7 +335,7 @@ namespace CustomizeMii // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(230, 6); + this.toolStripSeparator1.Size = new System.Drawing.Size(263, 6); // // cmChangeFormat // @@ -327,23 +346,25 @@ namespace CustomizeMii this.cmToIA8, this.cmToIA4, this.cmToI8, - this.cmToI4}); + this.cmToI4, + this.cmToCI8, + this.cmToCI4}); this.cmChangeFormat.Name = "cmChangeFormat"; - this.cmChangeFormat.Size = new System.Drawing.Size(233, 22); + this.cmChangeFormat.Size = new System.Drawing.Size(266, 22); this.cmChangeFormat.Text = "Change Format"; // // cmToRGBA8 // this.cmToRGBA8.Name = "cmToRGBA8"; - this.cmToRGBA8.Size = new System.Drawing.Size(234, 22); + this.cmToRGBA8.Size = new System.Drawing.Size(267, 22); this.cmToRGBA8.Tag = "rgba8"; - this.cmToRGBA8.Text = "To RGBA8 (High Quality)"; + this.cmToRGBA8.Text = "To RGBA8 (High Quality with Alpha)"; this.cmToRGBA8.Click += new System.EventHandler(this.cmChangeFormat_Click); // // cmToRGB565 // this.cmToRGB565.Name = "cmToRGB565"; - this.cmToRGB565.Size = new System.Drawing.Size(234, 22); + this.cmToRGB565.Size = new System.Drawing.Size(267, 22); this.cmToRGB565.Tag = "rgb565"; this.cmToRGB565.Text = "To RGB565 (Moderate Quality)"; this.cmToRGB565.Click += new System.EventHandler(this.cmChangeFormat_Click); @@ -351,15 +372,15 @@ namespace CustomizeMii // cmToRGB5A3 // this.cmToRGB5A3.Name = "cmToRGB5A3"; - this.cmToRGB5A3.Size = new System.Drawing.Size(234, 22); + this.cmToRGB5A3.Size = new System.Drawing.Size(267, 22); this.cmToRGB5A3.Tag = "rgb5a3"; - this.cmToRGB5A3.Text = "To RGB5A3 (Low Quality)"; + this.cmToRGB5A3.Text = "To RGB5A3 (Low Quality with Alpha)"; this.cmToRGB5A3.Click += new System.EventHandler(this.cmChangeFormat_Click); // // cmToIA8 // this.cmToIA8.Name = "cmToIA8"; - this.cmToIA8.Size = new System.Drawing.Size(234, 22); + this.cmToIA8.Size = new System.Drawing.Size(267, 22); this.cmToIA8.Tag = "ia8"; this.cmToIA8.Text = "To IA8 (B/W with Alpha)"; this.cmToIA8.Click += new System.EventHandler(this.cmChangeFormat_Click); @@ -367,7 +388,7 @@ namespace CustomizeMii // cmToIA4 // this.cmToIA4.Name = "cmToIA4"; - this.cmToIA4.Size = new System.Drawing.Size(234, 22); + this.cmToIA4.Size = new System.Drawing.Size(267, 22); this.cmToIA4.Tag = "ia4"; this.cmToIA4.Text = "To IA4 (B/W with Alpha)"; this.cmToIA4.Click += new System.EventHandler(this.cmChangeFormat_Click); @@ -375,7 +396,7 @@ namespace CustomizeMii // cmToI8 // this.cmToI8.Name = "cmToI8"; - this.cmToI8.Size = new System.Drawing.Size(234, 22); + this.cmToI8.Size = new System.Drawing.Size(267, 22); this.cmToI8.Tag = "i8"; this.cmToI8.Text = "To I8 (B/W)"; this.cmToI8.Click += new System.EventHandler(this.cmChangeFormat_Click); @@ -383,7 +404,7 @@ namespace CustomizeMii // cmToI4 // this.cmToI4.Name = "cmToI4"; - this.cmToI4.Size = new System.Drawing.Size(234, 22); + this.cmToI4.Size = new System.Drawing.Size(267, 22); this.cmToI4.Tag = "i4"; this.cmToI4.Text = "To I4 (B/W)"; this.cmToI4.Click += new System.EventHandler(this.cmChangeFormat_Click); @@ -399,6 +420,154 @@ namespace CustomizeMii this.lbNoPreview.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.lbNoPreview.Visible = false; // + // cmCI8 + // + this.cmCI8.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.cmCI8RGB5A3, + this.cmCI8RGB565, + this.cmCI8IA8}); + this.cmCI8.Name = "cmCI8"; + this.cmCI8.Size = new System.Drawing.Size(266, 22); + this.cmCI8.Text = "As CI8 (Indexed, max. 256 Colors)"; + // + // cmCI4 + // + this.cmCI4.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.cmCI4RGB5A3, + this.cmCI4RGB565, + this.cmCI4IA8}); + this.cmCI4.Name = "cmCI4"; + this.cmCI4.Size = new System.Drawing.Size(266, 22); + this.cmCI4.Text = "As CI4 (Indexed, max. 16 Colors)"; + // + // cmCI8RGB5A3 + // + this.cmCI8RGB5A3.Name = "cmCI8RGB5A3"; + this.cmCI8RGB5A3.Size = new System.Drawing.Size(283, 22); + this.cmCI8RGB5A3.Tag = "ci8rgb5a3"; + this.cmCI8RGB5A3.Text = "With RGB5A3 Palette (Color with Alpha)"; + this.cmCI8RGB5A3.Click += new System.EventHandler(this.cmFormat_Click); + // + // cmCI8RGB565 + // + this.cmCI8RGB565.Name = "cmCI8RGB565"; + this.cmCI8RGB565.Size = new System.Drawing.Size(283, 22); + this.cmCI8RGB565.Tag = "ci8rgb565"; + this.cmCI8RGB565.Text = "With RGB565 Palette (Color)"; + this.cmCI8RGB565.Click += new System.EventHandler(this.cmFormat_Click); + // + // cmCI8IA8 + // + this.cmCI8IA8.Name = "cmCI8IA8"; + this.cmCI8IA8.Size = new System.Drawing.Size(283, 22); + this.cmCI8IA8.Tag = "ci8ia8"; + this.cmCI8IA8.Text = "With IA8 Palette (B/W with Alpha)"; + this.cmCI8IA8.Click += new System.EventHandler(this.cmFormat_Click); + // + // cmCI4RGB5A3 + // + this.cmCI4RGB5A3.Name = "cmCI4RGB5A3"; + this.cmCI4RGB5A3.Size = new System.Drawing.Size(283, 22); + this.cmCI4RGB5A3.Tag = "ci4rgb5a3"; + this.cmCI4RGB5A3.Text = "With RGB5A3 Palette (Color with Alpha)"; + this.cmCI4RGB5A3.Click += new System.EventHandler(this.cmFormat_Click); + // + // cmCI4RGB565 + // + this.cmCI4RGB565.Name = "cmCI4RGB565"; + this.cmCI4RGB565.Size = new System.Drawing.Size(283, 22); + this.cmCI4RGB565.Tag = "ci4rgb565"; + this.cmCI4RGB565.Text = "With RGB565 Palette (Color)"; + this.cmCI4RGB565.Click += new System.EventHandler(this.cmFormat_Click); + // + // cmCI4IA8 + // + this.cmCI4IA8.Name = "cmCI4IA8"; + this.cmCI4IA8.Size = new System.Drawing.Size(283, 22); + this.cmCI4IA8.Tag = "ci4ia8"; + this.cmCI4IA8.Text = "With IA8 Palette (B/W with Alpha)"; + this.cmCI4IA8.Click += new System.EventHandler(this.cmFormat_Click); + // + // lbTip + // + this.lbTip.AutoSize = true; + this.lbTip.ForeColor = System.Drawing.Color.Red; + this.lbTip.Location = new System.Drawing.Point(149, 6); + this.lbTip.Name = "lbTip"; + this.lbTip.Size = new System.Drawing.Size(470, 13); + this.lbTip.TabIndex = 4; + this.lbTip.Text = "Tip: Reduce the colors of an image with Photoshop or GIMP to gain better results " + + "with CI formats..."; + this.lbTip.Visible = false; + // + // cmToCI8 + // + this.cmToCI8.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.cmToCI8RGB5A3, + this.cmToCI8RGB565, + this.cmToCI8IA8}); + this.cmToCI8.Name = "cmToCI8"; + this.cmToCI8.Size = new System.Drawing.Size(267, 22); + this.cmToCI8.Text = "To CI8 (Indexed, max. 256 Colors)"; + // + // cmToCI4 + // + this.cmToCI4.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.cmToCI4RGB5A3, + this.cmToCI4RGB565, + this.cmToCI4IA8}); + this.cmToCI4.Name = "cmToCI4"; + this.cmToCI4.Size = new System.Drawing.Size(267, 22); + this.cmToCI4.Text = "To CI4 (Indexed, max. 16 Colors)"; + // + // cmToCI8RGB5A3 + // + this.cmToCI8RGB5A3.Name = "cmToCI8RGB5A3"; + this.cmToCI8RGB5A3.Size = new System.Drawing.Size(283, 22); + this.cmToCI8RGB5A3.Tag = "ci8rgb5a3"; + this.cmToCI8RGB5A3.Text = "With RGB5A3 Palette (Color with Alpha)"; + this.cmToCI8RGB5A3.Click += new System.EventHandler(this.cmChangeFormat_Click); + // + // cmToCI8RGB565 + // + this.cmToCI8RGB565.Name = "cmToCI8RGB565"; + this.cmToCI8RGB565.Size = new System.Drawing.Size(283, 22); + this.cmToCI8RGB565.Tag = "ci8rgb565"; + this.cmToCI8RGB565.Text = "With RGB565 Palette (Color)"; + this.cmToCI8RGB565.Click += new System.EventHandler(this.cmChangeFormat_Click); + // + // cmToCI8IA8 + // + this.cmToCI8IA8.Name = "cmToCI8IA8"; + this.cmToCI8IA8.Size = new System.Drawing.Size(283, 22); + this.cmToCI8IA8.Tag = "ci8ia8"; + this.cmToCI8IA8.Text = "With IA8 Palette (B/W with Alpha)"; + this.cmToCI8IA8.Click += new System.EventHandler(this.cmChangeFormat_Click); + // + // cmToCI4RGB5A3 + // + this.cmToCI4RGB5A3.Name = "cmToCI4RGB5A3"; + this.cmToCI4RGB5A3.Size = new System.Drawing.Size(283, 22); + this.cmToCI4RGB5A3.Tag = "ci4rgb5a3"; + this.cmToCI4RGB5A3.Text = "With RGB5A3 Palette (Color with Alpha)"; + this.cmToCI4RGB5A3.Click += new System.EventHandler(this.cmChangeFormat_Click); + // + // cmToCI4RGB565 + // + this.cmToCI4RGB565.Name = "cmToCI4RGB565"; + this.cmToCI4RGB565.Size = new System.Drawing.Size(283, 22); + this.cmToCI4RGB565.Tag = "ci4rgb565"; + this.cmToCI4RGB565.Text = "With RGB565 Palette (Color)"; + this.cmToCI4RGB565.Click += new System.EventHandler(this.cmChangeFormat_Click); + // + // cmToCI4IA8 + // + this.cmToCI4IA8.Name = "cmToCI4IA8"; + this.cmToCI4IA8.Size = new System.Drawing.Size(283, 22); + this.cmToCI4IA8.Tag = "ci4ia8"; + this.cmToCI4IA8.Text = "With IA8 Palette (B/W with Alpha)"; + this.cmToCI4IA8.Click += new System.EventHandler(this.cmChangeFormat_Click); + // // CustomizeMii_Preview // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -414,8 +583,8 @@ namespace CustomizeMii this.MinimumSize = new System.Drawing.Size(833, 500); this.Name = "CustomizeMii_Preview"; this.Text = "Preview"; - this.Load += new System.EventHandler(this.Preview_Load); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Preview_FormClosing); + this.Load += new System.EventHandler(this.Preview_Load); this.Panel.ResumeLayout(false); this.Panel.PerformLayout(); this.panel1.ResumeLayout(false); @@ -460,5 +629,22 @@ namespace CustomizeMii private System.Windows.Forms.ToolStripMenuItem cmToI4; private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; private System.Windows.Forms.CheckBox cbCheckerBoard; + private System.Windows.Forms.ToolStripMenuItem cmCI8; + private System.Windows.Forms.ToolStripMenuItem cmCI4; + private System.Windows.Forms.ToolStripMenuItem cmCI8RGB5A3; + private System.Windows.Forms.ToolStripMenuItem cmCI8RGB565; + private System.Windows.Forms.ToolStripMenuItem cmCI8IA8; + private System.Windows.Forms.ToolStripMenuItem cmCI4RGB5A3; + private System.Windows.Forms.ToolStripMenuItem cmCI4RGB565; + private System.Windows.Forms.ToolStripMenuItem cmCI4IA8; + private System.Windows.Forms.Label lbTip; + private System.Windows.Forms.ToolStripMenuItem cmToCI8; + private System.Windows.Forms.ToolStripMenuItem cmToCI4; + private System.Windows.Forms.ToolStripMenuItem cmToCI8RGB5A3; + private System.Windows.Forms.ToolStripMenuItem cmToCI8RGB565; + private System.Windows.Forms.ToolStripMenuItem cmToCI8IA8; + private System.Windows.Forms.ToolStripMenuItem cmToCI4RGB5A3; + private System.Windows.Forms.ToolStripMenuItem cmToCI4RGB565; + private System.Windows.Forms.ToolStripMenuItem cmToCI4IA8; } } \ No newline at end of file diff --git a/CustomizeMii/CustomizeMii_Preview.cs b/CustomizeMii/CustomizeMii_Preview.cs index a1dd582..db0a4eb 100644 --- a/CustomizeMii/CustomizeMii_Preview.cs +++ b/CustomizeMii/CustomizeMii_Preview.cs @@ -30,6 +30,7 @@ namespace CustomizeMii private U8 iconBin; private string startTPL; private bool startIcon = false; + Timer tipTimer = new Timer(); public U8 BannerBin { get { return bannerBin; } set { bannerBin = value; } } public U8 IconBin { get { return iconBin; } set { iconBin = value; } } @@ -79,6 +80,9 @@ namespace CustomizeMii tmpImage.tplImage = tmpTpl.ExtractTexture(); tmpImage.checkerBoard = createCheckerBoard(tmpImage.tplImage.Width, tmpImage.tplImage.Height); + if (tmpImage.tplFormat.StartsWith("CI")) + tmpImage.tplFormat += " + " + tmpTpl.GetPaletteFormat(0); + bannerImages.Add(tmpImage); } } @@ -95,6 +99,9 @@ namespace CustomizeMii tmpImage.tplImage = tmpTpl.ExtractTexture(); tmpImage.checkerBoard = createCheckerBoard(tmpImage.tplImage.Width, tmpImage.tplImage.Height); + if (tmpImage.tplFormat.StartsWith("CI")) + tmpImage.tplFormat += " + " + tmpTpl.GetPaletteFormat(0); + iconImages.Add(tmpImage); } } @@ -130,6 +137,16 @@ namespace CustomizeMii if (cbBanner.SelectedIndex != -1) cbBanner.Select(); else if (cbIcon.SelectedIndex != -1) cbIcon.Select(); + + tipTimer.Interval = 7000; + tipTimer.Tag = 0; + tipTimer.Tick += new EventHandler(tipTimer_Tick); + } + + void tipTimer_Tick(object sender, EventArgs e) + { + lbTip.Visible = false; + tipTimer.Stop(); } private void cbBanner_SelectedIndexChanged(object sender, EventArgs e) @@ -243,40 +260,66 @@ namespace CustomizeMii } Size tplSize = tmpTpl.GetTextureSize(0); - TPL_Format tplFormat; if (newImg.Width != tplSize.Width || newImg.Height != tplSize.Height) newImg = resizeImage(newImg, tplSize.Width, tplSize.Height); ToolStripMenuItem cmSender = sender as ToolStripMenuItem; + TPL_TextureFormat tplFormat; + TPL_PaletteFormat pFormat = TPL_PaletteFormat.RGB5A3; + switch (cmSender.Tag.ToString().ToLower()) { case "i4": - tplFormat = TPL_Format.I4; + tplFormat = TPL_TextureFormat.I4; break; case "i8": - tplFormat = TPL_Format.I8; + tplFormat = TPL_TextureFormat.I8; break; case "ia4": - tplFormat = TPL_Format.IA4; + tplFormat = TPL_TextureFormat.IA4; break; case "ia8": - tplFormat = TPL_Format.IA8; + tplFormat = TPL_TextureFormat.IA8; break; case "rgb565": - tplFormat = TPL_Format.RGB565; + tplFormat = TPL_TextureFormat.RGB565; break; case "rgb5a3": - tplFormat = TPL_Format.RGB5A3; + tplFormat = TPL_TextureFormat.RGB5A3; + break; + case "ci8rgb5a3": + tplFormat = TPL_TextureFormat.CI8; + pFormat = TPL_PaletteFormat.RGB5A3; + break; + case "ci8rgb565": + tplFormat = TPL_TextureFormat.CI8; + pFormat = TPL_PaletteFormat.RGB565; + break; + case "ci8ia8": + tplFormat = TPL_TextureFormat.CI8; + pFormat = TPL_PaletteFormat.IA8; + break; + case "ci4rgb5a3": + tplFormat = TPL_TextureFormat.CI4; + pFormat = TPL_PaletteFormat.RGB5A3; + break; + case "ci4rgb565": + tplFormat = TPL_TextureFormat.CI4; + pFormat = TPL_PaletteFormat.RGB565; + break; + case "ci4ia8": + tplFormat = TPL_TextureFormat.CI4; + pFormat = TPL_PaletteFormat.IA8; break; default: - tplFormat = TPL_Format.RGBA8; + tplFormat = TPL_TextureFormat.RGBA8; break; } tmpTpl.RemoveTexture(0); - tmpTpl.AddTexture(newImg, tplFormat); + tmpTpl.AddTexture(newImg, tplFormat, pFormat); if (cbBanner.SelectedIndex != -1) { @@ -284,6 +327,9 @@ namespace CustomizeMii images[0][cbBanner.SelectedIndex].tplImage = tmpTpl.ExtractTexture(); images[0][cbBanner.SelectedIndex].tplFormat = tmpTpl.GetTextureFormat(0).ToString(); + if (images[0][cbBanner.SelectedIndex].tplFormat.StartsWith("CI")) + images[0][cbBanner.SelectedIndex].tplFormat += " + " + tmpTpl.GetPaletteFormat(0); + pbPic.Image = images[0][cbBanner.SelectedIndex].tplImage; lbFormat.Text = images[0][cbBanner.SelectedIndex].tplFormat; lbSize.Text = string.Format("{0} x {1}", images[0][cbBanner.SelectedIndex].tplImage.Width, images[0][cbBanner.SelectedIndex].tplImage.Height); @@ -294,6 +340,9 @@ namespace CustomizeMii images[1][cbIcon.SelectedIndex].tplImage = tmpTpl.ExtractTexture(); images[1][cbIcon.SelectedIndex].tplFormat = tmpTpl.GetTextureFormat(0).ToString(); + if (images[1][cbIcon.SelectedIndex].tplFormat.StartsWith("CI")) + images[1][cbIcon.SelectedIndex].tplFormat += " + " + tmpTpl.GetPaletteFormat(0); + pbPic.Image = images[1][cbIcon.SelectedIndex].tplImage; lbFormat.Text = images[1][cbIcon.SelectedIndex].tplFormat; lbSize.Text = string.Format("{0} x {1}", images[1][cbIcon.SelectedIndex].tplImage.Width, images[1][cbIcon.SelectedIndex].tplImage.Height); @@ -301,6 +350,12 @@ namespace CustomizeMii if (cbBanner.SelectedIndex != -1) cbBanner.Select(); else if (cbIcon.SelectedIndex != -1) cbIcon.Select(); + + if (tplFormat == TPL_TextureFormat.CI4 || tplFormat == TPL_TextureFormat.CI8) + { + lbTip.Visible = true; + tipTimer.Start(); + } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } @@ -327,38 +382,63 @@ namespace CustomizeMii } newImg = tmpTpl.ExtractTexture(); - TPL_Format tplFormat; + TPL_TextureFormat tplFormat; + TPL_PaletteFormat pFormat = TPL_PaletteFormat.RGB5A3; ToolStripMenuItem cmSender = sender as ToolStripMenuItem; switch (cmSender.Tag.ToString().ToLower()) { case "i4": - tplFormat = TPL_Format.I4; + tplFormat = TPL_TextureFormat.I4; break; case "i8": - tplFormat = TPL_Format.I8; + tplFormat = TPL_TextureFormat.I8; break; case "ia4": - tplFormat = TPL_Format.IA4; + tplFormat = TPL_TextureFormat.IA4; break; case "ia8": - tplFormat = TPL_Format.IA8; + tplFormat = TPL_TextureFormat.IA8; break; case "rgb565": - tplFormat = TPL_Format.RGB565; + tplFormat = TPL_TextureFormat.RGB565; break; case "rgb5a3": - tplFormat = TPL_Format.RGB5A3; + tplFormat = TPL_TextureFormat.RGB5A3; + break; + case "ci8rgb5a3": + tplFormat = TPL_TextureFormat.CI8; + pFormat = TPL_PaletteFormat.RGB5A3; + break; + case "ci8rgb565": + tplFormat = TPL_TextureFormat.CI8; + pFormat = TPL_PaletteFormat.RGB565; + break; + case "ci8ia8": + tplFormat = TPL_TextureFormat.CI8; + pFormat = TPL_PaletteFormat.IA8; + break; + case "ci4rgb5a3": + tplFormat = TPL_TextureFormat.CI4; + pFormat = TPL_PaletteFormat.RGB5A3; + break; + case "ci4rgb565": + tplFormat = TPL_TextureFormat.CI4; + pFormat = TPL_PaletteFormat.RGB565; + break; + case "ci4ia8": + tplFormat = TPL_TextureFormat.CI4; + pFormat = TPL_PaletteFormat.IA8; break; default: - tplFormat = TPL_Format.RGBA8; + tplFormat = TPL_TextureFormat.RGBA8; break; } if (tmpTpl.GetTextureFormat(0) == tplFormat) return; tmpTpl.RemoveTexture(0); - tmpTpl.AddTexture(newImg, tplFormat); + tmpTpl.AddTexture(newImg, tplFormat, pFormat); if (cbBanner.SelectedIndex != -1) { @@ -366,6 +446,8 @@ namespace CustomizeMii images[0][cbBanner.SelectedIndex].tplImage = tmpTpl.ExtractTexture(); images[0][cbBanner.SelectedIndex].tplFormat = tmpTpl.GetTextureFormat(0).ToString(); + if (images[0][cbBanner.SelectedIndex].tplFormat.StartsWith("CI")) + images[0][cbBanner.SelectedIndex].tplFormat += " + " + tmpTpl.GetPaletteFormat(0); pbPic.Image = images[0][cbBanner.SelectedIndex].tplImage; lbFormat.Text = images[0][cbBanner.SelectedIndex].tplFormat; @@ -377,6 +459,9 @@ namespace CustomizeMii images[1][cbIcon.SelectedIndex].tplImage = tmpTpl.ExtractTexture(); images[1][cbIcon.SelectedIndex].tplFormat = tmpTpl.GetTextureFormat(0).ToString(); + if (images[1][cbIcon.SelectedIndex].tplFormat.StartsWith("CI")) + images[1][cbIcon.SelectedIndex].tplFormat += " + " + tmpTpl.GetPaletteFormat(0); + pbPic.Image = images[1][cbIcon.SelectedIndex].tplImage; lbFormat.Text = images[1][cbIcon.SelectedIndex].tplFormat; lbSize.Text = string.Format("{0} x {1}", images[1][cbIcon.SelectedIndex].tplImage.Width, images[1][cbIcon.SelectedIndex].tplImage.Height); @@ -384,6 +469,12 @@ namespace CustomizeMii if (cbBanner.SelectedIndex != -1) cbBanner.Select(); else if (cbIcon.SelectedIndex != -1) cbIcon.Select(); + + if (tplFormat == TPL_TextureFormat.CI4 || tplFormat == TPL_TextureFormat.CI8) + { + lbTip.Visible = true; + tipTimer.Start(); + } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } diff --git a/CustomizeMii/CustomizeMii_PrivateFunctions.cs b/CustomizeMii/CustomizeMii_PrivateFunctions.cs index 299f416..15f387c 100644 --- a/CustomizeMii/CustomizeMii_PrivateFunctions.cs +++ b/CustomizeMii/CustomizeMii_PrivateFunctions.cs @@ -169,7 +169,7 @@ namespace CustomizeMii if (!tbSound.Text.ToLower().EndsWith(".bns") && !tbSound.Text.StartsWith("BNS:")) { Wave w = new Wave(Headers.IMD5.RemoveHeader(newSoundBin)); - soundLength = w.GetWaveLength(); + soundLength = w.PlayLength; if (soundLength > soundMaxLength) { errorBox(string.Format("Your wave sound is longer than {0} seconds and thus not supported.\nIt is recommended to use a sound shorter than {1} seconds, the maximum length is {0} seconds!\nThis limit doesn't affect BNS sounds!", soundMaxLength, soundWarningLength)); @@ -449,7 +449,14 @@ namespace CustomizeMii try { TPL tmpTpl = TPL.Load(bannerBin.Data[i]); - bannerTpls.Add(string.Format("{0} ({3}, {1} x {2}, {4})", bannerBin.StringTable[i], tmpTpl.GetTextureSize(0).Width, tmpTpl.GetTextureSize(0).Height, tmpTpl.GetTextureFormat(0).ToString(), getSizeString(bannerBin.Data[i].Length))); + + string formatString = tmpTpl.GetTextureFormat(0).ToString(); + if (formatString.StartsWith("CI")) formatString += "+" + tmpTpl.GetPaletteFormat(0); + + bannerTpls.Add(string.Format("{0} ({3}, {1} x {2}, {4})", + bannerBin.StringTable[i], tmpTpl.GetTextureSize(0).Width, + tmpTpl.GetTextureSize(0).Height, formatString, + getSizeString(bannerBin.Data[i].Length))); } catch { } } @@ -462,7 +469,14 @@ namespace CustomizeMii try { TPL tmpTpl = TPL.Load(newBannerBin.Data[i]); - bannerTpls.Add(string.Format("{0} ({3}, {1} x {2}, {4})", newBannerBin.StringTable[i], tmpTpl.GetTextureSize(0).Width, tmpTpl.GetTextureSize(0).Height, tmpTpl.GetTextureFormat(0).ToString(), getSizeString(newBannerBin.Data[i].Length))); + + string formatString = tmpTpl.GetTextureFormat(0).ToString(); + if (formatString.StartsWith("CI")) formatString += "+" + tmpTpl.GetPaletteFormat(0); + + bannerTpls.Add(string.Format("{0} ({3}, {1} x {2}, {4})", + newBannerBin.StringTable[i], tmpTpl.GetTextureSize(0).Width, + tmpTpl.GetTextureSize(0).Height, formatString, + getSizeString(newBannerBin.Data[i].Length))); } catch { } } @@ -690,7 +704,7 @@ namespace CustomizeMii Image tImg = new Bitmap(tSize.Width, tSize.Height); tmpTpl.RemoveTexture(0); - tmpTpl.AddTexture(tImg, TPL_Format.IA4); + tmpTpl.AddTexture(tImg, TPL_TextureFormat.IA4); bannerBin.Data[i] = tmpTpl.ToByteArray(); } @@ -707,7 +721,7 @@ namespace CustomizeMii Image tImg = new Bitmap(tSize.Width, tSize.Height); tmpTpl.RemoveTexture(0); - tmpTpl.AddTexture(tImg, TPL_Format.IA4); + tmpTpl.AddTexture(tImg, TPL_TextureFormat.IA4); newBannerBin.Data[i] = tmpTpl.ToByteArray(); } @@ -734,7 +748,7 @@ namespace CustomizeMii Image tImg = new Bitmap(tSize.Width, tSize.Height); tmpTpl.RemoveTexture(0); - tmpTpl.AddTexture(tImg, TPL_Format.IA4); + tmpTpl.AddTexture(tImg, TPL_TextureFormat.IA4); iconBin.Data[i] = tmpTpl.ToByteArray(); } @@ -751,7 +765,7 @@ namespace CustomizeMii Image tImg = new Bitmap(tSize.Width, tSize.Height); tmpTpl.RemoveTexture(0); - tmpTpl.AddTexture(tImg, TPL_Format.IA4); + tmpTpl.AddTexture(tImg, TPL_TextureFormat.IA4); newIconBin.Data[i] = tmpTpl.ToByteArray(); } @@ -771,7 +785,7 @@ namespace CustomizeMii try { int switchVal = lbx == lbxBannerTpls ? cmbFormatBanner.SelectedIndex : cmbFormatIcon.SelectedIndex; - if (switchVal > 6) + if (switchVal > 9) throw new Exception("This format is not supported, you must choose a different one!"); if (string.IsNullOrEmpty(inputFile)) @@ -880,28 +894,54 @@ namespace CustomizeMii int tplFormat = 6; + TPL_PaletteFormat pFormat = TPL_PaletteFormat.RGB5A3; + switch (switchVal) { - case 6: //I4 - tplFormat = 0; + case 6: + tplFormat = (int)TPL_TextureFormat.I4; break; - case 5: //I8 - tplFormat = 1; + case 5: + tplFormat = (int)TPL_TextureFormat.I8; break; - case 4: //IA4 - tplFormat = 2; + case 4: + tplFormat = (int)TPL_TextureFormat.IA4; break; - case 3: //IA8 - tplFormat = 3; + case 3: + tplFormat = (int)TPL_TextureFormat.IA8; break; case 0: - tplFormat = 6; + tplFormat = (int)TPL_TextureFormat.RGBA8; break; case 1: - tplFormat = 4; + tplFormat = (int)TPL_TextureFormat.RGB565; break; case 2: - tplFormat = 5; + tplFormat = (int)TPL_TextureFormat.RGB5A3; + break; + case 7: + tplFormat = (int)TPL_TextureFormat.CI4; + + CustomizeMii_PaletteFormatBox pfb = new CustomizeMii_PaletteFormatBox(); + pfb.ShowDialog(); + + pFormat = pfb.PaletteFormat; + break; + case 8: + tplFormat = (int)TPL_TextureFormat.CI8; + + CustomizeMii_PaletteFormatBox pfb2 = new CustomizeMii_PaletteFormatBox(); + pfb2.ShowDialog(); + + pFormat = pfb2.PaletteFormat; + break; + case 9: + tplFormat = (int)TPL_TextureFormat.CI14X2; + + CustomizeMii_PaletteFormatBox pfb3 = new CustomizeMii_PaletteFormatBox(); + pfb3.ShowDialog(); + + pFormat = pfb3.PaletteFormat; break; default: if (!inputFile.ToLower().EndsWith(".tpl")) @@ -913,7 +953,7 @@ namespace CustomizeMii if (inputFile.ToLower().EndsWith(".tpl")) newTpl = File.ReadAllBytes(inputFile); else - newTpl = TPL.FromImage(inputFile, (TPL_Format)tplFormat).ToByteArray(); + newTpl = TPL.FromImage(inputFile, (TPL_TextureFormat)tplFormat, pFormat).ToByteArray(); if (lbx == lbxBannerTpls) { @@ -1187,7 +1227,7 @@ namespace CustomizeMii TPL tmpTpl = TPL.Load(bannerBin.Data[bannerBin.GetNodeIndex(thisTpl)]); Image img = Image.FromFile(image); - TPL_Format tplFormat = tmpTpl.GetTextureFormat(0); + TPL_TextureFormat tplFormat = tmpTpl.GetTextureFormat(0); Size tplSize = tmpTpl.GetTextureSize(0); if (tplSize.Width != img.Width || @@ -1205,7 +1245,7 @@ namespace CustomizeMii TPL tmpTpl = TPL.Load(newBannerBin.Data[newBannerBin.GetNodeIndex(thisTpl)]); Image img = Image.FromFile(image); - TPL_Format tplFormat = tmpTpl.GetTextureFormat(0); + TPL_TextureFormat tplFormat = tmpTpl.GetTextureFormat(0); Size tplSize = tmpTpl.GetTextureSize(0); if (tplSize.Width != img.Width || @@ -1226,7 +1266,7 @@ namespace CustomizeMii TPL tmpTpl = TPL.Load(iconBin.Data[iconBin.GetNodeIndex(thisTpl)]); Image img = Image.FromFile(image); - TPL_Format tplFormat = tmpTpl.GetTextureFormat(0); + TPL_TextureFormat tplFormat = tmpTpl.GetTextureFormat(0); Size tplSize = tmpTpl.GetTextureSize(0); if (tplSize.Width != img.Width || @@ -1244,7 +1284,7 @@ namespace CustomizeMii TPL tmpTpl = TPL.Load(newIconBin.Data[newIconBin.GetNodeIndex(thisTpl)]); Image img = Image.FromFile(image); - TPL_Format tplFormat = tmpTpl.GetTextureFormat(0); + TPL_TextureFormat tplFormat = tmpTpl.GetTextureFormat(0); Size tplSize = tmpTpl.GetTextureSize(0); if (tplSize.Width != img.Width || diff --git a/CustomizeMii/Properties/AssemblyInfo.cs b/CustomizeMii/Properties/AssemblyInfo.cs index bb20754..4809c9f 100644 --- a/CustomizeMii/Properties/AssemblyInfo.cs +++ b/CustomizeMii/Properties/AssemblyInfo.cs @@ -50,6 +50,6 @@ using System.Resources; // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern // übernehmen, indem Sie "*" eingeben: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("3.0.0.0")] -[assembly: AssemblyFileVersion("3.0.0.0")] +[assembly: AssemblyVersion("3.1.0.0")] +[assembly: AssemblyFileVersion("3.1.0.0")] [assembly: NeutralResourcesLanguageAttribute("en")] diff --git a/CustomizeMii/Properties/Resources.Designer.cs b/CustomizeMii/Properties/Resources.Designer.cs index 3137e88..2a6abd0 100644 --- a/CustomizeMii/Properties/Resources.Designer.cs +++ b/CustomizeMii/Properties/Resources.Designer.cs @@ -1,10 +1,10 @@ //------------------------------------------------------------------------------ // -// Dieser Code wurde von einem Tool generiert. -// Laufzeitversion:2.0.50727.4927 +// This code was generated by a tool. +// Runtime Version:4.0.30128.1 // -// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn -// der Code erneut generiert wird. +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. // //------------------------------------------------------------------------------ @@ -13,13 +13,13 @@ namespace CustomizeMii.Properties { /// - /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. + /// A strongly-typed resource class, for looking up localized strings, etc. /// - // Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert - // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert. - // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen - // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { @@ -33,7 +33,7 @@ namespace CustomizeMii.Properties { } /// - /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. + /// Returns the cached ResourceManager instance used by this class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { @@ -47,8 +47,8 @@ namespace CustomizeMii.Properties { } /// - /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle - /// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden. + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { @@ -89,14 +89,14 @@ namespace CustomizeMii.Properties { } /// - /// Sucht eine lokalisierte Zeichenfolge, die {\rtf1\ansi\ansicpg1252\deff0\deflang1031{\fonttbl{\f0\fnil\fcharset0 MS Sans Serif;}} + /// Looks up a localized string similar to {\rtf1\ansi\ansicpg1252\deff0\deflang1031{\fonttbl{\f0\fnil\fcharset0 MS Sans Serif;}} ///{\colortbl ;\red255\green0\blue0;\red0\green0\blue255;} ///{\*\generator Msftedit 5.41.21.2509;}\viewkind4\uc1\pard\sl276\slmult1\b\f0\fs17 These are some basic instructions for CustomizeMii.\b0\par ///\par ///\cf1 At the very beginning, let me say this again: Don't install any WADs without a proper brick protection!\cf0\par ///\par ///Ok, so you want to create your own custom channels?\par - ///First it is important to understand how [Rest der Zeichenfolge wurde abgeschnitten]"; ähnelt. + ///First it is important to understand how [rest of string was truncated]";. /// internal static string Instructions { get { diff --git a/CustomizeMii/Properties/Resources.resx b/CustomizeMii/Properties/Resources.resx index 8ee3630..faf8dfb 100644 --- a/CustomizeMii/Properties/Resources.resx +++ b/CustomizeMii/Properties/Resources.resx @@ -117,7 +117,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + ..\Resources\btnCreate.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a diff --git a/CustomizeMii/Properties/Settings.Designer.cs b/CustomizeMii/Properties/Settings.Designer.cs index 85009d5..fa3ffdf 100644 --- a/CustomizeMii/Properties/Settings.Designer.cs +++ b/CustomizeMii/Properties/Settings.Designer.cs @@ -1,27 +1,10 @@ -/* 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 +// This code was generated by a tool. +// Runtime Version:4.0.30128.1 // -// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn -// der Code erneut generiert wird. +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. // //------------------------------------------------------------------------------ @@ -29,7 +12,7 @@ namespace CustomizeMii.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); diff --git a/CustomizeMii/Readme.txt b/CustomizeMii/Readme.txt index 767c6d0..c1f9d67 100644 --- a/CustomizeMii/Readme.txt +++ b/CustomizeMii/Readme.txt @@ -9,6 +9,15 @@ Thanks to icefire / Xuzz for the basic idea of this application! ----------------------------------------------------------------------------------------- Changelog: +Version 3.1 + - Updated libWiiSharp to 0.2 + => - Speed up in TPL conversion + => - Fixed IA8 TPL code (from/to) + => - Fixed CI14X2 TPL code (from) + => - Added conversion to CI4 / CI8 + => - Added BNS to Wave conversion (Extract -> Sound -> As Audiofile) + - Added option to make the sound silent + Version 3.0 - Switched backend to libWiiSharp (http://libwiisharp.googlecode.com) - Speed improvements through using RAM instead of temp files on HDD diff --git a/CustomizeMii/lControls.dll b/CustomizeMii/lControls.dll new file mode 100644 index 0000000..c57b6cd Binary files /dev/null and b/CustomizeMii/lControls.dll differ diff --git a/CustomizeMii/libWiiSharp.dll b/CustomizeMii/libWiiSharp.dll index 562da8e..cfb197f 100644 Binary files a/CustomizeMii/libWiiSharp.dll and b/CustomizeMii/libWiiSharp.dll differ diff --git a/CustomizeMiiInstaller/CustomizeMiiInstaller.csproj b/CustomizeMiiInstaller/CustomizeMiiInstaller.csproj index 9f787c2..4ec7b7f 100644 --- a/CustomizeMiiInstaller/CustomizeMiiInstaller.csproj +++ b/CustomizeMiiInstaller/CustomizeMiiInstaller.csproj @@ -1,5 +1,5 @@  - + Debug AnyCPU @@ -12,6 +12,10 @@ CustomizeMiiInstaller v2.0 512 + + + 3.5 + true @@ -21,6 +25,7 @@ DEBUG;TRACE prompt 4 + AllRules.ruleset pdbonly @@ -29,6 +34,7 @@ TRACE prompt 4 + AllRules.ruleset diff --git a/ForwardMii/ForwardMii.csproj b/ForwardMii/ForwardMii.csproj index c79a5b8..16f5d23 100644 --- a/ForwardMii/ForwardMii.csproj +++ b/ForwardMii/ForwardMii.csproj @@ -1,5 +1,5 @@  - + Debug AnyCPU @@ -12,8 +12,10 @@ ForwardMii v2.0 512 - - + + + 3.5 + true @@ -23,6 +25,7 @@ DEBUG;TRACE prompt 4 + AllRules.ruleset pdbonly @@ -31,6 +34,7 @@ TRACE prompt 4 + AllRules.ruleset true @@ -39,6 +43,7 @@ full x86 prompt + AllRules.ruleset bin\x86\Release\ @@ -47,6 +52,7 @@ pdbonly x86 prompt + AllRules.ruleset