Replaced the TPL preview window with the one from ShowMiiWads

git-svn-id: svn://localhost/Users/andi/Downloads/code/trunk@18 eddbe33b-e435-4246-ac25-f5eb65f9a13c
This commit is contained in:
leathl 2009-12-31 03:34:47 +00:00
parent 3376e169ba
commit c276e85f01
11 changed files with 691 additions and 259 deletions

View File

@ -83,12 +83,6 @@
<Compile Include="CustomizeMii_Main.Designer.cs">
<DependentUpon>CustomizeMii_Main.cs</DependentUpon>
</Compile>
<Compile Include="CustomizeMii_Preview.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="CustomizeMii_Preview.Designer.cs">
<DependentUpon>CustomizeMii_Preview.cs</DependentUpon>
</Compile>
<Compile Include="CustomizeMii_InputBox.cs">
<SubType>Form</SubType>
</Compile>
@ -109,9 +103,6 @@
<EmbeddedResource Include="CustomizeMii_Main.resx">
<DependentUpon>CustomizeMii_Main.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="CustomizeMii_Preview.resx">
<DependentUpon>CustomizeMii_Preview.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
@ -128,12 +119,21 @@
</None>
<EmbeddedResource Include="Resources\comex.app" />
<EmbeddedResource Include="Resources\Waninkoko.app" />
<EmbeddedResource Include="CustomizeMii_Preview.resx">
<DependentUpon>CustomizeMii_Preview.cs</DependentUpon>
</EmbeddedResource>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<Compile Include="CustomizeMii_Structs.cs" />
<Compile Include="CustomizeMii_Preview.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="CustomizeMii_Preview.designer.cs">
<DependentUpon>CustomizeMii_Preview.cs</DependentUpon>
</Compile>
<Compile Include="Wave.cs" />
<Compile Include="Wii.cs" />
</ItemGroup>
@ -141,6 +141,8 @@
<Content Include="License.txt" />
<Content Include="Readme.txt" />
<Content Include="Instructions.txt" />
<None Include="Resources\btnSend.png" />
<None Include="Resources\btnCreate.png" />
<None Include="Resources\btnCreateWad.png" />
<None Include="Resources\CustomizeMii.ico" />
<None Include="Resources\Instructions.rtf" />

View File

@ -52,7 +52,6 @@ namespace CustomizeMii
this.tabSource = new System.Windows.Forms.TabPage();
this.tbReplace = new System.Windows.Forms.TextBox();
this.btnBrowseReplace = new System.Windows.Forms.Button();
this.btnClearReplace = new System.Windows.Forms.Button();
this.cmbReplace = new System.Windows.Forms.ComboBox();
this.btnSaveBaseWad = new System.Windows.Forms.Button();
this.btnPreviewBaseWad = new System.Windows.Forms.Button();
@ -221,7 +220,6 @@ namespace CustomizeMii
//
this.tabSource.Controls.Add(this.tbReplace);
this.tabSource.Controls.Add(this.btnBrowseReplace);
this.tabSource.Controls.Add(this.btnClearReplace);
this.tabSource.Controls.Add(this.cmbReplace);
this.tabSource.Controls.Add(this.btnSaveBaseWad);
this.tabSource.Controls.Add(this.btnPreviewBaseWad);
@ -243,13 +241,14 @@ namespace CustomizeMii
this.tbReplace.Location = new System.Drawing.Point(100, 173);
this.tbReplace.Name = "tbReplace";
this.tbReplace.ReadOnly = true;
this.tbReplace.Size = new System.Drawing.Size(173, 20);
this.tbReplace.Size = new System.Drawing.Size(254, 20);
this.tbReplace.TabIndex = 10;
this.tbReplace.Tag = "Disabled";
this.tbReplace.TextChanged += new System.EventHandler(this.tbReplace_TextChanged);
//
// btnBrowseReplace
//
this.btnBrowseReplace.Location = new System.Drawing.Point(279, 172);
this.btnBrowseReplace.Location = new System.Drawing.Point(360, 171);
this.btnBrowseReplace.Name = "btnBrowseReplace";
this.btnBrowseReplace.Size = new System.Drawing.Size(75, 23);
this.btnBrowseReplace.TabIndex = 9;
@ -257,16 +256,6 @@ namespace CustomizeMii
this.btnBrowseReplace.UseVisualStyleBackColor = true;
this.btnBrowseReplace.Click += new System.EventHandler(this.btnBrowseReplace_Click);
//
// btnClearReplace
//
this.btnClearReplace.Location = new System.Drawing.Point(360, 172);
this.btnClearReplace.Name = "btnClearReplace";
this.btnClearReplace.Size = new System.Drawing.Size(75, 23);
this.btnClearReplace.TabIndex = 8;
this.btnClearReplace.Text = "Clear";
this.btnClearReplace.UseVisualStyleBackColor = true;
this.btnClearReplace.Click += new System.EventHandler(this.btnClearReplace_Click);
//
// cmbReplace
//
this.cmbReplace.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
@ -1562,7 +1551,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.Button btnClearReplace;
private System.Windows.Forms.CheckBox cbLz77;
private System.Windows.Forms.LinkLabel llbSite;
private System.Windows.Forms.TabPage tabBrlyt;

View File

