Ejemplo n.º 1
0
 public DS4StateExposed()
 {
     _state = new DS4State();
 }
Ejemplo n.º 2
0
 public DS4StateExposed(DS4State state)
 {
     _state = state;
 }
Ejemplo n.º 3
0
 public DS4StateExposed()
 {
     _state = new DS4State();
 }
Ejemplo n.º 4
0
 public DS4StateExposed(DS4State state)
 {
     _state = state;
 }
Ejemplo n.º 5
0
        public void Parse(DS4State state, Byte[] Output, int device)
        {
            Output[0] = 0x1C;
            Output[4] = (Byte)(device + firstController);
            Output[9] = 0x14;

            for (int i = 10; i < Output.Length; i++)
            {
                Output[i] = 0;
            }
            if (state.Share)
            {
                Output[10] |= (Byte)(1 << 5);              // Back
            }
            if (state.L3)
            {
                Output[10] |= (Byte)(1 << 6);           // Left  Thumb
            }
            if (state.R3)
            {
                Output[10] |= (Byte)(1 << 7);           // Right Thumb
            }
            if (state.Options)
            {
                Output[10] |= (Byte)(1 << 4);                // Start
            }
            if (state.DpadUp)
            {
                Output[10] |= (Byte)(1 << 0);               // Up
            }
            if (state.DpadRight)
            {
                Output[10] |= (Byte)(1 << 3);                  // Down
            }
            if (state.DpadDown)
            {
                Output[10] |= (Byte)(1 << 1);                 // Right
            }
            if (state.DpadLeft)
            {
                Output[10] |= (Byte)(1 << 2);                 // Left
            }
            if (state.L1)
            {
                Output[11] |= (Byte)(1 << 0);           // Left  Shoulder
            }
            if (state.R1)
            {
                Output[11] |= (Byte)(1 << 1);           // Right Shoulder
            }
            if (state.Triangle)
            {
                Output[11] |= (Byte)(1 << 7);                 // Y
            }
            if (state.Circle)
            {
                Output[11] |= (Byte)(1 << 5);               // B
            }
            if (state.Cross)
            {
                Output[11] |= (Byte)(1 << 4);              // A
            }
            if (state.Square)
            {
                Output[11] |= (Byte)(1 << 6);               // X
            }
            if (state.PS)
            {
                Output[11] |= (Byte)(1 << 2); // Guide
            }
            Output[12] = state.L2;            // Left Trigger
            Output[13] = state.R2;            // Right Trigger

            Int32 ThumbLX = Scale(state.LX, false);
            Int32 ThumbLY = -Scale(state.LY, false);
            Int32 ThumbRX = Scale(state.RX, false);
            Int32 ThumbRY = -Scale(state.RY, false);

            Output[14] = (Byte)((ThumbLX >> 0) & 0xFF); // LX
            Output[15] = (Byte)((ThumbLX >> 8) & 0xFF);
            Output[16] = (Byte)((ThumbLY >> 0) & 0xFF); // LY
            Output[17] = (Byte)((ThumbLY >> 8) & 0xFF);
            Output[18] = (Byte)((ThumbRX >> 0) & 0xFF); // RX
            Output[19] = (Byte)((ThumbRX >> 8) & 0xFF);
            Output[20] = (Byte)((ThumbRY >> 0) & 0xFF); // RY
            Output[21] = (Byte)((ThumbRY >> 8) & 0xFF);
        }
