CustomizeMii 2.3

This commit is contained in:
leathl 2010-02-24 21:41:37 +00:00
parent 342875a7f5
commit 7f0c3bc9f3
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/>. * 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! //Thanks to Xuzz, SquidMan, megazig, Matt_P, Omega and The Lemon Man, the authors of Wii.py!
using System; using System;

View File

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

View File

@ -197,7 +197,7 @@ namespace CustomizeMii
this.rbFromAudioFile.Name = "rbFromAudioFile"; this.rbFromAudioFile.Name = "rbFromAudioFile";
this.rbFromAudioFile.Size = new System.Drawing.Size(281, 17); this.rbFromAudioFile.Size = new System.Drawing.Size(281, 17);
this.rbFromAudioFile.TabIndex = 0; 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.UseVisualStyleBackColor = true;
this.rbFromAudioFile.CheckedChanged += new System.EventHandler(this.rbSelectionChanged); this.rbFromAudioFile.CheckedChanged += new System.EventHandler(this.rbSelectionChanged);
// //
@ -396,6 +396,7 @@ namespace CustomizeMii
this.AcceptButton = this.btnConvert; this.AcceptButton = this.btnConvert;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.Control;
this.CancelButton = this.btnCancel; this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(674, 230); this.ClientSize = new System.Drawing.Size(674, 230);
this.Controls.Add(this.gbPrelisten); this.Controls.Add(this.gbPrelisten);

View File

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

View File

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

View File

