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 c197077a6..1d02513da 100644 --- a/PKHeX.WinForms/Subforms/Save Editors/Gen7/SAV_Trainer7.Designer.cs +++ b/PKHeX.WinForms/Subforms/Save Editors/Gen7/SAV_Trainer7.Designer.cs @@ -139,6 +139,10 @@ private void InitializeComponent() this.L_Z = new System.Windows.Forms.Label(); this.L_X = new System.Windows.Forms.Label(); this.Tab_BattleTree = new System.Windows.Forms.TabPage(); + this.GB_UnlockSupers = new System.Windows.Forms.GroupBox(); + this.CHK_UnlockSuperMulti = new System.Windows.Forms.CheckBox(); + this.CHK_UnlockSuperDoubles = new System.Windows.Forms.CheckBox(); + this.CHK_UnlockSuperSingles = new System.Windows.Forms.CheckBox(); this.L_Super = new System.Windows.Forms.Label(); this.L_Regular = new System.Windows.Forms.Label(); this.NUD_SMStreak2 = new System.Windows.Forms.NumericUpDown(); @@ -202,6 +206,7 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.NUD_Y)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_X)).BeginInit(); this.Tab_BattleTree.SuspendLayout(); + this.GB_UnlockSupers.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_SMStreak2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_SCStreak2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_SMStreak1)).BeginInit(); @@ -1294,6 +1299,7 @@ private void InitializeComponent() // // Tab_BattleTree // + this.Tab_BattleTree.Controls.Add(this.GB_UnlockSupers); this.Tab_BattleTree.Controls.Add(this.L_Super); this.Tab_BattleTree.Controls.Add(this.L_Regular); this.Tab_BattleTree.Controls.Add(this.NUD_SMStreak2); @@ -1322,6 +1328,48 @@ private void InitializeComponent() this.Tab_BattleTree.Text = "Battle Tree"; this.Tab_BattleTree.UseVisualStyleBackColor = true; // + // GB_UnlockSupers + // + this.GB_UnlockSupers.Controls.Add(this.CHK_UnlockSuperMulti); + this.GB_UnlockSupers.Controls.Add(this.CHK_UnlockSuperDoubles); + this.GB_UnlockSupers.Controls.Add(this.CHK_UnlockSuperSingles); + this.GB_UnlockSupers.Location = new System.Drawing.Point(6, 240); + this.GB_UnlockSupers.Name = "GB_UnlockSupers"; + this.GB_UnlockSupers.Size = new System.Drawing.Size(199, 40); + this.GB_UnlockSupers.TabIndex = 95; + this.GB_UnlockSupers.TabStop = false; + this.GB_UnlockSupers.Text = "Unlock Super*"; + // + // CHK_UnlockSuperMulti + // + this.CHK_UnlockSuperMulti.AutoSize = true; + this.CHK_UnlockSuperMulti.Location = new System.Drawing.Point(144, 18); + this.CHK_UnlockSuperMulti.Name = "CHK_UnlockSuperMulti"; + this.CHK_UnlockSuperMulti.Size = new System.Drawing.Size(49, 16); + this.CHK_UnlockSuperMulti.TabIndex = 2; + this.CHK_UnlockSuperMulti.Text = "Multi"; + this.CHK_UnlockSuperMulti.UseVisualStyleBackColor = true; + // + // CHK_UnlockSuperDoubles + // + this.CHK_UnlockSuperDoubles.AutoSize = true; + this.CHK_UnlockSuperDoubles.Location = new System.Drawing.Point(73, 18); + this.CHK_UnlockSuperDoubles.Name = "CHK_UnlockSuperDoubles"; + this.CHK_UnlockSuperDoubles.Size = new System.Drawing.Size(65, 16); + this.CHK_UnlockSuperDoubles.TabIndex = 1; + this.CHK_UnlockSuperDoubles.Text = "Doubles"; + this.CHK_UnlockSuperDoubles.UseVisualStyleBackColor = true; + // + // CHK_UnlockSuperSingles + // + this.CHK_UnlockSuperSingles.AutoSize = true; + this.CHK_UnlockSuperSingles.Location = new System.Drawing.Point(6, 18); + this.CHK_UnlockSuperSingles.Name = "CHK_UnlockSuperSingles"; + this.CHK_UnlockSuperSingles.Size = new System.Drawing.Size(61, 16); + this.CHK_UnlockSuperSingles.TabIndex = 0; + this.CHK_UnlockSuperSingles.Text = "Singles"; + this.CHK_UnlockSuperSingles.UseVisualStyleBackColor = true; + // // L_Super // this.L_Super.Location = new System.Drawing.Point(243, 37); @@ -1964,6 +2012,8 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.NUD_Y)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_X)).EndInit(); this.Tab_BattleTree.ResumeLayout(false); + this.GB_UnlockSupers.ResumeLayout(false); + this.GB_UnlockSupers.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_SMStreak2)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_SCStreak2)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_SMStreak1)).EndInit(); @@ -2148,5 +2198,9 @@ private void InitializeComponent() private System.Windows.Forms.ListBox LB_BallThrowTypeLearned; private System.Windows.Forms.Label L_Stamps; private System.Windows.Forms.ListBox LB_Stamps; + private System.Windows.Forms.GroupBox GB_UnlockSupers; + private System.Windows.Forms.CheckBox CHK_UnlockSuperMulti; + private System.Windows.Forms.CheckBox CHK_UnlockSuperDoubles; + private System.Windows.Forms.CheckBox CHK_UnlockSuperSingles; } } diff --git a/PKHeX.WinForms/Subforms/Save Editors/Gen7/SAV_Trainer7.cs b/PKHeX.WinForms/Subforms/Save Editors/Gen7/SAV_Trainer7.cs index ef83235c2..9e1611bf3 100644 --- a/PKHeX.WinForms/Subforms/Save Editors/Gen7/SAV_Trainer7.cs +++ b/PKHeX.WinForms/Subforms/Save Editors/Gen7/SAV_Trainer7.cs @@ -225,6 +225,10 @@ private void getTextBoxes() for (int i = 0; i < LB_Stamps.Items.Count; i++) LB_Stamps.SetSelected(i, (stampBits & (1 << i)) != 0); + byte btsu = SAV.BattleTreeSuperUnlocked; + CHK_UnlockSuperSingles.Checked = (btsu & 1) != 0; + CHK_UnlockSuperDoubles.Checked = (btsu & (1 << 1)) != 0; + CHK_UnlockSuperMulti.Checked = (btsu & (1 << 2)) != 0; } private void save() { @@ -334,6 +338,11 @@ private void save() stampBits += (uint)(1 << i); } SAV.Stamps = stampBits; + byte btsu = 0; + if (CHK_UnlockSuperSingles.Checked) btsu |= 1; + if (CHK_UnlockSuperDoubles.Checked) btsu |= (1 << 1); + if (CHK_UnlockSuperMulti.Checked) btsu |= (1 << 2); + SAV.BattleTreeSuperUnlocked = btsu; } private void clickOT(object sender, MouseEventArgs e) diff --git a/PKHeX/Saves/SAV7.cs b/PKHeX/Saves/SAV7.cs index 02d7af2b5..e401ab0ef 100644 --- a/PKHeX/Saves/SAV7.cs +++ b/PKHeX/Saves/SAV7.cs @@ -1284,11 +1284,12 @@ public override string MiscSaveInfo() } public byte BallThrowTypeUnlocked { - get { return (byte)(((Data[0x23F5] & 0x0F) << 4) | ((Data[0x23F4] & 0xC0) >> 4)); } + get { return (byte)(((BitConverter.ToUInt16(Data, 0x23F4) << 4) >> 10) << 2); } set { - Data[0x23F4] = (byte)((Data[0x23F4] & 0x3F) | ((value & 0x0C) << 4)); - Data[0x23F5] = (byte)((Data[0x23F5] & 0xF0) | ((value & 0xF0) >> 4)); + ushort flags = (ushort)(BitConverter.ToUInt16(Data, 0x23F4) & 0xF03F); + flags |= (ushort)((value & 0xFC) << 4); + BitConverter.GetBytes(flags).CopyTo(Data, 0x23F4); } } public byte BallThrowTypeLearned @@ -1296,6 +1297,11 @@ public byte BallThrowTypeLearned get { return (byte)((Data[0x2583] & 0x7F) << 1); } set { Data[0x2583] = (byte)((Data[0x2583] & 0x80) | ((value & 0xFE) >> 1)); } } + public byte BattleTreeSuperUnlocked + { + get { return (byte)(Data[0x23F9] >> 5); } + set { Data[0x23F9] = (byte)((Data[0x23F9] & 0x1F) | ((value & 0x07) << 5)); } + } public override bool RequiresMemeCrypto => true; }