mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-06-03 05:04:12 -05:00
update online ID g7 size display
needed to refactor the gamesync textbox to be variable length like daycare seed to handle multiple generations NexUniqueID internal name, qword IsValidNexUniqueID checks for != 0
This commit is contained in:
parent
23aed12f16
commit
8143f28643
24
PKHeX/MainWindow/Main.Designer.cs
generated
24
PKHeX/MainWindow/Main.Designer.cs
generated
|
|
@ -435,6 +435,7 @@ public void InitializeComponent()
|
|||
this.B_OUTPasserby = new System.Windows.Forms.Button();
|
||||
this.B_CGearSkin = new System.Windows.Forms.Button();
|
||||
this.B_OpenPokeBeans = new System.Windows.Forms.Button();
|
||||
this.B_OpenZygardeCells = new System.Windows.Forms.Button();
|
||||
this.dragout = new System.Windows.Forms.PictureBox();
|
||||
this.mnuL = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.mnuLLegality = new System.Windows.Forms.ToolStripMenuItem();
|
||||
|
|
@ -442,7 +443,6 @@ public void InitializeComponent()
|
|||
this.mnuLSave = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.PB_Legal = new System.Windows.Forms.PictureBox();
|
||||
this.L_UpdateAvailable = new System.Windows.Forms.LinkLabel();
|
||||
this.B_OpenZygardeCells = new System.Windows.Forms.Button();
|
||||
this.tabMain.SuspendLayout();
|
||||
this.Tab_Main.SuspendLayout();
|
||||
this.FLP_Main.SuspendLayout();
|
||||
|
|
@ -5389,7 +5389,7 @@ public void InitializeComponent()
|
|||
this.TB_GameSync.Size = new System.Drawing.Size(120, 20);
|
||||
this.TB_GameSync.TabIndex = 10;
|
||||
this.TB_GameSync.Text = "0000000000000000";
|
||||
this.TB_GameSync.TextChanged += new System.EventHandler(this.updateU64);
|
||||
this.TB_GameSync.TextChanged += new System.EventHandler(this.updateGameSyncID);
|
||||
//
|
||||
// B_SaveBoxBin
|
||||
//
|
||||
|
|
@ -5625,6 +5625,16 @@ public void InitializeComponent()
|
|||
this.B_OpenPokeBeans.UseVisualStyleBackColor = true;
|
||||
this.B_OpenPokeBeans.Click += new System.EventHandler(this.B_OpenPokeBeans_Click);
|
||||
//
|
||||
// B_OpenZygardeCells
|
||||
//
|
||||
this.B_OpenZygardeCells.Location = new System.Drawing.Point(189, 148);
|
||||
this.B_OpenZygardeCells.Name = "B_OpenZygardeCells";
|
||||
this.B_OpenZygardeCells.Size = new System.Drawing.Size(87, 23);
|
||||
this.B_OpenZygardeCells.TabIndex = 26;
|
||||
this.B_OpenZygardeCells.Text = "Zygarde Cells";
|
||||
this.B_OpenZygardeCells.UseVisualStyleBackColor = true;
|
||||
this.B_OpenZygardeCells.Click += new System.EventHandler(this.B_OpenZygardeCells_Click);
|
||||
//
|
||||
// dragout
|
||||
//
|
||||
this.dragout.BackColor = System.Drawing.Color.Transparent;
|
||||
|
|
@ -5693,16 +5703,6 @@ public void InitializeComponent()
|
|||
this.L_UpdateAvailable.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
this.L_UpdateAvailable.Visible = false;
|
||||
//
|
||||
// B_OpenZygardeCells
|
||||
//
|
||||
this.B_OpenZygardeCells.Location = new System.Drawing.Point(189, 148);
|
||||
this.B_OpenZygardeCells.Name = "B_OpenZygardeCells";
|
||||
this.B_OpenZygardeCells.Size = new System.Drawing.Size(87, 23);
|
||||
this.B_OpenZygardeCells.TabIndex = 26;
|
||||
this.B_OpenZygardeCells.Text = "Zygarde Cells";
|
||||
this.B_OpenZygardeCells.UseVisualStyleBackColor = true;
|
||||
this.B_OpenZygardeCells.Click += new System.EventHandler(this.B_OpenZygardeCells_Click);
|
||||
//
|
||||
// Main
|
||||
//
|
||||
this.AllowDrop = true;
|
||||
|
|
|
|||
|
|
@ -1159,8 +1159,9 @@ private void openSAV(SaveFile sav, string path)
|
|||
getFieldsfromPKM = populateFieldsPK6;
|
||||
getPKMfromFields = preparePK6;
|
||||
extraBytes = PK6.ExtraBytes;
|
||||
TB_GameSync.Enabled = (SAV.GameSyncID ?? 0) != 0;
|
||||
TB_GameSync.Text = SAV.GameSyncID?.ToString("X16");
|
||||
TB_GameSync.Enabled = SAV.GameSyncID != null;
|
||||
TB_GameSync.MaxLength = SAV.GameSyncIDSize;
|
||||
TB_GameSync.Text = (SAV.GameSyncID ?? 0.ToString()).PadLeft(SAV.GameSyncIDSize, '0');
|
||||
TB_Secure1.Text = SAV.Secure1?.ToString("X16");
|
||||
TB_Secure2.Text = SAV.Secure2?.ToString("X16");
|
||||
break;
|
||||
|
|
@ -1168,8 +1169,9 @@ private void openSAV(SaveFile sav, string path)
|
|||
getFieldsfromPKM = populateFieldsPK7;
|
||||
getPKMfromFields = preparePK7;
|
||||
extraBytes = PK7.ExtraBytes;
|
||||
TB_GameSync.Enabled = (SAV.GameSyncID ?? 0) != 0;
|
||||
TB_GameSync.Text = SAV.GameSyncID?.ToString("X16");
|
||||
TB_GameSync.Enabled = SAV.GameSyncID != null;
|
||||
TB_GameSync.MaxLength = SAV.GameSyncIDSize;
|
||||
TB_GameSync.Text = (SAV.GameSyncID ?? 0.ToString()).PadLeft(SAV.GameSyncIDSize, '0');
|
||||
TB_Secure1.Text = SAV.Secure1?.ToString("X16");
|
||||
TB_Secure2.Text = SAV.Secure2?.ToString("X16");
|
||||
break;
|
||||
|
|
@ -3435,7 +3437,36 @@ private void updateEggRNGSeed(object sender, EventArgs e)
|
|||
{
|
||||
SAV.setDaycareRNGSeed(SAV.DaycareIndex, value);
|
||||
SAV.Edited = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
private void updateGameSyncID(object sender, EventArgs e)
|
||||
{
|
||||
TextBox tb = TB_GameSync;
|
||||
if (tb.Text.Length == 0)
|
||||
{
|
||||
// Reset to 0
|
||||
tb.Text = 0.ToString("X" + SAV.GameSyncIDSize);
|
||||
return; // recursively triggers this method, no need to continue
|
||||
}
|
||||
|
||||
string filterText = Util.getOnlyHex(tb.Text);
|
||||
if (filterText.Length != tb.Text.Length)
|
||||
{
|
||||
Util.Alert("Expected HEX (0-9, A-F).", "Received: " + Environment.NewLine + tb.Text);
|
||||
// Reset to Stored Value
|
||||
var seed = SAV.GameSyncID;
|
||||
if (seed != null)
|
||||
tb.Text = seed;
|
||||
return; // recursively triggers this method, no need to continue
|
||||
}
|
||||
|
||||
// Write final value back to the save
|
||||
var value = filterText.PadLeft(SAV.GameSyncIDSize, '0');
|
||||
if (value != SAV.GameSyncID)
|
||||
{
|
||||
SAV.GameSyncID = value;
|
||||
SAV.Edited = true;
|
||||
}
|
||||
}
|
||||
private void updateU64(object sender, EventArgs e)
|
||||
{
|
||||
|
|
@ -3454,9 +3485,7 @@ private void updateU64(object sender, EventArgs e)
|
|||
ulong? oldval = 0;
|
||||
if (SAV.Generation == 6)
|
||||
{
|
||||
if (tb == TB_GameSync)
|
||||
oldval = SAV.GameSyncID;
|
||||
else if (tb == TB_Secure1)
|
||||
if (tb == TB_Secure1)
|
||||
oldval = SAV.Secure1;
|
||||
else if (tb == TB_Secure2)
|
||||
oldval = SAV.Secure2;
|
||||
|
|
@ -3478,9 +3507,7 @@ private void updateU64(object sender, EventArgs e)
|
|||
|
||||
if (SAV.Generation >= 6)
|
||||
{
|
||||
if (tb == TB_GameSync)
|
||||
SAV.GameSyncID = newval;
|
||||
else if (tb == TB_Secure1)
|
||||
if (tb == TB_Secure1)
|
||||
SAV.Secure1 = newval;
|
||||
else if (tb == TB_Secure2)
|
||||
SAV.Secure2 = newval;
|
||||
|
|
|
|||
|
|
@ -352,10 +352,26 @@ public int Sprite
|
|||
get { return Data[TrainerCard + 7]; }
|
||||
set { Data[TrainerCard + 7] = (byte)value; }
|
||||
}
|
||||
public override ulong? GameSyncID
|
||||
public override int GameSyncIDSize => 16; // 64 bits
|
||||
public override string GameSyncID
|
||||
{
|
||||
get { return BitConverter.ToUInt64(Data, TrainerCard + 8); }
|
||||
set { BitConverter.GetBytes(value ?? 0).CopyTo(Data, TrainerCard + 8); }
|
||||
get
|
||||
{
|
||||
var data = Data.Skip(TrainerCard + 8).Take(GameSyncIDSize / 2).Reverse().ToArray();
|
||||
return BitConverter.ToString(data).Replace("-", "");
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
return;
|
||||
if (value.Length > GameSyncIDSize)
|
||||
return;
|
||||
Enumerable.Range(0, value.Length)
|
||||
.Where(x => x % 2 == 0)
|
||||
.Reverse()
|
||||
.Select(x => Convert.ToByte(value.Substring(x, 2), 16))
|
||||
.ToArray().CopyTo(Data, TrainerCard + 8);
|
||||
}
|
||||
}
|
||||
public override int SubRegion
|
||||
{
|
||||
|
|
|
|||
|
|
@ -316,10 +316,27 @@ public override int Gender
|
|||
get { return Data[TrainerCard + 5]; }
|
||||
set { Data[TrainerCard + 5] = (byte)value; }
|
||||
}
|
||||
public override ulong? GameSyncID
|
||||
public override int GameSyncIDSize => 32; // 128 bits
|
||||
public override string GameSyncID
|
||||
{
|
||||
get { return BitConverter.ToUInt64(Data, TrainerCard + 0x18); }
|
||||
set { BitConverter.GetBytes(value ?? 0).CopyTo(Data, TrainerCard + 0x18); }
|
||||
get
|
||||
{
|
||||
var data = Data.Skip(TrainerCard + 0x18).Take(GameSyncIDSize/2).Reverse().ToArray();
|
||||
return BitConverter.ToString(data).Replace("-", "");
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
return;
|
||||
if (value.Length > GameSyncIDSize)
|
||||
return;
|
||||
|
||||
Enumerable.Range(0, value.Length)
|
||||
.Where(x => x % 2 == 0)
|
||||
.Reverse()
|
||||
.Select(x => Convert.ToByte(value.Substring(x, 2), 16))
|
||||
.ToArray().CopyTo(Data, TrainerCard + 0x18);
|
||||
}
|
||||
}
|
||||
public override int SubRegion
|
||||
{
|
||||
|
|
|
|||
|
|
@ -328,7 +328,8 @@ public virtual MysteryGiftAlbum GiftAlbum
|
|||
public abstract int getPartyOffset(int slot);
|
||||
public abstract string getBoxName(int box);
|
||||
public abstract void setBoxName(int box, string val);
|
||||
public virtual ulong? GameSyncID { get { return null; } set { } }
|
||||
public virtual int GameSyncIDSize { get; } = 8;
|
||||
public virtual string GameSyncID { get { return null; } set { } }
|
||||
public virtual ulong? Secure1 { get { return null; } set { } }
|
||||
public virtual ulong? Secure2 { get { return null; } set { } }
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user