Merge pull request #1014 from pokecal/pokecal-patch-2

Add Gen7 Mega unlock
This commit is contained in:
Kurt 2017-03-30 14:39:20 -07:00 committed by GitHub
commit 1366e767b4
3 changed files with 26 additions and 0 deletions

View File

@ -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;
}
}

View File

@ -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)

View File

@ -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;
}