diff --git a/PKHeX/Subforms/Save Editors/Gen6/SAV_HallOfFame.Designer.cs b/PKHeX/Subforms/Save Editors/Gen6/SAV_HallOfFame.Designer.cs index 5573fbdcb..799f319db 100644 --- a/PKHeX/Subforms/Save Editors/Gen6/SAV_HallOfFame.Designer.cs +++ b/PKHeX/Subforms/Save Editors/Gen6/SAV_HallOfFame.Designer.cs @@ -108,7 +108,7 @@ this.RTB.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.RTB.Font = new System.Drawing.Font("Arial Narrow", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.RTB.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.RTB.Location = new System.Drawing.Point(72, 16); this.RTB.Name = "RTB"; this.RTB.ReadOnly = true; @@ -205,7 +205,7 @@ // this.TB_Nickname.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.TB_Nickname.Location = new System.Drawing.Point(483, 71); - this.TB_Nickname.MaxLength = 11; + this.TB_Nickname.MaxLength = 12; this.TB_Nickname.Name = "TB_Nickname"; this.TB_Nickname.Size = new System.Drawing.Size(122, 20); this.TB_Nickname.TabIndex = 37; @@ -539,7 +539,7 @@ // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(614, 312); + this.ClientSize = new System.Drawing.Size(604, 301); this.Controls.Add(this.B_Delete); this.Controls.Add(this.B_CopyText); this.Controls.Add(this.TB_Level); diff --git a/PKHeX/Subforms/Save Editors/Gen6/SAV_HallOfFame.cs b/PKHeX/Subforms/Save Editors/Gen6/SAV_HallOfFame.cs index 6dcf088a8..e6b932377 100644 --- a/PKHeX/Subforms/Save Editors/Gen6/SAV_HallOfFame.cs +++ b/PKHeX/Subforms/Save Editors/Gen6/SAV_HallOfFame.cs @@ -144,8 +144,8 @@ namespace PKHeX uint shiny = slgf >> 14 & 0x1; // uint unkn = slgf >> 15; - string nickname = Util.TrimFromZero(Encoding.Unicode.GetString(data, offset + 0x18, 22)); - string OTname = Util.TrimFromZero(Encoding.Unicode.GetString(data, offset + 0x30, 22)); + string nickname = Util.TrimFromZero(Encoding.Unicode.GetString(data, offset + 0x18, 24)); + string OTname = Util.TrimFromZero(Encoding.Unicode.GetString(data, offset + 0x30, 24)); if (species == 0) continue; @@ -207,8 +207,8 @@ namespace PKHeX TB_TID.Text = BitConverter.ToUInt16(data, offset + 0x10).ToString("00000"); TB_SID.Text = BitConverter.ToUInt16(data, offset + 0x12).ToString("00000"); - TB_Nickname.Text = Util.TrimFromZero(Encoding.Unicode.GetString(data, offset + 0x18, 22)); - TB_OT.Text = Util.TrimFromZero(Encoding.Unicode.GetString(data, offset + 0x30, 22)); + TB_Nickname.Text = Util.TrimFromZero(Encoding.Unicode.GetString(data, offset + 0x18, 24)); + TB_OT.Text = Util.TrimFromZero(Encoding.Unicode.GetString(data, offset + 0x30, 24)); uint slgf = BitConverter.ToUInt32(data, offset + 0x14); uint form = slgf & 0x1F; @@ -236,61 +236,21 @@ namespace PKHeX return; //Don't do writing until loaded Validate_TextBoxes(); - byte[] StringBuffer = new byte[22]; //Mimic in-game behavior of not clearing strings. It's awful, but accuracy > good. - string[] text_writes = new string[6 * 2]; //2 strings per mon, 6 mons int index = LB_DataEntry.SelectedIndex; - - int offset = index * 0x1B4; - for (int i = 0; i < text_writes.Length; i++) - { - string nickname = Util.TrimFromZero(Encoding.Unicode.GetString(data, offset + 0x18, 22)); - string OTname = Util.TrimFromZero(Encoding.Unicode.GetString(data, offset + 0x30, 22)); - text_writes[i] = nickname; - i++; - text_writes[i] = OTname; - offset += 0x48; - } - int partymember = Convert.ToInt32(NUP_PartyIndex.Value) - 1; + int offset = index * 0x1B4 + partymember * 0x48; - text_writes[partymember * 2] = TB_Nickname.Text; - text_writes[partymember * 2 + 1] = TB_OT.Text; - - offset = index * 0x1B4 + partymember * 0x48; + BitConverter.GetBytes(Convert.ToUInt16(CB_Species.SelectedValue)).CopyTo(data, offset + 0x00); + BitConverter.GetBytes(Convert.ToUInt16(CB_HeldItem.SelectedValue)).CopyTo(data, offset + 0x02); + BitConverter.GetBytes(Convert.ToUInt16(CB_Move1.SelectedValue)).CopyTo(data, offset + 0x04); + 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); - Array.Copy(BitConverter.GetBytes(Convert.ToUInt16(CB_Species.SelectedValue)), 0, data, offset + 0x00, 2); - Array.Copy(BitConverter.GetBytes(Convert.ToUInt16(CB_HeldItem.SelectedValue)), 0, data, offset + 0x02, 2); - Array.Copy(BitConverter.GetBytes(Convert.ToUInt16(CB_Move1.SelectedValue)), 0, data, offset + 0x04, 2); - Array.Copy(BitConverter.GetBytes(Convert.ToUInt16(CB_Move2.SelectedValue)), 0, data, offset + 0x06, 2); - Array.Copy(BitConverter.GetBytes(Convert.ToUInt16(CB_Move3.SelectedValue)), 0, data, offset + 0x08, 2); - Array.Copy(BitConverter.GetBytes(Convert.ToUInt16(CB_Move4.SelectedValue)), 0, data, offset + 0x0A, 2); - Array.Copy(BitConverter.GetBytes(Convert.ToUInt32(TB_EC.Text,16)), 0, data, offset + 0x0C, 4); - - Array.Copy(BitConverter.GetBytes(Convert.ToUInt16(TB_TID.Text)), 0, data, offset + 0x010, 2); - Array.Copy(BitConverter.GetBytes(Convert.ToUInt16(TB_SID.Text)), 0, data, offset + 0x012, 2); - - #region Write Strings - { - int ofs = index * 0x1B4; - for (int i = 0; i < 6; i++) - { - Array.Copy(Encoding.Unicode.GetBytes(text_writes[i * 2]), StringBuffer, text_writes[i*2].Length*2); - int pos = text_writes[i * 2].Length * 2; - if (pos good. + string pk = TB_Nickname.Text; if (pk.Length != 12) pk = pk.PadRight(pk.Length + 1, '\0'); + string ot = TB_OT.Text; if (ot.Length != 12) ot = ot.PadRight(pk.Length + 1, '\0'); + Encoding.Unicode.GetBytes(pk).CopyTo(data, offset + 0x18); + Encoding.Unicode.GetBytes(ot).CopyTo(data, offset + 0x30); offset = index * 0x1B4; @@ -328,9 +294,9 @@ namespace PKHeX private void Validate_TextBoxes() { TB_Level.Text = Math.Min(Util.ToInt32(TB_Level.Text), 100).ToString(); - TB_VN.Text = Math.Min(Util.ToInt32(TB_VN.Text), 255).ToString(); - TB_TID.Text = Math.Min(Util.ToInt32(TB_TID.Text), 65535).ToString(); - TB_SID.Text = Math.Min(Util.ToInt32(TB_SID.Text), 65535).ToString(); + TB_VN.Text = Math.Min(Util.ToInt32(TB_VN.Text), byte.MaxValue).ToString(); + TB_TID.Text = Math.Min(Util.ToInt32(TB_TID.Text), ushort.MaxValue).ToString(); + TB_SID.Text = Math.Min(Util.ToInt32(TB_SID.Text), ushort.MaxValue).ToString(); } private void updateNickname(object sender, EventArgs e) {