From 529f8d134860f5700c8ab6056d8a28abf39838d7 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sat, 4 Mar 2017 09:38:39 -0800 Subject: [PATCH] Misc profiling improvements ResetBoxes reduce method calls for new blank/setting, just set data. 160ms->4ms ComboBox Validation calling SelectedText.Length=0 no longer needed 3y after it was originally added. 268ms->0ms speeds up main thread by a third of a second (wowww), but the selectedtext removal makes the program snappier during regular use (loading/modifying) --- PKHeX.WinForms/MainWindow/Main.cs | 1 - PKHeX/Saves/SaveFile.cs | 7 ++++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/PKHeX.WinForms/MainWindow/Main.cs b/PKHeX.WinForms/MainWindow/Main.cs index 48e42282e..1cb4f7984 100644 --- a/PKHeX.WinForms/MainWindow/Main.cs +++ b/PKHeX.WinForms/MainWindow/Main.cs @@ -2817,7 +2817,6 @@ namespace PKHeX.WinForms if (cb == null) return; - cb.SelectionLength = 0; if (cb.Text == "") { cb.SelectedIndex = 0; return; } if (cb.SelectedValue == null) diff --git a/PKHeX/Saves/SaveFile.cs b/PKHeX/Saves/SaveFile.cs index 5d58f298c..00abda45d 100644 --- a/PKHeX/Saves/SaveFile.cs +++ b/PKHeX/Saves/SaveFile.cs @@ -565,11 +565,16 @@ namespace PKHeX.Core { if (BoxEnd < 0) BoxEnd = BoxCount; + + var blank = BlankPKM.EncryptedBoxData; + if (this is SAV3RSBox) + Array.Resize(ref blank, blank.Length + 4); // 00000 TID/SID at end + for (int i = BoxStart; i < BoxEnd; i++) { int offset = getBoxOffset(i); for (int p = 0; p < BoxSlotCount; p++) - setStoredSlot(BlankPKM, offset + SIZE_STORED * p); + setData(blank, offset + SIZE_STORED * p); } }