Comment: | ObjFWHID: Make sure `analog` is always set |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
3777558ccdb8aa09e8df8f17108f0928 |
User & Date: | js on 2024-11-02 02:24:10 |
Other Links: | manifest | tags |
2024-11-02
| ||
18:15 | Set version to 1.3-dev check-in: b8088ce448 user: js tags: trunk | |
18:11 | Branch for 1.2 check-in: 6783d1431a user: js tags: 1.2 | |
02:24 | ObjFWHID: Make sure `analog` is always set check-in: 3777558ccd user: js tags: trunk | |
2024-10-27
| ||
23:57 | Add support for \x from JSON5 check-in: 229486deb1 user: js tags: trunk | |
Modified src/hid/OHDualSenseGamepad.m from [f0385ed720] to [ba8334f2eb].
︙ | ︙ | |||
52 53 54 55 56 57 58 | OHGameControllerButton *button; OFMutableDictionary *directionalPads; OHGameControllerAxis *axis, *xAxis, *yAxis; OHGameControllerDirectionalPad *directionalPad; for (size_t i = 0; i < numButtons; i++) { button = [[[OHGameControllerButton alloc] | | > | > | > | > | > | > | > | > | > | > | > | > | 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 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | OHGameControllerButton *button; OFMutableDictionary *directionalPads; OHGameControllerAxis *axis, *xAxis, *yAxis; OHGameControllerDirectionalPad *directionalPad; for (size_t i = 0; i < numButtons; i++) { button = [[[OHGameControllerButton alloc] initWithName: buttonNames[i] analog: false] autorelease]; [buttons setObject: button forKey: buttonNames[i]]; } axis = [[[OHGameControllerAxis alloc] initWithName: @"L2" analog: true] autorelease]; button = [[[OHEmulatedGameControllerTriggerButton alloc] initWithName: @"L2" axis: axis] autorelease]; [buttons setObject: button forKey: @"L2"]; axis = [[[OHGameControllerAxis alloc] initWithName: @"R2" analog: true] autorelease]; button = [[[OHEmulatedGameControllerTriggerButton alloc] initWithName: @"R2" axis: axis] autorelease]; [buttons setObject: button forKey: @"R2"]; [buttons makeImmutable]; _buttons = [buttons retain]; directionalPads = [OFMutableDictionary dictionaryWithCapacity: 3]; xAxis = [[[OHGameControllerAxis alloc] initWithName: @"X" analog: true] autorelease]; yAxis = [[[OHGameControllerAxis alloc] initWithName: @"Y" analog: true] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"Left Stick" xAxis: xAxis yAxis: yAxis analog: true] autorelease]; [directionalPads setObject: directionalPad forKey: @"Left Stick"]; xAxis = [[[OHGameControllerAxis alloc] initWithName: @"RX" analog: true] autorelease]; yAxis = [[[OHGameControllerAxis alloc] initWithName: @"RY" analog: true] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"Right Stick" xAxis: xAxis yAxis: yAxis analog: true] autorelease]; [directionalPads setObject: directionalPad forKey: @"Right Stick"]; xAxis = [[[OHGameControllerAxis alloc] initWithName: @"D-Pad X" analog: false] autorelease]; yAxis = [[[OHGameControllerAxis alloc] initWithName: @"D-Pad Y" analog: false] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"D-Pad" xAxis: xAxis yAxis: yAxis analog: false] autorelease]; [directionalPads setObject: directionalPad forKey: @"D-Pad"]; [directionalPads makeImmutable]; _directionalPads = [directionalPads retain]; objc_autoreleasePoolPop(pool); } @catch (id e) { |
︙ | ︙ |
Modified src/hid/OHDualShock4Gamepad.m from [18a893f1a6] to [574ffee316].
︙ | ︙ | |||
52 53 54 55 56 57 58 | OHGameControllerButton *button; OFMutableDictionary *directionalPads; OHGameControllerAxis *axis, *xAxis, *yAxis; OHGameControllerDirectionalPad *directionalPad; for (size_t i = 0; i < numButtons; i++) { button = [[[OHGameControllerButton alloc] | | > | > | > | > | > | > | > | > | > | > | > | > | 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 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | OHGameControllerButton *button; OFMutableDictionary *directionalPads; OHGameControllerAxis *axis, *xAxis, *yAxis; OHGameControllerDirectionalPad *directionalPad; for (size_t i = 0; i < numButtons; i++) { button = [[[OHGameControllerButton alloc] initWithName: buttonNames[i] analog: false] autorelease]; [buttons setObject: button forKey: buttonNames[i]]; } axis = [[[OHGameControllerAxis alloc] initWithName: @"L2" analog: true] autorelease]; button = [[[OHEmulatedGameControllerTriggerButton alloc] initWithName: @"L2" axis: axis] autorelease]; [buttons setObject: button forKey: @"L2"]; axis = [[[OHGameControllerAxis alloc] initWithName: @"R2" analog: true] autorelease]; button = [[[OHEmulatedGameControllerTriggerButton alloc] initWithName: @"R2" axis: axis] autorelease]; [buttons setObject: button forKey: @"R2"]; [buttons makeImmutable]; _buttons = [buttons retain]; directionalPads = [OFMutableDictionary dictionaryWithCapacity: 3]; xAxis = [[[OHGameControllerAxis alloc] initWithName: @"X" analog: true] autorelease]; yAxis = [[[OHGameControllerAxis alloc] initWithName: @"Y" analog: true] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"Left Stick" xAxis: xAxis yAxis: yAxis analog: true] autorelease]; [directionalPads setObject: directionalPad forKey: @"Left Stick"]; xAxis = [[[OHGameControllerAxis alloc] initWithName: @"RX" analog: true] autorelease]; yAxis = [[[OHGameControllerAxis alloc] initWithName: @"RY" analog: true] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"Right Stick" xAxis: xAxis yAxis: yAxis analog: true] autorelease]; [directionalPads setObject: directionalPad forKey: @"Right Stick"]; xAxis = [[[OHGameControllerAxis alloc] initWithName: @"D-Pad X" analog: false] autorelease]; yAxis = [[[OHGameControllerAxis alloc] initWithName: @"D-Pad Y" analog: false] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"D-Pad" xAxis: xAxis yAxis: yAxis analog: false] autorelease]; [directionalPads setObject: directionalPad forKey: @"D-Pad"]; [directionalPads makeImmutable]; _directionalPads = [directionalPads retain]; objc_autoreleasePoolPop(pool); } @catch (id e) { |
︙ | ︙ |
Modified src/hid/OHEmulatedGameControllerAxis.h from [a0fe4a8f6c] to [d5464e93fd].
︙ | ︙ | |||
25 26 27 28 29 30 31 | OF_SUBCLASSING_RESTRICTED @interface OHEmulatedGameControllerAxis: OHGameControllerAxis { OHGameControllerButton *_negativeButton, *_positiveButton; } | | > | > | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | OF_SUBCLASSING_RESTRICTED @interface OHEmulatedGameControllerAxis: OHGameControllerAxis { OHGameControllerButton *_negativeButton, *_positiveButton; } - (instancetype)initWithName: (OFString *)name analog: (bool)analog OF_UNAVAILABLE; - (instancetype) initWithNegativeButton: (OHGameControllerButton *)negativeButton positiveButton: (OHGameControllerButton *)positiveButton OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END |
Modified src/hid/OHEmulatedGameControllerAxis.m from [46dce32498] to [05ca2dc704].
︙ | ︙ | |||
19 20 21 22 23 24 25 | #import "config.h" #import "OHEmulatedGameControllerAxis.h" #import "OHGameControllerButton.h" @implementation OHEmulatedGameControllerAxis | | | | 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 | #import "config.h" #import "OHEmulatedGameControllerAxis.h" #import "OHGameControllerButton.h" @implementation OHEmulatedGameControllerAxis - (instancetype)initWithName: (OFString *)name analog: (bool)analog { OF_INVALID_INIT_METHOD } - (instancetype)initWithNegativeButton: (OHGameControllerButton *)negativeButton positiveButton: (OHGameControllerButton *)positiveButton { void *pool = objc_autoreleasePoolPush(); OFString *name; @try { name = [OFString stringWithFormat: @"%@ and %@ as emulated axis", negativeButton.name, positiveButton.name]; } @catch (id e) { [self release]; @throw e; } self = [super initWithName: name analog: false]; objc_autoreleasePoolPop(pool); _negativeButton = [negativeButton retain]; _positiveButton = [positiveButton retain]; return self; |
︙ | ︙ |
Modified src/hid/OHEmulatedGameControllerButton.h from [ef1d24eb2d] to [52ccdea95f].
︙ | ︙ | |||
26 27 28 29 30 31 32 | OF_SUBCLASSING_RESTRICTED @interface OHEmulatedGameControllerButton: OHGameControllerButton { OHGameControllerAxis *_axis; bool _positive; } | | > | | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | OF_SUBCLASSING_RESTRICTED @interface OHEmulatedGameControllerButton: OHGameControllerButton { OHGameControllerAxis *_axis; bool _positive; } - (instancetype)initWithName: (OFString *)name analog: (bool)analog OF_UNAVAILABLE; - (instancetype)initWithAxis: (OHGameControllerAxis *)axis positive: (bool)positive OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END |
Modified src/hid/OHEmulatedGameControllerButton.m from [838a2c4d07] to [d381f03565].
︙ | ︙ | |||
19 20 21 22 23 24 25 | #include "config.h" #import "OHEmulatedGameControllerButton.h" #import "OHGameControllerAxis.h" @implementation OHEmulatedGameControllerButton | | | | 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 | #include "config.h" #import "OHEmulatedGameControllerButton.h" #import "OHGameControllerAxis.h" @implementation OHEmulatedGameControllerButton - (instancetype)initWithName: (OFString *)name analog: (bool)analog { OF_INVALID_INIT_METHOD } - (instancetype)initWithAxis: (OHGameControllerAxis *)axis positive: (bool)positive { void *pool = objc_autoreleasePoolPush(); OFString *name; @try { name = [OFString stringWithFormat: @"%@%c", axis.name, (positive ? '+' : '-')]; } @catch (id e) { [self release]; @throw e; } self = [super initWithName: name analog: false]; objc_autoreleasePoolPop(pool); _axis = [axis retain]; _positive = positive; return self; |
︙ | ︙ |
Modified src/hid/OHEmulatedGameControllerTriggerButton.h from [60ea9ad062] to [ca69b5094c].
︙ | ︙ | |||
27 28 29 30 31 32 33 | @interface OHEmulatedGameControllerTriggerButton: OHGameControllerButton { OHGameControllerAxis *_axis; } @property (readonly, nonatomic) OHGameControllerAxis *axis; | | > | > | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | @interface OHEmulatedGameControllerTriggerButton: OHGameControllerButton { OHGameControllerAxis *_axis; } @property (readonly, nonatomic) OHGameControllerAxis *axis; - (instancetype)initWithName: (OFString *)name analog: (bool)analog OF_UNAVAILABLE; - (instancetype)initWithName: (OFString *)name axis: (OHGameControllerAxis *)axis OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END |
Modified src/hid/OHEmulatedGameControllerTriggerButton.m from [c0d9c98c3d] to [4b0da3fefb].
︙ | ︙ | |||
21 22 23 24 25 26 27 | #import "OHEmulatedGameControllerTriggerButton.h" #import "OHGameControllerAxis.h" @implementation OHEmulatedGameControllerTriggerButton @synthesize axis = _axis; | | | | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | #import "OHEmulatedGameControllerTriggerButton.h" #import "OHGameControllerAxis.h" @implementation OHEmulatedGameControllerTriggerButton @synthesize axis = _axis; - (instancetype)initWithName: (OFString *)name analog: (bool)analog { OF_INVALID_INIT_METHOD } - (instancetype)initWithName: (OFString *)name axis: (OHGameControllerAxis *)axis { self = [super initWithName: name analog: true]; _axis = [axis retain]; return self; } - (void)dealloc |
︙ | ︙ |
Modified src/hid/OHEvdevExtendedGamepad.m from [188161fd62] to [0605bcdccb].
︙ | ︙ | |||
196 197 198 199 200 201 202 | if (xAxis == nil || yAxis == nil) return nil; return [[[OHGameControllerDirectionalPad alloc] initWithName: @"Left Thumbstick" xAxis: xAxis | | > | > | > | > | 196 197 198 199 200 201 202 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 | if (xAxis == nil || yAxis == nil) return nil; return [[[OHGameControllerDirectionalPad alloc] initWithName: @"Left Thumbstick" xAxis: xAxis yAxis: yAxis analog: true] autorelease]; } - (OHGameControllerDirectionalPad *)rightThumbstick { OHGameControllerAxis *xAxis = [_axes objectForKey: @"RX"]; OHGameControllerAxis *yAxis = [_axes objectForKey: @"RY"]; if (xAxis == nil || yAxis == nil) return nil; return [[[OHGameControllerDirectionalPad alloc] initWithName: @"Right Thumbstick" xAxis: xAxis yAxis: yAxis analog: true] autorelease]; } - (OHGameControllerDirectionalPad *)dPad { OHGameControllerAxis *xAxis = [_axes objectForKey: @"HAT0X"]; OHGameControllerAxis *yAxis = [_axes objectForKey: @"HAT0Y"]; OHGameControllerButton *up, *down, *left, *right; if (xAxis != nil && yAxis != nil) return [[[OHGameControllerDirectionalPad alloc] initWithName: @"D-Pad" xAxis: xAxis yAxis: yAxis analog: false] autorelease]; up = [_buttons objectForKey: @"D-Pad Up"]; down = [_buttons objectForKey: @"D-Pad Down"]; left = [_buttons objectForKey: @"D-Pad Left"]; right = [_buttons objectForKey: @"D-Pad Right"]; if (up != nil && down != nil && left != nil && right != nil) return [[[OHGameControllerDirectionalPad alloc] initWithName: @"D-Pad" up: up down: down left: left right: right analog: false] autorelease]; return nil; } @end |
Modified src/hid/OHEvdevGameControllerProfile.m from [98130bdc10] to [ae6b4a8235].
︙ | ︙ | |||
225 226 227 228 229 230 231 | buttonName = buttonToName(OHEvdevButtonIDs[i], vendorID, productID); if (buttonName == nil) continue; button = [[[OHGameControllerButton alloc] | | > > | | | 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 | buttonName = buttonToName(OHEvdevButtonIDs[i], vendorID, productID); if (buttonName == nil) continue; button = [[[OHGameControllerButton alloc] initWithName: buttonName analog: false] autorelease]; [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 alloc] initWithName: axisName analog: true] autorelease]; [axes setObject: axis forKey: axisName]; } } } [axes makeImmutable]; |
︙ | ︙ |
Modified src/hid/OHExtendedN64Controller.m from [b2b0ad81d7] to [7c4cbd5732].
︙ | ︙ | |||
42 43 44 45 46 47 48 | void *pool = objc_autoreleasePoolPush(); OFMutableDictionary *buttons = [[_buttons mutableCopy] autorelease]; for (size_t i = 0; i < numButtons; i++) { OHGameControllerButton *button = [[[OHGameControllerButton alloc] | | > | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | void *pool = objc_autoreleasePoolPush(); OFMutableDictionary *buttons = [[_buttons mutableCopy] autorelease]; for (size_t i = 0; i < numButtons; i++) { OHGameControllerButton *button = [[[OHGameControllerButton alloc] initWithName: buttonNames[i] analog: false] autorelease]; [buttons setObject: button forKey: buttonNames[i]]; } [buttons makeImmutable]; [_buttons release]; _buttons = [buttons retain]; objc_autoreleasePoolPop(pool); |
︙ | ︙ |
Modified src/hid/OHGameControllerDirectionalPad.h from [3d6d99697c] to [9f3d209aa4].
︙ | ︙ | |||
62 63 64 65 66 67 68 | @property (readonly, nonatomic) OHGameControllerButton *left; /** * @brief The right button of the directional pad. */ @property (readonly, nonatomic) OHGameControllerButton *right; | | > | > | > | 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | @property (readonly, nonatomic) OHGameControllerButton *left; /** * @brief The right button of the directional pad. */ @property (readonly, nonatomic) OHGameControllerButton *right; - (instancetype)initWithName: (OFString *)name analog: (bool)analog OF_UNAVAILABLE; - (instancetype)initWithName: (OFString *)name xAxis: (OHGameControllerAxis *)xAxis yAxis: (OHGameControllerAxis *)yAxis analog: (bool)analog; - (instancetype)initWithName: (OFString *)name up: (OHGameControllerButton *)up down: (OHGameControllerButton *)down left: (OHGameControllerButton *)left right: (OHGameControllerButton *)right analog: (bool)analog; @end OF_ASSUME_NONNULL_END |
Modified src/hid/OHGameControllerDirectionalPad.m from [6b45d63858] to [ea3786c95c].
︙ | ︙ | |||
23 24 25 26 27 28 29 | #import "OHEmulatedGameControllerAxis.h" #import "OHEmulatedGameControllerButton.h" @implementation OHGameControllerDirectionalPad @synthesize xAxis = _xAxis, yAxis = _yAxis; @synthesize up = _up, down = _down, left = _left, right = _right; | | > | | 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 | #import "OHEmulatedGameControllerAxis.h" #import "OHEmulatedGameControllerButton.h" @implementation OHGameControllerDirectionalPad @synthesize xAxis = _xAxis, yAxis = _yAxis; @synthesize up = _up, down = _down, left = _left, right = _right; - (instancetype)initWithName: (OFString *)name analog: (bool)analog { OF_INVALID_INIT_METHOD } - (instancetype)initWithName: (OFString *)name xAxis: (OHGameControllerAxis *)xAxis yAxis: (OHGameControllerAxis *)yAxis analog: (bool)analog { self = [super initWithName: name analog: analog]; @try { _xAxis = [xAxis retain]; _yAxis = [yAxis retain]; _up = [[OHEmulatedGameControllerButton alloc] initWithAxis: _yAxis |
︙ | ︙ | |||
63 64 65 66 67 68 69 70 | } - (instancetype)initWithName: (OFString *)name up: (OHGameControllerButton *)up down: (OHGameControllerButton *)down left: (OHGameControllerButton *)left right: (OHGameControllerButton *)right { | > | | 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | } - (instancetype)initWithName: (OFString *)name up: (OHGameControllerButton *)up down: (OHGameControllerButton *)down left: (OHGameControllerButton *)left right: (OHGameControllerButton *)right analog: (bool)analog { self = [super initWithName: name analog: analog]; @try { _up = [up retain]; _down = [down retain]; _left = [left retain]; _right = [right retain]; |
︙ | ︙ |
Modified src/hid/OHGameControllerElement.h from [646cedc120] to [3b9ea1e52c].
︙ | ︙ | |||
52 53 54 55 56 57 58 | /** * @brief Whether the game controller element is analog. */ @property (readonly, nonatomic, getter=isAnalog) bool analog; - (instancetype)init OF_UNAVAILABLE; | | > | 52 53 54 55 56 57 58 59 60 61 62 63 | /** * @brief Whether the game controller element is analog. */ @property (readonly, nonatomic, getter=isAnalog) bool analog; - (instancetype)init OF_UNAVAILABLE; - (instancetype)initWithName: (OFString *)name analog: (bool)analog OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END |
Modified src/hid/OHGameControllerElement.m from [e28f3ca624] to [a3cd067a48].
︙ | ︙ | |||
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | - (instancetype)init { OF_INVALID_INIT_METHOD } - (instancetype)initWithName: (OFString *)name { self = [super init]; @try { _name = [name copy]; } @catch (id e) { [self release]; @throw e; } return self; } | > > | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | - (instancetype)init { OF_INVALID_INIT_METHOD } - (instancetype)initWithName: (OFString *)name analog: (bool)analog { self = [super init]; @try { _name = [name copy]; _analog = analog; } @catch (id e) { [self release]; @throw e; } return self; } |
︙ | ︙ |
Modified src/hid/OHLeftJoyCon.m from [e350cc695f] to [a38d580513].
︙ | ︙ | |||
51 52 53 54 55 56 57 | OHGameControllerAxis *xAxis, *yAxis; OHGameControllerDirectionalPad *directionalPad; OHGameControllerButton *up, *down, *left, *right; for (size_t i = 0; i < numButtons; i++) { OHGameControllerButton *button = [[[OHGameControllerButton alloc] | | > | > | > | > | > | > | > | > | > | 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 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | OHGameControllerAxis *xAxis, *yAxis; OHGameControllerDirectionalPad *directionalPad; OHGameControllerButton *up, *down, *left, *right; for (size_t i = 0; i < numButtons; i++) { OHGameControllerButton *button = [[[OHGameControllerButton alloc] initWithName: buttonNames[i] analog: false] autorelease]; [buttons setObject: button forKey: buttonNames[i]]; } [buttons makeImmutable]; _buttons = [buttons retain]; directionalPads = [OFMutableDictionary dictionaryWithCapacity: 2]; xAxis = [[[OHGameControllerAxis alloc] initWithName: @"X" analog: true] autorelease]; yAxis = [[[OHGameControllerAxis alloc] initWithName: @"Y" analog: true] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"Left Thumbstick" xAxis: xAxis yAxis: yAxis analog: true] autorelease]; [directionalPads setObject: directionalPad forKey: @"Left Thumbstick"]; up = [[[OHGameControllerButton alloc] initWithName: @"D-Pad Up" analog: false] autorelease]; down = [[[OHGameControllerButton alloc] initWithName: @"D-Pad Down" analog: false] autorelease]; left = [[[OHGameControllerButton alloc] initWithName: @"D-Pad Left" analog: false] autorelease]; right = [[[OHGameControllerButton alloc] initWithName: @"D-Pad Right" analog: false] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"D-Pad" up: up down: down left: left right: right analog: false] autorelease]; [directionalPads setObject: directionalPad forKey: @"D-Pad"]; [directionalPads makeImmutable]; _directionalPads = [directionalPads retain]; objc_autoreleasePoolPop(pool); } @catch (id e) { |
︙ | ︙ |
Modified src/hid/OHN64Controller.m from [7a0ca41231] to [623858fd4c].
︙ | ︙ | |||
50 51 52 53 54 55 56 | OHGameControllerAxis *xAxis, *yAxis; OHGameControllerDirectionalPad *directionalPad; OHGameControllerButton *up, *down, *left, *right; for (size_t i = 0; i < numButtons; i++) { OHGameControllerButton *button = [[[OHGameControllerButton alloc] | | > | > | > | > | > | > | > | > | > | > | > | > | 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 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | OHGameControllerAxis *xAxis, *yAxis; OHGameControllerDirectionalPad *directionalPad; OHGameControllerButton *up, *down, *left, *right; for (size_t i = 0; i < numButtons; i++) { OHGameControllerButton *button = [[[OHGameControllerButton alloc] initWithName: buttonNames[i] analog: false] autorelease]; [buttons setObject: button forKey: buttonNames[i]]; } [buttons makeImmutable]; _buttons = [buttons retain]; directionalPads = [OFMutableDictionary dictionaryWithCapacity: 3]; xAxis = [[[OHGameControllerAxis alloc] initWithName: @"X" analog: true] autorelease]; yAxis = [[[OHGameControllerAxis alloc] initWithName: @"Y" analog: true] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"Thumbstick" xAxis: xAxis yAxis: yAxis analog: true] autorelease]; [directionalPads setObject: directionalPad forKey: @"Thumbstick"]; xAxis = [[[OHGameControllerAxis alloc] initWithName: @"D-Pad X" analog: false] autorelease]; yAxis = [[[OHGameControllerAxis alloc] initWithName: @"D-Pad Y" analog: false] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"D-Pad" xAxis: xAxis yAxis: yAxis analog: false] autorelease]; [directionalPads setObject: directionalPad forKey: @"D-Pad"]; up = [[[OHGameControllerButton alloc] initWithName: @"C-Up" analog: false] autorelease]; down = [[[OHGameControllerButton alloc] initWithName: @"C-Down" analog: false] autorelease]; left = [[[OHGameControllerButton alloc] initWithName: @"C-Left" analog: false] autorelease]; right = [[[OHGameControllerButton alloc] initWithName: @"C-Right" analog: false] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"C-Buttons" up: up down: down left: left right: right analog: false] autorelease]; [directionalPads setObject: directionalPad forKey: @"C-Buttons"]; [directionalPads makeImmutable]; _directionalPads = [directionalPads retain]; objc_autoreleasePoolPop(pool); |
︙ | ︙ |
Modified src/hid/OHNintendo3DSExtendedGamepad.m from [0752ac2ef9] to [2b5e0e2bfe].
︙ | ︙ | |||
45 46 47 48 49 50 51 | OHGameControllerAxis *xAxis, *yAxis; OHGameControllerDirectionalPad *directionalPad; OHGameControllerButton *up, *down, *left, *right; for (size_t i = 0; i < numButtons; i++) { OHGameControllerButton *button = [[[OHGameControllerButton alloc] | | > | > | > | > | > | > | > | > | > | > | > | > | 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 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | OHGameControllerAxis *xAxis, *yAxis; OHGameControllerDirectionalPad *directionalPad; OHGameControllerButton *up, *down, *left, *right; for (size_t i = 0; i < numButtons; i++) { OHGameControllerButton *button = [[[OHGameControllerButton alloc] initWithName: buttonNames[i] analog: false] autorelease]; [buttons setObject: button forKey: buttonNames[i]]; } [buttons makeImmutable]; _buttons = [buttons retain]; directionalPads = [OFMutableDictionary dictionaryWithCapacity: 3]; xAxis = [[[OHGameControllerAxis alloc] initWithName: @"X" analog: true] autorelease]; yAxis = [[[OHGameControllerAxis alloc] initWithName: @"Y" analog: true] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"Circle Pad" xAxis: xAxis yAxis: yAxis analog: true] autorelease]; [directionalPads setObject: directionalPad forKey: @"Circle Pad"]; xAxis = [[[OHGameControllerAxis alloc] initWithName: @"CX" analog: true] autorelease]; yAxis = [[[OHGameControllerAxis alloc] initWithName: @"CY" analog: true] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"C-Stick" xAxis: xAxis yAxis: yAxis analog: true] autorelease]; [directionalPads setObject: directionalPad forKey: @"C-Stick"]; up = [[[OHGameControllerButton alloc] initWithName: @"D-Pad Up" analog: false] autorelease]; down = [[[OHGameControllerButton alloc] initWithName: @"D-Pad Down" analog: false] autorelease]; left = [[[OHGameControllerButton alloc] initWithName: @"D-Pad Left" analog: false] autorelease]; right = [[[OHGameControllerButton alloc] initWithName: @"D-Pad Right" analog: false] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"D-Pad" up: up down: down left: left right: right analog: false] autorelease]; [directionalPads setObject: directionalPad forKey: @"D-Pad"]; [directionalPads makeImmutable]; _directionalPads = [directionalPads retain]; objc_autoreleasePoolPop(pool); } @catch (id e) { |
︙ | ︙ |
Modified src/hid/OHNintendoDSGamepad.m from [3fa1706571] to [9daef32bf6].
︙ | ︙ | |||
42 43 44 45 46 47 48 | [OFMutableDictionary dictionaryWithCapacity: numButtons]; OHGameControllerButton *up, *down, *left, *right; OHGameControllerDirectionalPad *dPad; for (size_t i = 0; i < numButtons; i++) { OHGameControllerButton *button = [[[OHGameControllerButton alloc] | | > | > | > | > | > | > | 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 | [OFMutableDictionary dictionaryWithCapacity: numButtons]; OHGameControllerButton *up, *down, *left, *right; OHGameControllerDirectionalPad *dPad; for (size_t i = 0; i < numButtons; i++) { OHGameControllerButton *button = [[[OHGameControllerButton alloc] initWithName: buttonNames[i] analog: false] autorelease]; [buttons setObject: button forKey: buttonNames[i]]; } [buttons makeImmutable]; _buttons = [buttons retain]; up = [[[OHGameControllerButton alloc] initWithName: @"D-Pad Up" analog: false] autorelease]; down = [[[OHGameControllerButton alloc] initWithName: @"D-Pad Down" analog: false] autorelease]; left = [[[OHGameControllerButton alloc] initWithName: @"D-Pad Left" analog: false] autorelease]; right = [[[OHGameControllerButton alloc] initWithName: @"D-Pad Right" analog: false] autorelease]; dPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"D-Pad" up: up down: down left: left right: right analog: false] autorelease]; _directionalPads = [[OFDictionary alloc] initWithObject: dPad forKey: @"D-Pad"]; objc_autoreleasePoolPop(pool); } @catch (id e) { |
︙ | ︙ |
Modified src/hid/OHNintendoSwitchExtendedGamepad.m from [472015d4b9] to [50efe01c0d].
︙ | ︙ | |||
46 47 48 49 50 51 52 | OHGameControllerAxis *xAxis, *yAxis; OHGameControllerDirectionalPad *directionalPad; OHGameControllerButton *up, *down, *left, *right; for (size_t i = 0; i < numButtons; i++) { OHGameControllerButton *button = [[[OHGameControllerButton alloc] | | > | > | > | > | > | > | > | > | > | > | > | > | 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 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | OHGameControllerAxis *xAxis, *yAxis; OHGameControllerDirectionalPad *directionalPad; OHGameControllerButton *up, *down, *left, *right; for (size_t i = 0; i < numButtons; i++) { OHGameControllerButton *button = [[[OHGameControllerButton alloc] initWithName: buttonNames[i] analog: false] autorelease]; [buttons setObject: button forKey: buttonNames[i]]; } [buttons makeImmutable]; _buttons = [buttons retain]; directionalPads = [OFMutableDictionary dictionaryWithCapacity: 3]; xAxis = [[[OHGameControllerAxis alloc] initWithName: @"X" analog: true] autorelease]; yAxis = [[[OHGameControllerAxis alloc] initWithName: @"Y" analog: true] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"Left Thumbstick" xAxis: xAxis yAxis: yAxis analog: true] autorelease]; [directionalPads setObject: directionalPad forKey: @"Left Thumbstick"]; xAxis = [[[OHGameControllerAxis alloc] initWithName: @"RX" analog: true] autorelease]; yAxis = [[[OHGameControllerAxis alloc] initWithName: @"RY" analog: true] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"Right Thumbstick" xAxis: xAxis yAxis: yAxis analog: true] autorelease]; [directionalPads setObject: directionalPad forKey: @"Right Thumbstick"]; up = [[[OHGameControllerButton alloc] initWithName: @"D-Pad Up" analog: false] autorelease]; down = [[[OHGameControllerButton alloc] initWithName: @"D-Pad Down" analog: false] autorelease]; left = [[[OHGameControllerButton alloc] initWithName: @"D-Pad Left" analog: false] autorelease]; right = [[[OHGameControllerButton alloc] initWithName: @"D-Pad Right" analog: false] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"D-Pad" up: up down: down left: left right: right analog: false] autorelease]; [directionalPads setObject: directionalPad forKey: @"D-Pad"]; [directionalPads makeImmutable]; _directionalPads = [directionalPads retain]; objc_autoreleasePoolPop(pool); } @catch (id e) { |
︙ | ︙ |
Modified src/hid/OHRightJoyCon.m from [c000bbc06a] to [a138914b11].
︙ | ︙ | |||
50 51 52 53 54 55 56 | [OFMutableDictionary dictionaryWithCapacity: numButtons]; OHGameControllerAxis *xAxis, *yAxis; OHGameControllerDirectionalPad *directionalPad; for (size_t i = 0; i < numButtons; i++) { OHGameControllerButton *button = [[[OHGameControllerButton alloc] | | > | > | > | > | 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 | [OFMutableDictionary dictionaryWithCapacity: numButtons]; OHGameControllerAxis *xAxis, *yAxis; OHGameControllerDirectionalPad *directionalPad; for (size_t i = 0; i < numButtons; i++) { OHGameControllerButton *button = [[[OHGameControllerButton alloc] initWithName: buttonNames[i] analog: false] autorelease]; [buttons setObject: button forKey: buttonNames[i]]; } [buttons makeImmutable]; _buttons = [buttons retain]; xAxis = [[[OHGameControllerAxis alloc] initWithName: @"X" analog: true] autorelease]; yAxis = [[[OHGameControllerAxis alloc] initWithName: @"Y" analog: true] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"Right Thumbstick" xAxis: xAxis yAxis: yAxis analog: true] autorelease]; _directionalPads = [[OFDictionary alloc] initWithObject: directionalPad forKey: @"Right Thumbstick"]; objc_autoreleasePoolPop(pool); } @catch (id e) { |
︙ | ︙ |
Modified src/hid/OHStadiaGamepad.m from [b96e163e22] to [59e1f24ccf].
︙ | ︙ | |||
51 52 53 54 55 56 57 | OHGameControllerButton *button; OFMutableDictionary *directionalPads; OHGameControllerAxis *axis, *xAxis, *yAxis; OHGameControllerDirectionalPad *directionalPad; for (size_t i = 0; i < numButtons; i++) { button = [[[OHGameControllerButton alloc] | | > | > | > | > | > | > | > | > | > | > | > | > | 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 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | OHGameControllerButton *button; OFMutableDictionary *directionalPads; OHGameControllerAxis *axis, *xAxis, *yAxis; OHGameControllerDirectionalPad *directionalPad; for (size_t i = 0; i < numButtons; i++) { button = [[[OHGameControllerButton alloc] initWithName: buttonNames[i] analog: false] autorelease]; [buttons setObject: button forKey: buttonNames[i]]; } axis = [[[OHGameControllerAxis alloc] initWithName: @"L2" analog: true] autorelease]; button = [[[OHEmulatedGameControllerTriggerButton alloc] initWithName: @"L2" axis: axis] autorelease]; [buttons setObject: button forKey: @"L2"]; axis = [[[OHGameControllerAxis alloc] initWithName: @"R2" analog: true] autorelease]; button = [[[OHEmulatedGameControllerTriggerButton alloc] initWithName: @"R2" axis: axis] autorelease]; [buttons setObject: button forKey: @"R2"]; [buttons makeImmutable]; _buttons = [buttons retain]; directionalPads = [OFMutableDictionary dictionaryWithCapacity: 3]; xAxis = [[[OHGameControllerAxis alloc] initWithName: @"X" analog: true] autorelease]; yAxis = [[[OHGameControllerAxis alloc] initWithName: @"Y" analog: true] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"Left Stick" xAxis: xAxis yAxis: yAxis analog: true] autorelease]; [directionalPads setObject: directionalPad forKey: @"Left Stick"]; xAxis = [[[OHGameControllerAxis alloc] initWithName: @"RX" analog: true] autorelease]; yAxis = [[[OHGameControllerAxis alloc] initWithName: @"RY" analog: true] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"Right Stick" xAxis: xAxis yAxis: yAxis analog: true] autorelease]; [directionalPads setObject: directionalPad forKey: @"Right Stick"]; xAxis = [[[OHGameControllerAxis alloc] initWithName: @"D-Pad X" analog: false] autorelease]; yAxis = [[[OHGameControllerAxis alloc] initWithName: @"D-Pad Y" analog: false] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"D-Pad" xAxis: xAxis yAxis: yAxis analog: false] autorelease]; [directionalPads setObject: directionalPad forKey: @"D-Pad"]; [directionalPads makeImmutable]; _directionalPads = [directionalPads retain]; objc_autoreleasePoolPop(pool); } @catch (id e) { |
︙ | ︙ |
Modified src/hid/OHWiiClassicController.m from [a6258ae305] to [cc27368578].
︙ | ︙ | |||
45 46 47 48 49 50 51 | OHGameControllerAxis *xAxis, *yAxis; OHGameControllerDirectionalPad *directionalPad; OHGameControllerButton *up, *down, *left, *right; for (size_t i = 0; i < numButtons; i++) { OHGameControllerButton *button = [[OHGameControllerButton alloc] | | > | > | > | > | > | > | > | > | > | > | > | > | 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 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | OHGameControllerAxis *xAxis, *yAxis; OHGameControllerDirectionalPad *directionalPad; OHGameControllerButton *up, *down, *left, *right; for (size_t i = 0; i < numButtons; i++) { OHGameControllerButton *button = [[OHGameControllerButton alloc] initWithName: buttonNames[i] analog: false]; [buttons setObject: button forKey: buttonNames[i]]; } [buttons makeImmutable]; _buttons = [buttons retain]; directionalPads = [OFMutableDictionary dictionaryWithCapacity: 3]; xAxis = [[[OHGameControllerAxis alloc] initWithName: @"X" analog: true] autorelease]; yAxis = [[[OHGameControllerAxis alloc] initWithName: @"Y" analog: true] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"Left Thumbstick" xAxis: xAxis yAxis: yAxis analog: true] autorelease]; [directionalPads setObject: directionalPad forKey: @"Left Thumbstick"]; xAxis = [[[OHGameControllerAxis alloc] initWithName: @"RX" analog: true] autorelease]; yAxis = [[[OHGameControllerAxis alloc] initWithName: @"RY" analog: true] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"Right Thumbstick" xAxis: xAxis yAxis: yAxis analog: true] autorelease]; [directionalPads setObject: directionalPad forKey: @"Right Thumbstick"]; up = [[[OHGameControllerButton alloc] initWithName: @"D-Pad Up" analog: false] autorelease]; down = [[[OHGameControllerButton alloc] initWithName: @"D-Pad Down" analog: false] autorelease]; left = [[[OHGameControllerButton alloc] initWithName: @"D-Pad Left" analog: false] autorelease]; right = [[[OHGameControllerButton alloc] initWithName: @"D-Pad Right" analog: false] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"D-Pad" up: up down: down left: left right: right analog: false] autorelease]; [directionalPads setObject: directionalPad forKey: @"D-Pad"]; [directionalPads makeImmutable]; _directionalPads = [directionalPads retain]; objc_autoreleasePoolPop(pool); } @catch (id e) { |
︙ | ︙ |
Modified src/hid/OHWiimote.m from [46b6929ff6] to [f4ccfcaf1a].
︙ | ︙ | |||
44 45 46 47 48 49 50 | OHGameControllerButton *up, *down, *left, *right; buttons = [OFMutableDictionary dictionaryWithCapacity: numButtons]; for (size_t i = 0; i < numButtons; i++) { OHGameControllerButton *button = [[[OHGameControllerButton alloc] | | > | > | > | > | > | > | 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 | OHGameControllerButton *up, *down, *left, *right; buttons = [OFMutableDictionary dictionaryWithCapacity: numButtons]; for (size_t i = 0; i < numButtons; i++) { OHGameControllerButton *button = [[[OHGameControllerButton alloc] initWithName: buttonNames[i] analog: false] autorelease]; [buttons setObject: button forKey: buttonNames[i]]; } [buttons makeImmutable]; _buttons = [buttons retain]; up = [[[OHGameControllerButton alloc] initWithName: @"D-Pad Up" analog: false] autorelease]; down = [[[OHGameControllerButton alloc] initWithName: @"D-Pad Down" analog: false] autorelease]; left = [[[OHGameControllerButton alloc] initWithName: @"D-Pad Left" analog: false] autorelease]; right = [[[OHGameControllerButton alloc] initWithName: @"D-Pad Right" analog: false] autorelease]; dPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"D-Pad" up: up down: down left: left right: right analog: false] autorelease]; _directionalPads = [[OFDictionary alloc] initWithObject: dPad forKey: @"D-Pad"]; objc_autoreleasePoolPop(pool); } @catch (id e) { |
︙ | ︙ |
Modified src/hid/OHWiimoteWithNunchuk.m from [5d0d220aa4] to [7c176b4a85].
︙ | ︙ | |||
43 44 45 46 47 48 49 | [[_directionalPads mutableCopy] autorelease]; OHGameControllerAxis *xAxis, *yAxis; OHGameControllerDirectionalPad *directionalPad; for (size_t i = 0; i < numButtons; i++) { OHGameControllerButton *button = [[[OHGameControllerButton alloc] | | > | > | > | > | 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 | [[_directionalPads mutableCopy] autorelease]; OHGameControllerAxis *xAxis, *yAxis; OHGameControllerDirectionalPad *directionalPad; for (size_t i = 0; i < numButtons; i++) { OHGameControllerButton *button = [[[OHGameControllerButton alloc] initWithName: buttonNames[i] analog: false] autorelease]; [buttons setObject: button forKey: buttonNames[i]]; } xAxis = [[[OHGameControllerAxis alloc] initWithName: @"X" analog: true] autorelease]; yAxis = [[[OHGameControllerAxis alloc] initWithName: @"Y" analog: true] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"Analog Stick" xAxis: xAxis yAxis: yAxis analog: true] autorelease]; [directionalPads setObject: directionalPad forKey: @"Analog Stick"]; [buttons makeImmutable]; [_buttons release]; _buttons = [buttons retain]; |
︙ | ︙ |
Modified src/hid/OHXboxGamepad.m from [822fa91559] to [2b505e6c37].
︙ | ︙ | |||
49 50 51 52 53 54 55 56 57 58 59 60 61 62 | [OFMutableDictionary dictionaryWithCapacity: numButtons]; OFMutableDictionary *directionalPads; OHGameControllerAxis *xAxis, *yAxis; OHGameControllerDirectionalPad *directionalPad; OHGameControllerButton *up, *down, *left, *right; for (size_t i = 0; i < numButtons; i++) { OHGameControllerButton *button; if ([buttonNames[i] isEqual: @"Guide"] && !hasGuideButton) continue; button = [[[OHGameControllerButton alloc] | > > | > | > | > | > | > | > | > | > | > | > | > | > | 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 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | [OFMutableDictionary dictionaryWithCapacity: numButtons]; OFMutableDictionary *directionalPads; OHGameControllerAxis *xAxis, *yAxis; OHGameControllerDirectionalPad *directionalPad; OHGameControllerButton *up, *down, *left, *right; for (size_t i = 0; i < numButtons; i++) { bool analog = ([buttonNames[i] isEqual: @"LT"] || [buttonNames[i] isEqual: @"RT"]); OHGameControllerButton *button; if ([buttonNames[i] isEqual: @"Guide"] && !hasGuideButton) continue; button = [[[OHGameControllerButton alloc] initWithName: buttonNames[i] analog: analog] autorelease]; [buttons setObject: button forKey: buttonNames[i]]; } [buttons makeImmutable]; _buttons = [buttons retain]; directionalPads = [OFMutableDictionary dictionaryWithCapacity: 3]; xAxis = [[[OHGameControllerAxis alloc] initWithName: @"X" analog: true] autorelease]; yAxis = [[[OHGameControllerAxis alloc] initWithName: @"Y" analog: true] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"Left Thumbstick" xAxis: xAxis yAxis: yAxis analog: true] autorelease]; [directionalPads setObject: directionalPad forKey: @"Left Thumbstick"]; xAxis = [[[OHGameControllerAxis alloc] initWithName: @"RX" analog: true] autorelease]; yAxis = [[[OHGameControllerAxis alloc] initWithName: @"RY" analog: true] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"Right Thumbstick" xAxis: xAxis yAxis: yAxis analog: true] autorelease]; [directionalPads setObject: directionalPad forKey: @"Right Thumbstick"]; up = [[[OHGameControllerButton alloc] initWithName: @"D-Pad Up" analog: false] autorelease]; down = [[[OHGameControllerButton alloc] initWithName: @"D-Pad Down" analog: false] autorelease]; left = [[[OHGameControllerButton alloc] initWithName: @"D-Pad Left" analog: false] autorelease]; right = [[[OHGameControllerButton alloc] initWithName: @"D-Pad Right" analog: false] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"D-Pad" up: up down: down left: left right: right analog: false] autorelease]; [directionalPads setObject: directionalPad forKey: @"D-Pad"]; [directionalPads makeImmutable]; _directionalPads = [directionalPads retain]; objc_autoreleasePoolPop(pool); } @catch (id e) { |
︙ | ︙ |