Differences From Artifact [c35ba635a9]:
- File
src/hid/OHEvdevGameController.m
— part of check-in
[998339ff24]
at
2024-06-09 11:43:49
on branch trunk
— OHGamepad: Move some elements to OHExtendedGamepad
This allows to have a profile for limited gamepads such as found on the
Nintendo DS rather than only having the raw profile for those. (user: js, size: 18942) [annotate] [blame] [check-ins using]
To Artifact [98e64f1a03]:
- File src/hid/OHEvdevGameController.m — part of check-in [8be13b6bc6] at 2024-06-09 15:12:03 on branch trunk — ObjFWHID: Make OHGameControllerProfile a protocol (user: js, size: 19369) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
51 52 53 54 55 56 57 | @interface OHEvdevGameControllerAxis: OHGameControllerAxis { @public int32_t _minValue, _maxValue; } @end | | > > > > > | 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | @interface OHEvdevGameControllerAxis: OHGameControllerAxis { @public int32_t _minValue, _maxValue; } @end @interface OHEvdevGameControllerProfile: OFObject <OHGameControllerProfile> { OFDictionary OF_GENERIC(OFString *, OHGameControllerButton *) *_buttons; OFDictionary OF_GENERIC(OFString *, OHGameControllerAxis *) *_axes; } - (instancetype)oh_initWithButtons: (OFDictionary *)buttons axes: (OFDictionary *)axes OF_METHOD_FAMILY(init); @end static const uint16_t buttonIDs[] = { BTN_A, BTN_B, BTN_C, BTN_X, BTN_Y, BTN_Z, BTN_TL, BTN_TR, BTN_TL2, BTN_TR2, BTN_SELECT, BTN_START, BTN_MODE, BTN_THUMBL, BTN_THUMBR, |
︙ | ︙ | |||
725 726 727 728 729 730 731 | axis->_minValue, axis->_maxValue); break; } } } | | | | 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 | axis->_minValue, axis->_maxValue); break; } } } - (id <OHGamepad>)gamepad { return self.extendedGamepad; } - (id <OHExtendedGamepad>)extendedGamepad { @try { if (_vendorID == OHVendorIDSony && _productID == OHProductIDDualSense) return [[[OHEvdevDualSense alloc] initWithController: self] autorelease]; else if (_vendorID == OHVendorIDSony && |
︙ | ︙ | |||
777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 | } @end @implementation OHEvdevGameControllerAxis @end @implementation OHEvdevGameControllerProfile - (instancetype)oh_initWithButtons: (OFDictionary *)buttons axes: (OFDictionary *)axes { self = [super init]; @try { _buttons = [buttons retain]; _axes = [axes retain]; } @catch (id e) { [self release]; @throw e; } return self; } @end | > > > > > > > > > > > > > > > > | 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 | } @end @implementation OHEvdevGameControllerAxis @end @implementation OHEvdevGameControllerProfile @synthesize buttons = _buttons, axes = _axes; - (instancetype)oh_initWithButtons: (OFDictionary *)buttons axes: (OFDictionary *)axes { self = [super init]; @try { _buttons = [buttons retain]; _axes = [axes retain]; } @catch (id e) { [self release]; @throw e; } return self; } - (void)dealloc { [_buttons release]; [_axes release]; [super dealloc]; } - (OFDictionary OF_GENERIC(OFString *, OHGameControllerDirectionalPad *) *) directionalPads { return [OFDictionary dictionary]; } @end |