Differences From Artifact [ae6b4a8235]:
- File src/hid/OHEvdevGameControllerProfile.m — part of check-in [3777558ccd] at 2024-11-02 02:24:10 on branch trunk — ObjFWHID: Make sure `analog` is always set (user: js, size: 7054) [annotate] [blame] [check-ins using]
To Artifact [d2edb1ba13]:
- File
src/hid/OHEvdevGameControllerProfile.m
— part of check-in
[bc3a7747d9]
at
2024-11-03 15:46:25
on branch trunk
— ObjFWHID: Properly hide private methods
Also fixes compiling XInput with GCC. (user: js, size: 7142) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
19 20 21 22 23 24 25 26 27 28 29 30 31 32 | #include "config.h" #import "OHEvdevGameControllerProfile.h" #import "OFDictionary.h" #import "OHGameControllerAxis.h" #import "OHGameControllerButton.h" #include <linux/input.h> #import "evdev_compat.h" static OFString * buttonToName(uint16_t button, uint16_t vendorID, uint16_t productID) | > > | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | #include "config.h" #import "OHEvdevGameControllerProfile.h" #import "OFDictionary.h" #import "OHGameControllerAxis.h" #import "OHGameControllerButton.h" #import "OHGameControllerElement.h" #import "OHGameControllerElement+Private.h" #include <linux/input.h> #import "evdev_compat.h" static OFString * buttonToName(uint16_t button, uint16_t vendorID, uint16_t productID) |
︙ | ︙ | |||
201 202 203 204 205 206 207 | return nil; } } @implementation OHEvdevGameControllerProfile @synthesize buttons = _buttons, axes = _axes; | | > > > > > | | | | | | | | < | | | 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | return nil; } } @implementation OHEvdevGameControllerProfile @synthesize buttons = _buttons, axes = _axes; - (instancetype)init { OF_INVALID_INIT_METHOD } - (instancetype)oh_initWithKeyBits: (unsigned long *)keyBits evBits: (unsigned long *)evBits absBits: (unsigned long *)absBits vendorID: (uint16_t)vendorID productID: (uint16_t)productID { self = [super init]; @try { void *pool = objc_autoreleasePoolPush(); OFMutableDictionary *buttons, *axes; buttons = [OFMutableDictionary dictionary]; for (size_t i = 0; i < OHNumEvdevButtonIDs; i++) { if (OFBitSetIsSet(keyBits, OHEvdevButtonIDs[i])) { OFString *buttonName; OHGameControllerButton *button; buttonName = buttonToName(OHEvdevButtonIDs[i], vendorID, productID); if (buttonName == nil) continue; button = [OHGameControllerButton oh_elementWithName: buttonName analog: false]; [buttons setObject: button forKey: buttonName]; } } [buttons makeImmutable]; axes = [OFMutableDictionary dictionary]; if (OFBitSetIsSet(evBits, EV_ABS)) { for (size_t i = 0; i < OHNumEvdevAxisIDs; i++) { if (OFBitSetIsSet(absBits, OHEvdevAxisIDs[i])) { OFString *axisName; OHGameControllerAxis *axis; axisName = axisToName(OHEvdevAxisIDs[i]); if (axisName == nil) continue; axis = [OHGameControllerAxis oh_elementWithName: axisName analog: true]; [axes setObject: axis forKey: axisName]; } } } [axes makeImmutable]; |
︙ | ︙ |