CustomizeMii 2.3

git-svn-id: svn://localhost/Users/andi/Downloads/code/trunk@32 eddbe33b-e435-4246-ac25-f5eb65f9a13c
This commit is contained in:
leathl 2010-02-24 21:41:37 +00:00
parent d810cbdffc
commit 7b345b76e1
15 changed files with 702 additions and 508 deletions

View File

@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
//These classes are based on bns.py of the Wii.py Framework with improvements by me (Leathl)
//These classes are based on bns.py (by megazig) of the Wii.py Framework with improvements by me (Leathl)
//Thanks to Xuzz, SquidMan, megazig, Matt_P, Omega and The Lemon Man, the authors of Wii.py!
using System;

View File

@ -493,9 +493,11 @@ namespace CustomizeMii
bwLoadChannel.ReportProgress(90, "Gathering Information...");
string[] ChannelTitles = Wii.WadInfo.GetChannelTitles(WadFile);
string TitleID = Wii.WadInfo.GetTitleID(WadFile, 1);
string IosFlag = Wii.WadInfo.GetIosFlag(WadFile).Replace("IOS", string.Empty);
bool allLangs = true;
SetText(tbTitleID, TitleID);
SetText(tbStartupIos, IosFlag);
if (ChannelTitles[0] != ChannelTitles[1]) SetText(tbJapanese, ChannelTitles[0]);
else allLangs = false;
@ -509,6 +511,7 @@ namespace CustomizeMii
else allLangs = false;
if (ChannelTitles[6] != ChannelTitles[1]) SetText(tbDutch, ChannelTitles[6]);
else allLangs = false;
if (ChannelTitles[7] != ChannelTitles[1]) SetText(tbKorean, ChannelTitles[7]);
if (allLangs) SetText(tbEnglish, ChannelTitles[1]);
else SetText(tbAllLanguages, ChannelTitles[1]);
@ -843,7 +846,7 @@ namespace CustomizeMii
Wii.Tools.SaveFileFromByteArray(bannerbin, TempUnpackPath + "00000000.app_OUT\\meta\\banner.bin");
Directory.Delete(TempUnpackPath + "00000000.app_OUT\\meta\\banner.bin_OUT", true);
if (!string.IsNullOrEmpty(SoundReplace) || !string.IsNullOrEmpty(tbSound.Text))
if (!string.IsNullOrEmpty(SoundReplace) || !string.IsNullOrEmpty(wadInfo.sound))
{
bwCreateWad.ReportProgress(50, "Packing sound.bin...");
@ -852,20 +855,20 @@ namespace CustomizeMii
File.Delete(TempUnpackPath + "00000000.app_OUT\\meta\\sound.bin");
File.Copy(TempSoundPath, TempUnpackPath + "00000000.app_OUT\\meta\\sound.bin");
}
else if (!string.IsNullOrEmpty(tbSound.Text))
else if (!string.IsNullOrEmpty(wadInfo.sound))
{
if (tbSound.Text.EndsWith(".bns"))
{
Wii.Sound.BnsToSoundBin(tbSound.Text, TempUnpackPath + "00000000.app_OUT\\meta\\sound.bin", false);
Wii.Sound.BnsToSoundBin(wadInfo.sound, TempUnpackPath + "00000000.app_OUT\\meta\\sound.bin", false);
}
else if (tbSound.Text.StartsWith("BNS:"))
else if (wadInfo.sound.StartsWith("BNS:"))
{
Wii.Sound.BnsToSoundBin(TempBnsPath, TempUnpackPath + "00000000.app_OUT\\meta\\sound.bin", false);
}
else
{
string SoundFile = tbSound.Text;
if (tbSound.Text.EndsWith(".mp3")) SoundFile = TempWavePath;
string SoundFile = wadInfo.sound;
if (wadInfo.sound.EndsWith(".mp3")) SoundFile = TempWavePath;
Wii.Sound.WaveToSoundBin(SoundFile, TempUnpackPath + "00000000.app_OUT\\meta\\sound.bin", false);
}
@ -874,13 +877,13 @@ namespace CustomizeMii
bwCreateWad.ReportProgress(60, "Packing 00000000.app...");
int[] Sizes = new int[3];
string[] Titles = new string[] { tbJapanese.Text, tbEnglish.Text, tbGerman.Text, tbFrench.Text, tbSpanish.Text, tbItalian.Text, tbDutch.Text };
for (int i = 0; i < Titles.Length; i++)
if (string.IsNullOrEmpty(Titles[i])) Titles[i] = tbAllLanguages.Text;
for (int i = 0; i < wadInfo.titles.Length; i++)
if (string.IsNullOrEmpty(wadInfo.titles[i])) wadInfo.titles[i] = wadInfo.allLangTitle;
byte[] nullapp = Wii.U8.PackU8(TempUnpackPath + "00000000.app_OUT", out Sizes[0], out Sizes[1], out Sizes[2]);
nullapp = Wii.U8.AddHeaderIMET(nullapp, Titles, Sizes);
byte[] nullapp = Wii.U8.PackU8(TempUnpackPath + "00000000.app_OUT", out Sizes[0], out Sizes[1], out Sizes[2]);
nullapp = Wii.U8.AddHeaderIMET(nullapp, wadInfo.titles, Sizes);
Wii.Tools.SaveFileFromByteArray(nullapp, TempUnpackPath + "00000000.app");
Directory.Delete(TempUnpackPath + "00000000.app_OUT", true);
@ -888,7 +891,7 @@ namespace CustomizeMii
string[] tmdfile = Directory.GetFiles(TempUnpackPath, "*.tmd");
byte[] tmd = Wii.Tools.LoadFileToByteArray(tmdfile[0]);
if (!string.IsNullOrEmpty(tbDol.Text))
if (!string.IsNullOrEmpty(wadInfo.dol))
{
bwCreateWad.ReportProgress(80, "Inserting new DOL...");
string[] AppFiles = Directory.GetFiles(TempUnpackPath, "*.app");
@ -907,22 +910,22 @@ namespace CustomizeMii
}
}
if (tbDol.Text.StartsWith("Simple Forwarder:"))
if (wadInfo.dol.StartsWith("Simple Forwarder:"))
{
CreateForwarderSimple(TempUnpackPath + "\\00000002.app");
}
else if (tbDol.Text.StartsWith("Complex Forwarder"))
else if (wadInfo.dol.StartsWith("Complex Forwarder"))
{
bwCreateWad.ReportProgress(82, "Compiling Forwarder...");
CreateForwarderComplex(TempUnpackPath + "\\00000002.app");
}
else if (tbDol.Text == "Internal" || tbDol.Text.EndsWith(".wad"))
else if (wadInfo.dol == "Internal" || wadInfo.dol.EndsWith(".wad"))
{
File.Copy(TempDolPath, TempUnpackPath + "\\00000002.app");
}
else
{
File.Copy(tbDol.Text, TempUnpackPath + "\\00000002.app");
File.Copy(wadInfo.dol, TempUnpackPath + "\\00000002.app");
}
tmd = Wii.WadEdit.ChangeTmdBootIndex(tmd, 1);
@ -938,16 +941,16 @@ namespace CustomizeMii
}
}
if (tbDol.Text.StartsWith("Simple Forwarder:"))
if (wadInfo.dol.StartsWith("Simple Forwarder:"))
{
CreateForwarderSimple(TempUnpackPath + "\\00000001.app");
}
else if (tbDol.Text.StartsWith("Complex Forwarder"))
else if (wadInfo.dol.StartsWith("Complex Forwarder"))
{
bwCreateWad.ReportProgress(82, "Compiling Forwarder...");
CreateForwarderComplex(TempUnpackPath + "\\00000001.app");
}
else if (tbDol.Text == "Internal")
else if (wadInfo.dol == "Internal")
{
File.Copy(TempDolPath, TempUnpackPath + "\\00000001.app");
}
@ -980,10 +983,14 @@ namespace CustomizeMii
}
bwCreateWad.ReportProgress(85, "Updating TMD...");
Wii.WadEdit.ChangeIosFlag(tmdfile[0], wadInfo.requiredIos);
Wii.WadEdit.UpdateTmdContents(tmdfile[0]);
Wii.WadEdit.ChangeTitleID(tikfile[0], 0, tbTitleID.Text.ToUpper());
Wii.WadEdit.ChangeTitleID(tmdfile[0], 1, tbTitleID.Text.ToUpper());
if (!string.IsNullOrEmpty(wadInfo.titleId))
{
Wii.WadEdit.ChangeTitleID(tikfile[0], 0, wadInfo.titleId);
Wii.WadEdit.ChangeTitleID(tmdfile[0], 1, wadInfo.titleId);
}
bwCreateWad.ReportProgress(90, "Trucha Signing...");
Wii.WadEdit.TruchaSign(tmdfile[0], 1);

View File

@ -197,7 +197,7 @@ namespace CustomizeMii
this.rbFromAudioFile.Name = "rbFromAudioFile";
this.rbFromAudioFile.Size = new System.Drawing.Size(281, 17);
this.rbFromAudioFile.TabIndex = 0;
this.rbFromAudioFile.Text = "From Audio File (works only with pre-looped wave files)";
this.rbFromAudioFile.Text = "From Audio File (only works with pre-looped wave files)";
this.rbFromAudioFile.UseVisualStyleBackColor = true;
this.rbFromAudioFile.CheckedChanged += new System.EventHandler(this.rbSelectionChanged);
//
@ -396,6 +396,7 @@ namespace CustomizeMii
this.AcceptButton = this.btnConvert;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.Control;
this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(674, 230);
this.Controls.Add(this.gbPrelisten);

View File

@ -434,6 +434,7 @@ namespace CustomizeMii
this.AcceptButton = this.btnOK;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.Control;
this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(358, 383);
this.Controls.Add(this.tabPaths);

View File

@ -111,6 +111,7 @@ namespace CustomizeMii
this.AcceptButton = this.btnOK;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.Control;
this.CancelButton = this.btnExit;
this.ClientSize = new System.Drawing.Size(238, 92);
this.Controls.Add(this.cbElf);

View File

