diff --git a/TransmitMii/Properties/AssemblyInfo.cs b/TransmitMii/Properties/AssemblyInfo.cs index f4cec16..6406767 100644 --- a/TransmitMii/Properties/AssemblyInfo.cs +++ b/TransmitMii/Properties/AssemblyInfo.cs @@ -49,5 +49,5 @@ using System.Runtime.InteropServices; // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern // übernehmen, indem Sie "*" eingeben: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.1.0.0")] -[assembly: AssemblyFileVersion("1.1.0.0")] +[assembly: AssemblyVersion("1.1.5.0")] +[assembly: AssemblyFileVersion("1.1.5.0")] diff --git a/TransmitMii/Readme.txt b/TransmitMii/Readme.txt index ba5b5d0..51aec10 100644 --- a/TransmitMii/Readme.txt +++ b/TransmitMii/Readme.txt @@ -9,6 +9,11 @@ TransmitMii is hosted on the CustomizeMii project page: http://customizemii.goog ----------------------------------------------------------------------------------------- Changelog: +Version 1.15 + - Fixed transmitting to HBC -1.0.4 (HAXX) + - Fixed transmitting to USB Loader GX + - Bugfix + Version 1.1 - Added ability to link and unlink extensions with TransmitMii - Added compression for HBC 1.0.5+ (similar to wiiload) diff --git a/TransmitMii/TransmitMii_Associations.cs b/TransmitMii/TransmitMii_Associations.cs index 3569af3..10ba246 100644 --- a/TransmitMii/TransmitMii_Associations.cs +++ b/TransmitMii/TransmitMii_Associations.cs @@ -42,24 +42,28 @@ namespace TransmitMii public static bool CheckAssociation(Extension which) { - if (which == Extension.Both) + try { - if (Registry.GetValue("HKEY_CLASSES_ROOT\\.dol", "", "").ToString().ToLower() == "wiibin" && - Registry.GetValue("HKEY_CLASSES_ROOT\\.elf", "", "").ToString().ToLower() == "wiibin") return true; - else return false; + if (which == Extension.Both) + { + if (Registry.GetValue("HKEY_CLASSES_ROOT\\.dol", "", "").ToString().ToLower() == "wiibin" && + Registry.GetValue("HKEY_CLASSES_ROOT\\.elf", "", "").ToString().ToLower() == "wiibin") return true; + else return false; + } + + string regKey; + if (which == Extension.DOL) + regKey = "HKEY_CLASSES_ROOT\\.dol"; + else if (which == Extension.ELF) + regKey = "HKEY_CLASSES_ROOT\\.elf"; + else + regKey = "HKEY_CLASSES_ROOT\\.wad"; + + + if (Registry.GetValue(regKey, "", "").ToString().ToLower() != "wiibin") return false; + else return true; } - - string regKey; - if (which == Extension.DOL) - regKey = "HKEY_CLASSES_ROOT\\.dol"; - else if (which == Extension.ELF) - regKey = "HKEY_CLASSES_ROOT\\.elf"; - else - regKey = "HKEY_CLASSES_ROOT\\.wad"; - - - if (Registry.GetValue(regKey, "", "").ToString().ToLower() != "wiibin") return false; - else return true; + catch { return false; } } public static bool DeleteAssociation(Extension which) diff --git a/TransmitMii/TransmitMii_Main.cs b/TransmitMii/TransmitMii_Main.cs index 8ded2ab..4496134 100644 --- a/TransmitMii/TransmitMii_Main.cs +++ b/TransmitMii/TransmitMii_Main.cs @@ -27,11 +27,11 @@ namespace TransmitMii { public partial class TransmitMii_Main : Form { - const string version = "1.1"; //Hint for myself: Never use a char in the Version (UpdateCheck)! + const string version = "1.15"; //Hint for myself: Never use a char in the Version (UpdateCheck)! private bool IsRunning = false; private string fileName; private string statusText; - private bool JODI; + private Protocol protocol; private bool Aborted = false; private bool directStart = false; EventHandler UpdateStatus; @@ -222,7 +222,7 @@ namespace TransmitMii fileName = Path.GetFileName(tbFile.Text); - JODI = cmbProtocol.SelectedIndex == 0 ? true : false; + protocol = IntToProtocol(cmbProtocol.SelectedIndex); bwTransmit.RunWorkerAsync(theFile); } else { tbIP.Focus(); tbIP.SelectAll(); } @@ -241,7 +241,7 @@ namespace TransmitMii { byte[] theFile = e.Argument as byte[]; - if (Transmit_Compress(fileName, theFile, JODI, File.Exists(Application.StartupPath + "\\zlib1.dll"))) + if (Transmit_Compress(fileName, theFile, protocol, File.Exists(Application.StartupPath + "\\zlib1.dll"))) { if (usedCompression) MessageBox.Show(string.Format("Transmitted {0} kB in {1} milliseconds...\nCompression Ratio: {2}%", transmittedLength, timeElapsed, compressionRatio), "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); @@ -311,7 +311,9 @@ namespace TransmitMii string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); if (files.Length == 1) { - if (Path.GetExtension(files[0]) == ".dol" || Path.GetExtension(files[0]) == ".elf") + if (Path.GetExtension(files[0]) == ".dol" || + Path.GetExtension(files[0]) == ".elf" || + Path.GetExtension(files[0]) == ".wad") e.Effect = DragDropEffects.Copy; else e.Effect = DragDropEffects.None; diff --git a/TransmitMii/TransmitMii_Transmit.cs b/TransmitMii/TransmitMii_Transmit.cs index f2af545..3127cb4 100644 --- a/TransmitMii/TransmitMii_Transmit.cs +++ b/TransmitMii/TransmitMii_Transmit.cs @@ -14,7 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + using System; using System.Net.Sockets; @@ -22,6 +22,10 @@ namespace TransmitMii { partial class TransmitMii_Main { + const bool JODI_Compress = true; + const bool HAXX_Compress = false; + const bool USBX_Compress = false; + TcpClient theClient; NetworkStream theStream; System.Diagnostics.Stopwatch stopper = new System.Diagnostics.Stopwatch(); @@ -30,18 +34,42 @@ namespace TransmitMii private bool usedCompression; private double compressionRatio; - private bool Transmit_Compress(string fileName, byte[] fileData, bool JODI, bool compress) + private enum Protocol : int + { + // 0 = No Compression + // 1 = Compression + JODI = 1, + HAXX = 0, + USBX = 0 + } + + private Protocol IntToProtocol(int theInt) + { + switch (theInt) + { + default: + return Protocol.JODI; + case 1: + return Protocol.HAXX; + case 2: + return Protocol.USBX; + } + } + + private bool Transmit_Compress(string fileName, byte[] fileData, Protocol protocol, bool compress) { stopper.Reset(); stopper.Start(); if (!Environment.OSVersion.ToString().Contains("Windows")) compress = false; + if ((int)(protocol) == 0) compress = false; + theClient = new TcpClient(); byte[] compFileData; int Blocksize = 4 * 1024; - if (!JODI) Blocksize = 16 * 1024; + if (protocol != Protocol.JODI) Blocksize = 16 * 1024; byte[] buffer = new byte[4]; string theIP = tbIP.Text; @@ -59,24 +87,15 @@ namespace TransmitMii catch (Exception ex) { if (!Aborted) ErrorBox("Error sending Magic:\n" + ex.Message); theStream.Close(); theClient.Close(); return false; } StatusUpdate("Magic Sent... Sending Version Info..."); - if (JODI) - { - buffer[0] = 0; - buffer[1] = 5; - buffer[2] = (byte)(((fileName.Length + 2) >> 8) & 0xff); - buffer[3] = (byte)((fileName.Length + 2) & 0xff); - } - else - { - buffer[0] = 0; - buffer[1] = 1; - buffer[2] = 0; - buffer[3] = 0; - } + buffer[0] = 0; + buffer[1] = protocol == Protocol.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) { if (!Aborted) ErrorBox("Error sending Version Info:\n" + ex.Message); theStream.Close(); theClient.Close(); return false; } - if (JODI && compress) + if (compress) { StatusUpdate("Version Info Sent... Compressing File..."); try { compFileData = zlib.Compress(fileData); } @@ -106,7 +125,7 @@ namespace TransmitMii try { theStream.Write(buffer, 0, 4); } catch (Exception ex) { if (!Aborted) ErrorBox("Error sending Filesize:\n" + ex.Message); theStream.Close(); theClient.Close(); return false; } - if (JODI) + if (compress) { buffer[0] = (byte)((fileData.Length >> 24) & 0xff); buffer[1] = (byte)((fileData.Length >> 16) & 0xff); @@ -139,14 +158,11 @@ namespace TransmitMii } catch (Exception ex) { if (!Aborted) ErrorBox("Error sending File:\n" + ex.Message); theStream.Close(); theClient.Close(); return false; } - if (JODI) - { - 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) { if (!Aborted) ErrorBox("Error sending Arguments:\n" + ex.Message); theStream.Close(); theClient.Close(); return false; } - } + 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) { if (!Aborted) ErrorBox("Error sending Arguments:\n" + ex.Message); theStream.Close(); theClient.Close(); return false; } theStream.Close(); theClient.Close(); @@ -164,13 +180,13 @@ namespace TransmitMii return true; } - //private bool Transmit(string fileName, byte[] fileData, bool JODI) + //private bool Transmit(string fileName, byte[] fileData, bool _JODI) //{ // TcpClient theClient = new TcpClient(); // NetworkStream theStream; // int Blocksize = 4 * 1024; - // if (!JODI) Blocksize = 16 * 1024; + // if (!_JODI) Blocksize = 16 * 1024; // byte[] buffer = new byte[4]; // string theIP = tbIP.Text; @@ -188,7 +204,7 @@ namespace TransmitMii // catch (Exception ex) { if (!Aborted) ErrorBox("Error sending Magic:\n" + ex.Message); theStream.Close(); theClient.Close(); return false; } // StatusUpdate("Magic Sent... Sending Version Info..."); - // if (JODI) + // if (_JODI) // { // buffer[0] = 0; // buffer[1] = 5; @@ -214,7 +230,7 @@ namespace TransmitMii // try { theStream.Write(buffer, 0, 4); } // catch (Exception ex) { if (!Aborted) ErrorBox("Error sending Filesize:\n" + ex.Message); theStream.Close(); theClient.Close(); return false; } - // if (JODI) + // if (_JODI) // { // buffer[0] = 0; // buffer[1] = 0; @@ -247,7 +263,7 @@ namespace TransmitMii // } // catch (Exception ex) { if (!Aborted) ErrorBox("Error sending File:\n" + ex.Message); theStream.Close(); theClient.Close(); return false; } - // if (JODI) + // if (_JODI) // { // StatusUpdate("File Sent... Sending Arguments..."); // byte[] theArgs = new byte[fileName.Length + 2];