Index: src/hid/OHDualSenseGamepad.m ================================================================== --- src/hid/OHDualSenseGamepad.m +++ src/hid/OHDualSenseGamepad.m @@ -27,10 +27,11 @@ #import "OHGameControllerButton.h" #import "OHGameControllerDirectionalPad.h" #if defined(OF_LINUX) && defined(OF_HAVE_FILES) # include +# import "evdev_compat.h" #endif static OFString *const buttonNames[] = { @"Triangle", @"Cross", @"Square", @"Circle", @"L1", @"R1", @"L3", @"R3", @"Options", @"Create", @"PS" Index: src/hid/OHDualShock4Gamepad.m ================================================================== --- src/hid/OHDualShock4Gamepad.m +++ src/hid/OHDualShock4Gamepad.m @@ -27,10 +27,11 @@ #import "OHGameControllerButton.h" #import "OHGameControllerDirectionalPad.h" #if defined(OF_LINUX) && defined(OF_HAVE_FILES) # include +# import "evdev_compat.h" #endif static OFString *const buttonNames[] = { @"Triangle", @"Cross", @"Square", @"Circle", @"L1", @"R1", @"L3", @"R3", @"Options", @"Share", @"PS" Index: src/hid/OHEvdevGameController.m ================================================================== --- src/hid/OHEvdevGameController.m +++ src/hid/OHEvdevGameController.m @@ -56,10 +56,12 @@ #import "OFInitializationFailedException.h" #import "OFInvalidArgumentException.h" #import "OFOpenItemFailedException.h" #import "OFOutOfRangeException.h" #import "OFReadFailedException.h" + +#import "evdev_compat.h" const uint16_t OHEvdevButtonIDs[] = { BTN_A, BTN_B, BTN_C, BTN_X, BTN_Y, BTN_Z, BTN_TL, BTN_TR, BTN_TL2, BTN_TR2, BTN_SELECT, BTN_START, BTN_MODE, BTN_THUMBL, BTN_THUMBR, BTN_DPAD_UP, BTN_DPAD_DOWN, BTN_DPAD_LEFT, BTN_DPAD_RIGHT, Index: src/hid/OHEvdevGameControllerProfile.m ================================================================== --- src/hid/OHEvdevGameControllerProfile.m +++ src/hid/OHEvdevGameControllerProfile.m @@ -23,10 +23,12 @@ #import "OFDictionary.h" #import "OHGameControllerAxis.h" #import "OHGameControllerButton.h" #include + +#import "evdev_compat.h" static OFString * buttonToName(uint16_t button, uint16_t vendorID, uint16_t productID) { switch (button) { Index: src/hid/OHLeftJoyCon.m ================================================================== --- src/hid/OHLeftJoyCon.m +++ src/hid/OHLeftJoyCon.m @@ -26,10 +26,11 @@ #import "OHGameControllerButton.h" #import "OHGameControllerDirectionalPad.h" #if defined(OF_LINUX) && defined(OF_HAVE_FILES) # include +# import "evdev_compat.h" #endif static OFString *const buttonNames[] = { @"L", @"ZL", @"Left Thumbstick", @"-", @"Capture", @"SL", @"SR" }; Index: src/hid/OHRightJoyCon.m ================================================================== --- src/hid/OHRightJoyCon.m +++ src/hid/OHRightJoyCon.m @@ -26,10 +26,11 @@ #import "OHGameControllerButton.h" #import "OHGameControllerDirectionalPad.h" #if defined(OF_LINUX) && defined(OF_HAVE_FILES) # include +# import "evdev_compat.h" #endif static OFString *const buttonNames[] = { @"X", @"B", @"A", @"Y", @"R", @"ZR", @"Right Thumbstick", @"+", @"Home", @"SL", @"SR" ADDED src/hid/evdev_compat.h Index: src/hid/evdev_compat.h ================================================================== --- /dev/null +++ src/hid/evdev_compat.h @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2008-2024 Jonathan Schleifer + * + * All rights reserved. + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License version 3.0 only, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * version 3.0 for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * version 3.0 along with this program. If not, see + * . + */ + +/* Provide compatibility defines for old evdev headers. */ + +#include + +#ifndef BTN_NORTH +# define BTN_NORTH BTN_X +#endif +#ifndef BTN_SOUTH +# define BTN_SOUTH BTN_A +#endif +#ifndef BTN_WEST +# define BTN_WEST BTN_Y +#endif +#ifndef BTN_EAST +# define BTN_EAST BTN_B +#endif + +#ifndef BTN_DPAD_UP +# define BTN_DPAD_UP 0x220 +#endif +#ifndef BTN_DPAD_DOWN +# define BTN_DPAD_DOWN 0x221 +#endif +#ifndef BTN_DPAD_LEFT +# define BTN_DPAD_LEFT 0x222 +#endif +#ifndef BTN_DPAD_RIGHT +# define BTN_DPAD_RIGHT 0x223 +#endif