Index: src/hid/OHDualSenseGamepad.m ================================================================== --- src/hid/OHDualSenseGamepad.m +++ src/hid/OHDualSenseGamepad.m @@ -54,23 +54,26 @@ OHGameControllerAxis *axis, *xAxis, *yAxis; OHGameControllerDirectionalPad *directionalPad; for (size_t i = 0; i < numButtons; i++) { button = [[[OHGameControllerButton alloc] - initWithName: buttonNames[i]] autorelease]; + initWithName: buttonNames[i] + analog: false] autorelease]; [buttons setObject: button forKey: buttonNames[i]]; } axis = [[[OHGameControllerAxis alloc] - initWithName: @"L2"] autorelease]; + initWithName: @"L2" + analog: true] autorelease]; button = [[[OHEmulatedGameControllerTriggerButton alloc] initWithName: @"L2" axis: axis] autorelease]; [buttons setObject: button forKey: @"L2"]; axis = [[[OHGameControllerAxis alloc] - initWithName: @"R2"] autorelease]; + initWithName: @"R2" + analog: true] autorelease]; button = [[[OHEmulatedGameControllerTriggerButton alloc] initWithName: @"R2" axis: axis] autorelease]; [buttons setObject: button forKey: @"R2"]; @@ -79,39 +82,48 @@ directionalPads = [OFMutableDictionary dictionaryWithCapacity: 3]; xAxis = [[[OHGameControllerAxis alloc] - initWithName: @"X"] autorelease]; + initWithName: @"X" + analog: true] autorelease]; yAxis = [[[OHGameControllerAxis alloc] - initWithName: @"Y"] autorelease]; + initWithName: @"Y" + analog: true] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"Left Stick" xAxis: xAxis - yAxis: yAxis] autorelease]; + yAxis: yAxis + analog: true] autorelease]; [directionalPads setObject: directionalPad forKey: @"Left Stick"]; xAxis = [[[OHGameControllerAxis alloc] - initWithName: @"RX"] autorelease]; + initWithName: @"RX" + analog: true] autorelease]; yAxis = [[[OHGameControllerAxis alloc] - initWithName: @"RY"] autorelease]; + initWithName: @"RY" + analog: true] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"Right Stick" xAxis: xAxis - yAxis: yAxis] autorelease]; + yAxis: yAxis + analog: true] autorelease]; [directionalPads setObject: directionalPad forKey: @"Right Stick"]; xAxis = [[[OHGameControllerAxis alloc] - initWithName: @"D-Pad X"] autorelease]; + initWithName: @"D-Pad X" + analog: false] autorelease]; yAxis = [[[OHGameControllerAxis alloc] - initWithName: @"D-Pad Y"] autorelease]; + initWithName: @"D-Pad Y" + analog: false] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"D-Pad" xAxis: xAxis - yAxis: yAxis] autorelease]; + yAxis: yAxis + analog: false] autorelease]; [directionalPads setObject: directionalPad forKey: @"D-Pad"]; [directionalPads makeImmutable]; _directionalPads = [directionalPads retain]; Index: src/hid/OHDualShock4Gamepad.m ================================================================== --- src/hid/OHDualShock4Gamepad.m +++ src/hid/OHDualShock4Gamepad.m @@ -54,23 +54,26 @@ OHGameControllerAxis *axis, *xAxis, *yAxis; OHGameControllerDirectionalPad *directionalPad; for (size_t i = 0; i < numButtons; i++) { button = [[[OHGameControllerButton alloc] - initWithName: buttonNames[i]] autorelease]; + initWithName: buttonNames[i] + analog: false] autorelease]; [buttons setObject: button forKey: buttonNames[i]]; } axis = [[[OHGameControllerAxis alloc] - initWithName: @"L2"] autorelease]; + initWithName: @"L2" + analog: true] autorelease]; button = [[[OHEmulatedGameControllerTriggerButton alloc] initWithName: @"L2" axis: axis] autorelease]; [buttons setObject: button forKey: @"L2"]; axis = [[[OHGameControllerAxis alloc] - initWithName: @"R2"] autorelease]; + initWithName: @"R2" + analog: true] autorelease]; button = [[[OHEmulatedGameControllerTriggerButton alloc] initWithName: @"R2" axis: axis] autorelease]; [buttons setObject: button forKey: @"R2"]; @@ -79,39 +82,48 @@ directionalPads = [OFMutableDictionary dictionaryWithCapacity: 3]; xAxis = [[[OHGameControllerAxis alloc] - initWithName: @"X"] autorelease]; + initWithName: @"X" + analog: true] autorelease]; yAxis = [[[OHGameControllerAxis alloc] - initWithName: @"Y"] autorelease]; + initWithName: @"Y" + analog: true] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"Left Stick" xAxis: xAxis - yAxis: yAxis] autorelease]; + yAxis: yAxis + analog: true] autorelease]; [directionalPads setObject: directionalPad forKey: @"Left Stick"]; xAxis = [[[OHGameControllerAxis alloc] - initWithName: @"RX"] autorelease]; + initWithName: @"RX" + analog: true] autorelease]; yAxis = [[[OHGameControllerAxis alloc] - initWithName: @"RY"] autorelease]; + initWithName: @"RY" + analog: true] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"Right Stick" xAxis: xAxis - yAxis: yAxis] autorelease]; + yAxis: yAxis + analog: true] autorelease]; [directionalPads setObject: directionalPad forKey: @"Right Stick"]; xAxis = [[[OHGameControllerAxis alloc] - initWithName: @"D-Pad X"] autorelease]; + initWithName: @"D-Pad X" + analog: false] autorelease]; yAxis = [[[OHGameControllerAxis alloc] - initWithName: @"D-Pad Y"] autorelease]; + initWithName: @"D-Pad Y" + analog: false] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"D-Pad" xAxis: xAxis - yAxis: yAxis] autorelease]; + yAxis: yAxis + analog: false] autorelease]; [directionalPads setObject: directionalPad forKey: @"D-Pad"]; [directionalPads makeImmutable]; _directionalPads = [directionalPads retain]; Index: src/hid/OHEmulatedGameControllerAxis.h ================================================================== --- src/hid/OHEmulatedGameControllerAxis.h +++ src/hid/OHEmulatedGameControllerAxis.h @@ -27,12 +27,14 @@ @interface OHEmulatedGameControllerAxis: OHGameControllerAxis { OHGameControllerButton *_negativeButton, *_positiveButton; } -- (instancetype)initWithName: (OFString *)name OF_UNAVAILABLE; +- (instancetype)initWithName: (OFString *)name + analog: (bool)analog OF_UNAVAILABLE; - (instancetype) initWithNegativeButton: (OHGameControllerButton *)negativeButton - positiveButton: (OHGameControllerButton *)positiveButton; + positiveButton: (OHGameControllerButton *)positiveButton + OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/hid/OHEmulatedGameControllerAxis.m ================================================================== --- src/hid/OHEmulatedGameControllerAxis.m +++ src/hid/OHEmulatedGameControllerAxis.m @@ -21,11 +21,11 @@ #import "OHEmulatedGameControllerAxis.h" #import "OHGameControllerButton.h" @implementation OHEmulatedGameControllerAxis -- (instancetype)initWithName: (OFString *)name +- (instancetype)initWithName: (OFString *)name analog: (bool)analog { OF_INVALID_INIT_METHOD } - (instancetype)initWithNegativeButton: (OHGameControllerButton *)negativeButton @@ -41,11 +41,11 @@ } @catch (id e) { [self release]; @throw e; } - self = [super initWithName: name]; + self = [super initWithName: name analog: false]; objc_autoreleasePoolPop(pool); _negativeButton = [negativeButton retain]; _positiveButton = [positiveButton retain]; Index: src/hid/OHEmulatedGameControllerButton.h ================================================================== --- src/hid/OHEmulatedGameControllerButton.h +++ src/hid/OHEmulatedGameControllerButton.h @@ -28,11 +28,12 @@ { OHGameControllerAxis *_axis; bool _positive; } -- (instancetype)initWithName: (OFString *)name OF_UNAVAILABLE; +- (instancetype)initWithName: (OFString *)name + analog: (bool)analog OF_UNAVAILABLE; - (instancetype)initWithAxis: (OHGameControllerAxis *)axis - positive: (bool)positive; + positive: (bool)positive OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/hid/OHEmulatedGameControllerButton.m ================================================================== --- src/hid/OHEmulatedGameControllerButton.m +++ src/hid/OHEmulatedGameControllerButton.m @@ -21,11 +21,11 @@ #import "OHEmulatedGameControllerButton.h" #import "OHGameControllerAxis.h" @implementation OHEmulatedGameControllerButton -- (instancetype)initWithName: (OFString *)name +- (instancetype)initWithName: (OFString *)name analog: (bool)analog { OF_INVALID_INIT_METHOD } - (instancetype)initWithAxis: (OHGameControllerAxis *)axis @@ -40,11 +40,11 @@ } @catch (id e) { [self release]; @throw e; } - self = [super initWithName: name]; + self = [super initWithName: name analog: false]; objc_autoreleasePoolPop(pool); _axis = [axis retain]; _positive = positive; Index: src/hid/OHEmulatedGameControllerTriggerButton.h ================================================================== --- src/hid/OHEmulatedGameControllerTriggerButton.h +++ src/hid/OHEmulatedGameControllerTriggerButton.h @@ -29,11 +29,13 @@ OHGameControllerAxis *_axis; } @property (readonly, nonatomic) OHGameControllerAxis *axis; -- (instancetype)initWithName: (OFString *)name OF_UNAVAILABLE; +- (instancetype)initWithName: (OFString *)name + analog: (bool)analog OF_UNAVAILABLE; - (instancetype)initWithName: (OFString *)name - axis: (OHGameControllerAxis *)axis; + axis: (OHGameControllerAxis *)axis + OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/hid/OHEmulatedGameControllerTriggerButton.m ================================================================== --- src/hid/OHEmulatedGameControllerTriggerButton.m +++ src/hid/OHEmulatedGameControllerTriggerButton.m @@ -23,19 +23,19 @@ #import "OHGameControllerAxis.h" @implementation OHEmulatedGameControllerTriggerButton @synthesize axis = _axis; -- (instancetype)initWithName: (OFString *)name +- (instancetype)initWithName: (OFString *)name analog: (bool)analog { OF_INVALID_INIT_METHOD } - (instancetype)initWithName: (OFString *)name axis: (OHGameControllerAxis *)axis { - self = [super initWithName: name]; + self = [super initWithName: name analog: true]; _axis = [axis retain]; return self; } Index: src/hid/OHEvdevExtendedGamepad.m ================================================================== --- src/hid/OHEvdevExtendedGamepad.m +++ src/hid/OHEvdevExtendedGamepad.m @@ -198,11 +198,12 @@ return nil; return [[[OHGameControllerDirectionalPad alloc] initWithName: @"Left Thumbstick" xAxis: xAxis - yAxis: yAxis] autorelease]; + yAxis: yAxis + analog: true] autorelease]; } - (OHGameControllerDirectionalPad *)rightThumbstick { OHGameControllerAxis *xAxis = [_axes objectForKey: @"RX"]; @@ -212,11 +213,12 @@ return nil; return [[[OHGameControllerDirectionalPad alloc] initWithName: @"Right Thumbstick" xAxis: xAxis - yAxis: yAxis] autorelease]; + yAxis: yAxis + analog: true] autorelease]; } - (OHGameControllerDirectionalPad *)dPad { OHGameControllerAxis *xAxis = [_axes objectForKey: @"HAT0X"]; @@ -225,11 +227,12 @@ if (xAxis != nil && yAxis != nil) return [[[OHGameControllerDirectionalPad alloc] initWithName: @"D-Pad" xAxis: xAxis - yAxis: yAxis] autorelease]; + 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"]; @@ -238,10 +241,11 @@ return [[[OHGameControllerDirectionalPad alloc] initWithName: @"D-Pad" up: up down: down left: left - right: right] autorelease]; + right: right + analog: false] autorelease]; return nil; } @end Index: src/hid/OHEvdevGameControllerProfile.m ================================================================== --- src/hid/OHEvdevGameControllerProfile.m +++ src/hid/OHEvdevGameControllerProfile.m @@ -227,11 +227,12 @@ vendorID, productID); if (buttonName == nil) continue; button = [[[OHGameControllerButton alloc] - initWithName: buttonName] autorelease]; + initWithName: buttonName + analog: false] autorelease]; [buttons setObject: button forKey: buttonName]; } } [buttons makeImmutable]; @@ -247,12 +248,13 @@ axisToName(OHEvdevAxisIDs[i]); if (axisName == nil) continue; axis = [[[OHGameControllerAxis - alloc] initWithName: axisName] - autorelease]; + alloc] + initWithName: axisName + analog: true] autorelease]; [axes setObject: axis forKey: axisName]; } } } Index: src/hid/OHExtendedN64Controller.m ================================================================== --- src/hid/OHExtendedN64Controller.m +++ src/hid/OHExtendedN64Controller.m @@ -44,11 +44,12 @@ [[_buttons mutableCopy] autorelease]; for (size_t i = 0; i < numButtons; i++) { OHGameControllerButton *button = [[[OHGameControllerButton alloc] - initWithName: buttonNames[i]] autorelease]; + initWithName: buttonNames[i] + analog: false] autorelease]; [buttons setObject: button forKey: buttonNames[i]]; } [buttons makeImmutable]; [_buttons release]; _buttons = [buttons retain]; Index: src/hid/OHGameControllerDirectionalPad.h ================================================================== --- src/hid/OHGameControllerDirectionalPad.h +++ src/hid/OHGameControllerDirectionalPad.h @@ -64,19 +64,22 @@ /** * @brief The right button of the directional pad. */ @property (readonly, nonatomic) OHGameControllerButton *right; -- (instancetype)initWithName: (OFString *)name OF_UNAVAILABLE; +- (instancetype)initWithName: (OFString *)name + analog: (bool)analog OF_UNAVAILABLE; - (instancetype)initWithName: (OFString *)name xAxis: (OHGameControllerAxis *)xAxis - yAxis: (OHGameControllerAxis *)yAxis; + yAxis: (OHGameControllerAxis *)yAxis + analog: (bool)analog; - (instancetype)initWithName: (OFString *)name up: (OHGameControllerButton *)up down: (OHGameControllerButton *)down left: (OHGameControllerButton *)left - right: (OHGameControllerButton *)right; + right: (OHGameControllerButton *)right + analog: (bool)analog; @end OF_ASSUME_NONNULL_END Index: src/hid/OHGameControllerDirectionalPad.m ================================================================== --- src/hid/OHGameControllerDirectionalPad.m +++ src/hid/OHGameControllerDirectionalPad.m @@ -25,20 +25,21 @@ @implementation OHGameControllerDirectionalPad @synthesize xAxis = _xAxis, yAxis = _yAxis; @synthesize up = _up, down = _down, left = _left, right = _right; -- (instancetype)initWithName: (OFString *)name +- (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]; + self = [super initWithName: name analog: analog]; @try { _xAxis = [xAxis retain]; _yAxis = [yAxis retain]; @@ -65,12 +66,13 @@ - (instancetype)initWithName: (OFString *)name up: (OHGameControllerButton *)up down: (OHGameControllerButton *)down left: (OHGameControllerButton *)left right: (OHGameControllerButton *)right + analog: (bool)analog { - self = [super initWithName: name]; + self = [super initWithName: name analog: analog]; @try { _up = [up retain]; _down = [down retain]; _left = [left retain]; Index: src/hid/OHGameControllerElement.h ================================================================== --- src/hid/OHGameControllerElement.h +++ src/hid/OHGameControllerElement.h @@ -54,9 +54,10 @@ */ @property (readonly, nonatomic, getter=isAnalog) bool analog; - (instancetype)init OF_UNAVAILABLE; -- (instancetype)initWithName: (OFString *)name OF_DESIGNATED_INITIALIZER; +- (instancetype)initWithName: (OFString *)name + analog: (bool)analog OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END Index: src/hid/OHGameControllerElement.m ================================================================== --- src/hid/OHGameControllerElement.m +++ src/hid/OHGameControllerElement.m @@ -28,15 +28,17 @@ { 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; } Index: src/hid/OHLeftJoyCon.m ================================================================== --- src/hid/OHLeftJoyCon.m +++ src/hid/OHLeftJoyCon.m @@ -53,44 +53,53 @@ OHGameControllerButton *up, *down, *left, *right; for (size_t i = 0; i < numButtons; i++) { OHGameControllerButton *button = [[[OHGameControllerButton alloc] - initWithName: buttonNames[i]] autorelease]; + 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"] autorelease]; + initWithName: @"X" + analog: true] autorelease]; yAxis = [[[OHGameControllerAxis alloc] - initWithName: @"Y"] autorelease]; + initWithName: @"Y" + analog: true] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"Left Thumbstick" xAxis: xAxis - yAxis: yAxis] autorelease]; + yAxis: yAxis + analog: true] autorelease]; [directionalPads setObject: directionalPad forKey: @"Left Thumbstick"]; up = [[[OHGameControllerButton alloc] - initWithName: @"D-Pad Up"] autorelease]; + initWithName: @"D-Pad Up" + analog: false] autorelease]; down = [[[OHGameControllerButton alloc] - initWithName: @"D-Pad Down"] autorelease]; + initWithName: @"D-Pad Down" + analog: false] autorelease]; left = [[[OHGameControllerButton alloc] - initWithName: @"D-Pad Left"] autorelease]; + initWithName: @"D-Pad Left" + analog: false] autorelease]; right = [[[OHGameControllerButton alloc] - initWithName: @"D-Pad Right"] autorelease]; + initWithName: @"D-Pad Right" + analog: false] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"D-Pad" up: up down: down left: left - right: right] autorelease]; + right: right + analog: false] autorelease]; [directionalPads setObject: directionalPad forKey: @"D-Pad"]; [directionalPads makeImmutable]; _directionalPads = [directionalPads retain]; Index: src/hid/OHN64Controller.m ================================================================== --- src/hid/OHN64Controller.m +++ src/hid/OHN64Controller.m @@ -52,54 +52,66 @@ OHGameControllerButton *up, *down, *left, *right; for (size_t i = 0; i < numButtons; i++) { OHGameControllerButton *button = [[[OHGameControllerButton alloc] - initWithName: buttonNames[i]] autorelease]; + 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"] autorelease]; + initWithName: @"X" + analog: true] autorelease]; yAxis = [[[OHGameControllerAxis alloc] - initWithName: @"Y"] autorelease]; + initWithName: @"Y" + analog: true] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"Thumbstick" xAxis: xAxis - yAxis: yAxis] autorelease]; + yAxis: yAxis + analog: true] autorelease]; [directionalPads setObject: directionalPad forKey: @"Thumbstick"]; xAxis = [[[OHGameControllerAxis alloc] - initWithName: @"D-Pad X"] autorelease]; + initWithName: @"D-Pad X" + analog: false] autorelease]; yAxis = [[[OHGameControllerAxis alloc] - initWithName: @"D-Pad Y"] autorelease]; + initWithName: @"D-Pad Y" + analog: false] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"D-Pad" xAxis: xAxis - yAxis: yAxis] autorelease]; + yAxis: yAxis + analog: false] autorelease]; [directionalPads setObject: directionalPad forKey: @"D-Pad"]; up = [[[OHGameControllerButton alloc] - initWithName: @"C-Up"] autorelease]; + initWithName: @"C-Up" + analog: false] autorelease]; down = [[[OHGameControllerButton alloc] - initWithName: @"C-Down"] autorelease]; + initWithName: @"C-Down" + analog: false] autorelease]; left = [[[OHGameControllerButton alloc] - initWithName: @"C-Left"] autorelease]; + initWithName: @"C-Left" + analog: false] autorelease]; right = [[[OHGameControllerButton alloc] - initWithName: @"C-Right"] autorelease]; + initWithName: @"C-Right" + analog: false] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"C-Buttons" up: up down: down left: left - right: right] autorelease]; + right: right + analog: false] autorelease]; [directionalPads setObject: directionalPad forKey: @"C-Buttons"]; [directionalPads makeImmutable]; _directionalPads = [directionalPads retain]; Index: src/hid/OHNintendo3DSExtendedGamepad.m ================================================================== --- src/hid/OHNintendo3DSExtendedGamepad.m +++ src/hid/OHNintendo3DSExtendedGamepad.m @@ -47,55 +47,67 @@ OHGameControllerButton *up, *down, *left, *right; for (size_t i = 0; i < numButtons; i++) { OHGameControllerButton *button = [[[OHGameControllerButton alloc] - initWithName: buttonNames[i]] autorelease]; + 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"] autorelease]; + initWithName: @"X" + analog: true] autorelease]; yAxis = [[[OHGameControllerAxis alloc] - initWithName: @"Y"] autorelease]; + initWithName: @"Y" + analog: true] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"Circle Pad" xAxis: xAxis - yAxis: yAxis] autorelease]; + yAxis: yAxis + analog: true] autorelease]; [directionalPads setObject: directionalPad forKey: @"Circle Pad"]; xAxis = [[[OHGameControllerAxis alloc] - initWithName: @"CX"] autorelease]; + initWithName: @"CX" + analog: true] autorelease]; yAxis = [[[OHGameControllerAxis alloc] - initWithName: @"CY"] autorelease]; + initWithName: @"CY" + analog: true] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"C-Stick" xAxis: xAxis - yAxis: yAxis] autorelease]; + yAxis: yAxis + analog: true] autorelease]; [directionalPads setObject: directionalPad forKey: @"C-Stick"]; up = [[[OHGameControllerButton alloc] - initWithName: @"D-Pad Up"] autorelease]; + initWithName: @"D-Pad Up" + analog: false] autorelease]; down = [[[OHGameControllerButton alloc] - initWithName: @"D-Pad Down"] autorelease]; + initWithName: @"D-Pad Down" + analog: false] autorelease]; left = [[[OHGameControllerButton alloc] - initWithName: @"D-Pad Left"] autorelease]; + initWithName: @"D-Pad Left" + analog: false] autorelease]; right = [[[OHGameControllerButton alloc] - initWithName: @"D-Pad Right"] autorelease]; + initWithName: @"D-Pad Right" + analog: false] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"D-Pad" up: up down: down left: left - right: right] autorelease]; + right: right + analog: false] autorelease]; [directionalPads setObject: directionalPad forKey: @"D-Pad"]; [directionalPads makeImmutable]; _directionalPads = [directionalPads retain]; Index: src/hid/OHNintendoDSGamepad.m ================================================================== --- src/hid/OHNintendoDSGamepad.m +++ src/hid/OHNintendoDSGamepad.m @@ -44,30 +44,36 @@ OHGameControllerDirectionalPad *dPad; for (size_t i = 0; i < numButtons; i++) { OHGameControllerButton *button = [[[OHGameControllerButton alloc] - initWithName: buttonNames[i]] autorelease]; + initWithName: buttonNames[i] + analog: false] autorelease]; [buttons setObject: button forKey: buttonNames[i]]; } [buttons makeImmutable]; _buttons = [buttons retain]; up = [[[OHGameControllerButton alloc] - initWithName: @"D-Pad Up"] autorelease]; + initWithName: @"D-Pad Up" + analog: false] autorelease]; down = [[[OHGameControllerButton alloc] - initWithName: @"D-Pad Down"] autorelease]; + initWithName: @"D-Pad Down" + analog: false] autorelease]; left = [[[OHGameControllerButton alloc] - initWithName: @"D-Pad Left"] autorelease]; + initWithName: @"D-Pad Left" + analog: false] autorelease]; right = [[[OHGameControllerButton alloc] - initWithName: @"D-Pad Right"] autorelease]; + initWithName: @"D-Pad Right" + analog: false] autorelease]; dPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"D-Pad" up: up down: down left: left - right: right] autorelease]; + right: right + analog: false] autorelease]; _directionalPads = [[OFDictionary alloc] initWithObject: dPad forKey: @"D-Pad"]; Index: src/hid/OHNintendoSwitchExtendedGamepad.m ================================================================== --- src/hid/OHNintendoSwitchExtendedGamepad.m +++ src/hid/OHNintendoSwitchExtendedGamepad.m @@ -48,55 +48,67 @@ OHGameControllerButton *up, *down, *left, *right; for (size_t i = 0; i < numButtons; i++) { OHGameControllerButton *button = [[[OHGameControllerButton alloc] - initWithName: buttonNames[i]] autorelease]; + 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"] autorelease]; + initWithName: @"X" + analog: true] autorelease]; yAxis = [[[OHGameControllerAxis alloc] - initWithName: @"Y"] autorelease]; + initWithName: @"Y" + analog: true] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"Left Thumbstick" xAxis: xAxis - yAxis: yAxis] autorelease]; + yAxis: yAxis + analog: true] autorelease]; [directionalPads setObject: directionalPad forKey: @"Left Thumbstick"]; xAxis = [[[OHGameControllerAxis alloc] - initWithName: @"RX"] autorelease]; + initWithName: @"RX" + analog: true] autorelease]; yAxis = [[[OHGameControllerAxis alloc] - initWithName: @"RY"] autorelease]; + initWithName: @"RY" + analog: true] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"Right Thumbstick" xAxis: xAxis - yAxis: yAxis] autorelease]; + yAxis: yAxis + analog: true] autorelease]; [directionalPads setObject: directionalPad forKey: @"Right Thumbstick"]; up = [[[OHGameControllerButton alloc] - initWithName: @"D-Pad Up"] autorelease]; + initWithName: @"D-Pad Up" + analog: false] autorelease]; down = [[[OHGameControllerButton alloc] - initWithName: @"D-Pad Down"] autorelease]; + initWithName: @"D-Pad Down" + analog: false] autorelease]; left = [[[OHGameControllerButton alloc] - initWithName: @"D-Pad Left"] autorelease]; + initWithName: @"D-Pad Left" + analog: false] autorelease]; right = [[[OHGameControllerButton alloc] - initWithName: @"D-Pad Right"] autorelease]; + initWithName: @"D-Pad Right" + analog: false] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"D-Pad" up: up down: down left: left - right: right] autorelease]; + right: right + analog: false] autorelease]; [directionalPads setObject: directionalPad forKey: @"D-Pad"]; [directionalPads makeImmutable]; _directionalPads = [directionalPads retain]; Index: src/hid/OHRightJoyCon.m ================================================================== --- src/hid/OHRightJoyCon.m +++ src/hid/OHRightJoyCon.m @@ -52,24 +52,28 @@ OHGameControllerDirectionalPad *directionalPad; for (size_t i = 0; i < numButtons; i++) { OHGameControllerButton *button = [[[OHGameControllerButton alloc] - initWithName: buttonNames[i]] autorelease]; + initWithName: buttonNames[i] + analog: false] autorelease]; [buttons setObject: button forKey: buttonNames[i]]; } [buttons makeImmutable]; _buttons = [buttons retain]; xAxis = [[[OHGameControllerAxis alloc] - initWithName: @"X"] autorelease]; + initWithName: @"X" + analog: true] autorelease]; yAxis = [[[OHGameControllerAxis alloc] - initWithName: @"Y"] autorelease]; + initWithName: @"Y" + analog: true] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"Right Thumbstick" xAxis: xAxis - yAxis: yAxis] autorelease]; + yAxis: yAxis + analog: true] autorelease]; _directionalPads = [[OFDictionary alloc] initWithObject: directionalPad forKey: @"Right Thumbstick"]; Index: src/hid/OHStadiaGamepad.m ================================================================== --- src/hid/OHStadiaGamepad.m +++ src/hid/OHStadiaGamepad.m @@ -53,23 +53,26 @@ OHGameControllerAxis *axis, *xAxis, *yAxis; OHGameControllerDirectionalPad *directionalPad; for (size_t i = 0; i < numButtons; i++) { button = [[[OHGameControllerButton alloc] - initWithName: buttonNames[i]] autorelease]; + initWithName: buttonNames[i] + analog: false] autorelease]; [buttons setObject: button forKey: buttonNames[i]]; } axis = [[[OHGameControllerAxis alloc] - initWithName: @"L2"] autorelease]; + initWithName: @"L2" + analog: true] autorelease]; button = [[[OHEmulatedGameControllerTriggerButton alloc] initWithName: @"L2" axis: axis] autorelease]; [buttons setObject: button forKey: @"L2"]; axis = [[[OHGameControllerAxis alloc] - initWithName: @"R2"] autorelease]; + initWithName: @"R2" + analog: true] autorelease]; button = [[[OHEmulatedGameControllerTriggerButton alloc] initWithName: @"R2" axis: axis] autorelease]; [buttons setObject: button forKey: @"R2"]; @@ -78,39 +81,48 @@ directionalPads = [OFMutableDictionary dictionaryWithCapacity: 3]; xAxis = [[[OHGameControllerAxis alloc] - initWithName: @"X"] autorelease]; + initWithName: @"X" + analog: true] autorelease]; yAxis = [[[OHGameControllerAxis alloc] - initWithName: @"Y"] autorelease]; + initWithName: @"Y" + analog: true] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"Left Stick" xAxis: xAxis - yAxis: yAxis] autorelease]; + yAxis: yAxis + analog: true] autorelease]; [directionalPads setObject: directionalPad forKey: @"Left Stick"]; xAxis = [[[OHGameControllerAxis alloc] - initWithName: @"RX"] autorelease]; + initWithName: @"RX" + analog: true] autorelease]; yAxis = [[[OHGameControllerAxis alloc] - initWithName: @"RY"] autorelease]; + initWithName: @"RY" + analog: true] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"Right Stick" xAxis: xAxis - yAxis: yAxis] autorelease]; + yAxis: yAxis + analog: true] autorelease]; [directionalPads setObject: directionalPad forKey: @"Right Stick"]; xAxis = [[[OHGameControllerAxis alloc] - initWithName: @"D-Pad X"] autorelease]; + initWithName: @"D-Pad X" + analog: false] autorelease]; yAxis = [[[OHGameControllerAxis alloc] - initWithName: @"D-Pad Y"] autorelease]; + initWithName: @"D-Pad Y" + analog: false] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"D-Pad" xAxis: xAxis - yAxis: yAxis] autorelease]; + yAxis: yAxis + analog: false] autorelease]; [directionalPads setObject: directionalPad forKey: @"D-Pad"]; [directionalPads makeImmutable]; _directionalPads = [directionalPads retain]; Index: src/hid/OHWiiClassicController.m ================================================================== --- src/hid/OHWiiClassicController.m +++ src/hid/OHWiiClassicController.m @@ -47,55 +47,67 @@ OHGameControllerButton *up, *down, *left, *right; for (size_t i = 0; i < numButtons; i++) { OHGameControllerButton *button = [[OHGameControllerButton alloc] - initWithName: buttonNames[i]]; + 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"] autorelease]; + initWithName: @"X" + analog: true] autorelease]; yAxis = [[[OHGameControllerAxis alloc] - initWithName: @"Y"] autorelease]; + initWithName: @"Y" + analog: true] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"Left Thumbstick" xAxis: xAxis - yAxis: yAxis] autorelease]; + yAxis: yAxis + analog: true] autorelease]; [directionalPads setObject: directionalPad forKey: @"Left Thumbstick"]; xAxis = [[[OHGameControllerAxis alloc] - initWithName: @"RX"] autorelease]; + initWithName: @"RX" + analog: true] autorelease]; yAxis = [[[OHGameControllerAxis alloc] - initWithName: @"RY"] autorelease]; + initWithName: @"RY" + analog: true] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"Right Thumbstick" xAxis: xAxis - yAxis: yAxis] autorelease]; + yAxis: yAxis + analog: true] autorelease]; [directionalPads setObject: directionalPad forKey: @"Right Thumbstick"]; up = [[[OHGameControllerButton alloc] - initWithName: @"D-Pad Up"] autorelease]; + initWithName: @"D-Pad Up" + analog: false] autorelease]; down = [[[OHGameControllerButton alloc] - initWithName: @"D-Pad Down"] autorelease]; + initWithName: @"D-Pad Down" + analog: false] autorelease]; left = [[[OHGameControllerButton alloc] - initWithName: @"D-Pad Left"] autorelease]; + initWithName: @"D-Pad Left" + analog: false] autorelease]; right = [[[OHGameControllerButton alloc] - initWithName: @"D-Pad Right"] autorelease]; + initWithName: @"D-Pad Right" + analog: false] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"D-Pad" up: up down: down left: left - right: right] autorelease]; + right: right + analog: false] autorelease]; [directionalPads setObject: directionalPad forKey: @"D-Pad"]; [directionalPads makeImmutable]; _directionalPads = [directionalPads retain]; Index: src/hid/OHWiimote.m ================================================================== --- src/hid/OHWiimote.m +++ src/hid/OHWiimote.m @@ -46,30 +46,36 @@ buttons = [OFMutableDictionary dictionaryWithCapacity: numButtons]; for (size_t i = 0; i < numButtons; i++) { OHGameControllerButton *button = [[[OHGameControllerButton alloc] - initWithName: buttonNames[i]] autorelease]; + initWithName: buttonNames[i] + analog: false] autorelease]; [buttons setObject: button forKey: buttonNames[i]]; } [buttons makeImmutable]; _buttons = [buttons retain]; up = [[[OHGameControllerButton alloc] - initWithName: @"D-Pad Up"] autorelease]; + initWithName: @"D-Pad Up" + analog: false] autorelease]; down = [[[OHGameControllerButton alloc] - initWithName: @"D-Pad Down"] autorelease]; + initWithName: @"D-Pad Down" + analog: false] autorelease]; left = [[[OHGameControllerButton alloc] - initWithName: @"D-Pad Left"] autorelease]; + initWithName: @"D-Pad Left" + analog: false] autorelease]; right = [[[OHGameControllerButton alloc] - initWithName: @"D-Pad Right"] autorelease]; + initWithName: @"D-Pad Right" + analog: false] autorelease]; dPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"D-Pad" up: up down: down left: left - right: right] autorelease]; + right: right + analog: false] autorelease]; _directionalPads = [[OFDictionary alloc] initWithObject: dPad forKey: @"D-Pad"]; Index: src/hid/OHWiimoteWithNunchuk.m ================================================================== --- src/hid/OHWiimoteWithNunchuk.m +++ src/hid/OHWiimoteWithNunchuk.m @@ -45,23 +45,27 @@ OHGameControllerDirectionalPad *directionalPad; for (size_t i = 0; i < numButtons; i++) { OHGameControllerButton *button = [[[OHGameControllerButton alloc] - initWithName: buttonNames[i]] autorelease]; + initWithName: buttonNames[i] + analog: false] autorelease]; [buttons setObject: button forKey: buttonNames[i]]; } xAxis = [[[OHGameControllerAxis alloc] - initWithName: @"X"] autorelease]; + initWithName: @"X" + analog: true] autorelease]; yAxis = [[[OHGameControllerAxis alloc] - initWithName: @"Y"] autorelease]; + initWithName: @"Y" + analog: true] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"Analog Stick" xAxis: xAxis - yAxis: yAxis] autorelease]; + yAxis: yAxis + analog: true] autorelease]; [directionalPads setObject: directionalPad forKey: @"Analog Stick"]; [buttons makeImmutable]; [_buttons release]; Index: src/hid/OHXboxGamepad.m ================================================================== --- src/hid/OHXboxGamepad.m +++ src/hid/OHXboxGamepad.m @@ -51,62 +51,76 @@ 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]] autorelease]; + 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"] autorelease]; + initWithName: @"X" + analog: true] autorelease]; yAxis = [[[OHGameControllerAxis alloc] - initWithName: @"Y"] autorelease]; + initWithName: @"Y" + analog: true] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"Left Thumbstick" xAxis: xAxis - yAxis: yAxis] autorelease]; + yAxis: yAxis + analog: true] autorelease]; [directionalPads setObject: directionalPad forKey: @"Left Thumbstick"]; xAxis = [[[OHGameControllerAxis alloc] - initWithName: @"RX"] autorelease]; + initWithName: @"RX" + analog: true] autorelease]; yAxis = [[[OHGameControllerAxis alloc] - initWithName: @"RY"] autorelease]; + initWithName: @"RY" + analog: true] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"Right Thumbstick" xAxis: xAxis - yAxis: yAxis] autorelease]; + yAxis: yAxis + analog: true] autorelease]; [directionalPads setObject: directionalPad forKey: @"Right Thumbstick"]; up = [[[OHGameControllerButton alloc] - initWithName: @"D-Pad Up"] autorelease]; + initWithName: @"D-Pad Up" + analog: false] autorelease]; down = [[[OHGameControllerButton alloc] - initWithName: @"D-Pad Down"] autorelease]; + initWithName: @"D-Pad Down" + analog: false] autorelease]; left = [[[OHGameControllerButton alloc] - initWithName: @"D-Pad Left"] autorelease]; + initWithName: @"D-Pad Left" + analog: false] autorelease]; right = [[[OHGameControllerButton alloc] - initWithName: @"D-Pad Right"] autorelease]; + initWithName: @"D-Pad Right" + analog: false] autorelease]; directionalPad = [[[OHGameControllerDirectionalPad alloc] initWithName: @"D-Pad" up: up down: down left: left - right: right] autorelease]; + right: right + analog: false] autorelease]; [directionalPads setObject: directionalPad forKey: @"D-Pad"]; [directionalPads makeImmutable]; _directionalPads = [directionalPads retain];