示例#1
0
        private static void KeyboardMouseInput()
        {
            while (true)
            {
                TranslateMouse.MouseButtonsInput(Controller);
                TranslateKeyboard.KeyboardInput(Controller);

                SendtoController(Controller);
            }
        }
示例#2
0
        private static void KeyboardMouseInput()
        {
            while (!shuttingDown)
            {
                TranslateMouse.MouseButtonsInput(state);
                TranslateKeyboard.KeyboardInput(state);
                SimGamePad.Instance.Update();

                // Poll aggressively, but avoid completely pegging the CPU to 100%.
                Thread.Sleep(1);
            }
        }
示例#3
0
        static void Main(string[] args)
        {
            // Check if we are debugging
            // if so then attach the console
            #if (DEBUG)
            int conPtr = AllocConsole();
            AttachConsole(conPtr);
            Logger.appendLogLine("State", "Console Attached!", Logger.Type.Info);
            #endif

            ReadConfiguration();
            ActiveConfig = Data.Load(ActiveConfigFile);
            ReloadActiveConfig();
            ReloadControlScheme();

            TranslateKeyboard.LoadKeymap();

            Thread tApplicationRun = new Thread(ApplicationRun);
            tApplicationRun.SetApartmentState(ApartmentState.STA);
            tApplicationRun.Start();

            //XboxKeyboardMouse.Hooks.HIDHook.getInfo();

            //XboxKeyboardMouse.Hooks.InterceptKeys.init();


            while (MainForm == null)
            {
                Thread.Sleep(100);
            }

            MainForm.FormClosing += (sender, e) => { Activate.ShutDown(); };

            Thread tPause = new Thread(Pause);
            tPause.SetApartmentState(ApartmentState.STA);
            tPause.IsBackground = true;
            tPause.Start();

            Thread tActivateKM = new Thread(() => { Activate.ActivateKeyboardAndMouse(); });
            tActivateKM.SetApartmentState(ApartmentState.STA);
            tActivateKM.IsBackground = true;
            tActivateKM.Start();
        }
示例#4
0
        public static void ReloadControlScheme()
        {
            TranslateKeyboard.ClearAllDicts();

            lock (TranslateKeyboard.buttons)        {
                lock (TranslateKeyboard.mapLeftStickY)  {
                    lock (TranslateKeyboard.mapLeftStickX)  {
                        lock (TranslateKeyboard.mapRightStickX) {
                            lock (TranslateKeyboard.mapRightStickY) {
                                if (ActiveConfig.Controls_KB_Xbox_A != 0)
                                {
                                    TranslateKeyboard.buttons.Add((Key)ActiveConfig.Controls_KB_Xbox_A, ScpDriverInterface.X360Buttons.A);
                                }
                                if (ActiveConfig.Controls_KB_Xbox_B != 0)
                                {
                                    TranslateKeyboard.buttons.Add((Key)ActiveConfig.Controls_KB_Xbox_B, ScpDriverInterface.X360Buttons.B);
                                }
                                if (ActiveConfig.Controls_KB_Xbox_X != 0)
                                {
                                    TranslateKeyboard.buttons.Add((Key)ActiveConfig.Controls_KB_Xbox_X, ScpDriverInterface.X360Buttons.X);
                                }
                                if (ActiveConfig.Controls_KB_Xbox_Y != 0)
                                {
                                    TranslateKeyboard.buttons.Add((Key)ActiveConfig.Controls_KB_Xbox_Y, ScpDriverInterface.X360Buttons.Y);
                                }

                                if (ActiveConfig.Controls_KB_Xbox_DPAD_Up != 0)
                                {
                                    TranslateKeyboard.buttons.Add((Key)ActiveConfig.Controls_KB_Xbox_DPAD_Up, ScpDriverInterface.X360Buttons.Up);
                                }
                                if (ActiveConfig.Controls_KB_Xbox_DPAD_Down != 0)
                                {
                                    TranslateKeyboard.buttons.Add((Key)ActiveConfig.Controls_KB_Xbox_DPAD_Down, ScpDriverInterface.X360Buttons.Down);
                                }
                                if (ActiveConfig.Controls_KB_Xbox_DPAD_Left != 0)
                                {
                                    TranslateKeyboard.buttons.Add((Key)ActiveConfig.Controls_KB_Xbox_DPAD_Left, ScpDriverInterface.X360Buttons.Left);
                                }
                                if (ActiveConfig.Controls_KB_Xbox_DPAD_Right != 0)
                                {
                                    TranslateKeyboard.buttons.Add((Key)ActiveConfig.Controls_KB_Xbox_DPAD_Right, ScpDriverInterface.X360Buttons.Right);
                                }

                                if (ActiveConfig.Controls_KB_Xbox_Guide != 0)
                                {
                                    TranslateKeyboard.buttons.Add((Key)ActiveConfig.Controls_KB_Xbox_Guide, ScpDriverInterface.X360Buttons.Guide);
                                }
                                if (ActiveConfig.Controls_KB_Xbox_Start != 0)
                                {
                                    TranslateKeyboard.buttons.Add((Key)ActiveConfig.Controls_KB_Xbox_Start, ScpDriverInterface.X360Buttons.Start);
                                }
                                if (ActiveConfig.Controls_KB_Xbox_Back != 0)
                                {
                                    TranslateKeyboard.buttons.Add((Key)ActiveConfig.Controls_KB_Xbox_Back, ScpDriverInterface.X360Buttons.Back);
                                }

                                if (ActiveConfig.Controls_KB_Xbox_LeftBumper != 0)
                                {
                                    TranslateKeyboard.buttons.Add((Key)ActiveConfig.Controls_KB_Xbox_LeftBumper, ScpDriverInterface.X360Buttons.LeftBumper);
                                }
                                if (ActiveConfig.Controls_KB_Xbox_RightBumper != 0)
                                {
                                    TranslateKeyboard.buttons.Add((Key)ActiveConfig.Controls_KB_Xbox_RightBumper, ScpDriverInterface.X360Buttons.RightBumper);
                                }

                                if (ActiveConfig.Controls_KB_Xbox_Sticks_Left != 0)
                                {
                                    TranslateKeyboard.buttons.Add((Key)ActiveConfig.Controls_KB_Xbox_Sticks_Left, ScpDriverInterface.X360Buttons.LeftStick);
                                }
                                if (ActiveConfig.Controls_KB_Xbox_Sticks_Right != 0)
                                {
                                    TranslateKeyboard.buttons.Add((Key)ActiveConfig.Controls_KB_Xbox_Sticks_Right, ScpDriverInterface.X360Buttons.RightStick);
                                }

                                if (ActiveConfig.Controls_KB_Xbox_Trigger_Left != 0)
                                {
                                    TranslateKeyboard.triggers.Add((Key)ActiveConfig.Controls_KB_Xbox_Trigger_Left, TranslateKeyboard.TriggerType.LeftTrigger);
                                }
                                if (ActiveConfig.Controls_KB_Xbox_Trigger_Right != 0)
                                {
                                    TranslateKeyboard.triggers.Add((Key)ActiveConfig.Controls_KB_Xbox_Trigger_Right, TranslateKeyboard.TriggerType.RightTrigger);
                                }


                                if (ActiveConfig.Controls_KB_Sticks_AXIS_L_Up != 0)
                                {
                                    TranslateKeyboard.mapLeftStickY.Add((Key)ActiveConfig.Controls_KB_Sticks_AXIS_L_Up, short.MaxValue);
                                }
                                if (ActiveConfig.Controls_KB_Sticks_AXIS_L_Down != 0)
                                {
                                    TranslateKeyboard.mapLeftStickY.Add((Key)ActiveConfig.Controls_KB_Sticks_AXIS_L_Down, short.MinValue);
                                }
                                if (ActiveConfig.Controls_KB_Sticks_AXIS_L_Left != 0)
                                {
                                    TranslateKeyboard.mapLeftStickX.Add((Key)ActiveConfig.Controls_KB_Sticks_AXIS_L_Left, short.MinValue);
                                }
                                if (ActiveConfig.Controls_KB_Sticks_AXIS_L_Right != 0)
                                {
                                    TranslateKeyboard.mapLeftStickX.Add((Key)ActiveConfig.Controls_KB_Sticks_AXIS_L_Right, short.MaxValue);
                                }

                                if (ActiveConfig.Controls_KB_Sticks_AXIS_R_Up != 0)
                                {
                                    TranslateKeyboard.mapRightStickY.Add((Key)ActiveConfig.Controls_KB_Sticks_AXIS_R_Up, short.MaxValue);
                                }
                                if (ActiveConfig.Controls_KB_Sticks_AXIS_R_Down != 0)
                                {
                                    TranslateKeyboard.mapRightStickY.Add((Key)ActiveConfig.Controls_KB_Sticks_AXIS_R_Down, short.MinValue);
                                }
                                if (ActiveConfig.Controls_KB_Sticks_AXIS_R_Left != 0)
                                {
                                    TranslateKeyboard.mapRightStickX.Add((Key)ActiveConfig.Controls_KB_Sticks_AXIS_R_Left, short.MinValue);
                                }
                                if (ActiveConfig.Controls_KB_Sticks_AXIS_R_Right != 0)
                                {
                                    TranslateKeyboard.mapRightStickX.Add((Key)ActiveConfig.Controls_KB_Sticks_AXIS_R_Right, short.MaxValue);
                                }
                            }
                        }
                    }
                }
            }
        }
