From 71275142f87ece35d14e282b9e5c7f16914e15d3 Mon Sep 17 00:00:00 2001 From: Kurt Date: Thu, 24 Jul 2014 10:28:24 -0700 Subject: [PATCH] Bugfixes Illegal TIDSID prevention, fixed shiny detection (button clicking) --- f1-Main.Designer.cs | 26 +++++++------------------- f1-Main.cs | 13 +++++++------ 2 files changed, 14 insertions(+), 25 deletions(-) diff --git a/f1-Main.Designer.cs b/f1-Main.Designer.cs index 2b9546e76..1982d609a 100644 --- a/f1-Main.Designer.cs +++ b/f1-Main.Designer.cs @@ -212,7 +212,6 @@ this.Menu_Exit = new System.Windows.Forms.ToolStripMenuItem(); this.Menu_Tools = new System.Windows.Forms.ToolStripMenuItem(); this.Menu_OpenBoxUI = new System.Windows.Forms.ToolStripMenuItem(); - this.Menu_ImportGen5 = new System.Windows.Forms.ToolStripMenuItem(); this.Menu_BoxIO = new System.Windows.Forms.ToolStripMenuItem(); this.codeGeneratorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.reportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -2540,10 +2539,9 @@ // this.Menu_Tools.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.Menu_OpenBoxUI, - this.Menu_ImportGen5, this.Menu_BoxIO, - this.codeGeneratorToolStripMenuItem, - this.reportToolStripMenuItem}); + this.reportToolStripMenuItem, + this.codeGeneratorToolStripMenuItem}); this.Menu_Tools.Name = "Menu_Tools"; this.Menu_Tools.Size = new System.Drawing.Size(48, 20); this.Menu_Tools.Text = "Tools"; @@ -2551,37 +2549,28 @@ // Menu_OpenBoxUI // this.Menu_OpenBoxUI.Name = "Menu_OpenBoxUI"; - this.Menu_OpenBoxUI.Size = new System.Drawing.Size(174, 22); - this.Menu_OpenBoxUI.Text = "Open Box Interface"; + this.Menu_OpenBoxUI.Size = new System.Drawing.Size(182, 22); + this.Menu_OpenBoxUI.Text = "Toggle Box Interface"; this.Menu_OpenBoxUI.Click += new System.EventHandler(this.mainmenuWiden); // - // Menu_ImportGen5 - // - this.Menu_ImportGen5.Name = "Menu_ImportGen5"; - this.Menu_ImportGen5.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.I))); - this.Menu_ImportGen5.ShowShortcutKeys = false; - this.Menu_ImportGen5.Size = new System.Drawing.Size(174, 22); - this.Menu_ImportGen5.Text = "&Import Gen5 PKM"; - this.Menu_ImportGen5.Click += new System.EventHandler(this.mainmenug5pkm); - // // Menu_BoxIO // this.Menu_BoxIO.Name = "Menu_BoxIO"; - this.Menu_BoxIO.Size = new System.Drawing.Size(174, 22); + this.Menu_BoxIO.Size = new System.Drawing.Size(182, 22); this.Menu_BoxIO.Text = "Load/Dump Boxes"; this.Menu_BoxIO.Click += new System.EventHandler(this.Menu_DumpLoadBoxes_Click); // // codeGeneratorToolStripMenuItem // this.codeGeneratorToolStripMenuItem.Name = "codeGeneratorToolStripMenuItem"; - this.codeGeneratorToolStripMenuItem.Size = new System.Drawing.Size(174, 22); + this.codeGeneratorToolStripMenuItem.Size = new System.Drawing.Size(182, 22); this.codeGeneratorToolStripMenuItem.Text = "Code Generator"; this.codeGeneratorToolStripMenuItem.Click += new System.EventHandler(this.codeGeneratorToolStripMenuItem_Click); // // reportToolStripMenuItem // this.reportToolStripMenuItem.Name = "reportToolStripMenuItem"; - this.reportToolStripMenuItem.Size = new System.Drawing.Size(174, 22); + this.reportToolStripMenuItem.Size = new System.Drawing.Size(182, 22); this.reportToolStripMenuItem.Text = "Box Data Report"; this.reportToolStripMenuItem.Click += new System.EventHandler(this.reportToolStripMenuItem_Click); // @@ -4189,7 +4178,6 @@ private System.Windows.Forms.Label Label_CharacteristicPrefix; private System.Windows.Forms.ToolStripMenuItem Menu_Tools; private System.Windows.Forms.ToolStripMenuItem Menu_OpenBoxUI; - private System.Windows.Forms.ToolStripMenuItem Menu_ImportGen5; private System.Windows.Forms.ToolStripMenuItem Menu_Options; private System.Windows.Forms.ToolStripMenuItem Menu_Language; private System.Windows.Forms.ToolStripComboBox CB_MainLanguage; diff --git a/f1-Main.cs b/f1-Main.cs index 99fa0f4df..6eb30986d 100644 --- a/f1-Main.cs +++ b/f1-Main.cs @@ -5678,7 +5678,7 @@ namespace PKHeX uint XOR = TSV ^ PSV; // Check to see if we actually did it right... - if (((XOR > 8) && (CB_GameOrigin.SelectedIndex < 24)) || ((XOR > 16) && (CB_GameOrigin.SelectedIndex > 24))) + if (((XOR > 8) && (CB_GameOrigin.SelectedIndex < 24)) || ((XOR > 16) && (CB_GameOrigin.SelectedIndex >= 24))) { TB_PID.Text = ((UID ^ XOR) * 0x10000 + LID).ToString("X8"); } @@ -5689,6 +5689,11 @@ namespace PKHeX // Trim out nonhex characters RemoveTroublesomeCharacters(TB_PID); RemoveTroublesomeCharacters(TB_EC); + + if (ToUInt32(TB_TID.Text) > 0xFFFF) + TB_TID.Text = TB_TID.Text.Remove(TB_TID.Text.Length - 1); + if (ToUInt32(TB_TID.Text) > 0xFFFF) + TB_SID.Text = TB_SID.Text.Remove(TB_SID.Text.Length - 1); getIsShiny(); UpdateIVs(sender, e); // If the PID is changed, PID%6 (Characteristic) might be changed. @@ -6002,10 +6007,6 @@ namespace PKHeX string message = "PKHeX - By Kaphotics.\n\nUI Inspiried by Codr's PokeGen.\n\nThanks to all the researchers!"; MessageBox.Show(message, caption); } - private void mainmenug5pkm(object sender, EventArgs e) - { - openg5pkm(); - } private void mainmenuWiden(object sender, EventArgs e) { int newwidth; @@ -8178,7 +8179,7 @@ namespace PKHeX uint PSV = UID ^ LID; uint TSV = ToUInt32(TB_TID.Text) ^ ToUInt32(TB_SID.Text); uint XOR = TSV ^ PSV; - if (((XOR < 8) && (gamevers < 24)) || ((XOR < 16) && (gamevers > 24))) + if (((XOR < 8) && (gamevers < 24)) || ((XOR < 16) && (gamevers >= 24))) { // Is Shiny isshiny = " ★"; }