From 0e8b82b5fc5e4822f70c66efc7b125f424d92f65 Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Fri, 29 Jul 2016 19:38:16 -0700 Subject: [PATCH 01/13] Fix EXP dropping to level threshold Only set back if the fields have been loaded. --- MainWindow/Main.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MainWindow/Main.cs b/MainWindow/Main.cs index 47f20897c..d9e691c20 100644 --- a/MainWindow/Main.cs +++ b/MainWindow/Main.cs @@ -1450,7 +1450,8 @@ private void updateEXPLevel(object sender, EventArgs e) TB_EXP.Text = PKX.getEXP(Level, Util.getIndex(CB_Species)).ToString(); } changingFields = false; - pkm.EXP = Util.ToUInt32(TB_EXP.Text); + if (fieldsLoaded) + pkm.EXP = Util.ToUInt32(TB_EXP.Text); updateStats(); updateLegality(); } From 9f40505f3a03344b1607c4ea0eaab0a237a699ea Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Fri, 29 Jul 2016 21:14:08 -0700 Subject: [PATCH 02/13] More descriptive Gen3 sav prompt Pops up (E) (RS) (FRLG) instead of "Generation 3" --- MainWindow/Main.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MainWindow/Main.cs b/MainWindow/Main.cs index d9e691c20..9a16a61d7 100644 --- a/MainWindow/Main.cs +++ b/MainWindow/Main.cs @@ -707,14 +707,14 @@ private void openSAV(byte[] input, string path) else sav = new SAV3(sav.Data, GameVersion.FRLG); } - var drJP = Util.Prompt(MessageBoxButtons.YesNoCancel, $"Generation {sav.Generation} Save File detected. Select Origins:", "Yes: International" + Environment.NewLine + "No: Japanese"); + var drJP = Util.Prompt(MessageBoxButtons.YesNoCancel, $"Generation 3 ({sav.Version}) Save File detected. Select Origins:", "Yes: International" + Environment.NewLine + "No: Japanese"); if (drJP == DialogResult.Cancel) return; sav.Japanese = drJP == DialogResult.No; if (sav.Version == GameVersion.FRLG) { - var drFRLG = Util.Prompt(MessageBoxButtons.YesNoCancel, "FRLG Detected. Select version...", "Yes: FireRed" + Environment.NewLine + "No: LeafGreen"); + var drFRLG = Util.Prompt(MessageBoxButtons.YesNoCancel, $"{sav.Version} detected. Select version...", "Yes: FireRed" + Environment.NewLine + "No: LeafGreen"); if (drFRLG == DialogResult.Cancel) return; From 4a14d663ad6f0ec2ec29a28c03e381200400bc13 Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Fri, 29 Jul 2016 22:30:06 -0700 Subject: [PATCH 03/13] Tweak random PID gen on changing fields Fixes quirky behavior of changing nature/gender on gen3/4 games. --- MainWindow/Main.cs | 40 +++++++++++++++++++++++----------------- PKM/PKM.cs | 13 +++++++------ PKM/PKX.cs | 5 ++++- 3 files changed, 34 insertions(+), 24 deletions(-) diff --git a/MainWindow/Main.cs b/MainWindow/Main.cs index 9a16a61d7..b8682cbcb 100644 --- a/MainWindow/Main.cs +++ b/MainWindow/Main.cs @@ -1283,7 +1283,7 @@ private void clickGender(object sender, EventArgs e) { pkm.Species = Util.getIndex(CB_Species); pkm.Version = Util.getIndex(CB_GameOrigin); - pkm.Nature = CB_Nature.SelectedIndex; + pkm.Nature = Util.getIndex(CB_Nature); pkm.AltForm = CB_Form.SelectedIndex; pkm.setPIDGender(newGender); @@ -1592,22 +1592,24 @@ private void updateRandomEVs(object sender, EventArgs e) } private void updateRandomPID(object sender, EventArgs e) { - int origin = Util.getIndex(CB_GameOrigin); - uint PID = PKX.getRandomPID(Util.getIndex(CB_Species), PKX.getGender(Label_Gender.Text), origin, Util.getIndex(CB_Nature), CB_Form.SelectedIndex); - TB_PID.Text = PID.ToString("X8"); + if (fieldsLoaded) + { + pkm.Version = Util.getIndex(CB_GameOrigin); + pkm.PID = Util.getHEXval(TB_PID.Text); + pkm.Species = Util.getIndex(CB_Species); + pkm.Nature = Util.getIndex(CB_Nature); + pkm.AltForm = CB_Form.SelectedIndex; + } + if (sender == Label_Gender) + pkm.setPIDGender(pkm.Gender); + else if (sender == CB_Nature && pkm.Nature != Util.getIndex(CB_Nature)) + pkm.setPIDNature(Util.getIndex(CB_Nature)); + else if (sender == BTN_RerollPID) + pkm.setPIDGender(pkm.Gender); + TB_PID.Text = pkm.PID.ToString("X8"); getQuickFiller(dragout); - if (origin >= 24) - return; - - // Before Gen6, EC and PID are related - // Ensure we don't have an illegal newshiny PID. - uint SID = Util.ToUInt32(TB_TID.Text); - uint TID = Util.ToUInt32(TB_TID.Text); - uint XOR = TID ^ SID ^ PID >> 16 ^ PID & 0xFFFF; - if (XOR >> 3 == 1) // Illegal - updateRandomPID(sender, e); // Get a new PID - - TB_EC.Text = PID.ToString("X8"); + if (pkm.Format >= 6) + TB_EC.Text = pkm.EncryptionConstant.ToString("X8"); } private void updateRandomEC(object sender, EventArgs e) { @@ -2119,10 +2121,14 @@ private void update_ID(object sender, EventArgs e) getQuickFiller(dragout); updateIVs(null, null); // If the EC is changed, EC%6 (Characteristic) might be changed. TB_PID.Select(60, 0); // position cursor at end of field - if (SAV.Generation == 4 && fieldsInitialized) + if (SAV.Generation <= 4 && fieldsLoaded) { + fieldsLoaded = false; pkm.PID = Util.getHEXval(TB_PID.Text); CB_Nature.SelectedValue = pkm.Nature; + Label_Gender.Text = gendersymbols[pkm.Gender]; + Label_Gender.ForeColor = pkm.Gender == 2 ? Label_Species.ForeColor : (pkm.Gender == 1 ? Color.Red : Color.Blue); + fieldsLoaded = true; } } private void validateComboBox(object sender) diff --git a/PKM/PKM.cs b/PKM/PKM.cs index bc4b9e84d..d5b946a8e 100644 --- a/PKM/PKM.cs +++ b/PKM/PKM.cs @@ -329,16 +329,17 @@ private int getBasePP(int move) public void setShinyPID() { - while (!IsShiny) - PID = PKX.getRandomPID(Species, Gender, Version, Nature, AltForm); + do PID = PKX.getRandomPID(Species, Gender, Version, Nature, AltForm, PID); while (!IsShiny); EncryptionConstant = PID; } public void setPIDGender(int gender) { - PID = PKX.getRandomPID(Species, gender, Version, Nature, AltForm); - while (IsShiny) - PID = PKX.getRandomPID(Species, gender, Version, Nature, AltForm); - + do PID = PKX.getRandomPID(Species, gender, Version, Nature, AltForm, PID); while (IsShiny); + EncryptionConstant = PID; + } + public void setPIDNature(int nature) + { + do PID = PKX.getRandomPID(Species, Gender, Version, nature, AltForm, PID); while (IsShiny); EncryptionConstant = PID; } } diff --git a/PKM/PKX.cs b/PKM/PKX.cs index 079071835..05d988355 100644 --- a/PKM/PKX.cs +++ b/PKM/PKX.cs @@ -419,8 +419,9 @@ internal static ushort getCHK(byte[] data) return chk; } - internal static uint getRandomPID(int species, int cg, int origin, int nature, int form) + internal static uint getRandomPID(int species, int cg, int origin, int nature, int form, uint OLDPID) { + uint bits = OLDPID & 0x00010001; int gt = Personal[species].Gender; if (origin >= 24) return Util.rnd32(); @@ -441,6 +442,8 @@ internal static uint getRandomPID(int species, int cg, int origin, int nature, i if (pidLetter != form) continue; } + else if (bits != (pid & 0x00010001)) // keep ability bits + continue; // Gen 3/4/5: Gender derived from PID uint gv = pid & 0xFF; From 3704d42fcf1dd46860a9bfcd9a7b9ac5ae391f49 Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Fri, 29 Jul 2016 22:36:24 -0700 Subject: [PATCH 04/13] Trainer Gender symbols if Unicode or not Thanks \ --- Subforms/Save Editors/Gen6/SAV_Trainer.cs | 3 +++ Subforms/Save Editors/SAV_SimpleTrainer.cs | 3 +++ 2 files changed, 6 insertions(+) diff --git a/Subforms/Save Editors/Gen6/SAV_Trainer.cs b/Subforms/Save Editors/Gen6/SAV_Trainer.cs index 0e089dde9..d106096cd 100644 --- a/Subforms/Save Editors/Gen6/SAV_Trainer.cs +++ b/Subforms/Save Editors/Gen6/SAV_Trainer.cs @@ -18,6 +18,9 @@ public SAV_Trainer() Util.TranslateInterface(this, Main.curlanguage); B_MaxCash.Click += (sender, e) => MT_Money.Text = "9,999,999"; + CB_Gender.Items.Clear(); + CB_Gender.Items.AddRange(Main.gendersymbols.Take(2).ToArray()); // m/f depending on unicode selection + MaisonRecords = new[] { TB_MCSN,TB_MCSS,TB_MBSN,TB_MBSS, diff --git a/Subforms/Save Editors/SAV_SimpleTrainer.cs b/Subforms/Save Editors/SAV_SimpleTrainer.cs index 59fd633e6..cd77cf21f 100644 --- a/Subforms/Save Editors/SAV_SimpleTrainer.cs +++ b/Subforms/Save Editors/SAV_SimpleTrainer.cs @@ -15,6 +15,9 @@ public SAV_SimpleTrainer() TB_OTName.MaxLength = SAV.OTLength; B_MaxCash.Click += (sender, e) => MT_Money.Text = "9,999,999"; + CB_Gender.Items.Clear(); + CB_Gender.Items.AddRange(Main.gendersymbols.Take(2).ToArray()); // m/f depending on unicode selection + TB_OTName.Text = SAV.OT; CB_Gender.SelectedIndex = SAV.Gender; MT_TID.Text = SAV.TID.ToString("00000"); From b69096d6f454eb96025dea0f51a19bd479b8c3f4 Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Sat, 30 Jul 2016 10:47:28 -0700 Subject: [PATCH 05/13] Further attempts to fix linux issue #151 ToList a bunch. --- MainWindow/Main.cs | 12 ++++++------ Subforms/Save Editors/Gen6/SAV_HallOfFame.cs | 11 ++++++----- Subforms/Save Editors/Gen6/SAV_PokedexORAS.cs | 2 +- Subforms/Save Editors/Gen6/SAV_PokedexXY.cs | 2 +- Subforms/Save Editors/Gen6/SAV_SecretBase.cs | 15 ++++++++------- Subforms/Save Editors/Gen6/SAV_SuperTrain.cs | 4 ++-- 6 files changed, 24 insertions(+), 22 deletions(-) diff --git a/MainWindow/Main.cs b/MainWindow/Main.cs index b8682cbcb..eabf44f36 100644 --- a/MainWindow/Main.cs +++ b/MainWindow/Main.cs @@ -1070,15 +1070,15 @@ private void populateFilteredDataSources() items = g3items; ItemDataSource = Util.getCBList(items, (HaX ? Enumerable.Range(0, SAV.MaxItemID) : SAV.HeldItems.Select(i => (int)i)).ToArray()); - CB_HeldItem.DataSource = new BindingSource(ItemDataSource.Where(i => i.Value <= SAV.MaxItemID), null); + CB_HeldItem.DataSource = new BindingSource(ItemDataSource.Where(i => i.Value <= SAV.MaxItemID).ToList(), null); - CB_Ball.DataSource = new BindingSource(BallDataSource.Where(b => b.Value <= SAV.MaxBallID), null); - CB_Species.DataSource = new BindingSource(SpeciesDataSource.Where(s => s.Value <= SAV.MaxSpeciesID), null); - DEV_Ability.DataSource = new BindingSource(AbilityDataSource.Where(a => a.Value <= SAV.MaxAbilityID), null); - CB_GameOrigin.DataSource = new BindingSource(VersionDataSource.Where(g => g.Value <= SAV.MaxGameID || SAV.Generation >= 3 && g.Value == 15), null); + CB_Ball.DataSource = new BindingSource(BallDataSource.Where(b => b.Value <= SAV.MaxBallID).ToList(), null); + CB_Species.DataSource = new BindingSource(SpeciesDataSource.Where(s => s.Value <= SAV.MaxSpeciesID).ToList(), null); + DEV_Ability.DataSource = new BindingSource(AbilityDataSource.Where(a => a.Value <= SAV.MaxAbilityID).ToList(), null); + CB_GameOrigin.DataSource = new BindingSource(VersionDataSource.Where(g => g.Value <= SAV.MaxGameID || SAV.Generation >= 3 && g.Value == 15).ToList(), null); // Set the Move ComboBoxes too.. - var moves = MoveDataSource.Where(m => m.Value <= SAV.MaxMoveID).ToArray(); + var moves = MoveDataSource.Where(m => m.Value <= SAV.MaxMoveID).ToList(); foreach (ComboBox cb in new[] { CB_Move1, CB_Move2, CB_Move3, CB_Move4, CB_RelearnMove1, CB_RelearnMove2, CB_RelearnMove3, CB_RelearnMove4 }) { cb.DisplayMember = "Text"; cb.ValueMember = "Value"; diff --git a/Subforms/Save Editors/Gen6/SAV_HallOfFame.cs b/Subforms/Save Editors/Gen6/SAV_HallOfFame.cs index fcfebd46c..a8fc4534a 100644 --- a/Subforms/Save Editors/Gen6/SAV_HallOfFame.cs +++ b/Subforms/Save Editors/Gen6/SAV_HallOfFame.cs @@ -67,15 +67,16 @@ private void Setup() CB_Species.DisplayMember = "Text"; CB_Species.ValueMember = "Value"; - CB_Species.DataSource = new BindingSource(Main.SpeciesDataSource.Skip(1), null); + CB_Species.DataSource = new BindingSource(Main.SpeciesDataSource.Skip(1).Where(s => s.Value <= SAV.MaxSpeciesID).ToList(), null); CB_Move1.DisplayMember = CB_Move2.DisplayMember = CB_Move3.DisplayMember = CB_Move4.DisplayMember = "Text"; CB_Move1.ValueMember = CB_Move2.ValueMember = CB_Move3.ValueMember = CB_Move4.ValueMember = "Value"; - CB_Move1.DataSource = new BindingSource(Main.MoveDataSource, null); - CB_Move2.DataSource = new BindingSource(Main.MoveDataSource, null); - CB_Move3.DataSource = new BindingSource(Main.MoveDataSource, null); - CB_Move4.DataSource = new BindingSource(Main.MoveDataSource, null); + var MoveList = Main.MoveDataSource.Where(m => m.Value <= SAV.MaxMoveID).ToList(); + CB_Move1.DataSource = new BindingSource(MoveList, null); + CB_Move2.DataSource = new BindingSource(MoveList, null); + CB_Move3.DataSource = new BindingSource(MoveList, null); + CB_Move4.DataSource = new BindingSource(MoveList, null); CB_HeldItem.DisplayMember = "Text"; CB_HeldItem.ValueMember = "Value"; diff --git a/Subforms/Save Editors/Gen6/SAV_PokedexORAS.cs b/Subforms/Save Editors/Gen6/SAV_PokedexORAS.cs index 4e035629d..e6647552f 100644 --- a/Subforms/Save Editors/Gen6/SAV_PokedexORAS.cs +++ b/Subforms/Save Editors/Gen6/SAV_PokedexORAS.cs @@ -23,7 +23,7 @@ public SAV_PokedexORAS() // Fill List CB_Species.DisplayMember = "Text"; CB_Species.ValueMember = "Value"; - CB_Species.DataSource = new BindingSource(Main.SpeciesDataSource.Skip(1), null); + CB_Species.DataSource = new BindingSource(Main.SpeciesDataSource.Skip(1).ToList(), null); for (int i = 1; i < SAV.MaxSpeciesID + 1; i++) LB_Species.Items.Add(i.ToString("000") + " - " + Main.specieslist[i]); diff --git a/Subforms/Save Editors/Gen6/SAV_PokedexXY.cs b/Subforms/Save Editors/Gen6/SAV_PokedexXY.cs index bc703fa39..517d3a132 100644 --- a/Subforms/Save Editors/Gen6/SAV_PokedexXY.cs +++ b/Subforms/Save Editors/Gen6/SAV_PokedexXY.cs @@ -23,7 +23,7 @@ public SAV_PokedexXY() // Fill List CB_Species.DisplayMember = "Text"; CB_Species.ValueMember = "Value"; - CB_Species.DataSource = new BindingSource(Main.SpeciesDataSource.Skip(1), null); + CB_Species.DataSource = new BindingSource(Main.SpeciesDataSource.Skip(1).ToList(), null); for (int i = 1; i < SAV.MaxSpeciesID + 1; i++) LB_Species.Items.Add(i.ToString("000") + " - " + Main.specieslist[i]); diff --git a/Subforms/Save Editors/Gen6/SAV_SecretBase.cs b/Subforms/Save Editors/Gen6/SAV_SecretBase.cs index 9392bb4d9..cc1da33bc 100644 --- a/Subforms/Save Editors/Gen6/SAV_SecretBase.cs +++ b/Subforms/Save Editors/Gen6/SAV_SecretBase.cs @@ -35,19 +35,20 @@ private void setupComboBoxes() CB_Ball.DisplayMember = CB_HeldItem.DisplayMember = CB_Species.DisplayMember = CB_Nature.DisplayMember = "Text"; CB_Ball.ValueMember = CB_HeldItem.ValueMember = CB_Species.ValueMember = CB_Nature.ValueMember = "Value"; - CB_Ball.DataSource = new BindingSource(Main.BallDataSource.Where(b => b.Value <= SAV.MaxBallID), null); - CB_HeldItem.DataSource = new BindingSource(Main.ItemDataSource, null); - CB_Species.DataSource = new BindingSource(Main.SpeciesDataSource.Where(s => s.Value <= SAV.MaxSpeciesID), null); + CB_Ball.DataSource = new BindingSource(Main.BallDataSource.Where(b => b.Value <= SAV.MaxBallID).ToList(), null); + CB_HeldItem.DataSource = new BindingSource(Main.ItemDataSource.Where(i => i.Value < SAV.MaxItemID).ToList(), null); + CB_Species.DataSource = new BindingSource(Main.SpeciesDataSource.Where(s => s.Value <= SAV.MaxSpeciesID).ToList(), null); CB_Nature.DataSource = new BindingSource(Main.NatureDataSource, null); CB_Move1.DisplayMember = CB_Move2.DisplayMember = CB_Move3.DisplayMember = CB_Move4.DisplayMember = "Text"; CB_Move1.ValueMember = CB_Move2.ValueMember = CB_Move3.ValueMember = CB_Move4.ValueMember = "Value"; - CB_Move1.DataSource = new BindingSource(Main.MoveDataSource, null); - CB_Move2.DataSource = new BindingSource(Main.MoveDataSource, null); - CB_Move3.DataSource = new BindingSource(Main.MoveDataSource, null); - CB_Move4.DataSource = new BindingSource(Main.MoveDataSource, null); + var MoveList = Main.MoveDataSource.Where(m => m.Value <= SAV.MaxMoveID).ToList(); + CB_Move1.DataSource = new BindingSource(MoveList, null); + CB_Move2.DataSource = new BindingSource(MoveList, null); + CB_Move3.DataSource = new BindingSource(MoveList, null); + CB_Move4.DataSource = new BindingSource(MoveList, null); } // Repopulation Functions diff --git a/Subforms/Save Editors/Gen6/SAV_SuperTrain.cs b/Subforms/Save Editors/Gen6/SAV_SuperTrain.cs index 79b819c36..7623628f9 100644 --- a/Subforms/Save Editors/Gen6/SAV_SuperTrain.cs +++ b/Subforms/Save Editors/Gen6/SAV_SuperTrain.cs @@ -35,11 +35,11 @@ private void setup() { CB_Species.DisplayMember = "Text"; CB_Species.ValueMember = "Value"; - CB_Species.DataSource = new BindingSource(Main.SpeciesDataSource.Where(s => s.Value <= SAV.MaxSpeciesID), null); + CB_Species.DataSource = new BindingSource(Main.SpeciesDataSource.Where(s => s.Value <= SAV.MaxSpeciesID).ToList(), null); CB_S2.DisplayMember = "Text"; CB_S2.ValueMember = "Value"; - CB_S2.DataSource = new BindingSource(Main.SpeciesDataSource.Where(s => s.Value <= SAV.MaxSpeciesID), null); + CB_S2.DataSource = new BindingSource(Main.SpeciesDataSource.Where(s => s.Value <= SAV.MaxSpeciesID).ToList(), null); } listBox1.SelectedIndex = 0; fillTrainingBags(); From e7834416ea61bf7d80896120b89d928308ab2930 Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Sat, 30 Jul 2016 11:25:45 -0700 Subject: [PATCH 06/13] Trycatch wrap normalize path Pretty sure cgse is unsupported on linux anyway, so the URI invalid exception can be ignored (skipping check). #151 continues! --- MainWindow/Main.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/MainWindow/Main.cs b/MainWindow/Main.cs index eabf44f36..7a6150dac 100644 --- a/MainWindow/Main.cs +++ b/MainWindow/Main.cs @@ -3254,8 +3254,11 @@ private static string detectSaveFile() if (Directory.Exists(pathCache)) return Directory.GetFiles(pathCache).Where(f => SaveUtil.SizeValidSAV6((int)new FileInfo(f).Length)) // filter .OrderByDescending(f => new FileInfo(f).LastWriteTime).FirstOrDefault(); - if (File.Exists(Util.NormalizePath(Path.Combine(Util.GetTempFolder(), "root", "main")))) // if cgse exists - return Util.NormalizePath(Path.Combine(Util.GetTempFolder(), "root", "main")); + try + { + if (File.Exists(Util.NormalizePath(Path.Combine(Util.GetTempFolder(), "root", "main")))) // if cgse exists + return Util.NormalizePath(Path.Combine(Util.GetTempFolder(), "root", "main")); + } catch { } return null; } From 1d32ef12f3cc7e2d17e8e8d9cfdc27981beaffb4 Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Sat, 30 Jul 2016 13:25:58 -0700 Subject: [PATCH 07/13] Fix wc6full -> 2064 --- MysteryGifts/WC6.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MysteryGifts/WC6.cs b/MysteryGifts/WC6.cs index 6661f9f3c..26f8a186c 100644 --- a/MysteryGifts/WC6.cs +++ b/MysteryGifts/WC6.cs @@ -18,7 +18,7 @@ public WC6(byte[] data = null) { Data = Data.Skip(SizeFull - Size).ToArray(); DateTime now = DateTime.Now; - Year = (uint)(now.Year - 2000); + Year = (uint)now.Year; Month = (uint)now.Month; Day = (uint)now.Day; } From e4cb0255e7f25f293d3a0d2f146bb301a27553a1 Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Sat, 30 Jul 2016 13:30:15 -0700 Subject: [PATCH 08/13] Release 07-31-16 Updated with latest event contributions. --- Resources/byte/wc6.pkl | Bin 242616 -> 244728 bytes Resources/byte/wc6full.pkl | Bin 182672 -> 186592 bytes Resources/text/changelog.txt | 16 ++++++++++++++-- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Resources/byte/wc6.pkl b/Resources/byte/wc6.pkl index e143246460bfd9b0847b32eb1e8c82763ddc6b83..741fee4e69ab6ba1f5fda89c6361071de24e68ba 100644 GIT binary patch delta 81 zcmdn-obShXzRdzmT#TEwSUDJ*wOHG=SQ)o#u`(U--2TXyiGvYD3NUSdcoFiS8uv@mXAy5zn6l^+uaNVaQ*Gi}!jXWo_w0OZ*b AaR2}S diff --git a/Resources/byte/wc6full.pkl b/Resources/byte/wc6full.pkl index 82d99627b4406f8c315bbeb7b70a9ed94ada5037..d3d842dc86abd85ac2eeba6c2548c1826e2bd32b 100644 GIT binary patch delta 45 wcmbO*nft*;?uIRlN4&Ogac5Lu+kV6gL|*X)kxv4EWc!z3#_eB%ndX!N0HLQ5!~g&Q delta 33 ocmaE`k$b{q?uIRlN4&N_31C!U+pZD|B-=yM7`KO{G4&Jy0OWTJG5`Po diff --git a/Resources/text/changelog.txt b/Resources/text/changelog.txt index d7b14e146..9c84e5254 100644 --- a/Resources/text/changelog.txt +++ b/Resources/text/changelog.txt @@ -726,7 +726,7 @@ http://projectpokemon.org/forums/showthread.php?36986 - Hotfix: Fixed Gen 5 save file detection. Thanks xtreme1! - Hotfix: Fixed Bad Eggs from causing past gen dumping to abort. Thanks xtreme1! -07/28/16 - New Update: +07/28/16 - New Update: (9500) - Fixed: Base save file when no save is loaded now has more realistic data (Console Region and Country fixed). - Fixed: Loading a X/Y save file will no longer have OR/AS exclusive items/moves/forms available as choices. - Fixed: Certain edge case Wonder Cards now are recognized correctly. @@ -750,4 +750,16 @@ http://projectpokemon.org/forums/showthread.php?36986 - - "!": Requires the value to NOT match the specified value. If not, the PKM is skipped. - - ".": Sets the attribute to the specified value if all filters are satisfied. - Changed: Database can now search pk3/pk4/pk5/pk6 files. - - - An advance search option has been added, uses the same filter style as the Batch Editor. \ No newline at end of file + - - An advance search option has been added, uses the same filter style as the Batch Editor. + +07/30/16 - New Update: + - Added: Batch editor "Shinify" command to make a Pokemon shiny ($shiny). Thanks exegg! + - Changed: Ribbon editor is now wider (5 ribbons per row). Thanks \! + - Fixed: Gen 3/4 save issues. Thanks BeyondTheHorizon, poutros! + - Fixed: Event Flag editor saving no longer throws a cast exception. Thanks Armodillomatt12! + - Fixed: Importing PGT/PCD to future generations no longer errors out. Thanks SubMana! + - Fixed: Mystery Gift window import/export button text displayed. Thanks poutros! + - Fixed: Misc Pokémon Link legality cases fixed. Thanks poutros! + - Fixed: Misc linux issues with latest refactoring. Thanks Zekario! + - Fixed: Trainer Editor window ~ Unicode character display. Thanks \! + - Fixed: Minor main window editing bugs for EXP/Nature/Gender. \ No newline at end of file From cdd33c9d5fd504341767572ed43f8ec1affb26c6 Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Sat, 30 Jul 2016 17:22:33 -0700 Subject: [PATCH 09/13] Add delete for mass editor .Species=0 Sets data to zeroes. --- Subforms/PKM Editors/BatchEditor.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Subforms/PKM Editors/BatchEditor.cs b/Subforms/PKM Editors/BatchEditor.cs index ffb3f9d59..aa31213e7 100644 --- a/Subforms/PKM Editors/BatchEditor.cs +++ b/Subforms/PKM Editors/BatchEditor.cs @@ -251,6 +251,8 @@ private static ModifyResult ProcessPKM(PKM PKM, IEnumerable F ReflectUtil.SetValue(PKM, cmd.PropertyName, Util.rnd32().ToString()); else if (cmd.PropertyValue == CONST_SHINY && cmd.PropertyName == "PID") PKM.setShinyPID(); + else if (cmd.PropertyValue == "0" && cmd.PropertyName == "Species") + PKM.Data = new byte[PKM.Data.Length]; else ReflectUtil.SetValue(PKM, cmd.PropertyName, cmd.PropertyValue); From 497bfb93977d9f81b023b314433e8d9b1de81abc Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Sat, 30 Jul 2016 20:47:28 -0700 Subject: [PATCH 10/13] Fix SAV3 dragdrop between slots Thanks Destinyy! --- MainWindow/Main.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MainWindow/Main.cs b/MainWindow/Main.cs index 7a6150dac..8e7356986 100644 --- a/MainWindow/Main.cs +++ b/MainWindow/Main.cs @@ -3347,6 +3347,7 @@ private void pbBoxSlot_DragDrop(object sender, DragEventArgs e) } else { + PKM pkz = SAV.getStoredSlot(pkm_from_offset); if (ModifierKeys == Keys.Alt && slot > -1) // overwrite delete old slot { // Clear from slot @@ -3365,8 +3366,7 @@ private void pbBoxSlot_DragDrop(object sender, DragEventArgs e) SAV.setStoredSlot(pk, pkm_from_offset); } // Copy from temp slot to new. - SAV.setStoredSlot(pkm_from, offset); - PKM pkz = SAV.getPKM(SAV.decryptPKM(pkm_from)); + SAV.setStoredSlot(pkz, offset); getQuickFiller(SlotPictureBoxes[slot], pkz); pkm_from_offset = 0; // Clear offset value From ceff3845b792f13a84847162d04c2465fc94f21e Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Sat, 30 Jul 2016 20:57:45 -0700 Subject: [PATCH 11/13] Add TableLayoutPanel scroll hack Thanks @poutros ! --- MainWindow/Main.cs | 2 +- Subforms/PKM Editors/RibbonEditor.cs | 2 ++ Subforms/PKM Editors/SuperTrainingEditor.cs | 2 ++ Subforms/Save Editors/SAV_EventFlags.cs | 5 +++-- Util/FormUtil.cs | 4 ++-- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/MainWindow/Main.cs b/MainWindow/Main.cs index 8e7356986..bdf4b2116 100644 --- a/MainWindow/Main.cs +++ b/MainWindow/Main.cs @@ -86,7 +86,7 @@ public Main() // Box to Tabs D&D dragout.AllowDrop = true; - FLP_SAVtools.Scroll += Util.FlowLayoutPanelScroll; + FLP_SAVtools.Scroll += Util.PanelScroll; // Load WC6 folder to legality refreshWC6DB(); diff --git a/Subforms/PKM Editors/RibbonEditor.cs b/Subforms/PKM Editors/RibbonEditor.cs index 1a8ad5292..fc73bd0a0 100644 --- a/Subforms/PKM Editors/RibbonEditor.cs +++ b/Subforms/PKM Editors/RibbonEditor.cs @@ -16,6 +16,8 @@ public RibbonEditor() // Updating a Control display with autosized elements on every row addition is cpu intensive. Disable layout updates while populating. TLP_Ribbons.SuspendLayout(); + FLP_Ribbons.Scroll += Util.PanelScroll; + TLP_Ribbons.Scroll += Util.PanelScroll; populateRibbons(); Util.TranslateInterface(this, Main.curlanguage); TLP_Ribbons.ResumeLayout(); diff --git a/Subforms/PKM Editors/SuperTrainingEditor.cs b/Subforms/PKM Editors/SuperTrainingEditor.cs index af930afb1..5f148bb31 100644 --- a/Subforms/PKM Editors/SuperTrainingEditor.cs +++ b/Subforms/PKM Editors/SuperTrainingEditor.cs @@ -16,6 +16,8 @@ public SuperTrainingEditor() // Updating a Control display with autosized elements on every row addition is cpu intensive. Disable layout updates while populating. TLP_SuperTrain.SuspendLayout(); TLP_DistSuperTrain.SuspendLayout(); + TLP_SuperTrain.Scroll += Util.PanelScroll; + TLP_DistSuperTrain.Scroll += Util.PanelScroll; populateRegimens("SuperTrain", TLP_SuperTrain, reglist); populateRegimens("DistSuperTrain", TLP_DistSuperTrain, distlist); Util.TranslateInterface(this, Main.curlanguage); diff --git a/Subforms/Save Editors/SAV_EventFlags.cs b/Subforms/Save Editors/SAV_EventFlags.cs index acb7234e8..006653a9c 100644 --- a/Subforms/Save Editors/SAV_EventFlags.cs +++ b/Subforms/Save Editors/SAV_EventFlags.cs @@ -24,9 +24,10 @@ public SAV_EventFlags() CB_Stats.Items.Add(i.ToString()); TLP_Flags.SuspendLayout(); - TLP_Flags.Controls.Clear(); - TLP_Const.SuspendLayout(); + TLP_Flags.Scroll += Util.PanelScroll; + TLP_Const.Scroll += Util.PanelScroll; + TLP_Flags.Controls.Clear(); TLP_Const.Controls.Clear(); addFlagList(getStringList("flags")); addConstList(getStringList("const")); diff --git a/Util/FormUtil.cs b/Util/FormUtil.cs index e0c9da540..c76a198d9 100644 --- a/Util/FormUtil.cs +++ b/Util/FormUtil.cs @@ -139,9 +139,9 @@ internal static int getIndex(ComboBox cb) return (int)(cb?.SelectedValue ?? 0); } - public static void FlowLayoutPanelScroll(object sender, ScrollEventArgs e) + public static void PanelScroll(object sender, ScrollEventArgs e) { - var p = sender as FlowLayoutPanel; + var p = sender as Panel; switch (e.ScrollOrientation) { case ScrollOrientation.HorizontalScroll: From 696c5aa158984fec2ae6baee9b0d4bbb801b60a5 Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Sat, 30 Jul 2016 23:03:41 -0700 Subject: [PATCH 12/13] Add folder output to another folder (no overwrite) Thanks \ for the suggestion! --- Subforms/PKM Editors/BatchEditor.cs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/Subforms/PKM Editors/BatchEditor.cs b/Subforms/PKM Editors/BatchEditor.cs index aa31213e7..c3a4ed7ea 100644 --- a/Subforms/PKM Editors/BatchEditor.cs +++ b/Subforms/PKM Editors/BatchEditor.cs @@ -65,6 +65,18 @@ private void runBackgroundWorker() if (Instructions.Any(z => string.IsNullOrWhiteSpace(z.PropertyValue))) { Util.Error("Empty Property Value detected."); return; } + string destPath = ""; + if (RB_Path.Checked) + { + Util.Alert("Please select the folder where the files will be saved to.", "This can be the same folder as the source of PKM files."); + var fbd = new FolderBrowserDialog(); + var dr = fbd.ShowDialog(); + if (dr != DialogResult.OK) + return; + + destPath = fbd.SelectedPath; + } + FLP_RB.Enabled = RTB_Instructions.Enabled = B_Go.Enabled = false; b = new BackgroundWorker {WorkerReportsProgress = true}; @@ -80,7 +92,7 @@ private void runBackgroundWorker() { var files = Directory.GetFiles(TB_Folder.Text, "*", SearchOption.AllDirectories); setupProgressBar(files.Length); - processFolder(files, Filters, Instructions); + processFolder(files, Filters, Instructions, destPath); } }; b.ProgressChanged += (sender, e) => @@ -161,7 +173,7 @@ private void processSAV(PKM[] data, List Filters, List Filters, List Instructions) + private void processFolder(string[] files, List Filters, List Instructions, string destPath) { len = err = ctr = 0; for (int i = 0; i < files.Length; i++) @@ -183,7 +195,7 @@ private void processFolder(string[] files, List Filters, List if (r == ModifyResult.Modified) { ctr++; - File.WriteAllBytes(file, pkm.DecryptedBoxData); + File.WriteAllBytes(Path.Combine(destPath, Path.GetFileName(file)), pkm.DecryptedBoxData); } b.ReportProgress(i); From 62ff84268b0045be8776b6959b54506e7c2f73a9 Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Sun, 31 Jul 2016 09:20:06 -0700 Subject: [PATCH 13/13] Fix nature modification for gen4 Thanks BeyondTheHorizon! --- MainWindow/Main.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/MainWindow/Main.cs b/MainWindow/Main.cs index bdf4b2116..e7bbd2d37 100644 --- a/MainWindow/Main.cs +++ b/MainWindow/Main.cs @@ -1976,9 +1976,6 @@ private void updateNatureModification(object sender, EventArgs e) incr != decr ? $"+{labarray[incr].Text} / -{labarray[decr].Text}".Replace(":", "") : "-/-"); - - if (fieldsLoaded && SAV.Generation <= 4) - updateRandomPID(sender, e); } private void updateNickname(object sender, EventArgs e) { @@ -2159,8 +2156,8 @@ private void validateComboBox2(object sender, EventArgs e) validateComboBox(sender, e); if (sender == CB_Ability) TB_AbilityNumber.Text = (1 << CB_Ability.SelectedIndex).ToString(); - if (fieldsInitialized && sender == CB_Nature && SAV.Generation == 4) - BTN_RerollPID.PerformClick(); + if (fieldsLoaded && sender == CB_Nature && SAV.Generation <= 4) + updateRandomPID(sender, e); updateNatureModification(sender, null); updateIVs(null, null); // updating Nature will trigger stats to update as well }