Esempio n. 1
0
        private void pidStart_Click(object sender, EventArgs e)
        {
            statusLabel.Text    = "Finding desired PID...";
            progressBar.Visible = true;

            byte hp, atk, def, spa, spd, spe;
            uint seed, pid, ivseed1, ivseed2;

            statusLabel.Text  = "Parsing data...";
            progressBar.Value = 25;

            byte.TryParse(dhpText.Text, System.Globalization.NumberStyles.Number, null, out hp);
            byte.TryParse(datkText.Text, System.Globalization.NumberStyles.Number, null, out atk);
            byte.TryParse(ddefText.Text, System.Globalization.NumberStyles.Number, null, out def);
            byte.TryParse(dspaText.Text, System.Globalization.NumberStyles.Number, null, out spa);
            byte.TryParse(dspdText.Text, System.Globalization.NumberStyles.Number, null, out spd);
            byte.TryParse(dspeText.Text, System.Globalization.NumberStyles.Number, null, out spe);

            ivseed1 = (uint)(hp + (atk << 5) + (def << 10));
            ivseed2 = (uint)(spe + (spa << 5) + (spd << 10));

            statusLabel.Text  = "Configuring output...";
            progressBar.Value = 50;

            pidOutput.BackgroundColor = Color.White;
            pidOutput.Rows.Clear();
            pidOutput.Columns.Clear();
            pidOutput.Columns.Add("Seed", "Seed");
            pidOutput.Columns[0].Width = 70;
            pidOutput.Columns.Add("PID", "PID");
            pidOutput.Columns[1].Width = 70;
            pidOutput.Columns.Add("Nature", "Nature");
            pidOutput.Columns[2].Width = 67;

            statusLabel.Text  = "Running PID search...";
            progressBar.Value = 75;

            for (int i = 0; i < 2; i++)
            {
                for (int j = 0; j < 65536; j++)
                {
                    seed = (uint)(((ivseed1 + (i << 15)) << 16) + j);
                    xdRNG xd = new xdRNG(seed);

                    if ((xd.previewHalfAdvance(seed, 1) & 0x7FFF) == ivseed2)
                    {
                        pid = xd.getPID();
                        pidOutput.Rows.Add(seed.ToString("X"), pid.ToString("X"), xd.getNature(pid).ToString());
                    }
                }
            }

            statusLabel.Text  = "PID search complete.";
            progressBar.Value = 100;
            Thread.Sleep(50); // Flash the full status bar
            progressBar.Visible = false;
        }
Esempio n. 2
0
        private Boolean runSearch(UInt32 ivseed1, UInt32 ivseed2, UInt32 upid, UInt32 lpid)
        {
            xdRNG xd;
            uint  seed;

            for (int i = 0; i < 65536; i++)
            {
                seed = (uint)((ivseed1 << 16) + i);
                xd   = new xdRNG(seed);

                if ((xd.previewHalfAdvance(seed, 1) == ivseed2) &&
                    (xd.previewHalfAdvance(seed, 3) == upid) &&
                    (xd.previewHalfAdvance(seed, 4) == lpid))
                {
                    return(true);
                }
            }

            return(false);
        }
Esempio n. 3
0
        private void rngStart_Click(object sender, EventArgs e)
        {
            statusLabel.Text    = "Running RNG...";
            progressBar.Visible = true;

            uint  frame     = 0;
            uint  startSeed = 0;
            xdRNG xd;

            statusLabel.Text  = "Parsing data...";
            progressBar.Value = 25;

            // If the value of the dropdown is invalid, set it to "Advance XD RNG"
            if (rngDirectionChoice.SelectedIndex != 0 && rngDirectionChoice.SelectedIndex != 1)
            {
                rngDirectionChoice.SelectedIndex = 0;
            }

            uint.TryParse(frameText.Text, System.Globalization.NumberStyles.Number, null, out frame);
            uint.TryParse(seedStartText.Text, System.Globalization.NumberStyles.HexNumber, null, out startSeed);

            statusLabel.Text  = "Configuring output...";
            progressBar.Value = 50;

            rngOutput.BackgroundColor = Color.White;
            rngOutput.Rows.Clear();
            rngOutput.Columns.Clear();
            rngOutput.Columns.Add("Frame", "Frame");
            rngOutput.Columns[0].Width = 48;
            rngOutput.Columns.Add("Seed", "Seed");
            rngOutput.Columns[1].Width = 145;

            statusLabel.Text  = "Running RNG...";
            progressBar.Value = 75;

            xd = new xdRNG(startSeed);

            switch (rngDirectionChoice.SelectedIndex)
            {
            case 0:     // Advance the RNG
                for (int i = 0; i <= frame; i++)
                {
                    rngOutput.Rows.Add((i).ToString(), xd.getSeed().ToString("X8"));
                    xd.advanceXD();
                }
                break;

            case 1:     // Reverse the RNG
                for (int i = 0; i <= frame; i++)
                {
                    rngOutput.Rows.Add((i).ToString(), xd.getSeed().ToString("X8"));
                    xd.reverseXD();
                }
                break;

            default: break;
            }

            statusLabel.Text  = "RNG run complete.";
            progressBar.Value = 100;
            Thread.Sleep(50); // Flash the full status bar
            progressBar.Visible = false;
        }
Esempio n. 4
0
        private Boolean runSearch(UInt32 ivseed1, UInt32 ivseed2, UInt32 upid, UInt32 lpid)
        {
            xdRNG xd;
            uint seed;

            for (int i = 0; i < 65536; i++)
            {
                seed = (uint)((ivseed1 << 16) + i);
                xd = new xdRNG(seed);

                if ( (xd.previewHalfAdvance(seed, 1) == ivseed2) &&
                     (xd.previewHalfAdvance(seed, 3) == upid)    &&
                     (xd.previewHalfAdvance(seed, 4) == lpid)     )
                        return true;
            }

            return false;
        }
Esempio n. 5
0
        private void rngStart_Click(object sender, EventArgs e)
        {
            statusLabel.Text = "Running RNG...";
            progressBar.Visible = true;

            uint frame = 0;
            uint startSeed = 0;
            xdRNG xd;

            statusLabel.Text = "Parsing data...";
            progressBar.Value = 25;

            // If the value of the dropdown is invalid, set it to "Advance XD RNG"
            if (rngDirectionChoice.SelectedIndex != 0 && rngDirectionChoice.SelectedIndex != 1)
                rngDirectionChoice.SelectedIndex = 0;

            uint.TryParse(frameText.Text, System.Globalization.NumberStyles.Number, null, out frame);
            uint.TryParse(seedStartText.Text, System.Globalization.NumberStyles.HexNumber, null, out startSeed);

            statusLabel.Text = "Configuring output...";
            progressBar.Value = 50;

            rngOutput.BackgroundColor = Color.White;
            rngOutput.Rows.Clear();
            rngOutput.Columns.Clear();
            rngOutput.Columns.Add("Frame", "Frame");
            rngOutput.Columns[0].Width = 48;
            rngOutput.Columns.Add("Seed", "Seed");
            rngOutput.Columns[1].Width = 145;

            statusLabel.Text = "Running RNG...";
            progressBar.Value = 75;

            xd = new xdRNG(startSeed);

            switch (rngDirectionChoice.SelectedIndex)
            {
                case 0: // Advance the RNG
                    for (int i = 0; i <= frame; i++)
                    {
                        rngOutput.Rows.Add((i).ToString(), xd.getSeed().ToString("X8"));
                        xd.advanceXD();
                    }
                    break;
                case 1: // Reverse the RNG
                    for (int i = 0; i <= frame; i++)
                    {
                        rngOutput.Rows.Add((i).ToString(), xd.getSeed().ToString("X8"));
                        xd.reverseXD();
                    }
                    break;
                default: break;
            }

            statusLabel.Text = "RNG run complete.";
            progressBar.Value = 100;
            Thread.Sleep(50); // Flash the full status bar
            progressBar.Visible = false;
        }
Esempio n. 6
0
        private void pidStart_Click(object sender, EventArgs e)
        {
            statusLabel.Text = "Finding desired PID...";
            progressBar.Visible = true;

            byte hp, atk, def, spa, spd, spe;
            uint seed, pid, ivseed1, ivseed2;

            statusLabel.Text = "Parsing data...";
            progressBar.Value = 25;

            byte.TryParse(dhpText.Text, System.Globalization.NumberStyles.Number, null, out hp);
            byte.TryParse(datkText.Text, System.Globalization.NumberStyles.Number, null, out atk);
            byte.TryParse(ddefText.Text, System.Globalization.NumberStyles.Number, null, out def);
            byte.TryParse(dspaText.Text, System.Globalization.NumberStyles.Number, null, out spa);
            byte.TryParse(dspdText.Text, System.Globalization.NumberStyles.Number, null, out spd);
            byte.TryParse(dspeText.Text, System.Globalization.NumberStyles.Number, null, out spe);

            ivseed1 = (uint)(hp + (atk << 5) + (def << 10));
            ivseed2 = (uint)(spe + (spa << 5) + (spd << 10));

            statusLabel.Text = "Configuring output...";
            progressBar.Value = 50;

            pidOutput.BackgroundColor = Color.White;
            pidOutput.Rows.Clear();
            pidOutput.Columns.Clear();
            pidOutput.Columns.Add("Seed", "Seed");
            pidOutput.Columns[0].Width = 70;
            pidOutput.Columns.Add("PID", "PID");
            pidOutput.Columns[1].Width = 70;
            pidOutput.Columns.Add("Nature", "Nature");
            pidOutput.Columns[2].Width = 67;

            statusLabel.Text = "Running PID search...";
            progressBar.Value = 75;

            for (int i = 0; i < 2; i++)
                for (int j = 0; j < 65536; j++)
                {
                    seed = (uint)(((ivseed1 + (i << 15)) << 16) + j);
                    xdRNG xd = new xdRNG(seed);

                    if ((xd.previewHalfAdvance(seed, 1) & 0x7FFF) == ivseed2)
                    {
                        pid = xd.getPID();
                        pidOutput.Rows.Add(seed.ToString("X"), pid.ToString("X"), xd.getNature(pid).ToString());
                    }
                }

            statusLabel.Text = "PID search complete.";
            progressBar.Value = 100;
            Thread.Sleep(50); // Flash the full status bar
            progressBar.Visible = false;
        }