Implemented CustomizeMiiInstaler, Project Cleanup, etc...

git-svn-id: svn://localhost/Users/andi/Downloads/code/trunk@26 eddbe33b-e435-4246-ac25-f5eb65f9a13c
This commit is contained in:
leathl 2010-01-12 17:03:46 +00:00
parent db8cb52491
commit abb6b9927d
101 changed files with 1542 additions and 672 deletions

View File

@ -1,36 +1,42 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
# 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}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ForwardMii", "ForwardMii\ForwardMii.csproj", "{20CB2CA7-6767-4758-97FA-97395F47CD6B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Helpers", "Helpers\Helpers.csproj", "{475F3ADF-B529-449F-89DA-BA5E8BE15DD5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tester", "Tester\Tester.csproj", "{C020DE3A-F72B-47AD-A451-17B7586E4D21}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CustomizeMiiInstaller", "CustomizeMiiInstaller\CustomizeMiiInstaller.csproj", "{475F3ADF-B529-449F-89DA-BA5E8BE15DD5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{46B7F0BC-101B-4167-95AD-4C5D78AA0A20}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{46B7F0BC-101B-4167-95AD-4C5D78AA0A20}.Debug|Any CPU.Build.0 = Debug|Any CPU
{46B7F0BC-101B-4167-95AD-4C5D78AA0A20}.Debug|x86.ActiveCfg = Debug|x86
{46B7F0BC-101B-4167-95AD-4C5D78AA0A20}.Debug|x86.Build.0 = Debug|x86
{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
{46B7F0BC-101B-4167-95AD-4C5D78AA0A20}.Release|x86.ActiveCfg = Release|x86
{46B7F0BC-101B-4167-95AD-4C5D78AA0A20}.Release|x86.Build.0 = Release|x86
{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}.Debug|x86.ActiveCfg = Debug|x86
{20CB2CA7-6767-4758-97FA-97395F47CD6B}.Debug|x86.Build.0 = Debug|x86
{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
{20CB2CA7-6767-4758-97FA-97395F47CD6B}.Release|x86.ActiveCfg = Release|x86
{20CB2CA7-6767-4758-97FA-97395F47CD6B}.Release|x86.Build.0 = Release|x86
{475F3ADF-B529-449F-89DA-BA5E8BE15DD5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{475F3ADF-B529-449F-89DA-BA5E8BE15DD5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{475F3ADF-B529-449F-89DA-BA5E8BE15DD5}.Debug|x86.ActiveCfg = Debug|Any CPU
{475F3ADF-B529-449F-89DA-BA5E8BE15DD5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{475F3ADF-B529-449F-89DA-BA5E8BE15DD5}.Release|Any CPU.Build.0 = Release|Any CPU
{C020DE3A-F72B-47AD-A451-17B7586E4D21}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C020DE3A-F72B-47AD-A451-17B7586E4D21}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C020DE3A-F72B-47AD-A451-17B7586E4D21}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C020DE3A-F72B-47AD-A451-17B7586E4D21}.Release|Any CPU.Build.0 = Release|Any CPU
{475F3ADF-B529-449F-89DA-BA5E8BE15DD5}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -48,12 +48,31 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<ItemGroup>
<Reference Include="CustomizeMiiInstaller, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\CustomizeMiiInstaller\bin\Debug\CustomizeMiiInstaller.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="BNS.cs" />
@ -91,6 +110,13 @@
<Compile Include="CustomizeMii_PrivateFunctions.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="CustomizeMii_Transmit.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="CustomizeMii_Transmit.Designer.cs">
<DependentUpon>CustomizeMii_Transmit.cs</DependentUpon>
</Compile>
<Compile Include="CustomizeMii_zlib.cs" />
<Compile Include="MP3Info.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
@ -106,6 +132,9 @@
<EmbeddedResource Include="CustomizeMii_Main.resx">
<DependentUpon>CustomizeMii_Main.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="CustomizeMii_Transmit.resx">
<DependentUpon>CustomizeMii_Transmit.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
@ -144,6 +173,7 @@
<Content Include="License.txt" />
<Content Include="Readme.txt" />
<Content Include="Instructions.txt" />
<None Include="app.config" />
<None Include="Resources\btnSend.png" />
<None Include="Resources\btnCreate.png" />
<None Include="Resources\CustomizeMii.ico" />
@ -177,9 +207,9 @@
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ForwardMii-Plugin\ForwardMii-Plugin.csproj">
<ProjectReference Include="..\ForwardMii\ForwardMii.csproj">
<Project>{20CB2CA7-6767-4758-97FA-97395F47CD6B}</Project>
<Name>ForwardMii-Plugin</Name>
<Name>ForwardMii</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

View File

@ -20,14 +20,19 @@ using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using BNS;
using System.Net.Sockets;
namespace CustomizeMii
{
partial class CustomizeMii_Main
{
private Stopwatch CreationTimer = new Stopwatch();
private Stopwatch TransmitTimer = new Stopwatch();
private TransmitInfo transmitInfo;
public int sendWadReady = 0;
private bool sendToWii = false;
private bool internalSound;
private WadCreationInfo wadCreationInfo;
void bwBannerReplace_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
@ -529,7 +534,7 @@ namespace CustomizeMii
}
}
void bwCreateWad_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
void bwTransmit_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
EventHandler EnableControls = new EventHandler(this.EnableControls);
EventHandler Initialize = new EventHandler(this.Initialize);
@ -537,6 +542,219 @@ namespace CustomizeMii
lbStatusText.Text = string.Empty;
this.Invoke(EnableControls);
this.Invoke(Initialize);
if (transmitInfo.timeElapsed > 0)
{
System.Windows.Forms.DialogResult dlg;
if (transmitInfo.usedCompression)
dlg = System.Windows.Forms.MessageBox.Show(
string.Format("Transmitted {0} kB in {1} milliseconds...\nCompression Ratio: {2}%\n\nDo you want to save the wad file?",
transmitInfo.transmittedLength, transmitInfo.timeElapsed, transmitInfo.compressionRatio),
"Save File?", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question);
else
dlg = System.Windows.Forms.MessageBox.Show(
string.Format("Transmitted {0} kB in {1} milliseconds...\n\nDo you want to save the wad file?",
transmitInfo.transmittedLength, transmitInfo.timeElapsed),
"Save File?", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question);
if (dlg == System.Windows.Forms.DialogResult.Yes)
{
System.Windows.Forms.SaveFileDialog sfd = new System.Windows.Forms.SaveFileDialog();
sfd.Filter = "Wii Channels|*.wad";
if (!string.IsNullOrEmpty(tbAllLanguages.Text))
sfd.FileName = tbAllLanguages.Text + " - " + tbTitleID.Text.ToUpper() + ".wad";
else
sfd.FileName = tbEnglish.Text + " - " + tbTitleID.Text.ToUpper() + ".wad";
if (sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
File.Copy(TempPath + "SendToWii.wad", sfd.FileName, true);
}
}
try { File.Delete(TempPath + "SendToWii.wad"); }
catch { }
}
void bwTransmit_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
currentProgress.progressValue = e.ProgressPercentage;
currentProgress.progressState = (string)e.UserState;
this.Invoke(ProgressUpdate);
}
void bwTransmit_DoWork(object sender, DoWorkEventArgs e)
{
try
{
BackgroundWorker bwTransmit = sender as BackgroundWorker;
//Insert wad into stub dol
string fileName = "CMiiInstaller.dol";
byte[] fileData = CustomizeMiiInstaller.InstallerHelper.CreateInstaller(TempPath + "SendToWii.wad", (byte)wadCreationInfo.transmitIos).ToArray();
//Transmit installer
transmitInfo.timeElapsed = 0; TransmitTimer.Reset(); TransmitTimer.Start();
bool compress = File.Exists(System.Windows.Forms.Application.StartupPath + "\\zlib1.dll");
if (!Environment.OSVersion.ToString().Contains("Windows"))
compress = false;
if ((int)(wadCreationInfo.transmitProtocol) == 1) compress = false;
TcpClient theClient = new TcpClient();
byte[] compFileData;
int Blocksize = 4 * 1024;
if (wadCreationInfo.transmitProtocol != TransmitProtocol.JODI) Blocksize = 16 * 1024;
byte[] buffer = new byte[4];
string theIP = wadCreationInfo.transmitIp;
bwTransmit.ReportProgress(0, "Connecting...");
//StatusUpdate("Connecting...");
try { theClient.Connect(theIP, 4299); }
catch (Exception ex) { theClient.Close(); throw new Exception("Connection Failed:\n" + ex.Message); }
NetworkStream theStream = theClient.GetStream();
bwTransmit.ReportProgress(0, "Connected... Sending Magic...");
//StatusUpdate("Connected... Sending Magic...");
buffer[0] = (byte)'H';
buffer[1] = (byte)'A';
buffer[2] = (byte)'X';
buffer[3] = (byte)'X';
try { theStream.Write(buffer, 0, 4); }
catch (Exception ex) { theStream.Close(); theClient.Close(); throw new Exception("Error sending Magic:\n" + ex.Message); }
bwTransmit.ReportProgress(0, "Magic Sent... Sending Version Info...");
//StatusUpdate("Magic Sent... Sending Version Info...");
buffer[0] = 0;
buffer[1] = wadCreationInfo.transmitProtocol == TransmitProtocol.JODI ? (byte)5 : (byte)4;
buffer[2] = (byte)(((fileName.Length + 2) >> 8) & 0xff);
buffer[3] = (byte)((fileName.Length + 2) & 0xff);
try { theStream.Write(buffer, 0, 4); }
catch (Exception ex) { theStream.Close(); theClient.Close(); throw new Exception("Error sending Version Info:\n" + ex.Message); }
if (compress)
{
bwTransmit.ReportProgress(0, "Version Info Sent... Compressing File...");
//StatusUpdate("Version Info Sent... Compressing File...");
try { compFileData = TransmitMii.zlib.Compress(fileData); }
catch (Exception ex)
{
ErrorBox(ex.Message);
//Compression failed, let's continue without compression
compFileData = fileData;
fileData = new byte[0];
}
bwTransmit.ReportProgress(0, "Compressed File... Sending Filesize...");
//StatusUpdate("Compressed File... Sending Filesize...");
}
else
{
compFileData = fileData;
fileData = new byte[0];
bwTransmit.ReportProgress(0, "Version Info Sent... Sending Filesize...");
//StatusUpdate("Version Info Sent... Sending Filesize...");
}
//First compressed filesize, then uncompressed filesize
buffer[0] = (byte)((compFileData.Length >> 24) & 0xff);
buffer[1] = (byte)((compFileData.Length >> 16) & 0xff);
buffer[2] = (byte)((compFileData.Length >> 8) & 0xff);
buffer[3] = (byte)(compFileData.Length & 0xff);
try { theStream.Write(buffer, 0, 4); }
catch (Exception ex) { theStream.Close(); theClient.Close(); throw new Exception("Error sending Filesize:\n" + ex.Message); }
if (wadCreationInfo.transmitProtocol != TransmitProtocol.HAXX)
{
buffer[0] = (byte)((fileData.Length >> 24) & 0xff);
buffer[1] = (byte)((fileData.Length >> 16) & 0xff);
buffer[2] = (byte)((fileData.Length >> 8) & 0xff);
buffer[3] = (byte)(fileData.Length & 0xff);
try { theStream.Write(buffer, 0, 4); }
catch (Exception ex) { theStream.Close(); theClient.Close(); throw new Exception("Error sending Filesize:\n" + ex.Message); }
}
bwTransmit.ReportProgress(0, "Filesize Sent... Sending File...");
//StatusUpdate("Filesize Sent... Sending File...");
int off = 0;
int cur = 0;
int count = compFileData.Length / Blocksize;
int left = compFileData.Length % Blocksize;
try
{
do
{
bwTransmit.ReportProgress((cur + 1) * 100 / count, "Sending File...");
//StatusUpdate("Sending File: " + ((cur + 1) * 100 / count).ToString() + "%");
theStream.Write(compFileData, off, Blocksize);
off += Blocksize;
cur++;
} while (cur < count);
if (left > 0)
{
theStream.Write(compFileData, off, compFileData.Length - off);
}
}
catch (Exception ex) { theStream.Close(); theClient.Close(); throw new Exception("Error sending File:\n" + ex.Message); }
bwTransmit.ReportProgress(0, "File Sent... Sending Arguments...");
//StatusUpdate("File Sent... Sending Arguments...");
byte[] theArgs = new byte[fileName.Length + 2];
for (int i = 0; i < fileName.Length; i++) { theArgs[i] = (byte)fileName.ToCharArray()[i]; }
try { theStream.Write(theArgs, 0, theArgs.Length); }
catch (Exception ex) { theStream.Close(); theClient.Close(); throw new Exception("Error sending Arguments:\n" + ex.Message); }
theStream.Close();
theClient.Close();
bwTransmit.ReportProgress(0, string.Empty);
//StatusUpdate(string.Empty);
TransmitTimer.Stop();
transmitInfo.timeElapsed = (int)TransmitTimer.ElapsedMilliseconds;
transmitInfo.usedCompression = compress;
transmitInfo.transmittedLength = Math.Round(compFileData.Length * 0.0009765625, 2);
if (compress && fileData.Length != 0)
transmitInfo.compressionRatio = (compFileData.Length * 100) / fileData.Length;
}
catch (Exception ex)
{
ErrorBox(ex.Message);
}
}
void bwCreateWad_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
if (!this.sendToWii)
{
EventHandler EnableControls = new EventHandler(this.EnableControls);
EventHandler Initialize = new EventHandler(this.Initialize);
pbProgress.Value = 100;
lbStatusText.Text = string.Empty;
this.Invoke(EnableControls);
this.Invoke(Initialize);
}
else
{
if (sendWadReady == 1)
{
//Start new BackgroundWorker to Transmit
BackgroundWorker bwTransmit = new BackgroundWorker();
bwTransmit.WorkerReportsProgress = true;
bwTransmit.DoWork += new DoWorkEventHandler(bwTransmit_DoWork);
bwTransmit.ProgressChanged += new ProgressChangedEventHandler(bwTransmit_ProgressChanged);
bwTransmit.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bwTransmit_RunWorkerCompleted);
bwTransmit.RunWorkerAsync();
}
}
}
void bwCreateWad_ProgressChanged(object sender, ProgressChangedEventArgs e)
@ -563,6 +781,9 @@ namespace CustomizeMii
MakeBannerTplsTransparent();
MakeIconTplsTransparent();
bwCreateWad.ReportProgress(3, "Fixing TPL Filters...");
FixTpls();
bwCreateWad.ReportProgress(5, "Packing icon.bin...");
byte[] iconbin;
@ -751,6 +972,8 @@ namespace CustomizeMii
InfoBox(string.Format("Successfully created custom channel!\nTime elapsed: {0} ms\nFilesize: {1} MB\nApprox. Blocks: {2}", CreationTimer.ElapsedMilliseconds, fileSize, Wii.WadInfo.GetNandBlocks(wadInfo.outFile)));
}
else sendWadReady = 1;
wadCreationInfo = wadInfo;
}
catch (Exception ex)
{

View File

@ -1,4 +1,21 @@
using System;
/* This file is part of CustomizeMii
* Copyright (C) 2009 Leathl
*
* CustomizeMii is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CustomizeMii is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.ComponentModel;
using System.IO;
using System.Windows.Forms;

View File

@ -63,6 +63,7 @@ namespace CustomizeMii
this.tbSourceWad = new System.Windows.Forms.TextBox();
this.lbSource = new System.Windows.Forms.Label();
this.tabTitle = new System.Windows.Forms.TabPage();
this.llbTranslateChannel = new System.Windows.Forms.LinkLabel();
this.tbItalian = new System.Windows.Forms.TextBox();
this.tbFrench = new System.Windows.Forms.TextBox();
this.tbJapanese = new System.Windows.Forms.TextBox();
@ -140,6 +141,7 @@ namespace CustomizeMii
this.tabInstructions = new System.Windows.Forms.TabPage();
this.rtbInstructions = new System.Windows.Forms.RichTextBox();
this.tabCredits = new System.Windows.Forms.TabPage();
this.label1 = new System.Windows.Forms.Label();
this.lbForwardMiiVersion = new System.Windows.Forms.Label();
this.panCredits = new System.Windows.Forms.Panel();
this.lbCreditThanks = new System.Windows.Forms.Label();
@ -164,6 +166,10 @@ namespace CustomizeMii
this.cmExtractBannerImages = new System.Windows.Forms.ToolStripMenuItem();
this.cmExtractIconImages = new System.Windows.Forms.ToolStripMenuItem();
this.cmExtractBothImages = new System.Windows.Forms.ToolStripMenuItem();
this.tsExtractBrl = new System.Windows.Forms.ToolStripMenuItem();
this.cmExtractBrlyt = new System.Windows.Forms.ToolStripMenuItem();
this.cmExtractBrlan = new System.Windows.Forms.ToolStripMenuItem();
this.cmExtractBothBrl = new System.Windows.Forms.ToolStripMenuItem();
this.cmSound = new System.Windows.Forms.ContextMenuStrip(this.components);
this.cmLoadAudioFile = new System.Windows.Forms.ToolStripMenuItem();
this.cmConvertToBns = new System.Windows.Forms.ToolStripMenuItem();
@ -377,6 +383,7 @@ namespace CustomizeMii
//
// tabTitle
//
this.tabTitle.Controls.Add(this.llbTranslateChannel);
this.tabTitle.Controls.Add(this.tbItalian);
this.tabTitle.Controls.Add(this.tbFrench);
this.tabTitle.Controls.Add(this.tbJapanese);
@ -402,6 +409,17 @@ namespace CustomizeMii
this.tabTitle.Text = "Title";
this.tabTitle.UseVisualStyleBackColor = true;
//
// llbTranslateChannel
//
this.llbTranslateChannel.AutoSize = true;
this.llbTranslateChannel.Location = new System.Drawing.Point(322, 42);
this.llbTranslateChannel.Name = "llbTranslateChannel";
this.llbTranslateChannel.Size = new System.Drawing.Size(103, 13);
this.llbTranslateChannel.TabIndex = 17;
this.llbTranslateChannel.TabStop = true;
this.llbTranslateChannel.Text = "Translate \"Channel\"";
this.llbTranslateChannel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.llbTranslateChannel_LinkClicked);
//
// tbItalian
//
this.tbItalian.Location = new System.Drawing.Point(301, 143);
@ -1213,6 +1231,7 @@ namespace CustomizeMii
//
// tabCredits
//
this.tabCredits.Controls.Add(this.label1);
this.tabCredits.Controls.Add(this.lbForwardMiiVersion);
this.tabCredits.Controls.Add(this.panCredits);
this.tabCredits.Controls.Add(this.llbUpdateAvailabe);
@ -1227,9 +1246,18 @@ namespace CustomizeMii
this.tabCredits.Text = "About";
this.tabCredits.UseVisualStyleBackColor = true;
//
// label1
//
this.label1.Location = new System.Drawing.Point(0, 28);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(443, 13);
this.label1.TabIndex = 7;
this.label1.Text = "CustomizeMii Installer by WiiCrazy / I.R.on";
this.label1.TextAlign = System.Drawing.ContentAlignment.TopCenter;
//
// lbForwardMiiVersion
//
this.lbForwardMiiVersion.Location = new System.Drawing.Point(0, 62);
this.lbForwardMiiVersion.Location = new System.Drawing.Point(0, 68);
this.lbForwardMiiVersion.Name = "lbForwardMiiVersion";
this.lbForwardMiiVersion.Size = new System.Drawing.Size(443, 13);
this.lbForwardMiiVersion.TabIndex = 6;
@ -1258,7 +1286,7 @@ namespace CustomizeMii
// llbUpdateAvailabe
//
this.llbUpdateAvailabe.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.llbUpdateAvailabe.Location = new System.Drawing.Point(0, 62);
this.llbUpdateAvailabe.Location = new System.Drawing.Point(0, 67);
this.llbUpdateAvailabe.Name = "llbUpdateAvailabe";
this.llbUpdateAvailabe.Size = new System.Drawing.Size(443, 13);
this.llbUpdateAvailabe.TabIndex = 4;
@ -1270,18 +1298,19 @@ namespace CustomizeMii
//
// llbSite
//
this.llbSite.Location = new System.Drawing.Point(0, 35);
this.llbSite.Location = new System.Drawing.Point(0, 47);
this.llbSite.Name = "llbSite";
this.llbSite.Size = new System.Drawing.Size(443, 13);
this.llbSite.TabIndex = 3;
this.llbSite.TabStop = true;
this.llbSite.Tag = "Independent";
this.llbSite.Text = "http://customizemii.googlecode.com";
this.llbSite.TextAlign = System.Drawing.ContentAlignment.TopCenter;
this.llbSite.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.llbSite_LinkClicked);
//
// lbCreditVersion
//
this.lbCreditVersion.Location = new System.Drawing.Point(0, 13);
this.lbCreditVersion.Location = new System.Drawing.Point(0, 10);
this.lbCreditVersion.Name = "lbCreditVersion";
this.lbCreditVersion.Size = new System.Drawing.Size(443, 13);
this.lbCreditVersion.TabIndex = 1;
@ -1360,21 +1389,22 @@ namespace CustomizeMii
this.cmExtractWad,
this.cmExtractDol,
this.tsExtractSound,
this.tsExtractImages});
this.tsExtractImages,
this.tsExtractBrl});
this.cmOptionsExtract.Name = "cmOptionsExtract";
this.cmOptionsExtract.Size = new System.Drawing.Size(153, 92);
this.cmOptionsExtract.Size = new System.Drawing.Size(183, 114);
//
// cmExtractWad
//
this.cmExtractWad.Name = "cmExtractWad";
this.cmExtractWad.Size = new System.Drawing.Size(152, 22);
this.cmExtractWad.Size = new System.Drawing.Size(182, 22);
this.cmExtractWad.Text = "WAD Contents";
this.cmExtractWad.Click += new System.EventHandler(this.cmExtractWad_Click);
//
// cmExtractDol
//
this.cmExtractDol.Name = "cmExtractDol";
this.cmExtractDol.Size = new System.Drawing.Size(152, 22);
this.cmExtractDol.Size = new System.Drawing.Size(182, 22);
this.cmExtractDol.Text = "DOL";
this.cmExtractDol.Click += new System.EventHandler(this.cmOptionsExtract_MouseClick);
//
@ -1384,7 +1414,7 @@ namespace CustomizeMii
this.cmExtractSoundAsBin,
this.cmExtractSoundAsAudio});
this.tsExtractSound.Name = "tsExtractSound";
this.tsExtractSound.Size = new System.Drawing.Size(152, 22);
this.tsExtractSound.Size = new System.Drawing.Size(182, 22);
this.tsExtractSound.Text = "Sound";
//
// cmExtractSoundAsBin
@ -1408,7 +1438,7 @@ namespace CustomizeMii
this.cmExtractIconImages,
this.cmExtractBothImages});
this.tsExtractImages.Name = "tsExtractImages";
this.tsExtractImages.Size = new System.Drawing.Size(152, 22);
this.tsExtractImages.Size = new System.Drawing.Size(182, 22);
this.tsExtractImages.Text = "Images";
//
// cmExtractBannerImages
@ -1432,6 +1462,37 @@ namespace CustomizeMii
this.cmExtractBothImages.Text = "Both";
this.cmExtractBothImages.Click += new System.EventHandler(this.cmOptionsExtract_MouseClick);
//
// tsExtractBrl
//
this.tsExtractBrl.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.cmExtractBrlyt,
this.cmExtractBrlan,
this.cmExtractBothBrl});
this.tsExtractBrl.Name = "tsExtractBrl";
this.tsExtractBrl.Size = new System.Drawing.Size(182, 22);
this.tsExtractBrl.Text = "Layout && Animation";
//
// cmExtractBrlyt
//
this.cmExtractBrlyt.Name = "cmExtractBrlyt";
this.cmExtractBrlyt.Size = new System.Drawing.Size(109, 22);
this.cmExtractBrlyt.Text = "brlyt\'s";
this.cmExtractBrlyt.Click += new System.EventHandler(this.cmOptionsExtract_MouseClick);
//
// cmExtractBrlan
//
this.cmExtractBrlan.Name = "cmExtractBrlan";
this.cmExtractBrlan.Size = new System.Drawing.Size(109, 22);
this.cmExtractBrlan.Text = "brlan\'s";
this.cmExtractBrlan.Click += new System.EventHandler(this.cmOptionsExtract_MouseClick);
//
// cmExtractBothBrl
//
this.cmExtractBothBrl.Name = "cmExtractBothBrl";
this.cmExtractBothBrl.Size = new System.Drawing.Size(109, 22);
this.cmExtractBothBrl.Text = "Both";
this.cmExtractBothBrl.Click += new System.EventHandler(this.cmOptionsExtract_MouseClick);
//
// cmSound
//
this.cmSound.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
@ -1648,6 +1709,12 @@ namespace CustomizeMii
private System.Windows.Forms.Label lbForwardMiiVersion;
private System.Windows.Forms.Label lbCreated;
private System.Windows.Forms.Label lbCreatedValue;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.ToolStripMenuItem tsExtractBrl;
private System.Windows.Forms.ToolStripMenuItem cmExtractBrlyt;
private System.Windows.Forms.ToolStripMenuItem cmExtractBrlan;
private System.Windows.Forms.ToolStripMenuItem cmExtractBothBrl;
private System.Windows.Forms.LinkLabel llbTranslateChannel;
}
}

View File

@ -45,7 +45,7 @@ namespace CustomizeMii
#endregion
#region Variables
public bool Mono = false;
public static bool Mono = false;
public static string TempPath = Path.GetTempPath() + "CustomizeMii_Temp\\XXX\\";
public static string TempWadPath = Path.GetTempPath() + "CustomizeMii_Temp\\XXX\\TempWad.wad";
public static string TempUnpackPath = Path.GetTempPath() + "CustomizeMii_Temp\\XXX\\Unpack\\";
@ -80,7 +80,6 @@ namespace CustomizeMii
private Progress currentProgress;
private EventHandler ProgressUpdate;
private int UnpackFolderErrorCount = 0;
private Stopwatch CreationTimer = new Stopwatch();
private List<string> BannerTransparents = new List<string>();
private List<string> IconTransparents = new List<string>();
private string Mp3Path;
@ -311,7 +310,9 @@ namespace CustomizeMii
tTip.SetToolTip(btnBrlanExtract, "Extract the selected brlan file...");
tTip.SetToolTip(btnOptionsExtract, "Extract contents of the WAD...");
tTip.SetToolTip(btnForwarder, "Create a forwarder that will be inserted as a DOL...");
tTip.SetToolTip(llbTranslateChannel, "Translates the word \"Channel\" to each language...");
tTip.SetToolTip(cbLz77, "Use Lz77 compression for the banner.bin and icon.bin...\nIf the created WAD does not work, try it without compression first...");
tTip.SetToolTip(cbFailureChecks, "Turn off the security checks...\nNot recommended, you may get a bricking WAD...");
}
@ -324,7 +325,7 @@ namespace CustomizeMii
return false;
}
void rtbInstructions_LinkClicked(object sender, LinkClickedEventArgs e)
private void rtbInstructions_LinkClicked(object sender, LinkClickedEventArgs e)
{
try
{
@ -385,10 +386,6 @@ namespace CustomizeMii
gImg.DrawLine(Pens.Gray, new Point((int)separatorBtn, 0), new Point((int)separatorBtn, btnCreateWad.Height));
//gImg.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixelGridFit;
//gImg.DrawString("Send", btnCreateWad.Font, Brushes.Black, new PointF(95, 10));
//gImg.DrawString("Save", btnCreateWad.Font, Brushes.Black, new PointF(320, 10));
Image tmpCreate = Properties.Resources.btnCreate;
Image tmpSend = Properties.Resources.btnSend;
gImg.DrawImage(ResizeImage(tmpCreate, tmpCreate.Width, tmpCreate.Height), new Point(280, 0));
@ -398,33 +395,11 @@ namespace CustomizeMii
}
}
private void ErrorBox(string message)
{
BoxInvoker invoker = new BoxInvoker(this.errorBox);
this.Invoke(invoker, new object[] { message });
}
private void errorBox(string message)
{
MessageBox.Show(message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
private void InfoBox(string message)
{
BoxInvoker invoker = new BoxInvoker(this.infoBox);
this.Invoke(invoker, new object[] { message });
}
private void infoBox(string message)
{
MessageBox.Show(message, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private bool CheckInet()
{
try
{
System.Net.IPHostEntry IpHost = System.Net.Dns.GetHostEntry("www.google.com");
System.Net.IPHostEntry ipHost = System.Net.Dns.GetHostEntry("www.google.com");
return true;
}
catch
@ -444,220 +419,6 @@ namespace CustomizeMii
}
}
private void AddBannerTpls(object sender, EventArgs e)
{
try
{
string[] BannerTpls;
if (string.IsNullOrEmpty(BannerReplace))
BannerTpls = Directory.GetFiles(TempUnpackBannerTplPath);
else
BannerTpls = Directory.GetFiles(TempBannerPath + "arc\\timg");
AddBannerTpls(BannerTpls);
}
catch { }
}
private void AddIconTpls(object sender, EventArgs e)
{
try
{
string[] IconTpls;
if (string.IsNullOrEmpty(IconReplace))
IconTpls = Directory.GetFiles(TempUnpackIconTplPath);
else
IconTpls = Directory.GetFiles(TempIconPath + "arc\\timg");
AddIconTpls(IconTpls);
}
catch { }
}
private void AddBannerTpls(string[] tpls)
{
if (tpls.Length > 0)
{
lbxBannerTpls.Items.Clear();
BannerTplPath = tpls[0].Remove(tpls[0].LastIndexOf('\\') + 1);
for (int i = 0; i < tpls.Length; i++)
{
if (BannerTransparents.Contains(tpls[i].Remove(0, tpls[i].LastIndexOf('\\') + 1)))
lbxBannerTpls.Items.Add(tpls[i].Remove(0, tpls[i].LastIndexOf('\\') + 1) + " (Transparent)");
else
lbxBannerTpls.Items.Add(tpls[i].Remove(0, tpls[i].LastIndexOf('\\') + 1));
}
}
}
private void AddIconTpls(string[] tpls)
{
if (tpls.Length > 0)
{
lbxIconTpls.Items.Clear();
IconTplPath = tpls[0].Remove(tpls[0].LastIndexOf('\\') + 1);
for (int i = 0; i < tpls.Length; i++)
{
if (IconTransparents.Contains(tpls[i].Remove(0, tpls[i].LastIndexOf('\\') + 1)))
lbxIconTpls.Items.Add(tpls[i].Remove(0, tpls[i].LastIndexOf('\\') + 1) + " (Transparent)");
else
lbxIconTpls.Items.Add(tpls[i].Remove(0, tpls[i].LastIndexOf('\\') + 1));
}
}
}
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)
{
lbxBrlytBanner.Items.Clear();
BannerBrlytPath = brlyt[0].Remove(brlyt[0].LastIndexOf('\\') + 1);
for (int i = 0; i < brlyt.Length; i++)
{
lbxBrlytBanner.Items.Add(brlyt[i].Remove(0, brlyt[i].LastIndexOf('\\') + 1));
}
}
}
private void AddIconBrlyt(string[] brlyt)
{
if (brlyt.Length > 0)
{
lbxBrlytIcon.Items.Clear();
IconBrlytPath = brlyt[0].Remove(brlyt[0].LastIndexOf('\\') + 1);
for (int i = 0; i < brlyt.Length; i++)
{
lbxBrlytIcon.Items.Add(brlyt[i].Remove(0, brlyt[i].LastIndexOf('\\') + 1));
}
}
}
private void AddBannerBrlan(string[] brlan)
{
if (brlan.Length > 0)
{
lbxBrlanBanner.Items.Clear();
BannerBrlanPath = brlan[0].Remove(brlan[0].LastIndexOf('\\') + 1);
for (int i = 0; i < brlan.Length; i++)
{
lbxBrlanBanner.Items.Add(brlan[i].Remove(0, brlan[i].LastIndexOf('\\') + 1));
}
}
}
private void AddIconBrlan(string[] brlan)
{
if (brlan.Length > 0)
{
lbxBrlanIcon.Items.Clear();
IconBrlanPath = brlan[0].Remove(brlan[0].LastIndexOf('\\') + 1);
for (int i = 0; i < brlan.Length; i++)
{
lbxBrlanIcon.Items.Add(brlan[i].Remove(0, brlan[i].LastIndexOf('\\') + 1));
}
}
}
private void SetText(TextBox tb, string text)
{
SetTextInvoker invoker = new SetTextInvoker(this.SetText);
this.Invoke(invoker, text, tb);
}
private void SetText(string text, TextBox tb)
{
tb.Text = text;
}
private void SetLabel(Label lb, string text)
{
SetLabelInvoker invoker = new SetLabelInvoker(this.SetLabel);
this.Invoke(invoker, text, lb);
}
private void SetLabel(string text, Label lb)
{
lb.Text = text;
}
private string GetCurBannerPath()
{
if (string.IsNullOrEmpty(BannerReplace))
return TempUnpackPath + "00000000.app_OUT\\meta\\banner.bin_OUT\\arc\\";
else
return TempBannerPath + "arc\\";
}
private string GetCurIconPath()
{
if (string.IsNullOrEmpty(IconReplace))
return TempUnpackPath + "00000000.app_OUT\\meta\\icon.bin_OUT\\arc\\";
else
return TempIconPath + "arc\\";
}
private void SetSourceWad(object sender, EventArgs e)
{
tbSourceWad.Text = SourceWad;
@ -756,7 +517,7 @@ namespace CustomizeMii
}
}
void tmrCredits_Tick(object sender, EventArgs e)
private void tmrCredits_Tick(object sender, EventArgs e)
{
if (lbCreditThanks.Location.Y == -130) lbCreditThanks.Location = new Point(lbCreditThanks.Location.X, panCredits.Height);
lbCreditThanks.Location = new Point(lbCreditThanks.Location.X, lbCreditThanks.Location.Y - 1);
@ -839,84 +600,6 @@ namespace CustomizeMii
}
}
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 MakeBannerTplsTransparent()
{
foreach (string thisTpl in lbxBannerTpls.Items)
{
if (thisTpl.EndsWith("(Transparent)"))
{
string Tpl = BannerTplPath + thisTpl.Replace(" (Transparent)", string.Empty);
byte[] TplArray = Wii.Tools.LoadFileToByteArray(Tpl);
int Width = Wii.TPL.GetTextureWidth(TplArray);
int Height = Wii.TPL.GetTextureHeight(TplArray);
Image Img = new Bitmap(Width, Height);
Wii.TPL.ConvertToTPL(Img, Tpl, 5);
}
}
}
private void MakeIconTplsTransparent()
{
foreach (string thisTpl in lbxIconTpls.Items)
{
if (thisTpl.EndsWith("(Transparent)"))
{
string Tpl = IconTplPath + thisTpl.Replace(" (Transparent)", string.Empty);
byte[] TplArray = Wii.Tools.LoadFileToByteArray(Tpl);
int Width = Wii.TPL.GetTextureWidth(TplArray);
int Height = Wii.TPL.GetTextureHeight(TplArray);
Image Img = new Bitmap(Width, Height);
Wii.TPL.ConvertToTPL(Img, Tpl, 5);
}
}
}
private void EnableControls(object sender, EventArgs e)
{
for (int i = 0; i < tabControl.TabCount; i++)
{
if (tabControl.TabPages[i] != tabSource)
{
foreach (Control Ctrl in tabControl.TabPages[i].Controls)
{
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.Tag != (object)"Independent") Ctrl.Enabled = true;
else if (Ctrl is ComboBox) Ctrl.Enabled = true;
}
}
}
}
private void DisableControls(object sender, EventArgs e)
{
for (int i = 0; i < tabControl.TabCount; i++)
{
if (tabControl.TabPages[i] != tabSource)
{
foreach (Control Ctrl in tabControl.TabPages[i].Controls)
{
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.Tag != (object)"Independent") Ctrl.Enabled = false;
else if (Ctrl is ComboBox) Ctrl.Enabled = false;
}
}
}
}
private void UpdateCheck()
{
if (CheckInet() == true)
@ -1012,9 +695,9 @@ namespace CustomizeMii
{
if (lbxBaseWads.SelectedIndex != -1)
{
if (CheckInet() == true)
if (pbProgress.Value == 100)
{
if (pbProgress.Value == 100)
if (CheckInet() == true)
{
#if Mono
CommonKeyCheck();
@ -1043,11 +726,10 @@ namespace CustomizeMii
}
}
}
}
else
{
ErrorBox("You're not connected to the Internet!");
else
{
ErrorBox("You're not connected to the Internet!");
}
}
}
}
@ -2187,32 +1869,40 @@ namespace CustomizeMii
{
if (!string.IsNullOrEmpty(tbSourceWad.Text))
{
if (cbFailureChecks.Checked == true || FailureCheck() == true)
if (!File.Exists(Application.StartupPath + "\\CustomizeMiiInstaller.dll"))
{
try
ErrorBox("The CustomizeMiiInstaller.dll wasn't found!");
}
else
{
if (cbFailureChecks.Checked == true || FailureCheck() == true)
{
WadCreationInfo wadInfo = new WadCreationInfo();
wadInfo.outFile = TempPath + "SendToWii.wad";
wadInfo.nandLoader = (WadCreationInfo.NandLoader)cmbNandLoader.SelectedIndex;
wadInfo.sendToWii = true;
CustomizeMii_Transmit cmt = new CustomizeMii_Transmit();
BackgroundWorker bwCreateWad = new BackgroundWorker();
bwCreateWad.DoWork += new DoWorkEventHandler(bwCreateWad_DoWork);
bwCreateWad.ProgressChanged += new ProgressChangedEventHandler(bwCreateWad_ProgressChanged);
bwCreateWad.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bwCreateWad_RunWorkerCompleted);
bwCreateWad.WorkerReportsProgress = true;
bwCreateWad.RunWorkerAsync(wadInfo);
if (cmt.ShowDialog() == DialogResult.OK)
{
try
{
WadCreationInfo wadInfo = new WadCreationInfo();
wadInfo.outFile = TempPath + "SendToWii.wad";
wadInfo.nandLoader = (WadCreationInfo.NandLoader)cmbNandLoader.SelectedIndex;
wadInfo.sendToWii = true;
wadInfo.transmitProtocol = (TransmitProtocol)cmt.Protocol;
wadInfo.transmitIp = cmt.IPAddress;
wadInfo.transmitIos = int.Parse(cmt.IOS);
// @WiiCrazy: The WAD will be saved to >> TempTempPath + "SendToWii.wad" <<
// here. Now a loop that waits for the BackgroundWorker to finish and then opens
// a new window (wiiload - window or whatever) ?!
// If it finishes successfully, the variable >> sendWadReady << will turn into 1,
// if it errors, it will turn into -1, as long as it's running it is 0.
}
catch (Exception ex)
{
ErrorBox(ex.Message);
BackgroundWorker bwCreateWad = new BackgroundWorker();
bwCreateWad.DoWork += new DoWorkEventHandler(bwCreateWad_DoWork);
bwCreateWad.ProgressChanged += new ProgressChangedEventHandler(bwCreateWad_ProgressChanged);
bwCreateWad.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bwCreateWad_RunWorkerCompleted);
bwCreateWad.WorkerReportsProgress = true;
bwCreateWad.RunWorkerAsync(wadInfo);
}
catch (Exception ex)
{
ErrorBox(ex.Message);
}
}
}
}
}
@ -2934,6 +2624,46 @@ namespace CustomizeMii
}
catch (Exception ex) { ErrorBox(ex.Message); }
}
else if (cmSender.OwnerItem == tsExtractBrl)
{
try
{
FolderBrowserDialog fbd = new FolderBrowserDialog();
fbd.Description = "Select the path where the files will be extracted to.";
if (fbd.ShowDialog() == DialogResult.OK)
{
if (cmSender == cmExtractBrlyt || cmSender == cmExtractBothBrl)
{
//Extract brlyts
string[] bannerFiles = Directory.GetFiles(GetCurBannerPath() + "blyt", "*.brlyt");
string[] iconFiles = Directory.GetFiles(GetCurIconPath() + "blyt", "*.brlyt");
foreach (string thisFile in bannerFiles)
File.Copy(thisFile, fbd.SelectedPath + "\\" + Path.GetFileName(thisFile),true);
foreach (string thisFile in iconFiles)
File.Copy(thisFile, fbd.SelectedPath + "\\" + Path.GetFileName(thisFile), true);
}
if (cmSender == cmExtractBothBrl || cmSender == cmExtractBrlan)
{
//Extract brlans
string[] bannerFiles = Directory.GetFiles(GetCurBannerPath() + "anim", "*.brlan");
string[] iconFiles = Directory.GetFiles(GetCurIconPath() + "anim", "*.brlan");
foreach (string thisFile in bannerFiles)
File.Copy(thisFile, fbd.SelectedPath + "\\" + Path.GetFileName(thisFile), true);
foreach (string thisFile in iconFiles)
File.Copy(thisFile, fbd.SelectedPath + "\\" + Path.GetFileName(thisFile), true);
}
InfoBox("Extracted files successfully!");
}
}
catch (Exception ex) { ErrorBox(ex.Message); }
}
else //DOL
{
try
@ -3163,5 +2893,49 @@ namespace CustomizeMii
ErrorBox(ex.Message);
}
}
private void llbTranslateChannel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
if (!tbAllLanguages.Text.ToLower().Contains("channel"))
{
tbAllLanguages.Focus();
tbAllLanguages.SelectAll();
return;
}
string tempText = tbAllLanguages.Text;
int startIndex = tempText.ToLower().IndexOf("channel");
try
{
tbEnglish.Text = tempText.Remove(startIndex, 7).Insert(startIndex, "Channel");
tbJapanese.Text = tempText.Remove(startIndex, 7).Insert(startIndex, "チャンネル");
tbGerman.Text = tempText.Remove(startIndex, 7).Insert(startIndex, "Kanal");
tbDutch.Text = tempText.Remove(startIndex, 7).Insert(startIndex, "Kanaal");
if (tempText[startIndex - 1] != ' ') tbFrench.Text = tempText.Remove(startIndex, 7).Insert(0, "Chaîne ");
else tbFrench.Text = tempText.Remove(startIndex - 1, 8).Insert(0, "Chaîne ");
if (tempText[startIndex - 1] != ' ') tbSpanish.Text = tempText.Remove(startIndex, 7).Insert(0, "Canal ");
else tbSpanish.Text = tempText.Remove(startIndex - 1, 8).Insert(0, "Canal ");
if (tempText[startIndex - 1] != ' ') tbItalian.Text = tempText.Remove(startIndex, 7).Insert(0, "Canale ");
else tbItalian.Text = tempText.Remove(startIndex - 1, 8).Insert(0, "Canale ");
tbAllLanguages.Text = string.Empty;
}
catch (Exception ex)
{
tbAllLanguages.Text = tempText;
tbEnglish.Text = string.Empty;
tbJapanese.Text = string.Empty;
tbGerman.Text = string.Empty;
tbFrench.Text = string.Empty;
tbSpanish.Text = string.Empty;
tbItalian.Text = string.Empty;
tbDutch.Text = string.Empty;
ErrorBox(ex.Message);
}
}
}
}

View File

@ -1,4 +1,21 @@
using System;
/* This file is part of CustomizeMii
* Copyright (C) 2009 Leathl
*
* CustomizeMii is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CustomizeMii is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Windows.Forms;
using System.ComponentModel;
using System.IO;
@ -8,6 +25,334 @@ namespace CustomizeMii
{
partial class CustomizeMii_Main
{
private void FixTpls()
{
string[] bannerTpls = Directory.GetFiles(GetCurBannerPath() + "timg\\", "*.tpl");
string[] iconTpls = Directory.GetFiles(GetCurIconPath() + "timg\\", "*.tpl");
foreach (string thisTpl in bannerTpls)
Wii.TPL.FixFilter(thisTpl);
foreach (string thisTpl in iconTpls)
Wii.TPL.FixFilter(thisTpl);
}
private void EnableControls(object sender, EventArgs e)
{
for (int i = 0; i < tabControl.TabCount; i++)
{
if (tabControl.TabPages[i] != tabSource)
{
foreach (Control Ctrl in tabControl.TabPages[i].Controls)
{
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.Tag != (object)"Independent") Ctrl.Enabled = true;
else if (Ctrl is ComboBox) Ctrl.Enabled = true;
else if (Ctrl is LinkLabel && Ctrl.Tag != (object)"Independent") Ctrl.Enabled = true;
}
}
}
}
private void DisableControls(object sender, EventArgs e)
{
for (int i = 0; i < tabControl.TabCount; i++)
{
if (tabControl.TabPages[i] != tabSource)
{
foreach (Control Ctrl in tabControl.TabPages[i].Controls)
{
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.Tag != (object)"Independent") Ctrl.Enabled = false;
else if (Ctrl is ComboBox) Ctrl.Enabled = false;
else if (Ctrl is LinkLabel && Ctrl.Tag != (object)"Independent") Ctrl.Enabled = false;
}
}
}
}
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 string GetCurBannerPath()
{
if (string.IsNullOrEmpty(BannerReplace))
return TempUnpackPath + "00000000.app_OUT\\meta\\banner.bin_OUT\\arc\\";
else
return TempBannerPath + "arc\\";
}
private string GetCurIconPath()
{
if (string.IsNullOrEmpty(IconReplace))
return TempUnpackPath + "00000000.app_OUT\\meta\\icon.bin_OUT\\arc\\";
else
return TempIconPath + "arc\\";
}
private void SetText(TextBox tb, string text)
{
SetTextInvoker invoker = new SetTextInvoker(this.SetText);
this.Invoke(invoker, text, tb);
}
private void SetText(string text, TextBox tb)
{
tb.Text = text;
}
private void SetLabel(Label lb, string text)
{
SetLabelInvoker invoker = new SetLabelInvoker(this.SetLabel);
this.Invoke(invoker, text, lb);
}
private void SetLabel(string text, Label lb)
{
lb.Text = text;
}
private void AddBannerTpls(object sender, EventArgs e)
{
try
{
string[] BannerTpls;
if (string.IsNullOrEmpty(BannerReplace))
BannerTpls = Directory.GetFiles(TempUnpackBannerTplPath);
else
BannerTpls = Directory.GetFiles(TempBannerPath + "arc\\timg");
AddBannerTpls(BannerTpls);
}
catch { }
}
private void AddIconTpls(object sender, EventArgs e)
{
try
{
string[] IconTpls;
if (string.IsNullOrEmpty(IconReplace))
IconTpls = Directory.GetFiles(TempUnpackIconTplPath);
else
IconTpls = Directory.GetFiles(TempIconPath + "arc\\timg");
AddIconTpls(IconTpls);
}
catch { }
}
private void AddBannerTpls(string[] tpls)
{
if (tpls.Length > 0)
{
lbxBannerTpls.Items.Clear();
BannerTplPath = tpls[0].Remove(tpls[0].LastIndexOf('\\') + 1);
for (int i = 0; i < tpls.Length; i++)
{
if (BannerTransparents.Contains(tpls[i].Remove(0, tpls[i].LastIndexOf('\\') + 1)))
lbxBannerTpls.Items.Add(tpls[i].Remove(0, tpls[i].LastIndexOf('\\') + 1) + " (Transparent)");
else
lbxBannerTpls.Items.Add(tpls[i].Remove(0, tpls[i].LastIndexOf('\\') + 1));
}
}
}
private void AddIconTpls(string[] tpls)
{
if (tpls.Length > 0)
{
lbxIconTpls.Items.Clear();
IconTplPath = tpls[0].Remove(tpls[0].LastIndexOf('\\') + 1);
for (int i = 0; i < tpls.Length; i++)
{
if (IconTransparents.Contains(tpls[i].Remove(0, tpls[i].LastIndexOf('\\') + 1)))
lbxIconTpls.Items.Add(tpls[i].Remove(0, tpls[i].LastIndexOf('\\') + 1) + " (Transparent)");
else
lbxIconTpls.Items.Add(tpls[i].Remove(0, tpls[i].LastIndexOf('\\') + 1));
}
}
}
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)
{
lbxBrlytBanner.Items.Clear();
BannerBrlytPath = brlyt[0].Remove(brlyt[0].LastIndexOf('\\') + 1);
for (int i = 0; i < brlyt.Length; i++)
{
lbxBrlytBanner.Items.Add(brlyt[i].Remove(0, brlyt[i].LastIndexOf('\\') + 1));
}
}
}
private void AddIconBrlyt(string[] brlyt)
{
if (brlyt.Length > 0)
{
lbxBrlytIcon.Items.Clear();
IconBrlytPath = brlyt[0].Remove(brlyt[0].LastIndexOf('\\') + 1);
for (int i = 0; i < brlyt.Length; i++)
{
lbxBrlytIcon.Items.Add(brlyt[i].Remove(0, brlyt[i].LastIndexOf('\\') + 1));
}
}
}
private void AddBannerBrlan(string[] brlan)
{
if (brlan.Length > 0)
{
lbxBrlanBanner.Items.Clear();
BannerBrlanPath = brlan[0].Remove(brlan[0].LastIndexOf('\\') + 1);
for (int i = 0; i < brlan.Length; i++)
{
lbxBrlanBanner.Items.Add(brlan[i].Remove(0, brlan[i].LastIndexOf('\\') + 1));
}
}
}
private void AddIconBrlan(string[] brlan)
{
if (brlan.Length > 0)
{
lbxBrlanIcon.Items.Clear();
IconBrlanPath = brlan[0].Remove(brlan[0].LastIndexOf('\\') + 1);
for (int i = 0; i < brlan.Length; i++)
{
lbxBrlanIcon.Items.Add(brlan[i].Remove(0, brlan[i].LastIndexOf('\\') + 1));
}
}
}
private void ErrorBox(string message)
{
BoxInvoker invoker = new BoxInvoker(this.errorBox);
this.Invoke(invoker, new object[] { message });
}
private void errorBox(string message)
{
MessageBox.Show(message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
private void InfoBox(string message)
{
BoxInvoker invoker = new BoxInvoker(this.infoBox);
this.Invoke(invoker, new object[] { message });
}
private void infoBox(string message)
{
MessageBox.Show(message, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void MakeBannerTplsTransparent()
{
foreach (string thisTpl in lbxBannerTpls.Items)
{
if (thisTpl.EndsWith("(Transparent)"))
{
string Tpl = GetCurBannerPath() + "timg\\" + thisTpl.Replace(" (Transparent)", string.Empty);
byte[] TplArray = Wii.Tools.LoadFileToByteArray(Tpl);
int Width = Wii.TPL.GetTextureWidth(TplArray);
int Height = Wii.TPL.GetTextureHeight(TplArray);
Image Img = new Bitmap(Width, Height);
Wii.TPL.ConvertToTPL(Img, Tpl, 5);
}
}
}
private void MakeIconTplsTransparent()
{
foreach (string thisTpl in lbxIconTpls.Items)
{
if (thisTpl.EndsWith("(Transparent)"))
{
string Tpl = GetCurIconPath() + "timg\\" + thisTpl.Replace(" (Transparent)", string.Empty);
byte[] TplArray = Wii.Tools.LoadFileToByteArray(Tpl);
int Width = Wii.TPL.GetTextureWidth(TplArray);
int Height = Wii.TPL.GetTextureHeight(TplArray);
Image Img = new Bitmap(Width, Height);
Wii.TPL.ConvertToTPL(Img, Tpl, 5);
}
}
}
private void AddTpl(ListBox lbx)
{
AddTpl(lbx, null);
@ -92,7 +437,7 @@ namespace CustomizeMii
private void LoadChannel(string inputFile)
{
if (this.Mono) CommonKeyCheck();
if (Mono) CommonKeyCheck();
if (pbProgress.Value == 100)
{

View File

@ -14,9 +14,23 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace CustomizeMii
namespace CustomizeMii
{
public struct TransmitInfo
{
public bool usedCompression;
public double compressionRatio;
public double transmittedLength;
public int timeElapsed;
}
public enum TransmitProtocol : int
{
JODI = 0,
HAXX = 1
}
public struct BnsConversionInfo
{
public enum LoopType
@ -43,6 +57,10 @@
public string outFile;
public NandLoader nandLoader;
public bool sendToWii;
public TransmitProtocol transmitProtocol;
public string transmitIp;
public int transmitIos;
public bool saveAfterTransmit;
}
public struct Progress

View File

@ -0,0 +1,168 @@
/* This file is part of CustomizeMii
* Copyright (C) 2009 Leathl
*
* CustomizeMii is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CustomizeMii is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace CustomizeMii
{
partial class CustomizeMii_Transmit
{
/// <summary>
/// Erforderliche Designervariable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Verwendete Ressourcen bereinigen.
/// </summary>
/// <param name="disposing">True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Vom Windows Form-Designer generierter Code
/// <summary>
/// Erforderliche Methode für die Designerunterstützung.
/// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
/// </summary>
private void InitializeComponent()
{
this.lbProtocol = new System.Windows.Forms.Label();
this.cmbProtocol = new System.Windows.Forms.ComboBox();
this.lbIP = new System.Windows.Forms.Label();
this.tbIP = new System.Windows.Forms.TextBox();
this.lbIOS = new System.Windows.Forms.Label();
this.tbIOS = new System.Windows.Forms.TextBox();
this.btnTransmit = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// lbProtocol
//
this.lbProtocol.AutoSize = true;
this.lbProtocol.Location = new System.Drawing.Point(12, 16);
this.lbProtocol.Name = "lbProtocol";
this.lbProtocol.Size = new System.Drawing.Size(49, 13);
this.lbProtocol.TabIndex = 0;
this.lbProtocol.Text = "Protocol:";
//
// cmbProtocol
//
this.cmbProtocol.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbProtocol.FormattingEnabled = true;
this.cmbProtocol.Items.AddRange(new object[] {
"Homebrewchannel 1.0.5+ (JODI)",
"Homebrewchannel -1.0.4 (HAXX)"});
this.cmbProtocol.Location = new System.Drawing.Point(67, 13);
this.cmbProtocol.Name = "cmbProtocol";
this.cmbProtocol.Size = new System.Drawing.Size(194, 21);
this.cmbProtocol.TabIndex = 1;
//
// lbIP
//
this.lbIP.AutoSize = true;
this.lbIP.Location = new System.Drawing.Point(12, 48);
this.lbIP.Name = "lbIP";
this.lbIP.Size = new System.Drawing.Size(61, 13);
this.lbIP.TabIndex = 2;
this.lbIP.Text = "IP Address:";
//
// tbIP
//
this.tbIP.Location = new System.Drawing.Point(79, 45);
this.tbIP.Name = "tbIP";
this.tbIP.Size = new System.Drawing.Size(182, 20);
this.tbIP.TabIndex = 3;
//
// lbIOS
//
this.lbIOS.AutoSize = true;
this.lbIOS.Location = new System.Drawing.Point(12, 78);
this.lbIOS.Name = "lbIOS";
this.lbIOS.Size = new System.Drawing.Size(127, 13);
this.lbIOS.TabIndex = 4;
this.lbIOS.Text = "IOS to use for installation:";
//
// tbIOS
//
this.tbIOS.Location = new System.Drawing.Point(145, 75);
this.tbIOS.Name = "tbIOS";
this.tbIOS.Size = new System.Drawing.Size(116, 20);
this.tbIOS.TabIndex = 5;
this.tbIOS.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.tbIOS_KeyPress);
//
// btnTransmit
//
this.btnTransmit.Location = new System.Drawing.Point(15, 109);
this.btnTransmit.Name = "btnTransmit";
this.btnTransmit.Size = new System.Drawing.Size(120, 23);
this.btnTransmit.TabIndex = 6;
this.btnTransmit.Text = "Transmit";
this.btnTransmit.UseVisualStyleBackColor = true;
this.btnTransmit.Click += new System.EventHandler(this.btnTransmit_Click);
//
// btnCancel
//
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point(141, 109);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(120, 23);
this.btnCancel.TabIndex = 6;
this.btnCancel.Text = "Cancel";
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// CustomizeMii_Transmit
//
this.AcceptButton = this.btnTransmit;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(273, 145);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnTransmit);
this.Controls.Add(this.tbIOS);
this.Controls.Add(this.lbIOS);
this.Controls.Add(this.tbIP);
this.Controls.Add(this.lbIP);
this.Controls.Add(this.cmbProtocol);
this.Controls.Add(this.lbProtocol);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "CustomizeMii_Transmit";
this.Text = "CustomizeMii_Transmit";
this.Load += new System.EventHandler(this.CustomizeMii_Transmit_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label lbProtocol;
private System.Windows.Forms.ComboBox cmbProtocol;
private System.Windows.Forms.Label lbIP;
private System.Windows.Forms.TextBox tbIP;
private System.Windows.Forms.Label lbIOS;
private System.Windows.Forms.TextBox tbIOS;
private System.Windows.Forms.Button btnTransmit;
private System.Windows.Forms.Button btnCancel;
}
}

View File

@ -0,0 +1,91 @@
/* This file is part of CustomizeMii
* Copyright (C) 2009 Leathl
*
* CustomizeMii is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CustomizeMii is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System.Text.RegularExpressions;
using System.Windows.Forms;
namespace CustomizeMii
{
public partial class CustomizeMii_Transmit : Form
{
public int Protocol { get { return cmbProtocol.SelectedIndex; } set { cmbProtocol.SelectedIndex = value; } }
public string IPAddress { get { return tbIP.Text; } set { tbIP.Text = value; } }
public string IOS { get { return tbIOS.Text; } set { tbIOS.Text = value; } }
public CustomizeMii_Transmit()
{
InitializeComponent();
this.CenterToParent();
}
private void CustomizeMii_Transmit_Load(object sender, System.EventArgs e)
{
try
{
cmbProtocol.SelectedIndex = Properties.Settings.Default.Protocol;
tbIP.Text = Properties.Settings.Default.IP;
tbIOS.Text = Properties.Settings.Default.IOS;
}
catch { }
}
private void btnCancel_Click(object sender, System.EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
this.Close();
}
private void btnTransmit_Click(object sender, System.EventArgs e)
{
string IpPattern = @"([01]?\d\d?|2[0-4]\d|25[0-5])\." +
@"([01]?\d\d?|2[0-4]\d|25[0-5])\." +
@"([01]?\d\d?|2[0-4]\d|25[0-5])\." +
@"([01]?\d\d?|2[0-4]\d|25[0-5])";
Regex IpAdress = new Regex(IpPattern);
if (IpAdress.IsMatch(tbIP.Text))
{
int tmp = int.Parse(tbIOS.Text);
if (tmp > 0 && tmp < 255)
{
Properties.Settings.Default.Protocol = cmbProtocol.SelectedIndex;
Properties.Settings.Default.IP = tbIP.Text;
Properties.Settings.Default.IOS = tbIOS.Text;
Properties.Settings.Default.Save();
this.DialogResult = DialogResult.OK;
this.Close();
}
else
{
tbIOS.Focus();
tbIOS.SelectAll();
}
}
else
{
tbIP.Focus();
tbIP.SelectAll();
}
}
private void tbIOS_KeyPress(object sender, KeyPressEventArgs e)
{
e.Handled = !char.IsDigit(e.KeyChar) && e.KeyChar != '\b';
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,59 @@
/* This file is part of TransmitMii
* Copyright (C) 2009 Leathl
*
* TransmitMii 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.
*
* TransmitMii is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.IO;
using System.Runtime.InteropServices;
namespace TransmitMii
{
public static class zlib
{
public enum ZLibError : int
{
Z_OK = 0,
Z_STREAM_END = 1,
Z_NEED_DICT = 2,
Z_ERRNO = (-1),
Z_STREAM_ERROR = (-2),
Z_DATA_ERROR = (-3),
Z_MEM_ERROR = (-4),
Z_BUF_ERROR = (-5),
Z_VERSION_ERROR = (-6)
}
[DllImport("zlib1.dll")]
private static extern ZLibError compress2(byte[] dest, ref int destLength, byte[] source, int sourceLength, int level);
public static byte[] Compress(byte[] inFile)
{
ZLibError err;
byte[] outFile = new byte[inFile.Length];
int outLength = -1;
err = compress2(outFile, ref outLength, inFile, inFile.Length, 6);
if (err == ZLibError.Z_OK && outLength > -1)
{
Array.Resize(ref outFile, outLength);
return outFile;
}
else
throw new Exception("An error occured while compressing! Code: " + err.ToString());
}
}
}

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
//------------------------------------------------------------------------------
// <auto-generated>
// Dieser Code wurde von einem Tool generiert.
// Laufzeitversion:2.0.50727.4927

View File

@ -17,31 +17,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.4927
// Dieser Code wurde von einem Tool generiert.
// Laufzeitversion:2.0.50727.4927
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
// der Code erneut generiert wird.
// </auto-generated>
//------------------------------------------------------------------------------
namespace CustomizeMii.Properties
{
namespace CustomizeMii.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
public static Settings Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0")]
public int Protocol {
get {
return ((int)(this["Protocol"]));
}
set {
this["Protocol"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string IP {
get {
return ((string)(this["IP"]));
}
set {
this["IP"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string IOS {
get {
return ((string)(this["IOS"]));
}
set {
this["IOS"] = value;
}
}
}
}

View File

@ -1,7 +1,15 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="CustomizeMii.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="Protocol" Type="System.Int32" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="IP" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="IOS" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
</Settings>
</SettingsFile>

View File

@ -10,12 +10,14 @@ Thanks to icefire / Xuzz for the basic idea of this Application!
Changelog:
Version 2.1
- Added CustomizeMii Installer (by WiiCrazy / I.R.on)
- Fixed rough edges (artifacts) on images (will be fixed automatically)
- Replaced the TPL preview window with the one from ShowMiiWads for easier handling
- Added loop prelistening to the BNS conversion window (only for wave files)
- Added drag & drop ability cause the file dialogs kept bothering me
- Improvement in startup speed (thanks shadow1643)
- Added Unix timestamp as footer (interesting to know when channels were created, huh?)
- Little improvements
- Added creation/last edited time (only for CustomizeMii 2.1+ channels)
- Little improvements and fixes
Version 2.01
- Base WAD downloading works again
@ -69,6 +71,7 @@ The author can't be held responsible for any damages arising from the use of it.
-----------------------------------------------------------------------------------------
Thanks:
WiiCrazy / I.R.on for CustomizeMii Installer
Xuzz for his idea and hard work
Xuzz, SquidMan, megazig, Matt_P, Omega and The Lemon Man for Wii.py
SquidMan for Zetsubou

View File

@ -683,49 +683,6 @@ namespace Wii
{
string[] titles = new string[7];
//Detection from footer is turned off, cause the footer
//can be easily edited and thus the titles in it could be simply wrong
//int footer = GetFooterSize(wadfile);
//if (footer > 0)
//{
// int footerpos = wadfile.Length - footer;
// int count = 0;
// int imetpos = 0;
// if ((wadfile.Length - (wadfile.Length - footer)) < 250) return new string[7];
// for (int z = 0; z < 250; z++)
// {
// if (Convert.ToChar(wadfile[footerpos + z]) == 'I')
// if (Convert.ToChar(wadfile[footerpos + z + 1]) == 'M')
// if (Convert.ToChar(wadfile[footerpos + z + 2]) == 'E')
// if (Convert.ToChar(wadfile[footerpos + z + 3]) == 'T')
// {
// imetpos = footerpos + z;
// break;
// }
// }
// int jappos = imetpos + 29;
// for (int i = jappos; i < jappos + 588; i += 84)
// {
// for (int j = 0; j < 40; j += 2)
// {
// if (wadfile[i + j] != 0x00)
// {
// char temp = Convert.ToChar(wadfile[i + j]);
// titles[count] += temp;
// }
// }
// count++;
// }
// return titles;
//}
string[,] conts = GetContentInfo(wadfile);
byte[] titlekey = GetTitleKey(wadfile);
int nullapp = 0;
@ -741,36 +698,56 @@ namespace Wii
if (contenthandle.Length < 400) return new string[7];
for (int z = 0; z < 400; z++)
if (!channeltype.Contains("Downloaded"))
{
if (Convert.ToChar(contenthandle[z]) == 'I')
if (Convert.ToChar(contenthandle[z + 1]) == 'M')
if (Convert.ToChar(contenthandle[z + 2]) == 'E')
if (Convert.ToChar(contenthandle[z + 3]) == 'T')
{
imetpos = z;
break;
}
}
int jappos = imetpos + 29;
int count = 0;
for (int i = jappos; i < jappos + 588; i += 84)
{
for (int j = 0; j < 40; j += 2)
for (int z = 0; z < 400; z++)
{
if (contenthandle[i + j] != 0x00)
if (Convert.ToChar(contenthandle[z]) == 'I')
if (Convert.ToChar(contenthandle[z + 1]) == 'M')
if (Convert.ToChar(contenthandle[z + 2]) == 'E')
if (Convert.ToChar(contenthandle[z + 3]) == 'T')
{
imetpos = z;
break;
}
}
int jappos = imetpos + 29;
int count = 0;
for (int i = jappos; i < jappos + 588; i += 84)
{
for (int j = 0; j < 40; j += 2)
{
char temp = BitConverter.ToChar(new byte[] { contenthandle[i + j], contenthandle[i + j - 1] }, 0);
titles[count] += temp;
if (contenthandle[i + j] != 0x00)
{
char temp = BitConverter.ToChar(new byte[] { contenthandle[i + j], contenthandle[i + j - 1] }, 0);
titles[count] += temp;
}
}
count++;
}
return titles;
}
else
{
//DLC's
for (int j = 97; j < 97 + 40; j += 2)
{
if (contenthandle[j] != 0x00)
{
char temp = BitConverter.ToChar(new byte[] { contenthandle[j], contenthandle[j - 1] }, 0);
titles[0] += temp;
}
}
count++;
}
for (int i = 1; i < 7; i++)
titles[i] = titles[0];
return titles;
return titles;
}
}
else return new string[7];
}
@ -1557,45 +1534,45 @@ namespace Wii
if (japchars.Length > count)
{
contenthandle[x + 29] = BitConverter.GetBytes(japchars[count])[0];
contenthandle[x + 30] = BitConverter.GetBytes(japchars[count])[1];
contenthandle[x + 28] = BitConverter.GetBytes(japchars[count])[1];
}
else { contenthandle[x + 29] = 0x00; }
else { contenthandle[x + 29] = 0x00; contenthandle[x + 28] = 0x00; }
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; }
else { contenthandle[x + 29 + 84] = 0x00; contenthandle[x + 29 + 84 - 1] = 0x00; }
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; }
else { contenthandle[x + 29 + 84 * 2] = 0x00; contenthandle[x + 29 + 84 * 2 - 1] = 0x00; }
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; }
else { contenthandle[x + 29 + 84 * 3] = 0x00; contenthandle[x + 29 + 84 * 3 - 1] = 0x00; }
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; }
else { contenthandle[x + 29 + 84 * 4] = 0x00; contenthandle[x + 29 + 84 * 4 - 1] = 0x00; }
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; }
else { contenthandle[x + 29 + 84 * 5] = 0x00; contenthandle[x + 29 + 84 * 5 - 1] = 0x00; }
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; }
else { contenthandle[x + 29 + 84 * 6] = 0x00; contenthandle[x + 29 + 84 * 6 - 1] = 0x00; }
count++;
}
@ -4232,6 +4209,30 @@ namespace Wii
public class TPL
{
/// <summary>
/// Fixes rough edges (artifacts), if necessary
/// </summary>
/// <param name="tplFile"></param>
public static void FixFilter(string tplFile)
{
using (FileStream fs = new FileStream(tplFile, FileMode.Open))
{
fs.Seek(41, SeekOrigin.Begin);
if (fs.ReadByte() == 0x01)
{
fs.Seek(-1, SeekOrigin.Current);
fs.Write(new byte[] { 0x00, 0x00, 0x01 }, 0, 3);
}
fs.Seek(45, SeekOrigin.Begin);
if (fs.ReadByte() == 0x01)
{
fs.Seek(-1, SeekOrigin.Current);
fs.Write(new byte[] { 0x00, 0x00, 0x01 }, 0, 3);
}
}
}
/// <summary>
/// Converts a Tpl to a Bitmap
/// </summary>
@ -4956,7 +4957,7 @@ namespace Wii
UInt16 texwidth = (UInt16)img.Width;
UInt32 texformat;
UInt32 texdataoffset = 0x40;
byte[] rest = new byte[] { 00, 00, 00, 00, 00, 00, 00, 00, 00, 01, 00, 00, 00, 01, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00 };
byte[] rest = new byte[] { 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 01, 00, 00, 00, 01, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00 };
//This should do it for our needs.. rest includes padding
switch (format)
@ -5648,9 +5649,13 @@ namespace Wii
{
string wonum = tpls[i].Remove(tpls[i].LastIndexOf('.') - 1) + "00.tpl";
string wonum2 = tpls[i].Remove(tpls[i].LastIndexOf('.') - 2) + "00.tpl";
string wonum3 = tpls[i].Remove(tpls[i].LastIndexOf('.') - 1) + "01.tpl";
string wonum4 = tpls[i].Remove(tpls[i].LastIndexOf('.') - 2) + "01.tpl";
if (Tools.StringExistsInStringArray(wonum, brlytTpls) == false &&
Tools.StringExistsInStringArray(wonum2, brlytTpls) == false)
Tools.StringExistsInStringArray(wonum2, brlytTpls) == false &&
Tools.StringExistsInStringArray(wonum3, brlytTpls) == false &&
Tools.StringExistsInStringArray(wonum4, brlytTpls) == false)
{
unuseds.Add(tpls[i]);
missing = true;

21
CustomizeMii/app.config Normal file
View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="CustomizeMii.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<userSettings>
<CustomizeMii.Properties.Settings>
<setting name="Protocol" serializeAs="String">
<value>0</value>
</setting>
<setting name="IP" serializeAs="String">
<value />
</setting>
<setting name="IOS" serializeAs="String">
<value />
</setting>
</CustomizeMii.Properties.Settings>
</userSettings>
</configuration>

BIN
CustomizeMii/zlib1.dll Normal file

Binary file not shown.

View File

@ -8,8 +8,8 @@
<ProjectGuid>{475F3ADF-B529-449F-89DA-BA5E8BE15DD5}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Helpers</RootNamespace>
<AssemblyName>Helpers</AssemblyName>
<RootNamespace>CustomizeMiiInstaller</RootNamespace>
<AssemblyName>CustomizeMiiInstaller</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
@ -33,7 +33,6 @@
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="InstallerHelper.cs" />

View File

@ -1,11 +1,25 @@
using System;
using System.Collections.Generic;
using System.Text;
/* This file is part of CustomizeMii
* Copyright (C) 2009 WiiCrazy / I.R.on
*
* CustomizeMii is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CustomizeMii is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System.IO;
using System.IO.Compression;
using System.Security.Cryptography;
namespace Helpers
namespace CustomizeMiiInstaller
{
public class InstallerHelper
{

View File

@ -1,15 +1,32 @@
using System.Reflection;
/* This file is part of CustomizeMii
* Copyright (C) 2009 WiiCrazy / I.R.on
*
* CustomizeMii is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CustomizeMii is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Helpers")]
[assembly: AssemblyTitle("CustomizeMiiInstaller")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Irduco")]
[assembly: AssemblyProduct("Helpers")]
[assembly: AssemblyProduct("CustomizeMiiInstaller")]
[assembly: AssemblyCopyright("Copyright © Irduco 2010")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

View File

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 54 KiB

View File

@ -32,6 +32,22 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Drawing" />

View File

Before

Width:  |  Height:  |  Size: 192 KiB

After

Width:  |  Height:  |  Size: 192 KiB

View File

Before

Width:  |  Height:  |  Size: 192 KiB

After

Width:  |  Height:  |  Size: 192 KiB

View File

Before

Width:  |  Height:  |  Size: 192 KiB

After

Width:  |  Height:  |  Size: 192 KiB

View File

@ -1,88 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
using Helpers;
using System.IO;
using System.IO.Compression;
namespace Tester
{
class Program
{
static void Main(string[] args)
{
string command = args[0];
if (command == "CSTUB")
{
Console.Out.WriteLine("Stub Compression>>");
CompressStub(args[1], args[2]);
}
else if (command == "DSTUB")
{
Console.Out.WriteLine("Stub Decompression>>");
DecompressStub(args[1], args[2]);
}
else if (command == "LOADC")
{
Console.Out.WriteLine("Installer creation>>");
CreateInstaller(args[1], args[2]);
}
}
static void CompressStub(string installerDol, string zippedResourceFileName)
{
using (FileStream fs = new FileStream(installerDol, FileMode.Open))
{
using (FileStream fsOut = new FileStream(zippedResourceFileName, FileMode.Create))
{
using (GZipStream gzip = new GZipStream(fsOut, CompressionMode.Compress))
{
// Copy the source file into the compression stream.
byte[] buffer = new byte[4096];
int numRead;
while ((numRead = fs.Read(buffer, 0, buffer.Length)) != 0)
{
gzip.Write(buffer, 0, numRead);
}
}
}
}
}
public static void DecompressStub(string compressedInstallerDol, string decompressedInstallerDol)
{
// Get the stream of the source file.
using (FileStream inFile = new FileStream(compressedInstallerDol, FileMode.Open))
{
//Create the decompressed file.
using (FileStream outFile = File.Create(decompressedInstallerDol))
{
using (GZipStream Decompress = new GZipStream(inFile,CompressionMode.Decompress))
{
//Copy the decompression stream into the output file.
byte[] buffer = new byte[4096];
int numRead;
while ((numRead = Decompress.Read(buffer, 0, buffer.Length)) != 0)
{
outFile.Write(buffer, 0, numRead);
}
}
}
}
}
static void CreateInstaller(string inWadFilename, string outDolFileName)
{
using (MemoryStream ms = InstallerHelper.CreateInstaller(inWadFilename, 249))
{
using (FileStream fs = new FileStream(outDolFileName, FileMode.Create))
{
ms.WriteTo(fs);
fs.Close();
}
}
}
}
}

View File

@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Tester")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Irduco")]
[assembly: AssemblyProduct("Tester")]
[assembly: AssemblyCopyright("Copyright © Irduco 2010")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("891f8670-dc92-4f81-b010-62634af8b756")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

Some files were not shown because too many files have changed in this diff Show More