public void LoadNewSettings(GameProfile gameProfile, ListBoxItem comboItem)
        {
            _gameProfile            = gameProfile;
            _comboItem              = comboItem;
            _isKeyboardorButtonAxis = gameProfile.ConfigValues.Any(x => x.FieldName == "Use Keyboard/Button For Axis" && x.FieldValue == "1");
            _RelativeAxis           = gameProfile.ConfigValues.Any(x => x.FieldName == "Use Relative Input" && x.FieldValue == "1");

            string inputApiString = _gameProfile.ConfigValues.Find(cv => cv.FieldName == "Input API")?.FieldValue;

            if (inputApiString != null)
            {
                _inputApi = (InputApi)Enum.Parse(typeof(InputApi), inputApiString);
            }

            // Hack
            foreach (var t in gameProfile.JoystickButtons)
            {
                if (_inputApi == InputApi.DirectInput)
                {
                    t.BindName = t.BindNameDi;
                }
                else if (_inputApi == InputApi.XInput)
                {
                    t.BindName = t.BindNameXi;
                }
                else if (_inputApi == InputApi.RawInput)
                {
                    t.BindName = t.BindNameRi;
                }
            }

            JoystickMappingItems.ItemsSource = gameProfile.JoystickButtons;
            if (_joystickControlRawInput == null)
            {
                _joystickControlRawInput = new JoystickControlRawInput();
            }
            if (_joystickControlXInput == null)
            {
                _joystickControlXInput = new JoystickControlXInput();
            }
            if (_joystickControlDirectInput == null)
            {
                _joystickControlDirectInput = new JoystickControlDirectInput();
            }
        }
        public void LoadNewSettings(GameProfile gameProfile, ListBoxItem comboItem)
        {
            _gameProfile = gameProfile;
            _comboItem   = comboItem;
            _isXinput    = gameProfile.ConfigValues.Any(x => x.FieldName == "XInput" && x.FieldValue == "1");

            // Hack
            foreach (var t in gameProfile.JoystickButtons)
            {
                t.BindName = _isXinput ? t.BindNameXi : t.BindNameDi;
            }

            JoystickMappingItems.ItemsSource = gameProfile.JoystickButtons;
            if (_joystickControlXInput == null)
            {
                _joystickControlXInput = new JoystickControlXInput();
            }
            if (_joystickControlDirectInput == null)
            {
                _joystickControlDirectInput = new JoystickControlDirectInput();
            }
        }
        public void LoadNewSettings(GameProfile gameProfile, ComboBoxItem comboItem, ParrotData parrotData)
        {
            _gameProfile = gameProfile;
            _comboItem   = comboItem;
            _isXinput    = parrotData.XInputMode;

            // Hack
            foreach (var t in gameProfile.JoystickButtons)
            {
                t.BindName = _isXinput ? t.BindNameXi : t.BindNameDi;
            }

            JoystickMappingItems.ItemsSource = gameProfile.JoystickButtons;
            if (_joystickControlXInput == null)
            {
                _joystickControlXInput = new JoystickControlXInput();
            }
            if (_joystickControlDirectInput == null)
            {
                _joystickControlDirectInput = new JoystickControlDirectInput();
            }
        }
        public void LoadNewSettings(GameProfile gameProfile, ListBoxItem comboItem)
        {
            _gameProfile            = gameProfile;
            _comboItem              = comboItem;
            _isXinput               = gameProfile.ConfigValues.Any(x => x.FieldName == "XInput" && x.FieldValue == "1");
            _isKeyboardorButtonAxis = gameProfile.ConfigValues.Any(x => x.FieldName == "Use Keyboard/Button For Axis" && x.FieldValue == "1");

            // Hack
            foreach (var t in gameProfile.JoystickButtons)
            {
                t.BindName = _isXinput ? t.BindNameXi : t.BindNameDi;
                if ((_isKeyboardorButtonAxis) && (!_isXinput))
                {
                    //Wheel Axis Right (Keyboard/Button Only) = " "
                    //Joystick Analog X Right (Keyboard/Button Only) = "   "
                    //Joystick Analog Y Up (Keyboard/Button Only) = "    "
                    //Analog X Right (Keyboard/Button Only) = "     "
                    //Analog Y Down (Keyboard/Button Only) = "      "
                    //Throttle Brake (Keyboard/Button Only) = "       "
                    //Wheel Axis Half Turn (Hold Down) = "        "
                    if (t.ButtonName.Equals("Wheel Axis"))
                    {
                        t.ButtonName = "Wheel Axis Left";
                    }
                    if (t.ButtonName.Equals(" "))
                    {
                        t.ButtonName = "Wheel Axis Right (Keyboard/Button Only)";
                    }
                    if (t.ButtonName.Equals("  "))
                    {
                        t.ButtonName = "Joystick Analog X Right (Keyboard/Button Only)";
                    }
                    if (t.ButtonName.Equals("   "))
                    {
                        t.ButtonName = "Joystick Analog Y Up (Keyboard/Button Only)";
                    }
                    if (t.ButtonName.Equals("    "))
                    {
                        t.ButtonName = "Analog X Right (Keyboard/Button Only)";
                    }
                    if (t.ButtonName.Equals("     "))
                    {
                        t.ButtonName = "Analog Y Down (Keyboard/Button Only)";
                    }
                    if (t.ButtonName.Equals("      "))
                    {
                        t.ButtonName = "Throttle Brake (Keyboard/Button Only)";
                    }
                    if (t.ButtonName.Equals("       "))
                    {
                        t.ButtonName = "Wheel Axis Half Turn (Hold Down)";
                    }
                    if (_gameProfile.EmulationProfile == EmulationProfile.NamcoMachStorm)
                    {
                        if (t.ButtonName.Equals("Analog X"))
                        {
                            t.ButtonName = "Analog X Left";
                        }
                        if (t.ButtonName.Equals("Analog Y"))
                        {
                            t.ButtonName = "Analog Y Up";
                        }
                    }
                    if (_gameProfile.EmulationProfile == EmulationProfile.AfterBurnerClimax)
                    {
                        if (t.ButtonName.Equals("Joystick Analog X"))
                        {
                            t.ButtonName = "Joystick Analog X Left";
                        }
                        if (t.ButtonName.Equals("Joystick Analog Y"))
                        {
                            t.ButtonName = "Joystick Analog Y Down";
                        }
                    }
                    if (_gameProfile.EmulationProfile == EmulationProfile.TokyoCop)
                    {
                        if (t.ButtonName.Equals("Leaning Axis"))
                        {
                            t.ButtonName = "Leaning Axis Left";
                        }
                        if (t.ButtonName.Equals("Handlebar Axis"))
                        {
                            t.ButtonName = "Handlebar Axis Left";
                        }
                    }
                }
                else
                {
                    if ((t.ButtonName.Equals(" ")) || (t.ButtonName.Equals("  ")) || (t.ButtonName.Equals("   ")) || (t.ButtonName.Equals("    ")) || (t.ButtonName.Equals("     ")) || (t.ButtonName.Equals("      ")) || (t.ButtonName.Equals("       ")))
                    {
                        t.BindName = "Hide";
                    }
                    if (t.ButtonName.Equals("Wheel Axis Right (Keyboard/Button Only)"))
                    {
                        t.ButtonName = " ";
                        t.BindName   = "Hide";
                    }
                    if (t.ButtonName.Equals("Joystick Analog X Right (Keyboard/Button Only)"))
                    {
                        t.ButtonName = "  ";
                        t.BindName   = "Hide";
                    }
                    if (t.ButtonName.Equals("Joystick Analog Y Up (Keyboard/Button Only)"))
                    {
                        t.ButtonName = "   ";
                        t.BindName   = "Hide";
                    }
                    if (t.ButtonName.Equals("Analog X Right (Keyboard/Button Only)"))
                    {
                        t.ButtonName = "    ";
                        t.BindName   = "Hide";
                    }
                    if (t.ButtonName.Equals("Analog Y Down (Keyboard/Button Only)"))
                    {
                        t.ButtonName = "     ";
                        t.BindName   = "Hide";
                    }
                    if (t.ButtonName.Equals("Throttle Brake (Keyboard/Button Only)"))
                    {
                        t.ButtonName = "      ";
                        t.BindName   = "Hide";
                    }
                    if (t.ButtonName.Equals("Wheel Axis Half Turn (Hold Down)"))
                    {
                        t.ButtonName = "       ";
                        t.BindName   = "Hide";
                    }
                    if (t.ButtonName.Equals("Wheel Axis Left"))
                    {
                        t.ButtonName = "Wheel Axis";
                    }
                    if (_gameProfile.EmulationProfile == EmulationProfile.NamcoMachStorm)
                    {
                        if (t.ButtonName.Equals("Analog X Left"))
                        {
                            t.ButtonName = "Analog X";
                        }
                        if (t.ButtonName.Equals("Analog Y Up"))
                        {
                            t.ButtonName = "Analog Y";
                        }
                    }
                    if (_gameProfile.EmulationProfile == EmulationProfile.AfterBurnerClimax)
                    {
                        if (t.ButtonName.Equals("Joystick Analog X Left"))
                        {
                            t.ButtonName = "Joystick Analog X";
                        }
                        if (t.ButtonName.Equals("Joystick Analog Y Down"))
                        {
                            t.ButtonName = "Joystick Analog Y";
                        }
                    }
                    if (_gameProfile.EmulationProfile == EmulationProfile.TokyoCop)
                    {
                        if (t.ButtonName.Equals("Leaning Axis Left"))
                        {
                            t.ButtonName = "Leaning Axis";
                        }
                        if (t.ButtonName.Equals("Handlebar Axis Left"))
                        {
                            t.ButtonName = "Handlebar Axis";
                        }
                    }
                }
            }

            JoystickMappingItems.ItemsSource = gameProfile.JoystickButtons;
            if (_joystickControlXInput == null)
            {
                _joystickControlXInput = new JoystickControlXInput();
            }
            if (_joystickControlDirectInput == null)
            {
                _joystickControlDirectInput = new JoystickControlDirectInput();
            }
        }
        public void LoadNewSettings(GameProfile gameProfile, ListBoxItem comboItem)
        {
            _gameProfile            = gameProfile;
            _comboItem              = comboItem;
            _isKeyboardorButtonAxis = gameProfile.ConfigValues.Any(x => x.FieldName == "Use Keyboard/Button For Axis" && x.FieldValue == "1");
            _RelativeAxis           = gameProfile.ConfigValues.Any(x => x.FieldName == "Use Relative Input" && x.FieldValue == "1");
            _BG4ProMode             = gameProfile.ConfigValues.Any(x => x.FieldName == "Professional Edition Enable" && x.FieldValue == "1");

            string UseDPadForGUN1Stick_String = _gameProfile.ConfigValues.Find(cv => cv.FieldName == "GUN1StickAxisInputStyle")?.FieldValue;

            if (UseDPadForGUN1Stick_String == "UseDPadForGUN1Stick")
            {
                _UseDPadForGUN1Stick = true;
            }
            else
            {
                _UseDPadForGUN1Stick = false;
            }
            string UseDPadForGUN2Stick_String = _gameProfile.ConfigValues.Find(cv => cv.FieldName == "GUN2StickAxisInputStyle")?.FieldValue;

            if (UseDPadForGUN2Stick_String == "UseDPadForGUN2Stick")
            {
                _UseDPadForGUN2Stick = true;
            }
            else
            {
                _UseDPadForGUN2Stick = false;
            }
            string UseAnalogAxisToAimGUN1_String = _gameProfile.ConfigValues.Find(cv => cv.FieldName == "GUN1AimingInputStyle")?.FieldValue;

            if (UseAnalogAxisToAimGUN1_String == "UseAnalogAxisToAim")
            {
                _UseAnalogAxisToAimGUN1 = true;
            }
            else
            {
                _UseAnalogAxisToAimGUN1 = false;
            }
            string UseAnalogAxisToAimGUN2_String = _gameProfile.ConfigValues.Find(cv => cv.FieldName == "GUN2AimingInputStyle")?.FieldValue;

            if (UseAnalogAxisToAimGUN2_String == "UseAnalogAxisToAim")
            {
                _UseAnalogAxisToAimGUN2 = true;
            }
            else
            {
                _UseAnalogAxisToAimGUN2 = false;
            }

            string inputApiString = _gameProfile.ConfigValues.Find(cv => cv.FieldName == "Input API")?.FieldValue;

            if (inputApiString != null)
            {
                _inputApi = (InputApi)Enum.Parse(typeof(InputApi), inputApiString);
            }

            // Hack
            foreach (var t in gameProfile.JoystickButtons)
            {
                if (_inputApi == InputApi.DirectInput)
                {
                    t.BindName = t.BindNameDi;
                }
                else if (_inputApi == InputApi.XInput)
                {
                    t.BindName = t.BindNameXi;
                }
                else if (_inputApi == InputApi.RawInput)
                {
                    t.BindName = t.BindNameRi;
                }
            }

            JoystickMappingItems.ItemsSource = gameProfile.JoystickButtons;
            if (_joystickControlRawInput == null)
            {
                _joystickControlRawInput = new JoystickControlRawInput();
            }
            if (_joystickControlXInput == null)
            {
                _joystickControlXInput = new JoystickControlXInput();
            }
            if (_joystickControlDirectInput == null)
            {
                _joystickControlDirectInput = new JoystickControlDirectInput();
            }
        }