From 43b1afec3f4483e1936c5464c5a53eaf09e197a0 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sat, 31 Jan 2015 15:59:23 -0800 Subject: [PATCH] Bugfixes --- Misc/PKX.cs | 31 ++++++--- Misc/SplashScreen.cs | 4 +- PKX/f1-Main.cs | 13 ++-- PKX/f3-MemoryAmie.Designer.cs | 120 +++++++++++++++++++-------------- PKX/f3-MemoryAmie.cs | 42 ++++++------ SAV/SAV_HallOfFame.Designer.cs | 24 +++---- SAV/SAV_HallOfFame.cs | 13 ++-- SAV/SAV_Trainer.cs | 10 ++- SAV/SAV_Wondercard.cs | 42 ++++++++++-- 9 files changed, 182 insertions(+), 117 deletions(-) diff --git a/Misc/PKX.cs b/Misc/PKX.cs index eb2c99943..b030b3b2c 100644 --- a/Misc/PKX.cs +++ b/Misc/PKX.cs @@ -1146,23 +1146,32 @@ namespace PKHeX // Font Related [System.Runtime.InteropServices.DllImport("gdi32.dll")] - private static extern IntPtr AddFontMemResourceEx(IntPtr pbFont, uint cbFont, IntPtr pdv, [System.Runtime.InteropServices.In] ref uint pcFonts); - internal static Font getPKXFont(float fontsize) + internal static extern IntPtr AddFontMemResourceEx(IntPtr pbFont, uint cbFont, IntPtr pdv, [System.Runtime.InteropServices.In] ref uint pcFonts); + internal static PrivateFontCollection s_FontCollection = new PrivateFontCollection(); + internal static FontFamily[] FontFamilies + { + get + { + if (s_FontCollection.Families.Length == 0) setPKXFont(); + return s_FontCollection.Families; + } + } + internal static Font getPKXFont(float size) + { + return new Font(FontFamilies[0], size); + } + internal static void setPKXFont() { - byte[] fontData = Properties.Resources.PGLDings_NormalRegular; - IntPtr fontPtr = System.Runtime.InteropServices.Marshal.AllocCoTaskMem(fontData.Length); - System.Runtime.InteropServices.Marshal.Copy(fontData, 0, fontPtr, fontData.Length); - PrivateFontCollection fonts = new PrivateFontCollection(); try { - fonts.AddMemoryFont(fontPtr, Properties.Resources.PGLDings_NormalRegular.Length); uint dummy = 0; + byte[] fontData = Properties.Resources.PGLDings_NormalRegular; + IntPtr fontPtr = System.Runtime.InteropServices.Marshal.AllocCoTaskMem(fontData.Length); + System.Runtime.InteropServices.Marshal.Copy(fontData, 0, fontPtr, fontData.Length); + s_FontCollection.AddMemoryFont(fontPtr, Properties.Resources.PGLDings_NormalRegular.Length); uint dummy = 0; AddFontMemResourceEx(fontPtr, (uint)Properties.Resources.PGLDings_NormalRegular.Length, IntPtr.Zero, ref dummy); System.Runtime.InteropServices.Marshal.FreeCoTaskMem(fontPtr); - Font f = new Font(fonts.Families[0], fontsize); - GC.Collect(); - return f; } - catch { Util.Error("Unable to add ingame font."); return null; } + catch { Util.Error("Unable to add ingame font."); return; } } // Personal.dat diff --git a/Misc/SplashScreen.cs b/Misc/SplashScreen.cs index 687f4a9ce..362e9ee08 100644 --- a/Misc/SplashScreen.cs +++ b/Misc/SplashScreen.cs @@ -14,7 +14,7 @@ namespace PKHeX m_parent = frm1; System.Timers.Timer myTimer = new System.Timers.Timer(); myTimer.Elapsed += new ElapsedEventHandler(DisplayTimeEvent); - myTimer.Interval = 5; // milliseconds per trigger interval + myTimer.Interval = 50; // milliseconds per trigger interval myTimer.Start(); } public void DisplayTimeEvent(object source, ElapsedEventArgs e) @@ -24,7 +24,7 @@ namespace PKHeX else { L_Status.Text = Form1.Status; } else if (InvokeRequired && IsHandleCreated) - Invoke((MethodInvoker)delegate() { Close(); }); + try { Invoke((MethodInvoker)delegate() { Close(); }); } catch { Close(); } else Close(); } } diff --git a/PKX/f1-Main.cs b/PKX/f1-Main.cs index 69886d45a..8cc2dbafc 100644 --- a/PKX/f1-Main.cs +++ b/PKX/f1-Main.cs @@ -158,6 +158,7 @@ namespace PKHeX Status = "Checking load args."; string[] args = Environment.GetCommandLineArgs(); pathSDF = Util.GetSDFLocation(); + path3DS = Util.get3DSLocation(); if (args.Length > 1) openQuick(args[1]); else if (pathSDF != null) @@ -1208,15 +1209,15 @@ namespace PKHeX public void setCountrySubRegion(object sender, string type) { ComboBox CB = sender as ComboBox; - int index = Util.getIndex(CB); + int index = CB.SelectedIndex; // fix for Korean / Chinese being swapped string cl = curlanguage + ""; cl = (cl == "zh") ? "ko" : (cl == "ko") ? "zh" : cl; CB.DataSource = Util.getCBList(type, cl); - if (index > 0 && index <= CB.Items.Count) - CB.SelectedValue = index; + if (index > 0 && index <= CB.Items.Count && init) + CB.SelectedIndex = index; } public void setForms(int species, ComboBox cb) { @@ -1738,8 +1739,8 @@ namespace PKHeX L_Potential.Text = "++++"; } - // Characteristic with PID%6 - int pm6 = (int)(Util.getHEXval(TB_PID) % 6); // PID MOD 6 + // Characteristic with EC%6 + int pm6 = (int)(Util.getHEXval(TB_EC) % 6); // EC MOD 6 int maxIV = iva.Max(); int pm6stat = 0; @@ -1747,7 +1748,7 @@ namespace PKHeX { pm6stat = (pm6 + i) % 6; if (iva[pm6stat] == maxIV) - break; // P%6 is this stat + break; // P%6 is this stat } L_Characteristic.Text = characteristics[pm6stat * 5 + maxIV % 5]; diff --git a/PKX/f3-MemoryAmie.Designer.cs b/PKX/f3-MemoryAmie.Designer.cs index e56f238a4..4e05a0f8b 100644 --- a/PKX/f3-MemoryAmie.Designer.cs +++ b/PKX/f3-MemoryAmie.Designer.cs @@ -53,11 +53,11 @@ this.L_OT_Affection = new System.Windows.Forms.Label(); this.M_OT_Affection = new System.Windows.Forms.MaskedTextBox(); this.GB_Residence = new System.Windows.Forms.GroupBox(); - this.Region4 = new System.Windows.Forms.ComboBox(); - this.Region3 = new System.Windows.Forms.ComboBox(); - this.Region2 = new System.Windows.Forms.ComboBox(); - this.Region1 = new System.Windows.Forms.ComboBox(); - this.Region0 = new System.Windows.Forms.ComboBox(); + this.CB_Region4 = new System.Windows.Forms.ComboBox(); + this.CB_Region3 = new System.Windows.Forms.ComboBox(); + this.CB_Region2 = new System.Windows.Forms.ComboBox(); + this.CB_Region1 = new System.Windows.Forms.ComboBox(); + this.CB_Region0 = new System.Windows.Forms.ComboBox(); this.CB_Country4 = new System.Windows.Forms.ComboBox(); this.CB_Country3 = new System.Windows.Forms.ComboBox(); this.CB_Country2 = new System.Windows.Forms.ComboBox(); @@ -364,11 +364,11 @@ // // GB_Residence // - this.GB_Residence.Controls.Add(this.Region4); - this.GB_Residence.Controls.Add(this.Region3); - this.GB_Residence.Controls.Add(this.Region2); - this.GB_Residence.Controls.Add(this.Region1); - this.GB_Residence.Controls.Add(this.Region0); + this.GB_Residence.Controls.Add(this.CB_Region4); + this.GB_Residence.Controls.Add(this.CB_Region3); + this.GB_Residence.Controls.Add(this.CB_Region2); + this.GB_Residence.Controls.Add(this.CB_Region1); + this.GB_Residence.Controls.Add(this.CB_Region0); this.GB_Residence.Controls.Add(this.CB_Country4); this.GB_Residence.Controls.Add(this.CB_Country3); this.GB_Residence.Controls.Add(this.CB_Country2); @@ -388,53 +388,65 @@ this.GB_Residence.TabStop = false; this.GB_Residence.Text = "Pokémon has Resided in:"; // - // Region4 + // CB_Region4 // - this.Region4.DropDownWidth = 180; - this.Region4.FormattingEnabled = true; - this.Region4.Location = new System.Drawing.Point(204, 158); - this.Region4.Name = "Region4"; - this.Region4.Size = new System.Drawing.Size(102, 21); - this.Region4.TabIndex = 88; + this.CB_Region4.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; + this.CB_Region4.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; + this.CB_Region4.DropDownWidth = 180; + this.CB_Region4.FormattingEnabled = true; + this.CB_Region4.Location = new System.Drawing.Point(204, 158); + this.CB_Region4.Name = "CB_Region4"; + this.CB_Region4.Size = new System.Drawing.Size(102, 21); + this.CB_Region4.TabIndex = 88; // - // Region3 + // CB_Region3 // - this.Region3.DropDownWidth = 180; - this.Region3.FormattingEnabled = true; - this.Region3.Location = new System.Drawing.Point(204, 126); - this.Region3.Name = "Region3"; - this.Region3.Size = new System.Drawing.Size(102, 21); - this.Region3.TabIndex = 87; + this.CB_Region3.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; + this.CB_Region3.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; + this.CB_Region3.DropDownWidth = 180; + this.CB_Region3.FormattingEnabled = true; + this.CB_Region3.Location = new System.Drawing.Point(204, 126); + this.CB_Region3.Name = "CB_Region3"; + this.CB_Region3.Size = new System.Drawing.Size(102, 21); + this.CB_Region3.TabIndex = 87; // - // Region2 + // CB_Region2 // - this.Region2.DropDownWidth = 180; - this.Region2.FormattingEnabled = true; - this.Region2.Location = new System.Drawing.Point(204, 93); - this.Region2.Name = "Region2"; - this.Region2.Size = new System.Drawing.Size(102, 21); - this.Region2.TabIndex = 86; + this.CB_Region2.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; + this.CB_Region2.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; + this.CB_Region2.DropDownWidth = 180; + this.CB_Region2.FormattingEnabled = true; + this.CB_Region2.Location = new System.Drawing.Point(204, 93); + this.CB_Region2.Name = "CB_Region2"; + this.CB_Region2.Size = new System.Drawing.Size(102, 21); + this.CB_Region2.TabIndex = 86; // - // Region1 + // CB_Region1 // - this.Region1.DropDownWidth = 180; - this.Region1.FormattingEnabled = true; - this.Region1.Location = new System.Drawing.Point(204, 60); - this.Region1.Name = "Region1"; - this.Region1.Size = new System.Drawing.Size(102, 21); - this.Region1.TabIndex = 85; + this.CB_Region1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; + this.CB_Region1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; + this.CB_Region1.DropDownWidth = 180; + this.CB_Region1.FormattingEnabled = true; + this.CB_Region1.Location = new System.Drawing.Point(204, 60); + this.CB_Region1.Name = "CB_Region1"; + this.CB_Region1.Size = new System.Drawing.Size(102, 21); + this.CB_Region1.TabIndex = 85; // - // Region0 + // CB_Region0 // - this.Region0.DropDownWidth = 180; - this.Region0.FormattingEnabled = true; - this.Region0.Location = new System.Drawing.Point(204, 27); - this.Region0.Name = "Region0"; - this.Region0.Size = new System.Drawing.Size(102, 21); - this.Region0.TabIndex = 84; + this.CB_Region0.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; + this.CB_Region0.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; + this.CB_Region0.DropDownWidth = 180; + this.CB_Region0.FormattingEnabled = true; + this.CB_Region0.Location = new System.Drawing.Point(204, 27); + this.CB_Region0.Name = "CB_Region0"; + this.CB_Region0.Size = new System.Drawing.Size(102, 21); + this.CB_Region0.TabIndex = 84; // // CB_Country4 // + this.CB_Country4.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; + this.CB_Country4.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Country4.DropDownWidth = 180; this.CB_Country4.FormattingEnabled = true; this.CB_Country4.Location = new System.Drawing.Point(82, 158); @@ -445,6 +457,8 @@ // // CB_Country3 // + this.CB_Country3.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; + this.CB_Country3.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Country3.DropDownWidth = 180; this.CB_Country3.FormattingEnabled = true; this.CB_Country3.Location = new System.Drawing.Point(82, 126); @@ -455,6 +469,8 @@ // // CB_Country2 // + this.CB_Country2.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; + this.CB_Country2.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Country2.DropDownWidth = 180; this.CB_Country2.FormattingEnabled = true; this.CB_Country2.Location = new System.Drawing.Point(82, 93); @@ -465,6 +481,8 @@ // // CB_Country1 // + this.CB_Country1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; + this.CB_Country1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Country1.DropDownWidth = 180; this.CB_Country1.FormattingEnabled = true; this.CB_Country1.Location = new System.Drawing.Point(82, 60); @@ -475,6 +493,8 @@ // // CB_Country0 // + this.CB_Country0.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; + this.CB_Country0.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_Country0.DropDownWidth = 180; this.CB_Country0.FormattingEnabled = true; this.CB_Country0.Location = new System.Drawing.Point(82, 27); @@ -864,10 +884,10 @@ private System.Windows.Forms.RichTextBox RTB_OT; private System.Windows.Forms.RichTextBox RTB_CT; private System.Windows.Forms.Label L_Arguments; - private System.Windows.Forms.ComboBox Region4; - private System.Windows.Forms.ComboBox Region3; - private System.Windows.Forms.ComboBox Region2; - private System.Windows.Forms.ComboBox Region1; - private System.Windows.Forms.ComboBox Region0; + private System.Windows.Forms.ComboBox CB_Region4; + private System.Windows.Forms.ComboBox CB_Region3; + private System.Windows.Forms.ComboBox CB_Region2; + private System.Windows.Forms.ComboBox CB_Region1; + private System.Windows.Forms.ComboBox CB_Region0; } } \ No newline at end of file diff --git a/PKX/f3-MemoryAmie.cs b/PKX/f3-MemoryAmie.cs index e553bc158..475441ef1 100644 --- a/PKX/f3-MemoryAmie.cs +++ b/PKX/f3-MemoryAmie.cs @@ -24,6 +24,10 @@ namespace PKHeX public MemoryAmie(Form1 frm1) { InitializeComponent(); + CB_Country0.DisplayMember = CB_Country1.DisplayMember = CB_Country2.DisplayMember = CB_Country3.DisplayMember = CB_Country4.DisplayMember = "Text"; + CB_Country0.ValueMember = CB_Country1.ValueMember = CB_Country2.ValueMember = CB_Country3.ValueMember = CB_Country4.ValueMember = "Value"; + CB_Region0.DisplayMember = CB_Region1.DisplayMember = CB_Region2.DisplayMember = CB_Region3.DisplayMember = CB_Region4.DisplayMember = "Text"; + CB_Region0.ValueMember = CB_Region1.ValueMember = CB_Region2.ValueMember = CB_Region3.ValueMember = CB_Region4.ValueMember = "Value"; Util.TranslateInterface(this, Form1.curlanguage); m_parent = frm1; string[] arguments = Regex.Split(L_Arguments.Text, " ; "); @@ -55,11 +59,11 @@ namespace PKHeX private void loadFields() { // Load the region/country values. - v1cb(CB_Country0, 0x95); v1cb(Region0, 0x94); - v1cb(CB_Country1, 0x97); v1cb(Region1, 0x96); - v1cb(CB_Country2, 0x99); v1cb(Region2, 0x98); - v1cb(CB_Country3, 0x9B); v1cb(Region3, 0x9A); - v1cb(CB_Country4, 0x9D); v1cb(Region4, 0x9C); + v1cb(CB_Country0, 0x95); v1cb(CB_Region0, 0x94); + v1cb(CB_Country1, 0x97); v1cb(CB_Region1, 0x96); + v1cb(CB_Country2, 0x99); v1cb(CB_Region2, 0x98); + v1cb(CB_Country3, 0x9B); v1cb(CB_Region3, 0x9A); + v1cb(CB_Country4, 0x9D); v1cb(CB_Region4, 0x9C); // Load the Fullness, and Enjoyment v1s(M_Fullness, 0xAE); v1s(M_Enjoyment, 0xAF); @@ -141,11 +145,11 @@ namespace PKHeX private void saveFields() { // Save Region & Country Data - cb1v(Region0, 0x94); cb1v(CB_Country0, 0x95); - cb1v(Region1, 0x96); cb1v(CB_Country1, 0x97); - cb1v(Region2, 0x98); cb1v(CB_Country2, 0x99); - cb1v(Region3, 0x9A); cb1v(CB_Country3, 0x9B); - cb1v(Region4, 0x9C); cb1v(CB_Country4, 0x9D); + cb1v(CB_Region0, 0x94); cb1v(CB_Country0, 0x95); + cb1v(CB_Region1, 0x96); cb1v(CB_Country1, 0x97); + cb1v(CB_Region2, 0x98); cb1v(CB_Country2, 0x99); + cb1v(CB_Region3, 0x9A); cb1v(CB_Country3, 0x9B); + cb1v(CB_Region4, 0x9C); cb1v(CB_Country4, 0x9D); // Save 0-255 stats s1v(M_CT_Friendship, 0xA2); s1v(M_CT_Affection, 0xA3); @@ -251,9 +255,9 @@ namespace PKHeX ComboBox[] cba = new ComboBox[] { CB_Country0, CB_Country1, CB_Country2, CB_Country3, CB_Country4, }; for (int i = 0; i < cba.Length; i++) { - m_parent.setCountrySubRegion(cba[i], "countries"); cba[i].DisplayMember = "Text"; cba[i].ValueMember = "Value"; + m_parent.setCountrySubRegion(cba[i], "countries"); } } private void getLangStrings() @@ -269,16 +273,15 @@ namespace PKHeX } Array.Resize(ref allowed, allowed.Length - 1); var memory_list1 = Util.getCBList(new string[] { memories[0] }, null); - var memory_list = Util.getOffsetCBList(memory_list1, memories, 0, allowed); + var memory_list = Util.getOffsetCBList(memory_list1, memories, 0, allowed); - CB_OTMemory.DataSource = memory_list; CB_OTMemory.DisplayMember = "Text"; CB_OTMemory.ValueMember = "Value"; + CB_OTMemory.DataSource = memory_list; - var mem1_list = new BindingSource(memory_list, null); - CB_CTMemory.DataSource = mem1_list; CB_CTMemory.DisplayMember = "Text"; CB_CTMemory.ValueMember = "Value"; + CB_CTMemory.DataSource = new BindingSource(memory_list, null); // Quality Chooser CB_CTQual.Items.Clear(); @@ -499,7 +502,7 @@ namespace PKHeX }; ComboBox[] mta = new ComboBox[] { - Region0, Region1, Region2, Region3, Region4, + CB_Region0, CB_Region1, CB_Region2, CB_Region3, CB_Region4, }; int index = Array.IndexOf(cba, sender as ComboBox); if (Util.getIndex(sender as ComboBox) > 0) @@ -529,16 +532,15 @@ namespace PKHeX }; ComboBox[] mta = new ComboBox[] { - Region0, Region1, Region2, Region3, Region4, + CB_Region0, CB_Region1, CB_Region2, CB_Region3, CB_Region4, }; int index = Array.IndexOf(senderarr, sender as Label); cba[index].SelectedValue = 0; - // doesn't work - // mta[index].SelectedValue = 0; - mta[index].DataSource = new[] { new { Text = "", Value = 0 } }; mta[index].DisplayMember = "Text"; mta[index].ValueMember = "Value"; + mta[index].DataSource = new[] { new { Text = "", Value = 0 } }; + mta[index].SelectedValue = 0; } } } diff --git a/SAV/SAV_HallOfFame.Designer.cs b/SAV/SAV_HallOfFame.Designer.cs index f11f79f45..5573fbdcb 100644 --- a/SAV/SAV_HallOfFame.Designer.cs +++ b/SAV/SAV_HallOfFame.Designer.cs @@ -29,7 +29,7 @@ private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SAV_HallOfFame)); - this.listBox1 = new System.Windows.Forms.ListBox(); + this.LB_DataEntry = new System.Windows.Forms.ListBox(); this.RTB = new System.Windows.Forms.RichTextBox(); this.B_Close = new System.Windows.Forms.Button(); this.bpkx = new System.Windows.Forms.PictureBox(); @@ -75,12 +75,12 @@ this.GB_OT.SuspendLayout(); this.SuspendLayout(); // - // listBox1 + // LB_DataEntry // - this.listBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + this.LB_DataEntry.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left))); - this.listBox1.FormattingEnabled = true; - this.listBox1.Items.AddRange(new object[] { + this.LB_DataEntry.FormattingEnabled = true; + this.LB_DataEntry.Items.AddRange(new object[] { "First", "01", "02", @@ -97,11 +97,11 @@ "13", "14", "15"}); - this.listBox1.Location = new System.Drawing.Point(7, 12); - this.listBox1.Name = "listBox1"; - this.listBox1.Size = new System.Drawing.Size(59, 238); - this.listBox1.TabIndex = 0; - this.listBox1.SelectedIndexChanged += new System.EventHandler(this.displayEntry); + this.LB_DataEntry.Location = new System.Drawing.Point(7, 12); + this.LB_DataEntry.Name = "LB_DataEntry"; + this.LB_DataEntry.Size = new System.Drawing.Size(59, 238); + this.LB_DataEntry.TabIndex = 0; + this.LB_DataEntry.SelectedIndexChanged += new System.EventHandler(this.displayEntry); // // RTB // @@ -569,7 +569,7 @@ this.Controls.Add(this.bpkx); this.Controls.Add(this.B_Close); this.Controls.Add(this.RTB); - this.Controls.Add(this.listBox1); + this.Controls.Add(this.LB_DataEntry); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MaximizeBox = false; @@ -591,7 +591,7 @@ #endregion - private System.Windows.Forms.ListBox listBox1; + private System.Windows.Forms.ListBox LB_DataEntry; private System.Windows.Forms.RichTextBox RTB; private System.Windows.Forms.Button B_Close; private System.Windows.Forms.PictureBox bpkx; diff --git a/SAV/SAV_HallOfFame.cs b/SAV/SAV_HallOfFame.cs index 741d304ce..e46c030aa 100644 --- a/SAV/SAV_HallOfFame.cs +++ b/SAV/SAV_HallOfFame.cs @@ -50,7 +50,7 @@ namespace PKHeX Label_EncryptionConstant, Label_MetDate, }; - listBox1.SelectedIndex = 0; + LB_DataEntry.SelectedIndex = 0; NUP_PartyIndex_ValueChanged(null, null); try { TB_Nickname.Font = PKX.getPKXFont(11); } catch (Exception e) { Util.Alert("Font loading failed...", e.ToString()); } @@ -125,7 +125,7 @@ namespace PKHeX RTB.Font = new Font("Courier New", 8); string s = ""; RTB.LanguageOption = RichTextBoxLanguageOptions.DualFont; - int index = listBox1.SelectedIndex; + int index = LB_DataEntry.SelectedIndex; int offset = index * 0x1B4; uint vnd = BitConverter.ToUInt32(data, offset + 0x1B0); @@ -213,7 +213,7 @@ namespace PKHeX private void NUP_PartyIndex_ValueChanged(object sender, EventArgs e) { editing = false; - int index = listBox1.SelectedIndex; + int index = LB_DataEntry.SelectedIndex; int offset = index * 0x1B4 + (Convert.ToInt32(NUP_PartyIndex.Value)-1) * 0x48; if (offset < 0) return; @@ -268,7 +268,7 @@ namespace PKHeX 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 = listBox1.SelectedIndex; + int index = LB_DataEntry.SelectedIndex; int offset = index * 0x1B4; for (int i = 0; i < text_writes.Length; i++) @@ -480,14 +480,15 @@ namespace PKHeX private void B_Delete_Click(object sender, EventArgs e) { - if (listBox1.SelectedIndex < 1) return; - int index = listBox1.SelectedIndex; + if (LB_DataEntry.SelectedIndex < 1) { Util.Alert("Cannot delete your first Hall of Fame Clear entry."); return; } + int index = LB_DataEntry.SelectedIndex; if (Util.Prompt(MessageBoxButtons.YesNo, String.Format("Delete Entry {0} from your records?", index)) == DialogResult.Yes) { int offset = index * 0x1B4; if (index != 15) Array.Copy(data, offset + 0x1B4, data, offset, 0x1B4 * (15 - index)); // Ensure Last Entry is Cleared Array.Copy(new byte[0x1B4], 0, data, 0x1B4 * 15, 0x1B4); + displayEntry(LB_DataEntry, null); } } diff --git a/SAV/SAV_Trainer.cs b/SAV/SAV_Trainer.cs index 23cc52959..2168c2323 100644 --- a/SAV/SAV_Trainer.cs +++ b/SAV/SAV_Trainer.cs @@ -235,13 +235,17 @@ namespace PKHeX new { Text = "KOR", Value = 8 } }; - CB_3DSReg.DataSource = dsregion_list; CB_3DSReg.DisplayMember = "Text"; CB_3DSReg.ValueMember = "Value"; - CB_Language.DataSource = language_list; + CB_3DSReg.DataSource = dsregion_list; CB_Language.DisplayMember = "Text"; CB_Language.ValueMember = "Value"; + CB_Language.DataSource = language_list; + CB_Country.DisplayMember = "Text"; + CB_Country.ValueMember = "Value"; + CB_Region.DisplayMember = "Text"; + CB_Region.ValueMember = "Value"; m_parent.setCountrySubRegion(CB_Country, "countries"); var oras_sprite_list = new[] { @@ -321,9 +325,9 @@ namespace PKHeX new { Text = "Archie", Value = 73 }, }; - CB_Multi.DataSource = oras_sprite_list; CB_Multi.DisplayMember = "Text"; CB_Multi.ValueMember = "Value"; + CB_Multi.DataSource = oras_sprite_list; L_Vivillon.Text = Form1.specieslist[666] + ":"; m_parent.setForms(666, CB_Vivillon); diff --git a/SAV/SAV_Wondercard.cs b/SAV/SAV_Wondercard.cs index 2e71739ff..a797a8f81 100644 --- a/SAV/SAV_Wondercard.cs +++ b/SAV/SAV_Wondercard.cs @@ -244,16 +244,44 @@ namespace PKHeX private void tabMain_DragDrop(object sender, DragEventArgs e) { string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); - string path = files[0]; // open first D&D - if (new FileInfo(path).Length > 0x108) + // Check for multiple wondercards + if (LB_WCs.SelectedIndex < 0) LB_WCs.SelectedIndex = 0; + int ctr = LB_WCs.SelectedIndex; + + if (files.Length == 1) { - Util.Error("File is not a Wondercard:", path); - return; + string path = files[0]; // open first D&D + if (new FileInfo(path).Length > 0x108) + { + Util.Error("File is not a Wondercard:", path); + return; + } + byte[] newwc6 = File.ReadAllBytes(path); + Array.Copy(newwc6, wondercard_data, newwc6.Length); + loadwcdata(); + } + else if (DialogResult.Yes == Util.Prompt(MessageBoxButtons.YesNo, String.Format("Try to load {0} Wondercards starting at Card {1}?", files.Length, ctr + 1))) + { + int i = 0; + while (i < files.Length && ctr < 24) + { + string path = files[i++]; // open first D&D + if (new FileInfo(path).Length != 0x108) + { Util.Error("File is not a Wondercard:", path); continue; } + + ctr++; // Load in WC + byte[] newwc6 = File.ReadAllBytes(path); + Array.Copy(newwc6, wondercard_data, newwc6.Length); + loadwcdata(); + + // Set in WC + B_DisplaytoWCSlot.PerformClick(); + + // Advance to next WC + if (ctr != 24) LB_WCs.SelectedIndex = ctr; + } } - byte[] newwc6 = File.ReadAllBytes(path); - Array.Copy(newwc6, wondercard_data, newwc6.Length); - loadwcdata(); } } } \ No newline at end of file