Merge pull request #4405 from xrix4096/mac-unknown-joyaxis

Make analog triggers on PS3 controllers accessible on Mac
This commit is contained in:
Markus Wick 2016-10-31 13:01:47 +01:00 committed by GitHub
commit b9e4f67d3a
1 changed files with 7 additions and 1 deletions

View File

@ -144,8 +144,14 @@ Joystick::Axis::Axis(IOHIDElementRef element, IOHIDDeviceRef device, direction d
break; break;
default: default:
{ {
IOHIDElementCookie elementCookie = IOHIDElementGetCookie(m_element);
// This axis isn't a 'well-known' one so cook a descriptive and uniquely
// identifiable name. macOS provides a 'cookie' for each element that
// will persist between sessions and identify the same physical controller
// element so we can use that as a component of the axis name
std::ostringstream s; std::ostringstream s;
s << usage; s << "CK-";
s << elementCookie;
description = StripSpaces(s.str()); description = StripSpaces(s.str());
break; break;
} }