@ -64,6 +64,7 @@ namespace CustomizeMii
this.lbSource = new System.Windows.Forms.Label();
this.tabTitle = new System.Windows.Forms.TabPage();
this.llbTranslateChannel = new System.Windows.Forms.LinkLabel();
this.tbKorean = new System.Windows.Forms.TextBox();
this.tbItalian = new System.Windows.Forms.TextBox();
this.tbFrench = new System.Windows.Forms.TextBox();
this.tbJapanese = new System.Windows.Forms.TextBox();
@ -72,6 +73,7 @@ namespace CustomizeMii
this.tbGerman = new System.Windows.Forms.TextBox();
this.tbEnglish = new System.Windows.Forms.TextBox();
this.lbDutch = new System.Windows.Forms.Label();
this.lbKorean = new System.Windows.Forms.Label();
this.lbItalian = new System.Windows.Forms.Label();
this.lbSpanish = new System.Windows.Forms.Label();
this.lbFrench = new System.Windows.Forms.Label();
@ -92,12 +94,15 @@ namespace CustomizeMii
this.cmbNandLoader = new System.Windows.Forms.ComboBox();
this.btnBrowseDol = new System.Windows.Forms.Button();
this.tbDol = new System.Windows.Forms.TextBox();
this.tbStartupIos = new System.Windows.Forms.TextBox();
this.tbTitleID = new System.Windows.Forms.TextBox();
this.lbNewSound = new System.Windows.Forms.Label();
this.lbNandLoader = new System.Windows.Forms.Label();
this.lbNewDol = new System.Windows.Forms.Label();
this.lbStartupIos = new System.Windows.Forms.Label();
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();
@ -108,6 +113,7 @@ namespace CustomizeMii
this.btnReplaceBanner = new System.Windows.Forms.Button();
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();
@ -383,6 +389,7 @@ namespace CustomizeMii
// tabTitle
//
this.tabTitle.Controls.Add(this.llbTranslateChannel);
this.tabTitle.Controls.Add(this.tbKorean);
this.tabTitle.Controls.Add(this.tbItalian);
this.tabTitle.Controls.Add(this.tbFrench);
this.tabTitle.Controls.Add(this.tbJapanese);
@ -391,6 +398,7 @@ namespace CustomizeMii
this.tabTitle.Controls.Add(this.tbGerman);
this.tabTitle.Controls.Add(this.tbEnglish);
this.tabTitle.Controls.Add(this.lbDutch);
this.tabTitle.Controls.Add(this.lbKorean);
this.tabTitle.Controls.Add(this.lbItalian);
this.tabTitle.Controls.Add(this.lbSpanish);
this.tabTitle.Controls.Add(this.lbFrench);
@ -420,6 +428,14 @@ namespace CustomizeMii
this.llbTranslateChannel.Text = "Translate \"Channel\"";
this.llbTranslateChannel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.llbTranslateChannel_LinkClicked);
//
// tbKorean
//
this.tbKorean.Location = new System.Drawing.Point(301, 171);
this.tbKorean.MaxLength = 20;
this.tbKorean.Name = "tbKorean";
this.tbKorean.Size = new System.Drawing.Size(124, 20);
this.tbKorean.TabIndex = 16;
//
// tbItalian
//
this.tbItalian.Location = new System.Drawing.Point(301, 143);
@ -485,6 +501,15 @@ namespace CustomizeMii
this.lbDutch.TabIndex = 9;
this.lbDutch.Text = "Dutch:";
//
// lbKorean
//
this.lbKorean.AutoSize = true;
this.lbKorean.Location = new System.Drawing.Point(221, 174);
this.lbKorean.Name = "lbKorean";
this.lbKorean.Size = new System.Drawing.Size(44, 13);
this.lbKorean.TabIndex = 8;
this.lbKorean.Text = "Korean:";
//
// lbItalian
//
this.lbItalian.AutoSize = true;
@ -578,10 +603,12 @@ namespace CustomizeMii
this.tabOptions.Controls.Add(this.cmbNandLoader);
this.tabOptions.Controls.Add(this.btnBrowseDol);
this.tabOptions.Controls.Add(this.tbDol);
this.tabOptions.Controls.Add(this.tbStartupIos);
this.tabOptions.Controls.Add(this.tbTitleID);
this.tabOptions.Controls.Add(this.lbNewSound);
this.tabOptions.Controls.Add(this.lbNandLoader);
this.tabOptions.Controls.Add(this.lbNewDol);
this.tabOptions.Controls.Add(this.lbStartupIos);
this.tabOptions.Controls.Add(this.lbTitleID);
this.tabOptions.Location = new System.Drawing.Point(4, 22);
this.tabOptions.Name = "tabOptions";
@ -700,6 +727,16 @@ namespace CustomizeMii
this.tbDol.DragDrop += new System.Windows.Forms.DragEventHandler(this.tbDol_DragDrop);
this.tbDol.DragEnter += new System.Windows.Forms.DragEventHandler(this.tbDol_DragEnter);
//
// tbStartupIos
//
this.tbStartupIos.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
this.tbStartupIos.Location = new System.Drawing.Point(299, 49);
this.tbStartupIos.MaxLength = 4;
this.tbStartupIos.Name = "tbStartupIos";
this.tbStartupIos.Size = new System.Drawing.Size(55, 20);
this.tbStartupIos.TabIndex = 4;
this.tbStartupIos.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.tbStartupIos_KeyPress);
//
// tbTitleID
//
this.tbTitleID.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
@ -736,6 +773,15 @@ namespace CustomizeMii
this.lbNewDol.TabIndex = 1;
this.lbNewDol.Text = "New DOL:";
//
// lbStartupIos
//
this.lbStartupIos.AutoSize = true;
this.lbStartupIos.Location = new System.Drawing.Point(192, 52);
this.lbStartupIos.Name = "lbStartupIos";
this.lbStartupIos.Size = new System.Drawing.Size(65, 13);
this.lbStartupIos.TabIndex = 0;
this.lbStartupIos.Text = "Startup IOS:";
//
// lbTitleID
//
this.lbTitleID.AutoSize = true;
@ -747,6 +793,7 @@ namespace CustomizeMii
//
// tabBanner
//
this.tabBanner.Controls.Add(this.llbBannerMultiReplace);
this.tabBanner.Controls.Add(this.cbBannerMakeTransparent);
this.tabBanner.Controls.Add(this.cmbFormatBanner);
this.tabBanner.Controls.Add(this.lbFormatBanner);
@ -764,6 +811,17 @@ namespace CustomizeMii
this.tabBanner.Text = "Banner";
this.tabBanner.UseVisualStyleBackColor = true;
//
// llbBannerMultiReplace
//
this.llbBannerMultiReplace.AutoSize = true;
this.llbBannerMultiReplace.Location = new System.Drawing.Point(282, 190);
this.llbBannerMultiReplace.Name = "llbBannerMultiReplace";
this.llbBannerMultiReplace.Size = new System.Drawing.Size(72, 13);
this.llbBannerMultiReplace.TabIndex = 7;
this.llbBannerMultiReplace.TabStop = true;
this.llbBannerMultiReplace.Text = "Multi Replace";
this.llbBannerMultiReplace.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.llbMultiReplace_LinkClicked);
//
// cbBannerMakeTransparent
//
this.cbBannerMakeTransparent.AutoSize = true;
@ -870,6 +928,7 @@ namespace CustomizeMii
//
// tabIcon
//
this.tabIcon.Controls.Add(this.llbIconMultiReplace);
this.tabIcon.Controls.Add(this.cbIconMakeTransparent);
this.tabIcon.Controls.Add(this.cmbFormatIcon);
this.tabIcon.Controls.Add(this.lbFormatIcon);
@ -887,6 +946,17 @@ namespace CustomizeMii
this.tabIcon.Text = "Icon";
this.tabIcon.UseVisualStyleBackColor = true;
//
// llbIconMultiReplace
//
this.llbIconMultiReplace.AutoSize = true;
this.llbIconMultiReplace.Location = new System.Drawing.Point(282, 190);
this.llbIconMultiReplace.Name = "llbIconMultiReplace";
this.llbIconMultiReplace.Size = new System.Drawing.Size(72, 13);
this.llbIconMultiReplace.TabIndex = 13;
this.llbIconMultiReplace.TabStop = true;
this.llbIconMultiReplace.Text = "Multi Replace";
this.llbIconMultiReplace.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.llbMultiReplace_LinkClicked);
//
// cbIconMakeTransparent
//
this.cbIconMakeTransparent.AutoSize = true;
@ -1710,6 +1780,12 @@ namespace CustomizeMii
private System.Windows.Forms.ToolStripMenuItem cmExtractBrlan;
private System.Windows.Forms.ToolStripMenuItem cmExtractBothBrl;
private System.Windows.Forms.LinkLabel llbTranslateChannel;
private System.Windows.Forms.TextBox tbStartupIos;
private System.Windows.Forms.Label lbStartupIos;
private System.Windows.Forms.TextBox tbKorean;
private System.Windows.Forms.Label lbKorean;
private System.Windows.Forms.LinkLabel llbBannerMultiReplace;
private System.Windows.Forms.LinkLabel llbIconMultiReplace;
}
}

View File

@ -33,7 +33,7 @@ namespace CustomizeMii
public partial class CustomizeMii_Main : Form
{
#region Constants
const string version = "2.2"; //Hint for myself: Never use a char in the Version (UpdateCheck)!
const string version = "2.3"; //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
@ -92,26 +92,30 @@ namespace CustomizeMii
private void CustomizeMii_Main_Load(object sender, EventArgs e)
{
MethodInvoker Update = new MethodInvoker(UpdateCheck);
UpdatePaths();
Update.BeginInvoke(null, null);
#if !Mono
MethodInvoker FUpdate = new MethodInvoker(UpdateCheckForwardMii);
FUpdate.BeginInvoke(null, null);
this.Text = this.Text.Replace("X", version);
this.lbCreditVersion.Text = this.lbCreditVersion.Text.Replace("X", version);
CommonKeyCheck();
#endif
InitializeStartup();
#if Mono
this.Text = this.Text.Replace("X", version + " (Mono)");
this.lbCreditVersion.Text = this.lbCreditVersion.Text.Replace("X", version + " (Mono)");
Mono = true;
//TextBox.MaxLength is not implemented in Mono, so don't use it
for (int i = 0; i < tabControl.TabPages.Count; i++)
for(int j=0;j<tabControl.TabPages[i].Controls.Count;j++)
if (tabControl.TabPages[i].Controls[j] is TextBox) ((TextBox)tabControl.TabPages[i].Controls[j]).MaxLength = 32000;
#endif
if (File.Exists(Application.StartupPath + "\\CustomizeMiiInstaller.dll"))
this.lbCreditInstaller.Text = this.lbCreditInstaller.Text.Replace("X", GetInstallerVersion());
else this.lbCreditInstaller.Text = this.lbCreditInstaller.Text.Replace(" X", string.Empty);
MethodInvoker Update = new MethodInvoker(UpdateCheck);
Update.BeginInvoke(null, null);
UpdatePaths();
InitializeStartup();
}
private void CustomizeMii_Main_FormClosing(object sender, FormClosingEventArgs e)
@ -148,11 +152,6 @@ namespace CustomizeMii
private void InitializeStartup()
{
this.Text = this.Text.Replace("X", version);
this.lbCreditVersion.Text = this.lbCreditVersion.Text.Replace("X", version);
if (File.Exists(Application.StartupPath + "\\CustomizeMiiInstaller.dll"))
this.lbCreditInstaller.Text = this.lbCreditInstaller.Text.Replace("X", GetInstallerVersion());
else this.lbCreditInstaller.Text = this.lbCreditInstaller.Text.Replace(" X", string.Empty);
if (Directory.Exists(TempPath)) Directory.Delete(TempPath, true);
ProgressUpdate = new EventHandler(this.UpdateProgress);
btnBrowseSource.Text = "Browse...";
@ -224,12 +223,14 @@ namespace CustomizeMii
tbFrench.Text = string.Empty;
tbGerman.Text = string.Empty;
tbItalian.Text = string.Empty;
tbKorean.Text = string.Empty;
tbJapanese.Text = string.Empty;
tbReplace.Text = string.Empty;
tbSound.Text = string.Empty;
tbSourceWad.Text = string.Empty;
tbSpanish.Text = string.Empty;
tbTitleID.Text = string.Empty;
tbStartupIos.Text = string.Empty;
BannerReplace = string.Empty;
IconReplace = string.Empty;
@ -560,41 +561,6 @@ namespace CustomizeMii
{
return ForwardMii_Plugin.GetVersion();
}
private void UpdateCheckForwardMii()
{
if (File.Exists(Application.StartupPath + "\\ForwardMii.dll"))
{
if (CheckInet() == true)
{
try
{
string CurrentVersion = GetForwardMiiVersion();
if (!string.IsNullOrEmpty(CurrentVersion))
{
WebClient GetVersion = new WebClient();
string NewVersion = GetVersion.DownloadString("http://customizemii.googlecode.com/svn/forwardmii-version.txt");
int newVersion = Convert.ToInt32(NewVersion.Replace(".", string.Empty).Length == 2 ? (NewVersion.Replace(".", string.Empty) + "0") : NewVersion.Replace(".", string.Empty));
int thisVersion = Convert.ToInt32(CurrentVersion.Replace(".", string.Empty).Length == 2 ? (CurrentVersion.Replace(".", string.Empty) + "0") : CurrentVersion.Replace(".", string.Empty));
if (newVersion > thisVersion)
{
if (MessageBox.Show("Version " + NewVersion +
" of the ForwardMii-Plugin is available.\nDo you want the download page to be opened?",
"ForwardMii Update available", MessageBoxButtons.YesNo, MessageBoxIcon.Information) ==
DialogResult.Yes)
{
Process.Start("http://code.google.com/p/customizemii/downloads/list");
}
}
}
}
catch { }
}
}
}
#endif
private void llbSite_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
@ -895,7 +861,7 @@ namespace CustomizeMii
cbBannerMakeTransparent.Enabled = true;
cbBannerMakeTransparent.Checked = lbxBannerTpls.SelectedItem.ToString().EndsWith("(Transparent)");
string TplFile = BannerTplPath + lbxBannerTpls.SelectedItem.ToString().Replace(" (Transparent)", string.Empty);
string TplFile = BannerTplPath + lbxBannerTpls.SelectedItem.ToString().Remove(lbxBannerTpls.SelectedItem.ToString().IndexOf('(', 0) - 1);
int TplFormat = Wii.TPL.GetTextureFormat(TplFile);
switch (TplFormat)
@ -956,7 +922,7 @@ namespace CustomizeMii
cbIconMakeTransparent.Enabled = true;
cbIconMakeTransparent.Checked = lbxIconTpls.SelectedItem.ToString().EndsWith("(Transparent)");
string TplFile = IconTplPath + lbxIconTpls.SelectedItem.ToString().Replace(" (Transparent)", string.Empty);
string TplFile = IconTplPath + lbxIconTpls.SelectedItem.ToString().Remove(lbxIconTpls.SelectedItem.ToString().IndexOf('(', 0) - 1);
int TplFormat = Wii.TPL.GetTextureFormat(TplFile);
switch (TplFormat)
@ -1024,7 +990,7 @@ namespace CustomizeMii
{
try
{
string Tpl = BannerTplPath + lbxBannerTpls.SelectedItem.ToString().Replace(" (Transparent)", string.Empty);
string Tpl = BannerTplPath + lbxBannerTpls.SelectedItem.ToString().Remove(lbxBannerTpls.SelectedItem.ToString().IndexOf('(', 0) - 1);
byte[] TplArray = Wii.Tools.LoadFileToByteArray(Tpl);
Image Img;
@ -1085,7 +1051,7 @@ namespace CustomizeMii
{
if (lbxBannerTpls.SelectedIndex != -1)
{
string Tpl = BannerTplPath + lbxBannerTpls.SelectedItem.ToString().Replace(" (Transparent)", string.Empty);
string Tpl = BannerTplPath + lbxBannerTpls.SelectedItem.ToString().Remove(lbxBannerTpls.SelectedItem.ToString().IndexOf('(', 0) - 1);
int format = Wii.TPL.GetTextureFormat(Tpl);
if (format == 8 || format == 9 || format == 10) { ErrorBox("This format is not supported!"); return; }
@ -1138,7 +1104,7 @@ namespace CustomizeMii
try
{
CustomizeMii_Preview pvw = new CustomizeMii_Preview();
pvw.startTPL = lbxBannerTpls.SelectedItem.ToString().Replace(" (Transparent)", string.Empty);
pvw.startTPL = lbxBannerTpls.SelectedItem.ToString().Remove(lbxBannerTpls.SelectedItem.ToString().IndexOf('(', 0) - 1);
pvw.ShowDialog();
pvw = null;
}
@ -1167,7 +1133,7 @@ namespace CustomizeMii
{
try
{
string Tpl = IconTplPath + lbxIconTpls.SelectedItem.ToString().Replace(" (Transparent)", string.Empty);
string Tpl = IconTplPath + lbxIconTpls.SelectedItem.ToString().Remove(lbxIconTpls.SelectedItem.ToString().IndexOf('(', 0) - 1);
byte[] TplArray = Wii.Tools.LoadFileToByteArray(Tpl);
Image Img;
@ -1228,7 +1194,7 @@ namespace CustomizeMii
{
if (lbxIconTpls.SelectedIndex != -1)
{
string Tpl = BannerTplPath + lbxBannerTpls.SelectedItem.ToString().Replace(" (Transparent)", string.Empty);
string Tpl = IconTplPath + lbxIconTpls.SelectedItem.ToString().Remove(lbxIconTpls.SelectedItem.ToString().IndexOf('(', 0) - 1);
int format = Wii.TPL.GetTextureFormat(Tpl);
if (format == 8 || format == 9 || format == 10) { ErrorBox("This format is not supported!"); return; }
@ -1282,7 +1248,7 @@ namespace CustomizeMii
{
CustomizeMii_Preview pvw = new CustomizeMii_Preview();
pvw.startIcon = true;
pvw.startTPL = lbxIconTpls.SelectedItem.ToString().Replace(" (Transparent)", string.Empty);
pvw.startTPL = lbxIconTpls.SelectedItem.ToString().Remove(lbxIconTpls.SelectedItem.ToString().IndexOf('(', 0) - 1);
pvw.ShowDialog();
pvw = null;
}
@ -1295,334 +1261,13 @@ namespace CustomizeMii
}
}
private bool CheckUnpackFolder()
{
try
{
//Check Unpack Root
string[] RootFiles = Directory.GetFiles(TempUnpackPath);
string[] RootDirs = Directory.GetDirectories(TempUnpackPath);
foreach (string thisFile in RootFiles)
{
if (!thisFile.ToLower().EndsWith(".app") &&
!thisFile.ToLower().EndsWith(".cert") &&
!thisFile.ToLower().EndsWith(".tik") &&
!thisFile.ToLower().EndsWith(".tmd"))
File.Delete(thisFile);
}
if (RootDirs.Length > 1)
{
foreach (string thisDir in RootDirs)
{
if (!thisDir.EndsWith("00000000.app_OUT"))
Directory.Delete(thisDir, true);
}
}
//Check 00000000.app_OUT
string[] MetaFiles = Directory.GetFiles(TempUnpackPath + "00000000.app_OUT");
string[] MetaDirs = Directory.GetDirectories(TempUnpackPath + "00000000.app_OUT");
foreach (string thisFile in MetaFiles)
File.Delete(thisFile);
foreach (string thisDir in MetaDirs)
if (!thisDir.ToLower().EndsWith("meta"))
Directory.Delete(thisDir, true);
string[] AppFiles = Directory.GetFiles(TempUnpackPath + "00000000.app_OUT\\meta");
string[] AppDirs = Directory.GetDirectories(TempUnpackPath + "00000000.app_OUT\\meta");
foreach (string thisFile in AppFiles)
{
if (!thisFile.ToLower().EndsWith("banner.bin") &&
!thisFile.ToLower().EndsWith("icon.bin") &&
!thisFile.ToLower().EndsWith("sound.bin"))
File.Delete(thisFile);
}
if (AppDirs.Length > 2)
{
foreach (string thisDir in AppDirs)
{
if (!thisDir.EndsWith("banner.bin_OUT") &&
!thisDir.EndsWith("icon.bin_OUT"))
Directory.Delete(thisDir, true);
}
}
//Check banner.bin_OUT / Banner Replace Path
if (string.IsNullOrEmpty(BannerReplace))
{
string[] ArcFiles = Directory.GetFiles(TempUnpackPath + "00000000.app_OUT\\meta\\banner.bin_OUT");
string[] ArcDirs = Directory.GetDirectories(TempUnpackPath + "00000000.app_OUT\\meta\\banner.bin_OUT");
foreach (string thisFile in ArcFiles)
File.Delete(thisFile);
foreach (string thisDir in ArcDirs)
if (!thisDir.ToLower().EndsWith("arc"))
Directory.Delete(thisDir, true);
string[] BannerFiles = Directory.GetFiles(TempUnpackPath + "00000000.app_OUT\\meta\\banner.bin_OUT\\arc");
string[] BannerDirs = Directory.GetDirectories(TempUnpackPath + "00000000.app_OUT\\meta\\banner.bin_OUT\\arc");
foreach (string thisFile in BannerFiles)
File.Delete(thisFile);
if (BannerDirs.Length > 3)
{
foreach (string thisDir in BannerDirs)
{
if (!thisDir.ToLower().EndsWith("anim") &&
!thisDir.ToLower().EndsWith("blyt") &&
!thisDir.ToLower().EndsWith("timg"))
Directory.Delete(thisDir, true);
}
}
string[] AnimFiles = Directory.GetFiles(TempUnpackPath + "00000000.app_OUT\\meta\\banner.bin_OUT\\arc\\anim");
string[] AnimDirs = Directory.GetDirectories(TempUnpackPath + "00000000.app_OUT\\meta\\banner.bin_OUT\\arc\\anim");
foreach (string thisFile in AnimFiles)
{
if (!thisFile.ToLower().EndsWith(".brlan"))
File.Delete(thisFile);
}
foreach (string thisDir in AnimDirs)
Directory.Delete(thisDir, true);
string[] BlytFiles = Directory.GetFiles(TempUnpackPath + "00000000.app_OUT\\meta\\banner.bin_OUT\\arc\\blyt");
string[] BlytDirs = Directory.GetDirectories(TempUnpackPath + "00000000.app_OUT\\meta\\banner.bin_OUT\\arc\\blyt");
foreach (string thisFile in BlytFiles)
{
if (!thisFile.ToLower().EndsWith(".brlyt"))
File.Delete(thisFile);
}
foreach (string thisDir in BlytDirs)
Directory.Delete(thisDir, true);
string[] TimgFiles = Directory.GetFiles(TempUnpackPath + "00000000.app_OUT\\meta\\banner.bin_OUT\\arc\\timg");
string[] TimgDirs = Directory.GetDirectories(TempUnpackPath + "00000000.app_OUT\\meta\\banner.bin_OUT\\arc\\timg");
foreach (string thisFile in TimgFiles)
{
if (!thisFile.ToLower().EndsWith(".tpl"))
File.Delete(thisFile);
}
foreach (string thisDir in TimgDirs)
Directory.Delete(thisDir, true);
}
else
{
string[] ArcFiles = Directory.GetFiles(TempBannerPath);
string[] ArcDirs = Directory.GetDirectories(TempBannerPath);
foreach (string thisFile in ArcFiles)
File.Delete(thisFile);
foreach (string thisDir in ArcDirs)
if (!thisDir.ToLower().EndsWith("arc"))
Directory.Delete(thisDir, true);
string[] BannerFiles = Directory.GetFiles(TempBannerPath + "arc");
string[] BannerDirs = Directory.GetDirectories(TempBannerPath + "arc");
foreach (string thisFile in BannerFiles)
File.Delete(thisFile);
if (BannerDirs.Length > 3)
{
foreach (string thisDir in BannerDirs)
{
if (!thisDir.ToLower().EndsWith("anim") &&
!thisDir.ToLower().EndsWith("blyt") &&
!thisDir.ToLower().EndsWith("timg"))
Directory.Delete(thisDir, true);
}
}
string[] AnimFiles = Directory.GetFiles(TempBannerPath + "arc\\anim");
string[] AnimDirs = Directory.GetDirectories(TempBannerPath + "arc\\anim");
foreach (string thisFile in AnimFiles)
{
if (!thisFile.ToLower().EndsWith(".brlan"))
File.Delete(thisFile);
}
foreach (string thisDir in AnimDirs)
Directory.Delete(thisDir, true);
string[] BlytFiles = Directory.GetFiles(TempBannerPath + "arc\\blyt");
string[] BlytDirs = Directory.GetDirectories(TempBannerPath + "arc\\blyt");
foreach (string thisFile in BlytFiles)
{
if (!thisFile.ToLower().EndsWith(".brlyt"))
File.Delete(thisFile);
}
foreach (string thisDir in BlytDirs)
Directory.Delete(thisDir, true);
string[] TimgFiles = Directory.GetFiles(TempBannerPath + "arc\\timg");
string[] TimgDirs = Directory.GetDirectories(TempBannerPath + "arc\\timg");
foreach (string thisFile in TimgFiles)
{
if (!thisFile.ToLower().EndsWith(".tpl"))
File.Delete(thisFile);
}
foreach (string thisDir in TimgDirs)
Directory.Delete(thisDir, true);
}
//Check icon.bin_OUT / Icon Replace Path
if (string.IsNullOrEmpty(IconReplace))
{
string[] ArcFiles = Directory.GetFiles(TempUnpackPath + "00000000.app_OUT\\meta\\icon.bin_OUT");
string[] ArcDirs = Directory.GetDirectories(TempUnpackPath + "00000000.app_OUT\\meta\\icon.bin_OUT");
foreach (string thisFile in ArcFiles)
File.Delete(thisFile);
foreach (string thisDir in ArcDirs)
if (!thisDir.ToLower().EndsWith("arc"))
Directory.Delete(thisDir, true);
string[] IconFiles = Directory.GetFiles(TempUnpackPath + "00000000.app_OUT\\meta\\icon.bin_OUT\\arc");
string[] IconDirs = Directory.GetDirectories(TempUnpackPath + "00000000.app_OUT\\meta\\icon.bin_OUT\\arc");
foreach (string thisFile in IconFiles)
File.Delete(thisFile);
if (IconDirs.Length > 3)
{
foreach (string thisDir in IconDirs)
{
if (!thisDir.ToLower().EndsWith("anim") &&
!thisDir.ToLower().EndsWith("blyt") &&
!thisDir.ToLower().EndsWith("timg"))
Directory.Delete(thisDir, true);
}
}
string[] AnimFiles = Directory.GetFiles(TempUnpackPath + "00000000.app_OUT\\meta\\icon.bin_OUT\\arc\\anim");
string[] AnimDirs = Directory.GetDirectories(TempUnpackPath + "00000000.app_OUT\\meta\\icon.bin_OUT\\arc\\anim");
foreach (string thisFile in AnimFiles)
{
if (!thisFile.ToLower().EndsWith(".brlan"))
File.Delete(thisFile);
}
foreach (string thisDir in AnimDirs)
Directory.Delete(thisDir, true);
string[] BlytFiles = Directory.GetFiles(TempUnpackPath + "00000000.app_OUT\\meta\\icon.bin_OUT\\arc\\blyt");
string[] BlytDirs = Directory.GetDirectories(TempUnpackPath + "00000000.app_OUT\\meta\\icon.bin_OUT\\arc\\blyt");
foreach (string thisFile in BlytFiles)
{
if (!thisFile.ToLower().EndsWith(".brlyt"))
File.Delete(thisFile);
}
foreach (string thisDir in BlytDirs)
Directory.Delete(thisDir, true);
string[] TimgFiles = Directory.GetFiles(TempUnpackPath + "00000000.app_OUT\\meta\\icon.bin_OUT\\arc\\timg");
string[] TimgDirs = Directory.GetDirectories(TempUnpackPath + "00000000.app_OUT\\meta\\icon.bin_OUT\\arc\\timg");
foreach (string thisFile in TimgFiles)
{
if (!thisFile.ToLower().EndsWith(".tpl"))
File.Delete(thisFile);
}
foreach (string thisDir in TimgDirs)
Directory.Delete(thisDir, true);
}
else
{
string[] ArcFiles = Directory.GetFiles(TempIconPath);
string[] ArcDirs = Directory.GetDirectories(TempIconPath);
foreach (string thisFile in ArcFiles)
File.Delete(thisFile);
foreach (string thisDir in ArcDirs)
if (!thisDir.ToLower().EndsWith("arc"))
Directory.Delete(thisDir, true);
string[] IconFiles = Directory.GetFiles(TempIconPath + "arc");
string[] IconDirs = Directory.GetDirectories(TempIconPath + "arc");
foreach (string thisFile in IconFiles)
File.Delete(thisFile);
if (IconDirs.Length > 3)
{
foreach (string thisDir in IconDirs)
{
if (!thisDir.ToLower().EndsWith("anim") &&
!thisDir.ToLower().EndsWith("blyt") &&
!thisDir.ToLower().EndsWith("timg"))
Directory.Delete(thisDir, true);
}
}
string[] AnimFiles = Directory.GetFiles(TempIconPath + "arc\\anim");
string[] AnimDirs = Directory.GetDirectories(TempIconPath + "arc\\anim");
foreach (string thisFile in AnimFiles)
{
if (!thisFile.ToLower().EndsWith(".brlan"))
File.Delete(thisFile);
}
foreach (string thisDir in AnimDirs)
Directory.Delete(thisDir, true);
string[] BlytFiles = Directory.GetFiles(TempIconPath + "arc\\blyt");
string[] BlytDirs = Directory.GetDirectories(TempIconPath + "arc\\blyt");
foreach (string thisFile in BlytFiles)
{
if (!thisFile.ToLower().EndsWith(".brlyt"))
File.Delete(thisFile);
}
foreach (string thisDir in BlytDirs)
Directory.Delete(thisDir, true);
string[] TimgFiles = Directory.GetFiles(TempIconPath + "arc\\timg");
string[] TimgDirs = Directory.GetDirectories(TempIconPath + "arc\\timg");
foreach (string thisFile in TimgFiles)
{
if (!thisFile.ToLower().EndsWith(".tpl"))
File.Delete(thisFile);
}
foreach (string thisDir in TimgDirs)
Directory.Delete(thisDir, true);
}
return true;
}
catch (Exception ex) { ErrorBox(ex.Message); return false; }
}
private void btnCreateWad_Click(object sender, EventArgs e)
{
Point mousePos = MousePosition;
if (mousePos.X < (this.Location.X + btnCreateWad.Location.X + Math.Ceiling(separatorBtn) + 3))
{
//SEND WAD
if (pbProgress.Value == 100)
{
if (!string.IsNullOrEmpty(tbSourceWad.Text))
@ -1668,6 +1313,7 @@ namespace CustomizeMii
}
else
{
//CREATE WAD
if (pbProgress.Value == 100)
{
if (!string.IsNullOrEmpty(tbSourceWad.Text))
@ -1690,6 +1336,14 @@ namespace CustomizeMii
CreationTimer.Start();
WadCreationInfo wadInfo = new WadCreationInfo();
if (!int.TryParse(tbStartupIos.Text, out wadInfo.requiredIos)) { ErrorBox("Please enter a valid Required IOS! (0 - 255)"); return; }
wadInfo.titles = new string[] { tbJapanese.Text, tbEnglish.Text, tbGerman.Text, tbFrench.Text, tbSpanish.Text, tbItalian.Text, tbDutch.Text, tbKorean.Text };
wadInfo.allLangTitle = tbAllLanguages.Text;
wadInfo.titleId = tbTitleID.Text;
wadInfo.sound = tbSound.Text;
wadInfo.dol = tbDol.Text;
wadInfo.outFile = sfd.FileName;
wadInfo.nandLoader = (WadCreationInfo.NandLoader)cmbNandLoader.SelectedIndex;
@ -1699,6 +1353,8 @@ namespace CustomizeMii
bwCreateWad.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bwCreateWad_RunWorkerCompleted);
bwCreateWad.WorkerReportsProgress = true;
bwCreateWad.RunWorkerAsync(wadInfo);
return;
}
catch (Exception ex)
{
@ -1709,6 +1365,10 @@ namespace CustomizeMii
}
}
}
currentProgress.progressValue = 100;
currentProgress.progressState = " ";
this.Invoke(ProgressUpdate);
}
}
@ -2052,7 +1712,7 @@ namespace CustomizeMii
try
{
string TplName = lbxBannerTpls.SelectedItem.ToString().Replace(" (Transparent)", string.Empty);
string TplName = lbxBannerTpls.SelectedItem.ToString().Remove(lbxBannerTpls.SelectedItem.ToString().IndexOf('(', 0) - 1);
string CurBannerPath = GetCurBannerPath();
string[] brlytTpls = Wii.Brlyt.GetBrlytTpls(CurBannerPath + "blyt\\banner.brlyt", (File.Exists(CurBannerPath + "anim\\banner.brlan")) ? CurBannerPath + "anim\\banner.brlan" : CurBannerPath + "anim\\banner_loop.brlan");
@ -2090,7 +1750,7 @@ namespace CustomizeMii
try
{
string TplName = lbxIconTpls.SelectedItem.ToString().Replace(" (Transparent)", string.Empty);
string TplName = lbxIconTpls.SelectedItem.ToString().Remove(lbxIconTpls.SelectedItem.ToString().IndexOf('(', 0) - 1);
string CurIconPath = GetCurIconPath();
string[] brlytTpls = Wii.Brlyt.GetBrlytTpls(CurIconPath + "blyt\\icon.brlyt", CurIconPath + "anim\\icon.brlan");
@ -2165,11 +1825,11 @@ namespace CustomizeMii
{
if (!lbxBannerTpls.SelectedItem.ToString().EndsWith("(Transparent)"))
{
string thisItem = lbxBannerTpls.SelectedItem.ToString().Replace(" (Transparent)", string.Empty);
string thisItem = lbxBannerTpls.SelectedItem.ToString();
lbxBannerTpls.Items.Remove(lbxBannerTpls.SelectedItem);
lbxBannerTpls.Items.Add(thisItem + " (Transparent)");
lbxBannerTpls.SelectedItem = thisItem + " (Transparent)";
BannerTransparents.Add(thisItem);
BannerTransparents.Add(thisItem.Remove(thisItem.IndexOf('(', 0) - 1));
}
}
catch { }
@ -2178,11 +1838,11 @@ namespace CustomizeMii
{
try
{
string thisItem = lbxBannerTpls.SelectedItem.ToString().Replace(" (Transparent)", string.Empty);
string thisItem = lbxBannerTpls.SelectedItem.ToString();
lbxBannerTpls.Items.Remove(lbxBannerTpls.SelectedItem);
lbxBannerTpls.Items.Add(thisItem.Replace(" (Transparent)", string.Empty));
lbxBannerTpls.SelectedItem = thisItem.Replace(" (Transparent)", string.Empty);
BannerTransparents.Remove(thisItem.Replace(" (Transparent)", string.Empty));
BannerTransparents.Remove(thisItem.Remove(thisItem.IndexOf('(', 0) - 1));
}
catch { }
}
@ -2201,11 +1861,11 @@ namespace CustomizeMii
{
if (!lbxIconTpls.SelectedItem.ToString().EndsWith("(Transparent)"))
{
string thisItem = lbxIconTpls.SelectedItem.ToString().Replace(" (Transparent)", string.Empty);
string thisItem = lbxIconTpls.SelectedItem.ToString();
lbxIconTpls.Items.Remove(lbxIconTpls.SelectedItem);
lbxIconTpls.Items.Add(thisItem + " (Transparent)");
lbxIconTpls.SelectedItem = thisItem + " (Transparent)";
IconTransparents.Add(thisItem);
IconTransparents.Add(thisItem.Remove(thisItem.IndexOf('(', 0) - 1));
}
}
catch { }
@ -2214,11 +1874,11 @@ namespace CustomizeMii
{
try
{
string thisItem = lbxIconTpls.SelectedItem.ToString().Replace(" (Transparent)", string.Empty);
string thisItem = lbxIconTpls.SelectedItem.ToString();
lbxIconTpls.Items.Remove(lbxIconTpls.SelectedItem);
lbxIconTpls.Items.Add(thisItem.Replace(" (Transparent)", string.Empty));
lbxIconTpls.SelectedItem = thisItem.Replace(" (Transparent)", string.Empty);
IconTransparents.Remove(thisItem.Replace(" (Transparent)", string.Empty));
IconTransparents.Remove(thisItem.Remove(thisItem.IndexOf('(', 0) - 1));
}
catch { }
}
@ -2257,6 +1917,7 @@ namespace CustomizeMii
private void cmForwarderItem_Click(object sender, EventArgs e)
{
#if !Mono
ToolStripMenuItem cmSender = sender as ToolStripMenuItem;
if (cmSender == cmSimpleForwarder)
@ -2280,6 +1941,7 @@ namespace CustomizeMii
ErrorBox(ex.Message);
}
}
#endif
}
private void btnOptionsExtract_Click(object sender, EventArgs e)
@ -2687,6 +2349,7 @@ namespace CustomizeMii
tbJapanese.Text = tempText.Remove(startIndex, 7).Insert(startIndex, "チャンネル");
tbGerman.Text = tempText.Remove(startIndex, 7).Insert(startIndex, "Kanal");
tbDutch.Text = tempText.Remove(startIndex, 7).Insert(startIndex, "Kanaal");
tbKorean.Text = tempText.Remove(startIndex, 7).Insert(startIndex, "채널");
try
{
@ -2720,6 +2383,7 @@ namespace CustomizeMii
tbSpanish.Text = string.Empty;
tbItalian.Text = string.Empty;
tbDutch.Text = string.Empty;
tbKorean.Text = string.Empty;
ErrorBox(ex.Message);
}
@ -2729,5 +2393,15 @@ namespace CustomizeMii
{
llbTranslateChannel.Enabled = tbAllLanguages.Text.ToLower().Contains("channel");
}
private void tbStartupIos_KeyPress(object sender, KeyPressEventArgs e)
{
e.Handled = !char.IsDigit(e.KeyChar) && e.KeyChar != '\b';
}
private void llbMultiReplace_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
MultiReplace(sender == llbBannerMultiReplace);
}
}
}

View File

@ -122,6 +122,7 @@
Xuzz for his idea and hard work
WiiCrazy / I.R.on for CustomizeMii Installer
Xuzz, SquidMan, megazig, Matt_P, Omega and The Lemon Man for Wii.py
megazig for his BNS conversion code
SquidMan for Zetsubou
Andre Perrot for gbalzss
comex and Waninkoko for both their NAND Loader

View File

@ -150,6 +150,8 @@ namespace CustomizeMii
images[0, cbBanner.SelectedIndex].tplFormat.ToLower() == "ci14x2")
lbNoPreview.Visible = true;
else lbNoPreview.Visible = false;
cbIcon.SelectedIndex = -1;
}
}
@ -195,6 +197,8 @@ namespace CustomizeMii
images[1, cbIcon.SelectedIndex].tplFormat.ToLower() == "ci14x2")
lbNoPreview.Visible = true;
else lbNoPreview.Visible = false;
cbBanner.SelectedIndex = -1;
}
}

