diff --git a/CustomizeMii.sln b/CustomizeMii.sln index 617b3b2..25a5dfa 100644 --- a/CustomizeMii.sln +++ b/CustomizeMii.sln @@ -3,6 +3,8 @@ Microsoft Visual Studio Solution File, Format Version 10.00 # Visual C# Express 2008 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CustomizeMii", "CustomizeMii\CustomizeMii.csproj", "{46B7F0BC-101B-4167-95AD-4C5D78AA0A20}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ForwardMii-Plugin", "ForwardMii-Plugin\ForwardMii-Plugin.csproj", "{20CB2CA7-6767-4758-97FA-97395F47CD6B}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -13,6 +15,10 @@ Global {46B7F0BC-101B-4167-95AD-4C5D78AA0A20}.Debug|Any CPU.Build.0 = Debug|Any CPU {46B7F0BC-101B-4167-95AD-4C5D78AA0A20}.Release|Any CPU.ActiveCfg = Release|Any CPU {46B7F0BC-101B-4167-95AD-4C5D78AA0A20}.Release|Any CPU.Build.0 = Release|Any CPU + {20CB2CA7-6767-4758-97FA-97395F47CD6B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {20CB2CA7-6767-4758-97FA-97395F47CD6B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {20CB2CA7-6767-4758-97FA-97395F47CD6B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {20CB2CA7-6767-4758-97FA-97395F47CD6B}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/CustomizeMii/CustomizeMii.csproj b/CustomizeMii/CustomizeMii.csproj index f7ee603..bdda561 100644 --- a/CustomizeMii/CustomizeMii.csproj +++ b/CustomizeMii/CustomizeMii.csproj @@ -15,6 +15,7 @@ Resources\CustomizeMii.ico + false publish\ true Disk @@ -26,8 +27,7 @@ false true 0 - 1.1.0.%2a - false + 1.2.0.%2a false true @@ -49,6 +49,10 @@ 4 + + False + ..\ForwardMii-Plugin\bin\Release\ForwardMii.dll + @@ -57,6 +61,13 @@ + + Form + + + CustomizeMii_ComplexForwarder.cs + + Form @@ -77,6 +88,9 @@ + + CustomizeMii_ComplexForwarder.cs + CustomizeMii_InputBox.cs diff --git a/CustomizeMii/CustomizeMii_ComplexForwarder.Designer.cs b/CustomizeMii/CustomizeMii_ComplexForwarder.Designer.cs new file mode 100644 index 0000000..56129f0 --- /dev/null +++ b/CustomizeMii/CustomizeMii_ComplexForwarder.Designer.cs @@ -0,0 +1,286 @@ +/* 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 . + */ + +namespace CustomizeMii +{ + partial class CustomizeMii_ComplexForwarder + { + /// + /// Erforderliche Designervariable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Verwendete Ressourcen bereinigen. + /// + /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Vom Windows Form-Designer generierter Code + + /// + /// Erforderliche Methode für die Designerunterstützung. + /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. + /// + private void InitializeComponent() + { + this.lbAppFolder = new System.Windows.Forms.Label(); + this.tbAppFolder = new System.Windows.Forms.TextBox(); + this.panSdUsb = new System.Windows.Forms.Panel(); + this.rbUSB = new System.Windows.Forms.RadioButton(); + this.rbSD = new System.Windows.Forms.RadioButton(); + this.panDolElf = new System.Windows.Forms.Panel(); + this.rbELF = new System.Windows.Forms.RadioButton(); + this.rbDOL = new System.Windows.Forms.RadioButton(); + this.cbImage43 = new System.Windows.Forms.CheckBox(); + this.cbImage169 = new System.Windows.Forms.CheckBox(); + this.tbImage43 = new System.Windows.Forms.TextBox(); + this.tbImage169 = new System.Windows.Forms.TextBox(); + this.btnBrowseImage43 = new System.Windows.Forms.Button(); + this.btnBrowseImage169 = new System.Windows.Forms.Button(); + this.label1 = new System.Windows.Forms.Label(); + this.btnOK = new System.Windows.Forms.Button(); + this.btnCancel = new System.Windows.Forms.Button(); + this.panSdUsb.SuspendLayout(); + this.panDolElf.SuspendLayout(); + this.SuspendLayout(); + // + // lbAppFolder + // + this.lbAppFolder.AutoSize = true; + this.lbAppFolder.Location = new System.Drawing.Point(12, 13); + this.lbAppFolder.Name = "lbAppFolder"; + this.lbAppFolder.Size = new System.Drawing.Size(107, 13); + this.lbAppFolder.TabIndex = 0; + this.lbAppFolder.Text = "Application Directory:"; + // + // tbAppFolder + // + this.tbAppFolder.Location = new System.Drawing.Point(125, 10); + this.tbAppFolder.Name = "tbAppFolder"; + this.tbAppFolder.Size = new System.Drawing.Size(221, 20); + this.tbAppFolder.TabIndex = 1; + // + // panSdUsb + // + this.panSdUsb.Controls.Add(this.rbUSB); + this.panSdUsb.Controls.Add(this.rbSD); + this.panSdUsb.Location = new System.Drawing.Point(15, 38); + this.panSdUsb.Name = "panSdUsb"; + this.panSdUsb.Size = new System.Drawing.Size(157, 64); + this.panSdUsb.TabIndex = 2; + // + // rbUSB + // + this.rbUSB.AutoSize = true; + this.rbUSB.Location = new System.Drawing.Point(24, 35); + this.rbUSB.Name = "rbUSB"; + this.rbUSB.Size = new System.Drawing.Size(87, 17); + this.rbUSB.TabIndex = 0; + this.rbUSB.TabStop = true; + this.rbUSB.Text = "Try USB First"; + this.rbUSB.UseVisualStyleBackColor = true; + // + // rbSD + // + this.rbSD.AutoSize = true; + this.rbSD.Location = new System.Drawing.Point(24, 12); + this.rbSD.Name = "rbSD"; + this.rbSD.Size = new System.Drawing.Size(80, 17); + this.rbSD.TabIndex = 0; + this.rbSD.TabStop = true; + this.rbSD.Text = "Try SD First"; + this.rbSD.UseVisualStyleBackColor = true; + // + // panDolElf + // + this.panDolElf.Controls.Add(this.rbELF); + this.panDolElf.Controls.Add(this.rbDOL); + this.panDolElf.Location = new System.Drawing.Point(189, 38); + this.panDolElf.Name = "panDolElf"; + this.panDolElf.Size = new System.Drawing.Size(157, 64); + this.panDolElf.TabIndex = 2; + // + // rbELF + // + this.rbELF.AutoSize = true; + this.rbELF.Location = new System.Drawing.Point(41, 35); + this.rbELF.Name = "rbELF"; + this.rbELF.Size = new System.Drawing.Size(84, 17); + this.rbELF.TabIndex = 0; + this.rbELF.TabStop = true; + this.rbELF.Text = "Try ELF First"; + this.rbELF.UseVisualStyleBackColor = true; + // + // rbDOL + // + this.rbDOL.AutoSize = true; + this.rbDOL.Location = new System.Drawing.Point(41, 12); + this.rbDOL.Name = "rbDOL"; + this.rbDOL.Size = new System.Drawing.Size(87, 17); + this.rbDOL.TabIndex = 0; + this.rbDOL.TabStop = true; + this.rbDOL.Text = "Try DOL First"; + this.rbDOL.UseVisualStyleBackColor = true; + // + // cbImage43 + // + this.cbImage43.AutoSize = true; + this.cbImage43.Location = new System.Drawing.Point(15, 141); + this.cbImage43.Name = "cbImage43"; + this.cbImage43.Size = new System.Drawing.Size(73, 17); + this.cbImage43.TabIndex = 3; + this.cbImage43.Text = "Image 4:3"; + this.cbImage43.UseVisualStyleBackColor = true; + this.cbImage43.CheckedChanged += new System.EventHandler(this.cbImage43_CheckedChanged); + // + // cbImage169 + // + this.cbImage169.AutoSize = true; + this.cbImage169.Location = new System.Drawing.Point(15, 171); + this.cbImage169.Name = "cbImage169"; + this.cbImage169.Size = new System.Drawing.Size(79, 17); + this.cbImage169.TabIndex = 3; + this.cbImage169.Text = "Image 16:9"; + this.cbImage169.UseVisualStyleBackColor = true; + this.cbImage169.CheckedChanged += new System.EventHandler(this.cbImage169_CheckedChanged); + // + // tbImage43 + // + this.tbImage43.Enabled = false; + this.tbImage43.Location = new System.Drawing.Point(94, 139); + this.tbImage43.Name = "tbImage43"; + this.tbImage43.Size = new System.Drawing.Size(171, 20); + this.tbImage43.TabIndex = 4; + // + // tbImage169 + // + this.tbImage169.Enabled = false; + this.tbImage169.Location = new System.Drawing.Point(94, 168); + this.tbImage169.Name = "tbImage169"; + this.tbImage169.Size = new System.Drawing.Size(171, 20); + this.tbImage169.TabIndex = 5; + // + // btnBrowseImage43 + // + this.btnBrowseImage43.Enabled = false; + this.btnBrowseImage43.Location = new System.Drawing.Point(271, 139); + this.btnBrowseImage43.Name = "btnBrowseImage43"; + this.btnBrowseImage43.Size = new System.Drawing.Size(75, 23); + this.btnBrowseImage43.TabIndex = 6; + this.btnBrowseImage43.Text = "Browse..."; + this.btnBrowseImage43.UseVisualStyleBackColor = true; + this.btnBrowseImage43.Click += new System.EventHandler(this.btnBrowse_Click); + // + // btnBrowseImage169 + // + this.btnBrowseImage169.Enabled = false; + this.btnBrowseImage169.Location = new System.Drawing.Point(271, 168); + this.btnBrowseImage169.Name = "btnBrowseImage169"; + this.btnBrowseImage169.Size = new System.Drawing.Size(75, 23); + this.btnBrowseImage169.TabIndex = 6; + this.btnBrowseImage169.Text = "Browse..."; + this.btnBrowseImage169.UseVisualStyleBackColor = true; + this.btnBrowseImage169.Click += new System.EventHandler(this.btnBrowse_Click); + // + // label1 + // + this.label1.Location = new System.Drawing.Point(0, 116); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(358, 13); + this.label1.TabIndex = 7; + this.label1.Text = "The images must be 640 x 480, else they will be resized!"; + this.label1.TextAlign = System.Drawing.ContentAlignment.TopCenter; + // + // btnOK + // + this.btnOK.Location = new System.Drawing.Point(15, 209); + this.btnOK.Name = "btnOK"; + this.btnOK.Size = new System.Drawing.Size(160, 23); + this.btnOK.TabIndex = 8; + this.btnOK.Text = "OK"; + this.btnOK.UseVisualStyleBackColor = true; + this.btnOK.Click += new System.EventHandler(this.btnOK_Click); + // + // btnCancel + // + this.btnCancel.Location = new System.Drawing.Point(186, 209); + this.btnCancel.Name = "btnCancel"; + this.btnCancel.Size = new System.Drawing.Size(160, 23); + this.btnCancel.TabIndex = 8; + this.btnCancel.Text = "Cancel"; + this.btnCancel.UseVisualStyleBackColor = true; + this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); + // + // CustomizeMii_ComplexForwarder + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(358, 245); + this.Controls.Add(this.btnCancel); + this.Controls.Add(this.btnOK); + this.Controls.Add(this.label1); + this.Controls.Add(this.btnBrowseImage169); + this.Controls.Add(this.btnBrowseImage43); + this.Controls.Add(this.tbImage169); + this.Controls.Add(this.tbImage43); + this.Controls.Add(this.cbImage169); + this.Controls.Add(this.cbImage43); + this.Controls.Add(this.panDolElf); + this.Controls.Add(this.panSdUsb); + this.Controls.Add(this.tbAppFolder); + this.Controls.Add(this.lbAppFolder); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; + this.Name = "CustomizeMii_ComplexForwarder"; + this.Text = "CustomizeMii_ComplexForwarder"; + this.panSdUsb.ResumeLayout(false); + this.panSdUsb.PerformLayout(); + this.panDolElf.ResumeLayout(false); + this.panDolElf.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label lbAppFolder; + private System.Windows.Forms.Panel panSdUsb; + private System.Windows.Forms.Panel panDolElf; + private System.Windows.Forms.Label label1; + public System.Windows.Forms.TextBox tbAppFolder; + public System.Windows.Forms.RadioButton rbUSB; + public System.Windows.Forms.RadioButton rbSD; + public System.Windows.Forms.RadioButton rbELF; + public System.Windows.Forms.RadioButton rbDOL; + public System.Windows.Forms.CheckBox cbImage43; + public System.Windows.Forms.CheckBox cbImage169; + public System.Windows.Forms.TextBox tbImage43; + public System.Windows.Forms.TextBox tbImage169; + public System.Windows.Forms.Button btnBrowseImage43; + public System.Windows.Forms.Button btnBrowseImage169; + private System.Windows.Forms.Button btnOK; + private System.Windows.Forms.Button btnCancel; + } +} \ No newline at end of file diff --git a/CustomizeMii/CustomizeMii_ComplexForwarder.cs b/CustomizeMii/CustomizeMii_ComplexForwarder.cs new file mode 100644 index 0000000..5d1f208 --- /dev/null +++ b/CustomizeMii/CustomizeMii_ComplexForwarder.cs @@ -0,0 +1,84 @@ +/* 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 . + */ + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; +using System.IO; + +namespace CustomizeMii +{ + public partial class CustomizeMii_ComplexForwarder : Form + { + public CustomizeMii_ComplexForwarder() + { + InitializeComponent(); + this.CenterToParent(); + } + + private void cbImage43_CheckedChanged(object sender, EventArgs e) + { + tbImage43.Enabled = cbImage43.Checked; + btnBrowseImage43.Enabled = cbImage43.Checked; + } + + private void cbImage169_CheckedChanged(object sender, EventArgs e) + { + tbImage169.Enabled = cbImage169.Checked; + btnBrowseImage169.Enabled = cbImage169.Checked; + } + + private void btnCancel_Click(object sender, EventArgs e) + { + this.DialogResult = DialogResult.Cancel; + this.Close(); + } + + private void btnOK_Click(object sender, EventArgs e) + { + if (string.IsNullOrEmpty(tbAppFolder.Text)) + { + tbAppFolder.Focus(); + } + else + { + if (!File.Exists(tbImage43.Text)) tbImage43.Text = string.Empty; + if (!File.Exists(tbImage169.Text)) tbImage169.Text = string.Empty; + + this.DialogResult = DialogResult.OK; + this.Close(); + } + } + + private void btnBrowse_Click(object sender, EventArgs e) + { + OpenFileDialog ofd = new OpenFileDialog(); + ofd.Filter = "PNG|*.png|JPG|*.jpg|GIF|*.gif|BMP|*.bmp|All|*.png;*.jpg;*.gif;*.bmp"; + ofd.FilterIndex = 5; + + if (ofd.ShowDialog() == DialogResult.OK) + { + if (sender == btnBrowseImage43) tbImage43.Text = ofd.FileName; + else tbImage169.Text = ofd.FileName; + } + } + } +} diff --git a/CustomizeMii/CustomizeMii_ComplexForwarder.resx b/CustomizeMii/CustomizeMii_ComplexForwarder.resx new file mode 100644 index 0000000..ff31a6d --- /dev/null +++ b/CustomizeMii/CustomizeMii_ComplexForwarder.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/CustomizeMii/CustomizeMii_Forwarders.cs b/CustomizeMii/CustomizeMii_Forwarders.cs new file mode 100644 index 0000000..bfc2e7c --- /dev/null +++ b/CustomizeMii/CustomizeMii_Forwarders.cs @@ -0,0 +1,85 @@ +/* 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 . + */ + +using ForwardMii; + +namespace CustomizeMii +{ + namespace Forwarder + { + //Let's use this kind of wrapper, so CustomizeMii can still run, if the ForwardMii.dll is missing... + + internal class Complex + { + private string thisAppFolder; + private bool elfFirst = false; + private bool usbFirst = false; + private string image43; + private string image169; + public string AppFolder { get { return thisAppFolder; } set { thisAppFolder = value; } } + public bool ElfFirst { get { return elfFirst; } set { elfFirst = value; } } + public bool UsbFirst { get { return usbFirst; } set { usbFirst = value; } } + public string Image43 { get { return image43; } set { image43 = value; } } + public string Image169 { get { return image169; } set { image169 = value; } } + + public Complex() + { + + } + + public void Save(string Destination) + { + GXForwarder Forwarder = new GXForwarder(thisAppFolder, usbFirst, elfFirst, image43, image169); + Forwarder.Save(Destination, true); + } + + public void Clear() + { + thisAppFolder = string.Empty; + elfFirst = false; + usbFirst = false; + image43 = string.Empty; + image169 = string.Empty; + } + } + + internal class Simple + { + private string thisAppFolder; + private bool toElf = false; + public string AppFolder { get { return thisAppFolder; } set { thisAppFolder = value; } } + public bool ForwardToElf { get { return toElf; } set { toElf = value; } } + + public Simple() + { + + } + + public void Save(string Destination) + { + SDSDHC_Forwarder Forwarder = new SDSDHC_Forwarder(thisAppFolder, toElf); + Forwarder.Save(Destination, true); + } + + public void Clear() + { + thisAppFolder = string.Empty; + toElf = false; + } + } + } +} diff --git a/CustomizeMii/CustomizeMii_InputBox.Designer.cs b/CustomizeMii/CustomizeMii_InputBox.Designer.cs index 6711986..a3ef099 100644 --- a/CustomizeMii/CustomizeMii_InputBox.Designer.cs +++ b/CustomizeMii/CustomizeMii_InputBox.Designer.cs @@ -49,10 +49,12 @@ namespace CustomizeMii this.lbInfo = new System.Windows.Forms.Label(); this.btnOK = new System.Windows.Forms.Button(); this.btnExit = new System.Windows.Forms.Button(); + this.cbElf = new System.Windows.Forms.CheckBox(); this.SuspendLayout(); // // tbInput // + this.tbInput.Anchor = System.Windows.Forms.AnchorStyles.Bottom; this.tbInput.Location = new System.Drawing.Point(7, 34); this.tbInput.MaxLength = 3; this.tbInput.Name = "tbInput"; @@ -61,15 +63,17 @@ namespace CustomizeMii // // lbInfo // - this.lbInfo.AutoSize = true; + this.lbInfo.Anchor = System.Windows.Forms.AnchorStyles.Top; this.lbInfo.Location = new System.Drawing.Point(4, 9); this.lbInfo.Name = "lbInfo"; - this.lbInfo.Size = new System.Drawing.Size(225, 13); + this.lbInfo.Size = new System.Drawing.Size(225, 32); this.lbInfo.TabIndex = 1; this.lbInfo.Text = "Please enter \"45e\" to create the Common-Key"; + this.lbInfo.TextAlign = System.Drawing.ContentAlignment.TopCenter; // // btnOK // + this.btnOK.Anchor = System.Windows.Forms.AnchorStyles.Bottom; this.btnOK.Location = new System.Drawing.Point(7, 62); this.btnOK.Name = "btnOK"; this.btnOK.Size = new System.Drawing.Size(108, 23); @@ -80,6 +84,8 @@ namespace CustomizeMii // // btnExit // + this.btnExit.Anchor = System.Windows.Forms.AnchorStyles.Bottom; + this.btnExit.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.btnExit.Location = new System.Drawing.Point(121, 62); this.btnExit.Name = "btnExit"; this.btnExit.Size = new System.Drawing.Size(108, 23); @@ -88,6 +94,18 @@ namespace CustomizeMii this.btnExit.UseVisualStyleBackColor = true; this.btnExit.Click += new System.EventHandler(this.btnExit_Click); // + // cbElf + // + this.cbElf.Anchor = System.Windows.Forms.AnchorStyles.Bottom; + this.cbElf.AutoSize = true; + this.cbElf.Location = new System.Drawing.Point(61, 16); + this.cbElf.Name = "cbElf"; + this.cbElf.Size = new System.Drawing.Size(114, 17); + this.cbElf.TabIndex = 4; + this.cbElf.Text = "Forward to boot.elf"; + this.cbElf.UseVisualStyleBackColor = true; + this.cbElf.Visible = false; + // // CustomizeMii_InputBox // this.AcceptButton = this.btnOK; @@ -95,10 +113,11 @@ namespace CustomizeMii this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.btnExit; this.ClientSize = new System.Drawing.Size(238, 92); + this.Controls.Add(this.cbElf); this.Controls.Add(this.btnExit); this.Controls.Add(this.btnOK); - this.Controls.Add(this.lbInfo); this.Controls.Add(this.tbInput); + this.Controls.Add(this.lbInfo); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.Name = "CustomizeMii_InputBox"; this.ShowInTaskbar = false; @@ -111,9 +130,10 @@ namespace CustomizeMii #endregion - private System.Windows.Forms.TextBox tbInput; - private System.Windows.Forms.Label lbInfo; private System.Windows.Forms.Button btnOK; - private System.Windows.Forms.Button btnExit; + public System.Windows.Forms.Label lbInfo; + public System.Windows.Forms.TextBox tbInput; + public System.Windows.Forms.Button btnExit; + public System.Windows.Forms.CheckBox cbElf; } } \ No newline at end of file diff --git a/CustomizeMii/CustomizeMii_InputBox.cs b/CustomizeMii/CustomizeMii_InputBox.cs index 337ba6a..edf7c7d 100644 --- a/CustomizeMii/CustomizeMii_InputBox.cs +++ b/CustomizeMii/CustomizeMii_InputBox.cs @@ -27,6 +27,7 @@ namespace CustomizeMii { public partial class CustomizeMii_InputBox : Form { + public bool CommonKeyMode = true; public string Input { get { return tbInput.Text; } @@ -37,6 +38,12 @@ namespace CustomizeMii InitializeComponent(); } + public CustomizeMii_InputBox(bool CommonKeyMode) + { + InitializeComponent(); + this.CommonKeyMode = CommonKeyMode; + } + private void CustomizeMii_InputBox_Load(object sender, EventArgs e) { this.CenterToScreen(); @@ -44,20 +51,40 @@ namespace CustomizeMii private void btnExit_Click(object sender, EventArgs e) { - Application.Exit(); + if (CommonKeyMode == true) + { + Application.Exit(); + } + else this.Close(); } private void btnOK_Click(object sender, EventArgs e) { - if (tbInput.Text == "45e") + if (this.CommonKeyMode == true) { - this.DialogResult = DialogResult.OK; - this.Close(); + if (tbInput.Text == "45e") + { + this.DialogResult = DialogResult.OK; + this.Close(); + } + else + { + tbInput.Focus(); + tbInput.SelectAll(); + } } else { - tbInput.Focus(); - tbInput.SelectAll(); + if (tbInput.Text.Length > 2) + { + this.DialogResult = DialogResult.OK; + this.Close(); + } + else + { + tbInput.Focus(); + tbInput.SelectAll(); + } } } } diff --git a/CustomizeMii/CustomizeMii_Main.Designer.cs b/CustomizeMii/CustomizeMii_Main.Designer.cs index d37be45..9a7cdbb 100644 --- a/CustomizeMii/CustomizeMii_Main.Designer.cs +++ b/CustomizeMii/CustomizeMii_Main.Designer.cs @@ -45,6 +45,7 @@ namespace CustomizeMii /// private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CustomizeMii_Main)); this.btnCreateWad = new System.Windows.Forms.Button(); this.tabControl = new System.Windows.Forms.TabControl(); @@ -79,6 +80,8 @@ namespace CustomizeMii this.tbAllLanguages = new System.Windows.Forms.TextBox(); this.lbAllLanguages = new System.Windows.Forms.Label(); this.tabOptions = new System.Windows.Forms.TabPage(); + this.btnForwarder = new System.Windows.Forms.Button(); + this.cbFailureChecks = new System.Windows.Forms.CheckBox(); this.cbLz77 = new System.Windows.Forms.CheckBox(); this.lbOptionsOptional = new System.Windows.Forms.Label(); this.btnBrowseSound = new System.Windows.Forms.Button(); @@ -144,6 +147,9 @@ namespace CustomizeMii this.lbStatus = new System.Windows.Forms.ToolStripStatusLabel(); this.lbStatusText = new System.Windows.Forms.ToolStripStatusLabel(); this.pbProgress = new System.Windows.Forms.ToolStripProgressBar(); + this.cmForwarder = new System.Windows.Forms.ContextMenuStrip(this.components); + this.cmSimpleForwarder = new System.Windows.Forms.ToolStripMenuItem(); + this.cmComplexForwarder = new System.Windows.Forms.ToolStripMenuItem(); this.tabControl.SuspendLayout(); this.tabSource.SuspendLayout(); this.tabTitle.SuspendLayout(); @@ -155,6 +161,7 @@ namespace CustomizeMii this.tabInstructions.SuspendLayout(); this.tabCredits.SuspendLayout(); this.ssMain.SuspendLayout(); + this.cmForwarder.SuspendLayout(); this.SuspendLayout(); // // btnCreateWad @@ -507,6 +514,8 @@ namespace CustomizeMii // // tabOptions // + this.tabOptions.Controls.Add(this.btnForwarder); + this.tabOptions.Controls.Add(this.cbFailureChecks); this.tabOptions.Controls.Add(this.cbLz77); this.tabOptions.Controls.Add(this.lbOptionsOptional); this.tabOptions.Controls.Add(this.btnBrowseSound); @@ -527,6 +536,26 @@ namespace CustomizeMii this.tabOptions.Text = "Options"; this.tabOptions.UseVisualStyleBackColor = true; // + // btnForwarder + // + this.btnForwarder.Location = new System.Drawing.Point(360, 109); + this.btnForwarder.Name = "btnForwarder"; + this.btnForwarder.Size = new System.Drawing.Size(75, 23); + this.btnForwarder.TabIndex = 13; + this.btnForwarder.Text = "Forwarder..."; + this.btnForwarder.UseVisualStyleBackColor = true; + this.btnForwarder.Click += new System.EventHandler(this.btnForwarder_Click); + // + // cbFailureChecks + // + this.cbFailureChecks.AutoSize = true; + this.cbFailureChecks.Location = new System.Drawing.Point(263, 180); + this.cbFailureChecks.Name = "cbFailureChecks"; + this.cbFailureChecks.Size = new System.Drawing.Size(172, 17); + this.cbFailureChecks.TabIndex = 12; + this.cbFailureChecks.Text = "/!\\ Turn off security checks /!\\"; + this.cbFailureChecks.UseVisualStyleBackColor = true; + // // cbLz77 // this.cbLz77.AutoSize = true; @@ -539,7 +568,7 @@ namespace CustomizeMii // // lbOptionsOptional // - this.lbOptionsOptional.Location = new System.Drawing.Point(-7, 9); + this.lbOptionsOptional.Location = new System.Drawing.Point(-7, 8); this.lbOptionsOptional.Name = "lbOptionsOptional"; this.lbOptionsOptional.Size = new System.Drawing.Size(457, 34); this.lbOptionsOptional.TabIndex = 10; @@ -892,7 +921,7 @@ namespace CustomizeMii this.tabBrlyt.Padding = new System.Windows.Forms.Padding(3); this.tabBrlyt.Size = new System.Drawing.Size(443, 209); this.tabBrlyt.TabIndex = 6; - this.tabBrlyt.Text = "brlyt"; + this.tabBrlyt.Text = "Layout"; this.tabBrlyt.UseVisualStyleBackColor = true; // // btnBrlytListTpls @@ -999,7 +1028,7 @@ namespace CustomizeMii this.tabBrlan.Padding = new System.Windows.Forms.Padding(3); this.tabBrlan.Size = new System.Drawing.Size(443, 209); this.tabBrlan.TabIndex = 7; - this.tabBrlan.Text = "brlan"; + this.tabBrlan.Text = "Animation"; this.tabBrlan.UseVisualStyleBackColor = true; // // lbBrlanWarning @@ -1107,7 +1136,7 @@ namespace CustomizeMii this.tabInstructions.Padding = new System.Windows.Forms.Padding(3); this.tabInstructions.Size = new System.Drawing.Size(443, 209); this.tabInstructions.TabIndex = 8; - this.tabInstructions.Text = "Instructions"; + this.tabInstructions.Text = "Help"; this.tabInstructions.UseVisualStyleBackColor = true; // // rtbInstructions @@ -1133,7 +1162,7 @@ namespace CustomizeMii this.tabCredits.Padding = new System.Windows.Forms.Padding(3); this.tabCredits.Size = new System.Drawing.Size(443, 209); this.tabCredits.TabIndex = 5; - this.tabCredits.Text = "Credits"; + this.tabCredits.Text = "About"; this.tabCredits.UseVisualStyleBackColor = true; // // llbUpdateAvailabe @@ -1222,6 +1251,28 @@ namespace CustomizeMii this.pbProgress.Size = new System.Drawing.Size(100, 16); this.pbProgress.Value = 100; // + // cmForwarder + // + this.cmForwarder.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.cmSimpleForwarder, + this.cmComplexForwarder}); + this.cmForwarder.Name = "contextMenuStrip1"; + this.cmForwarder.Size = new System.Drawing.Size(178, 70); + // + // cmSimpleForwarder + // + this.cmSimpleForwarder.Name = "cmSimpleForwarder"; + this.cmSimpleForwarder.Size = new System.Drawing.Size(177, 22); + this.cmSimpleForwarder.Text = "Simple Forwarder"; + this.cmSimpleForwarder.Click += new System.EventHandler(this.cmForwarderItem_Click); + // + // cmComplexForwarder + // + this.cmComplexForwarder.Name = "cmComplexForwarder"; + this.cmComplexForwarder.Size = new System.Drawing.Size(177, 22); + this.cmComplexForwarder.Text = "Complex Forwarder"; + this.cmComplexForwarder.Click += new System.EventHandler(this.cmForwarderItem_Click); + // // CustomizeMii_Main // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -1256,6 +1307,7 @@ namespace CustomizeMii this.tabCredits.ResumeLayout(false); this.ssMain.ResumeLayout(false); this.ssMain.PerformLayout(); + this.cmForwarder.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); @@ -1361,6 +1413,11 @@ namespace CustomizeMii private System.Windows.Forms.CheckBox cbIconMakeTransparent; private System.Windows.Forms.TabPage tabInstructions; private System.Windows.Forms.RichTextBox rtbInstructions; + private System.Windows.Forms.CheckBox cbFailureChecks; + private System.Windows.Forms.Button btnForwarder; + private System.Windows.Forms.ContextMenuStrip cmForwarder; + private System.Windows.Forms.ToolStripMenuItem cmSimpleForwarder; + private System.Windows.Forms.ToolStripMenuItem cmComplexForwarder; } } diff --git a/CustomizeMii/CustomizeMii_Main.cs b/CustomizeMii/CustomizeMii_Main.cs index 28d73f6..6c91d16 100644 --- a/CustomizeMii/CustomizeMii_Main.cs +++ b/CustomizeMii/CustomizeMii_Main.cs @@ -24,26 +24,29 @@ using System.IO; using System.Net; using System.Text.RegularExpressions; using System.Windows.Forms; +using ForwardMii; namespace CustomizeMii { public partial class CustomizeMii_Main : Form { - const string Version = "1.1"; //Hint for myself: Never use a char in the Version (UpdateCheck)! + const string version = "1.2"; //Hint for myself: Never use a char in the Version (UpdateCheck)! const int SoundMaxLength = 30; //In seconds const int SoundWarningLength = 20; //In seconds - protected string TempWadPath = Path.GetTempPath() + "CustomizeMii_Temp\\TempWad.wad"; - protected string TempUnpackPath = Path.GetTempPath() + "CustomizeMii_Temp\\Unpack\\"; - protected string TempBannerPath = Path.GetTempPath() + "CustomizeMii_Temp\\Banner\\"; - protected string TempIconPath = Path.GetTempPath() + "CustomizeMii_Temp\\Icon\\"; - protected string TempSoundPath = Path.GetTempPath() + "CustomizeMii_Temp\\sound.bin"; - protected string TempTempPath = Path.GetTempPath() + "CustomizeMii_Temp\\Temp\\"; - protected string TempUnpackBannerTplPath = Path.GetTempPath() + "CustomizeMii_Temp\\Unpack\\00000000.app_OUT\\meta\\banner.bin_OUT\\arc\\timg\\"; - protected string TempUnpackIconTplPath = Path.GetTempPath() + "CustomizeMii_Temp\\Unpack\\00000000.app_OUT\\meta\\icon.bin_OUT\\arc\\timg\\"; - protected string TempUnpackBannerBrlytPath = Path.GetTempPath() + "CustomizeMii_Temp\\Unpack\\00000000.app_OUT\\meta\\banner.bin_OUT\\arc\\blyt\\"; - protected string TempUnpackIconBrlytPath = Path.GetTempPath() + "CustomizeMii_Temp\\Unpack\\00000000.app_OUT\\meta\\icon.bin_OUT\\arc\\blyt\\"; - protected string TempUnpackBannerBrlanPath = Path.GetTempPath() + "CustomizeMii_Temp\\Unpack\\00000000.app_OUT\\meta\\banner.bin_OUT\\arc\\anim\\"; - protected string TempUnpackIconBrlanPath = Path.GetTempPath() + "CustomizeMii_Temp\\Unpack\\00000000.app_OUT\\meta\\icon.bin_OUT\\arc\\anim\\"; + protected string TempPath = Path.GetTempPath() + "CustomizeMii_Temp\\XXX\\"; + protected string TempWadPath = Path.GetTempPath() + "CustomizeMii_Temp\\XXX\\TempWad.wad"; + protected string TempUnpackPath = Path.GetTempPath() + "CustomizeMii_Temp\\XXX\\Unpack\\"; + protected string TempBannerPath = Path.GetTempPath() + "CustomizeMii_Temp\\XXX\\Banner\\"; + protected string TempIconPath = Path.GetTempPath() + "CustomizeMii_Temp\\XXX\\Icon\\"; + protected string TempSoundPath = Path.GetTempPath() + "CustomizeMii_Temp\\XXX\\sound.bin"; + protected string TempWavePath = Path.GetTempPath() + "CustomizeMii_Temp\\XXX\\Temp.wav"; + protected string TempTempPath = Path.GetTempPath() + "CustomizeMii_Temp\\XXX\\Temp\\"; + protected string TempUnpackBannerTplPath = Path.GetTempPath() + "CustomizeMii_Temp\\XXX\\Unpack\\00000000.app_OUT\\meta\\banner.bin_OUT\\arc\\timg\\"; + protected string TempUnpackIconTplPath = Path.GetTempPath() + "CustomizeMii_Temp\\XXX\\Unpack\\00000000.app_OUT\\meta\\icon.bin_OUT\\arc\\timg\\"; + protected string TempUnpackBannerBrlytPath = Path.GetTempPath() + "CustomizeMii_Temp\\XXX\\Unpack\\00000000.app_OUT\\meta\\banner.bin_OUT\\arc\\blyt\\"; + protected string TempUnpackIconBrlytPath = Path.GetTempPath() + "CustomizeMii_Temp\\XXX\\Unpack\\00000000.app_OUT\\meta\\icon.bin_OUT\\arc\\blyt\\"; + protected string TempUnpackBannerBrlanPath = Path.GetTempPath() + "CustomizeMii_Temp\\XXX\\Unpack\\00000000.app_OUT\\meta\\banner.bin_OUT\\arc\\anim\\"; + protected string TempUnpackIconBrlanPath = Path.GetTempPath() + "CustomizeMii_Temp\\XXX\\Unpack\\00000000.app_OUT\\meta\\icon.bin_OUT\\arc\\anim\\"; protected string[] ButtonTexts = new string[] { "Create WAD!", "Fire!", "Go Go Go!", "Let's do it!", "What are you waitin' for?", "I want my Channel!", "Houston, We've Got a Problem!", "Error, please contact anyone!", "Isn't she sweet?", "Is that milk?", "In your face!", "_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_", "Wo ist der Notausgang?", "Take me to a higher place!", "What's goin' on?", "I'm a Button!", "Click!", "Today's date is " + DateTime.Now.ToShortDateString(), "Launch Time: " + DateTime.Now.ToLongTimeString() }; protected string[] SourceWadUrls = new string[] { "http://wadder.net/bases/StaticBase.wad", "http://wadder.net/bases/GenesisGX.wad", "http://wadder.net/bases/MP-CE-Std.wad", "http://wadder.net/bases/MP-CE-Ext.wad", "http://wadder.net/bases/SNES9XGX.wad", "http://wadder.net/bases/FCEUGX-wilsoff.wad", "http://wadder.net/bases/FCEUGX.wad", "http://wadder.net/bases/Wii64.wad", "http://wadder.net/bases/WiiSXFull.wad", "http://wadder.net/bases/WiiSXRetro.wad", "http://wadder.net/bases/WADderBase1.wad", "http://wadder.net/bases/WADderBase2.wad", "http://wadder.net/bases/WADderBase3.wad", "http://wadder.net/bases/UniiLoader.wad", "http://wadder.net/bases/BackupChannel.wad" }; protected string[] SourceWadPreviewUrls = new string[] { "http://www.youtube.com/watch?v=pFNKldTYQq0", "http://www.youtube.com/watch?v=p9A6iEQvv9w", "http://www.youtube.com/watch?v=Up1RZebUc_U", "http://www.youtube.com/watch?v=Up1RZebUc_U", "http://www.youtube.com/watch?v=P-Mxd6DMvFY", "http://www.youtube.com/watch?v=wrbrg-DH_h4", "http://www.youtube.com/watch?v=MfiVbQaiXw8", "http://www.youtube.com/watch?v=krCQ2J7ZH8Y", "http://www.youtube.com/watch?v=rZC1DKUM6QI", "http://www.youtube.com/watch?v=Uiy8w-bp1kI", "http://www.youtube.com/watch?v=BbSYCSI8tz8", "http://www.youtube.com/watch?v=PIFZevHQ8lQ", "http://www.youtube.com/watch?v=OIhvDNjphhc", "http://www.youtube.com/watch?v=KLcncEArQLY&NR=1", "http://www.youtube.com/watch?v=xE_EgdCRV1I" }; @@ -68,7 +71,10 @@ namespace CustomizeMii private ToolTip TTip = new ToolTip(); private int UnpackFolderErrorCount = 0; private Stopwatch CreationTimer = new Stopwatch(); - List Transparents = new List(); + private List Transparents = new List(); + private string Mp3Path; + private Forwarder.Simple SimpleForwarder = new Forwarder.Simple(); + private Forwarder.Complex ComplexForwarder = new Forwarder.Complex(); public CustomizeMii_Main() { @@ -78,6 +84,9 @@ namespace CustomizeMii private void CustomizeMii_Main_Load(object sender, EventArgs e) { + UpdatePaths(); + UpdateCheck(); + UpdateCheckForwardMii(); InitializeStartup(); CommonKeyCheck(); } @@ -87,10 +96,31 @@ namespace CustomizeMii if (Directory.Exists(Path.GetTempPath() + "CustomizeMii_Temp")) Directory.Delete(Path.GetTempPath() + "CustomizeMii_Temp", true); } + private void UpdatePaths() + { + string thisGuid = Guid.NewGuid().ToString(); + + TempPath = TempPath.Replace("XXX", thisGuid); + TempWadPath = TempWadPath.Replace("XXX", thisGuid); + TempUnpackPath = TempUnpackPath.Replace("XXX", thisGuid); + TempBannerPath = TempBannerPath.Replace("XXX", thisGuid); + TempIconPath = TempIconPath.Replace("XXX", thisGuid); + TempSoundPath = TempSoundPath.Replace("XXX", thisGuid); + TempWavePath = TempWavePath.Replace("XXX", thisGuid); + TempTempPath = TempTempPath.Replace("XXX", thisGuid); + TempUnpackBannerTplPath = TempUnpackBannerTplPath.Replace("XXX", thisGuid); + TempUnpackIconTplPath = TempUnpackIconTplPath.Replace("XXX", thisGuid); + TempUnpackBannerBrlytPath = TempUnpackBannerBrlytPath.Replace("XXX", thisGuid); + TempUnpackIconBrlytPath = TempUnpackIconBrlytPath.Replace("XXX", thisGuid); + TempUnpackBannerBrlanPath = TempUnpackBannerBrlanPath.Replace("XXX", thisGuid); + TempUnpackIconBrlanPath = TempUnpackIconBrlanPath.Replace("XXX", thisGuid); + } + private void InitializeStartup() { - this.Text = this.Text.Replace("X", Version); - this.lbCreditVersion.Text = this.lbCreditVersion.Text.Replace("X", Version); + this.Text = this.Text.Replace("X", version); + this.lbCreditVersion.Text = this.lbCreditVersion.Text.Replace("X", version); + if (Directory.Exists(TempPath)) Directory.Delete(TempPath, true); ProgressUpdate = new EventHandler(this.UpdateProgress); SetButtonText(); cmbNandLoader.SelectedIndex = 0; @@ -100,13 +130,14 @@ namespace CustomizeMii pbProgress.Value = 100; BrlanChanged = false; BrlytChanged = false; - UpdateCheck(); DisableControls(null, null); SetToolTips(); btnBrowseDol.Text = "Browse..."; btnBrowseSound.Text = "Browse..."; rtbInstructions.Rtf = Properties.Resources.Instructions; rtbInstructions.LinkClicked += new LinkClickedEventHandler(rtbInstructions_LinkClicked); + SimpleForwarder.Clear(); + ComplexForwarder.Clear(); } void rtbInstructions_LinkClicked(object sender, LinkClickedEventArgs e) @@ -223,10 +254,126 @@ namespace CustomizeMii TTip.SetToolTip(cbLz77, "Use Lz77 compression for the banner.bin, icon.bin and sound.bin...\nIf the created WAD does not work, try it without compression first..."); } + private bool CheckForForwardMii() + { + if (File.Exists(Application.StartupPath + "\\ForwardMii.dll")) + return true; + else + return false; + } + + private bool CheckDevKit() + { + return ForwardMii_Plugin.CheckDevKit(); + } + + private void CreateForwarderSimple(string Output) + { + SimpleForwarder.Save(Output); + } + + private void CreateForwarderComplex(string Output) + { + ComplexForwarder.Save(Output); + } + + private void ConvertMp3ToWave(string mp3File) + { + if (File.Exists(Application.StartupPath + "\\lame.exe")) + { + try + { + BackgroundWorker bwConvertMp3 = new BackgroundWorker(); + bwConvertMp3.DoWork += new DoWorkEventHandler(bwConvertMp3_DoWork); + bwConvertMp3.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bwConvertMp3_RunWorkerCompleted); + bwConvertMp3.ProgressChanged += new ProgressChangedEventHandler(bwConvertMp3_ProgressChanged); + bwConvertMp3.WorkerReportsProgress = true; + + lbStatusText.Text = "Converting MP3..."; + bwConvertMp3.RunWorkerAsync(mp3File); + } + catch (Exception ex) + { + ErrorBox(ex.Message); + } + } + } + + void bwConvertMp3_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) + { + if (File.Exists(TempWavePath)) + { + SetText(tbSound, Mp3Path); + + btnBrowseSound.Text = "Clear"; + + if (!string.IsNullOrEmpty(SoundReplace)) + { + SoundReplace = string.Empty; + if (cmbReplace.SelectedIndex == 2) SetText(tbReplace, SoundReplace); + if (File.Exists(TempSoundPath)) File.Delete(TempSoundPath); + } + } + + lbStatusText.Text = string.Empty; + Mp3Path = string.Empty; + pbProgress.Value = 100; + } + + void bwConvertMp3_ProgressChanged(object sender, ProgressChangedEventArgs e) + { + ProgressValue = e.ProgressPercentage; + + this.Invoke(ProgressUpdate); + } + + void bwConvertMp3_DoWork(object sender, DoWorkEventArgs e) + { + try + { + BackgroundWorker bwConvertMp3 = sender as BackgroundWorker; + Mp3Path = (string)e.Argument; + ProcessStartInfo lameI = new ProcessStartInfo(Application.StartupPath + "\\lame.exe", string.Format("--decode {0} {1}", e.Argument, TempWavePath)); + lameI.CreateNoWindow = true; + lameI.UseShellExecute = false; + lameI.RedirectStandardError = true; + + Process lame = Process.Start(lameI); + + string thisLine = string.Empty; + while (lame.HasExited == false) + { + thisLine = lame.StandardError.ReadLine(); + if (!string.IsNullOrEmpty(thisLine)) + { + if (thisLine.StartsWith("Frame#")) + { + string thisFrame = thisLine.Remove(thisLine.IndexOf('/')); + thisFrame = thisFrame.Remove(0, thisFrame.LastIndexOf(' ') + 1); + string Frames = thisLine.Remove(0, thisLine.IndexOf('/') + 1); + Frames = Frames.Remove(Frames.IndexOf(' ')); + + int thisProgress = (int)((Convert.ToDouble(thisFrame) / Convert.ToDouble(Frames)) * 100); + bwConvertMp3.ReportProgress(thisProgress); + } + } + } + + lame.WaitForExit(); + lame.Close(); + } + catch (Exception ex) + { + if (File.Exists(TempWavePath)) File.Delete(TempWavePath); + Mp3Path = string.Empty; + ErrorBox("Error during convertion:\n" + ex.Message); + } + } + private void SetButtonText() { - Random randomize = new Random(); - btnCreateWad.Text = ButtonTexts[randomize.Next(0, ButtonTexts.Length - 1)]; + Random Randomizer = new Random(); + btnCreateWad.Text = ButtonTexts[Randomizer.Next(0, ButtonTexts.Length - 1)]; } private void ErrorBox(string message) @@ -324,6 +471,62 @@ namespace CustomizeMii } } + private void AddBrlyts(object sender, EventArgs e) + { + try + { + string[] BannerBrlyt; + if (string.IsNullOrEmpty(BannerReplace)) + BannerBrlyt = Directory.GetFiles(TempUnpackBannerBrlytPath); + else + BannerBrlyt = Directory.GetFiles(TempBannerPath + "arc\\blyt"); + + string[] IconBrlyt; + if (string.IsNullOrEmpty(IconReplace)) + IconBrlyt = Directory.GetFiles(TempUnpackIconBrlytPath); + else + IconBrlyt = Directory.GetFiles(TempIconPath + "arc\\blyt"); + + AddBannerBrlyt(BannerBrlyt); + AddIconBrlyt(IconBrlyt); + + if (lbxBrlytBanner.SelectedIndex == -1 && lbxBrlytIcon.SelectedIndex == -1) + { + if (lbxBrlytBanner.Items.Count > 0) lbxBrlytBanner.SelectedIndex = 0; + else if (lbxBrlytIcon.Items.Count > 0) lbxBrlytIcon.SelectedIndex = 0; + } + } + catch { } + } + + private void AddBrlans(object sender, EventArgs e) + { + try + { + string[] BannerBrlan; + if (string.IsNullOrEmpty(BannerReplace)) + BannerBrlan = Directory.GetFiles(TempUnpackBannerBrlanPath); + else + BannerBrlan = Directory.GetFiles(TempBannerPath + "arc\\anim"); + + string[] IconBrlan; + if (string.IsNullOrEmpty(IconReplace)) + IconBrlan = Directory.GetFiles(TempUnpackIconBrlanPath); + else + IconBrlan = Directory.GetFiles(TempIconPath + "arc\\anim"); + + AddBannerBrlan(BannerBrlan); + AddIconBrlan(IconBrlan); + + if (lbxBrlanBanner.SelectedIndex == -1 && lbxBrlanIcon.SelectedIndex == -1) + { + if (lbxBrlanBanner.Items.Count > 0) lbxBrlanBanner.SelectedIndex = 0; + else if (lbxBrlanIcon.Items.Count > 0) lbxBrlanIcon.SelectedIndex = 0; + } + } + catch { } + } + private void AddBannerBrlyt(string[] brlyt) { if (brlyt.Length > 0) @@ -414,6 +617,66 @@ namespace CustomizeMii tbSourceWad.Text = SourceWad; } + private void ForwarderDialogSimple() + { + CustomizeMii_InputBox ib = new CustomizeMii_InputBox(false); + ib.Size = new Size(ib.Size.Width, 120); + ib.lbInfo.Text = "Enter the application folder where the forwarder will point to (3-18 chars)"; + ib.tbInput.MaxLength = 18; + ib.btnExit.Text = "Close"; + ib.cbElf.Visible = true; + + ib.tbInput.Text = SimpleForwarder.AppFolder; + ib.cbElf.Checked = SimpleForwarder.ForwardToElf; + + if (ib.ShowDialog() == DialogResult.OK) + { + SimpleForwarder.ForwardToElf = ib.cbElf.Checked; + SimpleForwarder.AppFolder = ib.Input; + SetText(tbDol, string.Format("Simple Forwarder: \"SD:\\apps\\{0}\\boot.{1}\"", + SimpleForwarder.AppFolder, SimpleForwarder.ForwardToElf == true ? "elf" : "dol")); + btnBrowseDol.Text = "Clear"; + } + } + + private void ForwarderDialogComplex() + { + CustomizeMii_ComplexForwarder cf = new CustomizeMii_ComplexForwarder(); + cf.tbAppFolder.Text = ComplexForwarder.AppFolder; + cf.rbSD.Checked = !ComplexForwarder.UsbFirst; + cf.rbUSB.Checked = ComplexForwarder.UsbFirst; + cf.rbDOL.Checked = !ComplexForwarder.ElfFirst; + cf.rbELF.Checked = ComplexForwarder.ElfFirst; + + if (!string.IsNullOrEmpty(ComplexForwarder.Image43)) + { + cf.cbImage43.Checked = true; + cf.tbImage43.Enabled = true; + cf.btnBrowseImage43.Enabled = true; + + cf.tbImage43.Text = ComplexForwarder.Image43; + } + if (!string.IsNullOrEmpty(ComplexForwarder.Image169)) + { + cf.cbImage169.Checked = true; + cf.tbImage169.Enabled = true; + cf.btnBrowseImage169.Enabled = true; + + cf.tbImage169.Text = ComplexForwarder.Image169; + } + + if (cf.ShowDialog() == DialogResult.OK) + { + ComplexForwarder.AppFolder = cf.tbAppFolder.Text; + ComplexForwarder.UsbFirst = cf.rbUSB.Checked; + ComplexForwarder.ElfFirst = cf.rbELF.Checked; + ComplexForwarder.Image43 = cf.tbImage43.Text; + ComplexForwarder.Image169 = cf.tbImage169.Text; + + SetText(tbDol, string.Format("Complex Forwarder: \"{0}\"", ComplexForwarder.AppFolder)); + } + } + private void tabControl_Selecting(object sender, TabControlCancelEventArgs e) { if (tabControl.SelectedTab == tabBanner) @@ -432,57 +695,11 @@ namespace CustomizeMii } else if (tabControl.SelectedTab == tabBrlyt) { - try - { - string[] BannerBrlyt; - if (string.IsNullOrEmpty(BannerReplace)) - BannerBrlyt = Directory.GetFiles(TempUnpackBannerBrlytPath); - else - BannerBrlyt = Directory.GetFiles(TempBannerPath + "arc\\blyt"); - - string[] IconBrlyt; - if (string.IsNullOrEmpty(IconReplace)) - IconBrlyt = Directory.GetFiles(TempUnpackIconBrlytPath); - else - IconBrlyt = Directory.GetFiles(TempIconPath + "arc\\blyt"); - - AddBannerBrlyt(BannerBrlyt); - AddIconBrlyt(IconBrlyt); - - if (lbxBrlytBanner.SelectedIndex == -1 && lbxBrlytIcon.SelectedIndex == -1) - { - if (lbxBrlytBanner.Items.Count > 0) lbxBrlytBanner.SelectedIndex = 0; - else if (lbxBrlytIcon.Items.Count > 0) lbxBrlytIcon.SelectedIndex = 0; - } - } - catch { } + AddBrlyts(null, null); } else if (tabControl.SelectedTab == tabBrlan) { - try - { - string[] BannerBrlan; - if (string.IsNullOrEmpty(BannerReplace)) - BannerBrlan = Directory.GetFiles(TempUnpackBannerBrlanPath); - else - BannerBrlan = Directory.GetFiles(TempBannerPath + "arc\\anim"); - - string[] IconBrlan; - if (string.IsNullOrEmpty(IconReplace)) - IconBrlan = Directory.GetFiles(TempUnpackIconBrlanPath); - else - IconBrlan = Directory.GetFiles(TempIconPath + "arc\\anim"); - - AddBannerBrlan(BannerBrlan); - AddIconBrlan(IconBrlan); - - if (lbxBrlanBanner.SelectedIndex == -1 && lbxBrlanIcon.SelectedIndex == -1) - { - if (lbxBrlanBanner.Items.Count > 0) lbxBrlanBanner.SelectedIndex = 0; - else if (lbxBrlanIcon.Items.Count > 0) lbxBrlanIcon.SelectedIndex = 0; - } - } - catch { } + AddBrlans(null, null); } } @@ -617,7 +834,7 @@ namespace CustomizeMii { if (Ctrl is Button) Ctrl.Enabled = true; else if ((Ctrl is TextBox) && (Ctrl.Tag != (object)"Disabled")) Ctrl.Enabled = true; - else if (Ctrl is CheckBox && Ctrl == cbLz77) Ctrl.Enabled = true; + else if (Ctrl is CheckBox) Ctrl.Enabled = true; else if (Ctrl is ComboBox) Ctrl.Enabled = true; } } @@ -634,7 +851,7 @@ namespace CustomizeMii { if (Ctrl is Button) Ctrl.Enabled = false; else if ((Ctrl is TextBox) && (Ctrl.Tag != (object)"Disabled")) Ctrl.Enabled = false; - else if (Ctrl is CheckBox) Ctrl.Enabled = false; + else if (Ctrl is CheckBox && Ctrl != cbFailureChecks) Ctrl.Enabled = false; else if (Ctrl is ComboBox) Ctrl.Enabled = false; } } @@ -648,10 +865,10 @@ namespace CustomizeMii try { WebClient GetVersion = new WebClient(); - string NewVersion = GetVersion.DownloadString("http://customizemii.googlecode.com/svn/version.txt"); //TODO: Replace + string NewVersion = GetVersion.DownloadString("http://customizemii.googlecode.com/svn/version.txt"); int newVersion = Convert.ToInt32(NewVersion.Replace(".", string.Empty).Length == 2 ? (NewVersion.Replace(".", string.Empty) + "0") : NewVersion.Replace(".", string.Empty)); - int thisVersion = Convert.ToInt32(Version.Replace(".", string.Empty).Length == 2 ? (Version.Replace(".", string.Empty) + "0") : Version.Replace(".", string.Empty)); + int thisVersion = Convert.ToInt32(version.Replace(".", string.Empty).Length == 2 ? (version.Replace(".", string.Empty) + "0") : version.Replace(".", string.Empty)); if (newVersion > thisVersion) { @@ -671,6 +888,46 @@ namespace CustomizeMii } } + private string GetForwardMiiVersion() + { + return ForwardMii_Plugin.GetVersion(); + } + + private void UpdateCheckForwardMii() + { + if (File.Exists(Application.StartupPath + "\\ForwardMii.dll")) + { + if (CheckInet() == true) + { + try + { + string CurrentVersion = GetForwardMiiVersion(); + + if (!string.IsNullOrEmpty(CurrentVersion)) + { + WebClient GetVersion = new WebClient(); + string NewVersion = GetVersion.DownloadString("http://customizemii.googlecode.com/svn/forwardmii-version.txt"); + + int newVersion = Convert.ToInt32(NewVersion.Replace(".", string.Empty).Length == 2 ? (NewVersion.Replace(".", string.Empty) + "0") : NewVersion.Replace(".", string.Empty)); + int thisVersion = Convert.ToInt32(CurrentVersion.Replace(".", string.Empty).Length == 2 ? (CurrentVersion.Replace(".", string.Empty) + "0") : CurrentVersion.Replace(".", string.Empty)); + + if (newVersion > thisVersion) + { + if (MessageBox.Show("Version " + NewVersion + + " of the ForwardMii-Plugin is availabe.\nDo you want the download page to be opened?", + "ForwardMii Update availabe", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == + DialogResult.Yes) + { + Process.Start("http://code.google.com/p/customizemii/downloads/list"); + } + } + } + } + catch { } + } + } + } + private void llbSite_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { try @@ -764,8 +1021,12 @@ namespace CustomizeMii EventHandler AddBannerTpls = new EventHandler(this.AddBannerTpls); EventHandler AddIconTpls = new EventHandler(this.AddIconTpls); + EventHandler AddBrlyts = new EventHandler(this.AddBrlyts); + EventHandler AddBrlans = new EventHandler(this.AddBrlans); this.Invoke(AddBannerTpls); this.Invoke(AddIconTpls); + this.Invoke(AddBrlyts); + this.Invoke(AddBrlans); bwLoadChannel.ReportProgress(100); EventHandler EnableCtrls = new EventHandler(this.EnableControls); @@ -1064,8 +1325,12 @@ namespace CustomizeMii EventHandler AddBannerTpls = new EventHandler(this.AddBannerTpls); EventHandler AddIconTpls = new EventHandler(this.AddIconTpls); + EventHandler AddBrlyts = new EventHandler(this.AddBrlyts); + EventHandler AddBrlans = new EventHandler(this.AddBrlans); this.Invoke(AddBannerTpls); this.Invoke(AddIconTpls); + this.Invoke(AddBrlyts); + this.Invoke(AddBrlans); } catch (Exception ex) { @@ -1128,8 +1393,12 @@ namespace CustomizeMii EventHandler AddBannerTpls = new EventHandler(this.AddBannerTpls); EventHandler AddIconTpls = new EventHandler(this.AddIconTpls); + EventHandler AddBrlyts = new EventHandler(this.AddBrlyts); + EventHandler AddBrlans = new EventHandler(this.AddBrlans); this.Invoke(AddBannerTpls); this.Invoke(AddIconTpls); + this.Invoke(AddBrlyts); + this.Invoke(AddBrlans); } catch (Exception ex) { @@ -1230,6 +1499,9 @@ namespace CustomizeMii { SetText(tbDol, string.Empty); btnBrowseDol.Text = "Browse..."; + + SimpleForwarder.Clear(); + ComplexForwarder.Clear(); } else { @@ -1248,24 +1520,43 @@ namespace CustomizeMii { if (btnBrowseSound.Text == "Clear") { + if (File.Exists(TempWavePath)) File.Delete(TempWavePath); SetText(tbSound, string.Empty); btnBrowseSound.Text = "Browse..."; } else { - OpenFileDialog ofd = new OpenFileDialog(); - ofd.Filter = "Wave Files|*.wav"; - - if (ofd.ShowDialog() == DialogResult.OK) + if (pbProgress.Value == 100) { - SetText(tbSound, ofd.FileName); - btnBrowseSound.Text = "Clear"; + OpenFileDialog ofd = new OpenFileDialog(); - if (!string.IsNullOrEmpty(SoundReplace)) + if (File.Exists(Application.StartupPath + "\\lame.exe")) { - SoundReplace = string.Empty; - if (cmbReplace.SelectedIndex == 2) SetText(tbReplace, SoundReplace); - if (File.Exists(TempSoundPath)) File.Delete(TempSoundPath); + ofd.Filter = "Wave Files|*.wav|Mp3 Files|*.mp3|All|*.wav;*.mp3"; + ofd.FilterIndex = 3; + } + else + ofd.Filter = "Wave Files|*.wav"; + + if (ofd.ShowDialog() == DialogResult.OK) + { + if (ofd.FileName.EndsWith(".mp3")) + { + ConvertMp3ToWave(ofd.FileName); + } + else + { + SetText(tbSound, ofd.FileName); + + btnBrowseSound.Text = "Clear"; + + if (!string.IsNullOrEmpty(SoundReplace)) + { + SoundReplace = string.Empty; + if (cmbReplace.SelectedIndex == 2) SetText(tbReplace, SoundReplace); + if (File.Exists(TempSoundPath)) File.Delete(TempSoundPath); + } + } } } } @@ -1384,7 +1675,7 @@ namespace CustomizeMii if (Format == 0 || Format == 1 || Format == 2) { OpenFileDialog ofd = new OpenFileDialog(); - ofd.Filter = "Png|*.png|JPG|*.jpg|GIF|*.gif|BMP|*.bmp|TPL|*.tpl|All|*.png;*.jpg;*.gif;*.bmp;*.tpl"; + ofd.Filter = "PNG|*.png|JPG|*.jpg|GIF|*.gif|BMP|*.bmp|TPL|*.tpl|All|*.png;*.jpg;*.gif;*.bmp;*.tpl"; ofd.FilterIndex = 6; if (ofd.ShowDialog() == DialogResult.OK) @@ -1441,8 +1732,9 @@ namespace CustomizeMii if (lbxBannerTpls.SelectedIndex != -1) { SaveFileDialog sfd = new SaveFileDialog(); - sfd.Filter = "Png|*.png|JPG|*.jpg|GIF|*.gif|BMP|*.bmp|TPL|*.tpl|All|*.png;*.jpg;*.gif;*.bmp;*.tpl"; + sfd.Filter = "PNG|*.png|JPG|*.jpg|GIF|*.gif|BMP|*.bmp|TPL|*.tpl|All|*.png;*.jpg;*.gif;*.bmp;*.tpl"; sfd.FilterIndex = 6; + sfd.FileName = lbxBannerTpls.SelectedItem.ToString().Replace(".tpl", string.Empty); if (sfd.ShowDialog() == DialogResult.OK) { @@ -1520,7 +1812,7 @@ namespace CustomizeMii if (Format == 0 || Format == 1 || Format == 2) { OpenFileDialog ofd = new OpenFileDialog(); - ofd.Filter = "Png|*.png|JPG|*.jpg|GIF|*.gif|BMP|*.bmp|TPL|*.tpl|All|*.png;*.jpg;*.gif;*.bmp;*.tpl"; + ofd.Filter = "PNG|*.png|JPG|*.jpg|GIF|*.gif|BMP|*.bmp|TPL|*.tpl|All|*.png;*.jpg;*.gif;*.bmp;*.tpl"; ofd.FilterIndex = 6; if (ofd.ShowDialog() == DialogResult.OK) @@ -1577,8 +1869,9 @@ namespace CustomizeMii if (lbxIconTpls.SelectedIndex != -1) { SaveFileDialog sfd = new SaveFileDialog(); - sfd.Filter = "Png|*.png|JPG|*.jpg|GIF|*.gif|BMP|*.bmp|TPL|*.tpl|All|*.png;*.jpg;*.gif;*.bmp;*.tpl"; + sfd.Filter = "PNG|*.png|JPG|*.jpg|GIF|*.gif|BMP|*.bmp|TPL|*.tpl|All|*.png;*.jpg;*.gif;*.bmp;*.tpl"; sfd.FilterIndex = 6; + sfd.FileName = lbxIconTpls.SelectedItem.ToString().Replace(".tpl", string.Empty); if (sfd.ShowDialog() == DialogResult.OK) { @@ -1696,10 +1989,10 @@ namespace CustomizeMii } //Check brlan files - string[] ValidBrlans = new string[] { "banner.brlan", "icon.brlan", "banner_Loop.brlan", "icon_Loop.brlan", "banner_Start.brlan", "icon_Start.brlan" }; + string[] ValidBrlans = new string[] { "banner.brlan", "icon.brlan", "banner_loop.brlan", "icon_loop.brlan", "banner_start.brlan", "icon_start.brlan" }; foreach (string thisBrlan in lbxBrlanBanner.Items) { - if (!Wii.Tools.StringExistsInStringArray(thisBrlan, ValidBrlans)) + if (!Wii.Tools.StringExistsInStringArray(thisBrlan.ToLower(), ValidBrlans)) { ErrorBox(thisBrlan + " is not a valid brlan filename!"); return false; @@ -1707,7 +2000,7 @@ namespace CustomizeMii } foreach (string thisBrlan in lbxBrlanIcon.Items) { - if (!Wii.Tools.StringExistsInStringArray(thisBrlan, ValidBrlans)) + if (!Wii.Tools.StringExistsInStringArray(thisBrlan.ToLower(), ValidBrlans)) { ErrorBox(thisBrlan + " is not a valid brlan filename!"); return false; @@ -1750,10 +2043,13 @@ namespace CustomizeMii } //Check Sound length - int soundlength = -1; + int soundlength = 0; if (!string.IsNullOrEmpty(tbSound.Text) && string.IsNullOrEmpty(SoundReplace)) { - soundlength = Wii.Sound.GetWaveLength(tbSound.Text); + string SoundFile = tbSound.Text; + if (tbSound.Text.EndsWith(".mp3")) SoundFile = TempWavePath; + + soundlength = Wii.Sound.GetWaveLength(SoundFile); if (soundlength > SoundMaxLength) { ErrorBox(string.Format("Your Sound is longer than {0} seconds and thus not supported.\nIt is recommended to use a Sound shorter than {1} seconds, the maximum length is {0} seconds!", SoundMaxLength, SoundWarningLength)); @@ -1764,13 +2060,10 @@ namespace CustomizeMii /*Errors till here.. From here only Warnings!*/ - if (soundlength != -1) + if (soundlength > SoundWarningLength) { - if (soundlength > SoundWarningLength) - { - if (MessageBox.Show(string.Format("Your Sound is longer than {0} seconds.\nIt is recommended to use Sounds that are shorter than {0} seconds!\nDo you still want to continue?", SoundWarningLength), "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) - return false; - } + if (MessageBox.Show(string.Format("Your Sound is longer than {0} seconds.\nIt is recommended to use Sounds that are shorter than {0} seconds!\nDo you still want to continue?", SoundWarningLength), "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) + return false; } //Check if brlyt or brlan were changed @@ -2161,7 +2454,7 @@ namespace CustomizeMii { if (!string.IsNullOrEmpty(tbSourceWad.Text)) { - if (FailureCheck() == true) + if (cbFailureChecks.Checked == true || FailureCheck() == true) { SaveFileDialog sfd = new SaveFileDialog(); sfd.Filter = "Wii Channels|*.wad"; @@ -2262,7 +2555,10 @@ namespace CustomizeMii } else if (!string.IsNullOrEmpty(tbSound.Text)) { - Wii.Sound.WaveToSoundBin(tbSound.Text, TempUnpackPath + "00000000.app_OUT\\meta\\sound.bin", cbLz77.Checked); + string SoundFile = tbSound.Text; + if (tbSound.Text.EndsWith(".mp3")) SoundFile = TempWavePath; + + Wii.Sound.WaveToSoundBin(SoundFile, TempUnpackPath + "00000000.app_OUT\\meta\\sound.bin", cbLz77.Checked); } } @@ -2301,7 +2597,20 @@ namespace CustomizeMii } } - File.Copy(tbDol.Text, TempUnpackPath + "\\00000002.app"); + if (tbDol.Text.StartsWith("Simple Forwarder:")) + { + CreateForwarderSimple(TempUnpackPath + "\\00000002.app"); + } + else if (tbDol.Text.StartsWith("Complex Forwarder:")) + { + bwCreateWad.ReportProgress(82, "Compiling Forwarder..."); + CreateForwarderComplex(TempUnpackPath + "\\00000002.app"); + } + else + { + File.Copy(tbDol.Text, TempUnpackPath + "\\00000002.app"); + } + tmd = Wii.WadEdit.ChangeTmdBootIndex(tmd, 1); } else @@ -2315,13 +2624,26 @@ namespace CustomizeMii } } - File.Copy(tbDol.Text, TempUnpackPath + "\\00000001.app"); + if (tbDol.Text.StartsWith("Simple Forwarder:")) + { + CreateForwarderSimple(TempUnpackPath + "\\00000001.app"); + } + else if (tbDol.Text.StartsWith("Complex Forwarder:")) + { + bwCreateWad.ReportProgress(82, "Compiling Forwarder..."); + CreateForwarderComplex(TempUnpackPath + "\\00000001.app"); + } + else + { + File.Copy(tbDol.Text, TempUnpackPath + "\\00000001.app"); + } + tmd = Wii.WadEdit.ChangeTmdBootIndex(tmd, 2); } tmd = Wii.WadEdit.ChangeTmdContentCount(tmd, 3); - bwCreateWad.ReportProgress(80, "Updating TMD..."); + bwCreateWad.ReportProgress(85, "Updating TMD..."); File.Delete(tmdfile[0]); using (FileStream fs = new FileStream(tmdfile[0], FileMode.Create)) { @@ -3066,5 +3388,37 @@ namespace CustomizeMii } } } + + private void btnForwarder_Click(object sender, EventArgs e) + { + if (CheckForForwardMii() == true) + { + if (CheckDevKit() == false) + { + ForwarderDialogSimple(); + } + else + { + cmForwarder.Show(MousePosition); + } + } + else + { + if (MessageBox.Show("You don't have the ForwardMii.dll in your application folder.\nYou can download it on the project page, do you want the page to be opened?", "Plugin not availabe", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) + { + Process.Start("http://code.google.com/p/customizemii/downloads/list"); + } + } + } + + private void cmForwarderItem_Click(object sender, EventArgs e) + { + ToolStripMenuItem cmSender = sender as ToolStripMenuItem; + + if (cmSender == cmSimpleForwarder) + ForwarderDialogSimple(); + else + ForwarderDialogComplex(); + } } } diff --git a/CustomizeMii/CustomizeMii_Main.resx b/CustomizeMii/CustomizeMii_Main.resx index edd5a76..a93fdf2 100644 --- a/CustomizeMii/CustomizeMii_Main.resx +++ b/CustomizeMii/CustomizeMii_Main.resx @@ -128,6 +128,9 @@ comex and Waninkoko for both their NAND Loader 16, 7 + + 105, 7 + 42 diff --git a/CustomizeMii/Instructions.txt b/CustomizeMii/Instructions.txt index d1e5283..9b2edfd 100644 --- a/CustomizeMii/Instructions.txt +++ b/CustomizeMii/Instructions.txt @@ -59,6 +59,10 @@ Either load a forwarder or the DOL of any application. Note that some channles r and thus may not work in a channel (e.g. MPlayer CE). Choose a NAND loader or just stick with the one selected (both will do fine). +You can also use the built-in forwarder creation by using the forwarder button right below the browse button +for DOLs. +You need the ForwardMii.dll in order to use the forwarder creation. + INSERTING A NEW SOUND @@ -96,13 +100,13 @@ one piece of an animation (It's non-destructive, i.e. you can always uncheck the EDITING THE ANIMATION (Advanced users only!) Skip this part, if you don't really know what brlyt and brlan files are and how they're structured. -Goto the "brlyt" tab. You will see the banner.brlyt and icon.brlyt there. +Goto the "Layout" tab. You will see the banner.brlyt and icon.brlyt there. Above the buttons is a text that will indicate whether you're doing actions on the "Banner" or the "Icon" (When you select the banner.brlyt, you're editing the "Banner" and vice versa). Now, just replace the banner.brlyt and icon.brlyt files as you want. You can use the list TPLs button afterwards to see all TPLs that are required by the banner.brlyt/icon.brlyt (Don't worry, CustomizeMii won't let you create a WAD, if you forgot a required TPL). -Now, goto the "brlan" tab. It's similar to the "brlyt" tab. You shouldn't touch the add or delete button +Now, goto the "Animation" tab. It's similar to the "Layout" tab. You shouldn't touch the add or delete button unless your base WAD only has a banner.brlan and you want to use a banner_Start.brlan and banner_Loop.brlan. In this case, first add the two files and then delete the old banner.brlan. Else just replace the files with yours. Be absolutely sure the your brlan files only refer to panes that are diff --git a/CustomizeMii/Properties/AssemblyInfo.cs b/CustomizeMii/Properties/AssemblyInfo.cs index 0c1e38a..38dfbbb 100644 --- a/CustomizeMii/Properties/AssemblyInfo.cs +++ b/CustomizeMii/Properties/AssemblyInfo.cs @@ -50,6 +50,6 @@ using System.Resources; // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern // übernehmen, indem Sie "*" eingeben: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.1.0.0")] -[assembly: AssemblyFileVersion("1.1.0.0")] +[assembly: AssemblyVersion("1.2.0.0")] +[assembly: AssemblyFileVersion("1.2.0.0")] [assembly: NeutralResourcesLanguageAttribute("en")] diff --git a/CustomizeMii/Properties/Resources.Designer.cs b/CustomizeMii/Properties/Resources.Designer.cs index 14c69f3..4aba53d 100644 --- a/CustomizeMii/Properties/Resources.Designer.cs +++ b/CustomizeMii/Properties/Resources.Designer.cs @@ -1,4 +1,21 @@ -//------------------------------------------------------------------------------ +/* This file is part of CustomizeMii + * Copyright (C) 2009 Leathl + * + * CustomizeMii is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * CustomizeMii is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +//------------------------------------------------------------------------------ // // Dieser Code wurde von einem Tool generiert. // Laufzeitversion:2.0.50727.4927 diff --git a/CustomizeMii/Readme.txt b/CustomizeMii/Readme.txt index f43c55b..64f8ace 100644 --- a/CustomizeMii/Readme.txt +++ b/CustomizeMii/Readme.txt @@ -11,6 +11,14 @@ Thanks to icefire / Xuzz for the basic idea of this Application! ----------------------------------------------------------------------------------------- Changelog: +Version 1.2 + - Fixed writing/reading of channel titles, so japanese characters will work now + - Added checkbox (Options tab) to turn security checks off + - Added built-in forwarder creator (Needs the ForwardMii.dll which is + separately avaiable) + - You can choose MP3 files as channel sound (Needs lame.exe in application directory) + - Bugfixes + Version 1.1 - Note: License upgraded to GNU GPL v3! - Sound is working now @@ -21,7 +29,7 @@ Version 1.1 - Improved bricksafety (hopefully!) - Added Tooltips - Added update check at startup - - Wrote basic instructions (see Instructions.txt or instructions tab) + - Wrote basic instructions (see Instructions.txt or help tab) Version 1.0 - Initial Release @@ -31,7 +39,7 @@ Version 1.0 Disclaimer: Editing WAD files can result in a brick of your Wii. -Only use these features if you have a bricksafe Wii, meaning either Preloader or +Only use this application if you have a bricksafe Wii, meaning either Preloader or BootMii/boot2 is installed, and if you know what you're doing. This application comes without any express or implied warranty. @@ -46,6 +54,8 @@ Xuzz, SquidMan, megazig, Matt_P, Omega and The Lemon Man for Wii.py SquidMan for Zetsubou Andre Perrot for gbalzss comex and Waninkoko for both their NAND Loader +djdynamite123 for the forwarder base files (ForwardMii-Plugin) +The USB Loader GX Team for their forwarder source (ForwardMii-Plugin) ----------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------- diff --git a/CustomizeMii/Resources/Instructions.rtf b/CustomizeMii/Resources/Instructions.rtf index 951eaea..dabab6d 100644 Binary files a/CustomizeMii/Resources/Instructions.rtf and b/CustomizeMii/Resources/Instructions.rtf differ diff --git a/CustomizeMii/Wii.cs b/CustomizeMii/Wii.cs index ed43d0e..89a2d58 100644 --- a/CustomizeMii/Wii.cs +++ b/CustomizeMii/Wii.cs @@ -734,7 +734,7 @@ namespace Wii { if (contenthandle[i + j] != 0x00) { - char temp = Convert.ToChar(contenthandle[i + j]); + char temp = BitConverter.ToChar(new byte[] { contenthandle[i + j], contenthandle[i + j - 1] }, 0); titles[count] += temp; } } @@ -801,7 +801,7 @@ namespace Wii { if (app[i + j] != 0x00) { - char temp = Convert.ToChar(app[i + j]); + char temp = BitConverter.ToChar(new byte[] { app[i + j], app[i + j - 1] }, 0); titles[count] += temp; } } @@ -1450,19 +1450,47 @@ namespace Wii for (int x = imetpos; x < imetpos + 40; x += 2) { - if (japchars.Length > count) { contenthandle[x + 29] = Convert.ToByte(japchars[count]); } + if (japchars.Length > count) + { + contenthandle[x + 29] = BitConverter.GetBytes(japchars[count])[0]; + contenthandle[x + 30] = BitConverter.GetBytes(japchars[count])[1]; + } else { contenthandle[x + 29] = 0x00; } - if (engchars.Length > count) { contenthandle[x + 29 + 84] = Convert.ToByte(engchars[count]); } + if (engchars.Length > count) + { + contenthandle[x + 29 + 84] = BitConverter.GetBytes(engchars[count])[0]; + contenthandle[x + 29 + 84 - 1] = BitConverter.GetBytes(engchars[count])[1]; + } else { contenthandle[x + 29 + 84] = 0x00; } - if (gerchars.Length > count) { contenthandle[x + 29 + 84 * 2] = Convert.ToByte(gerchars[count]); } + if (gerchars.Length > count) + { + contenthandle[x + 29 + 84 * 2] = BitConverter.GetBytes(gerchars[count])[0]; + contenthandle[x + 29 + 84 * 2 - 1] = BitConverter.GetBytes(gerchars[count])[1]; + } else { contenthandle[x + 29 + 84 * 2] = 0x00; } - if (frachars.Length > count) { contenthandle[x + 29 + 84 * 3] = Convert.ToByte(frachars[count]); } + if (frachars.Length > count) + { + contenthandle[x + 29 + 84 * 3] = BitConverter.GetBytes(frachars[count])[0]; + contenthandle[x + 29 + 84 * 3 - 1] = BitConverter.GetBytes(frachars[count])[1]; + } else { contenthandle[x + 29 + 84 * 3] = 0x00; } - if (spachars.Length > count) { contenthandle[x + 29 + 84 * 4] = Convert.ToByte(spachars[count]); } + if (spachars.Length > count) + { + contenthandle[x + 29 + 84 * 4] = BitConverter.GetBytes(spachars[count])[0]; + contenthandle[x + 29 + 84 * 4 - 1] = BitConverter.GetBytes(spachars[count])[1]; + } else { contenthandle[x + 29 + 84 * 4] = 0x00; } - if (itachars.Length > count) { contenthandle[x + 29 + 84 * 5] = Convert.ToByte(itachars[count]); } + if (itachars.Length > count) + { + contenthandle[x + 29 + 84 * 5] = BitConverter.GetBytes(itachars[count])[0]; + contenthandle[x + 29 + 84 * 5 - 1] = BitConverter.GetBytes(itachars[count])[1]; + } else { contenthandle[x + 29 + 84 * 5] = 0x00; } - if (dutchars.Length > count) { contenthandle[x + 29 + 84 * 6] = Convert.ToByte(dutchars[count]); } + if (dutchars.Length > count) + { + contenthandle[x + 29 + 84 * 6] = BitConverter.GetBytes(dutchars[count])[0]; + contenthandle[x + 29 + 84 * 6 - 1] = BitConverter.GetBytes(dutchars[count])[1]; + } else { contenthandle[x + 29 + 84 * 6] = 0x00; } count++; @@ -3044,31 +3072,38 @@ namespace Wii { if (channeltitles[0].Length > i) { - japtitle[i * 2 + 1] = (byte)channeltitles[0][i]; + japtitle[i * 2] = BitConverter.GetBytes(channeltitles[0][i])[1]; + japtitle[i * 2 + 1] = BitConverter.GetBytes(channeltitles[0][i])[0]; } if (channeltitles[1].Length > i) { - engtitle[i * 2 + 1] = (byte)channeltitles[1][i]; + engtitle[i * 2] = BitConverter.GetBytes(channeltitles[1][i])[1]; + engtitle[i * 2 + 1] = BitConverter.GetBytes(channeltitles[1][i])[0]; } if (channeltitles[2].Length > i) { - gertitle[i * 2 + 1] = (byte)channeltitles[2][i]; + gertitle[i * 2] = BitConverter.GetBytes(channeltitles[2][i])[1]; + gertitle[i * 2 + 1] = BitConverter.GetBytes(channeltitles[2][i])[0]; } if (channeltitles[3].Length > i) { - fratitle[i * 2 + 1] = (byte)channeltitles[3][i]; + fratitle[i * 2] = BitConverter.GetBytes(channeltitles[3][i])[1]; + fratitle[i * 2 + 1] = BitConverter.GetBytes(channeltitles[3][i])[0]; } if (channeltitles[4].Length > i) { - spatitle[i * 2 + 1] = (byte)channeltitles[4][i]; + spatitle[i * 2] = BitConverter.GetBytes(channeltitles[4][i])[1]; + spatitle[i * 2 + 1] = BitConverter.GetBytes(channeltitles[4][i])[0]; } if (channeltitles[5].Length > i) { - itatitle[i * 2 + 1] = (byte)channeltitles[5][i]; + itatitle[i * 2] = BitConverter.GetBytes(channeltitles[5][i])[1]; + itatitle[i * 2 + 1] = BitConverter.GetBytes(channeltitles[5][i])[0]; } if (channeltitles[6].Length > i) { - duttitle[i * 2 + 1] = (byte)channeltitles[6][i]; + duttitle[i * 2] = BitConverter.GetBytes(channeltitles[6][i])[1]; + duttitle[i * 2 + 1] = BitConverter.GetBytes(channeltitles[6][i])[0]; } } @@ -5414,8 +5449,15 @@ namespace Wii { if (Tools.StringExistsInStringArray(tpls[i], brlytTpls) == false) { - unuseds.Add(tpls[i]); - missing = true; + string wonum = tpls[i].Remove(tpls[i].LastIndexOf('.') - 1) + "00.tpl"; + string wonum2 = tpls[i].Remove(tpls[i].LastIndexOf('.') - 2) + "00.tpl"; + + if (Tools.StringExistsInStringArray(wonum, brlytTpls) == false && + Tools.StringExistsInStringArray(wonum2, brlytTpls) == false) + { + unuseds.Add(tpls[i]); + missing = true; + } } } diff --git a/ForwardMii-Plugin/ForwardMii-Plugin.csproj b/ForwardMii-Plugin/ForwardMii-Plugin.csproj new file mode 100644 index 0000000..c1cf5fa --- /dev/null +++ b/ForwardMii-Plugin/ForwardMii-Plugin.csproj @@ -0,0 +1,95 @@ + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {20CB2CA7-6767-4758-97FA-97395F47CD6B} + Library + Properties + ForwardMii + ForwardMii + v2.0 + 512 + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ForwardMii-Plugin/ForwardMii.cs b/ForwardMii-Plugin/ForwardMii.cs new file mode 100644 index 0000000..8771076 --- /dev/null +++ b/ForwardMii-Plugin/ForwardMii.cs @@ -0,0 +1,41 @@ +/* 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 . + */ + +using System; + +namespace ForwardMii +{ + public class ForwardMii_Plugin + { + const string version = "1.0"; //Hint for myself: Never use a char in the Version (UpdateCheck)! + + public static string GetVersion() + { + return version; + } + + public static bool CheckDevKit() + { + if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("DEVKITPRO")) || + string.IsNullOrEmpty(Environment.GetEnvironmentVariable("DEVKITPPC"))) return false; + + if (!System.IO.Directory.Exists(Environment.GetEnvironmentVariable("DEVKITPRO").Remove(0, 1).Insert(1, ":") + "/libogc")) return false; + + return true; + } + } +} diff --git a/ForwardMii-Plugin/ForwardMii_BaseEdit.cs b/ForwardMii-Plugin/ForwardMii_BaseEdit.cs new file mode 100644 index 0000000..6ea9336 --- /dev/null +++ b/ForwardMii-Plugin/ForwardMii_BaseEdit.cs @@ -0,0 +1,1564 @@ +/* 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 . + */ + +using System.IO; + +namespace ForwardMii +{ + internal class SDSDHC_ConvertBaseStream + { + internal static MemoryStream ConvertTo5Chars(MemoryStream BaseStream) + { + BaseStream.Seek(16823, SeekOrigin.Begin); + BaseStream.WriteByte(0xd0); + BaseStream.Seek(16939, SeekOrigin.Begin); + BaseStream.WriteByte(0xd0); + BaseStream.Seek(17067, SeekOrigin.Begin); + BaseStream.WriteByte(0xd0); + BaseStream.Seek(17439, SeekOrigin.Begin); + BaseStream.WriteByte(0xa4); + BaseStream.Seek(17835, SeekOrigin.Begin); + BaseStream.WriteByte(0xa4); + BaseStream.Seek(21203, SeekOrigin.Begin); + BaseStream.WriteByte(0xa4); + BaseStream.Seek(29399, SeekOrigin.Begin); + BaseStream.WriteByte(0xfc); + BaseStream.Seek(33439, SeekOrigin.Begin); + BaseStream.WriteByte(0xa4); + BaseStream.Seek(69738, SeekOrigin.Begin); + BaseStream.WriteByte(0x01); + BaseStream.Seek(69739, SeekOrigin.Begin); + BaseStream.WriteByte(0x00); + BaseStream.Seek(69767, SeekOrigin.Begin); + BaseStream.WriteByte(0x2c); + BaseStream.Seek(69799, SeekOrigin.Begin); + BaseStream.WriteByte(0x5c); + BaseStream.Seek(69815, SeekOrigin.Begin); + BaseStream.WriteByte(0x70); + BaseStream.Seek(69839, SeekOrigin.Begin); + BaseStream.WriteByte(0x90); + BaseStream.Seek(69855, SeekOrigin.Begin); + BaseStream.WriteByte(0x94); + BaseStream.Seek(69871, SeekOrigin.Begin); + BaseStream.WriteByte(0xc8); + BaseStream.Seek(69999, SeekOrigin.Begin); + BaseStream.WriteByte(0xe4); + BaseStream.Seek(70011, SeekOrigin.Begin); + BaseStream.WriteByte(0xfc); + BaseStream.Seek(70047, SeekOrigin.Begin); + BaseStream.WriteByte(0x0c); + BaseStream.Seek(70071, SeekOrigin.Begin); + BaseStream.WriteByte(0x48); + BaseStream.Seek(70279, SeekOrigin.Begin); + BaseStream.WriteByte(0x1c); + BaseStream.Seek(70319, SeekOrigin.Begin); + BaseStream.WriteByte(0xcc); + BaseStream.Seek(70351, SeekOrigin.Begin); + BaseStream.WriteByte(0x44); + BaseStream.Seek(70795, SeekOrigin.Begin); + BaseStream.WriteByte(0x4c); + BaseStream.Seek(71315, SeekOrigin.Begin); + BaseStream.WriteByte(0xbc); + BaseStream.Seek(71627, SeekOrigin.Begin); + BaseStream.WriteByte(0xb0); + BaseStream.Seek(71655, SeekOrigin.Begin); + BaseStream.WriteByte(0xb4); + BaseStream.Seek(72171, SeekOrigin.Begin); + BaseStream.WriteByte(0xbc); + BaseStream.Seek(91719, SeekOrigin.Begin); + BaseStream.WriteByte(0xc0); + BaseStream.Seek(93627, SeekOrigin.Begin); + BaseStream.WriteByte(0x18); + BaseStream.Seek(94039, SeekOrigin.Begin); + BaseStream.WriteByte(0xc0); + BaseStream.Seek(95527, SeekOrigin.Begin); + BaseStream.WriteByte(0x08); + BaseStream.Seek(95895, SeekOrigin.Begin); + BaseStream.WriteByte(0x18); + BaseStream.Seek(96383, SeekOrigin.Begin); + BaseStream.WriteByte(0x08); + BaseStream.Seek(96667, SeekOrigin.Begin); + BaseStream.WriteByte(0xc0); + BaseStream.Seek(97171, SeekOrigin.Begin); + BaseStream.WriteByte(0xf4); + BaseStream.Seek(98075, SeekOrigin.Begin); + BaseStream.WriteByte(0xf4); + BaseStream.Seek(98711, SeekOrigin.Begin); + BaseStream.WriteByte(0x40); + BaseStream.Seek(99071, SeekOrigin.Begin); + BaseStream.WriteByte(0x14); + BaseStream.Seek(99079, SeekOrigin.Begin); + BaseStream.WriteByte(0x2c); + BaseStream.Seek(99082, SeekOrigin.Begin); + BaseStream.WriteByte(0x04); + BaseStream.Seek(99083, SeekOrigin.Begin); + BaseStream.WriteByte(0x00); + BaseStream.Seek(100619, SeekOrigin.Begin); + BaseStream.WriteByte(0xec); + BaseStream.Seek(100631, SeekOrigin.Begin); + BaseStream.WriteByte(0xe0); + BaseStream.Seek(100662, SeekOrigin.Begin); + BaseStream.WriteByte(0x05); + BaseStream.Seek(100663, SeekOrigin.Begin); + BaseStream.WriteByte(0x00); + BaseStream.Seek(100687, SeekOrigin.Begin); + BaseStream.WriteByte(0x10); + BaseStream.Seek(100723, SeekOrigin.Begin); + BaseStream.WriteByte(0x40); + BaseStream.Seek(100755, SeekOrigin.Begin); + BaseStream.WriteByte(0x70); + BaseStream.Seek(100787, SeekOrigin.Begin); + BaseStream.WriteByte(0xa0); + BaseStream.Seek(100819, SeekOrigin.Begin); + BaseStream.WriteByte(0xd0); + BaseStream.Seek(100850, SeekOrigin.Begin); + BaseStream.WriteByte(0x06); + BaseStream.Seek(100851, SeekOrigin.Begin); + BaseStream.WriteByte(0x00); + BaseStream.Seek(100883, SeekOrigin.Begin); + BaseStream.WriteByte(0x30); + BaseStream.Seek(100915, SeekOrigin.Begin); + BaseStream.WriteByte(0x60); + BaseStream.Seek(100947, SeekOrigin.Begin); + BaseStream.WriteByte(0x90); + BaseStream.Seek(100975, SeekOrigin.Begin); + BaseStream.WriteByte(0xb8); + BaseStream.Seek(101019, SeekOrigin.Begin); + BaseStream.WriteByte(0xd0); + BaseStream.Seek(101043, SeekOrigin.Begin); + BaseStream.WriteByte(0xe0); + BaseStream.Seek(101047, SeekOrigin.Begin); + BaseStream.WriteByte(0xe8); + BaseStream.Seek(101063, SeekOrigin.Begin); + BaseStream.WriteByte(0xec); + BaseStream.Seek(101067, SeekOrigin.Begin); + BaseStream.WriteByte(0xf0); + BaseStream.Seek(101287, SeekOrigin.Begin); + BaseStream.WriteByte(0x20); + BaseStream.Seek(101311, SeekOrigin.Begin); + BaseStream.WriteByte(0x38); + BaseStream.Seek(101315, SeekOrigin.Begin); + BaseStream.WriteByte(0x44); + BaseStream.Seek(101507, SeekOrigin.Begin); + BaseStream.WriteByte(0xf4); + BaseStream.Seek(101523, SeekOrigin.Begin); + BaseStream.WriteByte(0x04); + BaseStream.Seek(101615, SeekOrigin.Begin); + BaseStream.WriteByte(0xa4); + BaseStream.Seek(101803, SeekOrigin.Begin); + BaseStream.WriteByte(0xa4); + BaseStream.Seek(102259, SeekOrigin.Begin); + BaseStream.WriteByte(0x28); + BaseStream.Seek(102283, SeekOrigin.Begin); + BaseStream.WriteByte(0x80); + BaseStream.Seek(102299, SeekOrigin.Begin); + BaseStream.WriteByte(0x80); + BaseStream.Seek(102311, SeekOrigin.Begin); + BaseStream.WriteByte(0x80); + BaseStream.Seek(102327, SeekOrigin.Begin); + BaseStream.WriteByte(0x80); + BaseStream.Seek(102343, SeekOrigin.Begin); + BaseStream.WriteByte(0x80); + BaseStream.Seek(102359, SeekOrigin.Begin); + BaseStream.WriteByte(0x80); + BaseStream.Seek(102375, SeekOrigin.Begin); + BaseStream.WriteByte(0x80); + BaseStream.Seek(102391, SeekOrigin.Begin); + BaseStream.WriteByte(0x80); + BaseStream.Seek(106287, SeekOrigin.Begin); + BaseStream.WriteByte(0xfc); + BaseStream.Seek(114255, SeekOrigin.Begin); + BaseStream.WriteByte(0x20); + BaseStream.Seek(116755, SeekOrigin.Begin); + BaseStream.WriteByte(0x40); + BaseStream.Seek(116767, SeekOrigin.Begin); + BaseStream.WriteByte(0x58); + BaseStream.Seek(120895, SeekOrigin.Begin); + BaseStream.WriteByte(0x24); + BaseStream.Seek(128803, SeekOrigin.Begin); + BaseStream.WriteByte(0xa8); + BaseStream.Seek(129483, SeekOrigin.Begin); + BaseStream.WriteByte(0x90); + BaseStream.Seek(136707, SeekOrigin.Begin); + BaseStream.WriteByte(0xd0); + BaseStream.Seek(137175, SeekOrigin.Begin); + BaseStream.WriteByte(0xd0); + BaseStream.Seek(140083, SeekOrigin.Begin); + BaseStream.WriteByte(0x68); + BaseStream.Seek(140535, SeekOrigin.Begin); + BaseStream.WriteByte(0x90); + BaseStream.Seek(140847, SeekOrigin.Begin); + BaseStream.WriteByte(0xd4); + BaseStream.Seek(140855, SeekOrigin.Begin); + BaseStream.WriteByte(0x18); + BaseStream.Seek(140859, SeekOrigin.Begin); + BaseStream.WriteByte(0xb8); + BaseStream.Seek(144215, SeekOrigin.Begin); + BaseStream.WriteByte(0xc0); + BaseStream.Seek(144735, SeekOrigin.Begin); + BaseStream.WriteByte(0xe8); + BaseStream.Seek(144951, SeekOrigin.Begin); + BaseStream.WriteByte(0x78); + BaseStream.Seek(145071, SeekOrigin.Begin); + BaseStream.WriteByte(0x7c); + BaseStream.Seek(145235, SeekOrigin.Begin); + BaseStream.WriteByte(0x84); + BaseStream.Seek(145315, SeekOrigin.Begin); + BaseStream.WriteByte(0x88); + BaseStream.Seek(145395, SeekOrigin.Begin); + BaseStream.WriteByte(0x78); + BaseStream.Seek(145563, SeekOrigin.Begin); + BaseStream.WriteByte(0xac); + BaseStream.Seek(145687, SeekOrigin.Begin); + BaseStream.WriteByte(0xb4); + BaseStream.Seek(145847, SeekOrigin.Begin); + BaseStream.WriteByte(0x84); + BaseStream.Seek(145955, SeekOrigin.Begin); + BaseStream.WriteByte(0x5c); + BaseStream.Seek(146127, SeekOrigin.Begin); + BaseStream.WriteByte(0xac); + BaseStream.Seek(146251, SeekOrigin.Begin); + BaseStream.WriteByte(0xb4); + BaseStream.Seek(146375, SeekOrigin.Begin); + BaseStream.WriteByte(0xc8); + BaseStream.Seek(146647, SeekOrigin.Begin); + BaseStream.WriteByte(0xcc); + BaseStream.Seek(146794, SeekOrigin.Begin); + BaseStream.WriteByte(0x0e); + BaseStream.Seek(146795, SeekOrigin.Begin); + BaseStream.WriteByte(0x00); + BaseStream.Seek(146923, SeekOrigin.Begin); + BaseStream.WriteByte(0xd8); + BaseStream.Seek(147151, SeekOrigin.Begin); + BaseStream.WriteByte(0xdc); + BaseStream.Seek(153442, SeekOrigin.Begin); + BaseStream.WriteByte(0x0f); + BaseStream.Seek(153443, SeekOrigin.Begin); + BaseStream.WriteByte(0x00); + BaseStream.Seek(153719, SeekOrigin.Begin); + BaseStream.WriteByte(0x20); + BaseStream.Seek(178711, SeekOrigin.Begin); + BaseStream.WriteByte(0x18); + BaseStream.Seek(178715, SeekOrigin.Begin); + BaseStream.WriteByte(0xa4); + BaseStream.Seek(178719, SeekOrigin.Begin); + BaseStream.WriteByte(0xa4); + BaseStream.Seek(178723, SeekOrigin.Begin); + BaseStream.WriteByte(0xa4); + BaseStream.Seek(178727, SeekOrigin.Begin); + BaseStream.WriteByte(0xa4); + BaseStream.Seek(178731, SeekOrigin.Begin); + BaseStream.WriteByte(0xa4); + BaseStream.Seek(178735, SeekOrigin.Begin); + BaseStream.WriteByte(0xa4); + BaseStream.Seek(178739, SeekOrigin.Begin); + BaseStream.WriteByte(0xa4); + BaseStream.Seek(178743, SeekOrigin.Begin); + BaseStream.WriteByte(0xa4); + BaseStream.Seek(178747, SeekOrigin.Begin); + BaseStream.WriteByte(0xa4); + + return BaseStream; + } + + internal static MemoryStream ConvertTo9Chars(MemoryStream BaseStream) + { + BaseStream.Seek(16823, SeekOrigin.Begin); + BaseStream.WriteByte(0xdc); + BaseStream.Seek(16939, SeekOrigin.Begin); + BaseStream.WriteByte(0xdc); + BaseStream.Seek(17067, SeekOrigin.Begin); + BaseStream.WriteByte(0xdc); + BaseStream.Seek(17439, SeekOrigin.Begin); + BaseStream.WriteByte(0xb0); + BaseStream.Seek(17835, SeekOrigin.Begin); + BaseStream.WriteByte(0xb0); + BaseStream.Seek(21203, SeekOrigin.Begin); + BaseStream.WriteByte(0xb0); + BaseStream.Seek(29399, SeekOrigin.Begin); + BaseStream.WriteByte(0x08); + BaseStream.Seek(33439, SeekOrigin.Begin); + BaseStream.WriteByte(0xb0); + BaseStream.Seek(69739, SeekOrigin.Begin); + BaseStream.WriteByte(0x08); + BaseStream.Seek(69767, SeekOrigin.Begin); + BaseStream.WriteByte(0x38); + BaseStream.Seek(69799, SeekOrigin.Begin); + BaseStream.WriteByte(0x68); + BaseStream.Seek(69815, SeekOrigin.Begin); + BaseStream.WriteByte(0x7c); + BaseStream.Seek(69839, SeekOrigin.Begin); + BaseStream.WriteByte(0x9c); + BaseStream.Seek(69855, SeekOrigin.Begin); + BaseStream.WriteByte(0xa0); + BaseStream.Seek(69871, SeekOrigin.Begin); + BaseStream.WriteByte(0xd4); + BaseStream.Seek(69999, SeekOrigin.Begin); + BaseStream.WriteByte(0xf0); + BaseStream.Seek(70011, SeekOrigin.Begin); + BaseStream.WriteByte(0x08); + BaseStream.Seek(70047, SeekOrigin.Begin); + BaseStream.WriteByte(0x18); + BaseStream.Seek(70071, SeekOrigin.Begin); + BaseStream.WriteByte(0x54); + BaseStream.Seek(70279, SeekOrigin.Begin); + BaseStream.WriteByte(0x28); + BaseStream.Seek(70319, SeekOrigin.Begin); + BaseStream.WriteByte(0xd8); + BaseStream.Seek(70351, SeekOrigin.Begin); + BaseStream.WriteByte(0x50); + BaseStream.Seek(70795, SeekOrigin.Begin); + BaseStream.WriteByte(0x58); + BaseStream.Seek(71315, SeekOrigin.Begin); + BaseStream.WriteByte(0xc8); + BaseStream.Seek(71627, SeekOrigin.Begin); + BaseStream.WriteByte(0xbc); + BaseStream.Seek(71655, SeekOrigin.Begin); + BaseStream.WriteByte(0xc0); + BaseStream.Seek(72171, SeekOrigin.Begin); + BaseStream.WriteByte(0xc8); + BaseStream.Seek(91719, SeekOrigin.Begin); + BaseStream.WriteByte(0xcc); + BaseStream.Seek(93627, SeekOrigin.Begin); + BaseStream.WriteByte(0x24); + BaseStream.Seek(94039, SeekOrigin.Begin); + BaseStream.WriteByte(0xcc); + BaseStream.Seek(95527, SeekOrigin.Begin); + BaseStream.WriteByte(0x14); + BaseStream.Seek(95895, SeekOrigin.Begin); + BaseStream.WriteByte(0x24); + BaseStream.Seek(96383, SeekOrigin.Begin); + BaseStream.WriteByte(0x14); + BaseStream.Seek(96667, SeekOrigin.Begin); + BaseStream.WriteByte(0xcc); + BaseStream.Seek(97170, SeekOrigin.Begin); + BaseStream.WriteByte(0x03); + BaseStream.Seek(97171, SeekOrigin.Begin); + BaseStream.WriteByte(0x00); + BaseStream.Seek(98074, SeekOrigin.Begin); + BaseStream.WriteByte(0x03); + BaseStream.Seek(98075, SeekOrigin.Begin); + BaseStream.WriteByte(0x00); + BaseStream.Seek(98711, SeekOrigin.Begin); + BaseStream.WriteByte(0x4c); + BaseStream.Seek(99071, SeekOrigin.Begin); + BaseStream.WriteByte(0x20); + BaseStream.Seek(99079, SeekOrigin.Begin); + BaseStream.WriteByte(0x38); + BaseStream.Seek(99083, SeekOrigin.Begin); + BaseStream.WriteByte(0x0c); + BaseStream.Seek(100619, SeekOrigin.Begin); + BaseStream.WriteByte(0xf8); + BaseStream.Seek(100631, SeekOrigin.Begin); + BaseStream.WriteByte(0xec); + BaseStream.Seek(100663, SeekOrigin.Begin); + BaseStream.WriteByte(0x0c); + BaseStream.Seek(100687, SeekOrigin.Begin); + BaseStream.WriteByte(0x1c); + BaseStream.Seek(100723, SeekOrigin.Begin); + BaseStream.WriteByte(0x4c); + BaseStream.Seek(100755, SeekOrigin.Begin); + BaseStream.WriteByte(0x7c); + BaseStream.Seek(100787, SeekOrigin.Begin); + BaseStream.WriteByte(0xac); + BaseStream.Seek(100819, SeekOrigin.Begin); + BaseStream.WriteByte(0xdc); + BaseStream.Seek(100851, SeekOrigin.Begin); + BaseStream.WriteByte(0x0c); + BaseStream.Seek(100883, SeekOrigin.Begin); + BaseStream.WriteByte(0x3c); + BaseStream.Seek(100915, SeekOrigin.Begin); + BaseStream.WriteByte(0x6c); + BaseStream.Seek(100947, SeekOrigin.Begin); + BaseStream.WriteByte(0x9c); + BaseStream.Seek(100975, SeekOrigin.Begin); + BaseStream.WriteByte(0xc4); + BaseStream.Seek(101019, SeekOrigin.Begin); + BaseStream.WriteByte(0xdc); + BaseStream.Seek(101043, SeekOrigin.Begin); + BaseStream.WriteByte(0xec); + BaseStream.Seek(101047, SeekOrigin.Begin); + BaseStream.WriteByte(0xf4); + BaseStream.Seek(101063, SeekOrigin.Begin); + BaseStream.WriteByte(0xf8); + BaseStream.Seek(101067, SeekOrigin.Begin); + BaseStream.WriteByte(0xfc); + BaseStream.Seek(101287, SeekOrigin.Begin); + BaseStream.WriteByte(0x2c); + BaseStream.Seek(101311, SeekOrigin.Begin); + BaseStream.WriteByte(0x44); + BaseStream.Seek(101315, SeekOrigin.Begin); + BaseStream.WriteByte(0x50); + BaseStream.Seek(101506, SeekOrigin.Begin); + BaseStream.WriteByte(0x07); + BaseStream.Seek(101507, SeekOrigin.Begin); + BaseStream.WriteByte(0x00); + BaseStream.Seek(101523, SeekOrigin.Begin); + BaseStream.WriteByte(0x10); + BaseStream.Seek(101615, SeekOrigin.Begin); + BaseStream.WriteByte(0xb0); + BaseStream.Seek(101803, SeekOrigin.Begin); + BaseStream.WriteByte(0xb0); + BaseStream.Seek(102259, SeekOrigin.Begin); + BaseStream.WriteByte(0x34); + BaseStream.Seek(102283, SeekOrigin.Begin); + BaseStream.WriteByte(0x8c); + BaseStream.Seek(102299, SeekOrigin.Begin); + BaseStream.WriteByte(0x8c); + BaseStream.Seek(102311, SeekOrigin.Begin); + BaseStream.WriteByte(0x8c); + BaseStream.Seek(102327, SeekOrigin.Begin); + BaseStream.WriteByte(0x8c); + BaseStream.Seek(102343, SeekOrigin.Begin); + BaseStream.WriteByte(0x8c); + BaseStream.Seek(102359, SeekOrigin.Begin); + BaseStream.WriteByte(0x8c); + BaseStream.Seek(102375, SeekOrigin.Begin); + BaseStream.WriteByte(0x8c); + BaseStream.Seek(102391, SeekOrigin.Begin); + BaseStream.WriteByte(0x8c); + BaseStream.Seek(106287, SeekOrigin.Begin); + BaseStream.WriteByte(0x08); + BaseStream.Seek(114255, SeekOrigin.Begin); + BaseStream.WriteByte(0x2c); + BaseStream.Seek(116755, SeekOrigin.Begin); + BaseStream.WriteByte(0x4c); + BaseStream.Seek(116767, SeekOrigin.Begin); + BaseStream.WriteByte(0x64); + BaseStream.Seek(120895, SeekOrigin.Begin); + BaseStream.WriteByte(0x30); + BaseStream.Seek(128803, SeekOrigin.Begin); + BaseStream.WriteByte(0xb4); + BaseStream.Seek(129483, SeekOrigin.Begin); + BaseStream.WriteByte(0x9c); + BaseStream.Seek(136707, SeekOrigin.Begin); + BaseStream.WriteByte(0xdc); + BaseStream.Seek(137175, SeekOrigin.Begin); + BaseStream.WriteByte(0xdc); + BaseStream.Seek(140083, SeekOrigin.Begin); + BaseStream.WriteByte(0x74); + BaseStream.Seek(140535, SeekOrigin.Begin); + BaseStream.WriteByte(0x9c); + BaseStream.Seek(140847, SeekOrigin.Begin); + BaseStream.WriteByte(0xe0); + BaseStream.Seek(140855, SeekOrigin.Begin); + BaseStream.WriteByte(0x24); + BaseStream.Seek(140859, SeekOrigin.Begin); + BaseStream.WriteByte(0xc4); + BaseStream.Seek(144215, SeekOrigin.Begin); + BaseStream.WriteByte(0xcc); + BaseStream.Seek(144735, SeekOrigin.Begin); + BaseStream.WriteByte(0xf4); + BaseStream.Seek(144951, SeekOrigin.Begin); + BaseStream.WriteByte(0x84); + BaseStream.Seek(145071, SeekOrigin.Begin); + BaseStream.WriteByte(0x88); + BaseStream.Seek(145235, SeekOrigin.Begin); + BaseStream.WriteByte(0x90); + BaseStream.Seek(145315, SeekOrigin.Begin); + BaseStream.WriteByte(0x94); + BaseStream.Seek(145395, SeekOrigin.Begin); + BaseStream.WriteByte(0x84); + BaseStream.Seek(145563, SeekOrigin.Begin); + BaseStream.WriteByte(0xb8); + BaseStream.Seek(145687, SeekOrigin.Begin); + BaseStream.WriteByte(0xc0); + BaseStream.Seek(145847, SeekOrigin.Begin); + BaseStream.WriteByte(0x90); + BaseStream.Seek(145955, SeekOrigin.Begin); + BaseStream.WriteByte(0x68); + BaseStream.Seek(146127, SeekOrigin.Begin); + BaseStream.WriteByte(0xb8); + BaseStream.Seek(146251, SeekOrigin.Begin); + BaseStream.WriteByte(0xc0); + BaseStream.Seek(146375, SeekOrigin.Begin); + BaseStream.WriteByte(0xd4); + BaseStream.Seek(146647, SeekOrigin.Begin); + BaseStream.WriteByte(0xd8); + BaseStream.Seek(146795, SeekOrigin.Begin); + BaseStream.WriteByte(0x0c); + BaseStream.Seek(146923, SeekOrigin.Begin); + BaseStream.WriteByte(0xe4); + BaseStream.Seek(147151, SeekOrigin.Begin); + BaseStream.WriteByte(0xe8); + BaseStream.Seek(153443, SeekOrigin.Begin); + BaseStream.WriteByte(0x0c); + BaseStream.Seek(153719, SeekOrigin.Begin); + BaseStream.WriteByte(0x2c); + BaseStream.Seek(178711, SeekOrigin.Begin); + BaseStream.WriteByte(0x24); + BaseStream.Seek(178715, SeekOrigin.Begin); + BaseStream.WriteByte(0xb0); + BaseStream.Seek(178719, SeekOrigin.Begin); + BaseStream.WriteByte(0xb0); + BaseStream.Seek(178723, SeekOrigin.Begin); + BaseStream.WriteByte(0xb0); + BaseStream.Seek(178727, SeekOrigin.Begin); + BaseStream.WriteByte(0xb0); + BaseStream.Seek(178731, SeekOrigin.Begin); + BaseStream.WriteByte(0xb0); + BaseStream.Seek(178735, SeekOrigin.Begin); + BaseStream.WriteByte(0xb0); + BaseStream.Seek(178739, SeekOrigin.Begin); + BaseStream.WriteByte(0xb0); + BaseStream.Seek(178743, SeekOrigin.Begin); + BaseStream.WriteByte(0xb0); + BaseStream.Seek(178747, SeekOrigin.Begin); + BaseStream.WriteByte(0xb0); + + return BaseStream; + } + + internal static MemoryStream ConvertTo10Chars(MemoryStream BaseStream) + { + BaseStream.Seek(16823, SeekOrigin.Begin); + BaseStream.WriteByte(0xe4); + BaseStream.Seek(16939, SeekOrigin.Begin); + BaseStream.WriteByte(0xe4); + BaseStream.Seek(17067, SeekOrigin.Begin); + BaseStream.WriteByte(0xe4); + BaseStream.Seek(17439, SeekOrigin.Begin); + BaseStream.WriteByte(0xb8); + BaseStream.Seek(17835, SeekOrigin.Begin); + BaseStream.WriteByte(0xb8); + BaseStream.Seek(21203, SeekOrigin.Begin); + BaseStream.WriteByte(0xb8); + BaseStream.Seek(29399, SeekOrigin.Begin); + BaseStream.WriteByte(0x10); + BaseStream.Seek(33439, SeekOrigin.Begin); + BaseStream.WriteByte(0xb8); + BaseStream.Seek(69695, SeekOrigin.Begin); + BaseStream.WriteByte(0xc8); + BaseStream.Seek(69739, SeekOrigin.Begin); + BaseStream.WriteByte(0x0c); + BaseStream.Seek(69767, SeekOrigin.Begin); + BaseStream.WriteByte(0x40); + BaseStream.Seek(69799, SeekOrigin.Begin); + BaseStream.WriteByte(0x70); + BaseStream.Seek(69815, SeekOrigin.Begin); + BaseStream.WriteByte(0x84); + BaseStream.Seek(69839, SeekOrigin.Begin); + BaseStream.WriteByte(0xa4); + BaseStream.Seek(69855, SeekOrigin.Begin); + BaseStream.WriteByte(0xa8); + BaseStream.Seek(69871, SeekOrigin.Begin); + BaseStream.WriteByte(0xdc); + BaseStream.Seek(69999, SeekOrigin.Begin); + BaseStream.WriteByte(0xf8); + BaseStream.Seek(70011, SeekOrigin.Begin); + BaseStream.WriteByte(0x10); + BaseStream.Seek(70047, SeekOrigin.Begin); + BaseStream.WriteByte(0x20); + BaseStream.Seek(70071, SeekOrigin.Begin); + BaseStream.WriteByte(0x5c); + BaseStream.Seek(70279, SeekOrigin.Begin); + BaseStream.WriteByte(0x30); + BaseStream.Seek(70319, SeekOrigin.Begin); + BaseStream.WriteByte(0xe0); + BaseStream.Seek(70351, SeekOrigin.Begin); + BaseStream.WriteByte(0x58); + BaseStream.Seek(70371, SeekOrigin.Begin); + BaseStream.WriteByte(0xcc); + BaseStream.Seek(70795, SeekOrigin.Begin); + BaseStream.WriteByte(0x60); + BaseStream.Seek(71315, SeekOrigin.Begin); + BaseStream.WriteByte(0xd0); + BaseStream.Seek(71627, SeekOrigin.Begin); + BaseStream.WriteByte(0xc4); + BaseStream.Seek(71655, SeekOrigin.Begin); + BaseStream.WriteByte(0xc8); + BaseStream.Seek(72171, SeekOrigin.Begin); + BaseStream.WriteByte(0xd0); + BaseStream.Seek(91719, SeekOrigin.Begin); + BaseStream.WriteByte(0xd4); + BaseStream.Seek(93627, SeekOrigin.Begin); + BaseStream.WriteByte(0x2c); + BaseStream.Seek(94039, SeekOrigin.Begin); + BaseStream.WriteByte(0xd4); + BaseStream.Seek(95527, SeekOrigin.Begin); + BaseStream.WriteByte(0x1c); + BaseStream.Seek(95895, SeekOrigin.Begin); + BaseStream.WriteByte(0x2c); + BaseStream.Seek(96383, SeekOrigin.Begin); + BaseStream.WriteByte(0x1c); + BaseStream.Seek(96667, SeekOrigin.Begin); + BaseStream.WriteByte(0xd4); + BaseStream.Seek(97170, SeekOrigin.Begin); + BaseStream.WriteByte(0x03); + BaseStream.Seek(97171, SeekOrigin.Begin); + BaseStream.WriteByte(0x08); + BaseStream.Seek(98074, SeekOrigin.Begin); + BaseStream.WriteByte(0x03); + BaseStream.Seek(98075, SeekOrigin.Begin); + BaseStream.WriteByte(0x08); + BaseStream.Seek(98711, SeekOrigin.Begin); + BaseStream.WriteByte(0x54); + BaseStream.Seek(99071, SeekOrigin.Begin); + BaseStream.WriteByte(0x28); + BaseStream.Seek(99079, SeekOrigin.Begin); + BaseStream.WriteByte(0x40); + BaseStream.Seek(99083, SeekOrigin.Begin); + BaseStream.WriteByte(0x14); + BaseStream.Seek(100618, SeekOrigin.Begin); + BaseStream.WriteByte(0x08); + BaseStream.Seek(100619, SeekOrigin.Begin); + BaseStream.WriteByte(0x00); + BaseStream.Seek(100631, SeekOrigin.Begin); + BaseStream.WriteByte(0xf4); + BaseStream.Seek(100663, SeekOrigin.Begin); + BaseStream.WriteByte(0x14); + BaseStream.Seek(100687, SeekOrigin.Begin); + BaseStream.WriteByte(0x24); + BaseStream.Seek(100723, SeekOrigin.Begin); + BaseStream.WriteByte(0x54); + BaseStream.Seek(100755, SeekOrigin.Begin); + BaseStream.WriteByte(0x84); + BaseStream.Seek(100787, SeekOrigin.Begin); + BaseStream.WriteByte(0xb4); + BaseStream.Seek(100819, SeekOrigin.Begin); + BaseStream.WriteByte(0xe4); + BaseStream.Seek(100851, SeekOrigin.Begin); + BaseStream.WriteByte(0x14); + BaseStream.Seek(100883, SeekOrigin.Begin); + BaseStream.WriteByte(0x44); + BaseStream.Seek(100915, SeekOrigin.Begin); + BaseStream.WriteByte(0x74); + BaseStream.Seek(100947, SeekOrigin.Begin); + BaseStream.WriteByte(0xa4); + BaseStream.Seek(100975, SeekOrigin.Begin); + BaseStream.WriteByte(0xcc); + BaseStream.Seek(101019, SeekOrigin.Begin); + BaseStream.WriteByte(0xe4); + BaseStream.Seek(101043, SeekOrigin.Begin); + BaseStream.WriteByte(0xf4); + BaseStream.Seek(101047, SeekOrigin.Begin); + BaseStream.WriteByte(0xfc); + BaseStream.Seek(101062, SeekOrigin.Begin); + BaseStream.WriteByte(0x07); + BaseStream.Seek(101063, SeekOrigin.Begin); + BaseStream.WriteByte(0x00); + BaseStream.Seek(101066, SeekOrigin.Begin); + BaseStream.WriteByte(0x07); + BaseStream.Seek(101067, SeekOrigin.Begin); + BaseStream.WriteByte(0x04); + BaseStream.Seek(101287, SeekOrigin.Begin); + BaseStream.WriteByte(0x34); + BaseStream.Seek(101311, SeekOrigin.Begin); + BaseStream.WriteByte(0x4c); + BaseStream.Seek(101315, SeekOrigin.Begin); + BaseStream.WriteByte(0x58); + BaseStream.Seek(101506, SeekOrigin.Begin); + BaseStream.WriteByte(0x07); + BaseStream.Seek(101507, SeekOrigin.Begin); + BaseStream.WriteByte(0x08); + BaseStream.Seek(101523, SeekOrigin.Begin); + BaseStream.WriteByte(0x18); + BaseStream.Seek(101615, SeekOrigin.Begin); + BaseStream.WriteByte(0xb8); + BaseStream.Seek(101803, SeekOrigin.Begin); + BaseStream.WriteByte(0xb8); + BaseStream.Seek(102259, SeekOrigin.Begin); + BaseStream.WriteByte(0x3c); + BaseStream.Seek(102283, SeekOrigin.Begin); + BaseStream.WriteByte(0x94); + BaseStream.Seek(102299, SeekOrigin.Begin); + BaseStream.WriteByte(0x94); + BaseStream.Seek(102311, SeekOrigin.Begin); + BaseStream.WriteByte(0x94); + BaseStream.Seek(102327, SeekOrigin.Begin); + BaseStream.WriteByte(0x94); + BaseStream.Seek(102343, SeekOrigin.Begin); + BaseStream.WriteByte(0x94); + BaseStream.Seek(102359, SeekOrigin.Begin); + BaseStream.WriteByte(0x94); + BaseStream.Seek(102375, SeekOrigin.Begin); + BaseStream.WriteByte(0x94); + BaseStream.Seek(102391, SeekOrigin.Begin); + BaseStream.WriteByte(0x94); + BaseStream.Seek(106287, SeekOrigin.Begin); + BaseStream.WriteByte(0x10); + BaseStream.Seek(114255, SeekOrigin.Begin); + BaseStream.WriteByte(0x34); + BaseStream.Seek(116755, SeekOrigin.Begin); + BaseStream.WriteByte(0x54); + BaseStream.Seek(116767, SeekOrigin.Begin); + BaseStream.WriteByte(0x6c); + BaseStream.Seek(120895, SeekOrigin.Begin); + BaseStream.WriteByte(0x38); + BaseStream.Seek(128803, SeekOrigin.Begin); + BaseStream.WriteByte(0xbc); + BaseStream.Seek(129483, SeekOrigin.Begin); + BaseStream.WriteByte(0xa4); + BaseStream.Seek(136707, SeekOrigin.Begin); + BaseStream.WriteByte(0xe4); + BaseStream.Seek(137175, SeekOrigin.Begin); + BaseStream.WriteByte(0xe4); + BaseStream.Seek(140083, SeekOrigin.Begin); + BaseStream.WriteByte(0x7c); + BaseStream.Seek(140535, SeekOrigin.Begin); + BaseStream.WriteByte(0xa4); + BaseStream.Seek(140847, SeekOrigin.Begin); + BaseStream.WriteByte(0xe8); + BaseStream.Seek(140855, SeekOrigin.Begin); + BaseStream.WriteByte(0x2c); + BaseStream.Seek(140859, SeekOrigin.Begin); + BaseStream.WriteByte(0xcc); + BaseStream.Seek(144215, SeekOrigin.Begin); + BaseStream.WriteByte(0xd4); + BaseStream.Seek(144735, SeekOrigin.Begin); + BaseStream.WriteByte(0xfc); + BaseStream.Seek(144951, SeekOrigin.Begin); + BaseStream.WriteByte(0x8c); + BaseStream.Seek(145071, SeekOrigin.Begin); + BaseStream.WriteByte(0x90); + BaseStream.Seek(145235, SeekOrigin.Begin); + BaseStream.WriteByte(0x98); + BaseStream.Seek(145315, SeekOrigin.Begin); + BaseStream.WriteByte(0x9c); + BaseStream.Seek(145395, SeekOrigin.Begin); + BaseStream.WriteByte(0x8c); + BaseStream.Seek(145563, SeekOrigin.Begin); + BaseStream.WriteByte(0xc0); + BaseStream.Seek(145687, SeekOrigin.Begin); + BaseStream.WriteByte(0xc8); + BaseStream.Seek(145847, SeekOrigin.Begin); + BaseStream.WriteByte(0x98); + BaseStream.Seek(145955, SeekOrigin.Begin); + BaseStream.WriteByte(0x70); + BaseStream.Seek(146127, SeekOrigin.Begin); + BaseStream.WriteByte(0xc0); + BaseStream.Seek(146251, SeekOrigin.Begin); + BaseStream.WriteByte(0xc8); + BaseStream.Seek(146375, SeekOrigin.Begin); + BaseStream.WriteByte(0xdc); + BaseStream.Seek(146647, SeekOrigin.Begin); + BaseStream.WriteByte(0xe0); + BaseStream.Seek(146795, SeekOrigin.Begin); + BaseStream.WriteByte(0x14); + BaseStream.Seek(146923, SeekOrigin.Begin); + BaseStream.WriteByte(0xec); + BaseStream.Seek(147151, SeekOrigin.Begin); + BaseStream.WriteByte(0xf0); + BaseStream.Seek(153443, SeekOrigin.Begin); + BaseStream.WriteByte(0x14); + BaseStream.Seek(153719, SeekOrigin.Begin); + BaseStream.WriteByte(0x34); + BaseStream.Seek(178711, SeekOrigin.Begin); + BaseStream.WriteByte(0x2c); + BaseStream.Seek(178715, SeekOrigin.Begin); + BaseStream.WriteByte(0xb8); + BaseStream.Seek(178719, SeekOrigin.Begin); + BaseStream.WriteByte(0xb8); + BaseStream.Seek(178723, SeekOrigin.Begin); + BaseStream.WriteByte(0xb8); + BaseStream.Seek(178727, SeekOrigin.Begin); + BaseStream.WriteByte(0xb8); + BaseStream.Seek(178731, SeekOrigin.Begin); + BaseStream.WriteByte(0xb8); + BaseStream.Seek(178735, SeekOrigin.Begin); + BaseStream.WriteByte(0xb8); + BaseStream.Seek(178739, SeekOrigin.Begin); + BaseStream.WriteByte(0xb8); + BaseStream.Seek(178743, SeekOrigin.Begin); + BaseStream.WriteByte(0xb8); + BaseStream.Seek(178747, SeekOrigin.Begin); + BaseStream.WriteByte(0xb8); + + return BaseStream; + } + + internal static MemoryStream ConvertTo13Chars(MemoryStream BaseStream) + { + BaseStream.Seek(16823, SeekOrigin.Begin); + BaseStream.WriteByte(0xe8); + BaseStream.Seek(16939, SeekOrigin.Begin); + BaseStream.WriteByte(0xe8); + BaseStream.Seek(17067, SeekOrigin.Begin); + BaseStream.WriteByte(0xe8); + BaseStream.Seek(17439, SeekOrigin.Begin); + BaseStream.WriteByte(0xbc); + BaseStream.Seek(17835, SeekOrigin.Begin); + BaseStream.WriteByte(0xbc); + BaseStream.Seek(21203, SeekOrigin.Begin); + BaseStream.WriteByte(0xbc); + BaseStream.Seek(29399, SeekOrigin.Begin); + BaseStream.WriteByte(0x14); + BaseStream.Seek(33439, SeekOrigin.Begin); + BaseStream.WriteByte(0xbc); + BaseStream.Seek(69695, SeekOrigin.Begin); + BaseStream.WriteByte(0xc8); + BaseStream.Seek(69739, SeekOrigin.Begin); + BaseStream.WriteByte(0x10); + BaseStream.Seek(69767, SeekOrigin.Begin); + BaseStream.WriteByte(0x44); + BaseStream.Seek(69799, SeekOrigin.Begin); + BaseStream.WriteByte(0x74); + BaseStream.Seek(69815, SeekOrigin.Begin); + BaseStream.WriteByte(0x88); + BaseStream.Seek(69839, SeekOrigin.Begin); + BaseStream.WriteByte(0xa8); + BaseStream.Seek(69855, SeekOrigin.Begin); + BaseStream.WriteByte(0xac); + BaseStream.Seek(69871, SeekOrigin.Begin); + BaseStream.WriteByte(0xe0); + BaseStream.Seek(69999, SeekOrigin.Begin); + BaseStream.WriteByte(0xfc); + BaseStream.Seek(70011, SeekOrigin.Begin); + BaseStream.WriteByte(0x14); + BaseStream.Seek(70047, SeekOrigin.Begin); + BaseStream.WriteByte(0x24); + BaseStream.Seek(70071, SeekOrigin.Begin); + BaseStream.WriteByte(0x60); + BaseStream.Seek(70279, SeekOrigin.Begin); + BaseStream.WriteByte(0x34); + BaseStream.Seek(70319, SeekOrigin.Begin); + BaseStream.WriteByte(0xe4); + BaseStream.Seek(70351, SeekOrigin.Begin); + BaseStream.WriteByte(0x5c); + BaseStream.Seek(70371, SeekOrigin.Begin); + BaseStream.WriteByte(0xcc); + BaseStream.Seek(70795, SeekOrigin.Begin); + BaseStream.WriteByte(0x64); + BaseStream.Seek(71315, SeekOrigin.Begin); + BaseStream.WriteByte(0xd4); + BaseStream.Seek(71627, SeekOrigin.Begin); + BaseStream.WriteByte(0xc8); + BaseStream.Seek(71655, SeekOrigin.Begin); + BaseStream.WriteByte(0xcc); + BaseStream.Seek(72171, SeekOrigin.Begin); + BaseStream.WriteByte(0xd4); + BaseStream.Seek(91719, SeekOrigin.Begin); + BaseStream.WriteByte(0xd8); + BaseStream.Seek(93627, SeekOrigin.Begin); + BaseStream.WriteByte(0x30); + BaseStream.Seek(94039, SeekOrigin.Begin); + BaseStream.WriteByte(0xd8); + BaseStream.Seek(95527, SeekOrigin.Begin); + BaseStream.WriteByte(0x20); + BaseStream.Seek(95895, SeekOrigin.Begin); + BaseStream.WriteByte(0x30); + BaseStream.Seek(96383, SeekOrigin.Begin); + BaseStream.WriteByte(0x20); + BaseStream.Seek(96667, SeekOrigin.Begin); + BaseStream.WriteByte(0xd8); + BaseStream.Seek(97170, SeekOrigin.Begin); + BaseStream.WriteByte(0x03); + BaseStream.Seek(97171, SeekOrigin.Begin); + BaseStream.WriteByte(0x0c); + BaseStream.Seek(98074, SeekOrigin.Begin); + BaseStream.WriteByte(0x03); + BaseStream.Seek(98075, SeekOrigin.Begin); + BaseStream.WriteByte(0x0c); + BaseStream.Seek(98711, SeekOrigin.Begin); + BaseStream.WriteByte(0x58); + BaseStream.Seek(99071, SeekOrigin.Begin); + BaseStream.WriteByte(0x2c); + BaseStream.Seek(99079, SeekOrigin.Begin); + BaseStream.WriteByte(0x44); + BaseStream.Seek(99083, SeekOrigin.Begin); + BaseStream.WriteByte(0x18); + BaseStream.Seek(100618, SeekOrigin.Begin); + BaseStream.WriteByte(0x08); + BaseStream.Seek(100619, SeekOrigin.Begin); + BaseStream.WriteByte(0x04); + BaseStream.Seek(100631, SeekOrigin.Begin); + BaseStream.WriteByte(0xf8); + BaseStream.Seek(100663, SeekOrigin.Begin); + BaseStream.WriteByte(0x18); + BaseStream.Seek(100687, SeekOrigin.Begin); + BaseStream.WriteByte(0x28); + BaseStream.Seek(100723, SeekOrigin.Begin); + BaseStream.WriteByte(0x58); + BaseStream.Seek(100755, SeekOrigin.Begin); + BaseStream.WriteByte(0x88); + BaseStream.Seek(100787, SeekOrigin.Begin); + BaseStream.WriteByte(0xb8); + BaseStream.Seek(100819, SeekOrigin.Begin); + BaseStream.WriteByte(0xe8); + BaseStream.Seek(100851, SeekOrigin.Begin); + BaseStream.WriteByte(0x18); + BaseStream.Seek(100883, SeekOrigin.Begin); + BaseStream.WriteByte(0x48); + BaseStream.Seek(100915, SeekOrigin.Begin); + BaseStream.WriteByte(0x78); + BaseStream.Seek(100947, SeekOrigin.Begin); + BaseStream.WriteByte(0xa8); + BaseStream.Seek(100975, SeekOrigin.Begin); + BaseStream.WriteByte(0xd0); + BaseStream.Seek(101019, SeekOrigin.Begin); + BaseStream.WriteByte(0xe8); + BaseStream.Seek(101043, SeekOrigin.Begin); + BaseStream.WriteByte(0xf8); + BaseStream.Seek(101046, SeekOrigin.Begin); + BaseStream.WriteByte(0x07); + BaseStream.Seek(101047, SeekOrigin.Begin); + BaseStream.WriteByte(0x00); + BaseStream.Seek(101062, SeekOrigin.Begin); + BaseStream.WriteByte(0x07); + BaseStream.Seek(101063, SeekOrigin.Begin); + BaseStream.WriteByte(0x04); + BaseStream.Seek(101066, SeekOrigin.Begin); + BaseStream.WriteByte(0x07); + BaseStream.Seek(101067, SeekOrigin.Begin); + BaseStream.WriteByte(0x08); + BaseStream.Seek(101287, SeekOrigin.Begin); + BaseStream.WriteByte(0x38); + BaseStream.Seek(101311, SeekOrigin.Begin); + BaseStream.WriteByte(0x50); + BaseStream.Seek(101315, SeekOrigin.Begin); + BaseStream.WriteByte(0x5c); + BaseStream.Seek(101506, SeekOrigin.Begin); + BaseStream.WriteByte(0x07); + BaseStream.Seek(101507, SeekOrigin.Begin); + BaseStream.WriteByte(0x0c); + BaseStream.Seek(101523, SeekOrigin.Begin); + BaseStream.WriteByte(0x1c); + BaseStream.Seek(101615, SeekOrigin.Begin); + BaseStream.WriteByte(0xbc); + BaseStream.Seek(101803, SeekOrigin.Begin); + BaseStream.WriteByte(0xbc); + BaseStream.Seek(102259, SeekOrigin.Begin); + BaseStream.WriteByte(0x40); + BaseStream.Seek(102283, SeekOrigin.Begin); + BaseStream.WriteByte(0x98); + BaseStream.Seek(102299, SeekOrigin.Begin); + BaseStream.WriteByte(0x98); + BaseStream.Seek(102311, SeekOrigin.Begin); + BaseStream.WriteByte(0x98); + BaseStream.Seek(102327, SeekOrigin.Begin); + BaseStream.WriteByte(0x98); + BaseStream.Seek(102343, SeekOrigin.Begin); + BaseStream.WriteByte(0x98); + BaseStream.Seek(102359, SeekOrigin.Begin); + BaseStream.WriteByte(0x98); + BaseStream.Seek(102375, SeekOrigin.Begin); + BaseStream.WriteByte(0x98); + BaseStream.Seek(102391, SeekOrigin.Begin); + BaseStream.WriteByte(0x98); + BaseStream.Seek(106287, SeekOrigin.Begin); + BaseStream.WriteByte(0x14); + BaseStream.Seek(114255, SeekOrigin.Begin); + BaseStream.WriteByte(0x38); + BaseStream.Seek(116755, SeekOrigin.Begin); + BaseStream.WriteByte(0x58); + BaseStream.Seek(116767, SeekOrigin.Begin); + BaseStream.WriteByte(0x70); + BaseStream.Seek(120895, SeekOrigin.Begin); + BaseStream.WriteByte(0x3c); + BaseStream.Seek(128803, SeekOrigin.Begin); + BaseStream.WriteByte(0xc0); + BaseStream.Seek(129483, SeekOrigin.Begin); + BaseStream.WriteByte(0xa8); + BaseStream.Seek(136707, SeekOrigin.Begin); + BaseStream.WriteByte(0xe8); + BaseStream.Seek(137175, SeekOrigin.Begin); + BaseStream.WriteByte(0xe8); + BaseStream.Seek(140083, SeekOrigin.Begin); + BaseStream.WriteByte(0x80); + BaseStream.Seek(140535, SeekOrigin.Begin); + BaseStream.WriteByte(0xa8); + BaseStream.Seek(140847, SeekOrigin.Begin); + BaseStream.WriteByte(0xec); + BaseStream.Seek(140855, SeekOrigin.Begin); + BaseStream.WriteByte(0x30); + BaseStream.Seek(140859, SeekOrigin.Begin); + BaseStream.WriteByte(0xd0); + BaseStream.Seek(144215, SeekOrigin.Begin); + BaseStream.WriteByte(0xd8); + BaseStream.Seek(144734, SeekOrigin.Begin); + BaseStream.WriteByte(0x0e); + BaseStream.Seek(144735, SeekOrigin.Begin); + BaseStream.WriteByte(0x00); + BaseStream.Seek(144951, SeekOrigin.Begin); + BaseStream.WriteByte(0x90); + BaseStream.Seek(145071, SeekOrigin.Begin); + BaseStream.WriteByte(0x94); + BaseStream.Seek(145235, SeekOrigin.Begin); + BaseStream.WriteByte(0x9c); + BaseStream.Seek(145315, SeekOrigin.Begin); + BaseStream.WriteByte(0xa0); + BaseStream.Seek(145395, SeekOrigin.Begin); + BaseStream.WriteByte(0x90); + BaseStream.Seek(145563, SeekOrigin.Begin); + BaseStream.WriteByte(0xc4); + BaseStream.Seek(145687, SeekOrigin.Begin); + BaseStream.WriteByte(0xcc); + BaseStream.Seek(145847, SeekOrigin.Begin); + BaseStream.WriteByte(0x9c); + BaseStream.Seek(145955, SeekOrigin.Begin); + BaseStream.WriteByte(0x74); + BaseStream.Seek(146127, SeekOrigin.Begin); + BaseStream.WriteByte(0xc4); + BaseStream.Seek(146251, SeekOrigin.Begin); + BaseStream.WriteByte(0xcc); + BaseStream.Seek(146375, SeekOrigin.Begin); + BaseStream.WriteByte(0xe0); + BaseStream.Seek(146647, SeekOrigin.Begin); + BaseStream.WriteByte(0xe4); + BaseStream.Seek(146795, SeekOrigin.Begin); + BaseStream.WriteByte(0x18); + BaseStream.Seek(146923, SeekOrigin.Begin); + BaseStream.WriteByte(0xf0); + BaseStream.Seek(147151, SeekOrigin.Begin); + BaseStream.WriteByte(0xf4); + BaseStream.Seek(153443, SeekOrigin.Begin); + BaseStream.WriteByte(0x18); + BaseStream.Seek(153719, SeekOrigin.Begin); + BaseStream.WriteByte(0x38); + BaseStream.Seek(178711, SeekOrigin.Begin); + BaseStream.WriteByte(0x30); + BaseStream.Seek(178715, SeekOrigin.Begin); + BaseStream.WriteByte(0xbc); + BaseStream.Seek(178719, SeekOrigin.Begin); + BaseStream.WriteByte(0xbc); + BaseStream.Seek(178723, SeekOrigin.Begin); + BaseStream.WriteByte(0xbc); + BaseStream.Seek(178727, SeekOrigin.Begin); + BaseStream.WriteByte(0xbc); + BaseStream.Seek(178731, SeekOrigin.Begin); + BaseStream.WriteByte(0xbc); + BaseStream.Seek(178735, SeekOrigin.Begin); + BaseStream.WriteByte(0xbc); + BaseStream.Seek(178739, SeekOrigin.Begin); + BaseStream.WriteByte(0xbc); + BaseStream.Seek(178743, SeekOrigin.Begin); + BaseStream.WriteByte(0xbc); + BaseStream.Seek(178747, SeekOrigin.Begin); + BaseStream.WriteByte(0xbc); + + return BaseStream; + } + + internal static MemoryStream ConvertTo14Chars(MemoryStream BaseStream) + { + BaseStream.Seek(16823, SeekOrigin.Begin); + BaseStream.WriteByte(0xf0); + BaseStream.Seek(16939, SeekOrigin.Begin); + BaseStream.WriteByte(0xf0); + BaseStream.Seek(17067, SeekOrigin.Begin); + BaseStream.WriteByte(0xf0); + BaseStream.Seek(17439, SeekOrigin.Begin); + BaseStream.WriteByte(0xc4); + BaseStream.Seek(17835, SeekOrigin.Begin); + BaseStream.WriteByte(0xc4); + BaseStream.Seek(21203, SeekOrigin.Begin); + BaseStream.WriteByte(0xc4); + BaseStream.Seek(29399, SeekOrigin.Begin); + BaseStream.WriteByte(0x1c); + BaseStream.Seek(33439, SeekOrigin.Begin); + BaseStream.WriteByte(0xc4); + BaseStream.Seek(69695, SeekOrigin.Begin); + BaseStream.WriteByte(0xcc); + BaseStream.Seek(69739, SeekOrigin.Begin); + BaseStream.WriteByte(0x14); + BaseStream.Seek(69767, SeekOrigin.Begin); + BaseStream.WriteByte(0x4c); + BaseStream.Seek(69799, SeekOrigin.Begin); + BaseStream.WriteByte(0x7c); + BaseStream.Seek(69815, SeekOrigin.Begin); + BaseStream.WriteByte(0x90); + BaseStream.Seek(69839, SeekOrigin.Begin); + BaseStream.WriteByte(0xb0); + BaseStream.Seek(69855, SeekOrigin.Begin); + BaseStream.WriteByte(0xb4); + BaseStream.Seek(69871, SeekOrigin.Begin); + BaseStream.WriteByte(0xe8); + BaseStream.Seek(69998, SeekOrigin.Begin); + BaseStream.WriteByte(0x02); + BaseStream.Seek(69999, SeekOrigin.Begin); + BaseStream.WriteByte(0x04); + BaseStream.Seek(70011, SeekOrigin.Begin); + BaseStream.WriteByte(0x1c); + BaseStream.Seek(70047, SeekOrigin.Begin); + BaseStream.WriteByte(0x2c); + BaseStream.Seek(70071, SeekOrigin.Begin); + BaseStream.WriteByte(0x68); + BaseStream.Seek(70279, SeekOrigin.Begin); + BaseStream.WriteByte(0x3c); + BaseStream.Seek(70319, SeekOrigin.Begin); + BaseStream.WriteByte(0xec); + BaseStream.Seek(70351, SeekOrigin.Begin); + BaseStream.WriteByte(0x64); + BaseStream.Seek(70371, SeekOrigin.Begin); + BaseStream.WriteByte(0xd0); + BaseStream.Seek(70795, SeekOrigin.Begin); + BaseStream.WriteByte(0x6c); + BaseStream.Seek(71315, SeekOrigin.Begin); + BaseStream.WriteByte(0xdc); + BaseStream.Seek(71627, SeekOrigin.Begin); + BaseStream.WriteByte(0xd0); + BaseStream.Seek(71655, SeekOrigin.Begin); + BaseStream.WriteByte(0xd4); + BaseStream.Seek(72171, SeekOrigin.Begin); + BaseStream.WriteByte(0xdc); + BaseStream.Seek(91719, SeekOrigin.Begin); + BaseStream.WriteByte(0xe0); + BaseStream.Seek(93627, SeekOrigin.Begin); + BaseStream.WriteByte(0x38); + BaseStream.Seek(94039, SeekOrigin.Begin); + BaseStream.WriteByte(0xe0); + BaseStream.Seek(95527, SeekOrigin.Begin); + BaseStream.WriteByte(0x28); + BaseStream.Seek(95895, SeekOrigin.Begin); + BaseStream.WriteByte(0x38); + BaseStream.Seek(96383, SeekOrigin.Begin); + BaseStream.WriteByte(0x28); + BaseStream.Seek(96667, SeekOrigin.Begin); + BaseStream.WriteByte(0xe0); + BaseStream.Seek(97170, SeekOrigin.Begin); + BaseStream.WriteByte(0x03); + BaseStream.Seek(97171, SeekOrigin.Begin); + BaseStream.WriteByte(0x14); + BaseStream.Seek(98074, SeekOrigin.Begin); + BaseStream.WriteByte(0x03); + BaseStream.Seek(98075, SeekOrigin.Begin); + BaseStream.WriteByte(0x14); + BaseStream.Seek(98711, SeekOrigin.Begin); + BaseStream.WriteByte(0x60); + BaseStream.Seek(99071, SeekOrigin.Begin); + BaseStream.WriteByte(0x34); + BaseStream.Seek(99079, SeekOrigin.Begin); + BaseStream.WriteByte(0x4c); + BaseStream.Seek(99083, SeekOrigin.Begin); + BaseStream.WriteByte(0x20); + BaseStream.Seek(100618, SeekOrigin.Begin); + BaseStream.WriteByte(0x08); + BaseStream.Seek(100619, SeekOrigin.Begin); + BaseStream.WriteByte(0x0c); + BaseStream.Seek(100630, SeekOrigin.Begin); + BaseStream.WriteByte(0x05); + BaseStream.Seek(100631, SeekOrigin.Begin); + BaseStream.WriteByte(0x00); + BaseStream.Seek(100663, SeekOrigin.Begin); + BaseStream.WriteByte(0x20); + BaseStream.Seek(100687, SeekOrigin.Begin); + BaseStream.WriteByte(0x30); + BaseStream.Seek(100723, SeekOrigin.Begin); + BaseStream.WriteByte(0x60); + BaseStream.Seek(100755, SeekOrigin.Begin); + BaseStream.WriteByte(0x90); + BaseStream.Seek(100787, SeekOrigin.Begin); + BaseStream.WriteByte(0xc0); + BaseStream.Seek(100819, SeekOrigin.Begin); + BaseStream.WriteByte(0xf0); + BaseStream.Seek(100851, SeekOrigin.Begin); + BaseStream.WriteByte(0x20); + BaseStream.Seek(100883, SeekOrigin.Begin); + BaseStream.WriteByte(0x50); + BaseStream.Seek(100915, SeekOrigin.Begin); + BaseStream.WriteByte(0x80); + BaseStream.Seek(100947, SeekOrigin.Begin); + BaseStream.WriteByte(0xb0); + BaseStream.Seek(100975, SeekOrigin.Begin); + BaseStream.WriteByte(0xd8); + BaseStream.Seek(101019, SeekOrigin.Begin); + BaseStream.WriteByte(0xf0); + BaseStream.Seek(101042, SeekOrigin.Begin); + BaseStream.WriteByte(0x07); + BaseStream.Seek(101043, SeekOrigin.Begin); + BaseStream.WriteByte(0x00); + BaseStream.Seek(101046, SeekOrigin.Begin); + BaseStream.WriteByte(0x07); + BaseStream.Seek(101047, SeekOrigin.Begin); + BaseStream.WriteByte(0x08); + BaseStream.Seek(101062, SeekOrigin.Begin); + BaseStream.WriteByte(0x07); + BaseStream.Seek(101063, SeekOrigin.Begin); + BaseStream.WriteByte(0x0c); + BaseStream.Seek(101066, SeekOrigin.Begin); + BaseStream.WriteByte(0x07); + BaseStream.Seek(101067, SeekOrigin.Begin); + BaseStream.WriteByte(0x10); + BaseStream.Seek(101287, SeekOrigin.Begin); + BaseStream.WriteByte(0x40); + BaseStream.Seek(101311, SeekOrigin.Begin); + BaseStream.WriteByte(0x58); + BaseStream.Seek(101315, SeekOrigin.Begin); + BaseStream.WriteByte(0x64); + BaseStream.Seek(101506, SeekOrigin.Begin); + BaseStream.WriteByte(0x07); + BaseStream.Seek(101507, SeekOrigin.Begin); + BaseStream.WriteByte(0x14); + BaseStream.Seek(101523, SeekOrigin.Begin); + BaseStream.WriteByte(0x24); + BaseStream.Seek(101615, SeekOrigin.Begin); + BaseStream.WriteByte(0xc4); + BaseStream.Seek(101803, SeekOrigin.Begin); + BaseStream.WriteByte(0xc4); + BaseStream.Seek(102259, SeekOrigin.Begin); + BaseStream.WriteByte(0x48); + BaseStream.Seek(102283, SeekOrigin.Begin); + BaseStream.WriteByte(0xa0); + BaseStream.Seek(102299, SeekOrigin.Begin); + BaseStream.WriteByte(0xa0); + BaseStream.Seek(102311, SeekOrigin.Begin); + BaseStream.WriteByte(0xa0); + BaseStream.Seek(102327, SeekOrigin.Begin); + BaseStream.WriteByte(0xa0); + BaseStream.Seek(102343, SeekOrigin.Begin); + BaseStream.WriteByte(0xa0); + BaseStream.Seek(102359, SeekOrigin.Begin); + BaseStream.WriteByte(0xa0); + BaseStream.Seek(102375, SeekOrigin.Begin); + BaseStream.WriteByte(0xa0); + BaseStream.Seek(102391, SeekOrigin.Begin); + BaseStream.WriteByte(0xa0); + BaseStream.Seek(106287, SeekOrigin.Begin); + BaseStream.WriteByte(0x1c); + BaseStream.Seek(114255, SeekOrigin.Begin); + BaseStream.WriteByte(0x40); + BaseStream.Seek(116755, SeekOrigin.Begin); + BaseStream.WriteByte(0x60); + BaseStream.Seek(116767, SeekOrigin.Begin); + BaseStream.WriteByte(0x78); + BaseStream.Seek(120895, SeekOrigin.Begin); + BaseStream.WriteByte(0x44); + BaseStream.Seek(128803, SeekOrigin.Begin); + BaseStream.WriteByte(0xc8); + BaseStream.Seek(129483, SeekOrigin.Begin); + BaseStream.WriteByte(0xb0); + BaseStream.Seek(136707, SeekOrigin.Begin); + BaseStream.WriteByte(0xf0); + BaseStream.Seek(137175, SeekOrigin.Begin); + BaseStream.WriteByte(0xf0); + BaseStream.Seek(140083, SeekOrigin.Begin); + BaseStream.WriteByte(0x88); + BaseStream.Seek(140535, SeekOrigin.Begin); + BaseStream.WriteByte(0xb0); + BaseStream.Seek(140847, SeekOrigin.Begin); + BaseStream.WriteByte(0xf4); + BaseStream.Seek(140855, SeekOrigin.Begin); + BaseStream.WriteByte(0x38); + BaseStream.Seek(140859, SeekOrigin.Begin); + BaseStream.WriteByte(0xd8); + BaseStream.Seek(144215, SeekOrigin.Begin); + BaseStream.WriteByte(0xe0); + BaseStream.Seek(144734, SeekOrigin.Begin); + BaseStream.WriteByte(0x0e); + BaseStream.Seek(144735, SeekOrigin.Begin); + BaseStream.WriteByte(0x08); + BaseStream.Seek(144951, SeekOrigin.Begin); + BaseStream.WriteByte(0x98); + BaseStream.Seek(145071, SeekOrigin.Begin); + BaseStream.WriteByte(0x9c); + BaseStream.Seek(145235, SeekOrigin.Begin); + BaseStream.WriteByte(0xa4); + BaseStream.Seek(145315, SeekOrigin.Begin); + BaseStream.WriteByte(0xa8); + BaseStream.Seek(145395, SeekOrigin.Begin); + BaseStream.WriteByte(0x98); + BaseStream.Seek(145563, SeekOrigin.Begin); + BaseStream.WriteByte(0xcc); + BaseStream.Seek(145687, SeekOrigin.Begin); + BaseStream.WriteByte(0xd4); + BaseStream.Seek(145847, SeekOrigin.Begin); + BaseStream.WriteByte(0xa4); + BaseStream.Seek(145955, SeekOrigin.Begin); + BaseStream.WriteByte(0x7c); + BaseStream.Seek(146127, SeekOrigin.Begin); + BaseStream.WriteByte(0xcc); + BaseStream.Seek(146251, SeekOrigin.Begin); + BaseStream.WriteByte(0xd4); + BaseStream.Seek(146375, SeekOrigin.Begin); + BaseStream.WriteByte(0xe8); + BaseStream.Seek(146647, SeekOrigin.Begin); + BaseStream.WriteByte(0xec); + BaseStream.Seek(146795, SeekOrigin.Begin); + BaseStream.WriteByte(0x20); + BaseStream.Seek(146923, SeekOrigin.Begin); + BaseStream.WriteByte(0xf8); + BaseStream.Seek(147151, SeekOrigin.Begin); + BaseStream.WriteByte(0xfc); + BaseStream.Seek(153443, SeekOrigin.Begin); + BaseStream.WriteByte(0x20); + BaseStream.Seek(153719, SeekOrigin.Begin); + BaseStream.WriteByte(0x40); + BaseStream.Seek(178711, SeekOrigin.Begin); + BaseStream.WriteByte(0x38); + BaseStream.Seek(178715, SeekOrigin.Begin); + BaseStream.WriteByte(0xc4); + BaseStream.Seek(178719, SeekOrigin.Begin); + BaseStream.WriteByte(0xc4); + BaseStream.Seek(178723, SeekOrigin.Begin); + BaseStream.WriteByte(0xc4); + BaseStream.Seek(178727, SeekOrigin.Begin); + BaseStream.WriteByte(0xc4); + BaseStream.Seek(178731, SeekOrigin.Begin); + BaseStream.WriteByte(0xc4); + BaseStream.Seek(178735, SeekOrigin.Begin); + BaseStream.WriteByte(0xc4); + BaseStream.Seek(178739, SeekOrigin.Begin); + BaseStream.WriteByte(0xc4); + BaseStream.Seek(178743, SeekOrigin.Begin); + BaseStream.WriteByte(0xc4); + BaseStream.Seek(178747, SeekOrigin.Begin); + BaseStream.WriteByte(0xc4); + + return BaseStream; + } + + internal static MemoryStream ConvertTo18Chars(MemoryStream BaseStream) + { + BaseStream.Seek(16823, SeekOrigin.Begin); + BaseStream.WriteByte(0xfc); + BaseStream.Seek(16939, SeekOrigin.Begin); + BaseStream.WriteByte(0xfc); + BaseStream.Seek(17067, SeekOrigin.Begin); + BaseStream.WriteByte(0xfc); + BaseStream.Seek(17439, SeekOrigin.Begin); + BaseStream.WriteByte(0xd0); + BaseStream.Seek(17835, SeekOrigin.Begin); + BaseStream.WriteByte(0xd0); + BaseStream.Seek(21203, SeekOrigin.Begin); + BaseStream.WriteByte(0xd0); + BaseStream.Seek(29399, SeekOrigin.Begin); + BaseStream.WriteByte(0x28); + BaseStream.Seek(33439, SeekOrigin.Begin); + BaseStream.WriteByte(0xd0); + BaseStream.Seek(69695, SeekOrigin.Begin); + BaseStream.WriteByte(0xd0); + BaseStream.Seek(69739, SeekOrigin.Begin); + BaseStream.WriteByte(0x1c); + BaseStream.Seek(69767, SeekOrigin.Begin); + BaseStream.WriteByte(0x58); + BaseStream.Seek(69799, SeekOrigin.Begin); + BaseStream.WriteByte(0x88); + BaseStream.Seek(69815, SeekOrigin.Begin); + BaseStream.WriteByte(0x9c); + BaseStream.Seek(69839, SeekOrigin.Begin); + BaseStream.WriteByte(0xbc); + BaseStream.Seek(69855, SeekOrigin.Begin); + BaseStream.WriteByte(0xc0); + BaseStream.Seek(69871, SeekOrigin.Begin); + BaseStream.WriteByte(0xf4); + BaseStream.Seek(69999, SeekOrigin.Begin); + BaseStream.WriteByte(0x10); + BaseStream.Seek(70011, SeekOrigin.Begin); + BaseStream.WriteByte(0x28); + BaseStream.Seek(70047, SeekOrigin.Begin); + BaseStream.WriteByte(0x38); + BaseStream.Seek(70071, SeekOrigin.Begin); + BaseStream.WriteByte(0x74); + BaseStream.Seek(70279, SeekOrigin.Begin); + BaseStream.WriteByte(0x48); + BaseStream.Seek(70319, SeekOrigin.Begin); + BaseStream.WriteByte(0xf8); + BaseStream.Seek(70351, SeekOrigin.Begin); + BaseStream.WriteByte(0x70); + BaseStream.Seek(70371, SeekOrigin.Begin); + BaseStream.WriteByte(0xd4); + BaseStream.Seek(70795, SeekOrigin.Begin); + BaseStream.WriteByte(0x78); + BaseStream.Seek(71315, SeekOrigin.Begin); + BaseStream.WriteByte(0xe8); + BaseStream.Seek(71627, SeekOrigin.Begin); + BaseStream.WriteByte(0xdc); + BaseStream.Seek(71655, SeekOrigin.Begin); + BaseStream.WriteByte(0xe0); + BaseStream.Seek(72171, SeekOrigin.Begin); + BaseStream.WriteByte(0xe8); + BaseStream.Seek(91719, SeekOrigin.Begin); + BaseStream.WriteByte(0xec); + BaseStream.Seek(93627, SeekOrigin.Begin); + BaseStream.WriteByte(0x44); + BaseStream.Seek(94039, SeekOrigin.Begin); + BaseStream.WriteByte(0xec); + BaseStream.Seek(95527, SeekOrigin.Begin); + BaseStream.WriteByte(0x34); + BaseStream.Seek(95895, SeekOrigin.Begin); + BaseStream.WriteByte(0x44); + BaseStream.Seek(96383, SeekOrigin.Begin); + BaseStream.WriteByte(0x34); + BaseStream.Seek(96667, SeekOrigin.Begin); + BaseStream.WriteByte(0xec); + BaseStream.Seek(97171, SeekOrigin.Begin); + BaseStream.WriteByte(0x20); + BaseStream.Seek(98075, SeekOrigin.Begin); + BaseStream.WriteByte(0x20); + BaseStream.Seek(98711, SeekOrigin.Begin); + BaseStream.WriteByte(0x6c); + BaseStream.Seek(99071, SeekOrigin.Begin); + BaseStream.WriteByte(0x40); + BaseStream.Seek(99079, SeekOrigin.Begin); + BaseStream.WriteByte(0x58); + BaseStream.Seek(99083, SeekOrigin.Begin); + BaseStream.WriteByte(0x2c); + BaseStream.Seek(100619, SeekOrigin.Begin); + BaseStream.WriteByte(0x18); + BaseStream.Seek(100631, SeekOrigin.Begin); + BaseStream.WriteByte(0x0c); + BaseStream.Seek(100663, SeekOrigin.Begin); + BaseStream.WriteByte(0x2c); + BaseStream.Seek(100687, SeekOrigin.Begin); + BaseStream.WriteByte(0x3c); + BaseStream.Seek(100723, SeekOrigin.Begin); + BaseStream.WriteByte(0x6c); + BaseStream.Seek(100755, SeekOrigin.Begin); + BaseStream.WriteByte(0x9c); + BaseStream.Seek(100787, SeekOrigin.Begin); + BaseStream.WriteByte(0xcc); + BaseStream.Seek(100819, SeekOrigin.Begin); + BaseStream.WriteByte(0xfc); + BaseStream.Seek(100851, SeekOrigin.Begin); + BaseStream.WriteByte(0x2c); + BaseStream.Seek(100883, SeekOrigin.Begin); + BaseStream.WriteByte(0x5c); + BaseStream.Seek(100915, SeekOrigin.Begin); + BaseStream.WriteByte(0x8c); + BaseStream.Seek(100947, SeekOrigin.Begin); + BaseStream.WriteByte(0xbc); + BaseStream.Seek(100975, SeekOrigin.Begin); + BaseStream.WriteByte(0xe4); + BaseStream.Seek(101019, SeekOrigin.Begin); + BaseStream.WriteByte(0xfc); + BaseStream.Seek(101043, SeekOrigin.Begin); + BaseStream.WriteByte(0x0c); + BaseStream.Seek(101047, SeekOrigin.Begin); + BaseStream.WriteByte(0x14); + BaseStream.Seek(101063, SeekOrigin.Begin); + BaseStream.WriteByte(0x18); + BaseStream.Seek(101067, SeekOrigin.Begin); + BaseStream.WriteByte(0x1c); + BaseStream.Seek(101287, SeekOrigin.Begin); + BaseStream.WriteByte(0x4c); + BaseStream.Seek(101311, SeekOrigin.Begin); + BaseStream.WriteByte(0x64); + BaseStream.Seek(101315, SeekOrigin.Begin); + BaseStream.WriteByte(0x70); + BaseStream.Seek(101507, SeekOrigin.Begin); + BaseStream.WriteByte(0x20); + BaseStream.Seek(101523, SeekOrigin.Begin); + BaseStream.WriteByte(0x30); + BaseStream.Seek(101615, SeekOrigin.Begin); + BaseStream.WriteByte(0xd0); + BaseStream.Seek(101803, SeekOrigin.Begin); + BaseStream.WriteByte(0xd0); + BaseStream.Seek(102259, SeekOrigin.Begin); + BaseStream.WriteByte(0x54); + BaseStream.Seek(102283, SeekOrigin.Begin); + BaseStream.WriteByte(0xac); + BaseStream.Seek(102299, SeekOrigin.Begin); + BaseStream.WriteByte(0xac); + BaseStream.Seek(102311, SeekOrigin.Begin); + BaseStream.WriteByte(0xac); + BaseStream.Seek(102327, SeekOrigin.Begin); + BaseStream.WriteByte(0xac); + BaseStream.Seek(102343, SeekOrigin.Begin); + BaseStream.WriteByte(0xac); + BaseStream.Seek(102359, SeekOrigin.Begin); + BaseStream.WriteByte(0xac); + BaseStream.Seek(102375, SeekOrigin.Begin); + BaseStream.WriteByte(0xac); + BaseStream.Seek(102391, SeekOrigin.Begin); + BaseStream.WriteByte(0xac); + BaseStream.Seek(106287, SeekOrigin.Begin); + BaseStream.WriteByte(0x28); + BaseStream.Seek(114255, SeekOrigin.Begin); + BaseStream.WriteByte(0x4c); + BaseStream.Seek(116755, SeekOrigin.Begin); + BaseStream.WriteByte(0x6c); + BaseStream.Seek(116767, SeekOrigin.Begin); + BaseStream.WriteByte(0x84); + BaseStream.Seek(120895, SeekOrigin.Begin); + BaseStream.WriteByte(0x50); + BaseStream.Seek(128803, SeekOrigin.Begin); + BaseStream.WriteByte(0xd4); + BaseStream.Seek(129483, SeekOrigin.Begin); + BaseStream.WriteByte(0xbc); + BaseStream.Seek(136707, SeekOrigin.Begin); + BaseStream.WriteByte(0xfc); + BaseStream.Seek(137175, SeekOrigin.Begin); + BaseStream.WriteByte(0xfc); + BaseStream.Seek(140083, SeekOrigin.Begin); + BaseStream.WriteByte(0x94); + BaseStream.Seek(140535, SeekOrigin.Begin); + BaseStream.WriteByte(0xbc); + BaseStream.Seek(140846, SeekOrigin.Begin); + BaseStream.WriteByte(0x0c); + BaseStream.Seek(140847, SeekOrigin.Begin); + BaseStream.WriteByte(0x00); + BaseStream.Seek(140855, SeekOrigin.Begin); + BaseStream.WriteByte(0x44); + BaseStream.Seek(140859, SeekOrigin.Begin); + BaseStream.WriteByte(0xe4); + BaseStream.Seek(144215, SeekOrigin.Begin); + BaseStream.WriteByte(0xec); + BaseStream.Seek(144735, SeekOrigin.Begin); + BaseStream.WriteByte(0x14); + BaseStream.Seek(144951, SeekOrigin.Begin); + BaseStream.WriteByte(0xa4); + BaseStream.Seek(145071, SeekOrigin.Begin); + BaseStream.WriteByte(0xa8); + BaseStream.Seek(145235, SeekOrigin.Begin); + BaseStream.WriteByte(0xb0); + BaseStream.Seek(145315, SeekOrigin.Begin); + BaseStream.WriteByte(0xb4); + BaseStream.Seek(145395, SeekOrigin.Begin); + BaseStream.WriteByte(0xa4); + BaseStream.Seek(145563, SeekOrigin.Begin); + BaseStream.WriteByte(0xd8); + BaseStream.Seek(145687, SeekOrigin.Begin); + BaseStream.WriteByte(0xe0); + BaseStream.Seek(145847, SeekOrigin.Begin); + BaseStream.WriteByte(0xb0); + BaseStream.Seek(145955, SeekOrigin.Begin); + BaseStream.WriteByte(0x88); + BaseStream.Seek(146127, SeekOrigin.Begin); + BaseStream.WriteByte(0xd8); + BaseStream.Seek(146251, SeekOrigin.Begin); + BaseStream.WriteByte(0xe0); + BaseStream.Seek(146375, SeekOrigin.Begin); + BaseStream.WriteByte(0xf4); + BaseStream.Seek(146647, SeekOrigin.Begin); + BaseStream.WriteByte(0xf8); + BaseStream.Seek(146795, SeekOrigin.Begin); + BaseStream.WriteByte(0x2c); + BaseStream.Seek(146922, SeekOrigin.Begin); + BaseStream.WriteByte(0x0f); + BaseStream.Seek(146923, SeekOrigin.Begin); + BaseStream.WriteByte(0x04); + BaseStream.Seek(147151, SeekOrigin.Begin); + BaseStream.WriteByte(0x08); + BaseStream.Seek(153443, SeekOrigin.Begin); + BaseStream.WriteByte(0x2c); + BaseStream.Seek(153719, SeekOrigin.Begin); + BaseStream.WriteByte(0x4c); + BaseStream.Seek(178711, SeekOrigin.Begin); + BaseStream.WriteByte(0x44); + BaseStream.Seek(178715, SeekOrigin.Begin); + BaseStream.WriteByte(0xd0); + BaseStream.Seek(178719, SeekOrigin.Begin); + BaseStream.WriteByte(0xd0); + BaseStream.Seek(178723, SeekOrigin.Begin); + BaseStream.WriteByte(0xd0); + BaseStream.Seek(178727, SeekOrigin.Begin); + BaseStream.WriteByte(0xd0); + BaseStream.Seek(178731, SeekOrigin.Begin); + BaseStream.WriteByte(0xd0); + BaseStream.Seek(178735, SeekOrigin.Begin); + BaseStream.WriteByte(0xd0); + BaseStream.Seek(178739, SeekOrigin.Begin); + BaseStream.WriteByte(0xd0); + BaseStream.Seek(178743, SeekOrigin.Begin); + BaseStream.WriteByte(0xd0); + BaseStream.Seek(178747, SeekOrigin.Begin); + BaseStream.WriteByte(0xd0); + + return BaseStream; + } + } +} diff --git a/ForwardMii-Plugin/ForwardMii_GX.cs b/ForwardMii-Plugin/ForwardMii_GX.cs new file mode 100644 index 0000000..fb53d35 --- /dev/null +++ b/ForwardMii-Plugin/ForwardMii_GX.cs @@ -0,0 +1,303 @@ +/* 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 . + */ + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Drawing; +using System.IO; +using System.Reflection; + +namespace ForwardMii +{ + public class GXForwarder + { + private readonly string TempDir = Path.GetTempPath() + "ForwardMii_Temp\\" + Guid.NewGuid() + "\\"; + private string thisAppFolder; + private bool elfFirst = false; + private bool usbFirst = false; + private string image43; + private string image169; + public string AppFolder { get { return thisAppFolder; } set { thisAppFolder = value; } } + public bool ElfFirst { get { return elfFirst; } set { elfFirst = value; } } + public bool UsbFirst { get { return usbFirst; } set { usbFirst = value; } } + public string Image43 { get { return image43; } set { image43 = value; } } + public string Image169 { get { return image169; } set { image169 = value; } } + + public GXForwarder() + { + + } + + public GXForwarder(string AppFolder) + { + if (ForwardMii_Plugin.CheckDevKit() == false) throw new Exception("DevkitPro or one of it's components wasn't found!"); + thisAppFolder = AppFolder; + } + + public GXForwarder(string AppFolder, bool UsbFirst) + { + if (ForwardMii_Plugin.CheckDevKit() == false) throw new Exception("DevkitPro or one of it's components wasn't found!"); + thisAppFolder = AppFolder; + usbFirst = UsbFirst; + } + + public GXForwarder(string AppFolder, string Image43, string Image169) + { + if (ForwardMii_Plugin.CheckDevKit() == false) throw new Exception("DevkitPro or one of it's components wasn't found!"); + thisAppFolder = AppFolder; + image43 = Image43; + image169 = Image169; + } + + public GXForwarder(string AppFolder, bool UsbFirst, bool ElfFirst) + { + if (ForwardMii_Plugin.CheckDevKit() == false) throw new Exception("DevkitPro or one of it's components wasn't found!"); + thisAppFolder = AppFolder; + usbFirst = UsbFirst; + elfFirst = ElfFirst; + } + + public GXForwarder(string AppFolder, bool UsbFirst, bool ElfFirst, string Image43, string Image169) + { + if (ForwardMii_Plugin.CheckDevKit() == false) throw new Exception("DevkitPro or one of it's components wasn't found!"); + thisAppFolder = AppFolder; + image43 = Image43; + image169 = Image169; + usbFirst = UsbFirst; + elfFirst = ElfFirst; + } + + public void Clear() + { + thisAppFolder = string.Empty; + elfFirst = false; + usbFirst = false; + image43 = string.Empty; + image169 = string.Empty; + } + + public void Save(string Destionation) + { + Save(Destionation, false); + } + + public void Save(string Destination, bool Overwrite) + { + byte[] theForwarder = ToByteArray(); + + if (Path.HasExtension(Destination) == false) Destination += ".dol"; + + if (File.Exists(Destination)) + { + if (Overwrite == true) + File.Delete(Destination); + else + throw new Exception("The destination file already exists!"); + } + + using (FileStream fs = new FileStream(Destination, FileMode.Create)) + { + fs.Write(theForwarder, 0, theForwarder.Length); + } + } + + public byte[] ToByteArray() + { + MemoryStream ms = this.ToMemoryStream(); + return ms.ToArray(); + } + + public MemoryStream ToMemoryStream() + { + try + { + if (Directory.Exists(TempDir)) Directory.Delete(TempDir, true); + CopyResources(); + EditMainCpp(); + CopyImages(); + if (Compile() == false) throw new Exception("An error occured during compiling!"); + byte[] fileTemp = File.ReadAllBytes(TempDir + "boot.dol"); + + try { Directory.Delete(TempDir, true); } + catch { } + + return new MemoryStream(fileTemp); + } + catch (Exception ex) + { + if (Directory.Exists(TempDir)) Directory.Delete(TempDir, true); + throw new Exception(ex.Message); + } + } + + private bool Compile() + { + try + { + ProcessStartInfo makeI = new ProcessStartInfo("make", "-C " + TempDir); + makeI.UseShellExecute = false; + makeI.CreateNoWindow = true; + + Process make = Process.Start(makeI); + make.WaitForExit(); + make.Close(); + + if (File.Exists(TempDir + "boot.dol") && File.Exists(TempDir + "boot.elf")) + { + return true; + } + else return false; + } + catch { return false; } + } + + private void CopyImages() + { + if (!string.IsNullOrEmpty(image43) && File.Exists(image43)) + { + try + { + Image img = Image.FromFile(image43); + if (img.Width != 640 || img.Height != 480) + img = ResizeImage(img, 640, 480); + img.Save(TempDir + "\\source\\images\\background.png", System.Drawing.Imaging.ImageFormat.Png); + } + catch + { + Bitmap img = new Bitmap(640, 480); + img.Save(TempDir + "\\source\\images\\background.png", System.Drawing.Imaging.ImageFormat.Png); + } + } + else + { + Bitmap img = new Bitmap(640, 480); + img.Save(TempDir + "\\source\\images\\background.png", System.Drawing.Imaging.ImageFormat.Png); + } + + if (!string.IsNullOrEmpty(image169) && File.Exists(image169)) + { + try + { + Image img = Image.FromFile(image169); + if (img.Width != 640 || img.Height != 480) + img = ResizeImage(img, 640, 480); + img.Save(TempDir + "\\source\\images\\background169.png", System.Drawing.Imaging.ImageFormat.Png); + } + catch + { + Bitmap img = new Bitmap(640, 480); + img.Save(TempDir + "\\source\\images\\background169.png", System.Drawing.Imaging.ImageFormat.Png); + } + } + else + { + Bitmap img = new Bitmap(640, 480); + img.Save(TempDir + "\\source\\images\\background169.png", System.Drawing.Imaging.ImageFormat.Png); + } + } + + private Image ResizeImage(Image img, int x, int y) + { + Image newimage = new Bitmap(x, y); + using (Graphics gfx = Graphics.FromImage(newimage)) + { + gfx.DrawImage(img, 0, 0, x, y); + } + return newimage; + } + + private void EditMainCpp() + { + Stream maincpp = GetReourceStream("main.cpp"); + StreamReader reader = new StreamReader(maincpp); + List tempLines = new List(); + string tempLine; + + while ((tempLine = reader.ReadLine()) != null) + { + tempLines.Add(tempLine); + } + + string[] lines = tempLines.ToArray(); + + for (int i = 0; i < lines.Length; i++) + { + if (lines[i].Contains("appfolder")) + lines[i] = lines[i].Replace("appfolder", thisAppFolder); + else if (lines[i].Contains("#define USB_FIRST")) + lines[i] = lines[i].Replace("false", usbFirst.ToString().ToLower()); + else if (lines[i].Contains("#define ELF_FIRST")) + lines[i] = lines[i].Replace("false", elfFirst.ToString().ToLower()); + } + + using (FileStream fs = new FileStream(TempDir + "source\\main.cpp", FileMode.Create)) + { + using (StreamWriter writer = new StreamWriter(fs)) + { + foreach (string thisLine in lines) + { + writer.WriteLine(thisLine); + } + } + } + } + + private void CopyResources() + { + if (Directory.Exists(TempDir)) Directory.Delete(TempDir, true); + Directory.CreateDirectory(TempDir + "source\\images"); + string[] Resources = new string[] { "dolloader.c", "dolloader.h", "elf_abi.h", "elfloader.c", + "elfloader.h", "fatmounter.c", "fatmounter.h", "filelist.h", "video.cpp", "video.h" }; + + foreach (string thisResource in Resources) + { + Stream tempStream = GetReourceStream(thisResource); + StreamToFile(tempStream, TempDir + "source\\" + thisResource); + } + + Stream makefile = GetReourceStream("Makefile"); + StreamToFile(makefile, TempDir + "Makefile"); + } + + private void StreamToFile(Stream theStream, string Destination) + { + using (FileStream fs = new FileStream(Destination, FileMode.Create)) + { + byte[] temp = new byte[theStream.Length]; + theStream.Read(temp, 0, temp.Length); + fs.Write(temp, 0, temp.Length); + + //int count = 0; + //int length = 4096; + //byte[] buffer = new byte[length]; + + //while ((count = theStream.Read(buffer, 0, length)) != 0) + // fs.Write(buffer, 0, length); + } + + } + + private MemoryStream GetReourceStream(string theResource) + { + Stream thisStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("ForwardMii_Plugin.Resources.GX." + theResource); + byte[] thisArray = new byte[thisStream.Length]; + thisStream.Read(thisArray, 0, thisArray.Length); + return new MemoryStream(thisArray); + } + } +} diff --git a/ForwardMii-Plugin/ForwardMii_SDSDHC.cs b/ForwardMii-Plugin/ForwardMii_SDSDHC.cs new file mode 100644 index 0000000..475e6de --- /dev/null +++ b/ForwardMii-Plugin/ForwardMii_SDSDHC.cs @@ -0,0 +1,439 @@ +/* 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 . + */ + +using System; +using System.IO; +using System.Reflection; + +namespace ForwardMii +{ + public class SDSDHC_Forwarder + { + private string thisAppFolder; + private bool toElf = false; + public string AppFolder { get { return thisAppFolder; } set { thisAppFolder = value; } } + public bool ForwardToElf { get { return toElf; } set { toElf = value; } } + + public SDSDHC_Forwarder() + { + + } + + public SDSDHC_Forwarder(string AppFolder) + { + if (AppFolder.Length > 18 || AppFolder.Length < 3) throw new Exception("Application folder must be 3 - 18 chars!"); + thisAppFolder = AppFolder; + } + + public SDSDHC_Forwarder(string AppFolder, bool ForwardToElf) + { + if (AppFolder.Length > 18 || AppFolder.Length < 3) throw new Exception("Application folder must be 3 - 18 chars!"); + thisAppFolder = AppFolder; + toElf = ForwardToElf; + } + + public void Clear() + { + thisAppFolder = string.Empty; + toElf = false; + } + + public void Save(string Destionation) + { + Save(Destionation, false); + } + + public void Save(string Destination, bool Overwrite) + { + byte[] theForwarder = ToByteArray(); + + if (Path.HasExtension(Destination) == false) Destination += ".dol"; + + if (File.Exists(Destination)) + { + if (Overwrite == true) + File.Delete(Destination); + else + throw new Exception("The destination file already exists!"); + } + + using (FileStream fs = new FileStream(Destination, FileMode.Create)) + { + fs.Write(theForwarder, 0, theForwarder.Length); + } + } + + public byte[] ToByteArray() + { + MemoryStream ms = this.ToMemoryStream(); + return ms.ToArray(); + } + + public MemoryStream ToMemoryStream() + { + MemoryStream BaseStream = GetBase(); + MemoryStream TailStream = GetTail(); + + BaseStream = ConvertBase(BaseStream); + TailStream = EditTailFolder(TailStream); + + byte[] BaseArray = BaseStream.ToArray(); + byte[] TailArray = TailStream.ToArray(); + + MemoryStream Result = new MemoryStream(); + Result.Seek(0, SeekOrigin.End); + Result.Write(BaseArray, 0, BaseArray.Length); + Result.Write(TailArray, 0, TailArray.Length); + + return Result; + } + + private MemoryStream EditTailFolder(MemoryStream TailStream) + { + char[] FolderChars = thisAppFolder.ToCharArray(); + int[] Offsets = GetOffsets(FolderChars.Length); + + TailStream.Seek(1, SeekOrigin.Begin); + foreach (char thisChar in FolderChars) + TailStream.WriteByte((byte)thisChar); + + TailStream.Seek(Offsets[0], SeekOrigin.Begin); + foreach (char thisChar in FolderChars) + TailStream.WriteByte((byte)thisChar); + + TailStream.Seek(Offsets[1], SeekOrigin.Begin); + foreach (char thisChar in FolderChars) + TailStream.WriteByte((byte)thisChar); + + if (toElf == true) + TailStream = EditTailToElf(TailStream); + + return TailStream; + } + + private MemoryStream EditTailToElf(MemoryStream TailStream) + { + int[] Offsets = GetDolOffsets(thisAppFolder.Length); + byte[] Elf = new byte[] { 0x65, 0x6c, 0x66 }; + + foreach (int thisOffset in Offsets) + { + TailStream.Seek(thisOffset, SeekOrigin.Begin); + TailStream.Write(Elf, 0, Elf.Length); + } + + return TailStream; + } + + private int[] GetDolOffsets(int CharCount) + { + int[] Offsets = new int[5]; + + switch (CharCount) + { + case 3: + Offsets[0] = 10; + Offsets[1] = 25; + Offsets[2] = 87; + Offsets[3] = 336; + Offsets[4] = 344; + break; + case 4: + Offsets[0] = 11; + Offsets[1] = 25; + Offsets[2] = 87; + Offsets[3] = 336; + Offsets[4] = 344; + break; + case 5: + Offsets[0] = 12; + Offsets[1] = 25; + Offsets[2] = 91; + Offsets[3] = 340; + Offsets[4] = 348; + break; + case 6: + Offsets[0] = 13; + Offsets[1] = 29; + Offsets[2] = 95; + Offsets[3] = 348; + Offsets[4] = 356; + break; + case 7: + Offsets[0] = 14; + Offsets[1] = 29; + Offsets[2] = 95; + Offsets[3] = 348; + Offsets[4] = 356; + break; + case 8: + Offsets[0] = 15; + Offsets[1] = 29; + Offsets[2] = 95; + Offsets[3] = 348; + Offsets[4] = 356; + break; + case 9: + Offsets[0] = 16; + Offsets[1] = 29; + Offsets[2] = 99; + Offsets[3] = 352; + Offsets[4] = 360; + break; + case 10: + Offsets[0] = 17; + Offsets[1] = 33; + Offsets[2] = 103; + Offsets[3] = 360; + Offsets[4] = 368; + break; + case 11: + Offsets[0] = 18; + Offsets[1] = 33; + Offsets[2] = 103; + Offsets[3] = 360; + Offsets[4] = 368; + break; + case 12: + Offsets[0] = 19; + Offsets[1] = 33; + Offsets[2] = 103; + Offsets[3] = 360; + Offsets[4] = 368; + break; + case 13: + Offsets[0] = 20; + Offsets[1] = 33; + Offsets[2] = 107; + Offsets[3] = 364; + Offsets[4] = 372; + break; + case 14: + Offsets[0] = 21; + Offsets[1] = 37; + Offsets[2] = 111; + Offsets[3] = 372; + Offsets[4] = 380; + break; + case 15: + Offsets[0] = 22; + Offsets[1] = 37; + Offsets[2] = 11; + Offsets[3] = 372; + Offsets[4] = 380; + break; + case 16: + Offsets[0] = 23; + Offsets[1] = 37; + Offsets[2] = 111; + Offsets[3] = 372; + Offsets[4] = 380; + break; + case 17: + Offsets[0] = 24; + Offsets[1] = 37; + Offsets[2] = 115; + Offsets[3] = 376; + Offsets[4] = 384; + break; + case 18: + Offsets[0] = 25; + Offsets[1] = 41; + Offsets[2] = 119; + Offsets[3] = 384; + Offsets[4] = 392; + break; + default: + throw new Exception(); + } + + return Offsets; + } + + private int[] GetOffsets(int CharCount) + { + int First = 0; + int Second = 0; + + switch (CharCount) + { + case 3: + case 4: + First = 57; + Second = 100; + break; + case 5: + First = 57; + Second = 104; + break; + case 6: + case 7: + case 8: + First = 61; + Second = 108; + break; + case 9: + First = 61; + Second = 112; + break; + case 10: + case 11: + case 12: + case 13: + First = 65; + Second = 120; + break; + case 14: + case 15: + case 16: + First = 69; + Second = 124; + break; + case 17: + First = 69; + Second = 128; + break; + case 18: + First = 73; + Second = 132; + break; + default: + throw new Exception(); + } + + return new int[] { First, Second }; + } + + private MemoryStream GetBase() + { + switch (thisAppFolder.Length) + { + case 3: + case 4: + case 5: + return GetReourceStream("ForwardMii_Plugin.Resources.SDSDHC.3CharsBase.bin"); + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + return GetReourceStream("ForwardMii_Plugin.Resources.SDSDHC.6CharsBase.bin"); + case 17: + case 18: + return GetReourceStream("ForwardMii_Plugin.Resources.SDSDHC.17CharsBase.bin"); + default: + throw new Exception(); + } + } + + private MemoryStream GetTail() + { + switch (thisAppFolder.Length) + { + case 3: + return GetReourceStream("ForwardMii_Plugin.Resources.SDSDHC.3CharsTail.bin"); + case 4: + return GetReourceStream("ForwardMii_Plugin.Resources.SDSDHC.4CharsTail.bin"); + case 5: + return GetReourceStream("ForwardMii_Plugin.Resources.SDSDHC.5CharsTail.bin"); + case 6: + return GetReourceStream("ForwardMii_Plugin.Resources.SDSDHC.6CharsTail.bin"); + case 7: + return GetReourceStream("ForwardMii_Plugin.Resources.SDSDHC.7CharsTail.bin"); + case 8: + return GetReourceStream("ForwardMii_Plugin.Resources.SDSDHC.8CharsTail.bin"); + case 9: + return GetReourceStream("ForwardMii_Plugin.Resources.SDSDHC.9CharsTail.bin"); + case 10: + return GetReourceStream("ForwardMii_Plugin.Resources.SDSDHC.10CharsTail.bin"); + case 11: + return GetReourceStream("ForwardMii_Plugin.Resources.SDSDHC.11CharsTail.bin"); + case 12: + return GetReourceStream("ForwardMii_Plugin.Resources.SDSDHC.12CharsTail.bin"); + case 13: + return GetReourceStream("ForwardMii_Plugin.Resources.SDSDHC.13CharsTail.bin"); + case 14: + return GetReourceStream("ForwardMii_Plugin.Resources.SDSDHC.14CharsTail.bin"); + case 15: + return GetReourceStream("ForwardMii_Plugin.Resources.SDSDHC.15CharsTail.bin"); + case 16: + return GetReourceStream("ForwardMii_Plugin.Resources.SDSDHC.16CharsTail.bin"); + case 17: + return GetReourceStream("ForwardMii_Plugin.Resources.SDSDHC.17CharsTail.bin"); + case 18: + return GetReourceStream("ForwardMii_Plugin.Resources.SDSDHC.18CharsTail.bin"); + default: + throw new Exception(); + } + } + + private MemoryStream ConvertBase(MemoryStream BaseStream) + { + switch (thisAppFolder.Length) + { + case 3: + return BaseStream; + case 4: + return BaseStream; + case 5: + return SDSDHC_ConvertBaseStream.ConvertTo5Chars(BaseStream); + case 6: + return BaseStream; + case 7: + return BaseStream; + case 8: + return BaseStream; + case 9: + return SDSDHC_ConvertBaseStream.ConvertTo9Chars(BaseStream); + case 10: + return SDSDHC_ConvertBaseStream.ConvertTo10Chars(BaseStream); + case 11: + return SDSDHC_ConvertBaseStream.ConvertTo10Chars(BaseStream); + case 12: + return SDSDHC_ConvertBaseStream.ConvertTo10Chars(BaseStream); + case 13: + return SDSDHC_ConvertBaseStream.ConvertTo13Chars(BaseStream); + case 14: + return SDSDHC_ConvertBaseStream.ConvertTo14Chars(BaseStream); + case 15: + return SDSDHC_ConvertBaseStream.ConvertTo14Chars(BaseStream); + case 16: + return SDSDHC_ConvertBaseStream.ConvertTo14Chars(BaseStream); + case 17: + return BaseStream; + case 18: + return SDSDHC_ConvertBaseStream.ConvertTo18Chars(BaseStream); + default: + throw new Exception(); + } + } + + private MemoryStream GetReourceStream(string theResource) + { + Stream thisStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(theResource); + byte[] thisArray = new byte[thisStream.Length]; + thisStream.Read(thisArray, 0, thisArray.Length); + return new MemoryStream(thisArray); + } + } +} diff --git a/ForwardMii-Plugin/License.txt b/ForwardMii-Plugin/License.txt new file mode 100644 index 0000000..94a9ed0 --- /dev/null +++ b/ForwardMii-Plugin/License.txt @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program 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. + + This program 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 . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/ForwardMii-Plugin/Properties/AssemblyInfo.cs b/ForwardMii-Plugin/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..0d19aae --- /dev/null +++ b/ForwardMii-Plugin/Properties/AssemblyInfo.cs @@ -0,0 +1,53 @@ +/* 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 . + */ + +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Allgemeine Informationen über eine Assembly werden über die folgenden +// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, +// die mit einer Assembly verknüpft sind. +[assembly: AssemblyTitle("ForwardMii-Plugin")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("ForwardMii-Plugin")] +[assembly: AssemblyCopyright("Copyright © Microsoft 2009")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar +// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von +// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest. +[assembly: ComVisible(false)] + +// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird +[assembly: Guid("4a706a44-9612-4717-8da0-0ca789a9c632")] + +// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: +// +// Hauptversion +// Nebenversion +// Buildnummer +// Revision +// +// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern +// übernehmen, indem Sie "*" eingeben: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/ForwardMii-Plugin/Readme_ForwardMii.txt b/ForwardMii-Plugin/Readme_ForwardMii.txt new file mode 100644 index 0000000..e4a3715 --- /dev/null +++ b/ForwardMii-Plugin/Readme_ForwardMii.txt @@ -0,0 +1,58 @@ +This is a plugin for CustomizeMii to create forwarders. Put it in CustomizeMii's directory. + +It can create simple SD / SDHC forwarders that will point to one ELF or DOL file. +It's also able to create complex forwarders based on the official USB Loader GX +forwarder (Needs devkitPPC + libOGC installed). It will look for the DOL or ELF +in the specified folder on USB and SD, you can change the order it searches. +It can also display an image while loading. +If it fails to compile, you may have the wrong libOGC, try the one downloadable on +the CustomizeMii project page. + +----------------------------------------------------------------------------------------- +Changelog: + +Version 1.0 + - Initial Release +----------------------------------------------------------------------------------------- + +----------------------------------------------------------------------------------------- +Disclaimer: + +Editing WAD files can result in a brick of your Wii. +Only use this application if you have a bricksafe Wii, meaning either Preloader or +BootMii/boot2 is installed, and if you know what you're doing. + +This application comes without any express or implied warranty. +The author can't be held responsible for any damages arising from the use of it. +----------------------------------------------------------------------------------------- + +----------------------------------------------------------------------------------------- +Thanks: + +Xuzz for his idea and hard work +Xuzz, SquidMan, megazig, Matt_P, Omega and The Lemon Man for Wii.py +SquidMan for Zetsubou +Andre Perrot for gbalzss +comex and Waninkoko for both their NAND Loader +djdynamite123 for the forwarder base files +The USB Loader GX Team for their forwarder source +----------------------------------------------------------------------------------------- + +----------------------------------------------------------------------------------------- +License: + +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 . +----------------------------------------------------------------------------------------- \ No newline at end of file diff --git a/ForwardMii-Plugin/Resources/GX/Makefile b/ForwardMii-Plugin/Resources/GX/Makefile new file mode 100644 index 0000000..795229b --- /dev/null +++ b/ForwardMii-Plugin/Resources/GX/Makefile @@ -0,0 +1,146 @@ +#--------------------------------------------------------------------------------- +# Clear the implicit built in rules +#--------------------------------------------------------------------------------- +.SUFFIXES: +#--------------------------------------------------------------------------------- +ifeq ($(strip $(DEVKITPPC)),) +$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") +endif + +include $(DEVKITPPC)/wii_rules + +#--------------------------------------------------------------------------------- +# TARGET is the name of the output +# BUILD is the directory where object files & intermediate files will be placed +# SOURCES is a list of directories containing source code +# INCLUDES is a list of directories containing extra header files +#--------------------------------------------------------------------------------- +TARGET := boot +BUILD := build +SOURCES := source source/images +DATA := data +INCLUDES := + +#--------------------------------------------------------------------------------- +# options for code generation +#--------------------------------------------------------------------------------- + +CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) +CXXFLAGS = $(CFLAGS) + +#--------------------------------------------------------------------------------- +# move loader to another location - THANKS CREDIAR - 0x81330000 for HBC +#--------------------------------------------------------------------------------- +LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map -Wl,--section-start,.init=0x81230000 +#LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map +#LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map -Wl,--section-start,.init=0x80003f00 + +#--------------------------------------------------------------------------------- +# any extra libraries we wish to link with the project +#--------------------------------------------------------------------------------- +LIBS := -lfat -lpngu -lpng -lz -lbte -logc -lm + +#--------------------------------------------------------------------------------- +# list of directories containing libraries, this must be the top level containing +# include and lib +#--------------------------------------------------------------------------------- +LIBDIRS := $(CURDIR) + +#--------------------------------------------------------------------------------- +# no real need to edit anything past this point unless you need to add additional +# rules for different file extensions +#--------------------------------------------------------------------------------- +ifneq ($(BUILD),$(notdir $(CURDIR))) +#--------------------------------------------------------------------------------- + +export OUTPUT := $(CURDIR)/$(TARGET) + +export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ + $(foreach dir,$(DATA),$(CURDIR)/$(dir)) + +export DEPSDIR := $(CURDIR)/$(BUILD) + +#--------------------------------------------------------------------------------- +# automatically build a list of object files for our project +#--------------------------------------------------------------------------------- +CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) +CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) +sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) +SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S))) +BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) +PNGFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.png))) + +#--------------------------------------------------------------------------------- +# use CXX for linking C++ projects, CC for standard C +#--------------------------------------------------------------------------------- +ifeq ($(strip $(CPPFILES)),) + export LD := $(CC) +else + export LD := $(CXX) +endif + +export OFILES := $(addsuffix .o,$(BINFILES)) \ + $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \ + $(sFILES:.s=.o) $(SFILES:.S=.o) \ + $(PNGFILES:.png=.png.o) + +#--------------------------------------------------------------------------------- +# build a list of include paths +#--------------------------------------------------------------------------------- +export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \ + $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ + -I$(CURDIR)/$(BUILD) \ + -I$(LIBOGC_INC) + +#--------------------------------------------------------------------------------- +# build a list of library paths +#--------------------------------------------------------------------------------- +export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \ + -L$(LIBOGC_LIB) + +export OUTPUT := $(CURDIR)/$(TARGET) +.PHONY: $(BUILD) clean + +#--------------------------------------------------------------------------------- +$(BUILD): + @[ -d $@ ] || mkdir -p $@ + @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile + +#--------------------------------------------------------------------------------- +clean: + @echo clean ... + @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol + +#--------------------------------------------------------------------------------- +run: + wiiload $(TARGET).dol + + +#--------------------------------------------------------------------------------- +pack: + zip -9 loadMii.zip $(TARGET).dol ../icon.png ../meta.xml ../README + + +#--------------------------------------------------------------------------------- +else + +DEPENDS := $(OFILES:.o=.d) + +#--------------------------------------------------------------------------------- +# main targets +#--------------------------------------------------------------------------------- +$(OUTPUT).dol: $(OUTPUT).elf +$(OUTPUT).elf: $(OFILES) + +#--------------------------------------------------------------------------------- +# This rule links in binary data with the .jpg extension +#--------------------------------------------------------------------------------- +%.png.o : %.png + @echo $(notdir $<) + $(bin2o) + +-include $(DEPENDS) + +#--------------------------------------------------------------------------------- +endif +#--------------------------------------------------------------------------------- diff --git a/ForwardMii-Plugin/Resources/GX/dolloader.c b/ForwardMii-Plugin/Resources/GX/dolloader.c new file mode 100644 index 0000000..7a6629d --- /dev/null +++ b/ForwardMii-Plugin/Resources/GX/dolloader.c @@ -0,0 +1,54 @@ +#include +#include +#include +#include +#include +#include +#include + +#include "dolloader.h" + +typedef struct _dolheader { + u32 text_pos[7]; + u32 data_pos[11]; + u32 text_start[7]; + u32 data_start[11]; + u32 text_size[7]; + u32 data_size[11]; + u32 bss_start; + u32 bss_size; + u32 entry_point; +} dolheader; + +u32 load_dol_image (void *dolstart, struct __argv *argv) { + u32 i; + dolheader *dolfile; + + if (dolstart) { + dolfile = (dolheader *) dolstart; + for (i = 0; i < 7; i++) { + if ((!dolfile->text_size[i]) || (dolfile->text_start[i] < 0x100)) continue; + VIDEO_WaitVSync(); + ICInvalidateRange ((void *) dolfile->text_start[i],dolfile->text_size[i]); + memmove ((void *) dolfile->text_start[i],dolstart+dolfile->text_pos[i],dolfile->text_size[i]); + } + + for(i = 0; i < 11; i++) { + if ((!dolfile->data_size[i]) || (dolfile->data_start[i] < 0x100)) continue; + VIDEO_WaitVSync(); + memmove ((void *) dolfile->data_start[i],dolstart+dolfile->data_pos[i],dolfile->data_size[i]); + DCFlushRangeNoSync ((void *) dolfile->data_start[i],dolfile->data_size[i]); + } + + memset ((void *) dolfile->bss_start, 0, dolfile->bss_size); + DCFlushRange((void *) dolfile->bss_start, dolfile->bss_size); + + if (argv && argv->argvMagic == ARGV_MAGIC) { + void *new_argv = (void *)(dolfile->entry_point + 8); + memmove(new_argv, argv, sizeof(*argv)); + DCFlushRange(new_argv, sizeof(*argv)); + } + return dolfile->entry_point; + } + return 0; +} diff --git a/ForwardMii-Plugin/Resources/GX/dolloader.h b/ForwardMii-Plugin/Resources/GX/dolloader.h new file mode 100644 index 0000000..7dcc292 --- /dev/null +++ b/ForwardMii-Plugin/Resources/GX/dolloader.h @@ -0,0 +1,23 @@ +#ifndef _DOLLOADER_H_ +#define _DOLLOADER_H_ + +#ifdef __cplusplus +extern "C" +{ +#endif + +// Apps goes here +#define EXECUTABLE_MEM_ADDR 0x92000000 +/* dol header */ + +extern void __exception_closeall(); +typedef void (*entrypoint) (void); + +u32 load_dol_image (void *dolstart, struct __argv *argv); + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/ForwardMii-Plugin/Resources/GX/elf_abi.h b/ForwardMii-Plugin/Resources/GX/elf_abi.h new file mode 100644 index 0000000..c9e705e --- /dev/null +++ b/ForwardMii-Plugin/Resources/GX/elf_abi.h @@ -0,0 +1,594 @@ +/* + * Copyright (c) 1995, 1996, 2001, 2002 + * Erik Theisen. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This is the ELF ABI header file + * formerly known as "elf_abi.h". + */ + +#ifndef _ELF_ABI_H +#define _ELF_ABI_H + +#include + +/* + * This version doesn't work for 64-bit ABIs - Erik. + */ + +/* + * These typedefs need to be handled better. + */ +typedef u32 Elf32_Addr; /* Unsigned program address */ +typedef u32 Elf32_Off; /* Unsigned file offset */ +typedef s32 Elf32_Sword; /* Signed large integer */ +typedef u32 Elf32_Word; /* Unsigned large integer */ +typedef u16 Elf32_Half; /* Unsigned medium integer */ + +/* e_ident[] identification indexes */ +#define EI_MAG0 0 /* file ID */ +#define EI_MAG1 1 /* file ID */ +#define EI_MAG2 2 /* file ID */ +#define EI_MAG3 3 /* file ID */ +#define EI_CLASS 4 /* file class */ +#define EI_DATA 5 /* data encoding */ +#define EI_VERSION 6 /* ELF header version */ +#define EI_OSABI 7 /* OS/ABI specific ELF extensions */ +#define EI_ABIVERSION 8 /* ABI target version */ +#define EI_PAD 9 /* start of pad bytes */ +#define EI_NIDENT 16 /* Size of e_ident[] */ + +/* e_ident[] magic number */ +#define ELFMAG0 0x7f /* e_ident[EI_MAG0] */ +#define ELFMAG1 'E' /* e_ident[EI_MAG1] */ +#define ELFMAG2 'L' /* e_ident[EI_MAG2] */ +#define ELFMAG3 'F' /* e_ident[EI_MAG3] */ +#define ELFMAG "\177ELF" /* magic */ +#define SELFMAG 4 /* size of magic */ + +/* e_ident[] file class */ +#define ELFCLASSNONE 0 /* invalid */ +#define ELFCLASS32 1 /* 32-bit objs */ +#define ELFCLASS64 2 /* 64-bit objs */ +#define ELFCLASSNUM 3 /* number of classes */ + +/* e_ident[] data encoding */ +#define ELFDATANONE 0 /* invalid */ +#define ELFDATA2LSB 1 /* Little-Endian */ +#define ELFDATA2MSB 2 /* Big-Endian */ +#define ELFDATANUM 3 /* number of data encode defines */ + +/* e_ident[] OS/ABI specific ELF extensions */ +#define ELFOSABI_NONE 0 /* No extension specified */ +#define ELFOSABI_HPUX 1 /* Hewlett-Packard HP-UX */ +#define ELFOSABI_NETBSD 2 /* NetBSD */ +#define ELFOSABI_LINUX 3 /* Linux */ +#define ELFOSABI_SOLARIS 6 /* Sun Solaris */ +#define ELFOSABI_AIX 7 /* AIX */ +#define ELFOSABI_IRIX 8 /* IRIX */ +#define ELFOSABI_FREEBSD 9 /* FreeBSD */ +#define ELFOSABI_TRU64 10 /* Compaq TRU64 UNIX */ +#define ELFOSABI_MODESTO 11 /* Novell Modesto */ +#define ELFOSABI_OPENBSD 12 /* OpenBSD */ +/* 64-255 Architecture-specific value range */ + +/* e_ident[] ABI Version */ +#define ELFABIVERSION 0 + +/* e_ident */ +#define IS_ELF(ehdr) ((ehdr).e_ident[EI_MAG0] == ELFMAG0 && \ + (ehdr).e_ident[EI_MAG1] == ELFMAG1 && \ + (ehdr).e_ident[EI_MAG2] == ELFMAG2 && \ + (ehdr).e_ident[EI_MAG3] == ELFMAG3) + +/* ELF Header */ +typedef struct elfhdr{ + unsigned char e_ident[EI_NIDENT]; /* ELF Identification */ + Elf32_Half e_type; /* object file type */ + Elf32_Half e_machine; /* machine */ + Elf32_Word e_version; /* object file version */ + Elf32_Addr e_entry; /* virtual entry point */ + Elf32_Off e_phoff; /* program header table offset */ + Elf32_Off e_shoff; /* section header table offset */ + Elf32_Word e_flags; /* processor-specific flags */ + Elf32_Half e_ehsize; /* ELF header size */ + Elf32_Half e_phentsize; /* program header entry size */ + Elf32_Half e_phnum; /* number of program header entries */ + Elf32_Half e_shentsize; /* section header entry size */ + Elf32_Half e_shnum; /* number of section header entries */ + Elf32_Half e_shstrndx; /* section header table's "section + header string table" entry offset */ +} Elf32_Ehdr; + +/* e_type */ +#define ET_NONE 0 /* No file type */ +#define ET_REL 1 /* relocatable file */ +#define ET_EXEC 2 /* executable file */ +#define ET_DYN 3 /* shared object file */ +#define ET_CORE 4 /* core file */ +#define ET_NUM 5 /* number of types */ +#define ET_LOOS 0xfe00 /* reserved range for operating */ +#define ET_HIOS 0xfeff /* system specific e_type */ +#define ET_LOPROC 0xff00 /* reserved range for processor */ +#define ET_HIPROC 0xffff /* specific e_type */ + +/* e_machine */ +#define EM_NONE 0 /* No Machine */ +#define EM_M32 1 /* AT&T WE 32100 */ +#define EM_SPARC 2 /* SPARC */ +#define EM_386 3 /* Intel 80386 */ +#define EM_68K 4 /* Motorola 68000 */ +#define EM_88K 5 /* Motorola 88000 */ +#if 0 +#define EM_486 6 /* RESERVED - was Intel 80486 */ +#endif +#define EM_860 7 /* Intel 80860 */ +#define EM_MIPS 8 /* MIPS R3000 Big-Endian only */ +#define EM_S370 9 /* IBM System/370 Processor */ +#define EM_MIPS_RS4_BE 10 /* MIPS R4000 Big-Endian */ +#if 0 +#define EM_SPARC64 11 /* RESERVED - was SPARC v9 + 64-bit unoffical */ +#endif +/* RESERVED 11-14 for future use */ +#define EM_PARISC 15 /* HPPA */ +/* RESERVED 16 for future use */ +#define EM_VPP500 17 /* Fujitsu VPP500 */ +#define EM_SPARC32PLUS 18 /* Enhanced instruction set SPARC */ +#define EM_960 19 /* Intel 80960 */ +#define EM_PPC 20 /* PowerPC */ +#define EM_PPC64 21 /* 64-bit PowerPC */ +#define EM_S390 22 /* IBM System/390 Processor */ +/* RESERVED 23-35 for future use */ +#define EM_V800 36 /* NEC V800 */ +#define EM_FR20 37 /* Fujitsu FR20 */ +#define EM_RH32 38 /* TRW RH-32 */ +#define EM_RCE 39 /* Motorola RCE */ +#define EM_ARM 40 /* Advanced Risc Machines ARM */ +#define EM_ALPHA 41 /* Digital Alpha */ +#define EM_SH 42 /* Hitachi SH */ +#define EM_SPARCV9 43 /* SPARC Version 9 */ +#define EM_TRICORE 44 /* Siemens TriCore embedded processor */ +#define EM_ARC 45 /* Argonaut RISC Core */ +#define EM_H8_300 46 /* Hitachi H8/300 */ +#define EM_H8_300H 47 /* Hitachi H8/300H */ +#define EM_H8S 48 /* Hitachi H8S */ +#define EM_H8_500 49 /* Hitachi H8/500 */ +#define EM_IA_64 50 /* Intel Merced */ +#define EM_MIPS_X 51 /* Stanford MIPS-X */ +#define EM_COLDFIRE 52 /* Motorola Coldfire */ +#define EM_68HC12 53 /* Motorola M68HC12 */ +#define EM_MMA 54 /* Fujitsu MMA Multimedia Accelerator*/ +#define EM_PCP 55 /* Siemens PCP */ +#define EM_NCPU 56 /* Sony nCPU embeeded RISC */ +#define EM_NDR1 57 /* Denso NDR1 microprocessor */ +#define EM_STARCORE 58 /* Motorola Start*Core processor */ +#define EM_ME16 59 /* Toyota ME16 processor */ +#define EM_ST100 60 /* STMicroelectronic ST100 processor */ +#define EM_TINYJ 61 /* Advanced Logic Corp. Tinyj emb.fam*/ +#define EM_X86_64 62 /* AMD x86-64 */ +#define EM_PDSP 63 /* Sony DSP Processor */ +/* RESERVED 64,65 for future use */ +#define EM_FX66 66 /* Siemens FX66 microcontroller */ +#define EM_ST9PLUS 67 /* STMicroelectronics ST9+ 8/16 mc */ +#define EM_ST7 68 /* STmicroelectronics ST7 8 bit mc */ +#define EM_68HC16 69 /* Motorola MC68HC16 microcontroller */ +#define EM_68HC11 70 /* Motorola MC68HC11 microcontroller */ +#define EM_68HC08 71 /* Motorola MC68HC08 microcontroller */ +#define EM_68HC05 72 /* Motorola MC68HC05 microcontroller */ +#define EM_SVX 73 /* Silicon Graphics SVx */ +#define EM_ST19 74 /* STMicroelectronics ST19 8 bit mc */ +#define EM_VAX 75 /* Digital VAX */ +#define EM_CHRIS 76 /* Axis Communications embedded proc. */ +#define EM_JAVELIN 77 /* Infineon Technologies emb. proc. */ +#define EM_FIREPATH 78 /* Element 14 64-bit DSP Processor */ +#define EM_ZSP 79 /* LSI Logic 16-bit DSP Processor */ +#define EM_MMIX 80 /* Donald Knuth's edu 64-bit proc. */ +#define EM_HUANY 81 /* Harvard University mach-indep objs */ +#define EM_PRISM 82 /* SiTera Prism */ +#define EM_AVR 83 /* Atmel AVR 8-bit microcontroller */ +#define EM_FR30 84 /* Fujitsu FR30 */ +#define EM_D10V 85 /* Mitsubishi DV10V */ +#define EM_D30V 86 /* Mitsubishi DV30V */ +#define EM_V850 87 /* NEC v850 */ +#define EM_M32R 88 /* Mitsubishi M32R */ +#define EM_MN10300 89 /* Matsushita MN10200 */ +#define EM_MN10200 90 /* Matsushita MN10200 */ +#define EM_PJ 91 /* picoJava */ +#define EM_NUM 92 /* number of machine types */ + +/* Version */ +#define EV_NONE 0 /* Invalid */ +#define EV_CURRENT 1 /* Current */ +#define EV_NUM 2 /* number of versions */ + +/* Section Header */ +typedef struct { + Elf32_Word sh_name; /* name - index into section header + string table section */ + Elf32_Word sh_type; /* type */ + Elf32_Word sh_flags; /* flags */ + Elf32_Addr sh_addr; /* address */ + Elf32_Off sh_offset; /* file offset */ + Elf32_Word sh_size; /* section size */ + Elf32_Word sh_link; /* section header table index link */ + Elf32_Word sh_info; /* extra information */ + Elf32_Word sh_addralign; /* address alignment */ + Elf32_Word sh_entsize; /* section entry size */ +} Elf32_Shdr; + +/* Special Section Indexes */ +#define SHN_UNDEF 0 /* undefined */ +#define SHN_LORESERVE 0xff00 /* lower bounds of reserved indexes */ +#define SHN_LOPROC 0xff00 /* reserved range for processor */ +#define SHN_HIPROC 0xff1f /* specific section indexes */ +#define SHN_LOOS 0xff20 /* reserved range for operating */ +#define SHN_HIOS 0xff3f /* specific semantics */ +#define SHN_ABS 0xfff1 /* absolute value */ +#define SHN_COMMON 0xfff2 /* common symbol */ +#define SHN_XINDEX 0xffff /* Index is an extra table */ +#define SHN_HIRESERVE 0xffff /* upper bounds of reserved indexes */ + +/* sh_type */ +#define SHT_NULL 0 /* inactive */ +#define SHT_PROGBITS 1 /* program defined information */ +#define SHT_SYMTAB 2 /* symbol table section */ +#define SHT_STRTAB 3 /* string table section */ +#define SHT_RELA 4 /* relocation section with addends*/ +#define SHT_HASH 5 /* symbol hash table section */ +#define SHT_DYNAMIC 6 /* dynamic section */ +#define SHT_NOTE 7 /* note section */ +#define SHT_NOBITS 8 /* no space section */ +#define SHT_REL 9 /* relation section without addends */ +#define SHT_SHLIB 10 /* reserved - purpose unknown */ +#define SHT_DYNSYM 11 /* dynamic symbol table section */ +#define SHT_INIT_ARRAY 14 /* Array of constructors */ +#define SHT_FINI_ARRAY 15 /* Array of destructors */ +#define SHT_PREINIT_ARRAY 16 /* Array of pre-constructors */ +#define SHT_GROUP 17 /* Section group */ +#define SHT_SYMTAB_SHNDX 18 /* Extended section indeces */ +#define SHT_NUM 19 /* number of section types */ +#define SHT_LOOS 0x60000000 /* Start OS-specific */ +#define SHT_HIOS 0x6fffffff /* End OS-specific */ +#define SHT_LOPROC 0x70000000 /* reserved range for processor */ +#define SHT_HIPROC 0x7fffffff /* specific section header types */ +#define SHT_LOUSER 0x80000000 /* reserved range for application */ +#define SHT_HIUSER 0xffffffff /* specific indexes */ + +/* Section names */ +#define ELF_BSS ".bss" /* uninitialized data */ +#define ELF_COMMENT ".comment" /* version control information */ +#define ELF_DATA ".data" /* initialized data */ +#define ELF_DATA1 ".data1" /* initialized data */ +#define ELF_DEBUG ".debug" /* debug */ +#define ELF_DYNAMIC ".dynamic" /* dynamic linking information */ +#define ELF_DYNSTR ".dynstr" /* dynamic string table */ +#define ELF_DYNSYM ".dynsym" /* dynamic symbol table */ +#define ELF_FINI ".fini" /* termination code */ +#define ELF_FINI_ARRAY ".fini_array" /* Array of destructors */ +#define ELF_GOT ".got" /* global offset table */ +#define ELF_HASH ".hash" /* symbol hash table */ +#define ELF_INIT ".init" /* initialization code */ +#define ELF_INIT_ARRAY ".init_array" /* Array of constuctors */ +#define ELF_INTERP ".interp" /* Pathname of program interpreter */ +#define ELF_LINE ".line" /* Symbolic line numnber information */ +#define ELF_NOTE ".note" /* Contains note section */ +#define ELF_PLT ".plt" /* Procedure linkage table */ +#define ELF_PREINIT_ARRAY ".preinit_array" /* Array of pre-constructors */ +#define ELF_REL_DATA ".rel.data" /* relocation data */ +#define ELF_REL_FINI ".rel.fini" /* relocation termination code */ +#define ELF_REL_INIT ".rel.init" /* relocation initialization code */ +#define ELF_REL_DYN ".rel.dyn" /* relocaltion dynamic link info */ +#define ELF_REL_RODATA ".rel.rodata" /* relocation read-only data */ +#define ELF_REL_TEXT ".rel.text" /* relocation code */ +#define ELF_RODATA ".rodata" /* read-only data */ +#define ELF_RODATA1 ".rodata1" /* read-only data */ +#define ELF_SHSTRTAB ".shstrtab" /* section header string table */ +#define ELF_STRTAB ".strtab" /* string table */ +#define ELF_SYMTAB ".symtab" /* symbol table */ +#define ELF_SYMTAB_SHNDX ".symtab_shndx"/* symbol table section index */ +#define ELF_TBSS ".tbss" /* thread local uninit data */ +#define ELF_TDATA ".tdata" /* thread local init data */ +#define ELF_TDATA1 ".tdata1" /* thread local init data */ +#define ELF_TEXT ".text" /* code */ + +/* Section Attribute Flags - sh_flags */ +#define SHF_WRITE 0x1 /* Writable */ +#define SHF_ALLOC 0x2 /* occupies memory */ +#define SHF_EXECINSTR 0x4 /* executable */ +#define SHF_MERGE 0x10 /* Might be merged */ +#define SHF_STRINGS 0x20 /* Contains NULL terminated strings */ +#define SHF_INFO_LINK 0x40 /* sh_info contains SHT index */ +#define SHF_LINK_ORDER 0x80 /* Preserve order after combining*/ +#define SHF_OS_NONCONFORMING 0x100 /* Non-standard OS specific handling */ +#define SHF_GROUP 0x200 /* Member of section group */ +#define SHF_TLS 0x400 /* Thread local storage */ +#define SHF_MASKOS 0x0ff00000 /* OS specific */ +#define SHF_MASKPROC 0xf0000000 /* reserved bits for processor */ + /* specific section attributes */ + +/* Section Group Flags */ +#define GRP_COMDAT 0x1 /* COMDAT group */ +#define GRP_MASKOS 0x0ff00000 /* Mask OS specific flags */ +#define GRP_MASKPROC 0xf0000000 /* Mask processor specific flags */ + +/* Symbol Table Entry */ +typedef struct elf32_sym { + Elf32_Word st_name; /* name - index into string table */ + Elf32_Addr st_value; /* symbol value */ + Elf32_Word st_size; /* symbol size */ + unsigned char st_info; /* type and binding */ + unsigned char st_other; /* 0 - no defined meaning */ + Elf32_Half st_shndx; /* section header index */ +} Elf32_Sym; + +/* Symbol table index */ +#define STN_UNDEF 0 /* undefined */ + +/* Extract symbol info - st_info */ +#define ELF32_ST_BIND(x) ((x) >> 4) +#define ELF32_ST_TYPE(x) (((unsigned int) x) & 0xf) +#define ELF32_ST_INFO(b,t) (((b) << 4) + ((t) & 0xf)) +#define ELF32_ST_VISIBILITY(x) ((x) & 0x3) + +/* Symbol Binding - ELF32_ST_BIND - st_info */ +#define STB_LOCAL 0 /* Local symbol */ +#define STB_GLOBAL 1 /* Global symbol */ +#define STB_WEAK 2 /* like global - lower precedence */ +#define STB_NUM 3 /* number of symbol bindings */ +#define STB_LOOS 10 /* reserved range for operating */ +#define STB_HIOS 12 /* system specific symbol bindings */ +#define STB_LOPROC 13 /* reserved range for processor */ +#define STB_HIPROC 15 /* specific symbol bindings */ + +/* Symbol type - ELF32_ST_TYPE - st_info */ +#define STT_NOTYPE 0 /* not specified */ +#define STT_OBJECT 1 /* data object */ +#define STT_FUNC 2 /* function */ +#define STT_SECTION 3 /* section */ +#define STT_FILE 4 /* file */ +#define STT_NUM 5 /* number of symbol types */ +#define STT_TLS 6 /* Thread local storage symbol */ +#define STT_LOOS 10 /* reserved range for operating */ +#define STT_HIOS 12 /* system specific symbol types */ +#define STT_LOPROC 13 /* reserved range for processor */ +#define STT_HIPROC 15 /* specific symbol types */ + +/* Symbol visibility - ELF32_ST_VISIBILITY - st_other */ +#define STV_DEFAULT 0 /* Normal visibility rules */ +#define STV_INTERNAL 1 /* Processor specific hidden class */ +#define STV_HIDDEN 2 /* Symbol unavailable in other mods */ +#define STV_PROTECTED 3 /* Not preemptible, not exported */ + + +/* Relocation entry with implicit addend */ +typedef struct +{ + Elf32_Addr r_offset; /* offset of relocation */ + Elf32_Word r_info; /* symbol table index and type */ +} Elf32_Rel; + +/* Relocation entry with explicit addend */ +typedef struct +{ + Elf32_Addr r_offset; /* offset of relocation */ + Elf32_Word r_info; /* symbol table index and type */ + Elf32_Sword r_addend; +} Elf32_Rela; + +/* Extract relocation info - r_info */ +#define ELF32_R_SYM(i) ((i) >> 8) +#define ELF32_R_TYPE(i) ((unsigned char) (i)) +#define ELF32_R_INFO(s,t) (((s) << 8) + (unsigned char)(t)) + +/* Program Header */ +typedef struct { + Elf32_Word p_type; /* segment type */ + Elf32_Off p_offset; /* segment offset */ + Elf32_Addr p_vaddr; /* virtual address of segment */ + Elf32_Addr p_paddr; /* physical address - ignored? */ + Elf32_Word p_filesz; /* number of bytes in file for seg. */ + Elf32_Word p_memsz; /* number of bytes in mem. for seg. */ + Elf32_Word p_flags; /* flags */ + Elf32_Word p_align; /* memory alignment */ +} Elf32_Phdr; + +/* Segment types - p_type */ +#define PT_NULL 0 /* unused */ +#define PT_LOAD 1 /* loadable segment */ +#define PT_DYNAMIC 2 /* dynamic linking section */ +#define PT_INTERP 3 /* the RTLD */ +#define PT_NOTE 4 /* auxiliary information */ +#define PT_SHLIB 5 /* reserved - purpose undefined */ +#define PT_PHDR 6 /* program header */ +#define PT_TLS 7 /* Thread local storage template */ +#define PT_NUM 8 /* Number of segment types */ +#define PT_LOOS 0x60000000 /* reserved range for operating */ +#define PT_HIOS 0x6fffffff /* system specific segment types */ +#define PT_LOPROC 0x70000000 /* reserved range for processor */ +#define PT_HIPROC 0x7fffffff /* specific segment types */ + +/* Segment flags - p_flags */ +#define PF_X 0x1 /* Executable */ +#define PF_W 0x2 /* Writable */ +#define PF_R 0x4 /* Readable */ +#define PF_MASKOS 0x0ff00000 /* OS specific segment flags */ +#define PF_MASKPROC 0xf0000000 /* reserved bits for processor */ + /* specific segment flags */ +/* Dynamic structure */ +typedef struct +{ + Elf32_Sword d_tag; /* controls meaning of d_val */ + union + { + Elf32_Word d_val; /* Multiple meanings - see d_tag */ + Elf32_Addr d_ptr; /* program virtual address */ + } d_un; +} Elf32_Dyn; + +extern Elf32_Dyn _DYNAMIC[]; + +/* Dynamic Array Tags - d_tag */ +#define DT_NULL 0 /* marks end of _DYNAMIC array */ +#define DT_NEEDED 1 /* string table offset of needed lib */ +#define DT_PLTRELSZ 2 /* size of relocation entries in PLT */ +#define DT_PLTGOT 3 /* address PLT/GOT */ +#define DT_HASH 4 /* address of symbol hash table */ +#define DT_STRTAB 5 /* address of string table */ +#define DT_SYMTAB 6 /* address of symbol table */ +#define DT_RELA 7 /* address of relocation table */ +#define DT_RELASZ 8 /* size of relocation table */ +#define DT_RELAENT 9 /* size of relocation entry */ +#define DT_STRSZ 10 /* size of string table */ +#define DT_SYMENT 11 /* size of symbol table entry */ +#define DT_INIT 12 /* address of initialization func. */ +#define DT_FINI 13 /* address of termination function */ +#define DT_SONAME 14 /* string table offset of shared obj */ +#define DT_RPATH 15 /* string table offset of library + search path */ +#define DT_SYMBOLIC 16 /* start sym search in shared obj. */ +#define DT_REL 17 /* address of rel. tbl. w addends */ +#define DT_RELSZ 18 /* size of DT_REL relocation table */ +#define DT_RELENT 19 /* size of DT_REL relocation entry */ +#define DT_PLTREL 20 /* PLT referenced relocation entry */ +#define DT_DEBUG 21 /* bugger */ +#define DT_TEXTREL 22 /* Allow rel. mod. to unwritable seg */ +#define DT_JMPREL 23 /* add. of PLT's relocation entries */ +#define DT_BIND_NOW 24 /* Process relocations of object */ +#define DT_INIT_ARRAY 25 /* Array with addresses of init fct */ +#define DT_FINI_ARRAY 26 /* Array with addresses of fini fct */ +#define DT_INIT_ARRAYSZ 27 /* Size in bytes of DT_INIT_ARRAY */ +#define DT_FINI_ARRAYSZ 28 /* Size in bytes of DT_FINI_ARRAY */ +#define DT_RUNPATH 29 /* Library search path */ +#define DT_FLAGS 30 /* Flags for the object being loaded */ +#define DT_ENCODING 32 /* Start of encoded range */ +#define DT_PREINIT_ARRAY 32 /* Array with addresses of preinit fct*/ +#define DT_PREINIT_ARRAYSZ 33 /* size in bytes of DT_PREINIT_ARRAY */ +#define DT_NUM 34 /* Number used. */ +#define DT_LOOS 0x60000000 /* reserved range for OS */ +#define DT_HIOS 0x6fffffff /* specific dynamic array tags */ +#define DT_LOPROC 0x70000000 /* reserved range for processor */ +#define DT_HIPROC 0x7fffffff /* specific dynamic array tags */ + +/* Dynamic Tag Flags - d_un.d_val */ +#define DF_ORIGIN 0x01 /* Object may use DF_ORIGIN */ +#define DF_SYMBOLIC 0x02 /* Symbol resolutions starts here */ +#define DF_TEXTREL 0x04 /* Object contains text relocations */ +#define DF_BIND_NOW 0x08 /* No lazy binding for this object */ +#define DF_STATIC_TLS 0x10 /* Static thread local storage */ + +/* Standard ELF hashing function */ +unsigned long elf_hash(const unsigned char *name); + +#define ELF_TARG_VER 1 /* The ver for which this code is intended */ + +/* + * XXX - PowerPC defines really don't belong in here, + * but we'll put them in for simplicity. + */ + +/* Values for Elf32/64_Ehdr.e_flags. */ +#define EF_PPC_EMB 0x80000000 /* PowerPC embedded flag */ + +/* Cygnus local bits below */ +#define EF_PPC_RELOCATABLE 0x00010000 /* PowerPC -mrelocatable flag*/ +#define EF_PPC_RELOCATABLE_LIB 0x00008000 /* PowerPC -mrelocatable-lib + flag */ + +/* PowerPC relocations defined by the ABIs */ +#define R_PPC_NONE 0 +#define R_PPC_ADDR32 1 /* 32bit absolute address */ +#define R_PPC_ADDR24 2 /* 26bit address, 2 bits ignored. */ +#define R_PPC_ADDR16 3 /* 16bit absolute address */ +#define R_PPC_ADDR16_LO 4 /* lower 16bit of absolute address */ +#define R_PPC_ADDR16_HI 5 /* high 16bit of absolute address */ +#define R_PPC_ADDR16_HA 6 /* adjusted high 16bit */ +#define R_PPC_ADDR14 7 /* 16bit address, 2 bits ignored */ +#define R_PPC_ADDR14_BRTAKEN 8 +#define R_PPC_ADDR14_BRNTAKEN 9 +#define R_PPC_REL24 10 /* PC relative 26 bit */ +#define R_PPC_REL14 11 /* PC relative 16 bit */ +#define R_PPC_REL14_BRTAKEN 12 +#define R_PPC_REL14_BRNTAKEN 13 +#define R_PPC_GOT16 14 +#define R_PPC_GOT16_LO 15 +#define R_PPC_GOT16_HI 16 +#define R_PPC_GOT16_HA 17 +#define R_PPC_PLTREL24 18 +#define R_PPC_COPY 19 +#define R_PPC_GLOB_DAT 20 +#define R_PPC_JMP_SLOT 21 +#define R_PPC_RELATIVE 22 +#define R_PPC_LOCAL24PC 23 +#define R_PPC_UADDR32 24 +#define R_PPC_UADDR16 25 +#define R_PPC_REL32 26 +#define R_PPC_PLT32 27 +#define R_PPC_PLTREL32 28 +#define R_PPC_PLT16_LO 29 +#define R_PPC_PLT16_HI 30 +#define R_PPC_PLT16_HA 31 +#define R_PPC_SDAREL16 32 +#define R_PPC_SECTOFF 33 +#define R_PPC_SECTOFF_LO 34 +#define R_PPC_SECTOFF_HI 35 +#define R_PPC_SECTOFF_HA 36 +/* Keep this the last entry. */ +#define R_PPC_NUM 37 + +/* The remaining relocs are from the Embedded ELF ABI, and are not + in the SVR4 ELF ABI. */ +#define R_PPC_EMB_NADDR32 101 +#define R_PPC_EMB_NADDR16 102 +#define R_PPC_EMB_NADDR16_LO 103 +#define R_PPC_EMB_NADDR16_HI 104 +#define R_PPC_EMB_NADDR16_HA 105 +#define R_PPC_EMB_SDAI16 106 +#define R_PPC_EMB_SDA2I16 107 +#define R_PPC_EMB_SDA2REL 108 +#define R_PPC_EMB_SDA21 109 /* 16 bit offset in SDA */ +#define R_PPC_EMB_MRKREF 110 +#define R_PPC_EMB_RELSEC16 111 +#define R_PPC_EMB_RELST_LO 112 +#define R_PPC_EMB_RELST_HI 113 +#define R_PPC_EMB_RELST_HA 114 +#define R_PPC_EMB_BIT_FLD 115 +#define R_PPC_EMB_RELSDA 116 /* 16 bit relative offset in SDA */ + +/* Diab tool relocations. */ +#define R_PPC_DIAB_SDA21_LO 180 /* like EMB_SDA21, but lower 16 bit */ +#define R_PPC_DIAB_SDA21_HI 181 /* like EMB_SDA21, but high 16 bit */ +#define R_PPC_DIAB_SDA21_HA 182 /* like EMB_SDA21, adjusted high 16 */ +#define R_PPC_DIAB_RELSDA_LO 183 /* like EMB_RELSDA, but lower 16 bit */ +#define R_PPC_DIAB_RELSDA_HI 184 /* like EMB_RELSDA, but high 16 bit */ +#define R_PPC_DIAB_RELSDA_HA 185 /* like EMB_RELSDA, adjusted high 16 */ + +/* This is a phony reloc to handle any old fashioned TOC16 references + that may still be in object files. */ +#define R_PPC_TOC16 255 + +#endif /* _ELF_H */ + diff --git a/ForwardMii-Plugin/Resources/GX/elfloader.c b/ForwardMii-Plugin/Resources/GX/elfloader.c new file mode 100644 index 0000000..651a1ee --- /dev/null +++ b/ForwardMii-Plugin/Resources/GX/elfloader.c @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2001 William L. Pitts + * Modifications (c) 2004 Felix Domke + * All rights reserved. + * + * Redistribution and use in source and binary forms are freely + * permitted provided that the above copyright notice and this + * paragraph and the following disclaimer are duplicated in all + * such forms. + * + * This software is provided "AS IS" and without any express or + * implied warranties, including, without limitation, the implied + * warranties of merchantability and fitness for a particular + * purpose. + */ + +#include +#include + +#include + +#include "elf_abi.h" + +/* ====================================================================== + * Determine if a valid ELF image exists at the given memory location. + * First looks at the ELF header magic field, the makes sure that it is + * executable and makes sure that it is for a PowerPC. + * ====================================================================== */ +s32 valid_elf_image (void *addr) +{ + Elf32_Ehdr *ehdr; /* Elf header structure pointer */ + + ehdr = (Elf32_Ehdr *) addr; + + if (!IS_ELF (*ehdr)) + return 0; + + if (ehdr->e_type != ET_EXEC) + return -1; + + if (ehdr->e_machine != EM_PPC) + return -1; + + return 1; +} + + +/* ====================================================================== + * A very simple elf loader, assumes the image is valid, returns the + * entry point address. + * ====================================================================== */ +u32 load_elf_image (void *addr) +{ + Elf32_Ehdr *ehdr; + Elf32_Shdr *shdr; + u8 *strtab = 0; + u8 *image; + int i; + + ehdr = (Elf32_Ehdr *) addr; + /* Find the section header string table for output info */ + shdr = (Elf32_Shdr *) (addr + ehdr->e_shoff + + (ehdr->e_shstrndx * sizeof (Elf32_Shdr))); + + if (shdr->sh_type == SHT_STRTAB) + strtab = (u8 *) (addr + shdr->sh_offset); + + /* Load each appropriate section */ + for (i = 0; i < ehdr->e_shnum; ++i) { + shdr = (Elf32_Shdr *) (addr + ehdr->e_shoff + + (i * sizeof (Elf32_Shdr))); + + if (!(shdr->sh_flags & SHF_ALLOC) + || shdr->sh_addr == 0 || shdr->sh_size == 0) { + continue; + } + + shdr->sh_addr &= 0x3FFFFFFF; + shdr->sh_addr |= 0x80000000; + + if (strtab) { + /*printf ("%sing section %s @ 0x%08x (0x%08x bytes)\n", + (shdr->sh_type == SHT_NOBITS) ? + "clear" : "load", + &strtab[shdr->sh_name], + (u32) shdr->sh_addr, + (u32) shdr->sh_size);*/ + } + + if (shdr->sh_type == SHT_NOBITS) { + memset ((void *) shdr->sh_addr, 0, shdr->sh_size); + } else { + image = (u8 *) addr + shdr->sh_offset; + memcpy ((void *) shdr->sh_addr, + (const void *) image, + shdr->sh_size); + } + DCFlushRangeNoSync ((void *) shdr->sh_addr, shdr->sh_size); + } + + return (ehdr->e_entry & 0x3FFFFFFF) | 0x80000000; +} + diff --git a/ForwardMii-Plugin/Resources/GX/elfloader.h b/ForwardMii-Plugin/Resources/GX/elfloader.h new file mode 100644 index 0000000..d378fe4 --- /dev/null +++ b/ForwardMii-Plugin/Resources/GX/elfloader.h @@ -0,0 +1,18 @@ +#ifndef _ELFLOADER_H_ +#define _ELFLOADER_H_ + +#include + +#ifdef __cplusplus +extern "C" +{ +#endif + +s32 valid_elf_image (void *addr); +u32 load_elf_image (void *addr); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/ForwardMii-Plugin/Resources/GX/fatmounter.c b/ForwardMii-Plugin/Resources/GX/fatmounter.c new file mode 100644 index 0000000..0009cef --- /dev/null +++ b/ForwardMii-Plugin/Resources/GX/fatmounter.c @@ -0,0 +1,184 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//these are the only stable and speed is good +#define CACHE 8 +#define SECTORS 64 + +enum BPB { + BPB_jmpBoot = 0x00, + BPB_OEMName = 0x03, + // BIOS Parameter Block + BPB_bytesPerSector = 0x0B, + BPB_sectorsPerCluster = 0x0D, + BPB_reservedSectors = 0x0E, + BPB_numFATs = 0x10, + BPB_rootEntries = 0x11, + BPB_numSectorsSmall = 0x13, + BPB_mediaDesc = 0x15, + BPB_sectorsPerFAT = 0x16, + BPB_sectorsPerTrk = 0x18, + BPB_numHeads = 0x1A, + BPB_numHiddenSectors = 0x1C, + BPB_numSectors = 0x20, + // Ext BIOS Parameter Block for FAT16 + BPB_FAT16_driveNumber = 0x24, + BPB_FAT16_reserved1 = 0x25, + BPB_FAT16_extBootSig = 0x26, + BPB_FAT16_volumeID = 0x27, + BPB_FAT16_volumeLabel = 0x2B, + BPB_FAT16_fileSysType = 0x36, + // Bootcode + BPB_FAT16_bootCode = 0x3E, + // FAT32 extended block + BPB_FAT32_sectorsPerFAT32 = 0x24, + BPB_FAT32_extFlags = 0x28, + BPB_FAT32_fsVer = 0x2A, + BPB_FAT32_rootClus = 0x2C, + BPB_FAT32_fsInfo = 0x30, + BPB_FAT32_bkBootSec = 0x32, + // Ext BIOS Parameter Block for FAT32 + BPB_FAT32_driveNumber = 0x40, + BPB_FAT32_reserved1 = 0x41, + BPB_FAT32_extBootSig = 0x42, + BPB_FAT32_volumeID = 0x43, + BPB_FAT32_volumeLabel = 0x47, + BPB_FAT32_fileSysType = 0x52, + // Bootcode + BPB_FAT32_bootCode = 0x5A, + BPB_bootSig_55 = 0x1FE, + BPB_bootSig_AA = 0x1FF +}; + +static const char FAT_SIG[3] = {'F', 'A', 'T'}; + +#define BYTES_PER_READ 512 + +static bool _FAT_partition_isFAT(const DISC_INTERFACE* disc, sec_t startSector) +{ + uint8_t sectorBuffer[BYTES_PER_READ] = {0}; + if (!disc->readSectors(startSector, 1, sectorBuffer)) { + return false; + } + // Make sure it is a valid BPB + if ( (sectorBuffer[BPB_bootSig_55] != 0x55) || (sectorBuffer[BPB_bootSig_AA] != 0xAA)) { + return false; + } + + // Now verify that this is indeed a FAT partition + if (memcmp(sectorBuffer + BPB_FAT16_fileSysType, FAT_SIG, sizeof(FAT_SIG)) && + memcmp(sectorBuffer + BPB_FAT32_fileSysType, FAT_SIG, sizeof(FAT_SIG))) + { + return false; + } + + // check again for the last two cases to make sure that we really have a FAT filesystem here + // and won't corrupt any data + if(memcmp(sectorBuffer + BPB_FAT16_fileSysType, "FAT", 3) != 0 && memcmp(sectorBuffer + BPB_FAT32_fileSysType, "FAT32", 5) != 0) + { + return false; + } + return true; +} +static inline uint32_t u8array_to_u32 (const uint8_t* item, int offset) { + return ( item[offset] | (item[offset + 1] << 8) | (item[offset + 2] << 16) | (item[offset + 3] << 24)); +} + +sec_t GetFATPartition(const DISC_INTERFACE* disc) +{ + int i; + uint8_t sectorBuffer[BYTES_PER_READ] = {0}; + sec_t startSector = 0; + + if(!disc->startup()) + return 0; + + // Read first sector of disc + if (!disc->readSectors(0, 1, sectorBuffer)) + startSector = 0; + + // Make sure it is a valid MBR or boot sector + if ( (sectorBuffer[BPB_bootSig_55] != 0x55) || (sectorBuffer[BPB_bootSig_AA] != 0xAA)) + startSector = 0; + + if (!memcmp(sectorBuffer + BPB_FAT16_fileSysType, FAT_SIG, sizeof(FAT_SIG))) + { + // Check if there is a FAT string, which indicates this is a boot sector + startSector = 0; + } + else if (!memcmp(sectorBuffer + BPB_FAT32_fileSysType, FAT_SIG, sizeof(FAT_SIG))) + { + // Check for FAT32 + startSector = 0; + } + else + { + // This is an MBR + // Find first valid partition from MBR + // First check for an active partition + for (i=0x1BE; (i < 0x1FE) && (sectorBuffer[i] != 0x80); i+= 0x10); + // If it find an active partition, check for FAT-Partition + if ( i != 0x1FE && !_FAT_partition_isFAT(disc, u8array_to_u32(sectorBuffer, 0x8 + i)) ) + i = 0x1FE; + + // If it didn't find an active partition, search for any valid partition + if (i == 0x1FE) + { + for (i=0x1BE; i < 0x1FE; i+= 0x10) + { + if ( sectorBuffer[i+0x04] != 0x00 && _FAT_partition_isFAT(disc, u8array_to_u32(sectorBuffer, 0x8 + i)) ) + break; + } + } + if (i != 0x1FE) + startSector = u8array_to_u32(sectorBuffer, 0x8 + i);; + } + disc->shutdown(); + return startSector; +} + +int USBDevice_Init() +{ + //closing all open Files write back the cache and then shutdown em! + fatUnmount("USB:/"); + //right now mounts first FAT-partition + if (fatMount("USB", &__io_usbstorage, GetFATPartition(&__io_usbstorage), CACHE, SECTORS)) { + //try first mount with libogc + return 1; + } + return -1; +} + +void USBDevice_deInit() +{ + //closing all open Files write back the cache and then shutdown em! + fatUnmount("USB:/"); +} + +int isSdInserted() +{ + return __io_wiisd.isInserted(); +} + +int SDCard_Init() +{ + //closing all open Files write back the cache and then shutdown em! + fatUnmount("SD:/"); + //right now mounts first FAT-partition + if (fatMount("SD", &__io_wiisd, GetFATPartition(&__io_wiisd), CACHE, SECTORS)) + return 1; + return -1; +} + +void SDCard_deInit() +{ + //closing all open Files write back the cache and then shutdown em! + fatUnmount("SD:/"); +} diff --git a/ForwardMii-Plugin/Resources/GX/fatmounter.h b/ForwardMii-Plugin/Resources/GX/fatmounter.h new file mode 100644 index 0000000..e235702 --- /dev/null +++ b/ForwardMii-Plugin/Resources/GX/fatmounter.h @@ -0,0 +1,19 @@ +#ifndef _FATMOUNTER_H_ +#define _FATMOUNTER_H_ + +#ifdef __cplusplus +extern "C" +{ +#endif + +int USBDevice_Init(); +void USBDevice_deInit(); +int isSdInserted(); +int SDCard_Init(); +void SDCard_deInit(); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/ForwardMii-Plugin/Resources/GX/filelist.h b/ForwardMii-Plugin/Resources/GX/filelist.h new file mode 100644 index 0000000..e0af26c --- /dev/null +++ b/ForwardMii-Plugin/Resources/GX/filelist.h @@ -0,0 +1,20 @@ +/**************************************************************************** + * libwiigui Template + * Tantric 2009 + * + * imagelist.h + * Contains a list of all of the files in the images, fonts, sounds folders + ***************************************************************************/ + +#ifndef _FILELIST_H_ +#define _FILELIST_H_ + +#include + +extern const u8 background_png[]; +extern const u32 background_png_size; + +extern const u8 background169_png[]; +extern const u32 background169_png_size; + +#endif diff --git a/ForwardMii-Plugin/Resources/GX/main.cpp b/ForwardMii-Plugin/Resources/GX/main.cpp new file mode 100644 index 0000000..c1d79b3 --- /dev/null +++ b/ForwardMii-Plugin/Resources/GX/main.cpp @@ -0,0 +1,244 @@ +/* + * loadMii loader v0.3 + * main.c + * http://code.google.com/p/loadmii + * + * Copyright 2009 The Lemon Man + * Thanks to luccax, Wiipower, Aurelio and crediar + * GX added by dimok (thanks to Tantric) + * usbGecko powered by Nuke + * little modifications by Leathl + * + * This program 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 2 of the License, or + * (at your option) any later version. + * + * This program 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + */ + +#include +#include +#include +#include +#include +#include + +#include "pngu/pngu.h" +#include "video.h" +#include "filelist.h" +#include "dolloader.h" +#include "elfloader.h" +#include "fatmounter.h" + +/*edit these*/ +#define USB_FIRST false +#define ELF_FIRST false + +#define SD_DOL "SD:/apps/appfolder/boot.dol" +#define SD_ELF "SD:/apps/appfolder/boot.elf" +#define USB_DOL "USB:/apps/appfolder/boot.dol" +#define USB_ELF "USB:/apps/appfolder/boot.elf" + +static PNGUPROP imgProp; +static IMGCTX ctx; + + +u8 * GetImageData(void) { + + u8 * data = NULL; + + int ret; + + if (CONF_GetAspectRatio()) { + ctx = PNGU_SelectImageFromBuffer(background169_png); + if (!ctx) + return NULL; + } else { + ctx = PNGU_SelectImageFromBuffer(background_png); + if (!ctx) + return NULL; + } + + ret = PNGU_GetImageProperties(ctx, &imgProp); + if (ret != PNGU_OK) + return NULL; + + int len = imgProp.imgWidth * imgProp.imgHeight * 4; + + if(len%32) len += (32-len%32); + data = (u8 *)memalign (32, len); + ret = PNGU_DecodeTo4x4RGBA8 (ctx, imgProp.imgWidth, imgProp.imgHeight, data, 255); + DCFlushRange(data, len); + + PNGU_ReleaseImageContext(ctx); + + return data; +} + +void Background_Show(int x, int y, int z, u8 * data, int angle, int scaleX, int scaleY, int alpha) +{ + /* Draw image */ + Menu_DrawImg(x, y, z, imgProp.imgWidth, imgProp.imgHeight, data, angle, scaleX, scaleY, alpha); +} + + +int main(int argc, char **argv) +{ + u32 cookie; + FILE *exeFile = NULL; + void *exeBuffer = (void *)EXECUTABLE_MEM_ADDR; + int exeSize = 0; + u32 exeEntryPointAddress = 0; + entrypoint exeEntryPoint; + char cfgpath[256], first[256], second[256], third[256], fourth[256]; + + /* int videomod */ + InitVideo(); + /* get imagedata */ + u8 * imgdata = GetImageData(); + /* fadein of image */ + for(int i = 0; i < 255; i = i+10) + { + if(i>255) i = 255; + Background_Show(0, 0, 0, imgdata, 0, 1, 1, i); + Menu_Render(); + } + + /*set order*/ + if (USB_FIRST && ELF_FIRST) + { + sprintf(first, USB_ELF); + sprintf(second, USB_DOL); + sprintf(third, SD_ELF); + sprintf(fourth, SD_DOL); + } + else if (USB_FIRST) + { + sprintf(first, USB_DOL); + sprintf(second, USB_ELF); + sprintf(third, SD_DOL); + sprintf(fourth, SD_ELF); + } + else if (ELF_FIRST) + { + sprintf(first, SD_ELF); + sprintf(second, SD_DOL); + sprintf(third, USB_ELF); + sprintf(fourth, USB_DOL); + } + else + { + sprintf(first, SD_DOL); + sprintf(second, SD_ELF); + sprintf(third, USB_DOL); + sprintf(fourth, USB_ELF); + } + + /* check devices */ + SDCard_Init(); + USBDevice_Init(); + + /* Open dol File and check exist */ + sprintf(cfgpath, first); + exeFile = fopen (cfgpath ,"rb"); + if (exeFile==NULL) + { + sprintf(cfgpath, second); + exeFile = fopen (cfgpath ,"rb"); + } + if (exeFile==NULL) + { + sprintf(cfgpath, third); + exeFile = fopen (cfgpath ,"rb"); + } + if (exeFile==NULL) + { + sprintf(cfgpath, fourth); + exeFile = fopen (cfgpath ,"rb"); + } + // if nothing found exiting + if (exeFile==NULL) { + printf("\n\n\t\tCan't find DOL File...\n"); + Menu_Render(); + sleep(3); + fclose (exeFile); + SDCard_deInit(); + USBDevice_deInit(); + StopGX(); + SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0); + } + + fseek (exeFile, 0, SEEK_END); + exeSize = ftell(exeFile); + fseek (exeFile, 0, SEEK_SET); + + if(fread (exeBuffer, 1, exeSize, exeFile) != (unsigned int) exeSize) + { + printf("\n\n\t\tCan't open DOL File...\n"); + Menu_Render(); + fclose (exeFile); + sleep(3); + SDCard_deInit(); + USBDevice_deInit(); + StopGX(); + SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0); + } + fclose (exeFile); + + /* load entry point */ + struct __argv args; + bzero(&args, sizeof(args)); + args.argvMagic = ARGV_MAGIC; + args.length = strlen(cfgpath) + 2; + args.commandLine = (char*)malloc(args.length); + if (!args.commandLine) SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0); + strcpy(args.commandLine, cfgpath); + args.commandLine[args.length - 1] = '\0'; + args.argc = 1; + args.argv = &args.commandLine; + args.endARGV = args.argv + 1; + + int ret = valid_elf_image(exeBuffer); + if (ret == 1) + exeEntryPointAddress = load_elf_image(exeBuffer); + else + exeEntryPointAddress = load_dol_image(exeBuffer, &args); + + /* fadeout of image */ + for(int i = 255; i > 1; i = i-7) + { + if(i < 0) i = 0; + Background_Show(0, 0, 0, imgdata, 0, 1, 1, i); + Menu_Render(); + } + SDCard_deInit(); + USBDevice_deInit(); + StopGX(); + if (exeEntryPointAddress == 0) { + printf("EntryPointAddress failed...\n"); + Menu_Render(); + sleep(3); + fclose (exeFile); + SDCard_deInit(); + USBDevice_deInit(); + StopGX(); + SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);; + } + exeEntryPoint = (entrypoint) exeEntryPointAddress; + /* cleaning up and load dol */ + SYS_ResetSystem(SYS_SHUTDOWN, 0, 0); + _CPU_ISR_Disable (cookie); + __exception_closeall (); + exeEntryPoint (); + _CPU_ISR_Restore (cookie); + return 0; +} diff --git a/ForwardMii-Plugin/Resources/GX/video.cpp b/ForwardMii-Plugin/Resources/GX/video.cpp new file mode 100644 index 0000000..0c2deb2 --- /dev/null +++ b/ForwardMii-Plugin/Resources/GX/video.cpp @@ -0,0 +1,240 @@ +/**************************************************************************** + * libwiigui Template + * Tantric 2009 + * + * video.cpp + * Video routines + ***************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include + +#define DEFAULT_FIFO_SIZE 256 * 1024 +static unsigned int *xfb[2] = { NULL, NULL }; // Double buffered +static int whichfb = 0; // Switch +static GXRModeObj *vmode; // Menu video mode +static unsigned char gp_fifo[DEFAULT_FIFO_SIZE] ATTRIBUTE_ALIGN (32); +static Mtx GXmodelView2D; + +/**************************************************************************** + * StartGX + * + * Initialises GX and sets it up for use + ***************************************************************************/ +static void +StartGX () +{ + GXColor background = { 0, 0, 0, 0xff }; + + /*** Clear out FIFO area ***/ + memset (&gp_fifo, 0, DEFAULT_FIFO_SIZE); + + /*** Initialise GX ***/ + GX_Init (&gp_fifo, DEFAULT_FIFO_SIZE); + GX_SetCopyClear (background, 0x00ffffff); + + GX_SetDispCopyGamma (GX_GM_1_0); + GX_SetCullMode (GX_CULL_NONE); +} + +/**************************************************************************** + * ResetVideo_Menu + * + * Reset the video/rendering mode for the menu +****************************************************************************/ +void +ResetVideo_Menu() +{ + Mtx44 p; + f32 yscale; + u32 xfbHeight; + + VIDEO_Configure (vmode); + VIDEO_Flush(); + VIDEO_WaitVSync(); + if (vmode->viTVMode & VI_NON_INTERLACE) + VIDEO_WaitVSync(); + else + while (VIDEO_GetNextField()) + VIDEO_WaitVSync(); + + // clears the bg to color and clears the z buffer + GXColor background = {0, 0, 0, 255}; + GX_SetCopyClear (background, 0x00ffffff); + + yscale = GX_GetYScaleFactor(vmode->efbHeight,vmode->xfbHeight); + xfbHeight = GX_SetDispCopyYScale(yscale); + GX_SetScissor(0,0,vmode->fbWidth,vmode->efbHeight); + GX_SetDispCopySrc(0,0,vmode->fbWidth,vmode->efbHeight); + GX_SetDispCopyDst(vmode->fbWidth,xfbHeight); + GX_SetCopyFilter(vmode->aa,vmode->sample_pattern,GX_TRUE,vmode->vfilter); + GX_SetFieldMode(vmode->field_rendering,((vmode->viHeight==2*vmode->xfbHeight)?GX_ENABLE:GX_DISABLE)); + + if (vmode->aa) + GX_SetPixelFmt(GX_PF_RGB565_Z16, GX_ZC_LINEAR); + else + GX_SetPixelFmt(GX_PF_RGB8_Z24, GX_ZC_LINEAR); + + // setup the vertex descriptor + // tells the flipper to expect direct data + GX_ClearVtxDesc(); + GX_InvVtxCache (); + GX_InvalidateTexAll(); + + GX_SetVtxDesc(GX_VA_TEX0, GX_NONE); + GX_SetVtxDesc(GX_VA_POS, GX_DIRECT); + GX_SetVtxDesc (GX_VA_CLR0, GX_DIRECT); + + GX_SetVtxAttrFmt (GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0); + GX_SetVtxAttrFmt (GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0); + GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_TEX_ST, GX_F32, 0); + GX_SetZMode (GX_FALSE, GX_LEQUAL, GX_TRUE); + + GX_SetNumChans(1); + GX_SetNumTexGens(1); + GX_SetTevOp (GX_TEVSTAGE0, GX_PASSCLR); + GX_SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR0A0); + GX_SetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY); + + guMtxIdentity(GXmodelView2D); + guMtxTransApply (GXmodelView2D, GXmodelView2D, 0.0F, 0.0F, -200.0F); + GX_LoadPosMtxImm(GXmodelView2D,GX_PNMTX0); + + guOrtho(p,0,479,0,639,0,300); + GX_LoadProjectionMtx(p, GX_ORTHOGRAPHIC); + + GX_SetViewport(0,0,vmode->fbWidth,vmode->efbHeight,0,1); + GX_SetBlendMode(GX_BM_BLEND, GX_BL_SRCALPHA, GX_BL_INVSRCALPHA, GX_LO_CLEAR); + GX_SetAlphaUpdate(GX_TRUE); +} + +/**************************************************************************** + * InitVideo + * + * This function MUST be called at startup. + * - also sets up menu video mode + ***************************************************************************/ + +void +InitVideo () +{ + VIDEO_Init(); + vmode = VIDEO_GetPreferredMode(NULL); // get default video mode + + VIDEO_Configure (vmode); + + // Allocate the video buffers + xfb[0] = (u32 *) MEM_K0_TO_K1 (SYS_AllocateFramebuffer (vmode)); + xfb[1] = (u32 *) MEM_K0_TO_K1 (SYS_AllocateFramebuffer (vmode)); + + // A console is always useful while debugging + console_init (xfb[0], 20, 64, vmode->fbWidth, vmode->xfbHeight, vmode->fbWidth * 2); + + // Clear framebuffers etc. + VIDEO_ClearFrameBuffer (vmode, xfb[0], COLOR_BLACK); + VIDEO_ClearFrameBuffer (vmode, xfb[1], COLOR_BLACK); + VIDEO_SetNextFramebuffer (xfb[0]); + + VIDEO_SetBlack (FALSE); + VIDEO_Flush (); + VIDEO_WaitVSync (); + if (vmode->viTVMode & VI_NON_INTERLACE) + VIDEO_WaitVSync (); + + StartGX(); + ResetVideo_Menu(); + // Finally, the video is up and ready for use :) +} + +/**************************************************************************** + * StopGX + * + * Stops GX (when exiting) + ***************************************************************************/ +void StopGX() +{ + GX_AbortFrame(); + GX_Flush(); + + VIDEO_SetBlack(TRUE); + VIDEO_Flush(); +} + +/**************************************************************************** + * Menu_Render + * + * Renders everything current sent to GX, and flushes video + ***************************************************************************/ +void Menu_Render() +{ + GX_DrawDone (); + + whichfb ^= 1; // flip framebuffer + GX_SetZMode(GX_TRUE, GX_LEQUAL, GX_TRUE); + GX_SetColorUpdate(GX_TRUE); + GX_CopyDisp(xfb[whichfb],GX_TRUE); + VIDEO_SetNextFramebuffer(xfb[whichfb]); + VIDEO_Flush(); + VIDEO_WaitVSync(); +} + +/**************************************************************************** + * Menu_DrawImg + * + * Draws the specified image on screen using GX + ***************************************************************************/ +void Menu_DrawImg(f32 xpos, f32 ypos, f32 zpos, u16 width, u16 height, u8 data[], + f32 degrees, f32 scaleX, f32 scaleY, u8 alpha) +{ + if(data == NULL) + return; + + GXTexObj texObj; + + GX_InitTexObj(&texObj, data, width,height, GX_TF_RGBA8,GX_CLAMP, GX_CLAMP,GX_FALSE); + GX_LoadTexObj(&texObj, GX_TEXMAP0); + GX_InvalidateTexAll(); + + GX_SetTevOp (GX_TEVSTAGE0, GX_MODULATE); + GX_SetVtxDesc (GX_VA_TEX0, GX_DIRECT); + + Mtx m,m1,m2, mv; + width *=.5; + height*=.5; + guMtxIdentity (m1); + guMtxScaleApply(m1,m1,scaleX,scaleY,1.0); + Vector axis = (Vector) {0 , 0, 1 }; + guMtxRotAxisDeg (m2, &axis, degrees); + guMtxConcat(m1,m2,m); + + guMtxTransApply(m,m, xpos+width+0.5,ypos+height+0.5,zpos); + guMtxConcat (GXmodelView2D, m, mv); + GX_LoadPosMtxImm (mv, GX_PNMTX0); + + GX_Begin(GX_QUADS, GX_VTXFMT0,4); + GX_Position3f32(-width, -height, 0); + GX_Color4u8(0xFF,0xFF,0xFF,alpha); + GX_TexCoord2f32(0, 0); + + GX_Position3f32(width, -height, 0); + GX_Color4u8(0xFF,0xFF,0xFF,alpha); + GX_TexCoord2f32(1, 0); + + GX_Position3f32(width, height, 0); + GX_Color4u8(0xFF,0xFF,0xFF,alpha); + GX_TexCoord2f32(1, 1); + + GX_Position3f32(-width, height, 0); + GX_Color4u8(0xFF,0xFF,0xFF,alpha); + GX_TexCoord2f32(0, 1); + GX_End(); + GX_LoadPosMtxImm (GXmodelView2D, GX_PNMTX0); + + GX_SetTevOp (GX_TEVSTAGE0, GX_PASSCLR); + GX_SetVtxDesc (GX_VA_TEX0, GX_NONE); +} diff --git a/ForwardMii-Plugin/Resources/GX/video.h b/ForwardMii-Plugin/Resources/GX/video.h new file mode 100644 index 0000000..fb45f0a --- /dev/null +++ b/ForwardMii-Plugin/Resources/GX/video.h @@ -0,0 +1,20 @@ +/**************************************************************************** + * libwiigui Template + * Tantric 2009 + * + * video.h + * Video routines + ***************************************************************************/ + +#ifndef _VIDEO_H_ +#define _VIDEO_H_ + +#include + +void InitVideo (); +void StopGX(); +void ResetVideo_Menu(); +void Menu_Render(); +void Menu_DrawImg(f32 xpos, f32 ypos, f32 zpos, u16 width, u16 height, u8 data[], f32 degrees, f32 scaleX, f32 scaleY, u8 alphaF ); + +#endif diff --git a/ForwardMii-Plugin/Resources/SDSDHC/10CharsTail.bin b/ForwardMii-Plugin/Resources/SDSDHC/10CharsTail.bin new file mode 100644 index 0000000..266d5d3 Binary files /dev/null and b/ForwardMii-Plugin/Resources/SDSDHC/10CharsTail.bin differ diff --git a/ForwardMii-Plugin/Resources/SDSDHC/11CharsTail.bin b/ForwardMii-Plugin/Resources/SDSDHC/11CharsTail.bin new file mode 100644 index 0000000..22e9232 Binary files /dev/null and b/ForwardMii-Plugin/Resources/SDSDHC/11CharsTail.bin differ diff --git a/ForwardMii-Plugin/Resources/SDSDHC/12CharsTail.bin b/ForwardMii-Plugin/Resources/SDSDHC/12CharsTail.bin new file mode 100644 index 0000000..fe084a8 Binary files /dev/null and b/ForwardMii-Plugin/Resources/SDSDHC/12CharsTail.bin differ diff --git a/ForwardMii-Plugin/Resources/SDSDHC/13CharsTail.bin b/ForwardMii-Plugin/Resources/SDSDHC/13CharsTail.bin new file mode 100644 index 0000000..47ee8b7 Binary files /dev/null and b/ForwardMii-Plugin/Resources/SDSDHC/13CharsTail.bin differ diff --git a/ForwardMii-Plugin/Resources/SDSDHC/14CharsTail.bin b/ForwardMii-Plugin/Resources/SDSDHC/14CharsTail.bin new file mode 100644 index 0000000..4036d7d Binary files /dev/null and b/ForwardMii-Plugin/Resources/SDSDHC/14CharsTail.bin differ diff --git a/ForwardMii-Plugin/Resources/SDSDHC/15CharsTail.bin b/ForwardMii-Plugin/Resources/SDSDHC/15CharsTail.bin new file mode 100644 index 0000000..d040888 Binary files /dev/null and b/ForwardMii-Plugin/Resources/SDSDHC/15CharsTail.bin differ diff --git a/ForwardMii-Plugin/Resources/SDSDHC/16CharsTail.bin b/ForwardMii-Plugin/Resources/SDSDHC/16CharsTail.bin new file mode 100644 index 0000000..0abcb09 Binary files /dev/null and b/ForwardMii-Plugin/Resources/SDSDHC/16CharsTail.bin differ diff --git a/ForwardMii-Plugin/Resources/SDSDHC/17CharsBase.bin b/ForwardMii-Plugin/Resources/SDSDHC/17CharsBase.bin new file mode 100644 index 0000000..5a50866 Binary files /dev/null and b/ForwardMii-Plugin/Resources/SDSDHC/17CharsBase.bin differ diff --git a/ForwardMii-Plugin/Resources/SDSDHC/17CharsTail.bin b/ForwardMii-Plugin/Resources/SDSDHC/17CharsTail.bin new file mode 100644 index 0000000..4762dae Binary files /dev/null and b/ForwardMii-Plugin/Resources/SDSDHC/17CharsTail.bin differ diff --git a/ForwardMii-Plugin/Resources/SDSDHC/18CharsTail.bin b/ForwardMii-Plugin/Resources/SDSDHC/18CharsTail.bin new file mode 100644 index 0000000..2a8d124 Binary files /dev/null and b/ForwardMii-Plugin/Resources/SDSDHC/18CharsTail.bin differ diff --git a/ForwardMii-Plugin/Resources/SDSDHC/3CharsBase.bin b/ForwardMii-Plugin/Resources/SDSDHC/3CharsBase.bin new file mode 100644 index 0000000..a63f9d1 Binary files /dev/null and b/ForwardMii-Plugin/Resources/SDSDHC/3CharsBase.bin differ diff --git a/ForwardMii-Plugin/Resources/SDSDHC/3CharsTail.bin b/ForwardMii-Plugin/Resources/SDSDHC/3CharsTail.bin new file mode 100644 index 0000000..273a244 Binary files /dev/null and b/ForwardMii-Plugin/Resources/SDSDHC/3CharsTail.bin differ diff --git a/ForwardMii-Plugin/Resources/SDSDHC/4CharsTail.bin b/ForwardMii-Plugin/Resources/SDSDHC/4CharsTail.bin new file mode 100644 index 0000000..c2f12b9 Binary files /dev/null and b/ForwardMii-Plugin/Resources/SDSDHC/4CharsTail.bin differ diff --git a/ForwardMii-Plugin/Resources/SDSDHC/5CharsTail.bin b/ForwardMii-Plugin/Resources/SDSDHC/5CharsTail.bin new file mode 100644 index 0000000..be5e492 Binary files /dev/null and b/ForwardMii-Plugin/Resources/SDSDHC/5CharsTail.bin differ diff --git a/ForwardMii-Plugin/Resources/SDSDHC/6CharsBase.bin b/ForwardMii-Plugin/Resources/SDSDHC/6CharsBase.bin new file mode 100644 index 0000000..0026f4d Binary files /dev/null and b/ForwardMii-Plugin/Resources/SDSDHC/6CharsBase.bin differ diff --git a/ForwardMii-Plugin/Resources/SDSDHC/6CharsTail.bin b/ForwardMii-Plugin/Resources/SDSDHC/6CharsTail.bin new file mode 100644 index 0000000..5d08011 Binary files /dev/null and b/ForwardMii-Plugin/Resources/SDSDHC/6CharsTail.bin differ diff --git a/ForwardMii-Plugin/Resources/SDSDHC/7CharsTail.bin b/ForwardMii-Plugin/Resources/SDSDHC/7CharsTail.bin new file mode 100644 index 0000000..2aa8595 Binary files /dev/null and b/ForwardMii-Plugin/Resources/SDSDHC/7CharsTail.bin differ diff --git a/ForwardMii-Plugin/Resources/SDSDHC/8CharsTail.bin b/ForwardMii-Plugin/Resources/SDSDHC/8CharsTail.bin new file mode 100644 index 0000000..9b67ecf Binary files /dev/null and b/ForwardMii-Plugin/Resources/SDSDHC/8CharsTail.bin differ diff --git a/ForwardMii-Plugin/Resources/SDSDHC/9CharsTail.bin b/ForwardMii-Plugin/Resources/SDSDHC/9CharsTail.bin new file mode 100644 index 0000000..f04c671 Binary files /dev/null and b/ForwardMii-Plugin/Resources/SDSDHC/9CharsTail.bin differ