Add pkm league starter EC for gen7

Closes #1671
This commit is contained in:
Kurt 2017-11-29 20:04:01 -08:00
parent 4a898b0829
commit fdc52e2c19
6 changed files with 44 additions and 1 deletions

View File

@ -612,6 +612,11 @@ public int Vivillon
get => Data[Misc + 0x130] & 0x1F;
set => Data[Misc + 0x130] = (byte)((Data[Misc + 0x130] & ~0x1F) | (value & 0x1F));
}
public uint StarterEncryptionConstant
{
get => BitConverter.ToUInt32(Data, Misc + 0x148);
set => SetData(BitConverter.GetBytes(value), Misc + 0x148);
}
public int DaysFromRefreshed
{
get => Data[Misc + 0x123];

View File

@ -252,7 +252,7 @@ private void Write_Entry(object sender, EventArgs e)
BitConverter.GetBytes(Convert.ToUInt16(CB_Move2.SelectedValue)).CopyTo(data, offset + 0x06);
BitConverter.GetBytes(Convert.ToUInt16(CB_Move3.SelectedValue)).CopyTo(data, offset + 0x08);
BitConverter.GetBytes(Convert.ToUInt16(CB_Move4.SelectedValue)).CopyTo(data, offset + 0x0A);
BitConverter.GetBytes(Convert.ToUInt32(TB_EC.Text,16)).CopyTo(data, offset + 0x0C);
BitConverter.GetBytes(Util.GetHexValue(TB_EC.Text)).CopyTo(data, offset + 0x0C);
BitConverter.GetBytes(Convert.ToUInt16(TB_TID.Text)).CopyTo(data, offset + 0x10);
BitConverter.GetBytes(Convert.ToUInt16(TB_SID.Text)).CopyTo(data, offset + 0x12);

View File

@ -60,6 +60,8 @@ private void InitializeComponent()
this.L_C1 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.TB_EC = new System.Windows.Forms.TextBox();
this.L_EC = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.NUD_Count)).BeginInit();
this.SuspendLayout();
//
@ -373,11 +375,33 @@ private void InitializeComponent()
this.label2.Text = "Current";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// TB_EC
//
this.TB_EC.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.TB_EC.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.TB_EC.Location = new System.Drawing.Point(220, 4);
this.TB_EC.MaxLength = 8;
this.TB_EC.Name = "TB_EC";
this.TB_EC.Size = new System.Drawing.Size(60, 20);
this.TB_EC.TabIndex = 65;
this.TB_EC.Text = "12345678";
//
// Label_EncryptionConstant
//
this.L_EC.Location = new System.Drawing.Point(143, 5);
this.L_EC.Name = "L_EC";
this.L_EC.Size = new System.Drawing.Size(75, 15);
this.L_EC.TabIndex = 64;
this.L_EC.Text = "Starter EC:";
this.L_EC.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// SAV_HallOfFame7
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(394, 201);
this.Controls.Add(this.TB_EC);
this.Controls.Add(this.L_EC);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.CB_C6);
@ -454,5 +478,7 @@ private void InitializeComponent()
private System.Windows.Forms.Label L_C1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox TB_EC;
private System.Windows.Forms.Label L_EC;
}
}

View File

@ -43,6 +43,11 @@ private void Setup()
cb.SelectedValue = (int)BitConverter.ToUInt16(SAV.Data, o);
}
if (SAV.USUM)
TB_EC.Text = SAV.StarterEncryptionConstant.ToString("X8");
else
TB_EC.Visible = L_EC.Visible = false;
}
private void B_Cancel_Click(object sender, EventArgs e)
@ -63,6 +68,10 @@ private void B_Close_Click(object sender, EventArgs e)
var val = WinFormsUtil.GetIndex(cb);
BitConverter.GetBytes((ushort)val).CopyTo(SAV.Data, o);
}
if (SAV.USUM)
SAV.StarterEncryptionConstant = Util.GetHexValue(TB_EC.Text);
Origin.SetData(SAV.Data, 0);
Close();
}

View File

@ -747,6 +747,7 @@ private void B_GenTID_Click(object sender, EventArgs e)
{069, "Items Reeled In"},
// USUM
{070, "Roto Lotos"},
{072, "Stickers Collected"},
{073, "Mantine Surf BP Earned"},
{074, "Battle Agency Wins"},

View File

@ -67,6 +67,8 @@ private void B_Save_Click(object sender, EventArgs e)
constants[cellstotal] = (ushort)NUD_Cells.Value;
constants[cellscollected] = (ushort)NUD_Collected.Value;
if (SAV.USUM)
SAV.SetRecord(72, (int)NUD_Collected.Value);
SAV.EventConsts = constants;
Origin.SetData(SAV.Data, 0);