Index: src/hid/OFGameController.h ================================================================== --- src/hid/OFGameController.h +++ src/hid/OFGameController.h @@ -41,188 +41,214 @@ /** * @brief A button on a controller. * * Possible values are: * - * * @ref OFGameControllerButtonA - * * @ref OFGameControllerButtonB - * * @ref OFGameControllerButtonC - * * @ref OFGameControllerButtonX - * * @ref OFGameControllerButtonY - * * @ref OFGameControllerButtonZ - * * @ref OFGameControllerButtonL - * * @ref OFGameControllerButtonR - * * @ref OFGameControllerButtonZL - * * @ref OFGameControllerButtonZR - * * @ref OFGameControllerButtonSelect - * * @ref OFGameControllerButtonStart - * * @ref OFGameControllerButtonHome - * * @ref OFGameControllerButtonCapture - * * @ref OFGameControllerButtonLeftStick - * * @ref OFGameControllerButtonRightStick - * * @ref OFGameControllerButtonDPadUp - * * @ref OFGameControllerButtonDPadDown - * * @ref OFGameControllerButtonDPadLeft - * * @ref OFGameControllerButtonDPadRight - * * @ref OFGameControllerButtonCPadUp - * * @ref OFGameControllerButtonCPadDown - * * @ref OFGameControllerButtonCPadLeft - * * @ref OFGameControllerButtonCPadRight - * * @ref OFGameControllerButtonSL - * * @ref OFGameControllerButtonSR - * * @ref OFGameControllerButtonMode + * * @ref OFGameControllerNorthButton + * * @ref OFGameControllerSouthButton + * * @ref OFGameControllerWestButton + * * @ref OFGameControllerEastButton + * * @ref OFGameControllerLeftTriggerButton + * * @ref OFGameControllerRightTriggerButton + * * @ref OFGameControllerLeftShoulderButton + * * @ref OFGameControllerRightShoulderButton + * * @ref OFGameControllerLeftStickButton + * * @ref OFGameControllerRightStickButton + * * @ref OFGameControllerDPadUpButton + * * @ref OFGameControllerDPadDownButton + * * @ref OFGameControllerDPadLeftButton + * * @ref OFGameControllerDPadRightButton + * * @ref OFGameControllerStartButton + * * @ref OFGameControllerSelectButton + * * @ref OFGameControllerHomeButton + * * @ref OFGameControllerCaptureButton + * * @ref OFGameControllerAButton + * * @ref OFGameControllerBButton + * * @ref OFGameControllerCButton + * * @ref OFGameControllerXButton + * * @ref OFGameControllerYButton + * * @ref OFGameControllerZButton + * * @ref OFGameControllerCPadUpButton + * * @ref OFGameControllerCPadDownButton + * * @ref OFGameControllerCPadLeftButton + * * @ref OFGameControllerCPadRightButton + * * @ref OFGameControllerPlusButton + * * @ref OFGameControllerMinusButton + * * @ref OFGameControllerSLButton + * * @ref OFGameControllerSRButton + * * @ref OFGameControllerModeButton */ typedef OFConstantString *OFGameControllerButton; #ifdef __cplusplus extern "C" { #endif /** - * @brief The A button on a game controller. - */ -extern const OFGameControllerButton OFGameControllerButtonA; - -/** - * @brief The B button on a game controller. - */ -extern const OFGameControllerButton OFGameControllerButtonB; - -/** - * @brief The C button on a game controller. - */ -extern const OFGameControllerButton OFGameControllerButtonC; - -/** - * @brief The X button on a game controller. - */ -extern const OFGameControllerButton OFGameControllerButtonX; - -/** - * @brief The Y button on a game controller. - */ -extern const OFGameControllerButton OFGameControllerButtonY; - -/** - * @brief The Z button on a game controller. - */ -extern const OFGameControllerButton OFGameControllerButtonZ; - -/** - * @brief The L button on a game controller. - */ -extern const OFGameControllerButton OFGameControllerButtonL; - -/** - * @brief The R button on a game controller. - */ -extern const OFGameControllerButton OFGameControllerButtonR; - -/** - * @brief The ZL button on a game controller. - */ -extern const OFGameControllerButton OFGameControllerButtonZL; - -/** - * @brief The ZR button on a game controller. - */ -extern const OFGameControllerButton OFGameControllerButtonZR; - -/** - * @brief The Select button on a game controller. - */ -extern const OFGameControllerButton OFGameControllerButtonSelect; - -/** - * @brief The Start button on a game controller. - */ -extern const OFGameControllerButton OFGameControllerButtonStart; - -/** - * @brief The Home button on a game controller. - */ -extern const OFGameControllerButton OFGameControllerButtonHome; - -/** - * @brief The Capture button on a game controller. - */ -extern const OFGameControllerButton OFGameControllerButtonCapture; + * @brief The north button on a game controller's diamond pad. + */ +extern const OFGameControllerButton OFGameControllerNorthButton; + +/** + * @brief The south button on a game controller's diamond pad. + */ +extern const OFGameControllerButton OFGameControllerSouthButton; + +/** + * @brief The west button on a game controller's diamond pad. + */ +extern const OFGameControllerButton OFGameControllerWestButton; + +/** + * @brief The east button on a game controller's diamond pad. + */ +extern const OFGameControllerButton OFGameControllerEastButton; + +/** + * @brief The left trigger button on a game controller. + */ +extern const OFGameControllerButton OFGameControllerLeftTriggerButton; + +/** + * @brief The right trigger button on a game controller. + */ +extern const OFGameControllerButton OFGameControllerRightTriggerButton; + +/** + * @brief The left shoulder button on a game controller. + */ +extern const OFGameControllerButton OFGameControllerLeftShoulderButton; + +/** + * @brief The right shoulder button on a game controller. + */ +extern const OFGameControllerButton OFGameControllerRightShoulderButton; /** * @brief The left stick button (pressing the left stick) on a game controller. */ -extern const OFGameControllerButton OFGameControllerButtonLeftStick; +extern const OFGameControllerButton OFGameControllerLeftStickButton; /** * @brief The right stick button (pressing the right stick) on a game * controller. */ -extern const OFGameControllerButton OFGameControllerButtonRightStick; +extern const OFGameControllerButton OFGameControllerRightStickButton; /** * @brief The D-Pad Up button on a game controller. */ -extern const OFGameControllerButton OFGameControllerButtonDPadUp; +extern const OFGameControllerButton OFGameControllerDPadUpButton; /** * @brief The D-Pad Down button on a game controller. */ -extern const OFGameControllerButton OFGameControllerButtonDPadDown; +extern const OFGameControllerButton OFGameControllerDPadDownButton; /** * @brief The D-Pad Left button on a game controller. */ -extern const OFGameControllerButton OFGameControllerButtonDPadLeft; +extern const OFGameControllerButton OFGameControllerDPadLeftButton; /** * @brief The D-Pad Right button on a game controller. */ -extern const OFGameControllerButton OFGameControllerButtonDPadRight; +extern const OFGameControllerButton OFGameControllerDPadRightButton; + +/** + * @brief The Start button on a game controller. + */ +extern const OFGameControllerButton OFGameControllerStartButton; + +/** + * @brief The Select button on a game controller. + */ +extern const OFGameControllerButton OFGameControllerSelectButton; + +/** + * @brief The Home button on a game controller. + */ +extern const OFGameControllerButton OFGameControllerHomeButton; + +/** + * @brief The Capture button on a game controller. + */ +extern const OFGameControllerButton OFGameControllerCaptureButton; + +/** + * @brief The A button on a game controller. + */ +extern const OFGameControllerButton OFGameControllerAButton; + +/** + * @brief The B button on a game controller. + */ +extern const OFGameControllerButton OFGameControllerBButton; + +/** + * @brief The C button on a game controller. + */ +extern const OFGameControllerButton OFGameControllerCButton; + +/** + * @brief The X button on a game controller. + */ +extern const OFGameControllerButton OFGameControllerXButton; + +/** + * @brief The Y button on a game controller. + */ +extern const OFGameControllerButton OFGameControllerYButton; + +/** + * @brief The Z button on a game controller. + */ +extern const OFGameControllerButton OFGameControllerZButton; /** * @brief The C-Pad Up button on a game controller. */ -extern const OFGameControllerButton OFGameControllerButtonCPadUp; +extern const OFGameControllerButton OFGameControllerCPadUpButton; /** * @brief The C-Pad Down button on a game controller. */ -extern const OFGameControllerButton OFGameControllerButtonCPadDown; +extern const OFGameControllerButton OFGameControllerCPadDownButton; /** * @brief The C-Pad Left button on a game controller. */ -extern const OFGameControllerButton OFGameControllerButtonCPadLeft; +extern const OFGameControllerButton OFGameControllerCPadLeftButton; /** * @brief The C-Pad Right button on a game controller. */ -extern const OFGameControllerButton OFGameControllerButtonCPadRight; +extern const OFGameControllerButton OFGameControllerCPadRightButton; /** * @brief The + button on a game controller. */ -extern const OFGameControllerButton OFGameControllerButtonPlus; +extern const OFGameControllerButton OFGameControllerPlusButton; /** * @brief The - button on a game controller. */ -extern const OFGameControllerButton OFGameControllerButtonMinus; +extern const OFGameControllerButton OFGameControllerMinusButton; /** * @brief The SL button on a game controller. */ -extern const OFGameControllerButton OFGameControllerButtonSL; +extern const OFGameControllerButton OFGameControllerSLButton; /** * @brief The SR button on a game controller. */ -extern const OFGameControllerButton OFGameControllerButtonSR; +extern const OFGameControllerButton OFGameControllerSRButton; /** * @brief The Mode button on a game controller. */ -extern const OFGameControllerButton OFGameControllerButtonMode; +extern const OFGameControllerButton OFGameControllerModeButton; #ifdef __cplusplus } #endif /** @@ -236,18 +262,19 @@ int _fd; uint16_t _vendorID, _productID; OFString *_name; OFMutableSet *_buttons, *_pressedButtons; bool _hasLeftAnalogStick, _hasRightAnalogStick; - bool _hasZLPressure, _hasZRPressure; + bool _hasLeftTriggerPressure, _hasRightTriggerPressure; OFPoint _leftAnalogStickPosition, _rightAnalogStickPosition; - float _ZLPressure, _ZRPressure; + float _leftTriggerPressure, _rightTriggerPressure; int32_t _leftAnalogStickMinX, _leftAnalogStickMaxX; int32_t _leftAnalogStickMinY, _leftAnalogStickMaxY; int32_t _rightAnalogStickMinX, _rightAnalogStickMaxX; int32_t _rightAnalogStickMinY, _rightAnalogStickMaxY; - int32_t _ZLMinPressure, _ZLMaxPressure, _ZRMinPressure, _ZRMaxPressure; + int32_t _leftTriggerMinPressure, _leftTriggerMaxPressure; + int32_t _rightTriggerMinPressure, _rightTriggerMaxPressure; #elif defined(OF_NINTENDO_DS) OFMutableSet *_pressedButtons; #elif defined(OF_NINTENDO_3DS) OFMutableSet *_pressedButtons; OFPoint _leftAnalogStickPosition; @@ -254,11 +281,11 @@ #elif defined(OF_WINDOWS) DWORD _index; OFNumber *_Nullable _vendorID, *_Nullable productID; OFMutableSet *_pressedButtons; OFPoint _leftAnalogStickPosition, _rightAnalogStickPosition; - float _ZLPressure, _ZRPressure; + float _leftTriggerPressure, _rightTriggerPressure; #endif } #ifdef OF_HAVE_CLASS_PROPERTIES @property (class, readonly, nonatomic) @@ -314,34 +341,10 @@ * * The range is from (-1, -1) to (1, 1). */ @property (readonly, nonatomic) OFPoint rightAnalogStickPosition; -/** - * @brief The north button on the right diamond pad or `nil` if there is none. - */ -@property OF_NULLABLE_PROPERTY (readonly, nonatomic) - OFGameControllerButton northButton; - -/** - * @brief The south button on the right diamond pad or `nil` if there is none. - */ -@property OF_NULLABLE_PROPERTY (readonly, nonatomic) - OFGameControllerButton southButton; - -/** - * @brief The west button on the right diamond pad or `nil` if there is none. - */ -@property OF_NULLABLE_PROPERTY (readonly, nonatomic) - OFGameControllerButton westButton; - -/** - * @brief The east button on the right diamond pad or `nil` if there is none. - */ -@property OF_NULLABLE_PROPERTY (readonly, nonatomic) - OFGameControllerButton eastButton; - /** * @brief Returns the available controllers. * * @return The available controllers */ Index: src/hid/OFGameController.m ================================================================== --- src/hid/OFGameController.m +++ src/hid/OFGameController.m @@ -20,39 +20,47 @@ #include "config.h" #import "OFGameController.h" #import "OFArray.h" -const OFGameControllerButton OFGameControllerButtonA = @"A"; -const OFGameControllerButton OFGameControllerButtonB = @"B"; -const OFGameControllerButton OFGameControllerButtonC = @"C"; -const OFGameControllerButton OFGameControllerButtonX = @"X"; -const OFGameControllerButton OFGameControllerButtonY = @"Y"; -const OFGameControllerButton OFGameControllerButtonZ = @"Z"; -const OFGameControllerButton OFGameControllerButtonL = @"L"; -const OFGameControllerButton OFGameControllerButtonR = @"R"; -const OFGameControllerButton OFGameControllerButtonZL = @"ZL"; -const OFGameControllerButton OFGameControllerButtonZR = @"ZR"; -const OFGameControllerButton OFGameControllerButtonSelect = @"Select"; -const OFGameControllerButton OFGameControllerButtonStart = @"Start"; -const OFGameControllerButton OFGameControllerButtonHome = @"Home"; -const OFGameControllerButton OFGameControllerButtonCapture = @"Capture"; -const OFGameControllerButton OFGameControllerButtonLeftStick = @"Left Stick"; -const OFGameControllerButton OFGameControllerButtonRightStick = @"Right Stick"; -const OFGameControllerButton OFGameControllerButtonDPadUp = @"D-Pad Up"; -const OFGameControllerButton OFGameControllerButtonDPadDown = @"D-Pad Down"; -const OFGameControllerButton OFGameControllerButtonDPadLeft = @"D-Pad Left"; -const OFGameControllerButton OFGameControllerButtonDPadRight = @"D-Pad Right"; -const OFGameControllerButton OFGameControllerButtonCPadUp = @"C-Pad Up"; -const OFGameControllerButton OFGameControllerButtonCPadDown = @"C-Pad Down"; -const OFGameControllerButton OFGameControllerButtonCPadLeft = @"C-Pad Left"; -const OFGameControllerButton OFGameControllerButtonCPadRight = @"C-Pad Right"; -const OFGameControllerButton OFGameControllerButtonPlus = @"+"; -const OFGameControllerButton OFGameControllerButtonMinus = @"-"; -const OFGameControllerButton OFGameControllerButtonSL = @"SL"; -const OFGameControllerButton OFGameControllerButtonSR = @"SR"; -const OFGameControllerButton OFGameControllerButtonMode = @"Mode"; +const OFGameControllerButton OFGameControllerNorthButton = @"North"; +const OFGameControllerButton OFGameControllerSouthButton = @"South"; +const OFGameControllerButton OFGameControllerWestButton = @"West"; +const OFGameControllerButton OFGameControllerEastButton = @"East"; +const OFGameControllerButton OFGameControllerLeftTriggerButton = + @"Left Trigger"; +const OFGameControllerButton OFGameControllerRightTriggerButton = + @"Right Trigger"; +const OFGameControllerButton OFGameControllerLeftShoulderButton = + @"Left Shoulder"; +const OFGameControllerButton OFGameControllerRightShoulderButton = + @"Right Shoulder"; +const OFGameControllerButton OFGameControllerLeftStickButton = @"Left Stick"; +const OFGameControllerButton OFGameControllerRightStickButton = @"Right Stick"; +const OFGameControllerButton OFGameControllerDPadUpButton = @"D-Pad Up"; +const OFGameControllerButton OFGameControllerDPadDownButton = @"D-Pad Down"; +const OFGameControllerButton OFGameControllerDPadLeftButton = @"D-Pad Left"; +const OFGameControllerButton OFGameControllerDPadRightButton = @"D-Pad Right"; +const OFGameControllerButton OFGameControllerStartButton = @"Start"; +const OFGameControllerButton OFGameControllerSelectButton = @"Select"; +const OFGameControllerButton OFGameControllerHomeButton = @"Home"; +const OFGameControllerButton OFGameControllerCaptureButton = @"Capture"; +const OFGameControllerButton OFGameControllerAButton = @"A"; +const OFGameControllerButton OFGameControllerBButton = @"B"; +const OFGameControllerButton OFGameControllerCButton = @"C"; +const OFGameControllerButton OFGameControllerXButton = @"X"; +const OFGameControllerButton OFGameControllerYButton = @"Y"; +const OFGameControllerButton OFGameControllerZButton = @"Z"; +const OFGameControllerButton OFGameControllerCPadUpButton = @"C-Pad Up"; +const OFGameControllerButton OFGameControllerCPadDownButton = @"C-Pad Down"; +const OFGameControllerButton OFGameControllerCPadLeftButton = @"C-Pad Left"; +const OFGameControllerButton OFGameControllerCPadRightButton = @"C-Pad Right"; +const OFGameControllerButton OFGameControllerPlusButton = @"+"; +const OFGameControllerButton OFGameControllerMinusButton = @"-"; +const OFGameControllerButton OFGameControllerSLButton = @"SL"; +const OFGameControllerButton OFGameControllerSRButton = @"SR"; +const OFGameControllerButton OFGameControllerModeButton = @"Mode"; #if defined(OF_LINUX) && defined(OF_HAVE_FILES) # include "platform/Linux/OFGameController.m" #elif defined(OF_WINDOWS) # include "platform/Windows/OFGameController.m" @@ -62,11 +70,10 @@ # include "platform/Nintendo3DS/OFGameController.m" #else @implementation OFGameController @dynamic name, buttons, pressedButtons, hasLeftAnalogStick; @dynamic leftAnalogStickPosition, hasRightAnalogStick, rightAnalogStickPosition; -@dynamic northButton, southButton, westButton, eastButton; + (OFArray OF_GENERIC(OFGameController *) *)controllers { return [OFArray array]; } Index: src/hid/platform/Linux/OFGameController.m ================================================================== --- src/hid/platform/Linux/OFGameController.m +++ src/hid/platform/Linux/OFGameController.m @@ -59,91 +59,91 @@ { if (vendorID == vendorIDNintendo && productID == productIDLeftJoycon) { switch (button) { case BTN_SELECT: - return OFGameControllerButtonMinus; - case BTN_Z: - return OFGameControllerButtonCapture; - case BTN_TR: - return OFGameControllerButtonSL; - case BTN_TR2: - return OFGameControllerButtonSR; - } - } else if (vendorID == vendorIDNintendo && - productID == productIDRightJoycon) { - switch (button) { - case BTN_B: - return OFGameControllerButtonA; - case BTN_A: - return OFGameControllerButtonB; - case BTN_START: - return OFGameControllerButtonPlus; - case BTN_TL: - return OFGameControllerButtonSL; - case BTN_TL2: - return OFGameControllerButtonSR; - } - } else if (vendorID == vendorIDNintendo && - productID == productIDN64Controller) { - switch (button) { - case BTN_TL2: - return OFGameControllerButtonZ; - case BTN_Y: - return OFGameControllerButtonCPadLeft; - case BTN_C: - return OFGameControllerButtonCPadRight; - case BTN_SELECT: - return OFGameControllerButtonCPadUp; - case BTN_X: - return OFGameControllerButtonCPadDown; - case BTN_MODE: - return OFGameControllerButtonHome; - case BTN_Z: - return OFGameControllerButtonCapture; - } - } - - switch (button) { - case BTN_A: - return OFGameControllerButtonA; - case BTN_B: - return OFGameControllerButtonB; - case BTN_C: - return OFGameControllerButtonC; - case BTN_X: - return OFGameControllerButtonX; - case BTN_Y: - return OFGameControllerButtonY; - case BTN_Z: - return OFGameControllerButtonZ; - case BTN_TL: - return OFGameControllerButtonL; - case BTN_TR: - return OFGameControllerButtonR; - case BTN_TL2: - return OFGameControllerButtonZL; - case BTN_TR2: - return OFGameControllerButtonZR; - case BTN_SELECT: - return OFGameControllerButtonSelect; - case BTN_START: - return OFGameControllerButtonStart; - case BTN_MODE: - return OFGameControllerButtonHome; - case BTN_THUMBL: - return OFGameControllerButtonLeftStick; - case BTN_THUMBR: - return OFGameControllerButtonRightStick; - case BTN_DPAD_UP: - return OFGameControllerButtonDPadUp; - case BTN_DPAD_DOWN: - return OFGameControllerButtonDPadDown; - case BTN_DPAD_LEFT: - return OFGameControllerButtonDPadLeft; - case BTN_DPAD_RIGHT: - return OFGameControllerButtonDPadRight; + return OFGameControllerMinusButton; + case BTN_Z: + return OFGameControllerCaptureButton; + case BTN_TR: + return OFGameControllerSLButton; + case BTN_TR2: + return OFGameControllerSRButton; + } + } else if (vendorID == vendorIDNintendo && + productID == productIDRightJoycon) { + switch (button) { + case BTN_X: + return OFGameControllerNorthButton; + case BTN_Y: + return OFGameControllerWestButton; + case BTN_START: + return OFGameControllerPlusButton; + case BTN_TL: + return OFGameControllerSLButton; + case BTN_TL2: + return OFGameControllerSRButton; + } + } else if (vendorID == vendorIDNintendo && + productID == productIDN64Controller) { + switch (button) { + case BTN_A: + return OFGameControllerAButton; + case BTN_B: + return OFGameControllerBButton; + case BTN_SELECT: + return OFGameControllerCPadUpButton; + case BTN_X: + return OFGameControllerCPadDownButton; + case BTN_Y: + return OFGameControllerCPadLeftButton; + case BTN_C: + return OFGameControllerCPadRightButton; + case BTN_Z: + return OFGameControllerCaptureButton; + } + } + + switch (button) { + case BTN_Y: + return OFGameControllerNorthButton; + case BTN_A: + return OFGameControllerSouthButton; + case BTN_X: + return OFGameControllerWestButton; + case BTN_B: + return OFGameControllerEastButton; + case BTN_TL2: + return OFGameControllerLeftTriggerButton; + case BTN_TR2: + return OFGameControllerRightTriggerButton; + case BTN_TL: + return OFGameControllerLeftShoulderButton; + case BTN_TR: + return OFGameControllerRightShoulderButton; + case BTN_THUMBL: + return OFGameControllerLeftStickButton; + case BTN_THUMBR: + return OFGameControllerRightStickButton; + case BTN_DPAD_UP: + return OFGameControllerDPadUpButton; + case BTN_DPAD_DOWN: + return OFGameControllerDPadDownButton; + case BTN_DPAD_LEFT: + return OFGameControllerDPadLeftButton; + case BTN_DPAD_RIGHT: + return OFGameControllerDPadRightButton; + case BTN_START: + return OFGameControllerStartButton; + case BTN_SELECT: + return OFGameControllerSelectButton; + case BTN_MODE: + return OFGameControllerHomeButton; + case BTN_C: + return OFGameControllerCButton; + case BTN_Z: + return OFGameControllerZButton; } return nil; } @@ -315,47 +315,49 @@ } if (OFBitSetIsSet(absBits, ABS_HAT0X) && OFBitSetIsSet(absBits, ABS_HAT0Y)) { [_buttons addObject: - OFGameControllerButtonDPadLeft]; + OFGameControllerDPadLeftButton]; + [_buttons addObject: + OFGameControllerDPadRightButton]; [_buttons addObject: - OFGameControllerButtonDPadRight]; + OFGameControllerDPadUpButton]; [_buttons addObject: - OFGameControllerButtonDPadUp]; - [_buttons addObject: - OFGameControllerButtonDPadDown]; + OFGameControllerDPadDownButton]; } if (OFBitSetIsSet(absBits, ABS_Z)) { struct input_absinfo info; - _hasZLPressure = true; + _hasLeftTriggerPressure = true; if (ioctl(_fd, EVIOCGABS(ABS_Z), &info) == -1) @throw [OFInitializationFailedException exception]; - _ZLMinPressure = info.minimum; - _ZLMaxPressure = info.maximum; + _leftTriggerMinPressure = info.minimum; + _leftTriggerMaxPressure = info.maximum; - [_buttons addObject: OFGameControllerButtonZL]; + [_buttons addObject: + OFGameControllerLeftTriggerButton]; } if (OFBitSetIsSet(absBits, ABS_RZ)) { struct input_absinfo info; - _hasZRPressure = true; + _hasRightTriggerPressure = true; if (ioctl(_fd, EVIOCGABS(ABS_RZ), &info) == -1) @throw [OFInitializationFailedException exception]; - _ZRMinPressure = info.minimum; - _ZRMaxPressure = info.maximum; + _rightTriggerMinPressure = info.minimum; + _rightTriggerMaxPressure = info.maximum; - [_buttons addObject: OFGameControllerButtonZR]; + [_buttons addObject: + OFGameControllerRightTriggerButton]; } } [_buttons makeImmutable]; @@ -439,64 +441,66 @@ _rightAnalogStickMaxY); break; case ABS_HAT0X: if (event.value < 0) { [_pressedButtons addObject: - OFGameControllerButtonDPadLeft]; + OFGameControllerDPadLeftButton]; [_pressedButtons removeObject: - OFGameControllerButtonDPadRight]; + OFGameControllerDPadRightButton]; } else if (event.value > 0) { [_pressedButtons addObject: - OFGameControllerButtonDPadRight]; + OFGameControllerDPadRightButton]; [_pressedButtons removeObject: - OFGameControllerButtonDPadLeft]; + OFGameControllerDPadLeftButton]; } else { [_pressedButtons removeObject: - OFGameControllerButtonDPadLeft]; + OFGameControllerDPadLeftButton]; [_pressedButtons removeObject: - OFGameControllerButtonDPadRight]; + OFGameControllerDPadRightButton]; } break; case ABS_HAT0Y: if (event.value < 0) { [_pressedButtons addObject: - OFGameControllerButtonDPadUp]; + OFGameControllerDPadUpButton]; [_pressedButtons removeObject: - OFGameControllerButtonDPadDown]; + OFGameControllerDPadDownButton]; } else if (event.value > 0) { [_pressedButtons addObject: - OFGameControllerButtonDPadDown]; + OFGameControllerDPadDownButton]; [_pressedButtons removeObject: - OFGameControllerButtonDPadUp]; + OFGameControllerDPadUpButton]; } else { [_pressedButtons removeObject: - OFGameControllerButtonDPadUp]; + OFGameControllerDPadUpButton]; [_pressedButtons removeObject: - OFGameControllerButtonDPadDown]; + OFGameControllerDPadDownButton]; } break; case ABS_Z: - _ZLPressure = scale(event.value, - _ZLMinPressure, _ZLMaxPressure); + _leftTriggerPressure = scale(event.value, + _leftTriggerMinPressure, + _leftTriggerMaxPressure); - if (_ZLPressure > 0) + if (_leftTriggerPressure > 0) [_pressedButtons addObject: - OFGameControllerButtonZL]; + OFGameControllerLeftTriggerButton]; else [_pressedButtons removeObject: - OFGameControllerButtonZL]; + OFGameControllerLeftTriggerButton]; break; case ABS_RZ: - _ZRPressure = scale(event.value, - _ZRMinPressure, _ZRMaxPressure); + _rightTriggerPressure = scale(event.value, + _rightTriggerMinPressure, + _rightTriggerMaxPressure); - if (_ZRPressure > 0) + if (_rightTriggerPressure > 0) [_pressedButtons addObject: - OFGameControllerButtonZR]; + OFGameControllerRightTriggerButton]; else [_pressedButtons removeObject: - OFGameControllerButtonZR]; + OFGameControllerRightTriggerButton]; break; } break; } @@ -527,70 +531,20 @@ return [[_pressedButtons copy] autorelease]; } - (float)pressureForButton: (OFGameControllerButton)button { - if (button == OFGameControllerButtonZL && _hasZLPressure) - return _ZLPressure; - if (button == OFGameControllerButtonZR && _hasZRPressure) - return _ZRPressure; + if (button == OFGameControllerLeftTriggerButton && + _hasLeftTriggerPressure) + return _leftTriggerPressure; + if (button == OFGameControllerRightTriggerButton && + _hasRightTriggerPressure) + return _rightTriggerPressure; return ([self.pressedButtons containsObject: button] ? 1 : 0); } -- (OFGameControllerButton)northButton -{ - if (_vendorID == vendorIDNintendo && _productID == productIDLeftJoycon) - return nil; - if (_vendorID == vendorIDNintendo && _productID == productIDRightJoycon) - return OFGameControllerButtonX; - if (_vendorID == vendorIDNintendo && - _productID == productIDN64Controller) - return nil; - - return OFGameControllerButtonY; -} - -- (OFGameControllerButton)southButton -{ - if (_vendorID == vendorIDNintendo && _productID == productIDLeftJoycon) - return nil; - if (_vendorID == vendorIDNintendo && _productID == productIDRightJoycon) - return OFGameControllerButtonB; - if (_vendorID == vendorIDNintendo && - _productID == productIDN64Controller) - return nil; - - return OFGameControllerButtonA; -} - -- (OFGameControllerButton)westButton -{ - if (_vendorID == vendorIDNintendo && _productID == productIDLeftJoycon) - return nil; - if (_vendorID == vendorIDNintendo && _productID == productIDRightJoycon) - return OFGameControllerButtonY; - if (_vendorID == vendorIDNintendo && - _productID == productIDN64Controller) - return nil; - - return OFGameControllerButtonX; -} - -- (OFGameControllerButton)eastButton -{ - if (_vendorID == vendorIDNintendo && _productID == productIDLeftJoycon) - return nil; - if (_vendorID == vendorIDNintendo && _productID == productIDRightJoycon) - return OFGameControllerButtonA; - if (_vendorID == vendorIDNintendo && - _productID == productIDN64Controller) - return nil; - - return OFGameControllerButtonB; -} - - (OFString *)description { return [OFString stringWithFormat: @"<%@: %@>", self.class, self.name]; } @end Index: src/hid/platform/Nintendo3DS/OFGameController.m ================================================================== --- src/hid/platform/Nintendo3DS/OFGameController.m +++ src/hid/platform/Nintendo3DS/OFGameController.m @@ -97,46 +97,47 @@ keys = hidKeysHeld(); hidCircleRead(&pos); [_pressedButtons removeAllObjects]; - if (keys & KEY_A) - [_pressedButtons addObject: OFGameControllerButtonA]; + if (keys & KEY_X) + [_pressedButtons addObject: OFGameControllerNorthButton]; if (keys & KEY_B) - [_pressedButtons addObject: OFGameControllerButtonB]; - if (keys & KEY_SELECT) - [_pressedButtons addObject: OFGameControllerButtonSelect]; - if (keys & KEY_START) - [_pressedButtons addObject: OFGameControllerButtonStart]; - if (keys & KEY_DRIGHT) - [_pressedButtons addObject: OFGameControllerButtonDPadRight]; - if (keys & KEY_DLEFT) - [_pressedButtons addObject: OFGameControllerButtonDPadLeft]; - if (keys & KEY_DUP) - [_pressedButtons addObject: OFGameControllerButtonDPadUp]; - if (keys & KEY_DDOWN) - [_pressedButtons addObject: OFGameControllerButtonDPadDown]; + [_pressedButtons addObject: OFGameControllerSouthButton]; + if (keys & KEY_Y) + [_pressedButtons addObject: OFGameControllerWestButton]; + if (keys & KEY_A) + [_pressedButtons addObject: OFGameControllerEastButton]; + if (keys & KEY_ZL) + [_pressedButtons addObject: OFGameControllerLeftTriggerButton]; + if (keys & KEY_ZR) + [_pressedButtons addObject: OFGameControllerRightTriggerButton]; + if (keys & KEY_L) + [_pressedButtons addObject: OFGameControllerLeftShoulderButton]; if (keys & KEY_R) - [_pressedButtons addObject: OFGameControllerButtonR]; - if (keys & KEY_L) - [_pressedButtons addObject: OFGameControllerButtonL]; - if (keys & KEY_X) - [_pressedButtons addObject: OFGameControllerButtonX]; - if (keys & KEY_Y) - [_pressedButtons addObject: OFGameControllerButtonY]; - if (keys & KEY_ZL) - [_pressedButtons addObject: OFGameControllerButtonZL]; - if (keys & KEY_ZR) - [_pressedButtons addObject: OFGameControllerButtonZR]; - if (keys & KEY_CSTICK_RIGHT) - [_pressedButtons addObject: OFGameControllerButtonCPadRight]; - if (keys & KEY_CSTICK_LEFT) - [_pressedButtons addObject: OFGameControllerButtonCPadLeft]; + [_pressedButtons addObject: + OFGameControllerRightShoulderButton]; + if (keys & KEY_DUP) + [_pressedButtons addObject: OFGameControllerDPadUpButton]; + if (keys & KEY_DDOWN) + [_pressedButtons addObject: OFGameControllerDPadDownButton]; + if (keys & KEY_DLEFT) + [_pressedButtons addObject: OFGameControllerDPadLeftButton]; + if (keys & KEY_DRIGHT) + [_pressedButtons addObject: OFGameControllerDPadRightButton]; + if (keys & KEY_START) + [_pressedButtons addObject: OFGameControllerStartButton]; + if (keys & KEY_SELECT) + [_pressedButtons addObject: OFGameControllerSelectButton]; if (keys & KEY_CSTICK_UP) - [_pressedButtons addObject: OFGameControllerButtonCPadUp]; + [_pressedButtons addObject: OFGameControllerCPadUpButton]; if (keys & KEY_CSTICK_DOWN) - [_pressedButtons addObject: OFGameControllerButtonCPadDown]; + [_pressedButtons addObject: OFGameControllerCPadDownButton]; + if (keys & KEY_CSTICK_LEFT) + [_pressedButtons addObject: OFGameControllerCPadLeftButton]; + if (keys & KEY_CSTICK_RIGHT) + [_pressedButtons addObject: OFGameControllerCPadRightButton]; _leftAnalogStickPosition = OFMakePoint( (float)pos.dx / (pos.dx < 0 ? -INT16_MIN : INT16_MAX), (float)pos.dy / (pos.dy < 0 ? -INT16_MIN : INT16_MAX)); } @@ -156,20 +157,29 @@ return nil; } - (OFSet OF_GENERIC(OFGameControllerButton) *)buttons { - return [OFSet setWithObjects: OFGameControllerButtonA, - OFGameControllerButtonB, OFGameControllerButtonSelect, - OFGameControllerButtonStart, OFGameControllerButtonDPadRight, - OFGameControllerButtonDPadLeft, OFGameControllerButtonDPadUp, - OFGameControllerButtonDPadDown, OFGameControllerButtonR, - OFGameControllerButtonL, OFGameControllerButtonX, - OFGameControllerButtonY, OFGameControllerButtonZL, - OFGameControllerButtonZR, OFGameControllerButtonCPadRight, - OFGameControllerButtonCPadLeft, OFGameControllerButtonCPadUp, - OFGameControllerButtonCPadDown, nil]; + return [OFSet setWithObjects: + OFGameControllerNorthButton, + OFGameControllerSouthButton, + OFGameControllerWestButton, + OFGameControllerEastButton, + OFGameControllerLeftTriggerButton, + OFGameControllerRightTriggerButton, + OFGameControllerRightShoulderButton, + OFGameControllerLeftShoulderButton, + OFGameControllerDPadUpButton, + OFGameControllerDPadDownButton, + OFGameControllerDPadLeftButton, + OFGameControllerDPadRightButton, + OFGameControllerStartButton, + OFGameControllerSelectButton, + OFGameControllerCPadRightButton, + OFGameControllerCPadLeftButton, + OFGameControllerCPadUpButton, + OFGameControllerCPadDownButton, nil]; } - (OFSet OF_GENERIC(OFGameControllerButton) *)pressedButtons { return [[_pressedButtons copy] autorelease]; @@ -188,30 +198,10 @@ - (float)pressureForButton: (OFGameControllerButton)button { return ([self.pressedButtons containsObject: button] ? 1 : 0); } -- (OFGameControllerButton)northButton -{ - return OFGameControllerButtonX; -} - -- (OFGameControllerButton)southButton -{ - return OFGameControllerButtonB; -} - -- (OFGameControllerButton)westButton -{ - return OFGameControllerButtonY; -} - -- (OFGameControllerButton)eastButton -{ - return OFGameControllerButtonA; -} - - (OFString *)description { return [OFString stringWithFormat: @"<%@: %@>", self.class, self.name]; } @end Index: src/hid/platform/NintendoDS/OFGameController.m ================================================================== --- src/hid/platform/NintendoDS/OFGameController.m +++ src/hid/platform/NintendoDS/OFGameController.m @@ -93,34 +93,35 @@ scanKeys(); keys = keysCurrent(); [_pressedButtons removeAllObjects]; - if (keys & KEY_A) - [_pressedButtons addObject: OFGameControllerButtonA]; + if (keys & KEY_X) + [_pressedButtons addObject: OFGameControllerNorthButton]; if (keys & KEY_B) - [_pressedButtons addObject: OFGameControllerButtonB]; - if (keys & KEY_SELECT) - [_pressedButtons addObject: OFGameControllerButtonSelect]; - if (keys & KEY_START) - [_pressedButtons addObject: OFGameControllerButtonStart]; - if (keys & KEY_RIGHT) - [_pressedButtons addObject: OFGameControllerButtonDPadRight]; - if (keys & KEY_LEFT) - [_pressedButtons addObject: OFGameControllerButtonDPadLeft]; + [_pressedButtons addObject: OFGameControllerSouthButton]; + if (keys & KEY_Y) + [_pressedButtons addObject: OFGameControllerWestButton]; + if (keys & KEY_A) + [_pressedButtons addObject: OFGameControllerEastButton]; + if (keys & KEY_L) + [_pressedButtons addObject: OFGameControllerLeftShoulderButton]; + if (keys & KEY_R) + [_pressedButtons addObject: + OFGameControllerRightShoulderButton]; if (keys & KEY_UP) - [_pressedButtons addObject: OFGameControllerButtonDPadUp]; + [_pressedButtons addObject: OFGameControllerDPadUpButton]; if (keys & KEY_DOWN) - [_pressedButtons addObject: OFGameControllerButtonDPadDown]; - if (keys & KEY_R) - [_pressedButtons addObject: OFGameControllerButtonR]; - if (keys & KEY_L) - [_pressedButtons addObject: OFGameControllerButtonL]; - if (keys & KEY_X) - [_pressedButtons addObject: OFGameControllerButtonX]; - if (keys & KEY_Y) - [_pressedButtons addObject: OFGameControllerButtonY]; + [_pressedButtons addObject: OFGameControllerDPadDownButton]; + if (keys & KEY_LEFT) + [_pressedButtons addObject: OFGameControllerDPadLeftButton]; + if (keys & KEY_RIGHT) + [_pressedButtons addObject: OFGameControllerDPadRightButton]; + if (keys & KEY_START) + [_pressedButtons addObject: OFGameControllerStartButton]; + if (keys & KEY_SELECT) + [_pressedButtons addObject: OFGameControllerSelectButton]; } - (OFString *)name { return @"Nintendo DS"; @@ -136,17 +137,23 @@ return nil; } - (OFSet OF_GENERIC(OFGameControllerButton) *)buttons { - return [OFSet setWithObjects: OFGameControllerButtonA, - OFGameControllerButtonB, OFGameControllerButtonSelect, - OFGameControllerButtonStart, OFGameControllerButtonDPadRight, - OFGameControllerButtonDPadLeft, OFGameControllerButtonDPadUp, - OFGameControllerButtonDPadDown, OFGameControllerButtonR, - OFGameControllerButtonL, OFGameControllerButtonX, - OFGameControllerButtonY, nil]; + return [OFSet setWithObjects: + OFGameControllerNorthButton, + OFGameControllerSouthButton, + OFGameControllerWestButton, + OFGameControllerEastButton, + OFGameControllerLeftShoulderButton, + OFGameControllerRightShoulderButton, + OFGameControllerDPadUpButton, + OFGameControllerDPadDownButton, + OFGameControllerDPadLeftButton, + OFGameControllerDPadRightButton, + OFGameControllerStartButton, + OFGameControllerSelectButton, nil]; } - (OFSet OF_GENERIC(OFGameControllerButton) *)pressedButtons { return [[_pressedButtons copy] autorelease]; @@ -165,30 +172,10 @@ - (float)pressureForButton: (OFGameControllerButton)button { return ([self.pressedButtons containsObject: button] ? 1 : 0); } -- (OFGameControllerButton)northButton -{ - return OFGameControllerButtonX; -} - -- (OFGameControllerButton)southButton -{ - return OFGameControllerButtonB; -} - -- (OFGameControllerButton)westButton -{ - return OFGameControllerButtonY; -} - -- (OFGameControllerButton)eastButton -{ - return OFGameControllerButtonA; -} - - (OFString *)description { return [OFString stringWithFormat: @"<%@: %@>", self.class, self.name]; } @end Index: src/hid/platform/Windows/OFGameController.m ================================================================== --- src/hid/platform/Windows/OFGameController.m +++ src/hid/platform/Windows/OFGameController.m @@ -159,46 +159,47 @@ requestedLength: sizeof(state) errNo: 0]; [_pressedButtons removeAllObjects]; - if (state.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_UP) - [_pressedButtons addObject: OFGameControllerButtonDPadUp]; - if (state.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_DOWN) - [_pressedButtons addObject: OFGameControllerButtonDPadDown]; - if (state.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_LEFT) - [_pressedButtons addObject: OFGameControllerButtonDPadLeft]; - if (state.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_RIGHT) - [_pressedButtons addObject: OFGameControllerButtonDPadRight]; - if (state.Gamepad.wButtons & XINPUT_GAMEPAD_START) - [_pressedButtons addObject: OFGameControllerButtonStart]; - if (state.Gamepad.wButtons & XINPUT_GAMEPAD_BACK) - [_pressedButtons addObject: OFGameControllerButtonSelect]; + if (state.Gamepad.wButtons & XINPUT_GAMEPAD_Y) + [_pressedButtons addObject: OFGameControllerNorthButton]; + if (state.Gamepad.wButtons & XINPUT_GAMEPAD_A) + [_pressedButtons addObject: OFGameControllerSouthButton]; + if (state.Gamepad.wButtons & XINPUT_GAMEPAD_X) + [_pressedButtons addObject: OFGameControllerWestButton]; + if (state.Gamepad.wButtons & XINPUT_GAMEPAD_B) + [_pressedButtons addObject: OFGameControllerEastButton]; + if (state.Gamepad.wButtons & XINPUT_GAMEPAD_LEFT_SHOULDER) + [_pressedButtons addObject: OFGameControllerLeftShoulderButton]; + if (state.Gamepad.wButtons & XINPUT_GAMEPAD_RIGHT_SHOULDER) + [_pressedButtons addObject: + OFGameControllerRightShoulderButton]; if (state.Gamepad.wButtons & XINPUT_GAMEPAD_LEFT_THUMB) - [_pressedButtons addObject: OFGameControllerButtonLeftStick]; + [_pressedButtons addObject: OFGameControllerLeftStickButton]; if (state.Gamepad.wButtons & XINPUT_GAMEPAD_RIGHT_THUMB) - [_pressedButtons addObject: OFGameControllerButtonRightStick]; - if (state.Gamepad.wButtons & XINPUT_GAMEPAD_LEFT_SHOULDER) - [_pressedButtons addObject: OFGameControllerButtonL]; - if (state.Gamepad.wButtons & XINPUT_GAMEPAD_RIGHT_SHOULDER) - [_pressedButtons addObject: OFGameControllerButtonR]; - if (state.Gamepad.wButtons & XINPUT_GAMEPAD_A) - [_pressedButtons addObject: OFGameControllerButtonA]; - if (state.Gamepad.wButtons & XINPUT_GAMEPAD_B) - [_pressedButtons addObject: OFGameControllerButtonB]; - if (state.Gamepad.wButtons & XINPUT_GAMEPAD_X) - [_pressedButtons addObject: OFGameControllerButtonX]; - if (state.Gamepad.wButtons & XINPUT_GAMEPAD_Y) - [_pressedButtons addObject: OFGameControllerButtonY]; - - _ZLPressure = (float)state.Gamepad.bLeftTrigger / 255; - _ZRPressure = (float)state.Gamepad.bRightTrigger / 255; - - if (_ZLPressure > 0) - [_pressedButtons addObject: OFGameControllerButtonZL]; - if (_ZRPressure > 0) - [_pressedButtons addObject: OFGameControllerButtonZR]; + [_pressedButtons addObject: OFGameControllerRightStickButton]; + if (state.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_UP) + [_pressedButtons addObject: OFGameControllerDPadUpButton]; + if (state.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_DOWN) + [_pressedButtons addObject: OFGameControllerDPadDownButton]; + if (state.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_LEFT) + [_pressedButtons addObject: OFGameControllerDPadLeftButton]; + if (state.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_RIGHT) + [_pressedButtons addObject: OFGameControllerDPadRightButton]; + if (state.Gamepad.wButtons & XINPUT_GAMEPAD_START) + [_pressedButtons addObject: OFGameControllerStartButton]; + if (state.Gamepad.wButtons & XINPUT_GAMEPAD_BACK) + [_pressedButtons addObject: OFGameControllerSelectButton]; + + _leftTriggerPressure = (float)state.Gamepad.bLeftTrigger / 255; + _rightTriggerPressure = (float)state.Gamepad.bRightTrigger / 255; + + if (_leftTriggerPressure > 0) + [_pressedButtons addObject: OFGameControllerLeftTriggerButton]; + if (_rightTriggerPressure > 0) + [_pressedButtons addObject: OFGameControllerRightTriggerButton]; _leftAnalogStickPosition = OFMakePoint( (float)state.Gamepad.sThumbLX / (state.Gamepad.sThumbLX < 0 ? -INT16_MIN : INT16_MAX), -(float)state.Gamepad.sThumbLY / @@ -216,18 +217,26 @@ } - (OFSet OF_GENERIC(OFGameControllerButton) *)buttons { return [OFSet setWithObjects: - OFGameControllerButtonA, OFGameControllerButtonB, - OFGameControllerButtonX, OFGameControllerButtonY, - OFGameControllerButtonL, OFGameControllerButtonR, - OFGameControllerButtonZL, OFGameControllerButtonZR, - OFGameControllerButtonStart, OFGameControllerButtonSelect, - OFGameControllerButtonLeftStick, OFGameControllerButtonRightStick, - OFGameControllerButtonDPadLeft, OFGameControllerButtonDPadRight, - OFGameControllerButtonDPadUp, OFGameControllerButtonDPadDown, nil]; + OFGameControllerNorthButton, + OFGameControllerSouthButton, + OFGameControllerWestButton, + OFGameControllerEastButton, + OFGameControllerLeftTriggerButton, + OFGameControllerRightTriggerButton, + OFGameControllerLeftShoulderButton, + OFGameControllerRightShoulderButton, + OFGameControllerLeftStickButton, + OFGameControllerRightStickButton, + OFGameControllerDPadLeftButton, + OFGameControllerDPadRightButton, + OFGameControllerDPadUpButton, + OFGameControllerDPadDownButton, + OFGameControllerStartButton, + OFGameControllerSelectButton, nil]; } - (OFSet OF_GENERIC(OFGameControllerButton) *)pressedButtons { return [[_pressedButtons copy] autorelease]; @@ -243,38 +252,18 @@ return true; } - (float)pressureForButton: (OFGameControllerButton)button { - if (button == OFGameControllerButtonZL) - return _ZLPressure; - if (button == OFGameControllerButtonZR) - return _ZRPressure; + if (button == OFGameControllerLeftTriggerButton) + return _leftTriggerPressure; + if (button == OFGameControllerRightTriggerButton) + return _rightTriggerPressure; return ([self.pressedButtons containsObject: button] ? 1 : 0); } -- (OFGameControllerButton)northButton -{ - return OFGameControllerButtonY; -} - -- (OFGameControllerButton)southButton -{ - return OFGameControllerButtonA; -} - -- (OFGameControllerButton)westButton -{ - return OFGameControllerButtonX; -} - -- (OFGameControllerButton)eastButton -{ - return OFGameControllerButtonB; -} - - (OFString *)description { return [OFString stringWithFormat: @"<%@: %@>", self.class, self.name]; } @end Index: src/test/OTAppDelegate.m ================================================================== --- src/test/OTAppDelegate.m +++ src/test/OTAppDelegate.m @@ -332,11 +332,12 @@ for (;;) { void *pool = objc_autoreleasePoolPush(); OFGameController *controller = [[OFGameController controllers] objectAtIndex: 0]; - if ([controller.pressedButtons containsObject: @"A"]) + if ([controller.pressedButtons containsObject: + OFGameControllerEastButton]) break; # if defined(OF_NINTENDO_DS) swiWaitForVBlank(); # elif defined(OF_NINTENDO_3DS) Index: tests/gamecontroller/GameControllerTests.m ================================================================== --- tests/gamecontroller/GameControllerTests.m +++ tests/gamecontroller/GameControllerTests.m @@ -57,15 +57,11 @@ [OFStdOut writeFormat: @" [%04X:%04X]", controller.vendorID.unsignedShortValue, controller.productID.unsignedShortValue]; } - [OFStdOut setForegroundColor: [OFColor blue]]; - [OFStdOut writeFormat: - @"\nNorth: %@ South: %@ West: %@ East: %@\n", - controller.northButton, controller.southButton, - controller.westButton, controller.eastButton]; + [OFStdOut writeString: @"\n"]; [controller retrieveState]; for (OFGameControllerButton button in buttons) { float pressure =