2.1 Files again for WiiCrazy, I'm confused :D

git-svn-id: svn://localhost/Users/andi/Downloads/code/trunk@17 eddbe33b-e435-4246-ac25-f5eb65f9a13c
This commit is contained in:
leathl 2009-12-30 17:57:38 +00:00
parent ad58ccbb76
commit 3376e169ba
8 changed files with 187 additions and 45 deletions

View File

@ -27,7 +27,7 @@
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>2.0.0.%2a</ApplicationVersion>
<ApplicationVersion>2.1.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>

View File

@ -25,6 +25,8 @@ namespace CustomizeMii
{
partial class CustomizeMii_Main
{
public int sendWadReady = 0;
private bool sendToWii = false;
private bool internalSound;
void bwBannerReplace_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
@ -542,6 +544,9 @@ namespace CustomizeMii
EventHandler DisableControls = new EventHandler(this.DisableControls);
this.Invoke(DisableControls);
this.sendToWii = wadInfo.sendToWii;
sendWadReady = 0;
bwCreateWad.ReportProgress(0, "Making TPLs transparent");
MakeBannerTplsTransparent();
MakeIconTplsTransparent();
@ -725,13 +730,19 @@ namespace CustomizeMii
bwCreateWad.ReportProgress(100, " ");
CreationTimer.Stop();
if (!sendToWii)
{
FileInfo fi = new FileInfo(wadInfo.outFile);
double fileSize = Math.Round(fi.Length * 0.0009765625 * 0.0009765625, 2);
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;
}
catch (Exception ex)
{
sendWadReady = -1;
CreationTimer.Stop();
EventHandler EnableControls = new EventHandler(this.EnableControls);
this.Invoke(EnableControls);

View File

@ -156,6 +156,7 @@ namespace CustomizeMii
//
// btnCancel
//
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point(186, 179);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(160, 23);
@ -166,8 +167,10 @@ namespace CustomizeMii
//
// CustomizeMii_ComplexForwarder
//
this.AcceptButton = this.btnOK;
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(358, 220);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOK);

View File

@ -139,9 +139,11 @@ namespace CustomizeMii
this.tabInstructions = new System.Windows.Forms.TabPage();
this.rtbInstructions = new System.Windows.Forms.RichTextBox();
this.tabCredits = new System.Windows.Forms.TabPage();
this.lbForwardMiiVersion = new System.Windows.Forms.Label();
this.panCredits = new System.Windows.Forms.Panel();
this.lbCreditThanks = new System.Windows.Forms.Label();
this.llbUpdateAvailabe = new System.Windows.Forms.LinkLabel();
this.llbSite = new System.Windows.Forms.LinkLabel();
this.lbCreditThanks = new System.Windows.Forms.Label();
this.lbCreditVersion = new System.Windows.Forms.Label();
this.lbCreditInfo = new System.Windows.Forms.Label();
this.ssMain = new System.Windows.Forms.StatusStrip();
@ -177,6 +179,7 @@ namespace CustomizeMii
this.tabBrlan.SuspendLayout();
this.tabInstructions.SuspendLayout();
this.tabCredits.SuspendLayout();
this.panCredits.SuspendLayout();
this.ssMain.SuspendLayout();
this.cmForwarder.SuspendLayout();
this.cmOptionsExtract.SuspendLayout();
@ -1185,9 +1188,10 @@ namespace CustomizeMii
//
// tabCredits
//
this.tabCredits.Controls.Add(this.lbForwardMiiVersion);
this.tabCredits.Controls.Add(this.panCredits);
this.tabCredits.Controls.Add(this.llbUpdateAvailabe);
this.tabCredits.Controls.Add(this.llbSite);
this.tabCredits.Controls.Add(this.lbCreditThanks);
this.tabCredits.Controls.Add(this.lbCreditVersion);
this.tabCredits.Controls.Add(this.lbCreditInfo);
this.tabCredits.Location = new System.Drawing.Point(4, 22);
@ -1198,6 +1202,34 @@ namespace CustomizeMii
this.tabCredits.Text = "About";
this.tabCredits.UseVisualStyleBackColor = true;
//
// lbForwardMiiVersion
//
this.lbForwardMiiVersion.Location = new System.Drawing.Point(0, 62);
this.lbForwardMiiVersion.Name = "lbForwardMiiVersion";
this.lbForwardMiiVersion.Size = new System.Drawing.Size(443, 13);
this.lbForwardMiiVersion.TabIndex = 6;
this.lbForwardMiiVersion.Text = "You\'re using Version X of the ForwardMii Plugin";
this.lbForwardMiiVersion.TextAlign = System.Drawing.ContentAlignment.TopCenter;
this.lbForwardMiiVersion.Visible = false;
//
// panCredits
//
this.panCredits.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.panCredits.Controls.Add(this.lbCreditThanks);
this.panCredits.Location = new System.Drawing.Point(0, 94);
this.panCredits.Name = "panCredits";
this.panCredits.Size = new System.Drawing.Size(443, 79);
this.panCredits.TabIndex = 5;
//
// lbCreditThanks
//
this.lbCreditThanks.Location = new System.Drawing.Point(8, 0);
this.lbCreditThanks.Name = "lbCreditThanks";
this.lbCreditThanks.Size = new System.Drawing.Size(427, 150);
this.lbCreditThanks.TabIndex = 2;
this.lbCreditThanks.Text = resources.GetString("lbCreditThanks.Text");
this.lbCreditThanks.TextAlign = System.Drawing.ContentAlignment.TopCenter;
//
// llbUpdateAvailabe
//
this.llbUpdateAvailabe.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
@ -1222,15 +1254,6 @@ namespace CustomizeMii
this.llbSite.TextAlign = System.Drawing.ContentAlignment.TopCenter;
this.llbSite.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.llbSite_LinkClicked);
//
// lbCreditThanks
//
this.lbCreditThanks.Location = new System.Drawing.Point(0, 91);
this.lbCreditThanks.Name = "lbCreditThanks";
this.lbCreditThanks.Size = new System.Drawing.Size(443, 79);
this.lbCreditThanks.TabIndex = 2;
this.lbCreditThanks.Text = resources.GetString("lbCreditThanks.Text");
this.lbCreditThanks.TextAlign = System.Drawing.ContentAlignment.TopCenter;
//
// lbCreditVersion
//
this.lbCreditVersion.Location = new System.Drawing.Point(0, 13);
@ -1460,6 +1483,7 @@ namespace CustomizeMii
this.tabBrlan.PerformLayout();
this.tabInstructions.ResumeLayout(false);
this.tabCredits.ResumeLayout(false);
this.panCredits.ResumeLayout(false);
this.ssMain.ResumeLayout(false);
this.ssMain.PerformLayout();
this.cmForwarder.ResumeLayout(false);
@ -1593,6 +1617,8 @@ namespace CustomizeMii
private System.Windows.Forms.ContextMenuStrip cmDol;
private System.Windows.Forms.ToolStripMenuItem cmLoadDol;
private System.Windows.Forms.ToolStripMenuItem cmDolFromSource;
private System.Windows.Forms.Panel panCredits;
private System.Windows.Forms.Label lbForwardMiiVersion;
}
}