View File

@ -34,6 +34,328 @@ namespace CustomizeMii
private delegate void SetLabelInvoker(string text, Label lb);
private delegate void SetButtonInvoker(string text, Button btn);
private bool CheckUnpackFolder()
{
try
{
//Check Unpack Root
string[] RootFiles = Directory.GetFiles(TempUnpackPath);
string[] RootDirs = Directory.GetDirectories(TempUnpackPath);
foreach (string thisFile in RootFiles)
{
if (!thisFile.ToLower().EndsWith(".app") &&
!thisFile.ToLower().EndsWith(".cert") &&
!thisFile.ToLower().EndsWith(".tik") &&
!thisFile.ToLower().EndsWith(".tmd"))
File.Delete(thisFile);
}
if (RootDirs.Length > 1)
{
foreach (string thisDir in RootDirs)
{
if (!thisDir.EndsWith("00000000.app_OUT"))
Directory.Delete(thisDir, true);
}
}
//Check 00000000.app_OUT
string[] MetaFiles = Directory.GetFiles(TempUnpackPath + "00000000.app_OUT");
string[] MetaDirs = Directory.GetDirectories(TempUnpackPath + "00000000.app_OUT");
foreach (string thisFile in MetaFiles)
File.Delete(thisFile);
foreach (string thisDir in MetaDirs)
if (!thisDir.ToLower().EndsWith("meta"))
Directory.Delete(thisDir, true);
string[] AppFiles = Directory.GetFiles(TempUnpackPath + "00000000.app_OUT\\meta");
string[] AppDirs = Directory.GetDirectories(TempUnpackPath + "00000000.app_OUT\\meta");
foreach (string thisFile in AppFiles)
{
if (!thisFile.ToLower().EndsWith("banner.bin") &&
!thisFile.ToLower().EndsWith("icon.bin") &&
!thisFile.ToLower().EndsWith("sound.bin"))
File.Delete(thisFile);
}
if (AppDirs.Length > 2)
{
foreach (string thisDir in AppDirs)
{
if (!thisDir.EndsWith("banner.bin_OUT") &&
!thisDir.EndsWith("icon.bin_OUT"))
Directory.Delete(thisDir, true);
}
}
//Check banner.bin_OUT / Banner Replace Path
if (string.IsNullOrEmpty(BannerReplace))
{
string[] ArcFiles = Directory.GetFiles(TempUnpackPath + "00000000.app_OUT\\meta\\banner.bin_OUT");
string[] ArcDirs = Directory.GetDirectories(TempUnpackPath + "00000000.app_OUT\\meta\\banner.bin_OUT");
foreach (string thisFile in ArcFiles)
File.Delete(thisFile);
foreach (string thisDir in ArcDirs)
if (!thisDir.ToLower().EndsWith("arc"))
Directory.Delete(thisDir, true);
string[] BannerFiles = Directory.GetFiles(TempUnpackPath + "00000000.app_OUT\\meta\\banner.bin_OUT\\arc");
string[] BannerDirs = Directory.GetDirectories(TempUnpackPath + "00000000.app_OUT\\meta\\banner.bin_OUT\\arc");
foreach (string thisFile in BannerFiles)
File.Delete(thisFile);
if (BannerDirs.Length > 3)
{
foreach (string thisDir in BannerDirs)
{
if (!thisDir.ToLower().EndsWith("anim") &&
!thisDir.ToLower().EndsWith("blyt") &&
!thisDir.ToLower().EndsWith("timg"))
Directory.Delete(thisDir, true);
}
}
string[] AnimFiles = Directory.GetFiles(TempUnpackPath + "00000000.app_OUT\\meta\\banner.bin_OUT\\arc\\anim");
string[] AnimDirs = Directory.GetDirectories(TempUnpackPath + "00000000.app_OUT\\meta\\banner.bin_OUT\\arc\\anim");
foreach (string thisFile in AnimFiles)
{
if (!thisFile.ToLower().EndsWith(".brlan"))
File.Delete(thisFile);
}
foreach (string thisDir in AnimDirs)
Directory.Delete(thisDir, true);
string[] BlytFiles = Directory.GetFiles(TempUnpackPath + "00000000.app_OUT\\meta\\banner.bin_OUT\\arc\\blyt");
string[] BlytDirs = Directory.GetDirectories(TempUnpackPath + "00000000.app_OUT\\meta\\banner.bin_OUT\\arc\\blyt");
foreach (string thisFile in BlytFiles)
{
if (!thisFile.ToLower().EndsWith(".brlyt"))
File.Delete(thisFile);
}
foreach (string thisDir in BlytDirs)
Directory.Delete(thisDir, true);
string[] TimgFiles = Directory.GetFiles(TempUnpackPath + "00000000.app_OUT\\meta\\banner.bin_OUT\\arc\\timg");
string[] TimgDirs = Directory.GetDirectories(TempUnpackPath + "00000000.app_OUT\\meta\\banner.bin_OUT\\arc\\timg");
foreach (string thisFile in TimgFiles)
{
if (!thisFile.ToLower().EndsWith(".tpl"))
File.Delete(thisFile);
}
foreach (string thisDir in TimgDirs)
Directory.Delete(thisDir, true);
}
else
{
string[] ArcFiles = Directory.GetFiles(TempBannerPath);
string[] ArcDirs = Directory.GetDirectories(TempBannerPath);
foreach (string thisFile in ArcFiles)
File.Delete(thisFile);
foreach (string thisDir in ArcDirs)
if (!thisDir.ToLower().EndsWith("arc"))
Directory.Delete(thisDir, true);
string[] BannerFiles = Directory.GetFiles(TempBannerPath + "arc");
string[] BannerDirs = Directory.GetDirectories(TempBannerPath + "arc");
foreach (string thisFile in BannerFiles)
File.Delete(thisFile);
if (BannerDirs.Length > 3)
{
foreach (string thisDir in BannerDirs)
{
if (!thisDir.ToLower().EndsWith("anim") &&
!thisDir.ToLower().EndsWith("blyt") &&
!thisDir.ToLower().EndsWith("timg"))
Directory.Delete(thisDir, true);
}
}
string[] AnimFiles = Directory.GetFiles(TempBannerPath + "arc\\anim");
string[] AnimDirs = Directory.GetDirectories(TempBannerPath + "arc\\anim");
foreach (string thisFile in AnimFiles)
{
if (!thisFile.ToLower().EndsWith(".brlan"))
File.Delete(thisFile);
}
foreach (string thisDir in AnimDirs)
Directory.Delete(thisDir, true);
string[] BlytFiles = Directory.GetFiles(TempBannerPath + "arc\\blyt");
string[] BlytDirs = Directory.GetDirectories(TempBannerPath + "arc\\blyt");
foreach (string thisFile in BlytFiles)
{
if (!thisFile.ToLower().EndsWith(".brlyt"))
File.Delete(thisFile);
}
foreach (string thisDir in BlytDirs)
Directory.Delete(thisDir, true);
string[] TimgFiles = Directory.GetFiles(TempBannerPath + "arc\\timg");
string[] TimgDirs = Directory.GetDirectories(TempBannerPath + "arc\\timg");
foreach (string thisFile in TimgFiles)
{
if (!thisFile.ToLower().EndsWith(".tpl"))
File.Delete(thisFile);
}
foreach (string thisDir in TimgDirs)
Directory.Delete(thisDir, true);
}
//Check icon.bin_OUT / Icon Replace Path
if (string.IsNullOrEmpty(IconReplace))
{
string[] ArcFiles = Directory.GetFiles(TempUnpackPath + "00000000.app_OUT\\meta\\icon.bin_OUT");
string[] ArcDirs = Directory.GetDirectories(TempUnpackPath + "00000000.app_OUT\\meta\\icon.bin_OUT");
foreach (string thisFile in ArcFiles)
File.Delete(thisFile);
foreach (string thisDir in ArcDirs)
if (!thisDir.ToLower().EndsWith("arc"))
Directory.Delete(thisDir, true);
string[] IconFiles = Directory.GetFiles(TempUnpackPath + "00000000.app_OUT\\meta\\icon.bin_OUT\\arc");
string[] IconDirs = Directory.GetDirectories(TempUnpackPath + "00000000.app_OUT\\meta\\icon.bin_OUT\\arc");
foreach (string thisFile in IconFiles)
File.Delete(thisFile);
if (IconDirs.Length > 3)
{
foreach (string thisDir in IconDirs)
{
if (!thisDir.ToLower().EndsWith("anim") &&
!thisDir.ToLower().EndsWith("blyt") &&
!thisDir.ToLower().EndsWith("timg"))
Directory.Delete(thisDir, true);
}
}
string[] AnimFiles = Directory.GetFiles(TempUnpackPath + "00000000.app_OUT\\meta\\icon.bin_OUT\\arc\\anim");
string[] AnimDirs = Directory.GetDirectories(TempUnpackPath + "00000000.app_OUT\\meta\\icon.bin_OUT\\arc\\anim");
foreach (string thisFile in AnimFiles)
{
if (!thisFile.ToLower().EndsWith(".brlan"))
File.Delete(thisFile);
}
foreach (string thisDir in AnimDirs)
Directory.Delete(thisDir, true);
string[] BlytFiles = Directory.GetFiles(TempUnpackPath + "00000000.app_OUT\\meta\\icon.bin_OUT\\arc\\blyt");
string[] BlytDirs = Directory.GetDirectories(TempUnpackPath + "00000000.app_OUT\\meta\\icon.bin_OUT\\arc\\blyt");
foreach (string thisFile in BlytFiles)
{
if (!thisFile.ToLower().EndsWith(".brlyt"))
File.Delete(thisFile);
}
foreach (string thisDir in BlytDirs)
Directory.Delete(thisDir, true);
string[] TimgFiles = Directory.GetFiles(TempUnpackPath + "00000000.app_OUT\\meta\\icon.bin_OUT\\arc\\timg");
string[] TimgDirs = Directory.GetDirectories(TempUnpackPath + "00000000.app_OUT\\meta\\icon.bin_OUT\\arc\\timg");
foreach (string thisFile in TimgFiles)
{
if (!thisFile.ToLower().EndsWith(".tpl"))
File.Delete(thisFile);
}
foreach (string thisDir in TimgDirs)
Directory.Delete(thisDir, true);
}
else
{
string[] ArcFiles = Directory.GetFiles(TempIconPath);
string[] ArcDirs = Directory.GetDirectories(TempIconPath);
foreach (string thisFile in ArcFiles)
File.Delete(thisFile);
foreach (string thisDir in ArcDirs)
if (!thisDir.ToLower().EndsWith("arc"))
Directory.Delete(thisDir, true);
string[] IconFiles = Directory.GetFiles(TempIconPath + "arc");
string[] IconDirs = Directory.GetDirectories(TempIconPath + "arc");
foreach (string thisFile in IconFiles)
File.Delete(thisFile);
if (IconDirs.Length > 3)
{
foreach (string thisDir in IconDirs)
{
if (!thisDir.ToLower().EndsWith("anim") &&
!thisDir.ToLower().EndsWith("blyt") &&
!thisDir.ToLower().EndsWith("timg"))
Directory.Delete(thisDir, true);
}
}
string[] AnimFiles = Directory.GetFiles(TempIconPath + "arc\\anim");
string[] AnimDirs = Directory.GetDirectories(TempIconPath + "arc\\anim");
foreach (string thisFile in AnimFiles)
{
if (!thisFile.ToLower().EndsWith(".brlan"))
File.Delete(thisFile);
}
foreach (string thisDir in AnimDirs)
Directory.Delete(thisDir, true);
string[] BlytFiles = Directory.GetFiles(TempIconPath + "arc\\blyt");
string[] BlytDirs = Directory.GetDirectories(TempIconPath + "arc\\blyt");
foreach (string thisFile in BlytFiles)
{
if (!thisFile.ToLower().EndsWith(".brlyt"))
File.Delete(thisFile);
}
foreach (string thisDir in BlytDirs)
Directory.Delete(thisDir, true);
string[] TimgFiles = Directory.GetFiles(TempIconPath + "arc\\timg");
string[] TimgDirs = Directory.GetDirectories(TempIconPath + "arc\\timg");
foreach (string thisFile in TimgFiles)
{
if (!thisFile.ToLower().EndsWith(".tpl"))
File.Delete(thisFile);
}
foreach (string thisDir in TimgDirs)
Directory.Delete(thisDir, true);
}
return true;
}
catch { return false; }
}
private bool FailureCheck()
{
try
@ -86,6 +408,17 @@ namespace CustomizeMii
ErrorBox("Please enter a valid Title ID!"); return false;
}
//Check Required IOS Box
int tmp;
if (!int.TryParse(tbStartupIos.Text, out tmp))
{
ErrorBox("Please enter a valid Required IOS! (0 - 255)"); return false;
}
else if (tmp < 0 || tmp > 255)
{
ErrorBox("Please enter a valid Required IOS! (0 - 255)"); return false;
}
//Check brlan files
string[] ValidBrlans = new string[] { "banner.brlan", "icon.brlan", "banner_loop.brlan", "icon_loop.brlan", "banner_start.brlan", "icon_start.brlan" };
foreach (string thisBrlan in lbxBrlanBanner.Items)
@ -108,8 +441,8 @@ namespace CustomizeMii
//Check TPLs
List<string> BannerTpls = new List<string>();
List<string> IconTpls = new List<string>();
foreach (string thisTpl in lbxBannerTpls.Items) BannerTpls.Add(thisTpl.Replace(" (Transparent)", string.Empty));
foreach (string thisTpl in lbxIconTpls.Items) IconTpls.Add(thisTpl.Replace(" (Transparent)", string.Empty));
foreach (string thisTpl in lbxBannerTpls.Items) BannerTpls.Add(thisTpl.Remove(thisTpl.IndexOf('(', 0) - 1));
foreach (string thisTpl in lbxIconTpls.Items) IconTpls.Add(thisTpl.Remove(thisTpl.IndexOf('(', 0) - 1));
string[] BannerBrlytPath;
string[] BannerBrlanPath;
@ -477,9 +810,11 @@ namespace CustomizeMii
for (int i = 0; i < tpls.Length; i++)
{
if (BannerTransparents.Contains(tpls[i].Remove(0, tpls[i].LastIndexOf('\\') + 1)))
lbxBannerTpls.Items.Add(tpls[i].Remove(0, tpls[i].LastIndexOf('\\') + 1) + " (Transparent)");
lbxBannerTpls.Items.Add(tpls[i].Remove(0, tpls[i].LastIndexOf('\\') + 1) +
string.Format(" ({0} x {1})", Wii.TPL.GetTextureWidth(File.ReadAllBytes(tpls[i])), Wii.TPL.GetTextureHeight(File.ReadAllBytes(tpls[i]))) + " (Transparent)");
else
lbxBannerTpls.Items.Add(tpls[i].Remove(0, tpls[i].LastIndexOf('\\') + 1));
lbxBannerTpls.Items.Add(tpls[i].Remove(0, tpls[i].LastIndexOf('\\') + 1) +
string.Format(" ({0} x {1})", Wii.TPL.GetTextureWidth(File.ReadAllBytes(tpls[i])), Wii.TPL.GetTextureHeight(File.ReadAllBytes(tpls[i]))));
}
}
}
@ -494,9 +829,11 @@ namespace CustomizeMii
for (int i = 0; i < tpls.Length; i++)
{
if (IconTransparents.Contains(tpls[i].Remove(0, tpls[i].LastIndexOf('\\') + 1)))
lbxIconTpls.Items.Add(tpls[i].Remove(0, tpls[i].LastIndexOf('\\') + 1) + " (Transparent)");
lbxIconTpls.Items.Add(tpls[i].Remove(0, tpls[i].LastIndexOf('\\') + 1) +
string.Format(" ({0} x {1})", Wii.TPL.GetTextureWidth(File.ReadAllBytes(tpls[i])), Wii.TPL.GetTextureHeight(File.ReadAllBytes(tpls[i]))) + " (Transparent)");
else
lbxIconTpls.Items.Add(tpls[i].Remove(0, tpls[i].LastIndexOf('\\') + 1));
lbxIconTpls.Items.Add(tpls[i].Remove(0, tpls[i].LastIndexOf('\\') + 1) +
string.Format(" ({0} x {1})", Wii.TPL.GetTextureWidth(File.ReadAllBytes(tpls[i])), Wii.TPL.GetTextureHeight(File.ReadAllBytes(tpls[i]))));
}
}
}
@ -641,7 +978,7 @@ namespace CustomizeMii
{
if (thisTpl.EndsWith("(Transparent)"))
{
string Tpl = GetCurBannerPath() + "timg\\" + thisTpl.Replace(" (Transparent)", string.Empty);
string Tpl = GetCurBannerPath() + "timg\\" + thisTpl.Remove(thisTpl.IndexOf('(', 0) - 1);
byte[] TplArray = Wii.Tools.LoadFileToByteArray(Tpl);
int Width = Wii.TPL.GetTextureWidth(TplArray);
int Height = Wii.TPL.GetTextureHeight(TplArray);
@ -658,7 +995,7 @@ namespace CustomizeMii
{
if (thisTpl.EndsWith("(Transparent)"))
{
string Tpl = GetCurIconPath() + "timg\\" + thisTpl.Replace(" (Transparent)", string.Empty);
string Tpl = GetCurIconPath() + "timg\\" + thisTpl.Remove(thisTpl.IndexOf('(', 0) - 1);
byte[] TplArray = Wii.Tools.LoadFileToByteArray(Tpl);
int Width = Wii.TPL.GetTextureWidth(TplArray);
int Height = Wii.TPL.GetTextureHeight(TplArray);
@ -751,7 +1088,7 @@ namespace CustomizeMii
using (Image img = Image.FromFile(inputFile))
{
Wii.TPL.ConvertToTPL(img, CurPath + "timg\\" + TplName, TplFormat);
lbx.Items.Add(TplName);
lbx.Items.Add(TplName + string.Format(" ({0} x {1})", img.Width, img.Height));
}
}
}
@ -952,5 +1289,59 @@ namespace CustomizeMii
}
}
}
private void MultiReplace(bool banner)
{
FolderBrowserDialog fbd = new FolderBrowserDialog();
fbd.Description = "Please select the folder where the images are in.\nThe images must have the same filename as the TPLs!";
if (fbd.ShowDialog() == DialogResult.OK)
{
string imageDir = fbd.SelectedPath;
string tplDir = ((banner) ? GetCurBannerPath() : GetCurIconPath()) + "timg\\";
string[] tpls = Directory.GetFiles(tplDir, "*.tpl");
List<string> replacedTpls = new List<string>();
foreach (string thisTpl in tpls)
{
string image = string.Empty;
if (File.Exists(imageDir + "\\" + Path.GetFileNameWithoutExtension(thisTpl) + ".png"))
image = imageDir + "\\" + Path.GetFileNameWithoutExtension(thisTpl) + ".png";
else if (File.Exists(imageDir + "\\" + Path.GetFileNameWithoutExtension(thisTpl) + ".jpg"))
image = imageDir + "\\" + Path.GetFileNameWithoutExtension(thisTpl) + ".jpg";
else if (File.Exists(imageDir + "\\" + Path.GetFileNameWithoutExtension(thisTpl) + ".gif"))
image = imageDir + "\\" + Path.GetFileNameWithoutExtension(thisTpl) + ".gif";
else if (File.Exists(imageDir + "\\" + Path.GetFileNameWithoutExtension(thisTpl) + ".bmp"))
image = imageDir + "\\" + Path.GetFileNameWithoutExtension(thisTpl) + ".bmp";
else continue;
try
{
Image img = Image.FromFile(image);
byte[] temp = File.ReadAllBytes(thisTpl);
int width = Wii.TPL.GetTextureWidth(temp);
int height = Wii.TPL.GetTextureHeight(temp);
int format = Wii.TPL.GetTextureFormat(temp);
if (img.Width != width || img.Height != height)
img = ResizeImage(img, width, height);
File.Delete(thisTpl);
Wii.TPL.ConvertToTPL(img, thisTpl, format);
replacedTpls.Add(Path.GetFileName(thisTpl));
}
catch { }
}
if (replacedTpls.Count > 0)
{
string replaced = string.Join("\n", replacedTpls.ToArray());
InfoBox(string.Format("The following TPLs were successfully replaced:\n\n{0}", replaced));
}
else ErrorBox("No TPLs were replaced, did you name the images right?");
}
}
}
}

