mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-12 07:34:50 +00:00
Merge branch 'osx_x360_gamepad' of https://github.com/alexey-lysiuk/gzdoom
This commit is contained in:
commit
48b65f3c76
1 changed files with 25 additions and 15 deletions
|
@ -152,10 +152,20 @@ IOKitJoystick::IOKitJoystick( IOHIDDeviceRef device )
|
||||||
: m_device( device )
|
: m_device( device )
|
||||||
, m_sensitivity( DEFAULT_SENSITIVITY )
|
, m_sensitivity( DEFAULT_SENSITIVITY )
|
||||||
{
|
{
|
||||||
IOHIDElementRef element = HIDGetFirstDeviceElement( device, kHIDElementTypeInput );
|
assert(NULL != device);
|
||||||
|
assert(IOHIDDeviceGetTypeID() == CFGetTypeID(device));
|
||||||
|
|
||||||
while ( NULL != element )
|
CFArrayRef elements = IOHIDDeviceCopyMatchingElements(device, NULL, kIOHIDOptionsTypeNone);
|
||||||
|
assert(NULL != elements);
|
||||||
|
assert(CFArrayGetTypeID() == CFGetTypeID(elements));
|
||||||
|
|
||||||
|
for (CFIndex i = 0, count = CFArrayGetCount(elements); i < count; ++i)
|
||||||
{
|
{
|
||||||
|
const IOHIDElementRef element =
|
||||||
|
static_cast<IOHIDElementRef>(const_cast<void*>(CFArrayGetValueAtIndex(elements, i)));
|
||||||
|
assert(NULL != element);
|
||||||
|
assert(IOHIDElementGetTypeID() == CFGetTypeID(element));
|
||||||
|
|
||||||
const uint32_t usagePage = IOHIDElementGetUsagePage( element );
|
const uint32_t usagePage = IOHIDElementGetUsagePage( element );
|
||||||
|
|
||||||
if ( kHIDPage_GenericDesktop == usagePage )
|
if ( kHIDPage_GenericDesktop == usagePage )
|
||||||
|
@ -200,10 +210,10 @@ IOKitJoystick::IOKitJoystick( IOHIDDeviceRef device )
|
||||||
|
|
||||||
HIDQueueElement( m_device, element );
|
HIDQueueElement( m_device, element );
|
||||||
}
|
}
|
||||||
|
|
||||||
element = HIDGetNextDeviceElement( element, kHIDElementTypeInput );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CFRelease(elements);
|
||||||
|
|
||||||
SetDefaultConfig();
|
SetDefaultConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue