mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-10 21:10:15 +00:00
4f352227ea
This commit has two main changes to the OSX HID driver: 1. Some joysticks have invalid/incorrect 'use' assigned to buttons and axes. For example, my RetroUSB.com Genesis Retroport reports 8 buttons, but they're reported as 1, 2, 3, 4, 1, 2, 3, 4, and my RetroLink Gamecube-clone controller reports 2 axes with id 50. OSX assigns each of these elements a unique cookie value, so it's still possible to uniquely identify a button. Whenever a controller is connected, the driver scans for all buttons and axes. When it identifies a duplicate 'use' id, it reassigns it a new ID. Whenever the input callback is called, it grabs the cookie value, finds the input element with a matching cookie, and uses that element's id instead of the one reported by the device. The old joystick configs should not be broken by this - I'm using the existing 'use' value wherever possible, and only changing it when it's broken. The 'faked' ids are done in a deterministic way, a joystick will never have a button's 'faked' id change between launches of RetroArch. 2. This enables HAT switch input.