View File

@ -60,6 +60,12 @@ namespace CustomizeMii
Waninkoko = 1
}
public string titleId;
public string[] titles;
public string allLangTitle;
public int requiredIos;
public string sound;
public string dol;
public string outFile;
public NandLoader nandLoader;
public bool sendToWii;

View File

@ -135,6 +135,7 @@ namespace CustomizeMii
this.AcceptButton = this.btnTransmit;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.Control;
this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(273, 145);
this.Controls.Add(this.btnCancel);

View File

@ -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("2.2.0.0")]
[assembly: AssemblyFileVersion("2.2.0.0")]
[assembly: AssemblyVersion("2.3.0.0")]
[assembly: AssemblyFileVersion("2.3.0.0")]
[assembly: NeutralResourcesLanguageAttribute("en")]

View File

@ -9,6 +9,13 @@ Thanks to icefire / Xuzz for the basic idea of this Application!
-----------------------------------------------------------------------------------------
Changelog:
Version 2.3
- Fixed bug when extracting icon images
- Added ability to change the startup IOS (IOS used to launch the title)
- Added support for Korean channel title (reading and writing)
- Added TPL width and height to Banner and Icon list
- Added ability to replace multiple TPLs at once (images must have the same filename!)
Version 2.2
- Fixed some bugs with the preview window
- Fixed Complex Forwarder in combination with Waninkoko's NAND Loader
@ -89,11 +96,12 @@ Thanks:
Xuzz for his idea and hard work
WiiCrazy / I.R.on for CustomizeMii Installer
Xuzz, SquidMan, megazig, Matt_P, Omega and The Lemon Man for Wii.py
megazig for his BNS conversion code
SquidMan for Zetsubou
Andre Perrot for gbalzss
comex and Waninkoko for both their NAND Loader
djdynamite123 for the forwarder base files (ForwardMii-Plugin)
The USB Loader GX Team for their forwarder source (ForwardMii-Plugin)
djdynamite123 for the forwarder base files
The USB Loader GX Team for their forwarder source
-----------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------

View File

@ -583,6 +583,14 @@ namespace Wii
string tikid = Convert.ToChar(wadtiktmd[tikpos + 0x1e0]).ToString() + Convert.ToChar(wadtiktmd[tikpos + 0x1e1]).ToString() + Convert.ToChar(wadtiktmd[tikpos + 0x1e2]).ToString() + Convert.ToChar(wadtiktmd[tikpos + 0x1e3]).ToString();
return tikid;
}
else if (channeltype.Contains("MIOS"))
{
return "MIOS";
}
else if (channeltype.Contains("BC"))
{
return "BC";
}
else if (channeltype.Contains("IOS"))
{
int tikid = Tools.HexStringToInt(wadtiktmd[tikpos + 0x1e0].ToString("x2") + wadtiktmd[tikpos + 0x1e1].ToString("x2") + wadtiktmd[tikpos + 0x1e2].ToString("x2") + wadtiktmd[tikpos + 0x1e3].ToString("x2"));
@ -665,7 +673,7 @@ namespace Wii
{
if (!channeltype.Contains("Hidden"))
{
string[] titles = new string[7];
string[] titles = new string[8];
string[,] conts = GetContentInfo(wadfile);
byte[] titlekey = GetTitleKey(wadfile);
@ -713,6 +721,15 @@ namespace Wii
count++;
}
for (int i = jappos + (9 * 84); i < (jappos + (9 * 84)) + 40; i += 2)
{
if (contenthandle[i] != 0x00)
{
char temp = BitConverter.ToChar(new byte[] { contenthandle[i], contenthandle[i - 1] }, 0);
titles[count] += temp;
}
}
return titles;
}
else
@ -727,17 +744,17 @@ namespace Wii
}
}
for (int i = 1; i < 7; i++)
for (int i = 1; i < 8; i++)
titles[i] = titles[0];
return titles;
}
}
else return new string[7];
else return new string[8];
}
else return new string[7];
else return new string[8];
}
else return new string[7];
else return new string[8];
}
/// <summary>
@ -760,7 +777,7 @@ namespace Wii
/// <returns></returns>
public static string[] GetChannelTitlesFromApp(byte[] app)
{
string[] titles = new string[7];
string[] titles = new string[8];
int imetpos = 0;
int length = 400;
@ -797,6 +814,15 @@ namespace Wii
count++;
}
for (int i = jappos + (9 * 84); i < (jappos + (9 * 84)) + 40; i += 2)
{
if (app[i] != 0x00)
{
char temp = BitConverter.ToChar(new byte[] { app[i], app[i - 1] }, 0);
titles[count] += temp;
}
}
}
return titles;
@ -1418,12 +1444,13 @@ namespace Wii
/// <returns></returns>
public static byte[] ChangeChannelTitle(byte[] wadfile, string title)
{
return ChangeChannelTitle(wadfile, title, title, title, title, title, title, title);
return ChangeChannelTitle(wadfile, title, title, title, title, title, title, title, title);
}
/// <summary>
/// Changes the Channel Title of the wad file
/// Each language has a specific title
/// Changes the Channel Title of the wad file.
/// Each language has a specific title.
/// 0 = Japanese, 1 = English, 2 = German, 3 = French, 4 = Spanish, 5 = Italian, 6 = Dutch, 7 = Korean
/// </summary>
/// <param name="wadfile"></param>
/// <param name="jap"></param>
@ -1433,10 +1460,10 @@ namespace Wii
/// <param name="spa"></param>
/// <param name="ita"></param>
/// <param name="dut"></param>
public static void ChangeChannelTitle(string wadfile, string jap, string eng, string ger, string fra, string spa, string ita, string dut)
public static void ChangeChannelTitle(string wadfile, params string[] titles)
{
byte[] wadarray = Tools.LoadFileToByteArray(wadfile);
wadarray = ChangeChannelTitle(wadarray, jap, eng, ger, fra, spa, ita, dut);
wadarray = ChangeChannelTitle(wadarray, titles[0], titles[1], titles[2], titles[3], titles[4], titles[5], titles[6], (titles.Length > 7) ? titles[8] : "");
using (FileStream fs = new FileStream(wadfile, FileMode.Open, FileAccess.Write))
{
@ -1446,29 +1473,27 @@ namespace Wii
}
/// <summary>
/// Changes the Channel Title of the wad file
/// Each language has a specific title
/// Changes the Channel Title of the wad file.
/// Each language has a specific title.
/// 0 = Japanese, 1 = English, 2 = German, 3 = French, 4 = Spanish, 5 = Italian, 6 = Dutch, 7 = Korean
/// </summary>
/// <param name="wadfile"></param>
/// <param name="jap">Japanese Title</param>
/// <param name="eng">English Title</param>
/// <param name="ger">German Title</param>
/// <param name="fra">French Title</param>
/// <param name="spa">Spanish Title</param>
/// <param name="ita">Italian Title</param>
/// <param name="dut">Dutch Title</param>
/// <returns></returns>
public static byte[] ChangeChannelTitle(byte[] wadfile, string jap, string eng, string ger, string fra, string spa, string ita, string dut)
public static byte[] ChangeChannelTitle(byte[] wadfile, params string[] titles)
{
if (titles.Length < 7) throw new Exception("A title must be given for each language!");
Tools.ChangeProgress(0);
char[] japchars = jap.ToCharArray();
char[] engchars = eng.ToCharArray();
char[] gerchars = ger.ToCharArray();
char[] frachars = fra.ToCharArray();
char[] spachars = spa.ToCharArray();
char[] itachars = ita.ToCharArray();
char[] dutchars = dut.ToCharArray();
char[] japchars = titles[0].ToCharArray();
char[] engchars = titles[1].ToCharArray();
char[] gerchars = titles[2].ToCharArray();
char[] frachars = titles[3].ToCharArray();
char[] spachars = titles[4].ToCharArray();
char[] itachars = titles[5].ToCharArray();
char[] dutchars = titles[6].ToCharArray();
char[] korchars = new char[] { };
if (titles.Length > 7) korchars = titles[7].ToCharArray();
byte[] titlekey = WadInfo.GetTitleKey(wadfile);
string[,] conts = WadInfo.GetContentInfo(wadfile);
@ -1557,6 +1582,12 @@ namespace Wii
contenthandle[x + 29 + 84 * 6 - 1] = BitConverter.GetBytes(dutchars[count])[1];
}
else { contenthandle[x + 29 + 84 * 6] = 0x00; contenthandle[x + 29 + 84 * 6 - 1] = 0x00; }
if (korchars.Length > count)
{
contenthandle[x + 29 + 84 * 9] = BitConverter.GetBytes(korchars[count])[0];
contenthandle[x + 29 + 84 * 9 - 1] = BitConverter.GetBytes(korchars[count])[1];
}
else { contenthandle[x + 29 + 84 * 9] = 0x00; contenthandle[x + 29 + 84 * 9 - 1] = 0x00; }
count++;
}
@ -1576,6 +1607,7 @@ namespace Wii
wadfile[contentpos + y] = contenthandle[y];
}
Tools.ChangeProgress(80);
//SHA1 in TMD
byte[] tmd = Tools.GetPartOfByteArray(wadfile, tmdpos, tmdsize);
for (int i = 0; i < 20; i++)
@ -1583,55 +1615,6 @@ namespace Wii
TruchaSign(tmd, 1);
wadfile = Tools.InsertByteArray(wadfile, tmd, tmdpos);
int footer = WadInfo.GetFooterSize(wadfile);
Tools.ChangeProgress(80);
if (footer > 0)
{
int footerpos = wadfile.Length - footer;
int imetposfoot = 0;
for (int z = 0; z < 200; z++)
{
if (Convert.ToChar(wadfile[footerpos + z]) == 'I')
if (Convert.ToChar(wadfile[footerpos + z + 1]) == 'M')
if (Convert.ToChar(wadfile[footerpos + z + 2]) == 'E')
if (Convert.ToChar(wadfile[footerpos + z + 3]) == 'T')
{
imetposfoot = footerpos + z;
break;
}
}
Tools.ChangeProgress(90);
int count2 = 0;
for (int x = imetposfoot; x < imetposfoot + 40; x += 2)
{
if (japchars.Length > count2) { wadfile[x + 29] = Convert.ToByte(japchars[count2]); }
else { wadfile[x + 29] = 0x00; }
if (engchars.Length > count2) { wadfile[x + 29 + 84] = Convert.ToByte(engchars[count2]); }
else { wadfile[x + 29 + 84] = 0x00; }
if (gerchars.Length > count2) { wadfile[x + 29 + 84 * 2] = Convert.ToByte(gerchars[count2]); }
else { wadfile[x + 29 + 84 * 2] = 0x00; }
if (frachars.Length > count2) { wadfile[x + 29 + 84 * 3] = Convert.ToByte(frachars[count2]); }
else { wadfile[x + 29 + 84 * 3] = 0x00; }
if (spachars.Length > count2) { wadfile[x + 29 + 84 * 4] = Convert.ToByte(spachars[count2]); }
else { wadfile[x + 29 + 84 * 4] = 0x00; }
if (itachars.Length > count2) { wadfile[x + 29 + 84 * 5] = Convert.ToByte(itachars[count2]); }
else { wadfile[x + 29 + 84 * 5] = 0x00; }
if (dutchars.Length > count2) { wadfile[x + 29 + 84 * 6] = Convert.ToByte(dutchars[count2]); }
else { wadfile[x + 29 + 84 * 6] = 0x00; }
count2++;
}
for (int i = 0; i < 16; i++)
wadfile[imetposfoot + 1456 + i] = newmd5[i];
}
Tools.ChangeProgress(100);
return wadfile;
}
@ -1797,8 +1780,8 @@ namespace Wii
public static byte[] TruchaSign(byte[] wadtiktmd, int type)
{
SHA1Managed sha = new SHA1Managed();
int[] position = new int[2] { 0x1f1, 0x1d4 }; //0x104 0x1c1
int[] tosign = new int[2] { 0x140, 0x140 }; //0x104 0x140
int[] position = new int[2] { 0x1f2, 0x1d4 };
int[] tosign = new int[2] { 0x140, 0x140 };
int tiktmdpos = 0;
int tiktmdsize = wadtiktmd.Length;
@ -2338,6 +2321,34 @@ namespace Wii
return decryptedkey;
}
/// <summary>
/// Changes the IOS flag (IOS used to launch the title)
/// </summary>
/// <param name="wadtmd"></param>
/// <returns></returns>
public static void ChangeIosFlag(string wadtmd, int newIos)
{
if (newIos < 0 || newIos > 255) throw new Exception("IOS must be between 0 and 255!");
Tools.SaveFileFromByteArray(ChangeIosFlag(Tools.LoadFileToByteArray(wadtmd), newIos), wadtmd);
}
/// <summary>
/// Changes the IOS flag (IOS used to launch the title)
/// </summary>
/// <param name="wadtmd"></param>
/// <returns></returns>
public static byte[] ChangeIosFlag(byte[] wadtmd, int newIos)
{
if (newIos < 0 || newIos > 255) throw new Exception("IOS must be between 0 and 255!");
int tmdpos = 0;
if (WadInfo.IsThisWad(wadtmd)) tmdpos = WadInfo.GetTmdPos(wadtmd);
wadtmd[tmdpos + 395] = (byte)newIos;
return wadtmd;
}
}
public class WadUnpack
@ -2864,7 +2875,7 @@ namespace Wii
//Write Footer Timestamp
byte[] footer = Tools.GetTimestamp();
Array.Resize(ref footer, Tools.AddPadding(footer.Length, 16));
Array.Resize(ref footer, Tools.AddPadding(footer.Length));
int footerLength = footer.Length;
wadstream.Seek(Tools.AddPadding(contpos), SeekOrigin.Begin);
@ -3244,6 +3255,7 @@ namespace Wii
byte[] spatitle = new byte[84];
byte[] itatitle = new byte[84];
byte[] duttitle = new byte[84];
byte[] kortitle = new byte[84];
for (int i = 0; i < 20; i++)
{
@ -3282,6 +3294,14 @@ namespace Wii
duttitle[i * 2] = BitConverter.GetBytes(channeltitles[6][i])[1];
duttitle[i * 2 + 1] = BitConverter.GetBytes(channeltitles[6][i])[0];
}
if (channeltitles.Length > 7)
{
if (channeltitles[7].Length > i)
{
kortitle[i * 2] = BitConverter.GetBytes(channeltitles[7][i])[1];
kortitle[i * 2 + 1] = BitConverter.GetBytes(channeltitles[7][i])[0];
}
}
}
byte[] crypto = new byte[16];
@ -3302,7 +3322,10 @@ namespace Wii
ms.Write(itatitle, 0, itatitle.Length);
ms.Write(duttitle, 0, duttitle.Length);
ms.Seek(0x348, SeekOrigin.Current);
ms.Seek(0x390, SeekOrigin.Begin);
ms.Write(kortitle, 0, kortitle.Length);
ms.Seek(0x630, SeekOrigin.Begin);
ms.Write(crypto, 0, crypto.Length);
byte[] tohash = ms.ToArray();