Differences From Artifact [9daef32bf6]:
- File src/hid/OHNintendoDSGamepad.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: 3588) [annotate] [blame] [check-ins using]
To Artifact [5ff13c9373]:
- File
src/hid/OHNintendoDSGamepad.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: 3775) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | * version 3.0 along with this program. If not, see * <https://www.gnu.org/licenses/>. */ #include "config.h" #import "OHNintendoDSGamepad.h" #import "OFDictionary.h" #import "OHGameControllerButton.h" #import "OHGameControllerDirectionalPad.h" static OFString *const buttonNames[] = { @"A", @"B", @"X", @"Y", @"L", @"R", @"Start", @"Select" }; static const size_t numButtons = sizeof(buttonNames) / sizeof(*buttonNames); @implementation OHNintendoDSGamepad @synthesize buttons = _buttons, directionalPads = _directionalPads; - (instancetype)init { self = [super init]; @try { void *pool = objc_autoreleasePoolPush(); OFMutableDictionary *buttons = [OFMutableDictionary dictionaryWithCapacity: numButtons]; OHGameControllerButton *up, *down, *left, *right; OHGameControllerDirectionalPad *dPad; for (size_t i = 0; i < numButtons; i++) { | > > > > > > > > > > > | < | | | < | < | | < | | | | | | < | | | | | | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | * version 3.0 along with this program. If not, see * <https://www.gnu.org/licenses/>. */ #include "config.h" #import "OHNintendoDSGamepad.h" #import "OHNintendoDSGamepad+Private.h" #import "OFDictionary.h" #import "OHGameController.h" #import "OHGameController+Private.h" #import "OHGameControllerButton.h" #import "OHGameControllerDirectionalPad.h" #import "OHGameControllerDirectionalPad+Private.h" #import "OHGameControllerElement.h" #import "OHGameControllerElement+Private.h" static OFString *const buttonNames[] = { @"A", @"B", @"X", @"Y", @"L", @"R", @"Start", @"Select" }; static const size_t numButtons = sizeof(buttonNames) / sizeof(*buttonNames); @implementation OHNintendoDSGamepad @synthesize buttons = _buttons, directionalPads = _directionalPads; - (instancetype)init { OF_INVALID_INIT_METHOD } - (instancetype)oh_init { self = [super init]; @try { void *pool = objc_autoreleasePoolPush(); OFMutableDictionary *buttons = [OFMutableDictionary dictionaryWithCapacity: numButtons]; OHGameControllerButton *up, *down, *left, *right; OHGameControllerDirectionalPad *dPad; for (size_t i = 0; i < numButtons; i++) { OHGameControllerButton *button = [OHGameControllerButton oh_elementWithName: buttonNames[i] analog: false]; [buttons setObject: button forKey: buttonNames[i]]; } [buttons makeImmutable]; _buttons = [buttons retain]; up = [OHGameControllerButton oh_elementWithName: @"D-Pad Up" analog: false]; down = [OHGameControllerButton oh_elementWithName: @"D-Pad Down" analog: false]; left = [OHGameControllerButton oh_elementWithName: @"D-Pad Left" analog: false]; right = [OHGameControllerButton oh_elementWithName: @"D-Pad Right" analog: false]; dPad = [OHGameControllerDirectionalPad oh_padWithName: @"D-Pad" up: up down: down left: left right: right analog: false]; _directionalPads = [[OFDictionary alloc] initWithObject: dPad forKey: @"D-Pad"]; objc_autoreleasePoolPop(pool); } @catch (id e) { |
︙ | ︙ |