Dear All,
On examining JoystickImpl.cpp in the OSX folder for the source code of SFML, I think I may have discovered why SFML still doesn't yet work correctly with my PS4 controller on my iMac.
Before examining the source code, I checked with my existing SFML joystick handler what was and what wasn't detected with my PS4 controller.
All 8 axes were detected correctly, but the PovX and PovY were not listed as detected when tested for individually. I checked the source I'd written on my PC and SFML detects them correctly on the PC.
I have listed the source below to help you in the context of this bug tracking and I think the possible bug in the source code is at the end of the source listing:
// Go through all connected elements.
for (int i = 0; i < elementsCount; ++i)
{
IOHIDElementRef element = (IOHIDElementRef) CFArrayGetValueAtIndex(elements, i);
switch (IOHIDElementGetType(element))
{
case kIOHIDElementTypeInput_Misc:
switch (IOHIDElementGetUsage(element))
{
case kHIDUsage_GD_X: m_axis[Joystick::X] = element; break;
case kHIDUsage_GD_Y: m_axis[Joystick::Y] = element; break;
case kHIDUsage_GD_Z: m_axis[Joystick::Z] = element; break;
case kHIDUsage_GD_Rx: m_axis[Joystick::U] = element; break;
case kHIDUsage_GD_Ry: m_axis[Joystick::V] = element; break;
case kHIDUsage_GD_Rz: m_axis[Joystick::R] = element; break;
default: break;
// kHIDUsage_GD_Vx, kHIDUsage_GD_Vy, kHIDUsage_GD_Vz are ignored.
}
break;
case kIOHIDElementTypeInput_Button:
if (m_buttons.size() < Joystick::ButtonCount) // If we have free slot...
m_buttons.push_back(element); // ...we add this element to the list
// Else: too many buttons. We ignore this one.
break;
default: // Make compiler happy
break;
}
}
If you examine the above source code, you will notice that it does not have a case statement for kHIDUsage_GD_PovX and kHIDUsage_GD_PovY.
Do you think that this could be the cause of the error?
Kind regards,
AshleyF