示例#1
0
 public VGState(VGState state)
 {
     ReportTimeStamp = state.ReportTimeStamp;
     Square          = state.Square;
     Triangle        = state.Triangle;
     Circle          = state.Circle;
     Cross           = state.Cross;
     DpadUp          = state.DpadUp;
     DpadDown        = state.DpadDown;
     DpadLeft        = state.DpadLeft;
     DpadRight       = state.DpadRight;
     L1                 = state.L1;
     L2                 = state.L2;
     L3                 = state.L3;
     R1                 = state.R1;
     R2                 = state.R2;
     R3                 = state.R3;
     Share              = state.Share;
     Options            = state.Options;
     PS                 = state.PS;
     Touch1             = state.Touch1;
     TouchRight         = state.TouchRight;
     TouchLeft          = state.TouchLeft;
     Touch1Identifier   = state.Touch1Identifier;
     Touch2             = state.Touch2;
     Touch2Identifier   = state.Touch2Identifier;
     TouchButton        = state.TouchButton;
     TouchPacketCounter = state.TouchPacketCounter;
     LX                 = state.LX;
     RX                 = state.RX;
     LY                 = state.LY;
     RY                 = state.RY;
     FrameCounter       = state.FrameCounter;
     Battery            = state.Battery;
 }
示例#2
0
 public void CopyTo(VGState state)
 {
     state.ReportTimeStamp = ReportTimeStamp;
     state.Square          = Square;
     state.Triangle        = Triangle;
     state.Circle          = Circle;
     state.Cross           = Cross;
     state.DpadUp          = DpadUp;
     state.DpadDown        = DpadDown;
     state.DpadLeft        = DpadLeft;
     state.DpadRight       = DpadRight;
     state.L1                 = L1;
     state.L2                 = L2;
     state.L3                 = L3;
     state.R1                 = R1;
     state.R2                 = R2;
     state.R3                 = R3;
     state.Share              = Share;
     state.Options            = Options;
     state.PS                 = PS;
     state.Touch1             = Touch1;
     state.Touch1Identifier   = Touch1Identifier;
     state.Touch2             = Touch2;
     state.Touch2Identifier   = Touch2Identifier;
     state.TouchLeft          = TouchLeft;
     state.TouchRight         = TouchRight;
     state.TouchButton        = TouchButton;
     state.TouchPacketCounter = TouchPacketCounter;
     state.LX                 = LX;
     state.RX                 = RX;
     state.LY                 = LY;
     state.RY                 = RY;
     state.FrameCounter       = FrameCounter;
     state.Battery            = Battery;
 }
示例#3
0
        public void handleSixaxis(byte[] gyro, byte[] accel, VGState state)
        {
            //bool touchPadIsDown = sensors.TouchButton;

            /*if (!PacketChanged(data, touchPacketOffset) && touchPadIsDown == lastTouchPadIsDown)
             * {
             *  if (SixAxisUnchanged != null)
             *      SixAxisUnchanged(this, EventArgs.Empty);
             *  return;
             * }*/
            /* byte touchID1 = (byte)(data[0 + TOUCHPAD_DATA_OFFSET + touchPacketOffset] & 0x7F);
             * byte touchID2 = (byte)(data[4 + TOUCHPAD_DATA_OFFSET + touchPacketOffset] & 0x7F);*/
            int currentX = (short)((ushort)(gyro[0] << 8) | gyro[1]) / 64;
            int currentY = (short)((ushort)(gyro[2] << 8) | gyro[3]) / 64;
            int currentZ = (short)((ushort)(gyro[4] << 8) | gyro[5]) / 64;
            int AccelX   = (short)((ushort)(accel[2] << 8) | accel[3]) / 256;
            int AccelY   = (short)((ushort)(accel[0] << 8) | accel[1]) / 256;
            int AccelZ   = (short)((ushort)(accel[4] << 8) | accel[5]) / 256;
            SixAxisEventArgs args;

            //if (sensors.Touch1 || sensors.Touch2)
            {
                /* if (SixAxisMoved != null)
                 * {
                 *   SixAxis sPrev, now;
                 *   sPrev = new SixAxis(lastGyroX, lastGyroY, lastGyroZ, lastAX,lastAY,lastAZ);
                 *   now = new SixAxis(currentX, currentY, currentZ, AccelX, AccelY, AccelZ, sPrev);
                 *   args = new SixAxisEventArgs(state.ReportTimeStamp, now);
                 *   SixAxisMoved(this, args);
                 * }
                 *
                 * lastGyroX = currentX;
                 * lastGyroY = currentY;
                 * lastGyroZ = currentZ;
                 * lastAX = AccelX;
                 * lastAY = AccelY;
                 * lastAZ = AccelZ;*/
            }
            if (AccelX != 0 || AccelY != 0 || AccelZ != 0)
            {
                if (SixAccelMoved != null)
                {
                    SixAxis sPrev, now;
                    sPrev = new SixAxis(lastGyroX, lastGyroY, lastGyroZ, lastAX, lastAY, lastAZ);
                    now   = new SixAxis(currentX, currentY, currentZ, AccelX, AccelY, AccelZ, sPrev);
                    args  = new SixAxisEventArgs(state.ReportTimeStamp, now);
                    SixAccelMoved(this, args);
                }

                lastGyroX = currentX;
                lastGyroY = currentY;
                lastGyroZ = currentZ;
                lastAX    = AccelX;
                lastAY    = AccelY;
                lastAZ    = AccelZ;
            }
        }
