示例#1
0
        //Lookup button group offset
        int LookupButtonGroupOffset(int targetGroup, ControllerSupported controllerSupported)
        {
            try
            {
                switch (targetGroup)
                {
                case 1: return((int)controllerSupported.OffsetHeader.ButtonsGroup1);

                case 2: return((int)controllerSupported.OffsetHeader.ButtonsGroup2);

                case 3: return((int)controllerSupported.OffsetHeader.ButtonsGroup3);
                }
            }
            catch { }
            return(0);
        }
示例#2
0
            //Reset controller status to defaults
            public void ResetControllerStatus()
            {
                try
                {
                    Debug.WriteLine("Reset the controller status for controller: " + NumberId);

                    //Controller Status
                    Activated = false;

                    //Battery Status
                    BatteryCurrent  = new ControllerBattery();
                    BatteryPrevious = new ControllerBattery();

                    //Time Variables
                    PrevInputTicks  = 0;
                    LastInputTicks  = 0;
                    LastActiveTicks = 0;

                    //Controller Details
                    Details     = null;
                    BlockOutput = false;

                    //Controller Tasks
                    InputVirtualOverlapped = new NativeOverlapped()
                    {
                        EventHandle = CreateEvent(IntPtr.Zero, true, false, null)
                    };
                    OutputVirtualOverlapped = new NativeOverlapped()
                    {
                        EventHandle = CreateEvent(IntPtr.Zero, true, false, null)
                    };
                    InputControllerTask  = new AVTaskDetails();
                    OutputControllerTask = new AVTaskDetails();
                    OutputVirtualTask    = new AVTaskDetails();
                    OutputGyroTask       = new AVTaskDetails();

                    //WinUsb Device Variables
                    WinUsbDevice = null;

                    //Hid Device Variables
                    HidDevice = null;

                    //Gyro Dsu Client Variables
                    GyroDsuClientPacketNumber = 0;
                    GyroDsuClientEndPoint     = null;

                    //Device In and Output
                    InputButtonCountLoop1     = 0;
                    InputButtonCountTotal1    = 80;
                    InputButtonCountLoop2     = 0;
                    InputButtonCountTotal2    = 80;
                    InputButtonCountLoop3     = 0;
                    InputButtonCountTotal3    = 80;
                    InputHeaderOffsetFinished = false;
                    InputHeaderOffsetByte     = 0;
                    InputButtonOffsetFinished = false;
                    InputButtonOffsetByte     = 0;
                    InputReport  = null;
                    OutputReport = null;
                    XInputData   = new XUSB_INPUT_REPORT();
                    XOutputData  = new XUSB_OUTPUT_REPORT();
                    XOutputCurrentRumbleHeavy  = 0;
                    XOutputCurrentRumbleLight  = 0;
                    XOutputPreviousRumbleHeavy = 0;
                    XOutputPreviousRumbleLight = 0;

                    //Controller Input
                    InputCurrent     = new ControllerInput();
                    SupportedCurrent = new ControllerSupported();
                }
                catch { }
            }