示例#5
0
        private static void KeyboardMouseInput()
        {
            while (!shuttingDown)
            {
                /*TranslateMouse.MouseButtonsInput(state);*/
                TranslateKeyboard.KeyboardInput(state);

                if (Program.MainForm.StatusSyncCheck() == true && Working == false)
                {
                    if (Program.MainForm.AutoCheck() == true)
                    {
                        Working = true;

                        Thread.Sleep(5000);

                        if (DoneOnce == false)
                        {
                            /*----Begin Alchemy---*/

                            state.Buttons = GamePadControl.A;
                            SimGamePad.Instance.Update();
                            Thread.Sleep(100);

                            state.Buttons = GamePadControl.A;
                            SimGamePad.Instance.Update();
                            Thread.Sleep(100);

                            state.Buttons = GamePadControl.None;
                            SimGamePad.Instance.Update();
                            Thread.Sleep(5000);

                            /*----Look at and open book----*/

                            state.RightStickX = 32767;
                            SimGamePad.Instance.Update();
                            Thread.Sleep(600);

                            state.RightStickX = 0;
                            SimGamePad.Instance.Update();

                            state.RightStickY = -32767;
                            SimGamePad.Instance.Update();
                            Thread.Sleep(100);

                            state.RightStickY = 0;
                            SimGamePad.Instance.Update();
                            Thread.Sleep(1000);

                            state.Buttons = GamePadControl.A;
                            SimGamePad.Instance.Update();
                            Thread.Sleep(10);

                            state.Buttons = GamePadControl.A;
                            SimGamePad.Instance.Update();
                            Thread.Sleep(100);

                            state.Buttons = GamePadControl.None;
                            SimGamePad.Instance.Update();
                            Thread.Sleep(5000);

                            /*----Turn page----*/

                            state.Buttons = GamePadControl.RightShoulder;
                            SimGamePad.Instance.Update();
                            Thread.Sleep(10);

                            state.Buttons = GamePadControl.None;
                            SimGamePad.Instance.Update();
                            Thread.Sleep(3000);

                            /*----End----*/
                        }
                        else
                        {
                            /*----Go to book from end and open----*/

                            state.RightStickX = 32767;
                            SimGamePad.Instance.Update();
                            Thread.Sleep(600);

                            state.RightStickX = 0;
                            SimGamePad.Instance.Update();
                            Thread.Sleep(1500);

                            state.Buttons = GamePadControl.A;
                            SimGamePad.Instance.Update();
                            Thread.Sleep(10);

                            state.Buttons = GamePadControl.A;
                            SimGamePad.Instance.Update();
                            Thread.Sleep(100);

                            state.Buttons = GamePadControl.None;
                            SimGamePad.Instance.Update();
                            Thread.Sleep(4000);

                            /*----End----*/
                        }

                        /*----Prepare cockeral potion----*/

                        state.Buttons |= GamePadControl.A;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(2000);

                        state.Buttons &= ~GamePadControl.A;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(3000);

                        /*----Grab spirits----*/

                        state.RightStickX = -32767;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(150);

                        state.RightStickX = 0;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(1000);

                        state.Buttons = GamePadControl.A;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(100);

                        state.Buttons = GamePadControl.None;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(7500);

                        /*---Grab Mint----*/

                        state.RightStickX = 32767;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(450);

                        state.RightStickX = 0;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(1000);

                        state.Buttons = GamePadControl.A;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(4000);

                        /*----Place Mint into morter----*/

                        state.RightStickY = -32767;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(400);

                        state.RightStickY = 0;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(1000);

                        PressA();

                        state.Buttons = GamePadControl.None;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(6000);

                        Thread.Sleep(10000);

                        /*----Grind Mint with pestle----*/

                        state.RightStickX = 32767;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(150);

                        state.RightStickX = 0;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(2000);

                        state.Buttons = GamePadControl.A;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(1000);

                        state.Buttons = GamePadControl.None;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(17000);

                        /*----Put Ground Mint into cauldren----*/

                        state.RightStickY = 32767;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(400);

                        state.RightStickY = 0;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(1000);

                        state.Buttons = GamePadControl.A;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(1000);

                        state.Buttons = GamePadControl.None;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(7000);

                        /*----Grab 2nd Mint---*/

                        state.RightStickX = 32767;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(200);

                        state.RightStickX = 0;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(1000);

                        state.RightStickY = 32767;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(400);

                        state.RightStickY = 0;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(1000);

                        state.Buttons = GamePadControl.A;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(1000);

                        state.Buttons = GamePadControl.None;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(5000);

                        /*----Place mint into morter----*/

                        state.RightStickY = -32767;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(400);

                        state.RightStickY = 0;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(1000);

                        state.Buttons = GamePadControl.A;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(1000);

                        state.Buttons = GamePadControl.None;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(3500);

                        /*----Grab pestle----*/

                        state.RightStickX = 32767;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(200);

                        state.RightStickX = 0;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(1000);

                        state.Buttons = GamePadControl.A;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(1000);

                        state.Buttons = GamePadControl.None;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(11000);

                        /*----Move morter to pot and drop in----*/

                        state.RightStickY = 32767;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(400);

                        state.RightStickY = 0;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(1000);

                        state.Buttons = GamePadControl.A;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(1000);

                        state.Buttons = GamePadControl.None;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(8500);

                        /*----Sandglass and Bellows----*/

                        state.RightTrigger = 255;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(1000);

                        state.RightTrigger = 0;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(3500);

                        state.LeftTrigger = 255;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(1000);

                        state.LeftTrigger = 0;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(8500);

                        /*----Grab Valeran----*/

                        state.RightStickX = 32767;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(350);

                        state.RightStickX = 0;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(1000);

                        state.Buttons = GamePadControl.A;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(1000);

                        state.Buttons = GamePadControl.None;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(4000);

                        /*----Place Valeran into cauldren----*/

                        state.RightStickX = -32767;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(450);

                        state.RightStickX = 0;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(1000);

                        state.Buttons = GamePadControl.A;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(1000);

                        state.Buttons = GamePadControl.None;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(4500);


                        /*----Sandglass and Bellows x1----*/

                        state.RightTrigger = 255;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(1000);

                        state.RightTrigger = 0;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(3500);

                        state.LeftTrigger = 255;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(1000);

                        state.LeftTrigger = 0;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(12000);

                        /*----Sandglass and Bellows x2----*/

                        state.RightTrigger = 255;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(1000);

                        state.RightTrigger = 0;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(3500);

                        state.LeftTrigger = 255;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(1000);

                        state.LeftTrigger = 0;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(8000);

                        /*----Grab phail---*/

                        state.RightStickX = -32767;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(600);

                        state.RightStickX = 0;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(1000);

                        state.RightStickY = -32767;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(175);

                        state.RightStickY = 0;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(600);

                        state.Buttons = GamePadControl.A;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(1000);

                        state.Buttons = GamePadControl.None;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(2500);

                        /*----Use Still----*/

                        state.Buttons |= GamePadControl.A;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(2000);

                        state.Buttons &= ~GamePadControl.A;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(10);

                        Thread.Sleep(6000);

                        /*----Final Bellows x2----*/

                        state.LeftTrigger = 255;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(1000);

                        state.LeftTrigger = 0;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(1500);

                        state.LeftTrigger = 255;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(1000);

                        state.LeftTrigger = 0;
                        SimGamePad.Instance.Update();
                        Thread.Sleep(7500);

                        /*----End----*/

                        Working = false;

                        DoneOnce = true;
                    }
                    else
                    {
                        SimGamePad.Instance.Update();
                        Thread.Sleep(1);
                    }
                }

                SimGamePad.Instance.Update();

                // Poll aggressively, but avoid completely pegging the CPU to 100%.
                Thread.Sleep(1);
            }
        }
示例#6
0
        public static void ReloadControlScheme()
        {
            TranslateKeyboard.ClearAllDicts();

            lock (TranslateKeyboard.buttons)
            {
                if (ActiveConfig.Controls_KB_Xbox_A != 0)
                {
                    TranslateKeyboard.buttons.Add((Key)ActiveConfig.Controls_KB_Xbox_A, GamePadControl.A);
                }
                if (ActiveConfig.Controls_KB_Xbox_B != 0)
                {
                    TranslateKeyboard.buttons.Add((Key)ActiveConfig.Controls_KB_Xbox_B, GamePadControl.B);
                }
                if (ActiveConfig.Controls_KB_Xbox_X != 0)
                {
                    TranslateKeyboard.buttons.Add((Key)ActiveConfig.Controls_KB_Xbox_X, GamePadControl.X);
                }
                if (ActiveConfig.Controls_KB_Xbox_Y != 0)
                {
                    TranslateKeyboard.buttons.Add((Key)ActiveConfig.Controls_KB_Xbox_Y, GamePadControl.Y);
                }

                if (ActiveConfig.Controls_KB_Xbox_DPAD_Up != 0)
                {
                    TranslateKeyboard.buttons.Add((Key)ActiveConfig.Controls_KB_Xbox_DPAD_Up, GamePadControl.DPadUp);
                }
                if (ActiveConfig.Controls_KB_Xbox_DPAD_Down != 0)
                {
                    TranslateKeyboard.buttons.Add((Key)ActiveConfig.Controls_KB_Xbox_DPAD_Down, GamePadControl.DPadDown);
                }
                if (ActiveConfig.Controls_KB_Xbox_DPAD_Left != 0)
                {
                    TranslateKeyboard.buttons.Add((Key)ActiveConfig.Controls_KB_Xbox_DPAD_Left, GamePadControl.DPadLeft);
                }
                if (ActiveConfig.Controls_KB_Xbox_DPAD_Right != 0)
                {
                    TranslateKeyboard.buttons.Add((Key)ActiveConfig.Controls_KB_Xbox_DPAD_Right, GamePadControl.DPadRight);
                }

                if (ActiveConfig.Controls_KB_Xbox_Guide != 0)
                {
                    TranslateKeyboard.buttons.Add((Key)ActiveConfig.Controls_KB_Xbox_Guide, GamePadControl.Guide);
                }
                if (ActiveConfig.Controls_KB_Xbox_Start != 0)
                {
                    TranslateKeyboard.buttons.Add((Key)ActiveConfig.Controls_KB_Xbox_Start, GamePadControl.Start);
                }
                if (ActiveConfig.Controls_KB_Xbox_Back != 0)
                {
                    TranslateKeyboard.buttons.Add((Key)ActiveConfig.Controls_KB_Xbox_Back, GamePadControl.Back);
                }

                if (ActiveConfig.Controls_KB_Xbox_LeftBumper != 0)
                {
                    TranslateKeyboard.buttons.Add((Key)ActiveConfig.Controls_KB_Xbox_LeftBumper, GamePadControl.LeftShoulder);
                }
                if (ActiveConfig.Controls_KB_Xbox_RightBumper != 0)
                {
                    TranslateKeyboard.buttons.Add((Key)ActiveConfig.Controls_KB_Xbox_RightBumper, GamePadControl.RightShoulder);
                }

                if (ActiveConfig.Controls_KB_Xbox_Sticks_Left != 0)
                {
                    TranslateKeyboard.buttons.Add((Key)ActiveConfig.Controls_KB_Xbox_Sticks_Left, GamePadControl.LeftStickClick);
                }
                if (ActiveConfig.Controls_KB_Xbox_Sticks_Right != 0)
                {
                    TranslateKeyboard.buttons.Add((Key)ActiveConfig.Controls_KB_Xbox_Sticks_Right, GamePadControl.RightStickClick);
                }

                if (ActiveConfig.Controls_KB_Xbox_Trigger_Left != 0)
                {
                    TranslateKeyboard.triggers.Add((Key)ActiveConfig.Controls_KB_Xbox_Trigger_Left, TranslateKeyboard.TriggerType.LeftTrigger);
                }
                if (ActiveConfig.Controls_KB_Xbox_Trigger_Right != 0)
                {
                    TranslateKeyboard.triggers.Add((Key)ActiveConfig.Controls_KB_Xbox_Trigger_Right, TranslateKeyboard.TriggerType.RightTrigger);
                }


                if (ActiveConfig.Controls_KB_Sticks_AXIS_L_Up != 0)
                {
                    TranslateKeyboard.mapLeftStickY.Add((Key)ActiveConfig.Controls_KB_Sticks_AXIS_L_Up, short.MaxValue);
                }
                if (ActiveConfig.Controls_KB_Sticks_AXIS_L_Down != 0)
                {
                    TranslateKeyboard.mapLeftStickY.Add((Key)ActiveConfig.Controls_KB_Sticks_AXIS_L_Down, short.MinValue);
                }
                if (ActiveConfig.Controls_KB_Sticks_AXIS_L_Left != 0)
                {
                    TranslateKeyboard.mapLeftStickX.Add((Key)ActiveConfig.Controls_KB_Sticks_AXIS_L_Left, short.MinValue);
                }
                if (ActiveConfig.Controls_KB_Sticks_AXIS_L_Right != 0)
                {
                    TranslateKeyboard.mapLeftStickX.Add((Key)ActiveConfig.Controls_KB_Sticks_AXIS_L_Right, short.MaxValue);
                }

                if (ActiveConfig.Controls_KB_Sticks_AXIS_R_Up != 0)
                {
                    TranslateKeyboard.mapRightStickY.Add((Key)ActiveConfig.Controls_KB_Sticks_AXIS_R_Up, short.MaxValue);
                }
                if (ActiveConfig.Controls_KB_Sticks_AXIS_R_Down != 0)
                {
                    TranslateKeyboard.mapRightStickY.Add((Key)ActiveConfig.Controls_KB_Sticks_AXIS_R_Down, short.MinValue);
                }
                if (ActiveConfig.Controls_KB_Sticks_AXIS_R_Left != 0)
                {
                    TranslateKeyboard.mapRightStickX.Add((Key)ActiveConfig.Controls_KB_Sticks_AXIS_R_Left, short.MinValue);
                }
                if (ActiveConfig.Controls_KB_Sticks_AXIS_R_Right != 0)
                {
                    TranslateKeyboard.mapRightStickX.Add((Key)ActiveConfig.Controls_KB_Sticks_AXIS_R_Right, short.MaxValue);
                }
            }
        }
示例#7
0
        public static void ReloadControlScheme()
        {
            TranslateKeyboard.ClearAllDicts();

            lock (TranslateKeyboard.buttons)
            {
                TranslateKeyboard.mapRunTimeOptions[RunTimeOptionType.CalibrateDeadZone] = ActiveConfig.Controls_Calibrate_DeadZone == 0 ? null : new RunTimeOption()
                {
                    Key = (Key)ActiveConfig.Controls_Calibrate_DeadZone,
                    Run = TranslateMouse.RunCalibrateDeadZone,
                };

                TranslateKeyboard.mapRunTimeOptions[RunTimeOptionType.FineTuneDeadZone] = ActiveConfig.Controls_Calibrate_FineDeadZone == 0 ? null : new RunTimeOption()
                {
                    Key = (Key)ActiveConfig.Controls_Calibrate_FineDeadZone,
                    Run = TranslateMouse.RunFineTuneDeadZone,
                };

                if (ActiveConfig.Controls_KB_Xbox_A != 0)
                {
                    TranslateKeyboard.buttons.Add((Key)ActiveConfig.Controls_KB_Xbox_A, GamePadControl.A);
                }
                if (ActiveConfig.Controls_KB_Xbox_B != 0)
                {
                    TranslateKeyboard.buttons.Add((Key)ActiveConfig.Controls_KB_Xbox_B, GamePadControl.B);
                }
                if (ActiveConfig.Controls_KB_Xbox_X != 0)
                {
                    TranslateKeyboard.buttons.Add((Key)ActiveConfig.Controls_KB_Xbox_X, GamePadControl.X);
                }
                if (ActiveConfig.Controls_KB_Xbox_Y != 0)
                {
                    TranslateKeyboard.buttons.Add((Key)ActiveConfig.Controls_KB_Xbox_Y, GamePadControl.Y);
                }

                if (ActiveConfig.Controls_KB_Xbox_DPAD_Up != 0)
                {
                    TranslateKeyboard.buttons.Add((Key)ActiveConfig.Controls_KB_Xbox_DPAD_Up, GamePadControl.DPadUp);
                }
                if (ActiveConfig.Controls_KB_Xbox_DPAD_Down != 0)
                {
                    TranslateKeyboard.buttons.Add((Key)ActiveConfig.Controls_KB_Xbox_DPAD_Down, GamePadControl.DPadDown);
                }
                if (ActiveConfig.Controls_KB_Xbox_DPAD_Left != 0)
                {
                    TranslateKeyboard.buttons.Add((Key)ActiveConfig.Controls_KB_Xbox_DPAD_Left, GamePadControl.DPadLeft);
                }
                if (ActiveConfig.Controls_KB_Xbox_DPAD_Right != 0)
                {
                    TranslateKeyboard.buttons.Add((Key)ActiveConfig.Controls_KB_Xbox_DPAD_Right, GamePadControl.DPadRight);
                }

                if (ActiveConfig.Controls_KB_Xbox_Guide != 0)
                {
                    TranslateKeyboard.buttons.Add((Key)ActiveConfig.Controls_KB_Xbox_Guide, GamePadControl.Guide);
                }
                if (ActiveConfig.Controls_KB_Xbox_Start != 0)
                {
                    TranslateKeyboard.buttons.Add((Key)ActiveConfig.Controls_KB_Xbox_Start, GamePadControl.Start);
                }
                if (ActiveConfig.Controls_KB_Xbox_Back != 0)
                {
                    TranslateKeyboard.buttons.Add((Key)ActiveConfig.Controls_KB_Xbox_Back, GamePadControl.Back);
                }

                if (ActiveConfig.Controls_KB_Xbox_LeftBumper != 0)
                {
                    TranslateKeyboard.buttons.Add((Key)ActiveConfig.Controls_KB_Xbox_LeftBumper, GamePadControl.LeftShoulder);
                }
                if (ActiveConfig.Controls_KB_Xbox_RightBumper != 0)
                {
                    TranslateKeyboard.buttons.Add((Key)ActiveConfig.Controls_KB_Xbox_RightBumper, GamePadControl.RightShoulder);
                }

                if (ActiveConfig.Controls_KB_Xbox_Sticks_Left != 0)
                {
                    TranslateKeyboard.buttons.Add((Key)ActiveConfig.Controls_KB_Xbox_Sticks_Left, GamePadControl.LeftStickClick);
                }
                if (ActiveConfig.Controls_KB_Xbox_Sticks_Right != 0)
                {
                    TranslateKeyboard.buttons.Add((Key)ActiveConfig.Controls_KB_Xbox_Sticks_Right, GamePadControl.RightStickClick);
                }

                if (ActiveConfig.Controls_KB_Xbox_Trigger_Left != 0)
                {
                    TranslateKeyboard.triggers.Add((Key)ActiveConfig.Controls_KB_Xbox_Trigger_Left, TranslateKeyboard.TriggerType.LeftTrigger);
                }
                if (ActiveConfig.Controls_KB_Xbox_Trigger_Right != 0)
                {
                    TranslateKeyboard.triggers.Add((Key)ActiveConfig.Controls_KB_Xbox_Trigger_Right, TranslateKeyboard.TriggerType.RightTrigger);
                }


                if (ActiveConfig.Controls_KB_Sticks_AXIS_L_Up != 0)
                {
                    TranslateKeyboard.mapLeftStickY.Add((Key)ActiveConfig.Controls_KB_Sticks_AXIS_L_Up, short.MaxValue);
                }
                if (ActiveConfig.Controls_KB_Sticks_AXIS_L_Down != 0)
                {
                    TranslateKeyboard.mapLeftStickY.Add((Key)ActiveConfig.Controls_KB_Sticks_AXIS_L_Down, short.MinValue);
                }
                if (ActiveConfig.Controls_KB_Sticks_AXIS_L_Left != 0)
                {
                    TranslateKeyboard.mapLeftStickX.Add((Key)ActiveConfig.Controls_KB_Sticks_AXIS_L_Left, short.MinValue);
                }
                if (ActiveConfig.Controls_KB_Sticks_AXIS_L_Right != 0)
                {
                    TranslateKeyboard.mapLeftStickX.Add((Key)ActiveConfig.Controls_KB_Sticks_AXIS_L_Right, short.MaxValue);
                }

                if (ActiveConfig.Controls_KB_Sticks_AXIS_R_Up != 0)
                {
                    TranslateKeyboard.mapRightStickY.Add((Key)ActiveConfig.Controls_KB_Sticks_AXIS_R_Up, short.MaxValue);
                }
                if (ActiveConfig.Controls_KB_Sticks_AXIS_R_Down != 0)
                {
                    TranslateKeyboard.mapRightStickY.Add((Key)ActiveConfig.Controls_KB_Sticks_AXIS_R_Down, short.MinValue);
                }
                if (ActiveConfig.Controls_KB_Sticks_AXIS_R_Left != 0)
                {
                    TranslateKeyboard.mapRightStickX.Add((Key)ActiveConfig.Controls_KB_Sticks_AXIS_R_Left, short.MinValue);
                }
                if (ActiveConfig.Controls_KB_Sticks_AXIS_R_Right != 0)
                {
                    TranslateKeyboard.mapRightStickX.Add((Key)ActiveConfig.Controls_KB_Sticks_AXIS_R_Right, short.MaxValue);
                }


/*                if (!TranslateKeyboard.buttons.ContainsKey(Key.Y))
 *                  TranslateKeyboard.buttons.Add(Key.Y, GamePadControl.Y);
 *              if (!TranslateKeyboard.buttons.ContainsKey(Key.X))
 *                  TranslateKeyboard.buttons.Add(Key.X, GamePadControl.X);
 *              if (!TranslateKeyboard.buttons.ContainsKey(Key.B))
 *                  TranslateKeyboard.buttons.Add(Key.B, GamePadControl.B);
 *              if (!TranslateKeyboard.buttons.ContainsKey(Key.Return))
 *                  TranslateKeyboard.buttons.Add(Key.Return, GamePadControl.A);
 *
 *              if (!TranslateKeyboard.buttons.ContainsKey(Key.LeftCtrl))
 *                  TranslateKeyboard.buttons.Add(Key.LeftCtrl, GamePadControl.RightShoulder);
 *
 *              //TranslateKeyboard.buttons.Add((Key)(int)Key.Y, GamePadControl.Y);
 */
            }
        }