From 8fca2075d922e8b48e47cb0cef03a73f68489a45 Mon Sep 17 00:00:00 2001 From: Jonathan Herbert Date: Sun, 16 Apr 2023 16:16:34 -0400 Subject: [PATCH] Add Game Start Time Editor For Scarlet and Violet (#3861) --- .../Gen9/SAV_Trainer9.Designer.cs | 28 +++++++++++++++++++ .../Save Editors/Gen9/SAV_Trainer9.cs | 10 +++++-- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/PKHeX.WinForms/Subforms/Save Editors/Gen9/SAV_Trainer9.Designer.cs b/PKHeX.WinForms/Subforms/Save Editors/Gen9/SAV_Trainer9.Designer.cs index 544e653ba..0246fe457 100644 --- a/PKHeX.WinForms/Subforms/Save Editors/Gen9/SAV_Trainer9.Designer.cs +++ b/PKHeX.WinForms/Subforms/Save Editors/Gen9/SAV_Trainer9.Designer.cs @@ -107,6 +107,8 @@ private void InitializeComponent() this.L_Y = new System.Windows.Forms.Label(); this.L_Z = new System.Windows.Forms.Label(); this.L_X = new System.Windows.Forms.Label(); + this.L_Started = new System.Windows.Forms.Label(); + this.CAL_AdventureStartDate = new System.Windows.Forms.DateTimePicker(); this.TC_Editor.SuspendLayout(); this.Tab_Overview.SuspendLayout(); this.Tab_MiscValues.SuspendLayout(); @@ -626,6 +628,8 @@ private void InitializeComponent() // // Tab_Overview // + this.Tab_Overview.Controls.Add(this.L_Started); + this.Tab_Overview.Controls.Add(this.CAL_AdventureStartDate); this.Tab_Overview.Controls.Add(this.MT_Seconds); this.Tab_Overview.Controls.Add(this.MT_LP); this.Tab_Overview.Controls.Add(this.MT_Hours); @@ -865,6 +869,28 @@ private void InitializeComponent() this.L_X.Text = "X Coordinate:"; this.L_X.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // + // L_Started + // + this.L_Started.Location = new System.Drawing.Point(19, 199); + this.L_Started.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.L_Started.Name = "L_Started"; + this.L_Started.Size = new System.Drawing.Size(93, 23); + this.L_Started.TabIndex = 73; + this.L_Started.Text = "Game Started:"; + this.L_Started.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // CAL_AdventureStartDate + // + this.CAL_AdventureStartDate.Format = System.Windows.Forms.DateTimePickerFormat.Short; + this.CAL_AdventureStartDate.Location = new System.Drawing.Point(112, 197); + this.CAL_AdventureStartDate.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.CAL_AdventureStartDate.MaxDate = new System.DateTime(2050, 12, 31, 0, 0, 0, 0); + this.CAL_AdventureStartDate.MinDate = new System.DateTime(1932, 1, 1, 0, 0, 0, 0); + this.CAL_AdventureStartDate.Name = "CAL_AdventureStartDate"; + this.CAL_AdventureStartDate.Size = new System.Drawing.Size(115, 23); + this.CAL_AdventureStartDate.TabIndex = 72; + this.CAL_AdventureStartDate.Value = new System.DateTime(2000, 1, 1, 0, 0, 0, 0); + // // SAV_Trainer9 // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); @@ -974,5 +1000,7 @@ private void InitializeComponent() private System.Windows.Forms.Button B_CollectAllStakes; private System.Windows.Forms.Button B_UnlockTMRecipes; private System.Windows.Forms.Button B_UnlockBikeUpgrades; + private System.Windows.Forms.Label L_Started; + private System.Windows.Forms.DateTimePicker CAL_AdventureStartDate; } } diff --git a/PKHeX.WinForms/Subforms/Save Editors/Gen9/SAV_Trainer9.cs b/PKHeX.WinForms/Subforms/Save Editors/Gen9/SAV_Trainer9.cs index e9be22c05..692b09a48 100644 --- a/PKHeX.WinForms/Subforms/Save Editors/Gen9/SAV_Trainer9.cs +++ b/PKHeX.WinForms/Subforms/Save Editors/Gen9/SAV_Trainer9.cs @@ -79,6 +79,8 @@ private void GetTextBoxes() MT_Hours.Text = SAV.PlayedHours.ToString(); MT_Minutes.Text = SAV.PlayedMinutes.ToString(); MT_Seconds.Text = SAV.PlayedSeconds.ToString(); + + CAL_AdventureStartDate.Value = SAV.EnrollmentDate.Timestamp; } private void Save() @@ -106,9 +108,11 @@ private void SaveTrainerInfo() // Save PlayTime SAV.PlayedHours = ushort.Parse(MT_Hours.Text); - SAV.PlayedMinutes = ushort.Parse(MT_Minutes.Text)%60; - SAV.PlayedSeconds = ushort.Parse(MT_Seconds.Text)%60; - } + SAV.PlayedMinutes = ushort.Parse(MT_Minutes.Text) % 60; + SAV.PlayedSeconds = ushort.Parse(MT_Seconds.Text) % 60; + + SAV.EnrollmentDate.Timestamp = CAL_AdventureStartDate.Value; + } private void ClickOT(object sender, MouseEventArgs e) {