diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2020-06-01 15:08:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-01 15:08:21 +0200 |
commit | 34ef9a51200978f9c552999969279fc4d6dba31b (patch) | |
tree | 48df7b1dcc5d1a48343d0a2f59cd0bcbf21770f8 | |
parent | a8787d1ae56006c00b4eecc3506dbc5ec763a8a5 (diff) | |
parent | d04cbbd76b50af563ae6317ca30ba038cc5fc03f (diff) |
Merge pull request #39172 from madmiraal/fix-39157
Update OSX joypad GUID to SDL uid conversion.
-rw-r--r-- | platform/osx/joypad_osx.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/platform/osx/joypad_osx.cpp b/platform/osx/joypad_osx.cpp index d342d30097..cfc371710b 100644 --- a/platform/osx/joypad_osx.cpp +++ b/platform/osx/joypad_osx.cpp @@ -311,9 +311,16 @@ bool JoypadOSX::configure_joypad(IOHIDDeviceRef p_device_ref, joypad *p_joy) { if (refCF) { CFNumberGetValue((CFNumberRef)refCF, kCFNumberSInt32Type, &product_id); } + + int version = 0; + refCF = IOHIDDeviceGetProperty(p_device_ref, CFSTR(kIOHIDVersionNumberKey)); + if (refCF) { + CFNumberGetValue((CFNumberRef)refCF, kCFNumberSInt32Type, &version); + } + if (vendor && product_id) { char uid[128]; - sprintf(uid, "%04x%08x%04x%08x", OSSwapHostToBigInt32(vendor), 0, OSSwapHostToBigInt32(product_id), 0); + sprintf(uid, "%08x%08x%08x%08x", OSSwapHostToBigInt32(3), OSSwapHostToBigInt32(vendor), OSSwapHostToBigInt32(product_id), OSSwapHostToBigInt32(version)); input->joy_connection_changed(id, true, name, uid); } else { //bluetooth device |