예제 #1
0
파일: ViGEmSink.cs 프로젝트: x3n1ty/Shibari
        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;
            }
        }
예제 #2
0
파일: Ds4.cs 프로젝트: evilC/AHK-ViGEm-Bus
 public void SetAxisState(DualShock4Axes axis, byte state)
 {
     _report.SetAxis(axis, state);
 }