internal override void Load(BinaryReader reader, ushort dataFormatVersion)
        {
            UnknownDeviceControl control = default(UnknownDeviceControl);

            control.Load(reader);
            Control = control;
        }
Beispiel #2
0
        internal override void Load(BinaryReader reader)
        {
            // Have to do this because it's a struct property? Weird.
            var temp = new UnknownDeviceControl();

            temp.Load(reader);
            Control = temp;
        }
Beispiel #3
0
        public override void Load(BinaryReader reader, UInt16 dataFormatVersion)
        {
            // Have to do this because it's a struct property? Weird.
            var temp = new UnknownDeviceControl();

            temp.Load(reader);
            Control = temp;
        }
Beispiel #4
0
        public BindingSource Listen(BindingListenOptions listenOptions, InputDevice device)
        {
            if (!listenOptions.IncludeUnknownControllers || device.IsKnown)
            {
                return(null);
            }

            if (detectPhase == DetectPhase.WaitForControlRelease && detectFound)
            {
                if (!IsPressed(detectFound, device))
                {
                    var bindingSource = new UnknownDeviceBindingSource(detectFound);
                    Reset();
                    return(bindingSource);
                }
            }

            var control = ListenForControl(listenOptions, device);

            if (control)
            {
                if (detectPhase == DetectPhase.WaitForControlPress)
                {
                    detectFound = control;
                    detectPhase = DetectPhase.WaitForControlRelease;
                }
            }
            else
            {
                if (detectPhase == DetectPhase.WaitForInitialRelease)
                {
                    detectPhase = DetectPhase.WaitForControlPress;
                }
            }

            return(null);
        }
Beispiel #5
0
 public UnknownDeviceBindingSource(UnknownDeviceControl control)
 {
     Control = control;
 }
Beispiel #6
0
 internal UnknownDeviceBindingSource()
 {
     Control = UnknownDeviceControl.None;
 }
Beispiel #7
0
        bool IsPressed(UnknownDeviceControl control, InputDevice device)
        {
            var value = control.GetValue(device);

            return(Utility.AbsoluteIsOverThreshold(value, 0.5f));
        }
Beispiel #8
0
 public void Reset()
 {
     detectFound = UnknownDeviceControl.None;
     detectPhase = DetectPhase.WaitForInitialRelease;
     TakeSnapshotOnUnknownDevices();
 }