From 2e5f447dce3a42e90d012492e9a2fdebde676968 Mon Sep 17 00:00:00 2001 From: Kurt Date: Mon, 19 Oct 2015 19:08:56 -0700 Subject: [PATCH] Begin Implementing auto-modification when set There's a few ways to finish implementing, as the program needs a way to access Trainer Information on the fly. Quick and dirty way is to add new global variables and set them when a save file is loaded, and a cleaner way would be to move the 'savefile' variable into the sav class and do all accessing from there. Not yet decided on which. For now, the added items and code still do nothing. --- Misc/PK6.cs | 2 ++ PKX/f1-Main.Designer.cs | 22 +++++++++++++++++----- PKX/f1-Main.cs | 7 +++++++ 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/Misc/PK6.cs b/Misc/PK6.cs index 7513d8f08..3abd44266 100644 --- a/Misc/PK6.cs +++ b/Misc/PK6.cs @@ -618,6 +618,8 @@ namespace PKHeX TradeGeoLocation(SAV_COUNTRY, SAV_REGION); CurrentHandler = 1; + HT_Name = SAV_Trainer; + HT_Gender = SAV_GENDER; // Make a memory if no memory already exists. Pretty terrible way of doing this but I'd rather not overwrite existing memories. if (HT_Memory == 0) diff --git a/PKX/f1-Main.Designer.cs b/PKX/f1-Main.Designer.cs index 8bab81ae0..039843e7c 100644 --- a/PKX/f1-Main.Designer.cs +++ b/PKX/f1-Main.Designer.cs @@ -328,6 +328,7 @@ this.B_OpenSuperTraining = new System.Windows.Forms.Button(); this.dragout = new System.Windows.Forms.PictureBox(); this.L_QR = new System.Windows.Forms.Label(); + this.Menu_Modify = new System.Windows.Forms.ToolStripMenuItem(); this.tabMain.SuspendLayout(); this.Tab_Main.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.Label_IsShiny)).BeginInit(); @@ -2664,8 +2665,9 @@ // this.Menu_Options.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.Menu_Language, - this.Menu_About, - this.Menu_Unicode}); + this.Menu_Unicode, + this.Menu_Modify, + this.Menu_About}); this.Menu_Options.Name = "Menu_Options"; this.Menu_Options.Size = new System.Drawing.Size(61, 20); this.Menu_Options.Text = "Options"; @@ -2675,7 +2677,7 @@ this.Menu_Language.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.CB_MainLanguage}); this.Menu_Language.Name = "Menu_Language"; - this.Menu_Language.Size = new System.Drawing.Size(139, 22); + this.Menu_Language.Size = new System.Drawing.Size(186, 22); this.Menu_Language.Text = "Language"; // // CB_MainLanguage @@ -2690,14 +2692,14 @@ this.Menu_About.Name = "Menu_About"; this.Menu_About.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.B))); this.Menu_About.ShowShortcutKeys = false; - this.Menu_About.Size = new System.Drawing.Size(139, 22); + this.Menu_About.Size = new System.Drawing.Size(186, 22); this.Menu_About.Text = "A&bout PKHeX"; this.Menu_About.Click += new System.EventHandler(this.mainMenuAbout); // // Menu_Unicode // this.Menu_Unicode.Name = "Menu_Unicode"; - this.Menu_Unicode.Size = new System.Drawing.Size(139, 22); + this.Menu_Unicode.Size = new System.Drawing.Size(186, 22); this.Menu_Unicode.Text = "Toggle Font"; this.Menu_Unicode.Click += new System.EventHandler(this.mainMenuUnicode); // @@ -3975,6 +3977,15 @@ this.L_QR.Visible = false; this.L_QR.Click += new System.EventHandler(this.clickQR); // + // Menu_Modify + // + this.Menu_Modify.Checked = true; + this.Menu_Modify.CheckOnClick = true; + this.Menu_Modify.CheckState = System.Windows.Forms.CheckState.Checked; + this.Menu_Modify.Name = "Menu_Modify"; + this.Menu_Modify.Size = new System.Drawing.Size(186, 22); + this.Menu_Modify.Text = "Modify on Set to SAV"; + // // Main // this.AllowDrop = true; @@ -4404,6 +4415,7 @@ private System.Windows.Forms.TextBox TB_OT; private System.Windows.Forms.ComboBox CB_GameOrigin; private System.Windows.Forms.Button B_OpenDB; + private System.Windows.Forms.ToolStripMenuItem Menu_Modify; } } diff --git a/PKX/f1-Main.cs b/PKX/f1-Main.cs index 26c95dbfb..6ca9073df 100644 --- a/PKX/f1-Main.cs +++ b/PKX/f1-Main.cs @@ -2600,6 +2600,13 @@ namespace PKHeX int offset = getPKXOffset(slot); byte[] pkxdata = preparepkx(); + if (Menu_Modify.Checked) + { + PK6 pk = new PK6(pkxdata); + // TODO: Trade + // pk.Trade(); + pkxdata = pk.Write(); + } byte[] ekxdata = PKX.encryptArray(pkxdata); if (!SaveGame.ORAS)