private byte?ModifyAnalog(JoystickButtons joystickButtons, State state)
        {
            switch (joystickButtons.AnalogType)
            {
            case AnalogType.None:
                break;

            case AnalogType.AnalogJoystick:
            {
                return(AnalogHelper.CalculateWheelPosXinput(joystickButtons.XInputButton, state, false, 0, _gameProfile));
            }

            case AnalogType.AnalogJoystickReverse:
            {
                return((byte)~AnalogHelper.CalculateWheelPosXinput(joystickButtons.XInputButton, state, false, 0, _gameProfile));
            }

            case AnalogType.Gas:
            case AnalogType.Brake:
                return(AnalogHelper.CalculateAxisOrTriggerGasBrakeXinput(joystickButtons.XInputButton, state));

            case AnalogType.Wheel:
            {
                var wheelPos = AnalogHelper.CalculateWheelPosXinput(joystickButtons.XInputButton, state, _useSto0Z, _stoozPercent, _gameProfile);
                if (_gameProfile.EmulationProfile == EmulationProfile.TaitoTypeXBattleGear || _gameProfile.EmulationProfile == EmulationProfile.VirtuaRLimit)
                {
                    JvsHelper.StateView.Write(4, wheelPos);
                }

                return(wheelPos);
            }
            }
            return(null);
        }
Esempio n. 2
0
        private byte?ModifyAnalog(JoystickButtons joystickButtons, State state, int index)
        {
            if (joystickButtons.XInputButton?.XInputIndex != index)
            {
                return(null);
            }
            switch (joystickButtons.AnalogType)
            {
            case AnalogType.None:
                break;

            case AnalogType.AnalogJoystick:
            {
                var analogPos = AnalogHelper.CalculateWheelPosXinput(joystickButtons.XInputButton, state, false, 0, _gameProfile);
                if (_gameProfile.EmulationProfile == EmulationProfile.Mballblitz)
                {
                    if (joystickButtons.InputMapping == InputMapping.Analog0)
                    {
                        JvsHelper.StateView.Write(8, analogPos);
                    }
                    if (joystickButtons.InputMapping == InputMapping.Analog2)
                    {
                        JvsHelper.StateView.Write(12, analogPos);
                    }
                }
                return(analogPos);
            }

            case AnalogType.AnalogJoystickReverse:
            {
                return((byte)~AnalogHelper.CalculateWheelPosXinput(joystickButtons.XInputButton, state, false, 0, _gameProfile));
            }

            case AnalogType.Gas:
            case AnalogType.Brake:
                return(AnalogHelper.CalculateAxisOrTriggerGasBrakeXinput(joystickButtons.XInputButton, state));

            case AnalogType.SWThrottle:
                return(AnalogHelper.CalculateSWThrottleXinput(joystickButtons.XInputButton, state));

            case AnalogType.Wheel:
            {
                var wheelPos = AnalogHelper.CalculateWheelPosXinput(joystickButtons.XInputButton, state, _useSto0Z, _stoozPercent, _gameProfile);
                if (_gameProfile.EmulationProfile == EmulationProfile.TaitoTypeXBattleGear || _gameProfile.EmulationProfile == EmulationProfile.VirtuaRLimit)
                {
                    JvsHelper.StateView.Write(4, wheelPos);
                }

                return(wheelPos);
            }
            }
            return(null);
        }