@ -36,11 +36,15 @@ namespace CustomizeMii
{
public partial class CustomizeMii_Main : Form
{
#region Constants
const string version = "2.1"; //Hint for myself: Never use a char in the Version (UpdateCheck)!
const int SoundMaxLength = 30; //In seconds
const int SoundWarningLength = 20; //In seconds
const int BnsWarningLength = 45; //In seconds
const int CreditsScrollSpeed = 85; //Timer Intervall for the scrolling Credits
const int CreditsScrollSpeed = 75; //Timer Intervall for the scrolling Credits
#endregion
#region Variables
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\\";
@ -57,18 +61,18 @@ namespace CustomizeMii
public static string TempUnpackIconBrlytPath = Path.GetTempPath() + "CustomizeMii_Temp\\XXX\\Unpack\\00000000.app_OUT\\meta\\icon.bin_OUT\\arc\\blyt\\";
public static string TempUnpackBannerBrlanPath = Path.GetTempPath() + "CustomizeMii_Temp\\XXX\\Unpack\\00000000.app_OUT\\meta\\banner.bin_OUT\\arc\\anim\\";
public static string TempUnpackIconBrlanPath = Path.GetTempPath() + "CustomizeMii_Temp\\XXX\\Unpack\\00000000.app_OUT\\meta\\icon.bin_OUT\\arc\\anim\\";
public static string[] ButtonTexts = new string[] { "Image", "Create WAD!", "Fire!", "Go Go Go!", "Let's do it!", "What are you waitin' for?", "I want my Channel!", "Houston, We've Got a Problem!", "Error, please contact anyone!", "Isn't she sweet?", "Is that milk?", "In your face!", "_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_", "Take me to a higher place!", "What's goin' on?", "I'm a Button!", "Click!", "Today's date is " + DateTime.Now.ToShortDateString(), "Launch Time: " + DateTime.Now.ToLongTimeString(), string.Format("My name is {0}", Environment.UserName) };
//public static string[] ButtonTexts = new string[] { "Create WAD!", "Fire!", "Go Go Go!", "Let's do it!", "What are you waitin' for?", "I want my Channel!", "Houston, We've Got a Problem!", "Error, please contact anyone!", "Isn't she sweet?", "Is that milk?", "In your face!", "_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_", "Take me to a higher place!", "What's goin' on?", "I'm a Button!", "Click!", "Today's date is " + DateTime.Now.ToShortDateString(), "Launch Time: " + DateTime.Now.ToLongTimeString(), string.Format("My name is {0}", Environment.UserName) };
public static string[] SourceWadUrls = new string[] { "StaticBase.wad", "MPlayer_CE_Short.wad", "MPlayer_CE_Long.wad", "Snes9xGX.wad", "FCE_Ultra_wilsoff.wad", "FCE_Ultra_Leathl.wad", "Wii64.wad", "WiiSX_Full.wad", "WiiSX_Retro.wad", "WADder_Base_1.wad", "WADder_Base_2.wad", "WADder_Base_3.wad", "UniiLoader.wad", "Backup_Channel.wad" };
public static string[] SourceWadPreviewUrls = new string[] { "http://www.youtube.com/watch?v=pFNKldTYQq0", "http://www.youtube.com/watch?v=Up1RZebUc_U", "http://www.youtube.com/watch?v=Up1RZebUc_U", "http://www.youtube.com/watch?v=P-Mxd6DMvFY", "http://www.youtube.com/watch?v=wrbrg-DH_h4", "http://www.youtube.com/watch?v=MfiVbQaiXw8", "http://www.youtube.com/watch?v=krCQ2J7ZH8Y", "http://www.youtube.com/watch?v=rZC1DKUM6QI", "http://www.youtube.com/watch?v=Uiy8w-bp1kI", "http://www.youtube.com/watch?v=BbSYCSI8tz8", "http://www.youtube.com/watch?v=PIFZevHQ8lQ", "http://www.youtube.com/watch?v=OIhvDNjphhc", "http://www.youtube.com/watch?v=KLcncEArQLY&NR=1", "http://www.youtube.com/watch?v=xE_EgdCRV1I" };
private string BannerTplPath = string.Empty;
private string IconTplPath = string.Empty;
public static string BannerReplace = string.Empty;
public static string IconReplace = string.Empty;
public static string BannerTplPath = string.Empty;
public static string IconTplPath = string.Empty;
private string SourceWad = string.Empty;
private string BannerBrlytPath = string.Empty;
private string IconBrlytPath = string.Empty;
private string BannerBrlanPath = string.Empty;
private string IconBrlanPath = string.Empty;
private string BannerReplace = string.Empty;
private string IconReplace = string.Empty;
private string SoundReplace = string.Empty;
private bool BrlytChanged = false;
private bool BrlanChanged = false;
@ -83,8 +87,10 @@ namespace CustomizeMii
private Forwarder.Complex ComplexForwarder = new Forwarder.Complex();
private delegate void BoxInvoker(string message);
private delegate void SetTextInvoker(string text, TextBox tb);
double separatorBtn;
Timer tmrCredits = new Timer();
private double separatorBtn;
private Timer tmrCredits = new Timer();
private ToolTip tTip = new ToolTip();
#endregion
public CustomizeMii_Main()
{
@ -176,15 +182,6 @@ namespace CustomizeMii
#endif
}
void rtbInstructions_LinkClicked(object sender, LinkClickedEventArgs e)
{
try
{
Process.Start(e.LinkText);
}
catch (Exception ex) { ErrorBox(ex.Message); }
}
private void SetForwardMiiLabel()
{
try
@ -276,38 +273,37 @@ namespace CustomizeMii
private void SetToolTips()
{
ToolTip TTip = new ToolTip();
TTip.SetToolTip(btnCreateWad, "Save WAD or send it directly to the Wii...");
TTip.SetToolTip(btnBrowseSource, "Browse for a WAD that is used as a Base...");
TTip.SetToolTip(btnLoadBaseWad, "Load the selected Base WAD...");
TTip.SetToolTip(btnPreviewBaseWad, "Preview the selected Base WAD, a Browserwindow will be opened...");
TTip.SetToolTip(btnSaveBaseWad, "Download and save the selected Base WAD to your HDD...");
TTip.SetToolTip(btnBrowseReplace, "Browse for a Banner / Icon / Sound to use instead of the one within the Base WAD...\nWAD's, 00000000.app's and banner.bin's / icon.bin's / sound.bin's can be loaded...");
TTip.SetToolTip(btnClearReplace, "Clear the replaced Banner / Icon / Sound and use the one within the Base WAD...");
TTip.SetToolTip(btnBrowseDol, "Browse for a DOL file that will be inserted into the WAD\nor choose the DOL form the source WAD to switch the NAND Loader...");
TTip.SetToolTip(btnBrowseSound, "Browse for a sound that will be inserted into the WAD\nor convert a sound to BNS format...");
TTip.SetToolTip(btnAddBanner, "Add an image or TPL to the Banner...");
TTip.SetToolTip(btnAddIcon, "Add an image or TPL to the Icon...");
TTip.SetToolTip(btnDeleteBanner, "Delete the selected TPL...\nRequired TPLs can't be deleted...");
TTip.SetToolTip(btnDeleteIcon, "Delete the selected TPL...\nRequired TPLs can't be deleted...");
TTip.SetToolTip(btnReplaceBanner, "Replace the selected TPL with any image...\nThe image wil be stretched to fit the size of the TPL...");
TTip.SetToolTip(btnReplaceIcon, "Replace the selected TPL with any image...\nThe image wil be stretched to fit the size of the TPL...");
TTip.SetToolTip(btnExtractBanner, "Extract the selected TPL as an image...");
TTip.SetToolTip(btnExtractIcon, "Extract the selected TPL as an image...");
TTip.SetToolTip(btnPreviewBanner, "Preview the selected TPL...");
TTip.SetToolTip(btnPreviewIcon, "Preview the selected TPL...");
TTip.SetToolTip(btnBrlytReplace, "Replace the selected brlyt with any other...\nThis is for advanced users only!");
TTip.SetToolTip(btnBrlytExtract, "Extract the selected brlyt...");
TTip.SetToolTip(btnBrlytListTpls, "List the TPLs required by the selected brlyt...");
TTip.SetToolTip(btnBrlanAdd, "Add a brlan file...\nThis is for advanced users only!");
TTip.SetToolTip(btnBrlanDelete, "Delete the selected brlan file...\nThis is for advanced users only!");
TTip.SetToolTip(btnBrlanReplace, "Replace the selected brlan file...\nThis is for advanced users only!");
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(btnCreateWad, "Create and save the WAD or send it directly to the Wii...\nBe sure the Homebrew Channel is running and connected if you want to send the WAD...");
tTip.SetToolTip(btnBrowseSource, "Browse for a WAD that is used as a Base...");
tTip.SetToolTip(btnLoadBaseWad, "Load the selected Base WAD...");
tTip.SetToolTip(btnPreviewBaseWad, "Preview the selected Base WAD, a Browserwindow will be opened...");
tTip.SetToolTip(btnSaveBaseWad, "Download and save the selected Base WAD to your HDD...");
tTip.SetToolTip(btnBrowseReplace, "Browse for a Banner / Icon / Sound to use instead of the one within the Base WAD...\nWAD's, 00000000.app's and banner.bin's / icon.bin's / sound.bin's can be loaded...");
//TTip.SetToolTip(btnClearReplace, "Clear the replaced Banner / Icon / Sound and use the one within the Base WAD...");
tTip.SetToolTip(btnBrowseDol, "Browse for a DOL file that will be inserted into the WAD\nor choose the DOL form the source WAD to switch the NAND Loader...");
tTip.SetToolTip(btnBrowseSound, "Browse for a sound that will be inserted into the WAD\nor convert a sound to BNS format...");
tTip.SetToolTip(btnAddBanner, "Add an image or TPL to the Banner...");
tTip.SetToolTip(btnAddIcon, "Add an image or TPL to the Icon...");
tTip.SetToolTip(btnDeleteBanner, "Delete the selected TPL...\nRequired TPLs can't be deleted...");
tTip.SetToolTip(btnDeleteIcon, "Delete the selected TPL...\nRequired TPLs can't be deleted...");
tTip.SetToolTip(btnReplaceBanner, "Replace the selected TPL with any image...\nThe image wil be stretched to fit the size of the TPL...");
tTip.SetToolTip(btnReplaceIcon, "Replace the selected TPL with any image...\nThe image wil be stretched to fit the size of the TPL...");
tTip.SetToolTip(btnExtractBanner, "Extract the selected TPL as an image...");
tTip.SetToolTip(btnExtractIcon, "Extract the selected TPL as an image...");
tTip.SetToolTip(btnPreviewBanner, "Preview the selected TPL...");
tTip.SetToolTip(btnPreviewIcon, "Preview the selected TPL...");
tTip.SetToolTip(btnBrlytReplace, "Replace the selected brlyt with any other...\nThis is for advanced users only!");
tTip.SetToolTip(btnBrlytExtract, "Extract the selected brlyt...");
tTip.SetToolTip(btnBrlytListTpls, "List the TPLs required by the selected brlyt...");
tTip.SetToolTip(btnBrlanAdd, "Add a brlan file...\nThis is for advanced users only!");
tTip.SetToolTip(btnBrlanDelete, "Delete the selected brlan file...\nThis is for advanced users only!");
tTip.SetToolTip(btnBrlanReplace, "Replace the selected brlan file...\nThis is for advanced users only!");
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(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...");
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...");
}
private bool CheckForForwardMii()
@ -318,6 +314,15 @@ namespace CustomizeMii
return false;
}
void rtbInstructions_LinkClicked(object sender, LinkClickedEventArgs e)
{
try
{
Process.Start(e.LinkText);
}
catch (Exception ex) { ErrorBox(ex.Message); }
}
#if !Mono
private bool CheckDevKit()
{
@ -359,34 +364,28 @@ namespace CustomizeMii
private void SetButtonText()
{
//Random Randomizer = new Random();
//btnCreateWad.Text = ButtonTexts[Randomizer.Next(0, ButtonTexts.Length - 1)];
//if (btnCreateWad.Text == "Image")
//{
// btnCreateWad.Text = string.Empty;
// btnCreateWad.Image = Properties.Resources.btnCreateWad;
//}
btnCreateWad.Text = string.Empty;
Image tmpImg = new Bitmap(btnCreateWad.Width, btnCreateWad.Height);
Graphics gImg = Graphics.FromImage(tmpImg);
using (Graphics gImg = Graphics.FromImage(tmpImg))
{
gImg.Clear(Color.Transparent);
gImg.Clear(Color.Transparent);
separatorBtn = btnCreateWad.Width * 0.5;
separatorBtn = btnCreateWad.Width * 0.5;
gImg.DrawLine(Pens.Gray, new Point((int)separatorBtn, 0), new Point((int)separatorBtn, btnCreateWad.Height));
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));
string sSend = "Send";
string sSave = "Save";
Image tmpCreate = Properties.Resources.btnCreate;
Image tmpSend = Properties.Resources.btnSend;
gImg.DrawImage(ResizeImage(tmpCreate, tmpCreate.Width, tmpCreate.Height), new Point(280, 0));
gImg.DrawImage(ResizeImage(tmpSend, tmpSend.Width, tmpSend.Height), new Point(55, 0));
gImg.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixelGridFit;
gImg.DrawString(sSend, btnCreateWad.Font, Brushes.Black, new PointF(95, 10));
gImg.DrawString(sSave, btnCreateWad.Font, Brushes.Black, new PointF(320, 10));
btnCreateWad.Image = tmpImg;
btnCreateWad.Image = tmpImg;
}
}
private void ErrorBox(string message)
@ -1182,126 +1181,142 @@ namespace CustomizeMii
}
}
private void btnBrowseReplace_Click(object sender, EventArgs e)
private void tbReplace_TextChanged(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(tbSourceWad.Text))
if (string.IsNullOrEmpty(tbReplace.Text))
{
if (pbProgress.Value == 100)
{
if (cmbReplace.SelectedIndex == 2) //sound
{
try
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "Wii Channels|*.wad|00000000.app|00000000.app|sound.bin|sound.bin|All|*.wad;00000000.app;sound.bin";
ofd.FilterIndex = 4;
if (ofd.ShowDialog() == DialogResult.OK)
{
if (ofd.FileName != tbSourceWad.Text)
{
SoundReplace = ofd.FileName;
SetText(tbReplace, SoundReplace);
BackgroundWorker bwSoundReplace = new BackgroundWorker();
bwSoundReplace.DoWork += new DoWorkEventHandler(bwSoundReplace_DoWork);
bwSoundReplace.ProgressChanged += new ProgressChangedEventHandler(bwSoundReplace_ProgressChanged);
bwSoundReplace.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bwSoundReplace_RunWorkerCompleted);
bwSoundReplace.WorkerReportsProgress = true;
bwSoundReplace.RunWorkerAsync(ofd.FileName);
}
}
}
catch (Exception ex)
{
SoundReplace = string.Empty;
SetText(tbReplace, SoundReplace);
ErrorBox(ex.Message);
}
}
else if (cmbReplace.SelectedIndex == 1) //icon
{
try
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "Wii Channels|*.wad|00000000.app|00000000.app|icon.bin|icon.bin|All|*.wad;00000000.app;icon.bin";
ofd.FilterIndex = 4;
if (ofd.ShowDialog() == DialogResult.OK)
{
if (ofd.FileName != tbSourceWad.Text)
{
IconReplace = ofd.FileName;
SetText(tbReplace, IconReplace);
BackgroundWorker bwIconReplace = new BackgroundWorker();
bwIconReplace.DoWork += new DoWorkEventHandler(bwIconReplace_DoWork);
bwIconReplace.ProgressChanged += new ProgressChangedEventHandler(bwIconReplace_ProgressChanged);
bwIconReplace.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bwIconReplace_RunWorkerCompleted);
bwIconReplace.WorkerReportsProgress = true;
bwIconReplace.RunWorkerAsync(ofd.FileName);
}
}
}
catch (Exception ex)
{
IconReplace = string.Empty;
SetText(tbReplace, IconReplace);
ErrorBox(ex.Message);
}
}
else //banner
{
try
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "Wii Channels|*.wad|00000000.app|00000000.app|banner.bin|banner.bin|All|*.wad;00000000.app;banner.bin";
ofd.FilterIndex = 4;
if (ofd.ShowDialog() == DialogResult.OK)
{
if (ofd.FileName != tbSourceWad.Text)
{
BannerReplace = ofd.FileName;
SetText(tbReplace, BannerReplace);
BackgroundWorker bwBannerReplace = new BackgroundWorker();
bwBannerReplace.DoWork += new DoWorkEventHandler(bwBannerReplace_DoWork);
bwBannerReplace.ProgressChanged += new ProgressChangedEventHandler(bwBannerReplace_ProgressChanged);
bwBannerReplace.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bwBannerReplace_RunWorkerCompleted);
bwBannerReplace.WorkerReportsProgress = true;
bwBannerReplace.RunWorkerAsync(ofd.FileName);
}
}
}
catch (Exception ex)
{
BannerReplace = string.Empty;
SetText(tbReplace, BannerReplace);
ErrorBox(ex.Message);
}
}
}
btnBrowseReplace.Text = "Browse...";
tTip.SetToolTip(btnBrowseReplace, "Browse for a Banner / Icon / Sound to use instead of the one within the Base WAD...\nWAD's, 00000000.app's and banner.bin's / icon.bin's / sound.bin's can be loaded...");
}
else
{
btnBrowseReplace.Text = "Clear";
tTip.SetToolTip(btnBrowseReplace, "Clear the replaced Banner / Icon / Sound and use the one within the Base WAD...");
}
}
private void btnClearReplace_Click(object sender, EventArgs e)
private void btnBrowseReplace_Click(object sender, EventArgs e)
{
if (cmbReplace.SelectedIndex == 2) //sound
if (btnBrowseReplace.Text == "Clear")
{
SoundReplace = string.Empty;
SetText(tbReplace, SoundReplace);
if (File.Exists(TempSoundPath)) File.Delete(TempSoundPath);
SetText(tbSound, string.Empty);
if (cmbReplace.SelectedIndex == 2) //sound
{
SoundReplace = string.Empty;
SetText(tbReplace, SoundReplace);
if (File.Exists(TempSoundPath)) File.Delete(TempSoundPath);
SetText(tbSound, string.Empty);
}
else if (cmbReplace.SelectedIndex == 1) //icon
{
IconReplace = string.Empty;
SetText(tbReplace, IconReplace);
if (Directory.Exists(TempIconPath)) Directory.Delete(TempIconPath, true);
}
else //banner
{
BannerReplace = string.Empty;
SetText(tbReplace, BannerReplace);
if (Directory.Exists(TempBannerPath)) Directory.Delete(TempBannerPath, true);
}
}
else if (cmbReplace.SelectedIndex == 1) //icon
else
{
IconReplace = string.Empty;
SetText(tbReplace, IconReplace);
if (Directory.Exists(TempIconPath)) Directory.Delete(TempIconPath, true);
}
else //banner
{
BannerReplace = string.Empty;
SetText(tbReplace, BannerReplace);
if (Directory.Exists(TempBannerPath)) Directory.Delete(TempBannerPath, true);
if (!string.IsNullOrEmpty(tbSourceWad.Text))
{
if (pbProgress.Value == 100)
{
if (cmbReplace.SelectedIndex == 2) //sound
{
try
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "Wii Channels|*.wad|00000000.app|00000000.app|sound.bin|sound.bin|All|*.wad;00000000.app;sound.bin";
ofd.FilterIndex = 4;
if (ofd.ShowDialog() == DialogResult.OK)
{
if (ofd.FileName != tbSourceWad.Text)
{
SoundReplace = ofd.FileName;
SetText(tbReplace, SoundReplace);
BackgroundWorker bwSoundReplace = new BackgroundWorker();
bwSoundReplace.DoWork += new DoWorkEventHandler(bwSoundReplace_DoWork);
bwSoundReplace.ProgressChanged += new ProgressChangedEventHandler(bwSoundReplace_ProgressChanged);
bwSoundReplace.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bwSoundReplace_RunWorkerCompleted);
bwSoundReplace.WorkerReportsProgress = true;
bwSoundReplace.RunWorkerAsync(ofd.FileName);
}
}
}
catch (Exception ex)
{
SoundReplace = string.Empty;
SetText(tbReplace, SoundReplace);
ErrorBox(ex.Message);
}
}
else if (cmbReplace.SelectedIndex == 1) //icon
{
try
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "Wii Channels|*.wad|00000000.app|00000000.app|icon.bin|icon.bin|All|*.wad;00000000.app;icon.bin";
ofd.FilterIndex = 4;
if (ofd.ShowDialog() == DialogResult.OK)
{
if (ofd.FileName != tbSourceWad.Text)
{
IconReplace = ofd.FileName;
SetText(tbReplace, IconReplace);
BackgroundWorker bwIconReplace = new BackgroundWorker();
bwIconReplace.DoWork += new DoWorkEventHandler(bwIconReplace_DoWork);
bwIconReplace.ProgressChanged += new ProgressChangedEventHandler(bwIconReplace_ProgressChanged);
bwIconReplace.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bwIconReplace_RunWorkerCompleted);
bwIconReplace.WorkerReportsProgress = true;
bwIconReplace.RunWorkerAsync(ofd.FileName);
}
}
}
catch (Exception ex)
{
IconReplace = string.Empty;
SetText(tbReplace, IconReplace);
ErrorBox(ex.Message);
}
}
else //banner
{
try
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "Wii Channels|*.wad|00000000.app|00000000.app|banner.bin|banner.bin|All|*.wad;00000000.app;banner.bin";
ofd.FilterIndex = 4;
if (ofd.ShowDialog() == DialogResult.OK)
{
if (ofd.FileName != tbSourceWad.Text)
{
BannerReplace = ofd.FileName;
SetText(tbReplace, BannerReplace);
BackgroundWorker bwBannerReplace = new BackgroundWorker();
bwBannerReplace.DoWork += new DoWorkEventHandler(bwBannerReplace_DoWork);
bwBannerReplace.ProgressChanged += new ProgressChangedEventHandler(bwBannerReplace_ProgressChanged);
bwBannerReplace.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bwBannerReplace_RunWorkerCompleted);
bwBannerReplace.WorkerReportsProgress = true;
bwBannerReplace.RunWorkerAsync(ofd.FileName);
}
}
}
catch (Exception ex)
{
BannerReplace = string.Empty;
SetText(tbReplace, BannerReplace);
ErrorBox(ex.Message);
}
}
}
}
}
}
@ -1556,19 +1571,23 @@ namespace CustomizeMii
{
try
{
string Tpl = BannerTplPath + lbxBannerTpls.SelectedItem.ToString().Replace(" (Transparent)", string.Empty);
Image Img = Wii.TPL.ConvertFromTPL(Tpl);
//string Tpl = BannerTplPath + lbxBannerTpls.SelectedItem.ToString().Replace(" (Transparent)", string.Empty);
//Image Img = Wii.TPL.ConvertFromTPL(Tpl);
//CustomizeMii_Preview pvw = new CustomizeMii_Preview();
//if (Img.Width > 200) pvw.Width = Img.Width + 50;
//else pvw.Width = 250;
//if (Img.Height > 200) pvw.Height = Img.Height + 50;
//else pvw.Height = 250;
//pvw.pbImage.Image = Img;
//pvw.Text = string.Format("CustomizeMii - Preview ({0} x {1})", Img.Width, Img.Height);
//pvw.ShowDialog();
CustomizeMii_Preview pvw = new CustomizeMii_Preview();
if (Img.Width > 200) pvw.Width = Img.Width + 50;
else pvw.Width = 250;
if (Img.Height > 200) pvw.Height = Img.Height + 50;
else pvw.Height = 250;
pvw.pbImage.Image = Img;
pvw.Text = string.Format("CustomizeMii - Preview ({0} x {1})", Img.Width, Img.Height);
pvw.startTPL = lbxBannerTpls.SelectedItem.ToString().Replace(" (Transparent)", string.Empty);
pvw.ShowDialog();
}
catch (Exception ex)
@ -1695,19 +1714,24 @@ namespace CustomizeMii
{
try
{
string Tpl = IconTplPath + lbxIconTpls.SelectedItem.ToString().Replace(" (Transparent)", string.Empty);
Image Img = Wii.TPL.ConvertFromTPL(Tpl);
//string Tpl = IconTplPath + lbxIconTpls.SelectedItem.ToString().Replace(" (Transparent)", string.Empty);
//Image Img = Wii.TPL.ConvertFromTPL(Tpl);
//CustomizeMii_Preview pvw = new CustomizeMii_Preview();
//if (Img.Width > 200) pvw.Width = Img.Width + 50;
//else pvw.Width = 250;
//if (Img.Height > 200) pvw.Height = Img.Height + 50;
//else pvw.Height = 250;
//pvw.pbImage.Image = Img;
//pvw.Text = string.Format("CustomizeMii - Preview ({0} x {1})", Img.Width, Img.Height);
//pvw.ShowDialog();
CustomizeMii_Preview pvw = new CustomizeMii_Preview();
if (Img.Width > 200) pvw.Width = Img.Width + 50;
else pvw.Width = 250;
if (Img.Height > 200) pvw.Height = Img.Height + 50;
else pvw.Height = 250;
pvw.pbImage.Image = Img;
pvw.Text = string.Format("CustomizeMii - Preview ({0} x {1})", Img.Width, Img.Height);
pvw.startIcon = true;
pvw.startTPL = lbxIconTpls.SelectedItem.ToString().Replace(" (Transparent)", string.Empty);
pvw.ShowDialog();
}
catch (Exception ex)

View File

@ -1,12 +1,12 @@
/* This file is part of CustomizeMii
/* This file is part of ShowMiiWads
* Copyright (C) 2009 Leathl
*
* CustomizeMii is free software: you can redistribute it and/or
* ShowMiiWads 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
* ShowMiiWads 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.
@ -14,7 +14,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace CustomizeMii
{
partial class CustomizeMii_Preview
@ -45,39 +45,249 @@ namespace CustomizeMii
/// </summary>
private void InitializeComponent()
{
this.pbImage = new System.Windows.Forms.PictureBox();
((System.ComponentModel.ISupportInitialize)(this.pbImage)).BeginInit();
this.components = new System.ComponentModel.Container();
this.Panel = new System.Windows.Forms.Panel();
this.btnClose = new System.Windows.Forms.Button();
this.cbIcon = new System.Windows.Forms.ComboBox();
this.lbIcon = new System.Windows.Forms.Label();
this.lbBanner = new System.Windows.Forms.Label();
this.cbBanner = new System.Windows.Forms.ComboBox();
this.panel1 = new System.Windows.Forms.Panel();
this.lbFormat = new System.Windows.Forms.Label();
this.lbFormatText = new System.Windows.Forms.Label();
this.lbSize = new System.Windows.Forms.Label();
this.lbSizeText = new System.Windows.Forms.Label();
this.pbPic = new System.Windows.Forms.PictureBox();
this.btnReplace = new System.Windows.Forms.Button();
this.cmFormat = new System.Windows.Forms.ContextMenuStrip(this.components);
this.cmRGBA8 = new System.Windows.Forms.ToolStripMenuItem();
this.cmRGB565 = new System.Windows.Forms.ToolStripMenuItem();
this.cmRGB5A3 = new System.Windows.Forms.ToolStripMenuItem();
this.Panel.SuspendLayout();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pbPic)).BeginInit();
this.cmFormat.SuspendLayout();
this.SuspendLayout();
//
// pbImage
// Panel
//
this.pbImage.Dock = System.Windows.Forms.DockStyle.Fill;
this.pbImage.Location = new System.Drawing.Point(0, 0);
this.pbImage.Name = "pbImage";
this.pbImage.Size = new System.Drawing.Size(194, 176);
this.pbImage.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.pbImage.TabIndex = 0;
this.pbImage.TabStop = false;
this.Panel.Controls.Add(this.btnReplace);
this.Panel.Controls.Add(this.btnClose);
this.Panel.Controls.Add(this.cbIcon);
this.Panel.Controls.Add(this.lbIcon);
this.Panel.Controls.Add(this.lbBanner);
this.Panel.Controls.Add(this.cbBanner);
this.Panel.Dock = System.Windows.Forms.DockStyle.Bottom;
this.Panel.Location = new System.Drawing.Point(0, 434);
this.Panel.Name = "Panel";
this.Panel.Size = new System.Drawing.Size(817, 28);
this.Panel.TabIndex = 0;
//
// btnClose
//
this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnClose.Location = new System.Drawing.Point(670, 4);
this.btnClose.Name = "btnClose";
this.btnClose.Size = new System.Drawing.Size(137, 21);
this.btnClose.TabIndex = 3;
this.btnClose.Text = "Close";
this.btnClose.UseVisualStyleBackColor = true;
this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
//
// cbIcon
//
this.cbIcon.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.cbIcon.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbIcon.FormattingEnabled = true;
this.cbIcon.Location = new System.Drawing.Point(239, 4);
this.cbIcon.MaxDropDownItems = 20;
this.cbIcon.Name = "cbIcon";
this.cbIcon.Size = new System.Drawing.Size(121, 21);
this.cbIcon.TabIndex = 1;
this.cbIcon.SelectedIndexChanged += new System.EventHandler(this.cbIcon_SelectedIndexChanged);
//
// lbIcon
//
this.lbIcon.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.lbIcon.AutoSize = true;
this.lbIcon.Location = new System.Drawing.Point(203, 7);
this.lbIcon.Name = "lbIcon";
this.lbIcon.Size = new System.Drawing.Size(31, 13);
this.lbIcon.TabIndex = 2;
this.lbIcon.Text = "Icon:";
//
// lbBanner
//
this.lbBanner.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.lbBanner.AutoSize = true;
this.lbBanner.Location = new System.Drawing.Point(3, 7);
this.lbBanner.Name = "lbBanner";
this.lbBanner.Size = new System.Drawing.Size(44, 13);
this.lbBanner.TabIndex = 1;
this.lbBanner.Text = "Banner:";
//
// cbBanner
//
this.cbBanner.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.cbBanner.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbBanner.FormattingEnabled = true;
this.cbBanner.Location = new System.Drawing.Point(51, 4);
this.cbBanner.MaxDropDownItems = 20;
this.cbBanner.Name = "cbBanner";
this.cbBanner.Size = new System.Drawing.Size(121, 21);
this.cbBanner.TabIndex = 0;
this.cbBanner.SelectedIndexChanged += new System.EventHandler(this.cbBanner_SelectedIndexChanged);
//
// panel1
//
this.panel1.Controls.Add(this.lbFormat);
this.panel1.Controls.Add(this.lbFormatText);
this.panel1.Controls.Add(this.lbSize);
this.panel1.Controls.Add(this.lbSizeText);
this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(817, 22);
this.panel1.TabIndex = 2;
//
// lbFormat
//
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.Name = "lbFormat";
this.lbFormat.Size = new System.Drawing.Size(43, 13);
this.lbFormat.TabIndex = 3;
this.lbFormat.Text = "RGBA8";
//
// 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.Name = "lbFormatText";
this.lbFormatText.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.lbFormatText.Size = new System.Drawing.Size(205, 13);
this.lbFormatText.TabIndex = 2;
this.lbFormatText.Text = "Texture Format:";
this.lbFormatText.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// lbSize
//
this.lbSize.AutoSize = true;
this.lbSize.Location = new System.Drawing.Point(39, 5);
this.lbSize.Name = "lbSize";
this.lbSize.Size = new System.Drawing.Size(30, 13);
this.lbSize.TabIndex = 1;
this.lbSize.Text = "0 x 0";
//
// lbSizeText
//
this.lbSizeText.AutoSize = true;
this.lbSizeText.Location = new System.Drawing.Point(4, 5);
this.lbSizeText.Name = "lbSizeText";
this.lbSizeText.Size = new System.Drawing.Size(30, 13);
this.lbSizeText.TabIndex = 0;
this.lbSizeText.Text = "Size:";
//
// pbPic
//
this.pbPic.Dock = System.Windows.Forms.DockStyle.Fill;
this.pbPic.Location = new System.Drawing.Point(0, 22);
this.pbPic.Name = "pbPic";
this.pbPic.Size = new System.Drawing.Size(817, 412);
this.pbPic.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.pbPic.TabIndex = 3;
this.pbPic.TabStop = false;
//
// btnReplace
//
this.btnReplace.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnReplace.Location = new System.Drawing.Point(512, 4);
this.btnReplace.Name = "btnReplace";
this.btnReplace.Size = new System.Drawing.Size(137, 21);
this.btnReplace.TabIndex = 3;
this.btnReplace.Text = "Replace";
this.btnReplace.UseVisualStyleBackColor = true;
this.btnReplace.Click += new System.EventHandler(this.btnReplace_Click);
//
// cmFormat
//
this.cmFormat.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.cmRGBA8,
this.cmRGB565,
this.cmRGB5A3});
this.cmFormat.Name = "cmFormat";
this.cmFormat.Size = new System.Drawing.Size(234, 70);
//
// cmRGBA8
//
this.cmRGBA8.Name = "cmRGBA8";
this.cmRGBA8.Size = new System.Drawing.Size(233, 22);
this.cmRGBA8.Tag = "rgba8";
this.cmRGBA8.Text = "As RGBA8 (High Quality)";
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.Tag = "rgb565";
this.cmRGB565.Text = "As RGB565 (Moderate Quality)";
this.cmRGB565.Click += new System.EventHandler(this.cmFormat_Click);
//
// cmRGB5A3
//
this.cmRGB5A3.Name = "cmRGB5A3";
this.cmRGB5A3.Size = new System.Drawing.Size(233, 22);
this.cmRGB5A3.Tag = "rgb5a3";
this.cmRGB5A3.Text = "As RGB5A3 (Low Quality)";
this.cmRGB5A3.Click += new System.EventHandler(this.cmFormat_Click);
//
// CustomizeMii_Preview
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(194, 176);
this.Controls.Add(this.pbImage);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.MinimumSize = new System.Drawing.Size(200, 200);
this.CancelButton = this.btnClose;
this.ClientSize = new System.Drawing.Size(817, 462);
this.Controls.Add(this.pbPic);
this.Controls.Add(this.panel1);
this.Controls.Add(this.Panel);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.MinimumSize = new System.Drawing.Size(833, 500);
this.Name = "CustomizeMii_Preview";
this.Text = "CustomizeMii - Preview";
this.Load += new System.EventHandler(this.CustomizeMii_Preview_Load);
((System.ComponentModel.ISupportInitialize)(this.pbImage)).EndInit();
this.Text = "Preview";
this.Load += new System.EventHandler(this.Preview_Load);
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Preview_FormClosing);
this.Panel.ResumeLayout(false);
this.Panel.PerformLayout();
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pbPic)).EndInit();
this.cmFormat.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
public System.Windows.Forms.PictureBox pbImage;
private System.Windows.Forms.Panel Panel;
private System.Windows.Forms.Label lbIcon;
private System.Windows.Forms.Label lbBanner;
public System.Windows.Forms.ComboBox cbBanner;
public System.Windows.Forms.Button btnClose;
public System.Windows.Forms.ComboBox cbIcon;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.PictureBox pbPic;
private System.Windows.Forms.Label lbSize;
private System.Windows.Forms.Label lbFormat;
public System.Windows.Forms.Label lbSizeText;
public System.Windows.Forms.Label lbFormatText;
public System.Windows.Forms.Button btnReplace;
private System.Windows.Forms.ContextMenuStrip cmFormat;
private System.Windows.Forms.ToolStripMenuItem cmRGBA8;
private System.Windows.Forms.ToolStripMenuItem cmRGB565;
private System.Windows.Forms.ToolStripMenuItem cmRGB5A3;
}
}

View File

@ -14,27 +14,214 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.IO;
using System.Windows.Forms;
namespace CustomizeMii
{
public partial class CustomizeMii_Preview : Form
{
public string startTPL;
public bool startIcon = false;
public CustomizeMii_Preview()
{
InitializeComponent();
this.Icon = global::CustomizeMii.Properties.Resources.CustomizeMii;
}
private void CustomizeMii_Preview_Load(object sender, EventArgs e)
private void btnClose_Click(object sender, EventArgs e)
{
this.Close();
}
private void Preview_FormClosing(object sender, FormClosingEventArgs e)
{
cbBanner.Items.Clear();
cbIcon.Items.Clear();
}
private void Preview_Load(object sender, EventArgs e)
{
this.CenterToParent();
string[] bannerpics;
string[] iconpics;
if (string.IsNullOrEmpty(CustomizeMii_Main.BannerReplace))
bannerpics = Directory.GetFiles(CustomizeMii_Main.TempUnpackBannerTplPath, "*.tpl");
else bannerpics = Directory.GetFiles(CustomizeMii_Main.BannerTplPath, "*.tpl");
if (string.IsNullOrEmpty(CustomizeMii_Main.IconReplace))
iconpics = Directory.GetFiles(CustomizeMii_Main.TempUnpackIconTplPath, "*.tpl");
else iconpics = Directory.GetFiles(CustomizeMii_Main.IconTplPath, "*.tpl");
int startIndex = -1;
if (!startIcon)
{
for (int i = 0; i < bannerpics.Length; i++)
if (Path.GetFileName(bannerpics[i]) == startTPL)
startIndex = i;
}
else
{
for (int i = 0; i < iconpics.Length; i++)
if (Path.GetFileName(iconpics[i]) == startTPL)
startIndex = i;
}
foreach (string thispic in bannerpics)
{
string picname = thispic.Remove(0, thispic.LastIndexOf('\\') + 1);
picname = picname.Remove(picname.LastIndexOf('.'));
cbBanner.Items.Add((object)picname);
}
foreach (string thispic in iconpics)
{
string picname = thispic.Remove(0, thispic.LastIndexOf('\\') + 1);
picname = picname.Remove(picname.LastIndexOf('.'));
cbIcon.Items.Add((object)picname);
}
try
{
if (startIndex != -1)
if (!startIcon)
cbBanner.SelectedIndex = startIndex;
else
cbIcon.SelectedIndex = startIndex;
}
catch { }
if (cbBanner.SelectedIndex != -1) cbBanner.Select();
else if (cbIcon.SelectedIndex != -1) cbIcon.Select();
}
private void cbBanner_SelectedIndexChanged(object sender, EventArgs e)
{
if (cbBanner.SelectedIndex != -1)
{
byte[] tpl;
if (string.IsNullOrEmpty(CustomizeMii_Main.BannerReplace))
tpl = Wii.Tools.LoadFileToByteArray(CustomizeMii_Main.TempUnpackBannerTplPath + cbBanner.SelectedItem.ToString() + ".tpl");
else tpl = Wii.Tools.LoadFileToByteArray(CustomizeMii_Main.BannerTplPath + cbBanner.SelectedItem.ToString() + ".tpl");
lbSize.Text = Wii.TPL.GetTextureWidth(tpl).ToString() + " x " + Wii.TPL.GetTextureHeight(tpl).ToString();
lbFormat.Text = Wii.TPL.GetTextureFormatName(tpl);
Image tmpImg = Wii.TPL.ConvertFromTPL(tpl);
pbPic.Image = tmpImg;
cbIcon.SelectedIndex = -1;
}
}
private void cbIcon_SelectedIndexChanged(object sender, EventArgs e)
{
if (cbIcon.SelectedIndex != -1)
{
byte[] tpl;
if (string.IsNullOrEmpty(CustomizeMii_Main.IconReplace))
tpl = Wii.Tools.LoadFileToByteArray(CustomizeMii_Main.TempUnpackIconTplPath + cbIcon.SelectedItem.ToString() + ".tpl");
else tpl = Wii.Tools.LoadFileToByteArray(CustomizeMii_Main.IconTplPath + cbIcon.SelectedItem.ToString() + ".tpl");
lbSize.Text = Wii.TPL.GetTextureWidth(tpl).ToString() + " x " + Wii.TPL.GetTextureHeight(tpl).ToString();
lbFormat.Text = Wii.TPL.GetTextureFormatName(tpl);
Image tmpImg = Wii.TPL.ConvertFromTPL(tpl);
pbPic.Image = tmpImg;
cbBanner.SelectedIndex = -1;
}
}
private void cmSave_Click(object sender, EventArgs e)
{
SaveFileDialog sfd = new SaveFileDialog();
sfd.FileName = pbPic.ImageLocation.Remove(0, pbPic.ImageLocation.LastIndexOf('\\') + 1);
sfd.Filter = "PNG|*.png";
if (sfd.ShowDialog() == DialogResult.OK)
File.Copy(pbPic.ImageLocation, sfd.FileName);
}
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 btnReplace_Click(object sender, EventArgs e)
{
cmFormat.Show(MousePosition);
}
private void cmFormat_Click(object sender, EventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "PNG|*.png|JPG|*.jpg|GIF|*.gif|BMP|*.bmp|TPL|*.tpl|All|*.png;*.jpg;*.gif;*.bmp;*.tpl";
ofd.FilterIndex = 6;
if (ofd.ShowDialog() == DialogResult.OK)
{
try
{
string Tpl;
if (cbBanner.SelectedIndex != -1) { Tpl = CustomizeMii_Main.BannerTplPath + cbBanner.SelectedItem + ".tpl"; }
else { Tpl = CustomizeMii_Main.IconTplPath + cbIcon.SelectedItem + ".tpl"; }
byte[] TplArray = Wii.Tools.LoadFileToByteArray(Tpl);
Image Img;
if (!ofd.FileName.ToLower().EndsWith(".tpl")) Img = Image.FromFile(ofd.FileName);
else Img = Wii.TPL.ConvertFromTPL(ofd.FileName);
int TplFormat;
int X = Wii.TPL.GetTextureWidth(TplArray);
int Y = Wii.TPL.GetTextureHeight(TplArray);
if (X != Img.Width ||
Y != Img.Height)
{
Img = ResizeImage(Img, X, Y);
}
ToolStripMenuItem cmSender = sender as ToolStripMenuItem;
switch (cmSender.Tag.ToString().ToLower())
{
case "rgb565":
TplFormat = 4;
lbFormat.Text = "RGB565";
break;
case "rgb5a3":
TplFormat = 5;
lbFormat.Text = "RGB5A3";
break;
default:
TplFormat = 6;
lbFormat.Text = "RGBA8";
break;
}
Wii.TPL.ConvertToTPL(Img, Tpl, TplFormat);
pbPic.Image = Wii.TPL.ConvertFromTPL(Tpl);
if (cbBanner.SelectedIndex != -1) cbBanner.Select();
else if (cbIcon.SelectedIndex != -1) cbIcon.Select();
}
catch (Exception ex)
{ MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); }
}
}
}
}

View File

@ -117,4 +117,10 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="cmFormat.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>14, 7</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>36</value>
</metadata>
</root>

View File

@ -60,9 +60,16 @@ namespace CustomizeMii.Properties {
}
}
internal static System.Drawing.Bitmap btnCreateWad {
internal static System.Drawing.Bitmap btnCreate {
get {
object obj = ResourceManager.GetObject("btnCreateWad", resourceCulture);
object obj = ResourceManager.GetObject("btnCreate", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap btnSend {
get {
object obj = ResourceManager.GetObject("btnSend", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}

View File

@ -118,13 +118,16 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="btnCreateWad" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\btnCreateWad.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="CustomizeMii" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\CustomizeMii.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Instructions" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\resources\instructions.rtf;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
<data name="btnCreate" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\btnCreate.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="btnSend" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\btnSend.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View File

@ -10,7 +10,12 @@ Thanks to icefire / Xuzz for the basic idea of this Application!
Changelog:
Version 2.1
- Replaced the TPL preview window with the one from ShowMiiWads for easier handling
-
- Little improvements
Version 2.01
- Base WAD downloading works again
Version 2.0
- Added BNS conversion (Mono and Stereo, with and without loop)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB