Esempio n. 1
0
        protected void OnInputReport(IInputReport report)
        {
            if (report == null)
            {
                return;
            }

            InputReportReceived?.Invoke(this, new InputReportEventArgs(report));
        }
Esempio n. 2
0
        protected void OnInputReport(IInputReport report)
        {
            if (report == null)
            {
                return;
            }

            // Pull battery state from report
            DualShock3InputReport ds3_report = (DualShock3InputReport)report;

            BatteryState = ds3_report.BatteryState;

            InputReportReceived?.Invoke(this, new InputReportEventArgs(report));
        }
Esempio n. 3
0
        public void InputReportReceived(IDualShockDevice device, IInputReport report)
        {
            _target.ResetReport(); //This may be able to be optimized, look into later...

            // Convert report to DS3 format and store latest report for this device
            var ds3Report = (DualShock3InputReport)report;

            if (device.DeviceIndex == 0)
            {
                _Nav0Report = ds3Report;
            }
            if (device.DeviceIndex == 1)
            {
                _Nav1Report = ds3Report;
            }

            // Only combine reports and submit if we've seen input from each controller at least once
            if (_Nav0Report != null && _Nav1Report != null)
            {
                // Map buttons from Navigation #1 into input report
                _target.SetAxisValue(Xbox360Axis.LeftThumbX, Scale(_Nav0Report[DualShock3Axes.LeftThumbX], false));
                _target.SetAxisValue(Xbox360Axis.LeftThumbY, Scale(_Nav0Report[DualShock3Axes.LeftThumbY], true));
                _target.SetAxisValue(Xbox360Axis.RightThumbX, Scale(_Nav1Report[DualShock3Axes.LeftThumbX], false));
                _target.SetAxisValue(Xbox360Axis.RightThumbY, Scale(_Nav1Report[DualShock3Axes.LeftThumbY], true));

                _target.SetSliderValue(Xbox360Slider.LeftTrigger, _Nav0Report[DualShock3Axes.LeftTrigger]);
                _target.SetSliderValue(Xbox360Slider.RightTrigger, _Nav1Report[DualShock3Axes.LeftTrigger]);

                foreach (var button in _btnMap0.Where(m => _Nav0Report.EngagedButtons.Contains(m.Key))
                         .Select(m => m.Value))
                {
                    _target.SetButtonState(button, true);
                }

                foreach (var button in _btnMap1.Where(m => _Nav1Report.EngagedButtons.Contains(m.Key))
                         .Select(m => m.Value))
                {
                    _target.SetButtonState(button, true);
                }

                _target.SubmitReport();
            }
        }
Esempio n. 4
0
        public void InputReportReceived(IDualShockDevice device, IInputReport report)
        {
            switch (device.DeviceType)
            {
            case DualShockDeviceType.DualShock3:

                var ds3Report = (DualShock3InputReport)report;

                if (ds3Report.BatteryState != status)
                {
                    Log.Information("Battery status for device #{0}: {1}", device, ds3Report.BatteryState);
                    status = ds3Report.BatteryState;
                }

                break;

            default:
                Log.Information("Break");
                break;
            }
        }
Esempio n. 5
0
        public void InputReportReceived(IDualShockDevice device, IInputReport report)
        {
            switch (device.DeviceType)
            {
            case DualShockDeviceType.DualShock3:

                var target = _deviceMap[device];
                target.ResetReport();

                var ds3Report = (DualShock3InputReport)report;

                foreach (var axis in _XaxisMap)
                {
                    target.SetAxisValue(axis.Value, Scale(ds3Report[axis.Key], false));
                }

                foreach (var axis in _YaxisMap)
                {
                    target.SetAxisValue(axis.Value, Scale(ds3Report[axis.Key], true));
                }

                foreach (var axis in _triggerAxisMap)
                {
                    target.SetSliderValue(axis.Value, ds3Report[axis.Key]);
                }

                foreach (var button in _btnMap.Where(m => ds3Report.EngagedButtons.Contains(m.Key))
                         .Select(m => m.Value))
                {
                    target.SetButtonState(button, true);
                }

                target.SubmitReport();

                break;
            }
        }
Esempio n. 6
0
 public InputReportReceivedEventArgs(IDualShockDevice device, IInputReport report)
 {
     Device = device;
     Report = report;
 }
Esempio n. 7
0
 public InputReportEventArgs(IInputReport report)
 {
     Report = report;
 }
Esempio n. 8
0
 protected void OnInputReportReceived(IDualShockDevice sender, IInputReport report)
 {
     InputReportReceived?.Invoke(this,
                                 new InputReportReceivedEventArgs(sender, report));
 }
Esempio n. 9
0
 protected void OnInputReport(IInputReport report)
 {
     InputReportReceived?.Invoke(this, new InputReportEventArgs(report));
 }
Esempio n. 10
0
        public void InputReportReceived(IDualShockDevice device, IInputReport report)
        {
            switch (device.DeviceType)
            {
            case DualShockDeviceType.DualShock3:

                var target = _deviceMap[device];

                var ds3Report = (DualShock3InputReport)report;
                var ds4Report = new DualShock4Report();

                ds4Report.SetAxis(DualShock4Axes.LeftThumbX, ds3Report[DualShock3Axes.LeftThumbX]);
                ds4Report.SetAxis(DualShock4Axes.LeftThumbY, ds3Report[DualShock3Axes.LeftThumbY]);
                ds4Report.SetAxis(DualShock4Axes.RightThumbX, ds3Report[DualShock3Axes.RightThumbX]);
                ds4Report.SetAxis(DualShock4Axes.RightThumbY, ds3Report[DualShock3Axes.RightThumbY]);
                ds4Report.SetAxis(DualShock4Axes.LeftTrigger, ds3Report[DualShock3Axes.LeftTrigger]);
                ds4Report.SetAxis(DualShock4Axes.RightTrigger, ds3Report[DualShock3Axes.RightTrigger]);

                ds4Report.SetButtons(_btnMap.Where(m => ds3Report.EngagedButtons.Contains(m.Key))
                                     .Select(m => m.Value).ToArray());

                if (ds3Report.EngagedButtons.Contains(DualShock3Buttons.DPadUp))
                {
                    ds4Report.SetDPad(DualShock4DPadValues.North);
                }
                if (ds3Report.EngagedButtons.Contains(DualShock3Buttons.DPadRight))
                {
                    ds4Report.SetDPad(DualShock4DPadValues.East);
                }
                if (ds3Report.EngagedButtons.Contains(DualShock3Buttons.DPadDown))
                {
                    ds4Report.SetDPad(DualShock4DPadValues.South);
                }
                if (ds3Report.EngagedButtons.Contains(DualShock3Buttons.DPadLeft))
                {
                    ds4Report.SetDPad(DualShock4DPadValues.West);
                }

                if (ds3Report.EngagedButtons.Contains(DualShock3Buttons.DPadUp) &&
                    ds3Report.EngagedButtons.Contains(DualShock3Buttons.DPadRight))
                {
                    ds4Report.SetDPad(DualShock4DPadValues.Northeast);
                }
                if (ds3Report.EngagedButtons.Contains(DualShock3Buttons.DPadRight) &&
                    ds3Report.EngagedButtons.Contains(DualShock3Buttons.DPadDown))
                {
                    ds4Report.SetDPad(DualShock4DPadValues.Southeast);
                }
                if (ds3Report.EngagedButtons.Contains(DualShock3Buttons.DPadDown) &&
                    ds3Report.EngagedButtons.Contains(DualShock3Buttons.DPadLeft))
                {
                    ds4Report.SetDPad(DualShock4DPadValues.Southwest);
                }
                if (ds3Report.EngagedButtons.Contains(DualShock3Buttons.DPadLeft) &&
                    ds3Report.EngagedButtons.Contains(DualShock3Buttons.DPadUp))
                {
                    ds4Report.SetDPad(DualShock4DPadValues.Northwest);
                }

                if (ds3Report.EngagedButtons.Contains(DualShock3Buttons.Ps))
                {
                    ds4Report.SetSpecialButtons(DualShock4SpecialButtons.Ps);
                }

                target.SendReport(ds4Report);

                break;
            }
        }
Esempio n. 11
0
        public void InputReportReceived(IDualShockDevice device, IInputReport report)
        {
            switch (device.DeviceType)
            {
            case DualShockDeviceType.DualShock3:

                var target = _deviceMap[device];
                target.ResetReport();

                var ds3Report = (DualShock3InputReport)report;

                foreach (var axis in _XaxisMap)
                {
                    target.SetAxisValue(axis.Value, ds3Report[axis.Key]);
                }

                foreach (var axis in _YaxisMap)
                {
                    target.SetAxisValue(axis.Value, ds3Report[axis.Key]);
                }

                foreach (var axis in _triggerAxisMap)
                {
                    target.SetSliderValue(axis.Value, ds3Report[axis.Key]);
                }

                foreach (var button in _btnMap.Where(m => ds3Report.EngagedButtons.Contains(m.Key))
                         .Select(m => m.Value))
                {
                    target.SetButtonState(button, true);
                }

                if (ds3Report.EngagedButtons.Contains(DualShock3Buttons.DPadUp))
                {
                    target.SetDPadDirection(DualShock4DPadDirection.North);
                }
                if (ds3Report.EngagedButtons.Contains(DualShock3Buttons.DPadRight))
                {
                    target.SetDPadDirection(DualShock4DPadDirection.East);
                }
                if (ds3Report.EngagedButtons.Contains(DualShock3Buttons.DPadDown))
                {
                    target.SetDPadDirection(DualShock4DPadDirection.South);
                }
                if (ds3Report.EngagedButtons.Contains(DualShock3Buttons.DPadLeft))
                {
                    target.SetDPadDirection(DualShock4DPadDirection.West);
                }

                if (ds3Report.EngagedButtons.Contains(DualShock3Buttons.DPadUp) &&
                    ds3Report.EngagedButtons.Contains(DualShock3Buttons.DPadRight))
                {
                    target.SetDPadDirection(DualShock4DPadDirection.Northeast);
                }
                if (ds3Report.EngagedButtons.Contains(DualShock3Buttons.DPadRight) &&
                    ds3Report.EngagedButtons.Contains(DualShock3Buttons.DPadDown))
                {
                    target.SetDPadDirection(DualShock4DPadDirection.Southeast);
                }
                if (ds3Report.EngagedButtons.Contains(DualShock3Buttons.DPadDown) &&
                    ds3Report.EngagedButtons.Contains(DualShock3Buttons.DPadLeft))
                {
                    target.SetDPadDirection(DualShock4DPadDirection.Southwest);
                }
                if (ds3Report.EngagedButtons.Contains(DualShock3Buttons.DPadLeft) &&
                    ds3Report.EngagedButtons.Contains(DualShock3Buttons.DPadUp))
                {
                    target.SetDPadDirection(DualShock4DPadDirection.Northwest);
                }

                target.SubmitReport();

                break;
            }
        }