Example #1
0
        private void Search6_Timeline()
        {
            if (!TTT.HasSeed)
            {
                FormUtil.Error("Please Calibrate Timeline");
                return;
            }

            var timeline = TTT.gettimeline();
            int min      = Math.Max((int)Frame_min.Value, timeline.Startingframe + 2);
            int max      = (int)TimeSpan.Value * 60 + min;

            timeline.Maxframe = max;
            timeline.Generate(ForMainForm: true);
            int listlength = timeline.TinyLength;

            // Prepare
            var rng = new MersenneTwister(Seed.Value);

            for (int i = 0; i < min; i++)
            {
                rng.Next();
            }
            getsetting(rng);
            Frame.standard = (int)(TargetFrame.Value - min);

            for (int i = 0; i < listlength; i++)
            {
                var tinyframe = timeline.results[i];
                if (tinyframe.unhitable)
                {
                    continue;
                }
                if (tinyframe.framemax < min)
                {
                    continue;
                }
                RNGPool.TinySynced = tinyframe.sync == true; // For stationary
                for (int j = tinyframe.framemin + 2; j <= tinyframe.framemax; j += 2, RNGPool.AddNext(rng), RNGPool.AddNext(rng))
                {
                    while (j < min)
                    {
                        j += 2;
                    }
                    RNGPool.tinystatus = tinyframe.tinystate.Clone();
                    RNGPool.tinystatus.Currentframe = j;
                    RNGResult result = RNGPool.Generate6();
                    if (!filter.CheckResult(result))
                    {
                        continue;
                    }
                    Frames.Add(new Frame(result, frame: j, time: j - min));
                    Frames.Last()._tinystate = new PRNGState(tinyframe.tinystate.Status);
                    if (Frames.Count > MAX_RESULTS_NUM)
                    {
                        return;
                    }
                }
            }
        }
Example #2
0
 private void DragDropWC(object sender, DragEventArgs e)
 {
     string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
     if (files.Length > 0 && !ReadWc(files[0]))
     {
         FormUtil.Error(FILEERRORSTR[lindex]);
     }
 }
Example #3
0
 private void B_Connect_Click(object sender, EventArgs e)
 {
     ntrclient.OneClick = sender == B_OneClick;
     L_NTRLog.Text      = "Connecting...";
     ntrclient.setServer(IP.Text, 8000);
     try
     {
         ntrclient.connectToServer();
     }
     catch
     {
         OnDisconnected(false);
         FormUtil.Error("Unable to connect the console");
     }
 }
Example #4
0
        private void B_Open_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog1 = new OpenFileDialog()
            {
                Filter = Gen6 ? "6th Gen Wonder Card File|*.wc6|Full Wonder Card File|*.wc6full"
                                          : "7th Gen Wonder Card File|*.wc7|Full Wonder Card File|*.wc7full",
                Title = "Select a Wonder Card File"
            };

            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                if (!ReadWc(openFileDialog1.FileName))
                {
                    FormUtil.Error(FILEERRORSTR[lindex]);
                }
            }
        }
Example #5
0
 private static void TryDownload()
 {
     try
     {
         var LatestVersion = new System.Net.WebClient().DownloadString("https://raw.githubusercontent.com/wwwwwwzx/3DSRNGTool/master/version.txt");
         if (HasNewerVersion(LatestVersion))
         {
             if (FormUtil.Prompt(MessageBoxButtons.YesNo, $"New version (v{LatestVersion}) detected. Start to download?") == DialogResult.Yes)
             {
                 System.Diagnostics.Process.Start(StringItem.GITHUB + "releases/download/" + LatestVersion + "/3DSRNGTool.exe");
                 Program.mainform.Close();
             }
         }
     }
     catch (Exception ex)
     {
         FormUtil.Error("Please download manually as an error occured: " + ex.Message);
     }
 }