Ejemplo n.º 6
0
        public void PopulateFieldMapping(DS4State cState, DS4StateExposed exposeState, Mouse tp, bool priorMouse = false)
        {
            unchecked
            {
                axisdirs[(int)DS4Controls.LXNeg]   = cState.LX;
                axisdirs[(int)DS4Controls.LXPos]   = cState.LX;
                axisdirs[(int)DS4Controls.LYNeg]   = cState.LY;
                axisdirs[(int)DS4Controls.LYPos]   = cState.LY;
                triggers[(int)DS4Controls.LSOuter] = cState.OutputLSOuter;

                axisdirs[(int)DS4Controls.RXNeg]   = cState.RX;
                axisdirs[(int)DS4Controls.RXPos]   = cState.RX;
                axisdirs[(int)DS4Controls.RYNeg]   = cState.RY;
                axisdirs[(int)DS4Controls.RYPos]   = cState.RY;
                triggers[(int)DS4Controls.RSOuter] = cState.OutputRSOuter;

                triggers[(int)DS4Controls.L2] = cState.L2;
                triggers[(int)DS4Controls.R2] = cState.R2;

                buttons[(int)DS4Controls.L1]         = cState.L1;
                buttons[(int)DS4Controls.L2FullPull] = cState.L2 == 255;
                buttons[(int)DS4Controls.L3]         = cState.L3;
                buttons[(int)DS4Controls.R1]         = cState.R1;
                buttons[(int)DS4Controls.R2FullPull] = cState.R2 == 255;
                buttons[(int)DS4Controls.R3]         = cState.R3;

                buttons[(int)DS4Controls.Cross]    = cState.Cross;
                buttons[(int)DS4Controls.Triangle] = cState.Triangle;
                buttons[(int)DS4Controls.Circle]   = cState.Circle;
                buttons[(int)DS4Controls.Square]   = cState.Square;
                buttons[(int)DS4Controls.PS]       = cState.PS;
                buttons[(int)DS4Controls.Options]  = cState.Options;
                buttons[(int)DS4Controls.Share]    = cState.Share;
                buttons[(int)DS4Controls.Mute]     = cState.Mute;
                buttons[(int)DS4Controls.Capture]  = cState.Capture;
                buttons[(int)DS4Controls.SideL]    = cState.SideL;
                buttons[(int)DS4Controls.SideR]    = cState.SideR;

                buttons[(int)DS4Controls.DpadUp]    = cState.DpadUp;
                buttons[(int)DS4Controls.DpadRight] = cState.DpadRight;
                buttons[(int)DS4Controls.DpadDown]  = cState.DpadDown;
                buttons[(int)DS4Controls.DpadLeft]  = cState.DpadLeft;

                buttons[(int)DS4Controls.TouchLeft]  = tp != null ? (!priorMouse ? tp.leftDown : tp.priorLeftDown) : false;
                buttons[(int)DS4Controls.TouchRight] = tp != null ? (!priorMouse ? tp.rightDown : tp.priorRightDown) : false;
                buttons[(int)DS4Controls.TouchUpper] = tp != null ? (!priorMouse ? tp.upperDown : tp.priorUpperDown) : false;
                buttons[(int)DS4Controls.TouchMulti] = tp != null ? (!priorMouse ? tp.multiDown : tp.priorMultiDown) : false;

                int sixAxisX = -exposeState.getOutputAccelX();
                gryodirs[(int)DS4Controls.GyroXPos] = sixAxisX > 0 ? sixAxisX : 0;
                gryodirs[(int)DS4Controls.GyroXNeg] = sixAxisX < 0 ? sixAxisX : 0;

                int sixAxisZ = exposeState.getOutputAccelZ();
                gryodirs[(int)DS4Controls.GyroZPos] = sixAxisZ > 0 ? sixAxisZ : 0;
                gryodirs[(int)DS4Controls.GyroZNeg] = sixAxisZ < 0 ? sixAxisZ : 0;

                swipedirs[(int)DS4Controls.SwipeLeft]  = tp != null ? (!priorMouse ? tp.swipeLeftB : tp.priorSwipeLeftB) : (byte)0;
                swipedirs[(int)DS4Controls.SwipeRight] = tp != null ? (!priorMouse ? tp.swipeRightB : tp.priorSwipeRightB) : (byte)0;
                swipedirs[(int)DS4Controls.SwipeUp]    = tp != null ? (!priorMouse ? tp.swipeUpB : tp.priorSwipeUpB) : (byte)0;
                swipedirs[(int)DS4Controls.SwipeDown]  = tp != null ? (!priorMouse ? tp.swipeDownB : tp.priorSwipeDownB) : (byte)0;

                swipedirbools[(int)DS4Controls.SwipeLeft]  = tp != null ? (!priorMouse ? tp.swipeLeft : tp.priorSwipeLeft) : false;
                swipedirbools[(int)DS4Controls.SwipeRight] = tp != null ? (!priorMouse ? tp.swipeRight : tp.priorSwipeRight) : false;
                swipedirbools[(int)DS4Controls.SwipeUp]    = tp != null ? (!priorMouse ? tp.swipeUp : tp.priorSwipeUp) : false;
                swipedirbools[(int)DS4Controls.SwipeDown]  = tp != null ? (!priorMouse ? tp.swipeDown : tp.priorSwipeDown) : false;

                buttons[(int)DS4Controls.GyroSwipeLeft]  = tp != null ? tp.gyroSwipe.swipeLeft : false;
                buttons[(int)DS4Controls.GyroSwipeRight] = tp != null ? tp.gyroSwipe.swipeRight : false;
                buttons[(int)DS4Controls.GyroSwipeUp]    = tp != null ? tp.gyroSwipe.swipeUp : false;
                buttons[(int)DS4Controls.GyroSwipeDown]  = tp != null ? tp.gyroSwipe.swipeDown : false;

                touchButton       = cState.TouchButton;
                outputTouchButton = cState.OutputTouchButton;
            }
        }
Ejemplo n.º 7
0
 public DS4StateFieldMapping(DS4State cState, DS4StateExposed exposeState, Mouse tp, bool priorMouse = false)
 {
     PopulateFieldMapping(cState, exposeState, tp, priorMouse);
 }