git-svn-id: svn://localhost/Users/andi/Downloads/code/trunk@19 eddbe33b-e435-4246-ac25-f5eb65f9a13c
This commit is contained in:
parent
c276e85f01
commit
03ec2dc0d8
@ -76,6 +76,9 @@
|
|||||||
<Compile Include="CustomizeMii_ComplexForwarder.Designer.cs">
|
<Compile Include="CustomizeMii_ComplexForwarder.Designer.cs">
|
||||||
<DependentUpon>CustomizeMii_ComplexForwarder.cs</DependentUpon>
|
<DependentUpon>CustomizeMii_ComplexForwarder.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="CustomizeMii_DragDrop.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
<Compile Include="CustomizeMii_Forwarders.cs" />
|
<Compile Include="CustomizeMii_Forwarders.cs" />
|
||||||
<Compile Include="CustomizeMii_Main.cs">
|
<Compile Include="CustomizeMii_Main.cs">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
@ -89,6 +92,10 @@
|
|||||||
<Compile Include="CustomizeMii_InputBox.Designer.cs">
|
<Compile Include="CustomizeMii_InputBox.Designer.cs">
|
||||||
<DependentUpon>CustomizeMii_InputBox.cs</DependentUpon>
|
<DependentUpon>CustomizeMii_InputBox.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="CustomizeMii_PrivateFunctions.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="MP3Info.cs" />
|
||||||
<Compile Include="Program.cs" />
|
<Compile Include="Program.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<EmbeddedResource Include="CustomizeMii_BnsConvert.resx">
|
<EmbeddedResource Include="CustomizeMii_BnsConvert.resx">
|
||||||
@ -143,7 +150,6 @@
|
|||||||
<Content Include="Instructions.txt" />
|
<Content Include="Instructions.txt" />
|
||||||
<None Include="Resources\btnSend.png" />
|
<None Include="Resources\btnSend.png" />
|
||||||
<None Include="Resources\btnCreate.png" />
|
<None Include="Resources\btnCreate.png" />
|
||||||
<None Include="Resources\btnCreateWad.png" />
|
|
||||||
<None Include="Resources\CustomizeMii.ico" />
|
<None Include="Resources\CustomizeMii.ico" />
|
||||||
<None Include="Resources\Instructions.rtf" />
|
<None Include="Resources\Instructions.rtf" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -473,6 +473,7 @@ namespace CustomizeMii
|
|||||||
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);
|
||||||
|
|
||||||
|
SetText(tbTitleID, TitleID);
|
||||||
SetText(tbAllLanguages, ChannelTitles[1]);
|
SetText(tbAllLanguages, ChannelTitles[1]);
|
||||||
|
|
||||||
if (ChannelTitles[0] != ChannelTitles[1])
|
if (ChannelTitles[0] != ChannelTitles[1])
|
||||||
@ -488,7 +489,18 @@ namespace CustomizeMii
|
|||||||
if (ChannelTitles[6] != ChannelTitles[1])
|
if (ChannelTitles[6] != ChannelTitles[1])
|
||||||
SetText(tbDutch, ChannelTitles[6]);
|
SetText(tbDutch, ChannelTitles[6]);
|
||||||
|
|
||||||
SetText(tbTitleID, TitleID);
|
string[] trailer = Directory.GetFiles(TempUnpackPath, "*.trailer");
|
||||||
|
if (trailer.Length > 0)
|
||||||
|
{
|
||||||
|
DateTime timestamp = Wii.WadInfo.GetCreationTime(trailer[0]);
|
||||||
|
|
||||||
|
if (timestamp > new DateTime(1970, 1, 1))
|
||||||
|
{
|
||||||
|
SetLabel(lbCreatedValue, timestamp.ToString() + " (UTC)");
|
||||||
|
}
|
||||||
|
else SetLabel(lbCreatedValue, "No Timestamp!");
|
||||||
|
}
|
||||||
|
else SetLabel(lbCreatedValue, "No Timestamp!");
|
||||||
|
|
||||||
EventHandler AddBannerTpls = new EventHandler(this.AddBannerTpls);
|
EventHandler AddBannerTpls = new EventHandler(this.AddBannerTpls);
|
||||||
EventHandler AddIconTpls = new EventHandler(this.AddIconTpls);
|
EventHandler AddIconTpls = new EventHandler(this.AddIconTpls);
|
||||||
@ -725,7 +737,7 @@ namespace CustomizeMii
|
|||||||
|
|
||||||
bwCreateWad.ReportProgress(95, "Packing WAD...");
|
bwCreateWad.ReportProgress(95, "Packing WAD...");
|
||||||
if (File.Exists(wadInfo.outFile)) File.Delete(wadInfo.outFile);
|
if (File.Exists(wadInfo.outFile)) File.Delete(wadInfo.outFile);
|
||||||
Wii.WadPack.PackWad(TempUnpackPath, wadInfo.outFile, false);
|
Wii.WadPack.PackWad(TempUnpackPath, wadInfo.outFile);
|
||||||
|
|
||||||
bwCreateWad.ReportProgress(100, " ");
|
bwCreateWad.ReportProgress(100, " ");
|
||||||
CreationTimer.Stop();
|
CreationTimer.Stop();
|
||||||
|
118
CustomizeMii/CustomizeMii_BnsConvert.Designer.cs
generated
118
CustomizeMii/CustomizeMii_BnsConvert.Designer.cs
generated
@ -51,6 +51,8 @@ namespace CustomizeMii
|
|||||||
this.tbAudioFile = new System.Windows.Forms.TextBox();
|
this.tbAudioFile = new System.Windows.Forms.TextBox();
|
||||||
this.btnBrowseAudioFile = new System.Windows.Forms.Button();
|
this.btnBrowseAudioFile = new System.Windows.Forms.Button();
|
||||||
this.gbLoop = new System.Windows.Forms.GroupBox();
|
this.gbLoop = new System.Windows.Forms.GroupBox();
|
||||||
|
this.tbarLoopStartSample = new System.Windows.Forms.TrackBar();
|
||||||
|
this.lbStartSample = new System.Windows.Forms.Label();
|
||||||
this.tbLoopStart = new System.Windows.Forms.TextBox();
|
this.tbLoopStart = new System.Windows.Forms.TextBox();
|
||||||
this.rbEnterManually = new System.Windows.Forms.RadioButton();
|
this.rbEnterManually = new System.Windows.Forms.RadioButton();
|
||||||
this.rbFromAudioFile = new System.Windows.Forms.RadioButton();
|
this.rbFromAudioFile = new System.Windows.Forms.RadioButton();
|
||||||
@ -71,15 +73,20 @@ namespace CustomizeMii
|
|||||||
this.lbSamplerate = new System.Windows.Forms.Label();
|
this.lbSamplerate = new System.Windows.Forms.Label();
|
||||||
this.lbBitdepth = new System.Windows.Forms.Label();
|
this.lbBitdepth = new System.Windows.Forms.Label();
|
||||||
this.cbSourceSound = new System.Windows.Forms.CheckBox();
|
this.cbSourceSound = new System.Windows.Forms.CheckBox();
|
||||||
|
this.gbPrelisten = new System.Windows.Forms.GroupBox();
|
||||||
|
this.label1 = new System.Windows.Forms.Label();
|
||||||
|
this.btnPlay = new System.Windows.Forms.Button();
|
||||||
this.gbLoop.SuspendLayout();
|
this.gbLoop.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.tbarLoopStartSample)).BeginInit();
|
||||||
this.gbWaveInfo.SuspendLayout();
|
this.gbWaveInfo.SuspendLayout();
|
||||||
|
this.gbPrelisten.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// btnCancel
|
// btnCancel
|
||||||
//
|
//
|
||||||
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||||
this.btnCancel.Location = new System.Drawing.Point(186, 179);
|
this.btnCancel.Location = new System.Drawing.Point(186, 189);
|
||||||
this.btnCancel.Name = "btnCancel";
|
this.btnCancel.Name = "btnCancel";
|
||||||
this.btnCancel.Size = new System.Drawing.Size(160, 23);
|
this.btnCancel.Size = new System.Drawing.Size(160, 23);
|
||||||
this.btnCancel.TabIndex = 10;
|
this.btnCancel.TabIndex = 10;
|
||||||
@ -90,7 +97,7 @@ namespace CustomizeMii
|
|||||||
// btnConvert
|
// btnConvert
|
||||||
//
|
//
|
||||||
this.btnConvert.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
this.btnConvert.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
this.btnConvert.Location = new System.Drawing.Point(15, 179);
|
this.btnConvert.Location = new System.Drawing.Point(15, 189);
|
||||||
this.btnConvert.Name = "btnConvert";
|
this.btnConvert.Name = "btnConvert";
|
||||||
this.btnConvert.Size = new System.Drawing.Size(160, 23);
|
this.btnConvert.Size = new System.Drawing.Size(160, 23);
|
||||||
this.btnConvert.TabIndex = 9;
|
this.btnConvert.TabIndex = 9;
|
||||||
@ -127,41 +134,66 @@ namespace CustomizeMii
|
|||||||
//
|
//
|
||||||
// gbLoop
|
// gbLoop
|
||||||
//
|
//
|
||||||
|
this.gbLoop.Controls.Add(this.tbarLoopStartSample);
|
||||||
|
this.gbLoop.Controls.Add(this.lbStartSample);
|
||||||
this.gbLoop.Controls.Add(this.tbLoopStart);
|
this.gbLoop.Controls.Add(this.tbLoopStart);
|
||||||
this.gbLoop.Controls.Add(this.rbEnterManually);
|
this.gbLoop.Controls.Add(this.rbEnterManually);
|
||||||
this.gbLoop.Controls.Add(this.rbFromAudioFile);
|
this.gbLoop.Controls.Add(this.rbFromAudioFile);
|
||||||
this.gbLoop.Controls.Add(this.rbNone);
|
this.gbLoop.Controls.Add(this.rbNone);
|
||||||
this.gbLoop.Location = new System.Drawing.Point(15, 72);
|
this.gbLoop.Location = new System.Drawing.Point(15, 70);
|
||||||
this.gbLoop.Name = "gbLoop";
|
this.gbLoop.Name = "gbLoop";
|
||||||
this.gbLoop.Size = new System.Drawing.Size(331, 94);
|
this.gbLoop.Size = new System.Drawing.Size(331, 113);
|
||||||
this.gbLoop.TabIndex = 14;
|
this.gbLoop.TabIndex = 14;
|
||||||
this.gbLoop.TabStop = false;
|
this.gbLoop.TabStop = false;
|
||||||
this.gbLoop.Text = "Loop";
|
this.gbLoop.Text = "Loop";
|
||||||
//
|
//
|
||||||
|
// tbarLoopStartSample
|
||||||
|
//
|
||||||
|
this.tbarLoopStartSample.Enabled = false;
|
||||||
|
this.tbarLoopStartSample.Location = new System.Drawing.Point(107, 62);
|
||||||
|
this.tbarLoopStartSample.Maximum = 1059620;
|
||||||
|
this.tbarLoopStartSample.Name = "tbarLoopStartSample";
|
||||||
|
this.tbarLoopStartSample.Size = new System.Drawing.Size(142, 45);
|
||||||
|
this.tbarLoopStartSample.TabIndex = 3;
|
||||||
|
this.tbarLoopStartSample.TickStyle = System.Windows.Forms.TickStyle.None;
|
||||||
|
this.tbarLoopStartSample.Scroll += new System.EventHandler(this.tbarLoopStartSample_Scroll);
|
||||||
|
//
|
||||||
|
// lbStartSample
|
||||||
|
//
|
||||||
|
this.lbStartSample.AutoSize = true;
|
||||||
|
this.lbStartSample.Location = new System.Drawing.Point(35, 74);
|
||||||
|
this.lbStartSample.Name = "lbStartSample";
|
||||||
|
this.lbStartSample.Size = new System.Drawing.Size(66, 13);
|
||||||
|
this.lbStartSample.TabIndex = 2;
|
||||||
|
this.lbStartSample.Text = "(startsample)";
|
||||||
|
//
|
||||||
// tbLoopStart
|
// tbLoopStart
|
||||||
//
|
//
|
||||||
this.tbLoopStart.Enabled = false;
|
this.tbLoopStart.Enabled = false;
|
||||||
this.tbLoopStart.Location = new System.Drawing.Point(227, 64);
|
this.tbLoopStart.Location = new System.Drawing.Point(256, 66);
|
||||||
this.tbLoopStart.Name = "tbLoopStart";
|
this.tbLoopStart.Name = "tbLoopStart";
|
||||||
this.tbLoopStart.Size = new System.Drawing.Size(60, 20);
|
this.tbLoopStart.Size = new System.Drawing.Size(60, 20);
|
||||||
this.tbLoopStart.TabIndex = 1;
|
this.tbLoopStart.TabIndex = 1;
|
||||||
this.tbLoopStart.Text = "0";
|
this.tbLoopStart.Text = "0";
|
||||||
|
this.tbLoopStart.TextChanged += new System.EventHandler(this.tbLoopStart_TextChanged);
|
||||||
|
this.tbLoopStart.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.tbLoopStart_KeyPress);
|
||||||
//
|
//
|
||||||
// rbEnterManually
|
// rbEnterManually
|
||||||
//
|
//
|
||||||
this.rbEnterManually.AutoSize = true;
|
this.rbEnterManually.AutoSize = true;
|
||||||
this.rbEnterManually.Location = new System.Drawing.Point(6, 65);
|
this.rbEnterManually.Location = new System.Drawing.Point(6, 59);
|
||||||
this.rbEnterManually.Name = "rbEnterManually";
|
this.rbEnterManually.Name = "rbEnterManually";
|
||||||
this.rbEnterManually.Size = new System.Drawing.Size(215, 17);
|
this.rbEnterManually.Size = new System.Drawing.Size(95, 17);
|
||||||
this.rbEnterManually.TabIndex = 0;
|
this.rbEnterManually.TabIndex = 0;
|
||||||
this.rbEnterManually.Text = "Enter Manually Loop Start Sample:";
|
this.rbEnterManually.Text = "Enter Manually";
|
||||||
this.rbEnterManually.UseVisualStyleBackColor = true;
|
this.rbEnterManually.UseVisualStyleBackColor = true;
|
||||||
this.rbEnterManually.CheckedChanged += new System.EventHandler(this.rbSelectionChanged);
|
this.rbEnterManually.CheckedChanged += new System.EventHandler(this.rbSelectionChanged);
|
||||||
//
|
//
|
||||||
// rbFromAudioFile
|
// rbFromAudioFile
|
||||||
//
|
//
|
||||||
this.rbFromAudioFile.AutoSize = true;
|
this.rbFromAudioFile.AutoSize = true;
|
||||||
this.rbFromAudioFile.Location = new System.Drawing.Point(6, 42);
|
this.rbFromAudioFile.Enabled = false;
|
||||||
|
this.rbFromAudioFile.Location = new System.Drawing.Point(6, 39);
|
||||||
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;
|
||||||
@ -200,49 +232,49 @@ namespace CustomizeMii
|
|||||||
this.gbWaveInfo.Controls.Add(this.lbBitdepth);
|
this.gbWaveInfo.Controls.Add(this.lbBitdepth);
|
||||||
this.gbWaveInfo.Location = new System.Drawing.Point(363, 20);
|
this.gbWaveInfo.Location = new System.Drawing.Point(363, 20);
|
||||||
this.gbWaveInfo.Name = "gbWaveInfo";
|
this.gbWaveInfo.Name = "gbWaveInfo";
|
||||||
this.gbWaveInfo.Size = new System.Drawing.Size(135, 182);
|
this.gbWaveInfo.Size = new System.Drawing.Size(135, 192);
|
||||||
this.gbWaveInfo.TabIndex = 15;
|
this.gbWaveInfo.TabIndex = 15;
|
||||||
this.gbWaveInfo.TabStop = false;
|
this.gbWaveInfo.TabStop = false;
|
||||||
this.gbWaveInfo.Text = "Wave Info";
|
this.gbWaveInfo.Text = "Wave Info";
|
||||||
//
|
//
|
||||||
// lbStatusValue
|
// lbStatusValue
|
||||||
//
|
//
|
||||||
this.lbStatusValue.Location = new System.Drawing.Point(75, 151);
|
this.lbStatusValue.Location = new System.Drawing.Point(75, 157);
|
||||||
this.lbStatusValue.Name = "lbStatusValue";
|
this.lbStatusValue.Name = "lbStatusValue";
|
||||||
this.lbStatusValue.Size = new System.Drawing.Size(54, 13);
|
this.lbStatusValue.Size = new System.Drawing.Size(54, 13);
|
||||||
this.lbStatusValue.TabIndex = 7;
|
this.lbStatusValue.TabIndex = 7;
|
||||||
//
|
//
|
||||||
// lbLoopStartValue
|
// lbLoopStartValue
|
||||||
//
|
//
|
||||||
this.lbLoopStartValue.Location = new System.Drawing.Point(75, 130);
|
this.lbLoopStartValue.Location = new System.Drawing.Point(75, 135);
|
||||||
this.lbLoopStartValue.Name = "lbLoopStartValue";
|
this.lbLoopStartValue.Name = "lbLoopStartValue";
|
||||||
this.lbLoopStartValue.Size = new System.Drawing.Size(54, 13);
|
this.lbLoopStartValue.Size = new System.Drawing.Size(54, 13);
|
||||||
this.lbLoopStartValue.TabIndex = 7;
|
this.lbLoopStartValue.TabIndex = 7;
|
||||||
//
|
//
|
||||||
// lbLoopCountValue
|
// lbLoopCountValue
|
||||||
//
|
//
|
||||||
this.lbLoopCountValue.Location = new System.Drawing.Point(75, 109);
|
this.lbLoopCountValue.Location = new System.Drawing.Point(75, 113);
|
||||||
this.lbLoopCountValue.Name = "lbLoopCountValue";
|
this.lbLoopCountValue.Name = "lbLoopCountValue";
|
||||||
this.lbLoopCountValue.Size = new System.Drawing.Size(54, 13);
|
this.lbLoopCountValue.Size = new System.Drawing.Size(54, 13);
|
||||||
this.lbLoopCountValue.TabIndex = 7;
|
this.lbLoopCountValue.TabIndex = 7;
|
||||||
//
|
//
|
||||||
// lbFormatValue
|
// lbFormatValue
|
||||||
//
|
//
|
||||||
this.lbFormatValue.Location = new System.Drawing.Point(75, 88);
|
this.lbFormatValue.Location = new System.Drawing.Point(75, 91);
|
||||||
this.lbFormatValue.Name = "lbFormatValue";
|
this.lbFormatValue.Name = "lbFormatValue";
|
||||||
this.lbFormatValue.Size = new System.Drawing.Size(54, 13);
|
this.lbFormatValue.Size = new System.Drawing.Size(54, 13);
|
||||||
this.lbFormatValue.TabIndex = 7;
|
this.lbFormatValue.TabIndex = 7;
|
||||||
//
|
//
|
||||||
// lbChannelCountValue
|
// lbChannelCountValue
|
||||||
//
|
//
|
||||||
this.lbChannelCountValue.Location = new System.Drawing.Point(75, 67);
|
this.lbChannelCountValue.Location = new System.Drawing.Point(75, 69);
|
||||||
this.lbChannelCountValue.Name = "lbChannelCountValue";
|
this.lbChannelCountValue.Name = "lbChannelCountValue";
|
||||||
this.lbChannelCountValue.Size = new System.Drawing.Size(54, 13);
|
this.lbChannelCountValue.Size = new System.Drawing.Size(54, 13);
|
||||||
this.lbChannelCountValue.TabIndex = 7;
|
this.lbChannelCountValue.TabIndex = 7;
|
||||||
//
|
//
|
||||||
// lbSamplerateValue
|
// lbSamplerateValue
|
||||||
//
|
//
|
||||||
this.lbSamplerateValue.Location = new System.Drawing.Point(75, 46);
|
this.lbSamplerateValue.Location = new System.Drawing.Point(75, 47);
|
||||||
this.lbSamplerateValue.Name = "lbSamplerateValue";
|
this.lbSamplerateValue.Name = "lbSamplerateValue";
|
||||||
this.lbSamplerateValue.Size = new System.Drawing.Size(54, 13);
|
this.lbSamplerateValue.Size = new System.Drawing.Size(54, 13);
|
||||||
this.lbSamplerateValue.TabIndex = 7;
|
this.lbSamplerateValue.TabIndex = 7;
|
||||||
@ -257,7 +289,7 @@ namespace CustomizeMii
|
|||||||
// lbStatus
|
// lbStatus
|
||||||
//
|
//
|
||||||
this.lbStatus.AutoSize = true;
|
this.lbStatus.AutoSize = true;
|
||||||
this.lbStatus.Location = new System.Drawing.Point(6, 151);
|
this.lbStatus.Location = new System.Drawing.Point(6, 157);
|
||||||
this.lbStatus.Name = "lbStatus";
|
this.lbStatus.Name = "lbStatus";
|
||||||
this.lbStatus.Size = new System.Drawing.Size(40, 13);
|
this.lbStatus.Size = new System.Drawing.Size(40, 13);
|
||||||
this.lbStatus.TabIndex = 6;
|
this.lbStatus.TabIndex = 6;
|
||||||
@ -266,7 +298,7 @@ namespace CustomizeMii
|
|||||||
// lbLoopStart
|
// lbLoopStart
|
||||||
//
|
//
|
||||||
this.lbLoopStart.AutoSize = true;
|
this.lbLoopStart.AutoSize = true;
|
||||||
this.lbLoopStart.Location = new System.Drawing.Point(6, 130);
|
this.lbLoopStart.Location = new System.Drawing.Point(6, 135);
|
||||||
this.lbLoopStart.Name = "lbLoopStart";
|
this.lbLoopStart.Name = "lbLoopStart";
|
||||||
this.lbLoopStart.Size = new System.Drawing.Size(59, 13);
|
this.lbLoopStart.Size = new System.Drawing.Size(59, 13);
|
||||||
this.lbLoopStart.TabIndex = 5;
|
this.lbLoopStart.TabIndex = 5;
|
||||||
@ -275,7 +307,7 @@ namespace CustomizeMii
|
|||||||
// lbLoopCount
|
// lbLoopCount
|
||||||
//
|
//
|
||||||
this.lbLoopCount.AutoSize = true;
|
this.lbLoopCount.AutoSize = true;
|
||||||
this.lbLoopCount.Location = new System.Drawing.Point(6, 109);
|
this.lbLoopCount.Location = new System.Drawing.Point(6, 113);
|
||||||
this.lbLoopCount.Name = "lbLoopCount";
|
this.lbLoopCount.Name = "lbLoopCount";
|
||||||
this.lbLoopCount.Size = new System.Drawing.Size(39, 13);
|
this.lbLoopCount.Size = new System.Drawing.Size(39, 13);
|
||||||
this.lbLoopCount.TabIndex = 4;
|
this.lbLoopCount.TabIndex = 4;
|
||||||
@ -284,7 +316,7 @@ namespace CustomizeMii
|
|||||||
// lbFormat
|
// lbFormat
|
||||||
//
|
//
|
||||||
this.lbFormat.AutoSize = true;
|
this.lbFormat.AutoSize = true;
|
||||||
this.lbFormat.Location = new System.Drawing.Point(6, 88);
|
this.lbFormat.Location = new System.Drawing.Point(6, 91);
|
||||||
this.lbFormat.Name = "lbFormat";
|
this.lbFormat.Name = "lbFormat";
|
||||||
this.lbFormat.Size = new System.Drawing.Size(42, 13);
|
this.lbFormat.Size = new System.Drawing.Size(42, 13);
|
||||||
this.lbFormat.TabIndex = 3;
|
this.lbFormat.TabIndex = 3;
|
||||||
@ -293,7 +325,7 @@ namespace CustomizeMii
|
|||||||
// lbChannelCount
|
// lbChannelCount
|
||||||
//
|
//
|
||||||
this.lbChannelCount.AutoSize = true;
|
this.lbChannelCount.AutoSize = true;
|
||||||
this.lbChannelCount.Location = new System.Drawing.Point(6, 67);
|
this.lbChannelCount.Location = new System.Drawing.Point(6, 69);
|
||||||
this.lbChannelCount.Name = "lbChannelCount";
|
this.lbChannelCount.Name = "lbChannelCount";
|
||||||
this.lbChannelCount.Size = new System.Drawing.Size(54, 13);
|
this.lbChannelCount.Size = new System.Drawing.Size(54, 13);
|
||||||
this.lbChannelCount.TabIndex = 2;
|
this.lbChannelCount.TabIndex = 2;
|
||||||
@ -302,7 +334,7 @@ namespace CustomizeMii
|
|||||||
// lbSamplerate
|
// lbSamplerate
|
||||||
//
|
//
|
||||||
this.lbSamplerate.AutoSize = true;
|
this.lbSamplerate.AutoSize = true;
|
||||||
this.lbSamplerate.Location = new System.Drawing.Point(6, 46);
|
this.lbSamplerate.Location = new System.Drawing.Point(6, 47);
|
||||||
this.lbSamplerate.Name = "lbSamplerate";
|
this.lbSamplerate.Name = "lbSamplerate";
|
||||||
this.lbSamplerate.Size = new System.Drawing.Size(63, 13);
|
this.lbSamplerate.Size = new System.Drawing.Size(63, 13);
|
||||||
this.lbSamplerate.TabIndex = 1;
|
this.lbSamplerate.TabIndex = 1;
|
||||||
@ -321,7 +353,7 @@ namespace CustomizeMii
|
|||||||
//
|
//
|
||||||
this.cbSourceSound.AutoSize = true;
|
this.cbSourceSound.AutoSize = true;
|
||||||
this.cbSourceSound.Enabled = false;
|
this.cbSourceSound.Enabled = false;
|
||||||
this.cbSourceSound.Location = new System.Drawing.Point(15, 50);
|
this.cbSourceSound.Location = new System.Drawing.Point(15, 48);
|
||||||
this.cbSourceSound.Name = "cbSourceSound";
|
this.cbSourceSound.Name = "cbSourceSound";
|
||||||
this.cbSourceSound.Size = new System.Drawing.Size(170, 17);
|
this.cbSourceSound.Size = new System.Drawing.Size(170, 17);
|
||||||
this.cbSourceSound.TabIndex = 16;
|
this.cbSourceSound.TabIndex = 16;
|
||||||
@ -329,13 +361,44 @@ namespace CustomizeMii
|
|||||||
this.cbSourceSound.UseVisualStyleBackColor = true;
|
this.cbSourceSound.UseVisualStyleBackColor = true;
|
||||||
this.cbSourceSound.CheckedChanged += new System.EventHandler(this.cbSourceSound_CheckedChanged);
|
this.cbSourceSound.CheckedChanged += new System.EventHandler(this.cbSourceSound_CheckedChanged);
|
||||||
//
|
//
|
||||||
|
// gbPrelisten
|
||||||
|
//
|
||||||
|
this.gbPrelisten.Controls.Add(this.label1);
|
||||||
|
this.gbPrelisten.Controls.Add(this.btnPlay);
|
||||||
|
this.gbPrelisten.Location = new System.Drawing.Point(519, 20);
|
||||||
|
this.gbPrelisten.Name = "gbPrelisten";
|
||||||
|
this.gbPrelisten.Size = new System.Drawing.Size(135, 192);
|
||||||
|
this.gbPrelisten.TabIndex = 17;
|
||||||
|
this.gbPrelisten.TabStop = false;
|
||||||
|
this.gbPrelisten.Text = "Prelisten Loop";
|
||||||
|
//
|
||||||
|
// label1
|
||||||
|
//
|
||||||
|
this.label1.Location = new System.Drawing.Point(6, 25);
|
||||||
|
this.label1.Name = "label1";
|
||||||
|
this.label1.Size = new System.Drawing.Size(123, 118);
|
||||||
|
this.label1.TabIndex = 0;
|
||||||
|
this.label1.Text = "Note:\r\n\r\nYou will only hear the looped part, not the part before.\r\nAlso, the Loop" +
|
||||||
|
" might be inaccurate (only a few samples)";
|
||||||
|
//
|
||||||
|
// btnPlay
|
||||||
|
//
|
||||||
|
this.btnPlay.Location = new System.Drawing.Point(6, 156);
|
||||||
|
this.btnPlay.Name = "btnPlay";
|
||||||
|
this.btnPlay.Size = new System.Drawing.Size(123, 23);
|
||||||
|
this.btnPlay.TabIndex = 13;
|
||||||
|
this.btnPlay.Text = "Play Loop";
|
||||||
|
this.btnPlay.UseVisualStyleBackColor = true;
|
||||||
|
this.btnPlay.Click += new System.EventHandler(this.btnPlay_Click);
|
||||||
|
//
|
||||||
// CustomizeMii_BnsConvert
|
// CustomizeMii_BnsConvert
|
||||||
//
|
//
|
||||||
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.CancelButton = this.btnCancel;
|
this.CancelButton = this.btnCancel;
|
||||||
this.ClientSize = new System.Drawing.Size(510, 220);
|
this.ClientSize = new System.Drawing.Size(674, 230);
|
||||||
|
this.Controls.Add(this.gbPrelisten);
|
||||||
this.Controls.Add(this.cbSourceSound);
|
this.Controls.Add(this.cbSourceSound);
|
||||||
this.Controls.Add(this.gbWaveInfo);
|
this.Controls.Add(this.gbWaveInfo);
|
||||||
this.Controls.Add(this.gbLoop);
|
this.Controls.Add(this.gbLoop);
|
||||||
@ -351,8 +414,10 @@ namespace CustomizeMii
|
|||||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.CustomizeMii_BnsConvert_FormClosing);
|
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.CustomizeMii_BnsConvert_FormClosing);
|
||||||
this.gbLoop.ResumeLayout(false);
|
this.gbLoop.ResumeLayout(false);
|
||||||
this.gbLoop.PerformLayout();
|
this.gbLoop.PerformLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.tbarLoopStartSample)).EndInit();
|
||||||
this.gbWaveInfo.ResumeLayout(false);
|
this.gbWaveInfo.ResumeLayout(false);
|
||||||
this.gbWaveInfo.PerformLayout();
|
this.gbWaveInfo.PerformLayout();
|
||||||
|
this.gbPrelisten.ResumeLayout(false);
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
this.PerformLayout();
|
this.PerformLayout();
|
||||||
|
|
||||||
@ -386,6 +451,11 @@ namespace CustomizeMii
|
|||||||
private System.Windows.Forms.Label lbSamplerateValue;
|
private System.Windows.Forms.Label lbSamplerateValue;
|
||||||
private System.Windows.Forms.Label lbBitdepthValue;
|
private System.Windows.Forms.Label lbBitdepthValue;
|
||||||
private System.Windows.Forms.CheckBox cbSourceSound;
|
private System.Windows.Forms.CheckBox cbSourceSound;
|
||||||
|
private System.Windows.Forms.GroupBox gbPrelisten;
|
||||||
|
private System.Windows.Forms.Label label1;
|
||||||
|
private System.Windows.Forms.Button btnPlay;
|
||||||
|
private System.Windows.Forms.Label lbStartSample;
|
||||||
|
private System.Windows.Forms.TrackBar tbarLoopStartSample;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -20,6 +20,7 @@ using System.IO;
|
|||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using WaveFile;
|
using WaveFile;
|
||||||
|
using System.Media;
|
||||||
|
|
||||||
namespace CustomizeMii
|
namespace CustomizeMii
|
||||||
{
|
{
|
||||||
@ -36,6 +37,9 @@ namespace CustomizeMii
|
|||||||
private int loopStart;
|
private int loopStart;
|
||||||
private bool error = false;
|
private bool error = false;
|
||||||
private bool cancelled = false;
|
private bool cancelled = false;
|
||||||
|
private int sampleCount;
|
||||||
|
private SoundPlayer sPlayer;
|
||||||
|
private bool mp3LengthKnown = false;
|
||||||
|
|
||||||
public string AudioFile { get { return tbAudioFile.Text; } }
|
public string AudioFile { get { return tbAudioFile.Text; } }
|
||||||
public bool LoopNone { get { return rbNone.Checked; } }
|
public bool LoopNone { get { return rbNone.Checked; } }
|
||||||
@ -53,7 +57,7 @@ namespace CustomizeMii
|
|||||||
private void CustomizeMii_BnsConvert_Load(object sender, EventArgs e)
|
private void CustomizeMii_BnsConvert_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
//this.Size = new System.Drawing.Size(358, 220);
|
//this.Size = new System.Drawing.Size(358, 220);
|
||||||
this.Size = new System.Drawing.Size(btnCancel.Location.X + btnCancel.Size.Width + 15, 220);
|
this.Size = new System.Drawing.Size(btnCancel.Location.X + btnCancel.Size.Width + 15, this.Size.Height);
|
||||||
|
|
||||||
this.CenterToParent();
|
this.CenterToParent();
|
||||||
bwGatherInfo = new BackgroundWorker();
|
bwGatherInfo = new BackgroundWorker();
|
||||||
@ -81,6 +85,19 @@ namespace CustomizeMii
|
|||||||
private void rbSelectionChanged(object sender, EventArgs e)
|
private void rbSelectionChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
tbLoopStart.Enabled = rbEnterManually.Checked;
|
tbLoopStart.Enabled = rbEnterManually.Checked;
|
||||||
|
if (tbAudioFile.Text.ToLower().EndsWith(".mp3")) { tbarLoopStartSample.Enabled = (rbEnterManually.Checked && mp3LengthKnown); }
|
||||||
|
else { tbarLoopStartSample.Enabled = rbEnterManually.Checked; }
|
||||||
|
|
||||||
|
if (!rbNone.Checked && this.Size.Width > 400)
|
||||||
|
this.Size = new System.Drawing.Size(gbPrelisten.Location.X + gbPrelisten.Size.Width + 15, this.Size.Height);
|
||||||
|
else if (rbNone.Checked && this.Size.Width > 400)
|
||||||
|
this.Size = new System.Drawing.Size(gbWaveInfo.Location.X + gbWaveInfo.Size.Width + 15, this.Size.Height);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void tbLoopStart_KeyPress(object sender, KeyPressEventArgs e)
|
||||||
|
{
|
||||||
|
e.Handled = !char.IsDigit(e.KeyChar) && e.KeyChar != '\b';
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnConvert_Click(object sender, EventArgs e)
|
private void btnConvert_Click(object sender, EventArgs e)
|
||||||
@ -98,12 +115,14 @@ namespace CustomizeMii
|
|||||||
tbLoopStart.SelectAll();
|
tbLoopStart.SelectAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.sPlayer != null) { this.sPlayer.Stop(); this.sPlayer.Dispose(); }
|
||||||
this.DialogResult = DialogResult.OK;
|
this.DialogResult = DialogResult.OK;
|
||||||
this.Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnCancel_Click(object sender, EventArgs e)
|
private void btnCancel_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if (this.sPlayer != null) { this.sPlayer.Stop(); this.sPlayer.Dispose(); }
|
||||||
this.DialogResult = DialogResult.Cancel;
|
this.DialogResult = DialogResult.Cancel;
|
||||||
this.Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
@ -135,7 +154,7 @@ namespace CustomizeMii
|
|||||||
bwGatherInfo.RunWorkerAsync(audio);
|
bwGatherInfo.RunWorkerAsync(audio);
|
||||||
|
|
||||||
//this.Size = new System.Drawing.Size(510, 220);
|
//this.Size = new System.Drawing.Size(510, 220);
|
||||||
this.Size = new System.Drawing.Size(gbWaveInfo.Location.X + gbWaveInfo.Size.Width + 15, 220);
|
this.Size = new System.Drawing.Size(gbWaveInfo.Location.X + gbWaveInfo.Size.Width + 15, this.Size.Height);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -143,7 +162,7 @@ namespace CustomizeMii
|
|||||||
tbAudioFile.Text = string.Empty;
|
tbAudioFile.Text = string.Empty;
|
||||||
|
|
||||||
//this.Size = new System.Drawing.Size(358, 220);
|
//this.Size = new System.Drawing.Size(358, 220);
|
||||||
this.Size = new System.Drawing.Size(btnCancel.Location.X + btnCancel.Size.Width + 15, 220);
|
this.Size = new System.Drawing.Size(btnCancel.Location.X + btnCancel.Size.Width + 15, this.Size.Height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,6 +179,8 @@ namespace CustomizeMii
|
|||||||
if (ofd.FileName != tbAudioFile.Text)
|
if (ofd.FileName != tbAudioFile.Text)
|
||||||
{
|
{
|
||||||
btnConvert.Enabled = false;
|
btnConvert.Enabled = false;
|
||||||
|
tbarLoopStartSample.Enabled = false;
|
||||||
|
mp3LengthKnown = false;
|
||||||
|
|
||||||
cbSourceSound.Checked = false;
|
cbSourceSound.Checked = false;
|
||||||
tbAudioFile.Text = ofd.FileName;
|
tbAudioFile.Text = ofd.FileName;
|
||||||
@ -177,8 +198,7 @@ namespace CustomizeMii
|
|||||||
|
|
||||||
bwGatherInfo.RunWorkerAsync(ofd.FileName);
|
bwGatherInfo.RunWorkerAsync(ofd.FileName);
|
||||||
|
|
||||||
//this.Size = new System.Drawing.Size(510, 220);
|
this.Size = new System.Drawing.Size(gbWaveInfo.Location.X + gbWaveInfo.Size.Width + 15, this.Size.Height);
|
||||||
this.Size = new System.Drawing.Size(gbWaveInfo.Location.X + gbWaveInfo.Size.Width + 15, 220);
|
|
||||||
}
|
}
|
||||||
else if (ofd.FileName.EndsWith(".mp3"))
|
else if (ofd.FileName.EndsWith(".mp3"))
|
||||||
{
|
{
|
||||||
@ -188,8 +208,16 @@ namespace CustomizeMii
|
|||||||
if (rbFromAudioFile.Checked) rbNone.Checked = true;
|
if (rbFromAudioFile.Checked) rbNone.Checked = true;
|
||||||
rbFromAudioFile.Enabled = false;
|
rbFromAudioFile.Enabled = false;
|
||||||
|
|
||||||
//this.Size = new System.Drawing.Size(358, 220);
|
this.Size = new System.Drawing.Size(btnCancel.Location.X + btnCancel.Size.Width + 15, this.Size.Height);
|
||||||
this.Size = new System.Drawing.Size(btnCancel.Location.X + btnCancel.Size.Width + 15, 220);
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
MP3Info mp3Info = new MP3Info(ofd.FileName);
|
||||||
|
tbarLoopStartSample.Maximum = mp3Info.AudioSamples;
|
||||||
|
mp3LengthKnown = true;
|
||||||
|
if (rbEnterManually.Checked) tbarLoopStartSample.Enabled = true;
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -207,6 +235,9 @@ namespace CustomizeMii
|
|||||||
else
|
else
|
||||||
{ wave = new Wave((string)e.Argument); }
|
{ wave = new Wave((string)e.Argument); }
|
||||||
|
|
||||||
|
try { this.sampleCount = wave.SampleCount; }
|
||||||
|
catch { }
|
||||||
|
|
||||||
try { bitDepth = wave.BitDepth; }
|
try { bitDepth = wave.BitDepth; }
|
||||||
catch { bitDepth = -1; }
|
catch { bitDepth = -1; }
|
||||||
|
|
||||||
@ -262,6 +293,8 @@ namespace CustomizeMii
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool statusOk = true;
|
bool statusOk = true;
|
||||||
|
tbarLoopStartSample.Maximum = this.sampleCount;
|
||||||
|
if (rbEnterManually.Checked) tbarLoopStartSample.Enabled = true;
|
||||||
|
|
||||||
if (bitDepth == -1) lbBitdepthValue.Text = "Error";
|
if (bitDepth == -1) lbBitdepthValue.Text = "Error";
|
||||||
else lbBitdepthValue.Text = bitDepth.ToString();
|
else lbBitdepthValue.Text = bitDepth.ToString();
|
||||||
@ -352,5 +385,63 @@ namespace CustomizeMii
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void btnPlay_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (btnPlay.Text == "Stop")
|
||||||
|
{
|
||||||
|
if (sPlayer != null)
|
||||||
|
{
|
||||||
|
sPlayer.Stop();
|
||||||
|
sPlayer = null;
|
||||||
|
|
||||||
|
btnPlay.Text = "Play Loop";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
int loopStart = rbFromAudioFile.Checked ? int.Parse(lbLoopStartValue.Text) : int.Parse(tbLoopStart.Text);
|
||||||
|
|
||||||
|
Wave wave;
|
||||||
|
if (cbSourceSound.Checked)
|
||||||
|
{
|
||||||
|
using (FileStream fs = new FileStream(CustomizeMii_Main.TempUnpackPath + "00000000.app_OUT\\meta\\sound.bin", FileMode.Open))
|
||||||
|
{
|
||||||
|
byte[] audio = new byte[fs.Length - 32];
|
||||||
|
fs.Seek(32, SeekOrigin.Begin);
|
||||||
|
fs.Read(audio, 0, audio.Length);
|
||||||
|
|
||||||
|
wave = new Wave(audio);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else wave = new Wave(tbAudioFile.Text);
|
||||||
|
|
||||||
|
sPlayer = new SoundPlayer(wave.TrimStart(loopStart));
|
||||||
|
sPlayer.PlayLooping();
|
||||||
|
|
||||||
|
btnPlay.Text = "Stop";
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
sPlayer = null;
|
||||||
|
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void tbarLoopStartSample_Scroll(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try { tbLoopStart.Text = tbarLoopStartSample.Value.ToString(); }
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
|
||||||
|
private void tbLoopStart_TextChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (tbarLoopStartSample.Enabled)
|
||||||
|
try { tbarLoopStartSample.Value = int.Parse(tbLoopStart.Text); }
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
252
CustomizeMii/CustomizeMii_DragDrop.cs
Normal file
252
CustomizeMii/CustomizeMii_DragDrop.cs
Normal file
@ -0,0 +1,252 @@
|
|||||||
|
using System;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.IO;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace CustomizeMii
|
||||||
|
{
|
||||||
|
partial class CustomizeMii_Main
|
||||||
|
{
|
||||||
|
private void CustomizeMii_Main_DragEnter(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Data.GetDataPresent(DataFormats.FileDrop) && pbProgress.Value == 100)
|
||||||
|
{
|
||||||
|
string[] data = (string[])e.Data.GetData(DataFormats.FileDrop);
|
||||||
|
|
||||||
|
if (data.Length == 1 && data[0].ToLower().EndsWith(".wad"))
|
||||||
|
e.Effect = DragDropEffects.Copy;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CustomizeMii_Main_DragDrop(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
string[] data = (string[])e.Data.GetData(DataFormats.FileDrop);
|
||||||
|
|
||||||
|
if (data.Length == 1 && data[0].ToLower().EndsWith(".wad"))
|
||||||
|
{
|
||||||
|
LoadChannel(data[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void tbReplace_DragEnter(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(tbSourceWad.Text))
|
||||||
|
{
|
||||||
|
if (pbProgress.Value == 100 && e.Data.GetDataPresent(DataFormats.FileDrop))
|
||||||
|
{
|
||||||
|
string[] data = (string[])e.Data.GetData(DataFormats.FileDrop);
|
||||||
|
|
||||||
|
if (data.Length == 1)
|
||||||
|
{
|
||||||
|
if (data[0].ToLower().EndsWith(".wad") ||
|
||||||
|
data[0].ToLower().EndsWith("00000000.app"))
|
||||||
|
e.Effect = DragDropEffects.Copy;
|
||||||
|
else if ((cmbReplace.SelectedIndex == 2 && data[0].ToLower().EndsWith("sound.bin")) ||
|
||||||
|
(cmbReplace.SelectedIndex == 1 && data[0].ToLower().EndsWith("icon.bin")) ||
|
||||||
|
(cmbReplace.SelectedIndex == 0 && data[0].ToLower().EndsWith("banner.bin")))
|
||||||
|
e.Effect = DragDropEffects.Copy;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void tbReplace_DragDrop(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
string[] data = (string[])e.Data.GetData(DataFormats.FileDrop);
|
||||||
|
|
||||||
|
if (data.Length == 1 && (data[0].ToLower().EndsWith(".wad") ||
|
||||||
|
data[0].ToLower().EndsWith("00000000.app") ||
|
||||||
|
data[0].ToLower().EndsWith("sound.bin") ||
|
||||||
|
data[0].ToLower().EndsWith("icon.bin") ||
|
||||||
|
data[0].ToLower().EndsWith("banner.bin")))
|
||||||
|
{
|
||||||
|
ReplacePart(data[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void tbDol_DragEnter(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Data.GetDataPresent(DataFormats.FileDrop) && pbProgress.Value == 100)
|
||||||
|
{
|
||||||
|
string[] data = (string[])e.Data.GetData(DataFormats.FileDrop);
|
||||||
|
|
||||||
|
if (data.Length == 1 && (data[0].ToLower().EndsWith(".wad") || data[0].ToLower().EndsWith(".dol")))
|
||||||
|
e.Effect = DragDropEffects.Copy;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void tbDol_DragDrop(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
string[] data = (string[])e.Data.GetData(DataFormats.FileDrop);
|
||||||
|
|
||||||
|
if (data[0].ToLower().EndsWith(".wad"))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
byte[] wad = Wii.Tools.LoadFileToByteArray(data[0]);
|
||||||
|
|
||||||
|
int numContents = Wii.WadInfo.GetContentNum(wad);
|
||||||
|
|
||||||
|
if (numContents == 3)
|
||||||
|
{
|
||||||
|
int bootIndex = Wii.WadInfo.GetBootIndex(wad);
|
||||||
|
string appFile = string.Empty;
|
||||||
|
|
||||||
|
if (bootIndex == 1)
|
||||||
|
{ appFile = "00000002.app"; }
|
||||||
|
else if (bootIndex == 2)
|
||||||
|
{ appFile = "00000001.app"; }
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(appFile))
|
||||||
|
{
|
||||||
|
if (Directory.Exists(TempTempPath + "TempWad")) Directory.Delete(TempTempPath + "TempWad", true);
|
||||||
|
Wii.WadUnpack.UnpackWad(data[0], TempTempPath + "TempWad");
|
||||||
|
|
||||||
|
File.Copy(TempTempPath + "TempWad\\" + appFile, TempDolPath, true);
|
||||||
|
SetText(tbDol, data[0]);
|
||||||
|
btnBrowseDol.Text = "Clear";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ErrorBox("The DOL file couldn't be found!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ErrorBox("The DOL file couldn't be found!");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
SetText(tbDol, string.Empty);
|
||||||
|
ErrorBox(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (data[0].ToLower().EndsWith(".dol"))
|
||||||
|
{
|
||||||
|
SetText(tbDol, data[0]);
|
||||||
|
btnBrowseDol.Text = "Clear";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void tbSound_DragEnter(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Data.GetDataPresent(DataFormats.FileDrop) && pbProgress.Value == 100)
|
||||||
|
{
|
||||||
|
string[] data = (string[])e.Data.GetData(DataFormats.FileDrop);
|
||||||
|
|
||||||
|
if (File.Exists(Application.StartupPath + "\\lame.exe"))
|
||||||
|
{
|
||||||
|
if (data.Length == 1 && (data[0].ToLower().EndsWith(".wav") ||
|
||||||
|
data[0].ToLower().EndsWith(".bns") ||
|
||||||
|
data[0].ToLower().EndsWith(".mp3")))
|
||||||
|
e.Effect = DragDropEffects.Copy;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (data.Length == 1 && (data[0].ToLower().EndsWith(".wav") ||
|
||||||
|
data[0].ToLower().EndsWith(".bns")))
|
||||||
|
e.Effect = DragDropEffects.Copy;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void tbSound_DragDrop(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
string[] data = (string[])e.Data.GetData(DataFormats.FileDrop);
|
||||||
|
|
||||||
|
if (data[0].ToLower().EndsWith(".mp3"))
|
||||||
|
{
|
||||||
|
ConvertMp3ToWave(data[0]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SetText(tbSound, data[0]);
|
||||||
|
|
||||||
|
btnBrowseSound.Text = "Clear";
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(SoundReplace))
|
||||||
|
{
|
||||||
|
SoundReplace = string.Empty;
|
||||||
|
if (cmbReplace.SelectedIndex == 2) SetText(tbReplace, SoundReplace);
|
||||||
|
if (File.Exists(TempSoundPath)) File.Delete(TempSoundPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void lbxBannerTpls_DragEnter(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Data.GetDataPresent(DataFormats.FileDrop) && pbProgress.Value == 100)
|
||||||
|
{
|
||||||
|
string[] data = (string[])e.Data.GetData(DataFormats.FileDrop);
|
||||||
|
bool correct = true;
|
||||||
|
|
||||||
|
for (int i = 0; i < data.Length; i++)
|
||||||
|
if (!(data[0].ToLower().EndsWith(".tpl") ||
|
||||||
|
data[0].ToLower().EndsWith(".png") ||
|
||||||
|
data[0].ToLower().EndsWith(".jpg") ||
|
||||||
|
data[0].ToLower().EndsWith(".gif") ||
|
||||||
|
data[0].ToLower().EndsWith(".bmp")))
|
||||||
|
correct = false;
|
||||||
|
|
||||||
|
if (correct) e.Effect = DragDropEffects.Copy;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void lbxBannerTpls_DragDrop(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
string[] data = (string[])e.Data.GetData(DataFormats.FileDrop);
|
||||||
|
List<string> errors = new List<string>();
|
||||||
|
|
||||||
|
foreach (string thisFile in data)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
AddTpl(lbxBannerTpls, thisFile);
|
||||||
|
}
|
||||||
|
catch { errors.Add(thisFile); }
|
||||||
|
}
|
||||||
|
|
||||||
|
if (errors.Count > 0)
|
||||||
|
{
|
||||||
|
ErrorBox(string.Format("These files were not added, because either they already exist or an error occured during conversion:\n\n{0}", string.Join("\n", (errors.ToArray()))));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void lbxIconTpls_DragEnter(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Data.GetDataPresent(DataFormats.FileDrop) && pbProgress.Value == 100)
|
||||||
|
{
|
||||||
|
string[] data = (string[])e.Data.GetData(DataFormats.FileDrop);
|
||||||
|
bool correct = true;
|
||||||
|
|
||||||
|
for (int i = 0; i < data.Length; i++)
|
||||||
|
if (!(data[0].ToLower().EndsWith(".tpl") ||
|
||||||
|
data[0].ToLower().EndsWith(".png") ||
|
||||||
|
data[0].ToLower().EndsWith(".jpg") ||
|
||||||
|
data[0].ToLower().EndsWith(".gif") ||
|
||||||
|
data[0].ToLower().EndsWith(".bmp")))
|
||||||
|
correct = false;
|
||||||
|
|
||||||
|
if (correct) e.Effect = DragDropEffects.Copy;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void lbxIconTpls_DragDrop(object sender, DragEventArgs e)
|
||||||
|
{
|
||||||
|
string[] data = (string[])e.Data.GetData(DataFormats.FileDrop);
|
||||||
|
List<string> errors = new List<string>();
|
||||||
|
|
||||||
|
foreach (string thisFile in data)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
AddTpl(lbxIconTpls, thisFile);
|
||||||
|
}
|
||||||
|
catch { errors.Add(thisFile); }
|
||||||
|
}
|
||||||
|
|
||||||
|
if (errors.Count > 0)
|
||||||
|
{
|
||||||
|
ErrorBox(string.Format("These files were not added, because either they already exist or an error occured during conversion:\n\n{0}", string.Join("\n", (errors.ToArray()))));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -46,7 +46,7 @@ namespace CustomizeMii
|
|||||||
|
|
||||||
private void CustomizeMii_InputBox_Load(object sender, EventArgs e)
|
private void CustomizeMii_InputBox_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
this.CenterToScreen();
|
this.CenterToParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnExit_Click(object sender, EventArgs e)
|
private void btnExit_Click(object sender, EventArgs e)
|
||||||
|
63
CustomizeMii/CustomizeMii_Main.Designer.cs
generated
63
CustomizeMii/CustomizeMii_Main.Designer.cs
generated
@ -50,6 +50,8 @@ namespace CustomizeMii
|
|||||||
this.btnCreateWad = new System.Windows.Forms.Button();
|
this.btnCreateWad = new System.Windows.Forms.Button();
|
||||||
this.tabControl = new System.Windows.Forms.TabControl();
|
this.tabControl = new System.Windows.Forms.TabControl();
|
||||||
this.tabSource = new System.Windows.Forms.TabPage();
|
this.tabSource = new System.Windows.Forms.TabPage();
|
||||||
|
this.lbCreatedValue = new System.Windows.Forms.Label();
|
||||||
|
this.lbCreated = new System.Windows.Forms.Label();
|
||||||
this.tbReplace = new System.Windows.Forms.TextBox();
|
this.tbReplace = new System.Windows.Forms.TextBox();
|
||||||
this.btnBrowseReplace = new System.Windows.Forms.Button();
|
this.btnBrowseReplace = new System.Windows.Forms.Button();
|
||||||
this.cmbReplace = new System.Windows.Forms.ComboBox();
|
this.cmbReplace = new System.Windows.Forms.ComboBox();
|
||||||
@ -218,6 +220,8 @@ namespace CustomizeMii
|
|||||||
//
|
//
|
||||||
// tabSource
|
// tabSource
|
||||||
//
|
//
|
||||||
|
this.tabSource.Controls.Add(this.lbCreatedValue);
|
||||||
|
this.tabSource.Controls.Add(this.lbCreated);
|
||||||
this.tabSource.Controls.Add(this.tbReplace);
|
this.tabSource.Controls.Add(this.tbReplace);
|
||||||
this.tabSource.Controls.Add(this.btnBrowseReplace);
|
this.tabSource.Controls.Add(this.btnBrowseReplace);
|
||||||
this.tabSource.Controls.Add(this.cmbReplace);
|
this.tabSource.Controls.Add(this.cmbReplace);
|
||||||
@ -236,19 +240,39 @@ namespace CustomizeMii
|
|||||||
this.tabSource.Text = "Source";
|
this.tabSource.Text = "Source";
|
||||||
this.tabSource.UseVisualStyleBackColor = true;
|
this.tabSource.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
|
// lbCreatedValue
|
||||||
|
//
|
||||||
|
this.lbCreatedValue.AutoSize = true;
|
||||||
|
this.lbCreatedValue.Location = new System.Drawing.Point(125, 45);
|
||||||
|
this.lbCreatedValue.Name = "lbCreatedValue";
|
||||||
|
this.lbCreatedValue.Size = new System.Drawing.Size(0, 13);
|
||||||
|
this.lbCreatedValue.TabIndex = 12;
|
||||||
|
//
|
||||||
|
// lbCreated
|
||||||
|
//
|
||||||
|
this.lbCreated.AutoSize = true;
|
||||||
|
this.lbCreated.Location = new System.Drawing.Point(8, 45);
|
||||||
|
this.lbCreated.Name = "lbCreated";
|
||||||
|
this.lbCreated.Size = new System.Drawing.Size(111, 13);
|
||||||
|
this.lbCreated.TabIndex = 11;
|
||||||
|
this.lbCreated.Text = "Created / Last Edited:";
|
||||||
|
//
|
||||||
// tbReplace
|
// tbReplace
|
||||||
//
|
//
|
||||||
this.tbReplace.Location = new System.Drawing.Point(100, 173);
|
this.tbReplace.AllowDrop = true;
|
||||||
|
this.tbReplace.Location = new System.Drawing.Point(100, 177);
|
||||||
this.tbReplace.Name = "tbReplace";
|
this.tbReplace.Name = "tbReplace";
|
||||||
this.tbReplace.ReadOnly = true;
|
this.tbReplace.ReadOnly = true;
|
||||||
this.tbReplace.Size = new System.Drawing.Size(254, 20);
|
this.tbReplace.Size = new System.Drawing.Size(254, 20);
|
||||||
this.tbReplace.TabIndex = 10;
|
this.tbReplace.TabIndex = 10;
|
||||||
this.tbReplace.Tag = "Disabled";
|
this.tbReplace.Tag = "Disabled";
|
||||||
this.tbReplace.TextChanged += new System.EventHandler(this.tbReplace_TextChanged);
|
this.tbReplace.TextChanged += new System.EventHandler(this.tbReplace_TextChanged);
|
||||||
|
this.tbReplace.DragDrop += new System.Windows.Forms.DragEventHandler(this.tbReplace_DragDrop);
|
||||||
|
this.tbReplace.DragEnter += new System.Windows.Forms.DragEventHandler(this.tbReplace_DragEnter);
|
||||||
//
|
//
|
||||||
// btnBrowseReplace
|
// btnBrowseReplace
|
||||||
//
|
//
|
||||||
this.btnBrowseReplace.Location = new System.Drawing.Point(360, 171);
|
this.btnBrowseReplace.Location = new System.Drawing.Point(360, 175);
|
||||||
this.btnBrowseReplace.Name = "btnBrowseReplace";
|
this.btnBrowseReplace.Name = "btnBrowseReplace";
|
||||||
this.btnBrowseReplace.Size = new System.Drawing.Size(75, 23);
|
this.btnBrowseReplace.Size = new System.Drawing.Size(75, 23);
|
||||||
this.btnBrowseReplace.TabIndex = 9;
|
this.btnBrowseReplace.TabIndex = 9;
|
||||||
@ -264,7 +288,7 @@ namespace CustomizeMii
|
|||||||
"Banner",
|
"Banner",
|
||||||
"Icon",
|
"Icon",
|
||||||
"Sound"});
|
"Sound"});
|
||||||
this.cmbReplace.Location = new System.Drawing.Point(11, 172);
|
this.cmbReplace.Location = new System.Drawing.Point(11, 176);
|
||||||
this.cmbReplace.Name = "cmbReplace";
|
this.cmbReplace.Name = "cmbReplace";
|
||||||
this.cmbReplace.Size = new System.Drawing.Size(83, 21);
|
this.cmbReplace.Size = new System.Drawing.Size(83, 21);
|
||||||
this.cmbReplace.TabIndex = 7;
|
this.cmbReplace.TabIndex = 7;
|
||||||
@ -272,7 +296,7 @@ namespace CustomizeMii
|
|||||||
//
|
//
|
||||||
// btnSaveBaseWad
|
// btnSaveBaseWad
|
||||||
//
|
//
|
||||||
this.btnSaveBaseWad.Location = new System.Drawing.Point(360, 127);
|
this.btnSaveBaseWad.Location = new System.Drawing.Point(360, 142);
|
||||||
this.btnSaveBaseWad.Name = "btnSaveBaseWad";
|
this.btnSaveBaseWad.Name = "btnSaveBaseWad";
|
||||||
this.btnSaveBaseWad.Size = new System.Drawing.Size(75, 23);
|
this.btnSaveBaseWad.Size = new System.Drawing.Size(75, 23);
|
||||||
this.btnSaveBaseWad.TabIndex = 6;
|
this.btnSaveBaseWad.TabIndex = 6;
|
||||||
@ -282,7 +306,7 @@ namespace CustomizeMii
|
|||||||
//
|
//
|
||||||
// btnPreviewBaseWad
|
// btnPreviewBaseWad
|
||||||
//
|
//
|
||||||
this.btnPreviewBaseWad.Location = new System.Drawing.Point(360, 93);
|
this.btnPreviewBaseWad.Location = new System.Drawing.Point(360, 106);
|
||||||
this.btnPreviewBaseWad.Name = "btnPreviewBaseWad";
|
this.btnPreviewBaseWad.Name = "btnPreviewBaseWad";
|
||||||
this.btnPreviewBaseWad.Size = new System.Drawing.Size(75, 23);
|
this.btnPreviewBaseWad.Size = new System.Drawing.Size(75, 23);
|
||||||
this.btnPreviewBaseWad.TabIndex = 5;
|
this.btnPreviewBaseWad.TabIndex = 5;
|
||||||
@ -292,7 +316,7 @@ namespace CustomizeMii
|
|||||||
//
|
//
|
||||||
// btnLoadBaseWad
|
// btnLoadBaseWad
|
||||||
//
|
//
|
||||||
this.btnLoadBaseWad.Location = new System.Drawing.Point(360, 59);
|
this.btnLoadBaseWad.Location = new System.Drawing.Point(360, 70);
|
||||||
this.btnLoadBaseWad.Name = "btnLoadBaseWad";
|
this.btnLoadBaseWad.Name = "btnLoadBaseWad";
|
||||||
this.btnLoadBaseWad.Size = new System.Drawing.Size(75, 23);
|
this.btnLoadBaseWad.Size = new System.Drawing.Size(75, 23);
|
||||||
this.btnLoadBaseWad.TabIndex = 4;
|
this.btnLoadBaseWad.TabIndex = 4;
|
||||||
@ -318,14 +342,14 @@ namespace CustomizeMii
|
|||||||
"WADder Base 3",
|
"WADder Base 3",
|
||||||
"UniiLoader",
|
"UniiLoader",
|
||||||
"Backup Channel"});
|
"Backup Channel"});
|
||||||
this.lbxBaseWads.Location = new System.Drawing.Point(11, 51);
|
this.lbxBaseWads.Location = new System.Drawing.Point(11, 70);
|
||||||
this.lbxBaseWads.Name = "lbxBaseWads";
|
this.lbxBaseWads.Name = "lbxBaseWads";
|
||||||
this.lbxBaseWads.Size = new System.Drawing.Size(343, 108);
|
this.lbxBaseWads.Size = new System.Drawing.Size(343, 95);
|
||||||
this.lbxBaseWads.TabIndex = 3;
|
this.lbxBaseWads.TabIndex = 3;
|
||||||
//
|
//
|
||||||
// btnBrowseSource
|
// btnBrowseSource
|
||||||
//
|
//
|
||||||
this.btnBrowseSource.Location = new System.Drawing.Point(360, 13);
|
this.btnBrowseSource.Location = new System.Drawing.Point(360, 12);
|
||||||
this.btnBrowseSource.Name = "btnBrowseSource";
|
this.btnBrowseSource.Name = "btnBrowseSource";
|
||||||
this.btnBrowseSource.Size = new System.Drawing.Size(75, 23);
|
this.btnBrowseSource.Size = new System.Drawing.Size(75, 23);
|
||||||
this.btnBrowseSource.TabIndex = 2;
|
this.btnBrowseSource.TabIndex = 2;
|
||||||
@ -335,7 +359,7 @@ namespace CustomizeMii
|
|||||||
//
|
//
|
||||||
// tbSourceWad
|
// tbSourceWad
|
||||||
//
|
//
|
||||||
this.tbSourceWad.Location = new System.Drawing.Point(84, 15);
|
this.tbSourceWad.Location = new System.Drawing.Point(84, 14);
|
||||||
this.tbSourceWad.Name = "tbSourceWad";
|
this.tbSourceWad.Name = "tbSourceWad";
|
||||||
this.tbSourceWad.ReadOnly = true;
|
this.tbSourceWad.ReadOnly = true;
|
||||||
this.tbSourceWad.Size = new System.Drawing.Size(270, 20);
|
this.tbSourceWad.Size = new System.Drawing.Size(270, 20);
|
||||||
@ -345,7 +369,7 @@ namespace CustomizeMii
|
|||||||
// lbSource
|
// lbSource
|
||||||
//
|
//
|
||||||
this.lbSource.AutoSize = true;
|
this.lbSource.AutoSize = true;
|
||||||
this.lbSource.Location = new System.Drawing.Point(8, 18);
|
this.lbSource.Location = new System.Drawing.Point(8, 17);
|
||||||
this.lbSource.Name = "lbSource";
|
this.lbSource.Name = "lbSource";
|
||||||
this.lbSource.Size = new System.Drawing.Size(70, 13);
|
this.lbSource.Size = new System.Drawing.Size(70, 13);
|
||||||
this.lbSource.TabIndex = 0;
|
this.lbSource.TabIndex = 0;
|
||||||
@ -613,12 +637,15 @@ namespace CustomizeMii
|
|||||||
//
|
//
|
||||||
// tbSound
|
// tbSound
|
||||||
//
|
//
|
||||||
|
this.tbSound.AllowDrop = true;
|
||||||
this.tbSound.Location = new System.Drawing.Point(90, 147);
|
this.tbSound.Location = new System.Drawing.Point(90, 147);
|
||||||
this.tbSound.Name = "tbSound";
|
this.tbSound.Name = "tbSound";
|
||||||
this.tbSound.ReadOnly = true;
|
this.tbSound.ReadOnly = true;
|
||||||
this.tbSound.Size = new System.Drawing.Size(264, 20);
|
this.tbSound.Size = new System.Drawing.Size(264, 20);
|
||||||
this.tbSound.TabIndex = 8;
|
this.tbSound.TabIndex = 8;
|
||||||
this.tbSound.Tag = "Disabled";
|
this.tbSound.Tag = "Disabled";
|
||||||
|
this.tbSound.DragDrop += new System.Windows.Forms.DragEventHandler(this.tbSound_DragDrop);
|
||||||
|
this.tbSound.DragEnter += new System.Windows.Forms.DragEventHandler(this.tbSound_DragEnter);
|
||||||
//
|
//
|
||||||
// cmbNandLoader
|
// cmbNandLoader
|
||||||
//
|
//
|
||||||
@ -644,12 +671,15 @@ namespace CustomizeMii
|
|||||||
//
|
//
|
||||||
// tbDol
|
// tbDol
|
||||||
//
|
//
|
||||||
|
this.tbDol.AllowDrop = true;
|
||||||
this.tbDol.Location = new System.Drawing.Point(90, 83);
|
this.tbDol.Location = new System.Drawing.Point(90, 83);
|
||||||
this.tbDol.Name = "tbDol";
|
this.tbDol.Name = "tbDol";
|
||||||
this.tbDol.ReadOnly = true;
|
this.tbDol.ReadOnly = true;
|
||||||
this.tbDol.Size = new System.Drawing.Size(264, 20);
|
this.tbDol.Size = new System.Drawing.Size(264, 20);
|
||||||
this.tbDol.TabIndex = 5;
|
this.tbDol.TabIndex = 5;
|
||||||
this.tbDol.Tag = "Disabled";
|
this.tbDol.Tag = "Disabled";
|
||||||
|
this.tbDol.DragDrop += new System.Windows.Forms.DragEventHandler(this.tbDol_DragDrop);
|
||||||
|
this.tbDol.DragEnter += new System.Windows.Forms.DragEventHandler(this.tbDol_DragEnter);
|
||||||
//
|
//
|
||||||
// tbTitleID
|
// tbTitleID
|
||||||
//
|
//
|
||||||
@ -805,6 +835,7 @@ namespace CustomizeMii
|
|||||||
//
|
//
|
||||||
// lbxBannerTpls
|
// lbxBannerTpls
|
||||||
//
|
//
|
||||||
|
this.lbxBannerTpls.AllowDrop = true;
|
||||||
this.lbxBannerTpls.FormattingEnabled = true;
|
this.lbxBannerTpls.FormattingEnabled = true;
|
||||||
this.lbxBannerTpls.Location = new System.Drawing.Point(11, 12);
|
this.lbxBannerTpls.Location = new System.Drawing.Point(11, 12);
|
||||||
this.lbxBannerTpls.Name = "lbxBannerTpls";
|
this.lbxBannerTpls.Name = "lbxBannerTpls";
|
||||||
@ -812,6 +843,8 @@ namespace CustomizeMii
|
|||||||
this.lbxBannerTpls.Sorted = true;
|
this.lbxBannerTpls.Sorted = true;
|
||||||
this.lbxBannerTpls.TabIndex = 0;
|
this.lbxBannerTpls.TabIndex = 0;
|
||||||
this.lbxBannerTpls.SelectedIndexChanged += new System.EventHandler(this.lbxBannerTpls_SelectedIndexChanged);
|
this.lbxBannerTpls.SelectedIndexChanged += new System.EventHandler(this.lbxBannerTpls_SelectedIndexChanged);
|
||||||
|
this.lbxBannerTpls.DragDrop += new System.Windows.Forms.DragEventHandler(this.lbxBannerTpls_DragDrop);
|
||||||
|
this.lbxBannerTpls.DragEnter += new System.Windows.Forms.DragEventHandler(this.lbxBannerTpls_DragEnter);
|
||||||
//
|
//
|
||||||
// tabIcon
|
// tabIcon
|
||||||
//
|
//
|
||||||
@ -922,6 +955,7 @@ namespace CustomizeMii
|
|||||||
//
|
//
|
||||||
// lbxIconTpls
|
// lbxIconTpls
|
||||||
//
|
//
|
||||||
|
this.lbxIconTpls.AllowDrop = true;
|
||||||
this.lbxIconTpls.FormattingEnabled = true;
|
this.lbxIconTpls.FormattingEnabled = true;
|
||||||
this.lbxIconTpls.Location = new System.Drawing.Point(11, 12);
|
this.lbxIconTpls.Location = new System.Drawing.Point(11, 12);
|
||||||
this.lbxIconTpls.Name = "lbxIconTpls";
|
this.lbxIconTpls.Name = "lbxIconTpls";
|
||||||
@ -929,6 +963,8 @@ namespace CustomizeMii
|
|||||||
this.lbxIconTpls.Sorted = true;
|
this.lbxIconTpls.Sorted = true;
|
||||||
this.lbxIconTpls.TabIndex = 6;
|
this.lbxIconTpls.TabIndex = 6;
|
||||||
this.lbxIconTpls.SelectedIndexChanged += new System.EventHandler(this.lbxIconTpls_SelectedIndexChanged);
|
this.lbxIconTpls.SelectedIndexChanged += new System.EventHandler(this.lbxIconTpls_SelectedIndexChanged);
|
||||||
|
this.lbxIconTpls.DragDrop += new System.Windows.Forms.DragEventHandler(this.lbxIconTpls_DragDrop);
|
||||||
|
this.lbxIconTpls.DragEnter += new System.Windows.Forms.DragEventHandler(this.lbxIconTpls_DragEnter);
|
||||||
//
|
//
|
||||||
// tabBrlyt
|
// tabBrlyt
|
||||||
//
|
//
|
||||||
@ -1442,6 +1478,7 @@ namespace CustomizeMii
|
|||||||
//
|
//
|
||||||
// CustomizeMii_Main
|
// CustomizeMii_Main
|
||||||
//
|
//
|
||||||
|
this.AllowDrop = true;
|
||||||
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.ClientSize = new System.Drawing.Size(451, 290);
|
this.ClientSize = new System.Drawing.Size(451, 290);
|
||||||
@ -1454,6 +1491,8 @@ namespace CustomizeMii
|
|||||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||||
this.Text = "CustomizeMii X by Leathl";
|
this.Text = "CustomizeMii X by Leathl";
|
||||||
this.Load += new System.EventHandler(this.CustomizeMii_Main_Load);
|
this.Load += new System.EventHandler(this.CustomizeMii_Main_Load);
|
||||||
|
this.DragDrop += new System.Windows.Forms.DragEventHandler(this.CustomizeMii_Main_DragDrop);
|
||||||
|
this.DragEnter += new System.Windows.Forms.DragEventHandler(this.CustomizeMii_Main_DragEnter);
|
||||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.CustomizeMii_Main_FormClosing);
|
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.CustomizeMii_Main_FormClosing);
|
||||||
this.tabControl.ResumeLayout(false);
|
this.tabControl.ResumeLayout(false);
|
||||||
this.tabSource.ResumeLayout(false);
|
this.tabSource.ResumeLayout(false);
|
||||||
@ -1607,6 +1646,8 @@ namespace CustomizeMii
|
|||||||
private System.Windows.Forms.ToolStripMenuItem cmDolFromSource;
|
private System.Windows.Forms.ToolStripMenuItem cmDolFromSource;
|
||||||
private System.Windows.Forms.Panel panCredits;
|
private System.Windows.Forms.Panel panCredits;
|
||||||
private System.Windows.Forms.Label lbForwardMiiVersion;
|
private System.Windows.Forms.Label lbForwardMiiVersion;
|
||||||
|
private System.Windows.Forms.Label lbCreated;
|
||||||
|
private System.Windows.Forms.Label lbCreatedValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//#define Mono //Change all "\\" to "/" (in all files, without quotes) while compiling for OS X / Linux (Mono)
|
//#define Mono //Change all "\\" to "/" (in all files; without quotes) while compiling for OS X / Linux (Mono)
|
||||||
//#define Debug //Always remember to turn off :)
|
//#define Debug //Always remember to turn off :)
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
@ -45,6 +45,7 @@ namespace CustomizeMii
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Variables
|
#region Variables
|
||||||
|
public bool Mono = false;
|
||||||
public static string TempPath = Path.GetTempPath() + "CustomizeMii_Temp\\XXX\\";
|
public static string TempPath = Path.GetTempPath() + "CustomizeMii_Temp\\XXX\\";
|
||||||
public static string TempWadPath = Path.GetTempPath() + "CustomizeMii_Temp\\XXX\\TempWad.wad";
|
public static string TempWadPath = Path.GetTempPath() + "CustomizeMii_Temp\\XXX\\TempWad.wad";
|
||||||
public static string TempUnpackPath = Path.GetTempPath() + "CustomizeMii_Temp\\XXX\\Unpack\\";
|
public static string TempUnpackPath = Path.GetTempPath() + "CustomizeMii_Temp\\XXX\\Unpack\\";
|
||||||
@ -87,6 +88,7 @@ namespace CustomizeMii
|
|||||||
private Forwarder.Complex ComplexForwarder = new Forwarder.Complex();
|
private Forwarder.Complex ComplexForwarder = new Forwarder.Complex();
|
||||||
private delegate void BoxInvoker(string message);
|
private delegate void BoxInvoker(string message);
|
||||||
private delegate void SetTextInvoker(string text, TextBox tb);
|
private delegate void SetTextInvoker(string text, TextBox tb);
|
||||||
|
private delegate void SetLabelInvoker(string text, Label lb);
|
||||||
private double separatorBtn;
|
private double separatorBtn;
|
||||||
private Timer tmrCredits = new Timer();
|
private Timer tmrCredits = new Timer();
|
||||||
private ToolTip tTip = new ToolTip();
|
private ToolTip tTip = new ToolTip();
|
||||||
@ -100,17 +102,21 @@ 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();
|
UpdatePaths();
|
||||||
UpdateCheck();
|
Update.BeginInvoke(null, null);
|
||||||
|
|
||||||
#if !Mono
|
#if !Mono
|
||||||
UpdateCheckForwardMii();
|
MethodInvoker FUpdate = new MethodInvoker(UpdateCheckForwardMii);
|
||||||
|
FUpdate.BeginInvoke(null, null);
|
||||||
CommonKeyCheck();
|
CommonKeyCheck();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
InitializeStartup();
|
InitializeStartup();
|
||||||
|
|
||||||
#if Mono
|
#if Mono
|
||||||
|
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++)
|
||||||
@ -172,16 +178,19 @@ namespace CustomizeMii
|
|||||||
tmrCredits.Interval = CreditsScrollSpeed;
|
tmrCredits.Interval = CreditsScrollSpeed;
|
||||||
tmrCredits.Tick += new EventHandler(tmrCredits_Tick);
|
tmrCredits.Tick += new EventHandler(tmrCredits_Tick);
|
||||||
|
|
||||||
|
#if !Mono
|
||||||
if (File.Exists(Application.StartupPath + "\\ForwardMii.dll") && lbForwardMiiVersion.Tag != (object)"Update")
|
if (File.Exists(Application.StartupPath + "\\ForwardMii.dll") && lbForwardMiiVersion.Tag != (object)"Update")
|
||||||
{
|
{
|
||||||
SetForwardMiiLabel();
|
SetForwardMiiLabel();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !Debug
|
#if !Debug
|
||||||
DisableControls(null, null);
|
DisableControls(null, null);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !Mono
|
||||||
private void SetForwardMiiLabel()
|
private void SetForwardMiiLabel()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -191,6 +200,7 @@ namespace CustomizeMii
|
|||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
private void CommonKeyCheck()
|
private void CommonKeyCheck()
|
||||||
{
|
{
|
||||||
@ -621,6 +631,17 @@ namespace CustomizeMii
|
|||||||
tb.Text = text;
|
tb.Text = text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SetLabel(Label lb, string text)
|
||||||
|
{
|
||||||
|
SetLabelInvoker invoker = new SetLabelInvoker(this.SetLabel);
|
||||||
|
this.Invoke(invoker, text, lb);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetLabel(string text, Label lb)
|
||||||
|
{
|
||||||
|
lb.Text = text;
|
||||||
|
}
|
||||||
|
|
||||||
private string GetCurBannerPath()
|
private string GetCurBannerPath()
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(BannerReplace))
|
if (string.IsNullOrEmpty(BannerReplace))
|
||||||
@ -984,26 +1005,7 @@ namespace CustomizeMii
|
|||||||
|
|
||||||
private void btnBrowseSource_Click(object sender, EventArgs e)
|
private void btnBrowseSource_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
#if Mono
|
LoadChannel();
|
||||||
CommonKeyCheck();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (pbProgress.Value == 100)
|
|
||||||
{
|
|
||||||
OpenFileDialog ofd = new OpenFileDialog();
|
|
||||||
ofd.Filter = "Wii Channels|*.wad";
|
|
||||||
|
|
||||||
if (ofd.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
SourceWad = ofd.FileName;
|
|
||||||
BackgroundWorker bwLoadChannel = new BackgroundWorker();
|
|
||||||
bwLoadChannel.DoWork += new DoWorkEventHandler(bwLoadChannel_DoWork);
|
|
||||||
bwLoadChannel.ProgressChanged += new ProgressChangedEventHandler(bwLoadChannel_ProgressChanged);
|
|
||||||
bwLoadChannel.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bwLoadChannel_RunWorkerCompleted);
|
|
||||||
bwLoadChannel.WorkerReportsProgress = true;
|
|
||||||
bwLoadChannel.RunWorkerAsync(ofd.FileName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnLoadBaseWad_Click(object sender, EventArgs e)
|
private void btnLoadBaseWad_Click(object sender, EventArgs e)
|
||||||
@ -1221,102 +1223,7 @@ namespace CustomizeMii
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(tbSourceWad.Text))
|
ReplacePart();
|
||||||
{
|
|
||||||
if (pbProgress.Value == 100)
|
|
||||||
{
|
|
||||||
if (cmbReplace.SelectedIndex == 2) //sound
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
OpenFileDialog ofd = new OpenFileDialog();
|
|
||||||
ofd.Filter = "Wii Channels|*.wad|00000000.app|00000000.app|sound.bin|sound.bin|All|*.wad;00000000.app;sound.bin";
|
|
||||||
ofd.FilterIndex = 4;
|
|
||||||
|
|
||||||
if (ofd.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
if (ofd.FileName != tbSourceWad.Text)
|
|
||||||
{
|
|
||||||
SoundReplace = ofd.FileName;
|
|
||||||
SetText(tbReplace, SoundReplace);
|
|
||||||
BackgroundWorker bwSoundReplace = new BackgroundWorker();
|
|
||||||
bwSoundReplace.DoWork += new DoWorkEventHandler(bwSoundReplace_DoWork);
|
|
||||||
bwSoundReplace.ProgressChanged += new ProgressChangedEventHandler(bwSoundReplace_ProgressChanged);
|
|
||||||
bwSoundReplace.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bwSoundReplace_RunWorkerCompleted);
|
|
||||||
bwSoundReplace.WorkerReportsProgress = true;
|
|
||||||
bwSoundReplace.RunWorkerAsync(ofd.FileName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
SoundReplace = string.Empty;
|
|
||||||
SetText(tbReplace, SoundReplace);
|
|
||||||
ErrorBox(ex.Message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (cmbReplace.SelectedIndex == 1) //icon
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
OpenFileDialog ofd = new OpenFileDialog();
|
|
||||||
ofd.Filter = "Wii Channels|*.wad|00000000.app|00000000.app|icon.bin|icon.bin|All|*.wad;00000000.app;icon.bin";
|
|
||||||
ofd.FilterIndex = 4;
|
|
||||||
|
|
||||||
if (ofd.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
if (ofd.FileName != tbSourceWad.Text)
|
|
||||||
{
|
|
||||||
IconReplace = ofd.FileName;
|
|
||||||
SetText(tbReplace, IconReplace);
|
|
||||||
BackgroundWorker bwIconReplace = new BackgroundWorker();
|
|
||||||
bwIconReplace.DoWork += new DoWorkEventHandler(bwIconReplace_DoWork);
|
|
||||||
bwIconReplace.ProgressChanged += new ProgressChangedEventHandler(bwIconReplace_ProgressChanged);
|
|
||||||
bwIconReplace.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bwIconReplace_RunWorkerCompleted);
|
|
||||||
bwIconReplace.WorkerReportsProgress = true;
|
|
||||||
bwIconReplace.RunWorkerAsync(ofd.FileName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
IconReplace = string.Empty;
|
|
||||||
SetText(tbReplace, IconReplace);
|
|
||||||
ErrorBox(ex.Message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else //banner
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
OpenFileDialog ofd = new OpenFileDialog();
|
|
||||||
ofd.Filter = "Wii Channels|*.wad|00000000.app|00000000.app|banner.bin|banner.bin|All|*.wad;00000000.app;banner.bin";
|
|
||||||
ofd.FilterIndex = 4;
|
|
||||||
|
|
||||||
if (ofd.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
if (ofd.FileName != tbSourceWad.Text)
|
|
||||||
{
|
|
||||||
BannerReplace = ofd.FileName;
|
|
||||||
SetText(tbReplace, BannerReplace);
|
|
||||||
BackgroundWorker bwBannerReplace = new BackgroundWorker();
|
|
||||||
bwBannerReplace.DoWork += new DoWorkEventHandler(bwBannerReplace_DoWork);
|
|
||||||
bwBannerReplace.ProgressChanged += new ProgressChangedEventHandler(bwBannerReplace_ProgressChanged);
|
|
||||||
bwBannerReplace.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bwBannerReplace_RunWorkerCompleted);
|
|
||||||
bwBannerReplace.WorkerReportsProgress = true;
|
|
||||||
bwBannerReplace.RunWorkerAsync(ofd.FileName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
BannerReplace = string.Empty;
|
|
||||||
SetText(tbReplace, BannerReplace);
|
|
||||||
ErrorBox(ex.Message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1873,7 +1780,7 @@ namespace CustomizeMii
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Check BNS sound length
|
//Check BNS sound length
|
||||||
if (tbSound.Text.StartsWith("BNS:") || tbSound.Text.EndsWith(".bns"))
|
if (tbSound.Text.StartsWith("BNS:") || tbSound.Text.ToLower().EndsWith(".bns"))
|
||||||
{
|
{
|
||||||
string bnsFile = tbSound.Text;
|
string bnsFile = tbSound.Text;
|
||||||
if (tbSound.Text.StartsWith("BNS:")) bnsFile = TempBnsPath;
|
if (tbSound.Text.StartsWith("BNS:")) bnsFile = TempBnsPath;
|
||||||
@ -2690,13 +2597,17 @@ namespace CustomizeMii
|
|||||||
|
|
||||||
private void btnDeleteBanner_Click(object sender, EventArgs e)
|
private void btnDeleteBanner_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if (lbxBannerTpls.SelectedIndex != -1)
|
||||||
|
{
|
||||||
|
int idx = lbxBannerTpls.SelectedIndex;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string TplName = lbxBannerTpls.SelectedItem.ToString().Replace(" (Transparent)", string.Empty);
|
string TplName = lbxBannerTpls.SelectedItem.ToString().Replace(" (Transparent)", string.Empty);
|
||||||
string CurBannerPath = GetCurBannerPath();
|
string CurBannerPath = GetCurBannerPath();
|
||||||
string[] brlytTpls = Wii.Brlyt.GetBrlytTpls(CurBannerPath + "blyt\\banner.brlyt");
|
string[] brlytTpls = Wii.Brlyt.GetBrlytTpls(CurBannerPath + "blyt\\banner.brlyt");
|
||||||
|
|
||||||
if (!Wii.Tools.StringExistsInStringArray(TplName, brlytTpls))
|
if (!Wii.Tools.StringExistsInStringArray(TplName, brlytTpls) || cbFailureChecks.Checked)
|
||||||
{
|
{
|
||||||
File.Delete(CurBannerPath + "timg\\" + TplName);
|
File.Delete(CurBannerPath + "timg\\" + TplName);
|
||||||
lbxBannerTpls.Items.Remove(lbxBannerTpls.SelectedItem);
|
lbxBannerTpls.Items.Remove(lbxBannerTpls.SelectedItem);
|
||||||
@ -2707,10 +2618,27 @@ namespace CustomizeMii
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex) { ErrorBox(ex.Message); }
|
catch (Exception ex) { ErrorBox(ex.Message); }
|
||||||
|
|
||||||
|
for (; ; )
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
lbxBannerTpls.SelectedIndex = idx;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
catch { idx--; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
lbxBannerTpls.Select();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnDeleteIcon_Click(object sender, EventArgs e)
|
private void btnDeleteIcon_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if (lbxIconTpls.SelectedIndex != -1)
|
||||||
|
{
|
||||||
|
int idx = lbxIconTpls.SelectedIndex;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string TplName = lbxIconTpls.SelectedItem.ToString().Replace(" (Transparent)", string.Empty);
|
string TplName = lbxIconTpls.SelectedItem.ToString().Replace(" (Transparent)", string.Empty);
|
||||||
@ -2718,7 +2646,7 @@ namespace CustomizeMii
|
|||||||
|
|
||||||
string[] brlytTpls = Wii.Brlyt.GetBrlytTpls(CurIconPath + "blyt\\icon.brlyt");
|
string[] brlytTpls = Wii.Brlyt.GetBrlytTpls(CurIconPath + "blyt\\icon.brlyt");
|
||||||
|
|
||||||
if (!Wii.Tools.StringExistsInStringArray(TplName, brlytTpls))
|
if (!Wii.Tools.StringExistsInStringArray(TplName, brlytTpls) || cbFailureChecks.Checked)
|
||||||
{
|
{
|
||||||
File.Delete(CurIconPath + "timg\\" + TplName);
|
File.Delete(CurIconPath + "timg\\" + TplName);
|
||||||
lbxIconTpls.Items.Remove(lbxIconTpls.SelectedItem);
|
lbxIconTpls.Items.Remove(lbxIconTpls.SelectedItem);
|
||||||
@ -2729,137 +2657,30 @@ namespace CustomizeMii
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex) { ErrorBox(ex.Message); }
|
catch (Exception ex) { ErrorBox(ex.Message); }
|
||||||
|
|
||||||
|
for (; ; )
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
lbxIconTpls.SelectedIndex = idx;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
catch { idx--; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
lbxIconTpls.Select();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnAddBanner_Click(object sender, EventArgs e)
|
private void btnAddBanner_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
try
|
try { AddTpl(lbxBannerTpls); }
|
||||||
{
|
|
||||||
OpenFileDialog ofd = new OpenFileDialog();
|
|
||||||
ofd.Filter = "TPL|*.tpl|PNG|*.png|JPG|*.jpg|GIF|*.gif|BMP|*.bmp|All|*.tpl;*.png;*.jpg;*.gif;*.bmp";
|
|
||||||
ofd.FilterIndex = 6;
|
|
||||||
|
|
||||||
if (ofd.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < lbxBannerTpls.Items.Count; i++)
|
|
||||||
{
|
|
||||||
if (lbxBannerTpls.Items[i].ToString().ToLower() == Path.GetFileNameWithoutExtension(ofd.FileName).ToLower() + ".tpl")
|
|
||||||
{
|
|
||||||
ErrorBox("This TPL already exists, use the Replace button");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
string CurBannerPath = GetCurBannerPath();
|
|
||||||
string[] brlytTpls = Wii.Brlyt.GetBrlytTpls(CurBannerPath + "blyt\\banner.brlyt");
|
|
||||||
string TplName = Path.GetFileNameWithoutExtension(ofd.FileName) + ".tpl";
|
|
||||||
int TplFormat = 6;
|
|
||||||
|
|
||||||
switch (cmbFormatBanner.SelectedIndex)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
TplFormat = 6;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
TplFormat = 4;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
TplFormat = 5;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
if (!ofd.FileName.ToLower().EndsWith(".tpl"))
|
|
||||||
{
|
|
||||||
ErrorBox("This format is not supported, you must choose either RGBA8, RGB565 or RGB5A3!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!Wii.Tools.StringExistsInStringArray(TplName, brlytTpls))
|
|
||||||
{
|
|
||||||
if (MessageBox.Show("This TPL is not required by your banner.brlyt and thus only wastes memory!\nDo you still want to add it?", "TPL not required", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.No)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ofd.FileName.ToLower().EndsWith(".tpl"))
|
|
||||||
{
|
|
||||||
File.Copy(ofd.FileName, CurBannerPath + "timg\\" + TplName, true);
|
|
||||||
lbxBannerTpls.Items.Add(TplName);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Image img = Image.FromFile(ofd.FileName);
|
|
||||||
Wii.TPL.ConvertToTPL(img, CurBannerPath + "timg\\" + TplName, TplFormat);
|
|
||||||
lbxBannerTpls.Items.Add(TplName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex) { ErrorBox(ex.Message); }
|
catch (Exception ex) { ErrorBox(ex.Message); }
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnAddIcon_Click(object sender, EventArgs e)
|
private void btnAddIcon_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
try
|
try { AddTpl(lbxIconTpls); }
|
||||||
{
|
|
||||||
OpenFileDialog ofd = new OpenFileDialog();
|
|
||||||
ofd.Filter = "TPL|*.tpl|PNG|*.png|JPG|*.jpg|GIF|*.gif|BMP|*.bmp|All|*.tpl;*.png;*.jpg;*.gif;*.bmp";
|
|
||||||
ofd.FilterIndex = 6;
|
|
||||||
|
|
||||||
if (ofd.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < lbxIconTpls.Items.Count; i++)
|
|
||||||
{
|
|
||||||
if (lbxIconTpls.Items[i].ToString().ToLower() == Path.GetFileNameWithoutExtension(ofd.FileName).ToLower() + ".tpl")
|
|
||||||
{
|
|
||||||
ErrorBox("This TPL already exists, use the Replace button");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
string CuriconPath = GetCurIconPath();
|
|
||||||
string[] brlytTpls = Wii.Brlyt.GetBrlytTpls(CuriconPath + "blyt\\icon.brlyt");
|
|
||||||
string TplName = Path.GetFileNameWithoutExtension(ofd.FileName) + ".tpl";
|
|
||||||
int TplFormat = 6;
|
|
||||||
|
|
||||||
switch (cmbFormatIcon.SelectedIndex)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
TplFormat = 6;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
TplFormat = 4;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
TplFormat = 5;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
if (!ofd.FileName.ToLower().EndsWith(".tpl"))
|
|
||||||
{
|
|
||||||
ErrorBox("This format is not supported, you must choose either RGBA8, RGB565 or RGB5A3!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!Wii.Tools.StringExistsInStringArray(TplName, brlytTpls))
|
|
||||||
{
|
|
||||||
if (MessageBox.Show("This TPL is not required by your icon.brlyt and thus only wastes memory!\nDo you still want to add it?", "TPL not required", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.No)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ofd.FileName.ToLower().EndsWith(".tpl"))
|
|
||||||
{
|
|
||||||
File.Copy(ofd.FileName, CuriconPath + "timg\\" + TplName, true);
|
|
||||||
lbxIconTpls.Items.Add(TplName);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Image img = Image.FromFile(ofd.FileName);
|
|
||||||
Wii.TPL.ConvertToTPL(img, CuriconPath + "timg\\" + TplName, TplFormat);
|
|
||||||
lbxIconTpls.Items.Add(TplName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex) { ErrorBox(ex.Message); }
|
catch (Exception ex) { ErrorBox(ex.Message); }
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3256,7 +3077,7 @@ namespace CustomizeMii
|
|||||||
|
|
||||||
if (ofd.ShowDialog() == DialogResult.OK)
|
if (ofd.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
if (ofd.FileName.EndsWith(".wad"))
|
if (ofd.FileName.ToLower().EndsWith(".wad"))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
284
CustomizeMii/CustomizeMii_PrivateFunctions.cs
Normal file
284
CustomizeMii/CustomizeMii_PrivateFunctions.cs
Normal file
@ -0,0 +1,284 @@
|
|||||||
|
using System;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.IO;
|
||||||
|
using System.Drawing;
|
||||||
|
|
||||||
|
namespace CustomizeMii
|
||||||
|
{
|
||||||
|
partial class CustomizeMii_Main
|
||||||
|
{
|
||||||
|
private void AddTpl(ListBox lbx)
|
||||||
|
{
|
||||||
|
AddTpl(lbx, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddTpl(ListBox lbx, string inputFile)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(inputFile))
|
||||||
|
{
|
||||||
|
OpenFileDialog ofd = new OpenFileDialog();
|
||||||
|
ofd.Filter = "TPL|*.tpl|PNG|*.png|JPG|*.jpg|GIF|*.gif|BMP|*.bmp|All|*.tpl;*.png;*.jpg;*.gif;*.bmp";
|
||||||
|
ofd.FilterIndex = 6;
|
||||||
|
|
||||||
|
if (ofd.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
inputFile = ofd.FileName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(inputFile))
|
||||||
|
{
|
||||||
|
for (int i = 0; i < lbx.Items.Count; i++)
|
||||||
|
if (lbx.Items[i].ToString().ToLower() == Path.GetFileNameWithoutExtension(inputFile).ToLower() + ".tpl")
|
||||||
|
throw new Exception("This TPL already exists, use the Replace button");
|
||||||
|
|
||||||
|
string CurPath;
|
||||||
|
if (lbx == lbxBannerTpls) CurPath = GetCurBannerPath();
|
||||||
|
else CurPath = GetCurIconPath();
|
||||||
|
|
||||||
|
string[] brlytTpls = Wii.Brlyt.GetBrlytTpls(CurPath + string.Format("blyt\\{0}.brlyt", lbx == lbxBannerTpls ? "banner" : "icon"));
|
||||||
|
string TplName = Path.GetFileNameWithoutExtension(inputFile) + ".tpl";
|
||||||
|
int TplFormat = 6;
|
||||||
|
|
||||||
|
int switchVal = lbx == lbxBannerTpls ? cmbFormatBanner.SelectedIndex : cmbFormatIcon.SelectedIndex;
|
||||||
|
switch (switchVal)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
TplFormat = 6;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
TplFormat = 4;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
TplFormat = 5;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (!inputFile.ToLower().EndsWith(".tpl"))
|
||||||
|
throw new Exception("This format is not supported, you must choose either RGBA8, RGB565 or RGB5A3!");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Wii.Tools.StringExistsInStringArray(TplName, brlytTpls))
|
||||||
|
{
|
||||||
|
if (MessageBox.Show(string.Format("{0} is not required by your {1}.brlyt and thus only wastes memory!\nDo you still want to add it?", TplName, lbx == lbxBannerTpls ? "banner" : "icon"), "TPL not required", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.No)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (inputFile.ToLower().EndsWith(".tpl"))
|
||||||
|
{
|
||||||
|
File.Copy(inputFile, CurPath + "timg\\" + TplName, true);
|
||||||
|
lbx.Items.Add(TplName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
using (Image img = Image.FromFile(inputFile))
|
||||||
|
{
|
||||||
|
Wii.TPL.ConvertToTPL(img, CurPath + "timg\\" + TplName, TplFormat);
|
||||||
|
lbx.Items.Add(TplName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex) { throw ex; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadChannel()
|
||||||
|
{
|
||||||
|
LoadChannel(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadChannel(string inputFile)
|
||||||
|
{
|
||||||
|
if (this.Mono) CommonKeyCheck();
|
||||||
|
|
||||||
|
if (pbProgress.Value == 100)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(inputFile))
|
||||||
|
{
|
||||||
|
OpenFileDialog ofd = new OpenFileDialog();
|
||||||
|
ofd.Filter = "Wii Channels|*.wad";
|
||||||
|
|
||||||
|
if (ofd.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
SourceWad = ofd.FileName;
|
||||||
|
BackgroundWorker bwLoadChannel = new BackgroundWorker();
|
||||||
|
bwLoadChannel.DoWork += new DoWorkEventHandler(bwLoadChannel_DoWork);
|
||||||
|
bwLoadChannel.ProgressChanged += new ProgressChangedEventHandler(bwLoadChannel_ProgressChanged);
|
||||||
|
bwLoadChannel.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bwLoadChannel_RunWorkerCompleted);
|
||||||
|
bwLoadChannel.WorkerReportsProgress = true;
|
||||||
|
bwLoadChannel.RunWorkerAsync(ofd.FileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SourceWad = inputFile;
|
||||||
|
BackgroundWorker bwLoadChannel = new BackgroundWorker();
|
||||||
|
bwLoadChannel.DoWork += new DoWorkEventHandler(bwLoadChannel_DoWork);
|
||||||
|
bwLoadChannel.ProgressChanged += new ProgressChangedEventHandler(bwLoadChannel_ProgressChanged);
|
||||||
|
bwLoadChannel.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bwLoadChannel_RunWorkerCompleted);
|
||||||
|
bwLoadChannel.WorkerReportsProgress = true;
|
||||||
|
bwLoadChannel.RunWorkerAsync(inputFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ReplacePart()
|
||||||
|
{
|
||||||
|
ReplacePart(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ReplacePart(string inputFile)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(tbSourceWad.Text))
|
||||||
|
{
|
||||||
|
if (pbProgress.Value == 100)
|
||||||
|
{
|
||||||
|
if (cmbReplace.SelectedIndex == 2) //sound
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(inputFile))
|
||||||
|
{
|
||||||
|
OpenFileDialog ofd = new OpenFileDialog();
|
||||||
|
ofd.Filter = "Wii Channels|*.wad|00000000.app|00000000.app|sound.bin|sound.bin|All|*.wad;00000000.app;sound.bin";
|
||||||
|
ofd.FilterIndex = 4;
|
||||||
|
|
||||||
|
if (ofd.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
if (ofd.FileName != tbSourceWad.Text)
|
||||||
|
{
|
||||||
|
SoundReplace = ofd.FileName;
|
||||||
|
SetText(tbReplace, SoundReplace);
|
||||||
|
BackgroundWorker bwSoundReplace = new BackgroundWorker();
|
||||||
|
bwSoundReplace.DoWork += new DoWorkEventHandler(bwSoundReplace_DoWork);
|
||||||
|
bwSoundReplace.ProgressChanged += new ProgressChangedEventHandler(bwSoundReplace_ProgressChanged);
|
||||||
|
bwSoundReplace.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bwSoundReplace_RunWorkerCompleted);
|
||||||
|
bwSoundReplace.WorkerReportsProgress = true;
|
||||||
|
bwSoundReplace.RunWorkerAsync(ofd.FileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (inputFile != tbSourceWad.Text)
|
||||||
|
{
|
||||||
|
SoundReplace = inputFile;
|
||||||
|
SetText(tbReplace, SoundReplace);
|
||||||
|
BackgroundWorker bwSoundReplace = new BackgroundWorker();
|
||||||
|
bwSoundReplace.DoWork += new DoWorkEventHandler(bwSoundReplace_DoWork);
|
||||||
|
bwSoundReplace.ProgressChanged += new ProgressChangedEventHandler(bwSoundReplace_ProgressChanged);
|
||||||
|
bwSoundReplace.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bwSoundReplace_RunWorkerCompleted);
|
||||||
|
bwSoundReplace.WorkerReportsProgress = true;
|
||||||
|
bwSoundReplace.RunWorkerAsync(inputFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
SoundReplace = string.Empty;
|
||||||
|
SetText(tbReplace, SoundReplace);
|
||||||
|
ErrorBox(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (cmbReplace.SelectedIndex == 1) //icon
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(inputFile))
|
||||||
|
{
|
||||||
|
OpenFileDialog ofd = new OpenFileDialog();
|
||||||
|
ofd.Filter = "Wii Channels|*.wad|00000000.app|00000000.app|icon.bin|icon.bin|All|*.wad;00000000.app;icon.bin";
|
||||||
|
ofd.FilterIndex = 4;
|
||||||
|
|
||||||
|
if (ofd.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
if (ofd.FileName != tbSourceWad.Text)
|
||||||
|
{
|
||||||
|
IconReplace = ofd.FileName;
|
||||||
|
SetText(tbReplace, IconReplace);
|
||||||
|
BackgroundWorker bwIconReplace = new BackgroundWorker();
|
||||||
|
bwIconReplace.DoWork += new DoWorkEventHandler(bwIconReplace_DoWork);
|
||||||
|
bwIconReplace.ProgressChanged += new ProgressChangedEventHandler(bwIconReplace_ProgressChanged);
|
||||||
|
bwIconReplace.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bwIconReplace_RunWorkerCompleted);
|
||||||
|
bwIconReplace.WorkerReportsProgress = true;
|
||||||
|
bwIconReplace.RunWorkerAsync(ofd.FileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (inputFile != tbSourceWad.Text)
|
||||||
|
{
|
||||||
|
IconReplace = inputFile;
|
||||||
|
SetText(tbReplace, IconReplace);
|
||||||
|
BackgroundWorker bwIconReplace = new BackgroundWorker();
|
||||||
|
bwIconReplace.DoWork += new DoWorkEventHandler(bwIconReplace_DoWork);
|
||||||
|
bwIconReplace.ProgressChanged += new ProgressChangedEventHandler(bwIconReplace_ProgressChanged);
|
||||||
|
bwIconReplace.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bwIconReplace_RunWorkerCompleted);
|
||||||
|
bwIconReplace.WorkerReportsProgress = true;
|
||||||
|
bwIconReplace.RunWorkerAsync(inputFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
IconReplace = string.Empty;
|
||||||
|
SetText(tbReplace, IconReplace);
|
||||||
|
ErrorBox(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else //banner
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(inputFile))
|
||||||
|
{
|
||||||
|
OpenFileDialog ofd = new OpenFileDialog();
|
||||||
|
ofd.Filter = "Wii Channels|*.wad|00000000.app|00000000.app|banner.bin|banner.bin|All|*.wad;00000000.app;banner.bin";
|
||||||
|
ofd.FilterIndex = 4;
|
||||||
|
|
||||||
|
if (ofd.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
if (ofd.FileName != tbSourceWad.Text)
|
||||||
|
{
|
||||||
|
BannerReplace = ofd.FileName;
|
||||||
|
SetText(tbReplace, BannerReplace);
|
||||||
|
BackgroundWorker bwBannerReplace = new BackgroundWorker();
|
||||||
|
bwBannerReplace.DoWork += new DoWorkEventHandler(bwBannerReplace_DoWork);
|
||||||
|
bwBannerReplace.ProgressChanged += new ProgressChangedEventHandler(bwBannerReplace_ProgressChanged);
|
||||||
|
bwBannerReplace.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bwBannerReplace_RunWorkerCompleted);
|
||||||
|
bwBannerReplace.WorkerReportsProgress = true;
|
||||||
|
bwBannerReplace.RunWorkerAsync(ofd.FileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (inputFile != tbSourceWad.Text)
|
||||||
|
{
|
||||||
|
BannerReplace = inputFile;
|
||||||
|
SetText(tbReplace, BannerReplace);
|
||||||
|
BackgroundWorker bwBannerReplace = new BackgroundWorker();
|
||||||
|
bwBannerReplace.DoWork += new DoWorkEventHandler(bwBannerReplace_DoWork);
|
||||||
|
bwBannerReplace.ProgressChanged += new ProgressChangedEventHandler(bwBannerReplace_ProgressChanged);
|
||||||
|
bwBannerReplace.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bwBannerReplace_RunWorkerCompleted);
|
||||||
|
bwBannerReplace.WorkerReportsProgress = true;
|
||||||
|
bwBannerReplace.RunWorkerAsync(inputFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
BannerReplace = string.Empty;
|
||||||
|
SetText(tbReplace, BannerReplace);
|
||||||
|
ErrorBox(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
245
CustomizeMii/MP3Info.cs
Normal file
245
CustomizeMii/MP3Info.cs
Normal file
@ -0,0 +1,245 @@
|
|||||||
|
/* This file is part of CustomizeMii
|
||||||
|
* Copyright (C) 2009 Leathl
|
||||||
|
*
|
||||||
|
* CustomizeMii is free software: you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License as published
|
||||||
|
* by the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* CustomizeMii is distributed in the hope that it will be
|
||||||
|
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||||
|
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
class MP3Info
|
||||||
|
{
|
||||||
|
//Private Variables
|
||||||
|
private int fileSize;
|
||||||
|
private int headerPos;
|
||||||
|
private BitArray bitHeader;
|
||||||
|
private MpegVersion mpegVersion;
|
||||||
|
private MpegLayer mpegLayer;
|
||||||
|
private int bitrate;
|
||||||
|
private int frequency;
|
||||||
|
private bool paddingBit;
|
||||||
|
private int frameLength;
|
||||||
|
private int frameCount;
|
||||||
|
private double secLength;
|
||||||
|
private int waveSamples;
|
||||||
|
|
||||||
|
//Public Variables
|
||||||
|
public int FileSize { get { return fileSize; } }
|
||||||
|
public MpegVersion MPEGVersion { get { return mpegVersion; } }
|
||||||
|
public MpegLayer MPEGLayer { get { return mpegLayer; } }
|
||||||
|
public int Bitrate { get { return bitrate; } }
|
||||||
|
public int Frequency { get { return frequency; } }
|
||||||
|
public int FrameLength { get { return frameLength; } }
|
||||||
|
public int FrameCount { get { return frameCount; } }
|
||||||
|
public double Seconds { get { return secLength; } }
|
||||||
|
public int AudioSamples { get { return waveSamples; } }
|
||||||
|
|
||||||
|
//Public Functions
|
||||||
|
public MP3Info(string mp3File)
|
||||||
|
{
|
||||||
|
FileInfo fi = new FileInfo(mp3File);
|
||||||
|
this.fileSize = (int)fi.Length;
|
||||||
|
|
||||||
|
FileStream fs = fi.OpenRead();
|
||||||
|
fs.Seek(0, SeekOrigin.Begin);
|
||||||
|
|
||||||
|
this.headerPos = SearchHeader(fs);
|
||||||
|
|
||||||
|
byte[] header = new byte[4];
|
||||||
|
fs.Seek(this.headerPos, SeekOrigin.Begin);
|
||||||
|
fs.Read(header, 0, header.Length);
|
||||||
|
fs.Close();
|
||||||
|
|
||||||
|
GetHeaderBits(header);
|
||||||
|
LoadHeader();
|
||||||
|
}
|
||||||
|
|
||||||
|
public MP3Info(byte[] mp3Header)
|
||||||
|
{
|
||||||
|
GetHeaderBits(mp3Header);
|
||||||
|
LoadHeader();
|
||||||
|
}
|
||||||
|
|
||||||
|
//Private Functions
|
||||||
|
private void ShowHeader()
|
||||||
|
{
|
||||||
|
//For debugging
|
||||||
|
if (this.bitHeader != null)
|
||||||
|
{
|
||||||
|
string strBits = string.Empty;
|
||||||
|
foreach (bool x in this.bitHeader)
|
||||||
|
if (x) strBits += "1"; else strBits += "0";
|
||||||
|
|
||||||
|
for (int i = strBits.Length - 8; i >= 0; i -= 8)
|
||||||
|
strBits = strBits.Insert(i, " ");
|
||||||
|
|
||||||
|
System.Windows.Forms.MessageBox.Show(strBits);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private int SearchHeader(Stream fileStream)
|
||||||
|
{
|
||||||
|
int tmp;
|
||||||
|
|
||||||
|
while ((tmp = fileStream.ReadByte()) != -1)
|
||||||
|
{
|
||||||
|
if (tmp == 255)
|
||||||
|
{
|
||||||
|
tmp = fileStream.ReadByte();
|
||||||
|
BitArray tmpBits = new BitArray(new int[] { tmp });
|
||||||
|
if (tmpBits[7] && tmpBits[6] && tmpBits[5]) return (int)(fileStream.Position - 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new Exception("Frame Header couldn't be found!");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GetHeaderBits(byte[] fourBytes)
|
||||||
|
{
|
||||||
|
BitArray tmp = new BitArray(fourBytes);
|
||||||
|
this.bitHeader = new BitArray(4 * 8);
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
for (int i = 0; i < 32; i += 8)
|
||||||
|
for (int j = 7; j >= 0; j--)
|
||||||
|
this.bitHeader[count++] = tmp[i + j];
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadHeader()
|
||||||
|
{
|
||||||
|
GetVersion(this.bitHeader[11], this.bitHeader[12]);
|
||||||
|
if (this.mpegVersion == MpegVersion.Reserved) throw new NotSupportedException("Unsupported MPEG Version!");
|
||||||
|
GetLayer(this.bitHeader[13], this.bitHeader[14]);
|
||||||
|
if (this.mpegLayer == MpegLayer.Reserved) throw new NotSupportedException("Unsupported MPEG Layer!");
|
||||||
|
GetBitrate(this.bitHeader[16], this.bitHeader[17], this.bitHeader[18], this.bitHeader[19]);
|
||||||
|
if (this.bitrate == 0) throw new NotSupportedException("Unsupported Bitrate!");
|
||||||
|
GetFrequency(this.bitHeader[20], this.bitHeader[21]);
|
||||||
|
if (this.frequency == -1) throw new NotSupportedException("Unsupported Frequency");
|
||||||
|
this.paddingBit = this.bitHeader[22];
|
||||||
|
|
||||||
|
GetFrameLength();
|
||||||
|
GetFrameCount();
|
||||||
|
GetSeconds();
|
||||||
|
GetWaveSamples();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GetVersion(params bool[] twoBits)
|
||||||
|
{
|
||||||
|
if (twoBits[0] && twoBits[1]) this.mpegVersion = MpegVersion.MpegVersion1;
|
||||||
|
else if (twoBits[0] && !twoBits[1]) this.mpegVersion = MpegVersion.MpegVersion2;
|
||||||
|
else if (!twoBits[0] && twoBits[1]) this.mpegVersion = MpegVersion.Reserved;
|
||||||
|
else if (!twoBits[0] && !twoBits[1]) this.mpegVersion = MpegVersion.MpegVersion25;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GetLayer(params bool[] twoBits)
|
||||||
|
{
|
||||||
|
if (twoBits[0] && twoBits[1]) this.mpegLayer = MpegLayer.I;
|
||||||
|
else if (twoBits[0] && !twoBits[1]) this.mpegLayer = MpegLayer.II;
|
||||||
|
else if (!twoBits[0] && twoBits[1]) this.mpegLayer = MpegLayer.III;
|
||||||
|
else if (!twoBits[0] && !twoBits[1]) this.mpegLayer = MpegLayer.Reserved;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GetBitrate(params bool[] fourBits)
|
||||||
|
{
|
||||||
|
int[] bitrateTable = GetBitrateTable();
|
||||||
|
|
||||||
|
Array.Reverse(fourBits);
|
||||||
|
BitArray bArray = new BitArray(fourBits);
|
||||||
|
byte[] index = new byte[1];
|
||||||
|
bArray.CopyTo(index, 0);
|
||||||
|
|
||||||
|
this.bitrate = bitrateTable[index[0]];
|
||||||
|
}
|
||||||
|
|
||||||
|
private int[] GetBitrateTable()
|
||||||
|
{
|
||||||
|
if (this.mpegVersion == MpegVersion.MpegVersion1)
|
||||||
|
{
|
||||||
|
if (this.mpegLayer == MpegLayer.I) return new int[] { 0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, 0 };
|
||||||
|
if (this.mpegLayer == MpegLayer.II) return new int[] { 0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, 0 };
|
||||||
|
if (this.mpegLayer == MpegLayer.III) return new int[] { 0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 0 };
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (this.mpegLayer == MpegLayer.I) return new int[] { 0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256, 0 };
|
||||||
|
if (this.mpegLayer == MpegLayer.II ||
|
||||||
|
this.mpegLayer == MpegLayer.III) return new int[] { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 0 };
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new NotSupportedException("Unsupported MPEG Version or Layer!");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GetFrequency(params bool[] twoBits)
|
||||||
|
{
|
||||||
|
int[] frequencyTable = GetFrequencyTable();
|
||||||
|
|
||||||
|
Array.Reverse(twoBits);
|
||||||
|
BitArray bArray = new BitArray(twoBits);
|
||||||
|
byte[] index = new byte[1];
|
||||||
|
bArray.CopyTo(index, 0);
|
||||||
|
|
||||||
|
this.frequency = frequencyTable[index[0]];
|
||||||
|
}
|
||||||
|
|
||||||
|
private int[] GetFrequencyTable()
|
||||||
|
{
|
||||||
|
if (this.mpegVersion == MpegVersion.MpegVersion1)
|
||||||
|
return new int[] { 44100, 48000, 32000, -1 };
|
||||||
|
else if (this.mpegVersion == MpegVersion.MpegVersion2)
|
||||||
|
return new int[] { 22050, 24000, 16000, -1 };
|
||||||
|
else if (this.mpegVersion == MpegVersion.MpegVersion25)
|
||||||
|
return new int[] { 32000, 16000, 8000, -1 };
|
||||||
|
else
|
||||||
|
return new int[] { 0, 0, 0, -1 };
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GetFrameLength()
|
||||||
|
{
|
||||||
|
double frmSize = (double)((this.mpegLayer == MpegLayer.I ? 12 : 144) * ((1000.0 * (float)this.bitrate / (float)this.frequency)));
|
||||||
|
this.frameLength = (int)Math.Ceiling(frmSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GetFrameCount()
|
||||||
|
{
|
||||||
|
this.frameCount = (this.fileSize - this.headerPos) / this.frameLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GetSeconds()
|
||||||
|
{
|
||||||
|
this.secLength = ((this.fileSize - this.headerPos) * 8.00) / (1000.00 * this.bitrate);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GetWaveSamples()
|
||||||
|
{
|
||||||
|
this.waveSamples = this.frameCount * 1125;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Structs & Enums
|
||||||
|
public enum MpegVersion : int
|
||||||
|
{
|
||||||
|
Reserved = 0,
|
||||||
|
MpegVersion1 = 1,
|
||||||
|
MpegVersion25 = 2,
|
||||||
|
MpegVersion2 = 3
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum MpegLayer : int
|
||||||
|
{
|
||||||
|
Reserved = 0,
|
||||||
|
I = 1,
|
||||||
|
II = 2,
|
||||||
|
III = 3
|
||||||
|
}
|
||||||
|
}
|
@ -11,7 +11,10 @@ Changelog:
|
|||||||
|
|
||||||
Version 2.1
|
Version 2.1
|
||||||
- Replaced the TPL preview window with the one from ShowMiiWads for easier handling
|
- Replaced the TPL preview window with the one from ShowMiiWads for easier handling
|
||||||
-
|
- Added loop prelistening to the BNS conversion window (only for wave files)
|
||||||
|
- Added drag & drop ability cause the file dialogs kept bothering me
|
||||||
|
- Improvement in startup speed (thanks shadow1643)
|
||||||
|
- Added Unix timestamp as footer (interesting to know when channels were created, huh?)
|
||||||
- Little improvements
|
- Little improvements
|
||||||
|
|
||||||
Version 2.01
|
Version 2.01
|
||||||
|
@ -58,6 +58,10 @@ namespace WaveFile
|
|||||||
/// The start sample of the first Loop (if exist)
|
/// The start sample of the first Loop (if exist)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int LoopStart { get { return GetLoopStart(); } }
|
public int LoopStart { get { return GetLoopStart(); } }
|
||||||
|
/// <summary>
|
||||||
|
/// The total number of Frames
|
||||||
|
/// </summary>
|
||||||
|
public int SampleCount { get { return GetFrameCount(); } }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -123,6 +127,42 @@ namespace WaveFile
|
|||||||
return ms.ToArray();
|
return ms.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Trims the start of the wave to the given sample
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="newStartSample"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public MemoryStream TrimStart(int newStartSample)
|
||||||
|
{
|
||||||
|
if (newStartSample > this.SampleCount) throw new Exception(string.Format("The loop start sample ({0}) is higher than the total number of samples ({1}) in this file!", newStartSample, this.SampleCount));
|
||||||
|
|
||||||
|
MemoryStream msOut = new MemoryStream();
|
||||||
|
msOut.Seek(0, SeekOrigin.Begin);
|
||||||
|
|
||||||
|
if (newStartSample == 0)
|
||||||
|
{
|
||||||
|
msOut.Write(waveFile, 0, waveFile.Length);
|
||||||
|
msOut.Seek(0, SeekOrigin.Begin);
|
||||||
|
return msOut;
|
||||||
|
}
|
||||||
|
|
||||||
|
msOut.Write(waveFile, 0, this.dataOffset + 8);
|
||||||
|
msOut.Write(waveFile, this.ChannelCount * 2 * newStartSample, waveFile.Length - (this.dataOffset + 8 + (this.ChannelCount * 2 * newStartSample)));
|
||||||
|
|
||||||
|
int cutted = (this.ChannelCount * 2 * newStartSample) - (this.dataOffset + 8);
|
||||||
|
|
||||||
|
byte[] newLength = BitConverter.GetBytes((UInt32)msOut.Position);
|
||||||
|
byte[] dataLength = BitConverter.GetBytes(BitConverter.ToInt32(waveFile, this.dataOffset + 4) - cutted);
|
||||||
|
|
||||||
|
msOut.Seek(4, SeekOrigin.Begin);
|
||||||
|
msOut.Write(newLength, 0, newLength.Length);
|
||||||
|
msOut.Seek(this.dataOffset + 4, SeekOrigin.Begin);
|
||||||
|
msOut.Write(dataLength, 0, dataLength.Length);
|
||||||
|
|
||||||
|
msOut.Seek(0, SeekOrigin.Begin);
|
||||||
|
return msOut;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Closes the Wave file
|
/// Closes the Wave file
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -135,6 +175,13 @@ namespace WaveFile
|
|||||||
|
|
||||||
//Private Functions
|
//Private Functions
|
||||||
|
|
||||||
|
private int GetFrameCount()
|
||||||
|
{
|
||||||
|
int dataLength = GetDataLength();
|
||||||
|
|
||||||
|
return (dataLength / (this.ChannelCount * 2));
|
||||||
|
}
|
||||||
|
|
||||||
private int GetLoopStart()
|
private int GetLoopStart()
|
||||||
{
|
{
|
||||||
if (smplOffset == -1) return 0;
|
if (smplOffset == -1) return 0;
|
||||||
|
@ -57,6 +57,21 @@ namespace Wii
|
|||||||
return big;
|
return big;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the current UTC Unix Timestamp as a Byte Array
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static byte[] GetTimestamp()
|
||||||
|
{
|
||||||
|
DateTime dtNow = DateTime.UtcNow;
|
||||||
|
TimeSpan tsTimestamp = (dtNow - new DateTime(1970, 1, 1, 0, 0, 0));
|
||||||
|
|
||||||
|
int timestamp = (int)tsTimestamp.TotalSeconds;
|
||||||
|
ASCIIEncoding enc = new ASCIIEncoding();
|
||||||
|
byte[] timestampBytes = enc.GetBytes("CMiiUT" + timestamp.ToString());
|
||||||
|
return timestampBytes;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new Byte Array out of the given one
|
/// Creates a new Byte Array out of the given one
|
||||||
/// from the given offset with the specified length
|
/// from the given offset with the specified length
|
||||||
@ -1347,6 +1362,50 @@ namespace Wii
|
|||||||
|
|
||||||
return decryptedkey;
|
return decryptedkey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Decodes the Timestamp in the Trailer, if available.
|
||||||
|
/// Returns null if no Timestamp was found.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="trailer"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static DateTime GetCreationTime(string trailer)
|
||||||
|
{
|
||||||
|
byte[] bTrailer = Tools.LoadFileToByteArray(trailer);
|
||||||
|
return GetCreationTime(bTrailer);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Decodes the Timestamp in the Trailer, if available.
|
||||||
|
/// Returns null if no Timestamp was found.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="trailer"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static DateTime GetCreationTime(byte[] trailer)
|
||||||
|
{
|
||||||
|
DateTime result = new DateTime(1970, 1, 1);
|
||||||
|
|
||||||
|
if (trailer[0] == 'C' &&
|
||||||
|
trailer[1] == 'M' &&
|
||||||
|
trailer[2] == 'i' &&
|
||||||
|
trailer[3] == 'i' &&
|
||||||
|
trailer[4] == 'U' &&
|
||||||
|
trailer[5] == 'T')
|
||||||
|
{
|
||||||
|
ASCIIEncoding enc = new ASCIIEncoding();
|
||||||
|
string stringSeconds = enc.GetString(trailer, 6, 10);
|
||||||
|
int seconds = 0;
|
||||||
|
|
||||||
|
if (int.TryParse(stringSeconds, out seconds))
|
||||||
|
{
|
||||||
|
result = result.AddSeconds((double)seconds);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
else return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class WadEdit
|
public class WadEdit
|
||||||
@ -2267,6 +2326,18 @@ namespace Wii
|
|||||||
|
|
||||||
return wadtmd;
|
return wadtmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Changes the Title Key in the Tik
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="tik"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static byte[] ChangeTitleKey(byte[] tik)
|
||||||
|
{
|
||||||
|
byte[] newKey = new byte[] { 0x47, 0x6f, 0x74, 0x74, 0x61, 0x47, 0x65, 0x74, 0x53, 0x6f, 0x6d, 0x65, 0x42, 0x65, 0x65, 0x72 };
|
||||||
|
Tools.InsertByteArray(tik, newKey, 447);
|
||||||
|
return tik;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class WadUnpack
|
public class WadUnpack
|
||||||
@ -2575,7 +2646,7 @@ namespace Wii
|
|||||||
/// Packs the contents in the given directory and creates the destination wad file
|
/// Packs the contents in the given directory and creates the destination wad file
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="directory"></param>
|
/// <param name="directory"></param>
|
||||||
public static void PackWad(string contentdirectory, string destinationfile, bool includefooter)
|
public static void PackWad(string contentdirectory, string destinationfile)
|
||||||
{
|
{
|
||||||
if (contentdirectory[contentdirectory.Length - 1] != '\\') { contentdirectory = contentdirectory + "\\"; }
|
if (contentdirectory[contentdirectory.Length - 1] != '\\') { contentdirectory = contentdirectory + "\\"; }
|
||||||
|
|
||||||
@ -2589,12 +2660,13 @@ namespace Wii
|
|||||||
string[] certfile = Directory.GetFiles(contentdirectory, "*.cert");
|
string[] certfile = Directory.GetFiles(contentdirectory, "*.cert");
|
||||||
string[] tikfile = Directory.GetFiles(contentdirectory, "*.tik");
|
string[] tikfile = Directory.GetFiles(contentdirectory, "*.tik");
|
||||||
string[] tmdfile = Directory.GetFiles(contentdirectory, "*.tmd");
|
string[] tmdfile = Directory.GetFiles(contentdirectory, "*.tmd");
|
||||||
string[] trailerfile = Directory.GetFiles(contentdirectory, "*.trailer");
|
|
||||||
|
|
||||||
byte[] cert = Tools.LoadFileToByteArray(certfile[0]);
|
byte[] cert = Tools.LoadFileToByteArray(certfile[0]);
|
||||||
byte[] tik = Tools.LoadFileToByteArray(tikfile[0]);
|
byte[] tik = Tools.LoadFileToByteArray(tikfile[0]);
|
||||||
byte[] tmd = Tools.LoadFileToByteArray(tmdfile[0]);
|
byte[] tmd = Tools.LoadFileToByteArray(tmdfile[0]);
|
||||||
|
|
||||||
|
tik = WadEdit.ChangeTitleKey(tik);
|
||||||
|
|
||||||
string[,] contents = WadInfo.GetContentInfo(tmd);
|
string[,] contents = WadInfo.GetContentInfo(tmd);
|
||||||
|
|
||||||
FileStream wadstream = new FileStream(destinationfile, FileMode.Create);
|
FileStream wadstream = new FileStream(destinationfile, FileMode.Create);
|
||||||
@ -2638,23 +2710,20 @@ namespace Wii
|
|||||||
allcont += thiscont.Length;
|
allcont += thiscont.Length;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Write Trailer, if exists and includefooter = true
|
//Write Footer Timestamp
|
||||||
int trailerlength = 0;
|
byte[] footer = Tools.GetTimestamp();
|
||||||
if (trailerfile.Length > 0 && includefooter == true)
|
Array.Resize(ref footer, Tools.AddPadding(footer.Length, 16));
|
||||||
{
|
|
||||||
byte[] trailer = Tools.LoadFileToByteArray(trailerfile[0]);
|
int footerLength = footer.Length;
|
||||||
trailerlength = trailer.Length;
|
|
||||||
Array.Resize(ref trailer, Tools.AddPadding(trailer.Length));
|
|
||||||
wadstream.Seek(Tools.AddPadding(contpos), SeekOrigin.Begin);
|
wadstream.Seek(Tools.AddPadding(contpos), SeekOrigin.Begin);
|
||||||
wadstream.Write(trailer, 0, trailer.Length);
|
wadstream.Write(footer, 0, footer.Length);
|
||||||
}
|
|
||||||
|
|
||||||
//Write Header
|
//Write Header
|
||||||
byte[] certsize = Tools.FileLengthToByteArray(cert.Length);
|
byte[] certsize = Tools.FileLengthToByteArray(cert.Length);
|
||||||
byte[] tiksize = Tools.FileLengthToByteArray(tik.Length);
|
byte[] tiksize = Tools.FileLengthToByteArray(tik.Length);
|
||||||
byte[] tmdsize = Tools.FileLengthToByteArray(tmd.Length);
|
byte[] tmdsize = Tools.FileLengthToByteArray(tmd.Length);
|
||||||
byte[] allcontsize = Tools.FileLengthToByteArray(allcont);
|
byte[] allcontsize = Tools.FileLengthToByteArray(allcont);
|
||||||
byte[] trailersize = Tools.FileLengthToByteArray(trailerlength);
|
byte[] footersize = Tools.FileLengthToByteArray(footerLength);
|
||||||
|
|
||||||
wadstream.Seek(0x00, SeekOrigin.Begin);
|
wadstream.Seek(0x00, SeekOrigin.Begin);
|
||||||
wadstream.Write(wadheader, 0, wadheader.Length);
|
wadstream.Write(wadheader, 0, wadheader.Length);
|
||||||
@ -2667,7 +2736,7 @@ namespace Wii
|
|||||||
wadstream.Seek(0x18, SeekOrigin.Begin);
|
wadstream.Seek(0x18, SeekOrigin.Begin);
|
||||||
wadstream.Write(allcontsize, 0, allcontsize.Length);
|
wadstream.Write(allcontsize, 0, allcontsize.Length);
|
||||||
wadstream.Seek(0x1c, SeekOrigin.Begin);
|
wadstream.Seek(0x1c, SeekOrigin.Begin);
|
||||||
wadstream.Write(trailersize, 0, trailersize.Length);
|
wadstream.Write(footersize, 0, footersize.Length);
|
||||||
|
|
||||||
wadstream.Close();
|
wadstream.Close();
|
||||||
}
|
}
|
||||||
@ -2699,6 +2768,8 @@ namespace Wii
|
|||||||
byte[] tik = Tools.LoadFileToByteArray(ticketdir + path2 + ".tik");
|
byte[] tik = Tools.LoadFileToByteArray(ticketdir + path2 + ".tik");
|
||||||
byte[] tmd = Tools.LoadFileToByteArray(contentdir + "title.tmd");
|
byte[] tmd = Tools.LoadFileToByteArray(contentdir + "title.tmd");
|
||||||
|
|
||||||
|
tik = WadEdit.ChangeTitleKey(tik);
|
||||||
|
|
||||||
string[,] contents = WadInfo.GetContentInfo(tmd);
|
string[,] contents = WadInfo.GetContentInfo(tmd);
|
||||||
|
|
||||||
FileStream wadstream = new FileStream(destinationfile, FileMode.Create);
|
FileStream wadstream = new FileStream(destinationfile, FileMode.Create);
|
||||||
@ -2758,12 +2829,20 @@ namespace Wii
|
|||||||
allcont += thiscont.Length;
|
allcont += thiscont.Length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Write Footer Timestamp
|
||||||
|
byte[] footer = Tools.GetTimestamp();
|
||||||
|
Array.Resize(ref footer, Tools.AddPadding(footer.Length, 16));
|
||||||
|
|
||||||
|
int footerLength = footer.Length;
|
||||||
|
wadstream.Seek(Tools.AddPadding(contpos), SeekOrigin.Begin);
|
||||||
|
wadstream.Write(footer, 0, footer.Length);
|
||||||
|
|
||||||
//Write Header
|
//Write Header
|
||||||
byte[] certsize = Tools.FileLengthToByteArray(cert.Length);
|
byte[] certsize = Tools.FileLengthToByteArray(cert.Length);
|
||||||
byte[] tiksize = Tools.FileLengthToByteArray(tik.Length);
|
byte[] tiksize = Tools.FileLengthToByteArray(tik.Length);
|
||||||
byte[] tmdsize = Tools.FileLengthToByteArray(tmd.Length);
|
byte[] tmdsize = Tools.FileLengthToByteArray(tmd.Length);
|
||||||
byte[] allcontsize = Tools.FileLengthToByteArray(allcont);
|
byte[] allcontsize = Tools.FileLengthToByteArray(allcont);
|
||||||
byte[] trailersize = new byte[] { 0x00, 0x00, 0x00, 0x00 };
|
byte[] footersize = Tools.FileLengthToByteArray(footerLength);
|
||||||
|
|
||||||
wadstream.Seek(0x00, SeekOrigin.Begin);
|
wadstream.Seek(0x00, SeekOrigin.Begin);
|
||||||
wadstream.Write(wadheader, 0, wadheader.Length);
|
wadstream.Write(wadheader, 0, wadheader.Length);
|
||||||
@ -2776,7 +2855,7 @@ namespace Wii
|
|||||||
wadstream.Seek(0x18, SeekOrigin.Begin);
|
wadstream.Seek(0x18, SeekOrigin.Begin);
|
||||||
wadstream.Write(allcontsize, 0, allcontsize.Length);
|
wadstream.Write(allcontsize, 0, allcontsize.Length);
|
||||||
wadstream.Seek(0x1c, SeekOrigin.Begin);
|
wadstream.Seek(0x1c, SeekOrigin.Begin);
|
||||||
wadstream.Write(trailersize, 0, trailersize.Length);
|
wadstream.Write(footersize, 0, footersize.Length);
|
||||||
|
|
||||||
wadstream.Close();
|
wadstream.Close();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user