示例#4
0
 public ControlService()
 {
     //声音播放
     //sp.Stream = Properties.Resources.EE;
     x360Bus = new X360Device();
     AddtoVGList();
     for (int i = 0; i < DS4Controllers.Length; i++)
     {
         processingData[i] = new X360Data();
         MappedState[i]    = new VGState();
         CurrentState[i]   = new VGState();
         PreviousState[i]  = new VGState();
         ExposedState[i]   = new VGStateExposed(CurrentState[i]);
     }
 }
示例#5
0
 private void synthesizeMouseButtons()
 {
     if (Global.GetDS4Action(deviceNum, VGControls.TouchLeft.ToString(), false) == null && leftDown)
     {
         Mapping.MapClick(deviceNum, Mapping.Click.Left);
         dragging2 = true;
     }
     else
     {
         dragging2 = false;
     }
     if (Global.GetDS4Action(deviceNum, VGControls.TouchUpper.ToString(), false) == null && upperDown)
     {
         Mapping.MapClick(deviceNum, Mapping.Click.Middle);
     }
     if (Global.GetDS4Action(deviceNum, VGControls.TouchRight.ToString(), false) == null && rightDown)
     {
         Mapping.MapClick(deviceNum, Mapping.Click.Left);
     }
     if (Global.GetDS4Action(deviceNum, VGControls.TouchMulti.ToString(), false) == null && multiDown)
     {
         Mapping.MapClick(deviceNum, Mapping.Click.Right);
     }
     if (!Global.UseTPforControls[deviceNum])
     {
         if (tappedOnce)
         {
             DateTime tester = DateTime.Now;
             if (tester > (TimeofEnd + TimeSpan.FromMilliseconds((double)(Global.TapSensitivity[deviceNum]) * 1.5)))
             {
                 Mapping.MapClick(deviceNum, Mapping.Click.Left);
                 tappedOnce = false;
             }
             //if it fails the method resets, and tries again with a new tester value (gives tap a delay so tap and hold can work)
         }
         if (secondtouchbegin) //if tap and hold (also works as double tap)
         {
             Mapping.MapClick(deviceNum, Mapping.Click.Left);
             dragging = true;
         }
         else
         {
             dragging = false;
         }
     }
     s = remapped;
     //remapped.CopyTo(s);
 }
示例#6
0
 public VGStateExposed(VGState state)
 {
     _state = state;
 }
示例#7
0
 public VGStateExposed()
 {
     _state = new VGState();
 }