View File

@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
//#define Mono //Change all '\\' to '/' (in all files) while compiling for OS X / Linux (Mono)
//#define Mono //Change all "\\" to "/" (in all files, without quotes) while compiling for OS X / Linux (Mono)
//#define Debug //Always remember to turn off :)
using System;
@ -36,10 +36,11 @@ namespace CustomizeMii
{
public partial class CustomizeMii_Main : Form
{
const string version = "2.01"; //Hint for myself: Never use a char in the Version (UpdateCheck)!
const string version = "2.1"; //Hint for myself: Never use a char in the Version (UpdateCheck)!
const int SoundMaxLength = 30; //In seconds
const int SoundWarningLength = 20; //In seconds
const int BnsWarningLength = 45; //In seconds
const int CreditsScrollSpeed = 85; //Timer Intervall for the scrolling Credits
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\\";
@ -82,6 +83,8 @@ namespace CustomizeMii
private Forwarder.Complex ComplexForwarder = new Forwarder.Complex();
private delegate void BoxInvoker(string message);
private delegate void SetTextInvoker(string text, TextBox tb);
double separatorBtn;
Timer tmrCredits = new Timer();
public CustomizeMii_Main()
{
@ -160,6 +163,13 @@ namespace CustomizeMii
btnBrowseSound.Text = "Browse...";
rtbInstructions.Rtf = Properties.Resources.Instructions;
rtbInstructions.LinkClicked += new LinkClickedEventHandler(rtbInstructions_LinkClicked);
tmrCredits.Interval = CreditsScrollSpeed;
tmrCredits.Tick += new EventHandler(tmrCredits_Tick);
if (File.Exists(Application.StartupPath + "\\ForwardMii.dll") && lbForwardMiiVersion.Tag != (object)"Update")
{
SetForwardMiiLabel();
}
#if !Debug
DisableControls(null, null);
@ -175,6 +185,16 @@ namespace CustomizeMii
catch (Exception ex) { ErrorBox(ex.Message); }
}
private void SetForwardMiiLabel()
{
try
{
lbForwardMiiVersion.Text = lbForwardMiiVersion.Text.Replace("X", ForwardMii_Plugin.GetVersion());
lbForwardMiiVersion.Visible = true;
}
catch { }
}
private void CommonKeyCheck()
{
if (!File.Exists(Application.StartupPath + "\\common-key.bin") && !File.Exists(Application.StartupPath + "\\key.bin"))
@ -257,7 +277,7 @@ namespace CustomizeMii
private void SetToolTips()
{
ToolTip TTip = new ToolTip();
TTip.SetToolTip(btnCreateWad, "Create WAD...");
TTip.SetToolTip(btnCreateWad, "Save WAD or send it directly to the Wii...");
TTip.SetToolTip(btnBrowseSource, "Browse for a WAD that is used as a Base...");
TTip.SetToolTip(btnLoadBaseWad, "Load the selected Base WAD...");
TTip.SetToolTip(btnPreviewBaseWad, "Preview the selected Base WAD, a Browserwindow will be opened...");
@ -339,14 +359,34 @@ namespace CustomizeMii
private void SetButtonText()
{
Random Randomizer = new Random();
btnCreateWad.Text = ButtonTexts[Randomizer.Next(0, ButtonTexts.Length - 1)];
//Random Randomizer = new Random();
//btnCreateWad.Text = ButtonTexts[Randomizer.Next(0, ButtonTexts.Length - 1)];
//if (btnCreateWad.Text == "Image")
//{
// btnCreateWad.Text = string.Empty;
// btnCreateWad.Image = Properties.Resources.btnCreateWad;
//}
if (btnCreateWad.Text == "Image")
{
btnCreateWad.Text = string.Empty;
btnCreateWad.Image = Properties.Resources.btnCreateWad;
}
Image tmpImg = new Bitmap(btnCreateWad.Width, btnCreateWad.Height);
Graphics gImg = Graphics.FromImage(tmpImg);
gImg.Clear(Color.Transparent);
separatorBtn = btnCreateWad.Width * 0.5;
gImg.DrawLine(Pens.Gray, new Point((int)separatorBtn, 0), new Point((int)separatorBtn, btnCreateWad.Height));
string sSend = "Send";
string sSave = "Save";
gImg.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixelGridFit;
gImg.DrawString(sSend, btnCreateWad.Font, Brushes.Black, new PointF(95, 10));
gImg.DrawString(sSave, btnCreateWad.Font, Brushes.Black, new PointF(320, 10));
btnCreateWad.Image = tmpImg;
}
private void ErrorBox(string message)
@ -665,6 +705,8 @@ namespace CustomizeMii
private void tabControl_Selecting(object sender, TabControlCancelEventArgs e)
{
tmrCredits.Stop();
if (tabControl.SelectedTab == tabBanner)
{
lbxBannerTpls.SelectedIndex = -1;
@ -687,6 +729,17 @@ namespace CustomizeMii
{
AddBrlans(null, null);
}
else if (tabControl.SelectedTab == tabCredits)
{
lbCreditThanks.Location = new Point(lbCreditThanks.Location.X, panCredits.Height);
tmrCredits.Start();
}
}
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);
}
private void lbStatusText_TextChanged(object sender, EventArgs e)
@ -863,6 +916,7 @@ namespace CustomizeMii
{
llbUpdateAvailabe.Text = llbUpdateAvailabe.Text.Replace("X", NewVersion);
llbUpdateAvailabe.Visible = true;
lbForwardMiiVersion.Tag = "Update";
if (MessageBox.Show("Version " + NewVersion +
" is availabe.\nDo you want the download page to be opened?",
@ -961,6 +1015,10 @@ namespace CustomizeMii
{
if (pbProgress.Value == 100)
{
#if Mono
CommonKeyCheck();
#endif
if (tbSourceWad.Text != SourceWadUrls[lbxBaseWads.SelectedIndex])
{
try
@ -2189,6 +2247,46 @@ namespace CustomizeMii
}
private void btnCreateWad_Click(object sender, EventArgs e)
{
Point mousePos = MousePosition;
if (mousePos.X < (this.Location.X + btnCreateWad.Location.X + Math.Ceiling(separatorBtn) + 3))
{
if (pbProgress.Value == 100)
{
if (!string.IsNullOrEmpty(tbSourceWad.Text))
{
if (cbFailureChecks.Checked == true || FailureCheck() == true)
{
try
{
WadCreationInfo wadInfo = new WadCreationInfo();
wadInfo.outFile = TempPath + "SendToWii.wad";
wadInfo.nandLoader = (WadCreationInfo.NandLoader)cmbNandLoader.SelectedIndex;
wadInfo.sendToWii = true;
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);
// @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);
}
}
}
}
}
else
{
if (pbProgress.Value == 100)
{
@ -2232,6 +2330,7 @@ namespace CustomizeMii
}
}
}
}
private void lbxBrlytBanner_SelectedIndexChanged(object sender, EventArgs e)
{

View File

@ -123,7 +123,9 @@ 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</value>
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)</value>
</data>
<metadata name="ssMain.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>16, 7</value>

View File

@ -42,6 +42,7 @@
public string outFile;
public NandLoader nandLoader;
public bool sendToWii;
}
public struct Progress

View File

@ -9,8 +9,8 @@ Thanks to icefire / Xuzz for the basic idea of this Application!
-----------------------------------------------------------------------------------------
Changelog:
Version 2.01
- Base WAD downloading works again
Version 2.1
-
Version 2.0
- Added BNS conversion (Mono and Stereo, with and without loop)