From a5985536e22532288c53c5bb6babfb451c8dc288 Mon Sep 17 00:00:00 2001 From: Egzon Date: Fri, 24 Jan 2020 01:37:39 +0100 Subject: [PATCH] Miscelanous fix on Underground Scores (#2657) * UG scores are uint32, with max value up to 999999. * fixing label position * another positioning fix! --- PKHeX.Core/Saves/SAV4Sinnoh.cs | 14 +- .../Gen4/SAV_Underground.Designer.cs | 140 +++++++++--------- .../Save Editors/Gen4/SAV_Underground.cs | 14 +- 3 files changed, 81 insertions(+), 87 deletions(-) diff --git a/PKHeX.Core/Saves/SAV4Sinnoh.cs b/PKHeX.Core/Saves/SAV4Sinnoh.cs index 71988b5e8..903cf1b22 100644 --- a/PKHeX.Core/Saves/SAV4Sinnoh.cs +++ b/PKHeX.Core/Saves/SAV4Sinnoh.cs @@ -152,13 +152,13 @@ public int[] MunchlaxTrees //Underground Scores protected int OFS_UG_Stats; - public int UG_PlayersMet { get => BitConverter.ToInt32(General, OFS_UG_Stats); set => SetData(General, BitConverter.GetBytes(value), OFS_UG_Stats); } - public int UG_Gifts { get => BitConverter.ToInt32(General, OFS_UG_Stats + 0x4); set => SetData(General, BitConverter.GetBytes(value), OFS_UG_Stats + 0x4); } - public int UG_Spheres { get => BitConverter.ToInt32(General, OFS_UG_Stats + 0xC); set => SetData(General, BitConverter.GetBytes(value), OFS_UG_Stats + 0xC); } - public int UG_Fossils { get => BitConverter.ToInt32(General, OFS_UG_Stats + 0x10); set => SetData(General, BitConverter.GetBytes(value), OFS_UG_Stats + 0x10); } - public int UG_TrapsAvoided { get => BitConverter.ToInt32(General, OFS_UG_Stats + 0x18); set => SetData(General, BitConverter.GetBytes(value), OFS_UG_Stats + 0x18); } - public int UG_TrapsTriggered { get => BitConverter.ToInt32(General, OFS_UG_Stats + 0x1C); set => SetData(General, BitConverter.GetBytes(value), OFS_UG_Stats + 0x1C); } - public int UG_Flags { get => BitConverter.ToInt32(General, OFS_UG_Stats + 0x34); set => SetData(General, BitConverter.GetBytes(value), OFS_UG_Stats + 0x34); } + public uint UG_PlayersMet { get => BitConverter.ToUInt32(General, OFS_UG_Stats); set => SetData(General, BitConverter.GetBytes(value), OFS_UG_Stats); } + public uint UG_Gifts { get => BitConverter.ToUInt32(General, OFS_UG_Stats + 0x4); set => SetData(General, BitConverter.GetBytes(value), OFS_UG_Stats + 0x4); } + public uint UG_Spheres { get => BitConverter.ToUInt32(General, OFS_UG_Stats + 0xC); set => SetData(General, BitConverter.GetBytes(value), OFS_UG_Stats + 0xC); } + public uint UG_Fossils { get => BitConverter.ToUInt32(General, OFS_UG_Stats + 0x10); set => SetData(General, BitConverter.GetBytes(value), OFS_UG_Stats + 0x10); } + public uint UG_TrapsAvoided { get => BitConverter.ToUInt32(General, OFS_UG_Stats + 0x18); set => SetData(General, BitConverter.GetBytes(value), OFS_UG_Stats + 0x18); } + public uint UG_TrapsTriggered { get => BitConverter.ToUInt32(General, OFS_UG_Stats + 0x1C); set => SetData(General, BitConverter.GetBytes(value), OFS_UG_Stats + 0x1C); } + public uint UG_Flags { get => BitConverter.ToUInt32(General, OFS_UG_Stats + 0x34); set => SetData(General, BitConverter.GetBytes(value), OFS_UG_Stats + 0x34); } } public enum PoketchColor diff --git a/PKHeX.WinForms/Subforms/Save Editors/Gen4/SAV_Underground.Designer.cs b/PKHeX.WinForms/Subforms/Save Editors/Gen4/SAV_Underground.Designer.cs index a58e5528c..5850e9578 100644 --- a/PKHeX.WinForms/Subforms/Save Editors/Gen4/SAV_Underground.Designer.cs +++ b/PKHeX.WinForms/Subforms/Save Editors/Gen4/SAV_Underground.Designer.cs @@ -56,10 +56,11 @@ private void InitializeComponent() // B_Save // this.B_Save.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.B_Save.Location = new System.Drawing.Point(202, 181); + this.B_Save.Location = new System.Drawing.Point(269, 223); + this.B_Save.Margin = new System.Windows.Forms.Padding(4); this.B_Save.Name = "B_Save"; - this.B_Save.Size = new System.Drawing.Size(75, 23); - this.B_Save.TabIndex = 1; + this.B_Save.Size = new System.Drawing.Size(100, 28); + this.B_Save.TabIndex = 26; this.B_Save.Text = "Save"; this.B_Save.UseVisualStyleBackColor = true; this.B_Save.Click += new System.EventHandler(this.B_Save_Click); @@ -67,180 +68,174 @@ private void InitializeComponent() // B_Cancel // this.B_Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.B_Cancel.Location = new System.Drawing.Point(121, 181); + this.B_Cancel.Location = new System.Drawing.Point(161, 223); + this.B_Cancel.Margin = new System.Windows.Forms.Padding(4); this.B_Cancel.Name = "B_Cancel"; - this.B_Cancel.Size = new System.Drawing.Size(75, 23); - this.B_Cancel.TabIndex = 2; + this.B_Cancel.Size = new System.Drawing.Size(100, 28); + this.B_Cancel.TabIndex = 25; this.B_Cancel.Text = "Cancel"; this.B_Cancel.UseVisualStyleBackColor = true; this.B_Cancel.Click += new System.EventHandler(this.B_Cancel_Click); // // LU_PlayersMet // - this.LU_PlayersMet.AutoSize = true; - this.LU_PlayersMet.Location = new System.Drawing.Point(68, 15); - this.LU_PlayersMet.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.LU_PlayersMet.Location = new System.Drawing.Point(12, 17); this.LU_PlayersMet.Name = "LU_PlayersMet"; - this.LU_PlayersMet.Size = new System.Drawing.Size(62, 13); + this.LU_PlayersMet.Size = new System.Drawing.Size(161, 22); this.LU_PlayersMet.TabIndex = 3; this.LU_PlayersMet.Text = "Players Met"; + this.LU_PlayersMet.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // U_PlayersMet // - this.U_PlayersMet.Location = new System.Drawing.Point(134, 14); - this.U_PlayersMet.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.U_PlayersMet.Location = new System.Drawing.Point(179, 17); + this.U_PlayersMet.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.U_PlayersMet.Maximum = new decimal(new int[] { - -1, + 999999, 0, 0, 0}); this.U_PlayersMet.Name = "U_PlayersMet"; - this.U_PlayersMet.Size = new System.Drawing.Size(71, 20); - this.U_PlayersMet.TabIndex = 4; + this.U_PlayersMet.Size = new System.Drawing.Size(95, 22); + this.U_PlayersMet.TabIndex = 1; // // LU_Gifts // - this.LU_Gifts.AutoSize = true; - this.LU_Gifts.Location = new System.Drawing.Point(71, 38); - this.LU_Gifts.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.LU_Gifts.Location = new System.Drawing.Point(12, 45); this.LU_Gifts.Name = "LU_Gifts"; - this.LU_Gifts.Size = new System.Drawing.Size(59, 13); + this.LU_Gifts.Size = new System.Drawing.Size(161, 22); this.LU_Gifts.TabIndex = 5; this.LU_Gifts.Text = "Gifts Given"; + this.LU_Gifts.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // U_Gifts // - this.U_Gifts.Location = new System.Drawing.Point(134, 37); - this.U_Gifts.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.U_Gifts.Location = new System.Drawing.Point(179, 45); + this.U_Gifts.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.U_Gifts.Maximum = new decimal(new int[] { - -1, + 999999, 0, 0, 0}); this.U_Gifts.Name = "U_Gifts"; - this.U_Gifts.Size = new System.Drawing.Size(71, 20); - this.U_Gifts.TabIndex = 6; + this.U_Gifts.Size = new System.Drawing.Size(95, 22); + this.U_Gifts.TabIndex = 2; // // LU_Spheres // - this.LU_Spheres.AutoSize = true; - this.LU_Spheres.Location = new System.Drawing.Point(38, 61); - this.LU_Spheres.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.LU_Spheres.Location = new System.Drawing.Point(12, 73); this.LU_Spheres.Name = "LU_Spheres"; - this.LU_Spheres.Size = new System.Drawing.Size(92, 13); + this.LU_Spheres.Size = new System.Drawing.Size(161, 22); this.LU_Spheres.TabIndex = 7; this.LU_Spheres.Text = "Spheres Obtained"; + this.LU_Spheres.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // U_Spheres // - this.U_Spheres.Location = new System.Drawing.Point(134, 59); - this.U_Spheres.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.U_Spheres.Location = new System.Drawing.Point(179, 73); + this.U_Spheres.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.U_Spheres.Maximum = new decimal(new int[] { - -1, + 999999, 0, 0, 0}); this.U_Spheres.Name = "U_Spheres"; - this.U_Spheres.Size = new System.Drawing.Size(71, 20); - this.U_Spheres.TabIndex = 8; + this.U_Spheres.Size = new System.Drawing.Size(95, 22); + this.U_Spheres.TabIndex = 3; // // LU_Fossils // - this.LU_Fossils.AutoSize = true; - this.LU_Fossils.Location = new System.Drawing.Point(45, 84); - this.LU_Fossils.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.LU_Fossils.Location = new System.Drawing.Point(12, 101); this.LU_Fossils.Name = "LU_Fossils"; - this.LU_Fossils.Size = new System.Drawing.Size(84, 13); + this.LU_Fossils.Size = new System.Drawing.Size(161, 22); this.LU_Fossils.TabIndex = 9; this.LU_Fossils.Text = "Fossils Obtained"; + this.LU_Fossils.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // U_Fossils // - this.U_Fossils.Location = new System.Drawing.Point(134, 82); - this.U_Fossils.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.U_Fossils.Location = new System.Drawing.Point(179, 101); + this.U_Fossils.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.U_Fossils.Maximum = new decimal(new int[] { - -1, + 999999, 0, 0, 0}); this.U_Fossils.Name = "U_Fossils"; - this.U_Fossils.Size = new System.Drawing.Size(71, 20); - this.U_Fossils.TabIndex = 10; + this.U_Fossils.Size = new System.Drawing.Size(95, 22); + this.U_Fossils.TabIndex = 4; // // LU_TrapsA // - this.LU_TrapsA.AutoSize = true; - this.LU_TrapsA.Location = new System.Drawing.Point(55, 106); - this.LU_TrapsA.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.LU_TrapsA.Location = new System.Drawing.Point(12, 129); this.LU_TrapsA.Name = "LU_TrapsA"; - this.LU_TrapsA.Size = new System.Drawing.Size(76, 13); + this.LU_TrapsA.Size = new System.Drawing.Size(161, 22); this.LU_TrapsA.TabIndex = 11; this.LU_TrapsA.Text = "Traps Avoided"; + this.LU_TrapsA.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // U_TrapsA // - this.U_TrapsA.Location = new System.Drawing.Point(134, 105); - this.U_TrapsA.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.U_TrapsA.Location = new System.Drawing.Point(179, 129); + this.U_TrapsA.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.U_TrapsA.Maximum = new decimal(new int[] { - -1, + 999999, 0, 0, 0}); this.U_TrapsA.Name = "U_TrapsA"; - this.U_TrapsA.Size = new System.Drawing.Size(71, 20); - this.U_TrapsA.TabIndex = 12; + this.U_TrapsA.Size = new System.Drawing.Size(95, 22); + this.U_TrapsA.TabIndex = 5; // // LU_TrapsT // - this.LU_TrapsT.AutoSize = true; - this.LU_TrapsT.Location = new System.Drawing.Point(46, 129); - this.LU_TrapsT.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.LU_TrapsT.Location = new System.Drawing.Point(12, 157); this.LU_TrapsT.Name = "LU_TrapsT"; - this.LU_TrapsT.Size = new System.Drawing.Size(82, 13); + this.LU_TrapsT.Size = new System.Drawing.Size(161, 22); this.LU_TrapsT.TabIndex = 13; this.LU_TrapsT.Text = "Traps Triggered"; + this.LU_TrapsT.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // U_TrapsT // - this.U_TrapsT.Location = new System.Drawing.Point(134, 128); - this.U_TrapsT.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.U_TrapsT.Location = new System.Drawing.Point(179, 157); + this.U_TrapsT.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.U_TrapsT.Maximum = new decimal(new int[] { - -1, + 999999, 0, 0, 0}); this.U_TrapsT.Name = "U_TrapsT"; - this.U_TrapsT.Size = new System.Drawing.Size(71, 20); - this.U_TrapsT.TabIndex = 14; + this.U_TrapsT.Size = new System.Drawing.Size(95, 22); + this.U_TrapsT.TabIndex = 6; // // LU_Flags // - this.LU_Flags.AutoSize = true; - this.LU_Flags.Location = new System.Drawing.Point(52, 152); - this.LU_Flags.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.LU_Flags.Location = new System.Drawing.Point(12, 184); this.LU_Flags.Name = "LU_Flags"; - this.LU_Flags.Size = new System.Drawing.Size(78, 13); + this.LU_Flags.Size = new System.Drawing.Size(161, 22); this.LU_Flags.TabIndex = 15; this.LU_Flags.Text = "Flags Captured"; + this.LU_Flags.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // U_Flags // - this.U_Flags.Location = new System.Drawing.Point(134, 150); - this.U_Flags.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.U_Flags.Location = new System.Drawing.Point(179, 184); + this.U_Flags.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.U_Flags.Maximum = new decimal(new int[] { - -1, + 999999, 0, 0, 0}); this.U_Flags.Name = "U_Flags"; - this.U_Flags.Size = new System.Drawing.Size(71, 20); - this.U_Flags.TabIndex = 16; + this.U_Flags.Size = new System.Drawing.Size(95, 22); + this.U_Flags.TabIndex = 7; // // SAV_Underground // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(284, 212); + this.ClientSize = new System.Drawing.Size(379, 261); this.Controls.Add(this.U_Flags); this.Controls.Add(this.LU_Flags); this.Controls.Add(this.U_TrapsT); @@ -258,7 +253,7 @@ private void InitializeComponent() this.Controls.Add(this.B_Cancel); this.Controls.Add(this.B_Save); this.Icon = global::PKHeX.WinForms.Properties.Resources.Icon; - this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.Name = "SAV_Underground"; this.Text = "Underground Scores Editor"; ((System.ComponentModel.ISupportInitialize)(this.U_PlayersMet)).EndInit(); @@ -269,7 +264,6 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.U_TrapsT)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.U_Flags)).EndInit(); this.ResumeLayout(false); - this.PerformLayout(); } diff --git a/PKHeX.WinForms/Subforms/Save Editors/Gen4/SAV_Underground.cs b/PKHeX.WinForms/Subforms/Save Editors/Gen4/SAV_Underground.cs index 52a24c165..c617305a8 100644 --- a/PKHeX.WinForms/Subforms/Save Editors/Gen4/SAV_Underground.cs +++ b/PKHeX.WinForms/Subforms/Save Editors/Gen4/SAV_Underground.cs @@ -31,13 +31,13 @@ private void GetUGScores() private void SetUGScores() { - SAV.UG_PlayersMet = (int)U_PlayersMet.Value; - SAV.UG_Gifts = (int)U_Gifts.Value; - SAV.UG_Spheres = (int)U_Spheres.Value; - SAV.UG_Fossils = (int)U_Fossils.Value; - SAV.UG_TrapsAvoided = (int)U_TrapsA.Value; - SAV.UG_TrapsTriggered = (int)U_TrapsT.Value; - SAV.UG_Flags = (int)U_Flags.Value; + SAV.UG_PlayersMet = (uint)U_PlayersMet.Value; + SAV.UG_Gifts = (uint)U_Gifts.Value; + SAV.UG_Spheres = (uint)U_Spheres.Value; + SAV.UG_Fossils = (uint)U_Fossils.Value; + SAV.UG_TrapsAvoided = (uint)U_TrapsA.Value; + SAV.UG_TrapsTriggered = (uint)U_TrapsT.Value; + SAV.UG_Flags = (uint)U_Flags.Value; } private void B_Save_Click(object sender, EventArgs e)