Example #6
0
        private void Search7_TimelineLeap()
        {
            int start      = (int)Frame_min.Value;
            int target     = (int)TargetFrame.Value;
            int Totaldelay = FuncUtil.CalcFrame(Seed.Value, start, target, Modelnum)[0];
            int mindelay   = (int)Math.Round(DelayMin.Value * 30);
            int maxdelay   = (int)Math.Round(DelayMax.Value * 30);
            int starttime  = Totaldelay - maxdelay;
            int endtime    = Totaldelay - mindelay;

            // Intialize
            SFMT sfmt = new SFMT(Seed.Value);

            for (int i = 0; i < start; i++)
            {
                sfmt.Next();
            }
            ModelStatus status = new ModelStatus(Modelnum, sfmt)
            {
                IsBoy = Boy.Checked
            };

            // Advance
            int frame = start;

            for (int i = 0; i < starttime; i++)
            {
                frame += status.NextState();
            }
            for (int i = start; i < frame; i++)
            {
                sfmt.Next();
            }

            getsetting(sfmt);

            List <int>         Framelist  = new List <int>();
            List <ModelStatus> statuslist = new List <ModelStatus>();
            List <int>         timelist   = new List <int>();

            // Search
            int         LeapType = getLeapType();
            int         frameadvance;
            int         Tmpframe, bakframe1, bakframe2 = 0;
            ModelStatus stmp, bak1, bak2 = null;

            for (int i = Math.Max(0, starttime); i < endtime; i++)
            {
                Tmpframe = frame;
                stmp     = status.Clone();

                // Leap!
                switch (LeapType)
                {
                case 0:     // WC7
                    for (int j = 0; j < 19; j++)
                    {
                        Tmpframe += stmp.NextState();
                    }
                    RNGPool.Rewind(Tmpframe - frame);
                    RNGPool.CopyStatus(stmp);
                    RNGPool.igenerator.Generate();
                    frameadvance = RNGPool.index - (Tmpframe - frame);
                    Tmpframe    += stmp.frameshift(frameadvance);
                    Tmpframe    += stmp.NextState();
                    break;

                case 1:     // Menu
                    stmp.fidget_cd = 3;
                    break;

                case 2:     // Dialogue
                    Tmpframe += stmp.NextState();
                    Tmpframe += stmp.NextState();
                    Tmpframe += stmp.frameshift(1);
                    Tmpframe += stmp.NextState();
                    break;
                }

                bak1      = stmp.Clone();
                bakframe1 = Tmpframe;

                // Check if hit
                while (Tmpframe < target)
                {
                    Tmpframe += stmp.NextState();
                }
                if (Tmpframe == target)
                {
                    Framelist.Add(frame);
                    timelist.Add(i);
                    bak2      = bak1.Clone();
                    bakframe2 = bakframe1;
                    statuslist.Add(stmp.Clone());
                }

                // Move to next state
                frameadvance = status.NextState();
                frame       += frameadvance;
                for (int j = 0; j < frameadvance; j++)
                {
                    RNGPool.AddNext(sfmt);
                }
            }

            if (Framelist.Count > 0)
            {
                int frame0 = Framelist.Last();
                Frame_max.Value = frame0;
                if (!IsEvent)
                {
                    JumpFrame.Value = frame0;
                }
                if (FormUtil.Prompt(MessageBoxButtons.YesNo, string.Format("Hit A at {0} (Frame1) and then at {1} (Frame2).\n\nYes: Check new timeline / No: Check the spread", frame0, target)) == DialogResult.Yes)
                {
                    Search7_TimelineLeap1(bakframe2, target, bak2, maxdelay);
                    foreach (var f in Frames)
                    {
                        f.Frame0 = frame0;
                    }
                }
                else
                {
                    Search7_TimelineLeap2(Framelist, statuslist, target, timelist);
                }
            }
            else
            {
                FormUtil.Error(StringItem.NORESULT_STR[StringItem.language]);
            }
        }