private static string FindFirstSeed(IEnumerable <ulong> potential_seeds, int[] ivs) { foreach (ulong seed in potential_seeds) { // Verify the IVs; at most 5 can match for (int i = 1; i <= 5; i++) // fixed IV count { if (!BruteForceSearch.IsMatch(seed, ivs, i)) { continue; } return($"{seed:X16}"); } } return("No seed found"); }
private void SeedSlow_Click(object sender, EventArgs e) { var result = WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "This might take several minutes. This method should only be used if the fast one does not yield result. Are you sure you want to use this method?"); if (result == DialogResult.Yes) { if (ECBox.Text.Length == 0) { return; } if (PIDBox.Text.Length == 0) { return; } uint ec = uint.Parse(ECBox.Text, System.Globalization.NumberStyles.HexNumber); uint pid = uint.Parse(PIDBox.Text, System.Globalization.NumberStyles.HexNumber); int[] ivs = { (int)minHP.Value, (int)minAtk.Value, (int)minDef.Value, (int)minSpa.Value, (int)minSpd.Value, (int)MinSpe.Value, }; var seeds = BruteForceSearch.FindSeeds(ec, pid, TID, SID); SeedResult.Text = FindFirstSeed(seeds, ivs); } }