Beispiel #1
0
        private void searchGenVHit(DateTime date, int hour, int minute, int minSec, int maxSec, int minframe,
                                   int maxframe, uint id, ulong mAC, Version version, Language language, DSType dstype,
                                   bool softReset,
                                   uint vCount, uint timer0, uint gxStat, uint vFrame)
        {
            var rng = new BWRng(0);
            int[] buttons = {0};

            isSearching = true;

            for (int sec = minSec; sec <= maxSec; sec++)
            {
                var dTime = new DateTime(date.Year, date.Month, date.Day, hour, minute, sec);

                for (int button = 0; button < 13; button++)
                {
                    buttons[0] = button;
                    ulong seed = Functions.EncryptSeed(dTime, mAC, version, language, dstype, softReset, vCount, timer0,
                                                       gxStat,
                                                       vFrame,
                                                       Functions.buttonMashed(buttons));

                    rng.Seed = seed;
                    ulong oSeed = seed;

                    for (int frame = 0; frame < minframe; frame++)
                    {
                        rng.Next();
                    }

                    for (int frame = minframe; frame <= maxframe; frame++)
                    {
                        rng.Next();
                        seed = rng.Seed;

                        var upper = (uint) (((seed >> 32)*0xFFFFFFFF) >> 32);
                        uint tid = (upper & 0xFFFF);
                        uint sid = (upper >> 16);

                        if (tid == id)
                        {
                            var iDSeed = new IDListBW
                                {
                                    Seed = oSeed,
                                    Date = dTime.ToShortDateString(),
                                    Time = dTime.ToString("HH:mm:ss"),
                                    Frame = frame,
                                    InitialFrame = (int) Functions.initialPIDRNG_ID(oSeed, false, version),
                                    ID = tid,
                                    SID = sid,
                                    Starter = "N/A",
                                    Button = Functions.buttonStrings[button]
                                };

                            resultsListBW.Add(iDSeed);

                            refresh = true;
                        }
                    }
                }
            }
            isSearching = false;

            lblAction.Text = "Done. - Awaiting Command";
        }
Beispiel #2
0
        private void searchGenV(DateTime date, bool entireMonth, bool useSeed, ulong shinySeed, int seedFrame,
                                bool usePID, uint pid, bool useID,
                                uint id, bool useSID, uint sid, bool calcMinFrame, bool existingFile, ulong mAC,
                                Version version, Language language, DSType dstype, bool softRest, uint vCount,
                                uint timer0, uint gxStat,
                                uint vFrame)
        {
            int dayMin, dayMax;
            uint shinyUpper = 0;
            bool xOR2 = false, starter = false;
            var rng = new BWRng(0);
            resultsCount = 0;
            int[] buttons = {0};

            isSearching = true;

            if (useSeed)
            {
                rng.Seed = shinySeed;
                for (int i = 0; i < seedFrame; i++)
                {
                    rng.Next();
                }

                shinyUpper = (uint) (rng.Seed >> 32);

                xOR2 = Convert.ToBoolean((shinyUpper >> 31) ^ (shinyUpper & 1));
            }

            if (entireMonth)
            {
                dayMin = 1;
                dayMax = DateTime.DaysInMonth(date.Year, date.Month);
            }
            else
                dayMin = dayMax = date.Day;

            long total = 86400*(dayMax - dayMin + 1);

            for (int day = dayMin; day <= dayMax; day++)
            {
                for (int hour = 0; hour < 24; hour++)
                {
                    for (int minute = 0; minute < 60; minute++)
                    {
                        for (int second = 0; second < 60; second++)
                        {
                            var dTime = new DateTime(date.Year, date.Month, day, hour, minute, second);

                            for (int button = 0; button < 13; button++)
                            {
                                buttons[0] = button;
                                ulong seed = Functions.EncryptSeed(dTime, mAC, version, language, dstype, softRest,
                                                                   vCount, timer0,
                                                                   gxStat,
                                                                   vFrame, Functions.buttonMashed(buttons));

                                rng.Seed = seed;
                                ulong oSeed = seed;

                                if (calcMinFrame)
                                {
                                    minFrame = (int) Functions.initialPIDRNG_ID(seed, existingFile, version);
                                }

                                for (int frame = 0; frame < minFrame; frame++)
                                {
                                    rng.Next();
                                }

                                for (int frame = minFrame; frame <= maxFrame; frame++)
                                {
                                    rng.Next();
                                    seed = rng.Seed;

                                    var upper = (uint) (((seed >> 32)*0xFFFFFFFF) >> 32);
                                    uint tid = (upper & 0xFFFF);
                                    uint tsid = (upper >> 16);

                                    if (useSeed)
                                    {
                                        bool xOR1 = Convert.ToBoolean((tid + tsid) & 1);

                                        if (xOR1 ^ xOR2)
                                        {
                                            pid = shinyUpper ^ 0x80010000;
                                            starter = false;
                                        }
                                        else
                                        {
                                            pid = shinyUpper ^ 0x00010000;
                                            starter = true;
                                        }

                                        pid = ((pid >> 16) ^ (pid << 16 >> 16));
                                    }

                                    if ((!useID || (tid == id)) && (!useSID || (tsid == sid)))
                                    {
                                        if (useSeed && (tid ^ tsid ^ pid) >= 8) continue;
                                        if (usePID && !Functions.Shiny(pid, (ushort) tid, (ushort) tsid)) continue;
                                        var iDSeed = new IDListBW
                                            {
                                                Seed = oSeed,
                                                Date = dTime.ToShortDateString(),
                                                Time = dTime.ToString("HH:mm:ss"),
                                                InitialFrame = minFrame,
                                                Frame = frame,
                                                ID = tid,
                                                SID = tsid,
                                                Starter = starter.ToString(),
                                                Button = Functions.buttonStrings[button]
                                            };

                                        resultsListBW.Add(iDSeed);
                                        refresh = true;

                                        if (resultsCount++ >= MAX_RESULTS)
                                        {
                                            lblAction.Text =
                                                "Search stopped - results max reached. Narrow your search for better results.";

                                            isSearching = false;
                                            return;
                                        }
                                    }
                                }
                            }
                        }
                    }
                    lblAction.Text = ((((day - dayMin)*24 + hour + 1)*3600)/(float) total*100) + "%";
                }
            }
            isSearching = false;

            lblAction.Text = "Done. - Awaiting Command";
        }