OpenEmu/OpenEmu-SDK — pull request #6 by CharlesJS (2014-11-05 05:22:36+00:00)
Title: Patch to fix non-functional buttons on some third-party game controllers

This patch fixes an issue with certain third-party controllers (I discovered this with the Moga Hero Power controller), in which certain button (the "Select" button on this particular controller) get mapped by OS X to be special "Back" and/or "Forward" keys instead of generic controller buttons. This causes the event type to be reported by IOHIDElementGetUsagePage() as kHIDPage_Consumer instead of kHIDPage_Button, which causes OpenEmu not to handle the event and the button to be thus rendered unmappable.

This patch attempts to resolve the issue by defining a new event type, OEHIDEventTypeSpecialButton, which behaves identically to OEHIDEventTypeButton but represents a special system key. An alternative solution could be simply to map the back and forward keys to a normal OEHIDEventTypeButton event, if you feel that that would be more appropriate. This patch does this only for the Back and Forward buttons since enabling everything causes odd issues, such as the controls preference dialog giving very inappropriate results when one of the volume keys is pressed.

This patch was put together rather quickly and should probably be tested. The constant name and description strings also may want to be adjusted as your UI designers see fit.

I hope you find this useful.