static unsafe bool EnumDevicesHandler(IntPtr /*DIDEVICEINSTANCE*/ lpddi, void *pvRef) { DIDEVICEINSTANCE *deviceInstance = (DIDEVICEINSTANCE *)lpddi.ToPointer(); //ignore XInput devices if (Instance.haveXInput && DInput.IsXInputDevice(ref deviceInstance->guidProduct)) { return(true); //continue } if ((deviceInstance->dwDevType & DInput.DI8DEVTYPE_JOYSTICK) != 0) { string deviceName = new string( deviceInstance->tszInstanceName ); DirectInputJoystickInputDevice joystick = new DirectInputJoystickInputDevice( deviceName, deviceInstance->guidInstance); if (!joystick.Init()) { joystick.CallOnShutdown(); return(true); } Instance.RegisterDevice(joystick); } return(true); //continue }