Ejemplo n.º 1
0
        private static bool IsWiimoteConnected(SafeHandle wiimoteHandle)
        {
            var _mBuff = new byte[22];

            _mBuff[0] = 0x15;
            bool good = WiimoteEnumerator.HidD_SetOutputReport(wiimoteHandle.DangerousGetHandle(), _mBuff,
                                                               (uint)_mBuff.Length);
            int error = Marshal.GetLastWin32Error();

            return(error != 0x1F && good);
        }
Ejemplo n.º 2
0
        /// <inheritdoc/>
        public override IEnumerable <IInputDevice> GetConnectedDevices()
        {
            var guid = new Guid("0306057e-0000-0000-0000-504944564944");

            return(from device in this.inputManager.GetAllDevices()
                   where device?.DI_ProductGUID == guid
                   let wiimoteHandle = WiimoteEnumerator.CreateFile(device.DI_InterfacePath)
                                       let deviceId = "DEVICE_WII_REMOTE"
                                                      where WiimoteEnumerator.IsWiimoteConnected(wiimoteHandle)
                                                      select new InputDevice(InputApi.Other, device, this.ControllerLayout));
        }
Ejemplo n.º 3
0
 public static SafeHandle CreateFile(string devicePath)
 {
     return(WiimoteEnumerator.CreateFile(devicePath, FileAccess.ReadWrite, FileShare.ReadWrite, IntPtr.Zero,
                                         FileMode.Open,
                                         0x40000000, IntPtr.Zero));
 }