Exemple #1
0
        public Thread CreateThread(IntPtr emuHandle, Hand hand, bool main, InputBoard inputBoard, BulletHellFishForm form, List <double> dataSource)
        {
            return(new Thread(() =>
            {
                Thread.CurrentThread.IsBackground = true;

                InputParameters param = form.GetInputParameters(hand);

                bool noDataSource = dataSource == null || dataSource.Count() == 0;

                int minHoldTime = param.MinHoldTime;
                int maxHoldTime = noDataSource ? minHoldTime : param.MaxHoldTime;

                int i = 0;
                while (true)
                {
                    if (Utils.GetWindowCaption(emuHandle).Equals(Utils.GetWindowCaption(GetForegroundWindow())))
                    {
                        if (main)
                        {
                            inputBoard.ExecAdditionalBehaviors();
                        }

                        string[] nextCombo;

                        if (noDataSource)
                        {
                            nextCombo = inputBoard.NextCombo(hand);
                        }
                        else
                        {
                            nextCombo = inputBoard.NextComboFromNormalizedData(hand, dataSource[i]);
                        }

                        if (!Behavior.IsLocked())
                        {
                            inputBoard.PressCombo(nextCombo, minHoldTime, maxHoldTime, hand);
                            form.UpdateForm(inputBoard.ComboName(nextCombo), hand, main, playerId, i);
                            i++;
                            if (i >= dataSource.Count())
                            {
                                i = 0;
                            }
                        }
                        else
                        {
                            continue;
                        }


                        Thread.Sleep(param.SleepTime);
                    }
                    else
                    {
                        if (!form.Text.Equals(Utils.GetWindowCaption(GetForegroundWindow())))
                        {
                            SetForegroundWindow(emuHandle);
                        }
                        else
                        {
                            form.Pause();
                        }
                    }
                }
            }));
        }
Exemple #2
0
 internal void SetInputBoard(InputBoard inputBoard)
 {
     this.inputBoard = inputBoard;
 }
Exemple #3
0
 internal void SetMapping(PSXInputBoard InputBoard)
 {
     this.InputBoard = InputBoard;
 }