private void GenerateData_Click(object sender, EventArgs e) { ulong start_seed = ulong.Parse(seedBox.Text, System.Globalization.NumberStyles.HexNumber); uint start_frame = uint.Parse(startFrame.Text); uint end_frame = uint.Parse(endFrame.Text); ulong current_seed = Advance(start_seed, start_frame); var s = GameInfo.Strings; RaidTemplate pkmn = (RaidTemplate)((ComboboxItem)speciesList.SelectedItem).Value; raidContent.Rows.Clear(); var rows = new List <DataGridViewRow>(); ((ISupportInitialize)raidContent).BeginInit(); for (uint current_frame = start_frame; current_frame <= start_frame + end_frame; current_frame++, current_seed += XOROSHIRO.XOROSHIRO_CONST) { RaidPKM res = pkmn.ConvertToPKM(current_seed, Raids.TID, Raids.SID); var row = CreateRaidRow(current_frame, res, s, current_seed); rows.Add(row); } raidContent.Rows.AddRange(rows.ToArray()); // Double buffering can make DGV slow in remote desktop if (!SystemInformation.TerminalServerSession) { raidContent.DoubleBuffered(true); } ((ISupportInitialize)raidContent).EndInit(); //raidContent }
public static IEnumerable <ulong> FindSeeds(uint ec, uint pid, uint tid, uint sid, int fixedShiny = 0) { var fixed_val = GetSeedStart(ec); uint tsv = (tid ^ sid) >> 4; ulong seed = fixed_val; do { rng.Reset(seed); rng.NextInt(0xFFFFFFFF); // EC uint tidsid = (uint)rng.NextInt(0xFFFFFFFF); uint new_pid = (uint)rng.NextInt(0xFFFFFFFF); new_pid = RaidTemplate.GetFinalPID(tid, sid, new_pid, tidsid, tsv, fixedShiny); if (new_pid == pid) { yield return(seed); } seed += 0x1_0000_0000; } while (seed != fixed_val); }