@ -64,6 +64,7 @@ namespace CustomizeMii
this.lbSource = new System.Windows.Forms.Label(); this.lbSource = new System.Windows.Forms.Label();
this.tabTitle = new System.Windows.Forms.TabPage(); this.tabTitle = new System.Windows.Forms.TabPage();
this.llbTranslateChannel = new System.Windows.Forms.LinkLabel(); this.llbTranslateChannel = new System.Windows.Forms.LinkLabel();
this.tbKorean = new System.Windows.Forms.TextBox();
this.tbItalian = new System.Windows.Forms.TextBox(); this.tbItalian = new System.Windows.Forms.TextBox();
this.tbFrench = new System.Windows.Forms.TextBox(); this.tbFrench = new System.Windows.Forms.TextBox();
this.tbJapanese = 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.tbGerman = new System.Windows.Forms.TextBox();
this.tbEnglish = new System.Windows.Forms.TextBox(); this.tbEnglish = new System.Windows.Forms.TextBox();
this.lbDutch = new System.Windows.Forms.Label(); this.lbDutch = new System.Windows.Forms.Label();
this.lbKorean = new System.Windows.Forms.Label();
this.lbItalian = new System.Windows.Forms.Label(); this.lbItalian = new System.Windows.Forms.Label();
this.lbSpanish = new System.Windows.Forms.Label(); this.lbSpanish = new System.Windows.Forms.Label();
this.lbFrench = 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.cmbNandLoader = new System.Windows.Forms.ComboBox();
this.btnBrowseDol = new System.Windows.Forms.Button(); this.btnBrowseDol = new System.Windows.Forms.Button();
this.tbDol = new System.Windows.Forms.TextBox(); this.tbDol = new System.Windows.Forms.TextBox();
this.tbStartupIos = new System.Windows.Forms.TextBox();
this.tbTitleID = new System.Windows.Forms.TextBox(); this.tbTitleID = new System.Windows.Forms.TextBox();
this.lbNewSound = new System.Windows.Forms.Label(); this.lbNewSound = new System.Windows.Forms.Label();
this.lbNandLoader = new System.Windows.Forms.Label(); this.lbNandLoader = new System.Windows.Forms.Label();
this.lbNewDol = 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.lbTitleID = new System.Windows.Forms.Label();
this.tabBanner = new System.Windows.Forms.TabPage(); this.tabBanner = new System.Windows.Forms.TabPage();
this.llbBannerMultiReplace = new System.Windows.Forms.LinkLabel();
this.cbBannerMakeTransparent = new System.Windows.Forms.CheckBox(); this.cbBannerMakeTransparent = new System.Windows.Forms.CheckBox();
this.cmbFormatBanner = new System.Windows.Forms.ComboBox(); this.cmbFormatBanner = new System.Windows.Forms.ComboBox();
this.lbFormatBanner = new System.Windows.Forms.Label(); this.lbFormatBanner = new System.Windows.Forms.Label();
@ -108,6 +113,7 @@ namespace CustomizeMii
this.btnReplaceBanner = new System.Windows.Forms.Button(); this.btnReplaceBanner = new System.Windows.Forms.Button();
this.lbxBannerTpls = new System.Windows.Forms.ListBox(); this.lbxBannerTpls = new System.Windows.Forms.ListBox();
this.tabIcon = new System.Windows.Forms.TabPage(); this.tabIcon = new System.Windows.Forms.TabPage();
this.llbIconMultiReplace = new System.Windows.Forms.LinkLabel();
this.cbIconMakeTransparent = new System.Windows.Forms.CheckBox(); this.cbIconMakeTransparent = new System.Windows.Forms.CheckBox();
this.cmbFormatIcon = new System.Windows.Forms.ComboBox(); this.cmbFormatIcon = new System.Windows.Forms.ComboBox();
this.lbFormatIcon = new System.Windows.Forms.Label(); this.lbFormatIcon = new System.Windows.Forms.Label();
@ -383,6 +389,7 @@ namespace CustomizeMii
// tabTitle // tabTitle
// //
this.tabTitle.Controls.Add(this.llbTranslateChannel); this.tabTitle.Controls.Add(this.llbTranslateChannel);
this.tabTitle.Controls.Add(this.tbKorean);
this.tabTitle.Controls.Add(this.tbItalian); this.tabTitle.Controls.Add(this.tbItalian);
this.tabTitle.Controls.Add(this.tbFrench); this.tabTitle.Controls.Add(this.tbFrench);
this.tabTitle.Controls.Add(this.tbJapanese); this.tabTitle.Controls.Add(this.tbJapanese);
@ -391,6 +398,7 @@ namespace CustomizeMii
this.tabTitle.Controls.Add(this.tbGerman); this.tabTitle.Controls.Add(this.tbGerman);
this.tabTitle.Controls.Add(this.tbEnglish); this.tabTitle.Controls.Add(this.tbEnglish);
this.tabTitle.Controls.Add(this.lbDutch); this.tabTitle.Controls.Add(this.lbDutch);
this.tabTitle.Controls.Add(this.lbKorean);
this.tabTitle.Controls.Add(this.lbItalian); this.tabTitle.Controls.Add(this.lbItalian);
this.tabTitle.Controls.Add(this.lbSpanish); this.tabTitle.Controls.Add(this.lbSpanish);
this.tabTitle.Controls.Add(this.lbFrench); this.tabTitle.Controls.Add(this.lbFrench);
@ -420,6 +428,14 @@ namespace CustomizeMii
this.llbTranslateChannel.Text = "Translate \"Channel\""; this.llbTranslateChannel.Text = "Translate \"Channel\"";
this.llbTranslateChannel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.llbTranslateChannel_LinkClicked); 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 // tbItalian
// //
this.tbItalian.Location = new System.Drawing.Point(301, 143); this.tbItalian.Location = new System.Drawing.Point(301, 143);
@ -485,6 +501,15 @@ namespace CustomizeMii
this.lbDutch.TabIndex = 9; this.lbDutch.TabIndex = 9;
this.lbDutch.Text = "Dutch:"; 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 // lbItalian
// //
this.lbItalian.AutoSize = true; this.lbItalian.AutoSize = true;
@ -578,10 +603,12 @@ namespace CustomizeMii
this.tabOptions.Controls.Add(this.cmbNandLoader); this.tabOptions.Controls.Add(this.cmbNandLoader);
this.tabOptions.Controls.Add(this.btnBrowseDol); this.tabOptions.Controls.Add(this.btnBrowseDol);
this.tabOptions.Controls.Add(this.tbDol); this.tabOptions.Controls.Add(this.tbDol);
this.tabOptions.Controls.Add(this.tbStartupIos);
this.tabOptions.Controls.Add(this.tbTitleID); this.tabOptions.Controls.Add(this.tbTitleID);
this.tabOptions.Controls.Add(this.lbNewSound); this.tabOptions.Controls.Add(this.lbNewSound);
this.tabOptions.Controls.Add(this.lbNandLoader); this.tabOptions.Controls.Add(this.lbNandLoader);
this.tabOptions.Controls.Add(this.lbNewDol); this.tabOptions.Controls.Add(this.lbNewDol);
this.tabOptions.Controls.Add(this.lbStartupIos);
this.tabOptions.Controls.Add(this.lbTitleID); this.tabOptions.Controls.Add(this.lbTitleID);
this.tabOptions.Location = new System.Drawing.Point(4, 22); this.tabOptions.Location = new System.Drawing.Point(4, 22);
this.tabOptions.Name = "tabOptions"; this.tabOptions.Name = "tabOptions";
@ -700,6 +727,16 @@ namespace CustomizeMii
this.tbDol.DragDrop += new System.Windows.Forms.DragEventHandler(this.tbDol_DragDrop); this.tbDol.DragDrop += new System.Windows.Forms.DragEventHandler(this.tbDol_DragDrop);
this.tbDol.DragEnter += new System.Windows.Forms.DragEventHandler(this.tbDol_DragEnter); 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 // tbTitleID
// //
this.tbTitleID.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper; this.tbTitleID.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
@ -736,6 +773,15 @@ namespace CustomizeMii
this.lbNewDol.TabIndex = 1; this.lbNewDol.TabIndex = 1;
this.lbNewDol.Text = "New DOL:"; 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 // lbTitleID
// //
this.lbTitleID.AutoSize = true; this.lbTitleID.AutoSize = true;
@ -747,6 +793,7 @@ namespace CustomizeMii
// //
// tabBanner // tabBanner
// //
this.tabBanner.Controls.Add(this.llbBannerMultiReplace);
this.tabBanner.Controls.Add(this.cbBannerMakeTransparent); this.tabBanner.Controls.Add(this.cbBannerMakeTransparent);
this.tabBanner.Controls.Add(this.cmbFormatBanner); this.tabBanner.Controls.Add(this.cmbFormatBanner);
this.tabBanner.Controls.Add(this.lbFormatBanner); this.tabBanner.Controls.Add(this.lbFormatBanner);
@ -764,6 +811,17 @@ namespace CustomizeMii
this.tabBanner.Text = "Banner"; this.tabBanner.Text = "Banner";
this.tabBanner.UseVisualStyleBackColor = true; 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 // cbBannerMakeTransparent
// //
this.cbBannerMakeTransparent.AutoSize = true; this.cbBannerMakeTransparent.AutoSize = true;
@ -870,6 +928,7 @@ namespace CustomizeMii
// //
// tabIcon // tabIcon
// //
this.tabIcon.Controls.Add(this.llbIconMultiReplace);
this.tabIcon.Controls.Add(this.cbIconMakeTransparent); this.tabIcon.Controls.Add(this.cbIconMakeTransparent);
this.tabIcon.Controls.Add(this.cmbFormatIcon); this.tabIcon.Controls.Add(this.cmbFormatIcon);
this.tabIcon.Controls.Add(this.lbFormatIcon); this.tabIcon.Controls.Add(this.lbFormatIcon);
@ -887,6 +946,17 @@ namespace CustomizeMii
this.tabIcon.Text = "Icon"; this.tabIcon.Text = "Icon";
this.tabIcon.UseVisualStyleBackColor = true; 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 // cbIconMakeTransparent
// //
this.cbIconMakeTransparent.AutoSize = true; this.cbIconMakeTransparent.AutoSize = true;
@ -1710,6 +1780,12 @@ namespace CustomizeMii
private System.Windows.Forms.ToolStripMenuItem cmExtractBrlan; private System.Windows.Forms.ToolStripMenuItem cmExtractBrlan;
private System.Windows.Forms.ToolStripMenuItem cmExtractBothBrl; private System.Windows.Forms.ToolStripMenuItem cmExtractBothBrl;
private System.Windows.Forms.LinkLabel llbTranslateChannel; 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 public partial class CustomizeMii_Main : Form
{ {
#region Constants #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 SoundMaxLength = 30; //In seconds
const int SoundWarningLength = 20; //In seconds const int SoundWarningLength = 20; //In seconds
const int BnsWarningLength = 45; //In seconds const int BnsWarningLength = 45; //In seconds
@ -92,26 +92,30 @@ namespace CustomizeMii
private void CustomizeMii_Main_Load(object sender, EventArgs e) private void CustomizeMii_Main_Load(object sender, EventArgs e)
{ {
MethodInvoker Update = new MethodInvoker(UpdateCheck);
UpdatePaths();
Update.BeginInvoke(null, null);
#if !Mono #if !Mono
MethodInvoker FUpdate = new MethodInvoker(UpdateCheckForwardMii); this.Text = this.Text.Replace("X", version);
FUpdate.BeginInvoke(null, null); this.lbCreditVersion.Text = this.lbCreditVersion.Text.Replace("X", version);
CommonKeyCheck(); CommonKeyCheck();
#endif #endif
InitializeStartup();
#if Mono #if Mono
this.Text = this.Text.Replace("X", version + " (Mono)");
this.lbCreditVersion.Text = this.lbCreditVersion.Text.Replace("X", version + " (Mono)");
Mono = true; Mono = true;
//TextBox.MaxLength is not implemented in Mono, so don't use it //TextBox.MaxLength is not implemented in Mono, so don't use it
for (int i = 0; i < tabControl.TabPages.Count; i++) for (int i = 0; i < tabControl.TabPages.Count; i++)
for(int j=0;j<tabControl.TabPages[i].Controls.Count;j++) 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; if (tabControl.TabPages[i].Controls[j] is TextBox) ((TextBox)tabControl.TabPages[i].Controls[j]).MaxLength = 32000;
#endif #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) private void CustomizeMii_Main_FormClosing(object sender, FormClosingEventArgs e)
@ -148,11 +152,6 @@ namespace CustomizeMii
private void InitializeStartup() 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); if (Directory.Exists(TempPath)) Directory.Delete(TempPath, true);
ProgressUpdate = new EventHandler(this.UpdateProgress); ProgressUpdate = new EventHandler(this.UpdateProgress);
btnBrowseSource.Text = "Browse..."; btnBrowseSource.Text = "Browse...";
@ -224,12 +223,14 @@ namespace CustomizeMii
tbFrench.Text = string.Empty; tbFrench.Text = string.Empty;
tbGerman.Text = string.Empty; tbGerman.Text = string.Empty;
tbItalian.Text = string.Empty; tbItalian.Text = string.Empty;
tbKorean.Text = string.Empty;
tbJapanese.Text = string.Empty; tbJapanese.Text = string.Empty;
tbReplace.Text = string.Empty; tbReplace.Text = string.Empty;
tbSound.Text = string.Empty; tbSound.Text = string.Empty;
tbSourceWad.Text = string.Empty; tbSourceWad.Text = string.Empty;
tbSpanish.Text = string.Empty; tbSpanish.Text = string.Empty;
tbTitleID.Text = string.Empty; tbTitleID.Text = string.Empty;
tbStartupIos.Text = string.Empty;
BannerReplace = string.Empty; BannerReplace = string.Empty;
IconReplace = string.Empty; IconReplace = string.Empty;
@ -560,41 +561,6 @@ namespace CustomizeMii
{ {
return ForwardMii_Plugin.GetVersion(); 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 #endif
private void llbSite_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) private void llbSite_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
@ -895,7 +861,7 @@ namespace CustomizeMii
cbBannerMakeTransparent.Enabled = true; cbBannerMakeTransparent.Enabled = true;
cbBannerMakeTransparent.Checked = lbxBannerTpls.SelectedItem.ToString().EndsWith("(Transparent)"); 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); int TplFormat = Wii.TPL.GetTextureFormat(TplFile);
switch (TplFormat) switch (TplFormat)
@ -956,7 +922,7 @@ namespace CustomizeMii
cbIconMakeTransparent.Enabled = true; cbIconMakeTransparent.Enabled = true;
cbIconMakeTransparent.Checked = lbxIconTpls.SelectedItem.ToString().EndsWith("(Transparent)"); 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); int TplFormat = Wii.TPL.GetTextureFormat(TplFile);
switch (TplFormat) switch (TplFormat)
@ -1024,7 +990,7 @@ namespace CustomizeMii
{ {
try 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); byte[] TplArray = Wii.Tools.LoadFileToByteArray(Tpl);
Image Img; Image Img;
@ -1085,7 +1051,7 @@ namespace CustomizeMii
{ {
if (lbxBannerTpls.SelectedIndex != -1) 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); int format = Wii.TPL.GetTextureFormat(Tpl);
if (format == 8 || format == 9 || format == 10) { ErrorBox("This format is not supported!"); return; } if (format == 8 || format == 9 || format == 10) { ErrorBox("This format is not supported!"); return; }
@ -1138,7 +1104,7 @@ namespace CustomizeMii
try try
{ {
CustomizeMii_Preview pvw = new CustomizeMii_Preview(); 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.ShowDialog();
pvw = null; pvw = null;
} }
@ -1167,7 +1133,7 @@ namespace CustomizeMii
{ {
try 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); byte[] TplArray = Wii.Tools.LoadFileToByteArray(Tpl);
Image Img; Image Img;
@ -1228,7 +1194,7 @@ namespace CustomizeMii
{ {
if (lbxIconTpls.SelectedIndex != -1) 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); int format = Wii.TPL.GetTextureFormat(Tpl);
if (format == 8 || format == 9 || format == 10) { ErrorBox("This format is not supported!"); return; } 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(); CustomizeMii_Preview pvw = new CustomizeMii_Preview();
pvw.startIcon = true; 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.ShowDialog();
pvw = null; 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) private void btnCreateWad_Click(object sender, EventArgs e)
{ {
Point mousePos = MousePosition; Point mousePos = MousePosition;
if (mousePos.X < (this.Location.X + btnCreateWad.Location.X + Math.Ceiling(separatorBtn) + 3)) if (mousePos.X < (this.Location.X + btnCreateWad.Location.X + Math.Ceiling(separatorBtn) + 3))
{ {
//SEND WAD
if (pbProgress.Value == 100) if (pbProgress.Value == 100)
{ {
if (!string.IsNullOrEmpty(tbSourceWad.Text)) if (!string.IsNullOrEmpty(tbSourceWad.Text))
@ -1668,6 +1313,7 @@ namespace CustomizeMii
} }
else else
{ {
//CREATE WAD
if (pbProgress.Value == 100) if (pbProgress.Value == 100)
{ {
if (!string.IsNullOrEmpty(tbSourceWad.Text)) if (!string.IsNullOrEmpty(tbSourceWad.Text))
@ -1690,6 +1336,14 @@ namespace CustomizeMii
CreationTimer.Start(); CreationTimer.Start();
WadCreationInfo wadInfo = new WadCreationInfo(); 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.outFile = sfd.FileName;
wadInfo.nandLoader = (WadCreationInfo.NandLoader)cmbNandLoader.SelectedIndex; wadInfo.nandLoader = (WadCreationInfo.NandLoader)cmbNandLoader.SelectedIndex;
@ -1699,6 +1353,8 @@ namespace CustomizeMii
bwCreateWad.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bwCreateWad_RunWorkerCompleted); bwCreateWad.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bwCreateWad_RunWorkerCompleted);
bwCreateWad.WorkerReportsProgress = true; bwCreateWad.WorkerReportsProgress = true;
bwCreateWad.RunWorkerAsync(wadInfo); bwCreateWad.RunWorkerAsync(wadInfo);
return;
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -1709,6 +1365,10 @@ namespace CustomizeMii
} }
} }
} }
currentProgress.progressValue = 100;
currentProgress.progressState = " ";
this.Invoke(ProgressUpdate);
} }
} }
@ -2052,7 +1712,7 @@ namespace CustomizeMii
try 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 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"); 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 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 CurIconPath = GetCurIconPath();
string[] brlytTpls = Wii.Brlyt.GetBrlytTpls(CurIconPath + "blyt\\icon.brlyt", CurIconPath + "anim\\icon.brlan"); 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)")) 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.Remove(lbxBannerTpls.SelectedItem);
lbxBannerTpls.Items.Add(thisItem + " (Transparent)"); lbxBannerTpls.Items.Add(thisItem + " (Transparent)");
lbxBannerTpls.SelectedItem = thisItem + " (Transparent)"; lbxBannerTpls.SelectedItem = thisItem + " (Transparent)";
BannerTransparents.Add(thisItem); BannerTransparents.Add(thisItem.Remove(thisItem.IndexOf('(', 0) - 1));
} }
} }
catch { } catch { }
@ -2178,11 +1838,11 @@ namespace CustomizeMii
{ {
try try
{ {
string thisItem = lbxBannerTpls.SelectedItem.ToString().Replace(" (Transparent)", string.Empty); string thisItem = lbxBannerTpls.SelectedItem.ToString();
lbxBannerTpls.Items.Remove(lbxBannerTpls.SelectedItem); lbxBannerTpls.Items.Remove(lbxBannerTpls.SelectedItem);
lbxBannerTpls.Items.Add(thisItem.Replace(" (Transparent)", string.Empty)); lbxBannerTpls.Items.Add(thisItem.Replace(" (Transparent)", string.Empty));
lbxBannerTpls.SelectedItem = 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 { } catch { }
} }
@ -2201,11 +1861,11 @@ namespace CustomizeMii
{ {
if (!lbxIconTpls.SelectedItem.ToString().EndsWith("(Transparent)")) 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.Remove(lbxIconTpls.SelectedItem);
lbxIconTpls.Items.Add(thisItem + " (Transparent)"); lbxIconTpls.Items.Add(thisItem + " (Transparent)");
lbxIconTpls.SelectedItem = thisItem + " (Transparent)"; lbxIconTpls.SelectedItem = thisItem + " (Transparent)";
IconTransparents.Add(thisItem); IconTransparents.Add(thisItem.Remove(thisItem.IndexOf('(', 0) - 1));
} }
} }
catch { } catch { }
@ -2214,11 +1874,11 @@ namespace CustomizeMii
{ {
try try
{ {
string thisItem = lbxIconTpls.SelectedItem.ToString().Replace(" (Transparent)", string.Empty); string thisItem = lbxIconTpls.SelectedItem.ToString();
lbxIconTpls.Items.Remove(lbxIconTpls.SelectedItem); lbxIconTpls.Items.Remove(lbxIconTpls.SelectedItem);
lbxIconTpls.Items.Add(thisItem.Replace(" (Transparent)", string.Empty)); lbxIconTpls.Items.Add(thisItem.Replace(" (Transparent)", string.Empty));
lbxIconTpls.SelectedItem = 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 { } catch { }
} }
@ -2257,6 +1917,7 @@ namespace CustomizeMii
private void cmForwarderItem_Click(object sender, EventArgs e) private void cmForwarderItem_Click(object sender, EventArgs e)
{ {
#if !Mono
ToolStripMenuItem cmSender = sender as ToolStripMenuItem; ToolStripMenuItem cmSender = sender as ToolStripMenuItem;
if (cmSender == cmSimpleForwarder) if (cmSender == cmSimpleForwarder)
@ -2280,6 +1941,7 @@ namespace CustomizeMii
ErrorBox(ex.Message); ErrorBox(ex.Message);
} }
} }
#endif
} }
private void btnOptionsExtract_Click(object sender, EventArgs e) private void btnOptionsExtract_Click(object sender, EventArgs e)
@ -2687,6 +2349,7 @@ namespace CustomizeMii
tbJapanese.Text = tempText.Remove(startIndex, 7).Insert(startIndex, "チャンネル"); tbJapanese.Text = tempText.Remove(startIndex, 7).Insert(startIndex, "チャンネル");
tbGerman.Text = tempText.Remove(startIndex, 7).Insert(startIndex, "Kanal"); tbGerman.Text = tempText.Remove(startIndex, 7).Insert(startIndex, "Kanal");
tbDutch.Text = tempText.Remove(startIndex, 7).Insert(startIndex, "Kanaal"); tbDutch.Text = tempText.Remove(startIndex, 7).Insert(startIndex, "Kanaal");
tbKorean.Text = tempText.Remove(startIndex, 7).Insert(startIndex, "채널");
try try
{ {
@ -2720,6 +2383,7 @@ namespace CustomizeMii
tbSpanish.Text = string.Empty; tbSpanish.Text = string.Empty;
tbItalian.Text = string.Empty; tbItalian.Text = string.Empty;
tbDutch.Text = string.Empty; tbDutch.Text = string.Empty;
tbKorean.Text = string.Empty;
ErrorBox(ex.Message); ErrorBox(ex.Message);
} }
@ -2729,5 +2393,15 @@ namespace CustomizeMii
{ {
llbTranslateChannel.Enabled = tbAllLanguages.Text.ToLower().Contains("channel"); 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 Xuzz for his idea and hard work
WiiCrazy / I.R.on for CustomizeMii Installer WiiCrazy / I.R.on for CustomizeMii Installer
Xuzz, SquidMan, megazig, Matt_P, Omega and The Lemon Man for Wii.py Xuzz, SquidMan, megazig, Matt_P, Omega and The Lemon Man for Wii.py
megazig for his BNS conversion code
SquidMan for Zetsubou SquidMan for Zetsubou
Andre Perrot for gbalzss Andre Perrot for gbalzss
comex and Waninkoko for both their NAND Loader comex and Waninkoko for both their NAND Loader

View File

@ -150,6 +150,8 @@ namespace CustomizeMii
images[0, cbBanner.SelectedIndex].tplFormat.ToLower() == "ci14x2") images[0, cbBanner.SelectedIndex].tplFormat.ToLower() == "ci14x2")
lbNoPreview.Visible = true; lbNoPreview.Visible = true;
else lbNoPreview.Visible = false; else lbNoPreview.Visible = false;
cbIcon.SelectedIndex = -1;
} }
} }
@ -195,6 +197,8 @@ namespace CustomizeMii
images[1, cbIcon.SelectedIndex].tplFormat.ToLower() == "ci14x2") images[1, cbIcon.SelectedIndex].tplFormat.ToLower() == "ci14x2")
lbNoPreview.Visible = true; lbNoPreview.Visible = true;
else lbNoPreview.Visible = false; 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 SetLabelInvoker(string text, Label lb);
private delegate void SetButtonInvoker(string text, Button btn); 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() private bool FailureCheck()
{ {
try try
@ -86,6 +408,17 @@ namespace CustomizeMii
ErrorBox("Please enter a valid Title ID!"); return false; 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 //Check brlan files
string[] ValidBrlans = new string[] { "banner.brlan", "icon.brlan", "banner_loop.brlan", "icon_loop.brlan", "banner_start.brlan", "icon_start.brlan" }; 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) foreach (string thisBrlan in lbxBrlanBanner.Items)
@ -108,8 +441,8 @@ namespace CustomizeMii
//Check TPLs //Check TPLs
List<string> BannerTpls = new List<string>(); List<string> BannerTpls = new List<string>();
List<string> IconTpls = 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 lbxBannerTpls.Items) BannerTpls.Add(thisTpl.Remove(thisTpl.IndexOf('(', 0) - 1));
foreach (string thisTpl in lbxIconTpls.Items) IconTpls.Add(thisTpl.Replace(" (Transparent)", string.Empty)); foreach (string thisTpl in lbxIconTpls.Items) IconTpls.Add(thisTpl.Remove(thisTpl.IndexOf('(', 0) - 1));
string[] BannerBrlytPath; string[] BannerBrlytPath;
string[] BannerBrlanPath; string[] BannerBrlanPath;
@ -477,9 +810,11 @@ namespace CustomizeMii
for (int i = 0; i < tpls.Length; i++) for (int i = 0; i < tpls.Length; i++)
{ {
if (BannerTransparents.Contains(tpls[i].Remove(0, tpls[i].LastIndexOf('\\') + 1))) 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 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++) for (int i = 0; i < tpls.Length; i++)
{ {
if (IconTransparents.Contains(tpls[i].Remove(0, tpls[i].LastIndexOf('\\') + 1))) 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 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)")) 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); byte[] TplArray = Wii.Tools.LoadFileToByteArray(Tpl);
int Width = Wii.TPL.GetTextureWidth(TplArray); int Width = Wii.TPL.GetTextureWidth(TplArray);
int Height = Wii.TPL.GetTextureHeight(TplArray); int Height = Wii.TPL.GetTextureHeight(TplArray);
@ -658,7 +995,7 @@ namespace CustomizeMii
{ {
if (thisTpl.EndsWith("(Transparent)")) 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); byte[] TplArray = Wii.Tools.LoadFileToByteArray(Tpl);
int Width = Wii.TPL.GetTextureWidth(TplArray); int Width = Wii.TPL.GetTextureWidth(TplArray);
int Height = Wii.TPL.GetTextureHeight(TplArray); int Height = Wii.TPL.GetTextureHeight(TplArray);
@ -751,7 +1088,7 @@ namespace CustomizeMii
using (Image img = Image.FromFile(inputFile)) using (Image img = Image.FromFile(inputFile))
{ {
Wii.TPL.ConvertToTPL(img, CurPath + "timg\\" + TplName, TplFormat); 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 Waninkoko = 1
} }
public string titleId;
public string[] titles;
public string allLangTitle;
public int requiredIos;
public string sound;
public string dol;
public string outFile; public string outFile;
public NandLoader nandLoader; public NandLoader nandLoader;
public bool sendToWii; public bool sendToWii;

View File

@ -135,6 +135,7 @@ namespace CustomizeMii
this.AcceptButton = this.btnTransmit; this.AcceptButton = this.btnTransmit;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.Control;
this.CancelButton = this.btnCancel; this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(273, 145); this.ClientSize = new System.Drawing.Size(273, 145);
this.Controls.Add(this.btnCancel); 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 // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben: // übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.2.0.0")] [assembly: AssemblyVersion("2.3.0.0")]
[assembly: AssemblyFileVersion("2.2.0.0")] [assembly: AssemblyFileVersion("2.3.0.0")]
[assembly: NeutralResourcesLanguageAttribute("en")] [assembly: NeutralResourcesLanguageAttribute("en")]

View File

@ -9,6 +9,13 @@ Thanks to icefire / Xuzz for the basic idea of this Application!
----------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------
Changelog: 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 Version 2.2
- Fixed some bugs with the preview window - Fixed some bugs with the preview window
- Fixed Complex Forwarder in combination with Waninkoko's NAND Loader - Fixed Complex Forwarder in combination with Waninkoko's NAND Loader
@ -89,11 +96,12 @@ Thanks:
Xuzz for his idea and hard work Xuzz for his idea and hard work
WiiCrazy / I.R.on for CustomizeMii Installer WiiCrazy / I.R.on for CustomizeMii Installer
Xuzz, SquidMan, megazig, Matt_P, Omega and The Lemon Man for Wii.py Xuzz, SquidMan, megazig, Matt_P, Omega and The Lemon Man for Wii.py
megazig for his BNS conversion code
SquidMan for Zetsubou SquidMan for Zetsubou
Andre Perrot for gbalzss Andre Perrot for gbalzss
comex and Waninkoko for both their NAND Loader comex and Waninkoko for both their NAND Loader
djdynamite123 for the forwarder base files (ForwardMii-Plugin) djdynamite123 for the forwarder base files
The USB Loader GX Team for their forwarder source (ForwardMii-Plugin) 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(); 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; return tikid;
} }
else if (channeltype.Contains("MIOS"))
{
return "MIOS";
}
else if (channeltype.Contains("BC"))
{
return "BC";
}
else if (channeltype.Contains("IOS")) 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")); 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")) if (!channeltype.Contains("Hidden"))
{ {
string[] titles = new string[7]; string[] titles = new string[8];
string[,] conts = GetContentInfo(wadfile); string[,] conts = GetContentInfo(wadfile);
byte[] titlekey = GetTitleKey(wadfile); byte[] titlekey = GetTitleKey(wadfile);
@ -713,6 +721,15 @@ namespace Wii
count++; 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; return titles;
} }
else 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]; titles[i] = titles[0];
return titles; 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> /// <summary>
@ -760,7 +777,7 @@ namespace Wii
/// <returns></returns> /// <returns></returns>
public static string[] GetChannelTitlesFromApp(byte[] app) public static string[] GetChannelTitlesFromApp(byte[] app)
{ {
string[] titles = new string[7]; string[] titles = new string[8];
int imetpos = 0; int imetpos = 0;
int length = 400; int length = 400;
@ -797,6 +814,15 @@ namespace Wii
count++; 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; return titles;
@ -1418,12 +1444,13 @@ namespace Wii
/// <returns></returns> /// <returns></returns>
public static byte[] ChangeChannelTitle(byte[] wadfile, string title) 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> /// <summary>
/// Changes the Channel Title of the wad file /// Changes the Channel Title of the wad file.
/// Each language has a specific title /// Each language has a specific title.
/// 0 = Japanese, 1 = English, 2 = German, 3 = French, 4 = Spanish, 5 = Italian, 6 = Dutch, 7 = Korean
/// </summary> /// </summary>
/// <param name="wadfile"></param> /// <param name="wadfile"></param>
/// <param name="jap"></param> /// <param name="jap"></param>
@ -1433,10 +1460,10 @@ namespace Wii
/// <param name="spa"></param> /// <param name="spa"></param>
/// <param name="ita"></param> /// <param name="ita"></param>
/// <param name="dut"></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); 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)) using (FileStream fs = new FileStream(wadfile, FileMode.Open, FileAccess.Write))
{ {
@ -1446,29 +1473,27 @@ namespace Wii
} }
/// <summary> /// <summary>
/// Changes the Channel Title of the wad file /// Changes the Channel Title of the wad file.
/// Each language has a specific title /// Each language has a specific title.
/// 0 = Japanese, 1 = English, 2 = German, 3 = French, 4 = Spanish, 5 = Italian, 6 = Dutch, 7 = Korean
/// </summary> /// </summary>
/// <param name="wadfile"></param> /// <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> /// <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); Tools.ChangeProgress(0);
char[] japchars = jap.ToCharArray(); char[] japchars = titles[0].ToCharArray();
char[] engchars = eng.ToCharArray(); char[] engchars = titles[1].ToCharArray();
char[] gerchars = ger.ToCharArray(); char[] gerchars = titles[2].ToCharArray();
char[] frachars = fra.ToCharArray(); char[] frachars = titles[3].ToCharArray();
char[] spachars = spa.ToCharArray(); char[] spachars = titles[4].ToCharArray();
char[] itachars = ita.ToCharArray(); char[] itachars = titles[5].ToCharArray();
char[] dutchars = dut.ToCharArray(); char[] dutchars = titles[6].ToCharArray();
char[] korchars = new char[] { };
if (titles.Length > 7) korchars = titles[7].ToCharArray();
byte[] titlekey = WadInfo.GetTitleKey(wadfile); byte[] titlekey = WadInfo.GetTitleKey(wadfile);
string[,] conts = WadInfo.GetContentInfo(wadfile); string[,] conts = WadInfo.GetContentInfo(wadfile);
@ -1557,6 +1582,12 @@ namespace Wii
contenthandle[x + 29 + 84 * 6 - 1] = BitConverter.GetBytes(dutchars[count])[1]; 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; } 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++; count++;
} }
@ -1576,6 +1607,7 @@ namespace Wii
wadfile[contentpos + y] = contenthandle[y]; wadfile[contentpos + y] = contenthandle[y];
} }
Tools.ChangeProgress(80);
//SHA1 in TMD //SHA1 in TMD
byte[] tmd = Tools.GetPartOfByteArray(wadfile, tmdpos, tmdsize); byte[] tmd = Tools.GetPartOfByteArray(wadfile, tmdpos, tmdsize);
for (int i = 0; i < 20; i++) for (int i = 0; i < 20; i++)
@ -1583,55 +1615,6 @@ namespace Wii
TruchaSign(tmd, 1); TruchaSign(tmd, 1);
wadfile = Tools.InsertByteArray(wadfile, tmd, tmdpos); 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); Tools.ChangeProgress(100);
return wadfile; return wadfile;
} }
@ -1797,8 +1780,8 @@ namespace Wii
public static byte[] TruchaSign(byte[] wadtiktmd, int type) public static byte[] TruchaSign(byte[] wadtiktmd, int type)
{ {
SHA1Managed sha = new SHA1Managed(); SHA1Managed sha = new SHA1Managed();
int[] position = new int[2] { 0x1f1, 0x1d4 }; //0x104 0x1c1 int[] position = new int[2] { 0x1f2, 0x1d4 };
int[] tosign = new int[2] { 0x140, 0x140 }; //0x104 0x140 int[] tosign = new int[2] { 0x140, 0x140 };
int tiktmdpos = 0; int tiktmdpos = 0;
int tiktmdsize = wadtiktmd.Length; int tiktmdsize = wadtiktmd.Length;
@ -2338,6 +2321,34 @@ namespace Wii
return decryptedkey; 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 public class WadUnpack
@ -2864,7 +2875,7 @@ namespace Wii
//Write Footer Timestamp //Write Footer Timestamp
byte[] footer = Tools.GetTimestamp(); 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; int footerLength = footer.Length;
wadstream.Seek(Tools.AddPadding(contpos), SeekOrigin.Begin); wadstream.Seek(Tools.AddPadding(contpos), SeekOrigin.Begin);
@ -3244,6 +3255,7 @@ namespace Wii
byte[] spatitle = new byte[84]; byte[] spatitle = new byte[84];
byte[] itatitle = new byte[84]; byte[] itatitle = new byte[84];
byte[] duttitle = new byte[84]; byte[] duttitle = new byte[84];
byte[] kortitle = new byte[84];
for (int i = 0; i < 20; i++) 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] = BitConverter.GetBytes(channeltitles[6][i])[1];
duttitle[i * 2 + 1] = BitConverter.GetBytes(channeltitles[6][i])[0]; 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]; byte[] crypto = new byte[16];
@ -3302,7 +3322,10 @@ namespace Wii
ms.Write(itatitle, 0, itatitle.Length); ms.Write(itatitle, 0, itatitle.Length);
ms.Write(duttitle, 0, duttitle.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); ms.Write(crypto, 0, crypto.Length);
byte[] tohash = ms.ToArray(); byte[] tohash = ms.ToArray();