diff --git a/PKHeX.WinForms/Subforms/Save Editors/Gen7/SAV_Trainer7.Designer.cs b/PKHeX.WinForms/Subforms/Save Editors/Gen7/SAV_Trainer7.Designer.cs index 1d02513da..f6452e16e 100644 --- a/PKHeX.WinForms/Subforms/Save Editors/Gen7/SAV_Trainer7.Designer.cs +++ b/PKHeX.WinForms/Subforms/Save Editors/Gen7/SAV_Trainer7.Designer.cs @@ -191,6 +191,7 @@ private void InitializeComponent() this.LB_BallThrowTypeLearned = new System.Windows.Forms.ListBox(); this.L_Stamps = new System.Windows.Forms.Label(); this.LB_Stamps = new System.Windows.Forms.ListBox(); + this.CHK_UnlockMega = new System.Windows.Forms.CheckBox(); this.TC_Editor.SuspendLayout(); this.Tab_Overview.SuspendLayout(); this.GB_Stats.SuspendLayout(); @@ -1648,6 +1649,7 @@ private void InitializeComponent() // // Tab_Misc // + this.Tab_Misc.Controls.Add(this.CHK_UnlockMega); this.Tab_Misc.Controls.Add(this.L_BallThrowType); this.Tab_Misc.Controls.Add(this.CB_BallThrowType); this.Tab_Misc.Controls.Add(this.CB_BallThrowTypeListMode); @@ -1979,6 +1981,16 @@ private void InitializeComponent() this.LB_Stamps.Size = new System.Drawing.Size(159, 52); this.LB_Stamps.TabIndex = 71; // + // CHK_UnlockMega + // + this.CHK_UnlockMega.AutoSize = true; + this.CHK_UnlockMega.Location = new System.Drawing.Point(6, 256); + this.CHK_UnlockMega.Name = "CHK_UnlockMega"; + this.CHK_UnlockMega.Size = new System.Drawing.Size(90, 17); + this.CHK_UnlockMega.TabIndex = 72; + this.CHK_UnlockMega.Text = "Unlock Mega"; + this.CHK_UnlockMega.UseVisualStyleBackColor = true; + // // SAV_Trainer7 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -2202,5 +2214,6 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox CHK_UnlockSuperMulti; private System.Windows.Forms.CheckBox CHK_UnlockSuperDoubles; private System.Windows.Forms.CheckBox CHK_UnlockSuperSingles; + private System.Windows.Forms.CheckBox CHK_UnlockMega; } } diff --git a/PKHeX.WinForms/Subforms/Save Editors/Gen7/SAV_Trainer7.cs b/PKHeX.WinForms/Subforms/Save Editors/Gen7/SAV_Trainer7.cs index b22f18d7d..6177610d0 100644 --- a/PKHeX.WinForms/Subforms/Save Editors/Gen7/SAV_Trainer7.cs +++ b/PKHeX.WinForms/Subforms/Save Editors/Gen7/SAV_Trainer7.cs @@ -229,6 +229,8 @@ private void getTextBoxes() CHK_UnlockSuperSingles.Checked = (btsu & 1) != 0; CHK_UnlockSuperDoubles.Checked = (btsu & (1 << 1)) != 0; CHK_UnlockSuperMulti.Checked = (btsu & (1 << 2)) != 0; + + CHK_UnlockMega.Checked = SAV.MegaUnlocked; } private void save() { @@ -343,6 +345,8 @@ private void save() if (CHK_UnlockSuperDoubles.Checked) btsu |= (1 << 1); if (CHK_UnlockSuperMulti.Checked) btsu |= (1 << 2); SAV.BattleTreeSuperUnlocked = btsu; + + SAV.MegaUnlocked = CHK_UnlockMega.Checked; } private void clickOT(object sender, MouseEventArgs e) diff --git a/PKHeX/Saves/SAV7.cs b/PKHeX/Saves/SAV7.cs index e401ab0ef..911a6d45b 100644 --- a/PKHeX/Saves/SAV7.cs +++ b/PKHeX/Saves/SAV7.cs @@ -1302,6 +1302,15 @@ public byte BattleTreeSuperUnlocked get { return (byte)(Data[0x23F9] >> 5); } set { Data[0x23F9] = (byte)((Data[0x23F9] & 0x1F) | ((value & 0x07) << 5)); } } + public bool MegaUnlocked + { + get { return (Data[0x1278] & 0x01) != 0; } + set + { + Data[0x1278] = (byte)((Data[0x1278] & 0xFE) | (value ? 1 : 0)); // in battle + // Data[0x1F22] = (byte)((Data[0x1F22] & 0xFE) | (value ? 1 : 0)); // event + } + } public override bool RequiresMemeCrypto => true; }