示例#8
0
        public static void updateLightBar(VGDevice device, int deviceNum, VGState cState, VGStateExposed eState, Mouse tp)
        {
            VGColor color;

            if (!defualtLight && !forcelight[deviceNum])
            {
                if (UseCustomLed[deviceNum])
                {
                    if (LedAsBatteryIndicator[deviceNum])
                    {
                        VGColor fullColor = CustomColor[deviceNum];
                        VGColor lowColor  = LowColor[deviceNum];

                        color = getTransitionedColor(lowColor, fullColor, device.Battery);
                    }
                    else
                    {
                        color = CustomColor[deviceNum];
                    }
                }
                else
                {
                    if (Rainbow[deviceNum] > 0)
                    {                                                      // Display rainbow
                        DateTime now = DateTime.UtcNow;
                        if (now >= oldnow + TimeSpan.FromMilliseconds(10)) //update by the millisecond that way it's a smooth transtion
                        {
                            oldnow = now;
                            if (device.Charging)
                            {
                                counters[deviceNum] -= 1.5 * 3 / Rainbow[deviceNum];
                            }
                            else
                            {
                                counters[deviceNum] += 1.5 * 3 / Rainbow[deviceNum];
                            }
                        }
                        if (counters[deviceNum] < 0)
                        {
                            counters[deviceNum] = 180000;
                        }
                        if (counters[deviceNum] > 180000)
                        {
                            counters[deviceNum] = 0;
                        }
                        if (LedAsBatteryIndicator[deviceNum])
                        {
                            color = HuetoRGB((float)counters[deviceNum] % 360, (byte)(2.55 * device.Battery));
                        }
                        else
                        {
                            color = HuetoRGB((float)counters[deviceNum] % 360, 255);
                        }
                    }
                    else if (LedAsBatteryIndicator[deviceNum])
                    {
                        //if (device.Charging == false || device.Battery >= 100) // when charged, don't show the charging animation
                        {
                            VGColor fullColor = MainColor[deviceNum];
                            VGColor lowColor  = LowColor[deviceNum];

                            color = getTransitionedColor(lowColor, fullColor, (uint)device.Battery);
                        }
                    }
                    else
                    {
                        color = MainColor[deviceNum];
                    }
                }

                if (device.Battery <= FlashAt[deviceNum] && !defualtLight && !device.Charging)
                {
                    if (!(FlashColor[deviceNum].red == 0 &&
                          FlashColor[deviceNum].green == 0 &&
                          FlashColor[deviceNum].blue == 0))
                    {
                        color = FlashColor[deviceNum];
                    }
                    if (FlashType[deviceNum] == 1)
                    {
                        if (fadetimer[deviceNum] <= 0)
                        {
                            fadedirection[deviceNum] = true;
                        }
                        else if (fadetimer[deviceNum] >= 100)
                        {
                            fadedirection[deviceNum] = false;
                        }
                        if (fadedirection[deviceNum])
                        {
                            fadetimer[deviceNum] += 1;
                        }
                        else
                        {
                            fadetimer[deviceNum] -= 1;
                        }
                        color = getTransitionedColor(color, new VGColor(0, 0, 0), fadetimer[deviceNum]);
                    }
                }

                if (IdleDisconnectTimeout[deviceNum] > 0 && LedAsBatteryIndicator[deviceNum] && (!device.Charging || device.Battery >= 100))
                {//Fade lightbar by idle time
                    TimeSpan timeratio = new TimeSpan(DateTime.UtcNow.Ticks - device.lastActive.Ticks);
                    double   botratio  = timeratio.TotalMilliseconds;
                    double   topratio  = TimeSpan.FromSeconds(IdleDisconnectTimeout[deviceNum]).TotalMilliseconds;
                    double   ratio     = ((botratio / topratio) * 100);
                    if (ratio >= 50 && ratio <= 100)
                    {
                        color = getTransitionedColor(color, new VGColor(0, 0, 0), (uint)((ratio - 50) * 2));
                    }
                    else if (ratio >= 100)
                    {
                        color = getTransitionedColor(color, new VGColor(0, 0, 0), 100);
                    }
                }
                if (device.Charging && device.Battery < 100)
                {
                    switch (ChargingType[deviceNum])
                    {
                    case 1:
                        if (fadetimer[deviceNum] <= 0)
                        {
                            fadedirection[deviceNum] = true;
                        }
                        else if (fadetimer[deviceNum] >= 105)
                        {
                            fadedirection[deviceNum] = false;
                        }
                        if (fadedirection[deviceNum])
                        {
                            fadetimer[deviceNum] += .1;
                        }
                        else
                        {
                            fadetimer[deviceNum] -= .1;
                        }
                        color = getTransitionedColor(color, new VGColor(0, 0, 0), fadetimer[deviceNum]);
                        break;

                    case 2:
                        counters[deviceNum] += .167;
                        color = HuetoRGB((float)counters[deviceNum] % 360, 255);
                        break;

                    case 3:
                        color = ChargingColor[deviceNum];
                        break;

                    default:
                        break;
                    }
                }
            }
            else if (forcelight[deviceNum])
            {
                color = forcedColor[deviceNum];
            }
            else if (shuttingdown)
            {
                color = new VGColor(0, 0, 0);
            }
            else
            {
                if (device.ConnectionType == ConnectionType.BT)
                {
                    color = new VGColor(32, 64, 64);
                }
                else
                {
                    color = new VGColor(0, 0, 0);
                }
            }
            bool distanceprofile = (ProfilePath[deviceNum].ToLower().Contains("distance") || tempprofilename[deviceNum].ToLower().Contains("distance"));

            if (distanceprofile && !defualtLight)
            { //Thing I did for Distance
                float rumble = device.LeftHeavySlowRumble / 2.55f;
                byte  max    = Max(color.red, Max(color.green, color.blue));
                if (device.LeftHeavySlowRumble > 100)
                {
                    color = getTransitionedColor(new VGColor(max, max, 0), new VGColor(255, 0, 0), rumble);
                }
                else
                {
                    color = getTransitionedColor(color, getTransitionedColor(new VGColor(max, max, 0), new VGColor(255, 0, 0), 39.6078f), device.LeftHeavySlowRumble);
                }
            }
            VGHapticState haptics = new VGHapticState
            {
                LightBarColor = color
            };

            if (haptics.IsLightBarSet())
            {
                if (forcelight[deviceNum] && forcedFlash[deviceNum] > 0)
                {
                    haptics.LightBarFlashDurationOff = haptics.LightBarFlashDurationOn = (byte)(25 - forcedFlash[deviceNum]);
                    haptics.LightBarExplicitlyOff    = true;
                }
                else if (device.Battery <= FlashAt[deviceNum] && FlashType[deviceNum] == 0 && !defualtLight && !device.Charging)
                {
                    int level = device.Battery / 10;
                    //if (level >= 10)
                    //level = 0; // all values of ~0% or >~100% are rendered the same
                    haptics.LightBarFlashDurationOn  = BatteryIndicatorDurations[level, 0];
                    haptics.LightBarFlashDurationOff = BatteryIndicatorDurations[level, 1];
                }
                else if (distanceprofile && device.LeftHeavySlowRumble > 155) //also part of Distance
                {
                    haptics.LightBarFlashDurationOff = haptics.LightBarFlashDurationOn = (byte)((-device.LeftHeavySlowRumble + 265));
                    haptics.LightBarExplicitlyOff    = true;
                }
                else
                {
                    //haptics.LightBarFlashDurationOff = haptics.LightBarFlashDurationOn = 1;
                    haptics.LightBarFlashDurationOff = haptics.LightBarFlashDurationOn = 0;
                    haptics.LightBarExplicitlyOff    = true;
                }
            }
            else
            {
                haptics.LightBarExplicitlyOff = true;
            }
            if (device.LightBarOnDuration != haptics.LightBarFlashDurationOn && device.LightBarOnDuration != 1 && haptics.LightBarFlashDurationOn == 0)
            {
                haptics.LightBarFlashDurationOff = haptics.LightBarFlashDurationOn = 1;
            }
            if (device.LightBarOnDuration == 1) //helps better reset the color
            {
                System.Threading.Thread.Sleep(5);
            }
            device.pushHapticState(haptics);
        }
        public void handleTouchpad(byte[] data, VGState sensors, int touchPacketOffset = 0)
        {
            bool touchPadIsDown = sensors.TouchButton;

            if (!PacketChanged(data, touchPacketOffset) && touchPadIsDown == lastTouchPadIsDown)
            {
                if (TouchUnchanged != null)
                {
                    TouchUnchanged(this, EventArgs.Empty);
                }
                return;
            }
            byte touchID1  = (byte)(data[0 + TOUCHPAD_DATA_OFFSET + touchPacketOffset] & 0x7F);
            byte touchID2  = (byte)(data[4 + TOUCHPAD_DATA_OFFSET + touchPacketOffset] & 0x7F);
            int  currentX1 = data[1 + TOUCHPAD_DATA_OFFSET + touchPacketOffset] + ((data[2 + TOUCHPAD_DATA_OFFSET + touchPacketOffset] & 0xF) * 255);
            int  currentY1 = ((data[2 + TOUCHPAD_DATA_OFFSET + touchPacketOffset] & 0xF0) >> 4) + (data[3 + TOUCHPAD_DATA_OFFSET + touchPacketOffset] * 16);
            int  currentX2 = data[5 + TOUCHPAD_DATA_OFFSET + touchPacketOffset] + ((data[6 + TOUCHPAD_DATA_OFFSET + touchPacketOffset] & 0xF) * 255);
            int  currentY2 = ((data[6 + TOUCHPAD_DATA_OFFSET + touchPacketOffset] & 0xF0) >> 4) + (data[7 + TOUCHPAD_DATA_OFFSET + touchPacketOffset] * 16);

            TouchpadEventArgs args;

            if (sensors.Touch1 || sensors.Touch2)
            {
                if ((sensors.Touch1 && !lastIsActive1) || (sensors.Touch2 && !lastIsActive2))
                {
                    if (TouchesBegan != null)
                    {
                        if (sensors.Touch1 && sensors.Touch2)
                        {
                            args = new TouchpadEventArgs(sensors.ReportTimeStamp, sensors.TouchButton, new Touch(currentX1, currentY1, touchID1), new Touch(currentX2, currentY2, touchID2));
                        }
                        else if (sensors.Touch1)
                        {
                            args = new TouchpadEventArgs(sensors.ReportTimeStamp, sensors.TouchButton, new Touch(currentX1, currentY1, touchID1));
                        }
                        else
                        {
                            args = new TouchpadEventArgs(sensors.ReportTimeStamp, sensors.TouchButton, new Touch(currentX2, currentY2, touchID2));
                        }

                        TouchesBegan(this, args);
                    }
                }
                else if (sensors.Touch1 == lastIsActive1 && sensors.Touch2 == lastIsActive2 && TouchesMoved != null)
                {
                    Touch tPrev, t0, t1;

                    if (sensors.Touch1 && sensors.Touch2)
                    {
                        tPrev = new Touch(lastTouchPadX1, lastTouchPadY1, lastTouchID1);
                        t0    = new Touch(currentX1, currentY1, touchID1, tPrev);
                        tPrev = new Touch(lastTouchPadX2, lastTouchPadY2, lastTouchID2);
                        t1    = new Touch(currentX2, currentY2, touchID2, tPrev);
                    }
                    else if (sensors.Touch1)
                    {
                        tPrev = new Touch(lastTouchPadX1, lastTouchPadY1, lastTouchID1);
                        t0    = new Touch(currentX1, currentY1, touchID1, tPrev);
                        t1    = null;
                    }
                    else
                    {
                        tPrev = new Touch(lastTouchPadX2, lastTouchPadY2, lastTouchID2);
                        t0    = new Touch(currentX2, currentY2, touchID2, tPrev);
                        t1    = null;
                    }
                    args = new TouchpadEventArgs(sensors.ReportTimeStamp, sensors.TouchButton, t0, t1);

                    TouchesMoved(this, args);
                }

                if (!lastTouchPadIsDown && touchPadIsDown && TouchButtonDown != null)
                {
                    if (sensors.Touch1 && sensors.Touch2)
                    {
                        args = new TouchpadEventArgs(sensors.ReportTimeStamp, sensors.TouchButton, new Touch(currentX1, currentY1, touchID1), new Touch(currentX2, currentY2, touchID2));
                    }
                    else if (sensors.Touch1)
                    {
                        args = new TouchpadEventArgs(sensors.ReportTimeStamp, sensors.TouchButton, new Touch(currentX1, currentY1, touchID1));
                    }
                    else
                    {
                        args = new TouchpadEventArgs(sensors.ReportTimeStamp, sensors.TouchButton, new Touch(currentX2, currentY2, touchID2));
                    }

                    TouchButtonDown(this, args);
                }
                else if (lastTouchPadIsDown && !touchPadIsDown && TouchButtonUp != null)
                {
                    if (sensors.Touch1 && sensors.Touch2)
                    {
                        args = new TouchpadEventArgs(sensors.ReportTimeStamp, sensors.TouchButton, new Touch(currentX1, currentY1, touchID1), new Touch(currentX2, currentY2, touchID2));
                    }
                    else if (sensors.Touch1)
                    {
                        args = new TouchpadEventArgs(sensors.ReportTimeStamp, sensors.TouchButton, new Touch(currentX1, currentY1, touchID1));
                    }
                    else
                    {
                        args = new TouchpadEventArgs(sensors.ReportTimeStamp, sensors.TouchButton, new Touch(currentX2, currentY2, touchID2));
                    }

                    TouchButtonUp(this, args);
                }

                if (sensors.Touch1)
                {
                    lastTouchPadX1 = currentX1;
                    lastTouchPadY1 = currentY1;
                }
                if (sensors.Touch2)
                {
                    lastTouchPadX2 = currentX2;
                    lastTouchPadY2 = currentY2;
                }
                lastTouchPadIsDown = touchPadIsDown;
            }
            else
            {
                if (touchPadIsDown && !lastTouchPadIsDown)
                {
                    if (TouchButtonDown != null)
                    {
                        TouchButtonDown(this, new TouchpadEventArgs(sensors.ReportTimeStamp, sensors.TouchButton, null, null));
                    }
                }
                else if (!touchPadIsDown && lastTouchPadIsDown)
                {
                    if (TouchButtonUp != null)
                    {
                        TouchButtonUp(this, new TouchpadEventArgs(sensors.ReportTimeStamp, sensors.TouchButton, null, null));
                    }
                }

                if ((lastIsActive1 || lastIsActive2) && TouchesEnded != null)
                {
                    if (lastIsActive1 && lastIsActive2)
                    {
                        args = new TouchpadEventArgs(sensors.ReportTimeStamp, sensors.TouchButton, new Touch(lastTouchPadX1, lastTouchPadY1, touchID1), new Touch(lastTouchPadX2, lastTouchPadY2, touchID2));
                    }
                    else if (lastIsActive1)
                    {
                        args = new TouchpadEventArgs(sensors.ReportTimeStamp, sensors.TouchButton, new Touch(lastTouchPadX1, lastTouchPadY1, touchID1));
                    }
                    else
                    {
                        args = new TouchpadEventArgs(sensors.ReportTimeStamp, sensors.TouchButton, new Touch(lastTouchPadX2, lastTouchPadY2, touchID2));
                    }

                    TouchesEnded(this, args);
                }
            }

            lastIsActive1      = sensors.Touch1;
            lastIsActive2      = sensors.Touch2;
            lastTouchID1       = touchID1;
            lastTouchID2       = touchID2;
            lastTouchPadIsDown = touchPadIsDown;
        }
示例#10
0
        public void Parse(VGState 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);
        }
示例#11
0
 public void getPreviousState(VGState state)
 {
     pState.CopyTo(state);
 }
示例#12
0
 public void getCurrentState(VGState state)
 {
     cState.CopyTo(state);
 }
示例#13
0
 public void getExposedState(VGStateExposed expState, VGState state)
 {
     cState.CopyTo(state);
     expState.Accel = accel;
     expState.Gyro  = gyro;
 }