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);
                }
            }
        }
Exemple #2
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);
                                }
                            }
                        }
                    }
                }
            }
        }
Exemple #3
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);
 */
            }
        }