Overview
Comment: | OFEvdevGameController: Poll HAT0[XY] for D-Pad |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
f99cb23d38631841ff88d599003b274f |
User & Date: | js on 2024-05-20 19:38:02 |
Other Links: | manifest | tags |
Context
2024-05-20
| ||
19:41 | tests/gamecontroller: Print read errors check-in: f8b2baa0f5 user: js tags: trunk | |
19:38 | OFEvdevGameController: Poll HAT0[XY] for D-Pad check-in: f99cb23d38 user: js tags: trunk | |
17:29 | OFGameController: Fix polling trigger pressure check-in: cf17d93f51 user: js tags: trunk | |
Changes
Modified src/hid/OFEvdevGameController.h from [f6b3abc284] to [5ec72d013e].
︙ | ︙ | |||
23 24 25 26 27 28 29 30 31 32 33 34 35 36 | @interface OFEvdevGameController: OFGameController { OFString *_path; int _fd; bool _discardUntilReport; unsigned long *_keyBits; uint16_t _vendorID, _productID; OFString *_name; OFMutableSet OF_GENERIC(OFGameControllerButton) *_buttons; OFMutableSet OF_GENERIC(OFGameControllerButton) *_pressedButtons; bool _hasLeftAnalogStick, _hasRightAnalogStick; bool _hasLeftTriggerPressure, _hasRightTriggerPressure; unsigned int _leftTriggerPressureBit, _rightTriggerPressureBit; | > | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | @interface OFEvdevGameController: OFGameController { OFString *_path; int _fd; bool _discardUntilReport; unsigned long *_keyBits; bool _DPadIsHAT0; uint16_t _vendorID, _productID; OFString *_name; OFMutableSet OF_GENERIC(OFGameControllerButton) *_buttons; OFMutableSet OF_GENERIC(OFGameControllerButton) *_pressedButtons; bool _hasLeftAnalogStick, _hasRightAnalogStick; bool _hasLeftTriggerPressure, _hasRightTriggerPressure; unsigned int _leftTriggerPressureBit, _rightTriggerPressureBit; |
︙ | ︙ |
Modified src/hid/OFEvdevGameController.m from [c9d2d02f2c] to [9e74768eff].
︙ | ︙ | |||
336 337 338 339 340 341 342 343 344 345 346 347 348 349 | OFBitSetIsSet(_keyBits, BTN_C) && OFBitSetIsSet(_keyBits, BTN_SELECT) && OFBitSetIsSet(_keyBits, BTN_X)) _hasRightAnalogStick = true; if (OFBitSetIsSet(absBits, ABS_HAT0X) && OFBitSetIsSet(absBits, ABS_HAT0Y)) { [_buttons addObject: OFGameControllerDPadLeftButton]; [_buttons addObject: OFGameControllerDPadRightButton]; [_buttons addObject: OFGameControllerDPadUpButton]; [_buttons addObject: | > > | 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 | OFBitSetIsSet(_keyBits, BTN_C) && OFBitSetIsSet(_keyBits, BTN_SELECT) && OFBitSetIsSet(_keyBits, BTN_X)) _hasRightAnalogStick = true; if (OFBitSetIsSet(absBits, ABS_HAT0X) && OFBitSetIsSet(absBits, ABS_HAT0Y)) { _DPadIsHAT0 = true; [_buttons addObject: OFGameControllerDPadLeftButton]; [_buttons addObject: OFGameControllerDPadRightButton]; [_buttons addObject: OFGameControllerDPadUpButton]; [_buttons addObject: |
︙ | ︙ | |||
424 425 426 427 428 429 430 431 432 433 434 435 436 437 | OFGameControllerButton button = buttonToName( buttons[i], _vendorID, _productID); if (button != nil) [_pressedButtons addObject: button]; } } if (_hasLeftAnalogStick) { struct input_absinfo infoX, infoY; if (ioctl(_fd, EVIOCGABS(ABS_X), &infoX) == -1) @throw [OFReadFailedException exceptionWithObject: self | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 | OFGameControllerButton button = buttonToName( buttons[i], _vendorID, _productID); if (button != nil) [_pressedButtons addObject: button]; } } if (_DPadIsHAT0) { struct input_absinfo infoX, infoY; if (ioctl(_fd, EVIOCGABS(ABS_HAT0X), &infoX) == -1) @throw [OFReadFailedException exceptionWithObject: self requestedLength: sizeof(infoX) errNo: errno]; if (ioctl(_fd, EVIOCGABS(ABS_HAT0Y), &infoY) == -1) @throw [OFReadFailedException exceptionWithObject: self requestedLength: sizeof(infoY) errNo: errno]; if (infoX.value < 0) [_pressedButtons addObject: OFGameControllerDPadLeftButton]; else if (infoX.value > 0) [_pressedButtons addObject: OFGameControllerDPadRightButton]; if (infoY.value < 0) [_pressedButtons addObject: OFGameControllerDPadUpButton]; else if (infoY.value > 0) [_pressedButtons addObject: OFGameControllerDPadDownButton]; } if (_hasLeftAnalogStick) { struct input_absinfo infoX, infoY; if (ioctl(_fd, EVIOCGABS(ABS_X), &infoX) == -1) @throw [OFReadFailedException exceptionWithObject: self |
︙ | ︙ |