ObjFW  Check-in [c28b5e5208]

Overview
Comment:OFGameController: Map - to Select and + to Start
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | gamecontroller
Files: files | file ages | folders
SHA3-256: c28b5e520834313c0249d55a944a18072bb623ba21e007bc06c4ee6e1cd0e815
User & Date: js on 2024-05-18 12:06:32
Other Links: branch diff | manifest | tags
Context
2024-05-19
00:06
Merge trunk into branch "gamecontroller" check-in: a13251499a user: js tags: gamecontroller
2024-05-18
12:06
OFGameController: Map - to Select and + to Start check-in: c28b5e5208 user: js tags: gamecontroller
11:37
OFGameController: More code reuse check-in: 764fe0bac3 user: js tags: gamecontroller
Changes

Modified src/hid/OFEvdevGameController.m from [3197bc7111] to [7e2448fb2d].

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
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







-
-














-
-








static OFGameControllerButton
buttonToName(uint16_t button, uint16_t vendorID, uint16_t productID)
{
	if (vendorID == vendorIDNintendo &&
	    productID == productIDLeftJoycon) {
		switch (button) {
		case BTN_SELECT:
			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_NORTH:
			return OFGameControllerNorthButton;
		case BTN_WEST:
			return OFGameControllerWestButton;
		case BTN_START:
			return OFGameControllerPlusButton;
		case BTN_TL:
			return OFGameControllerSLButton;
		case BTN_TL2:
			return OFGameControllerSRButton;
		}
	} else if (vendorID == vendorIDNintendo &&
	    productID == productIDN64Controller) {

Modified src/hid/OFGameController.h from [76e31b3ce8] to [933ce242f6].

67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
67
68
69
70
71
72
73


74
75
76
77
78
79
80







-
-







 *  * @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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
217
218
219
220
221
222
223










224
225
226
227
228
229
230







-
-
-
-
-
-
-
-
-
-







extern const OFGameControllerButton OFGameControllerCPadLeftButton;

/**
 * @brief The C-Pad Right button on a game controller.
 */
extern const OFGameControllerButton OFGameControllerCPadRightButton;

/**
 * @brief The + button on a game controller.
 */
extern const OFGameControllerButton OFGameControllerPlusButton;

/**
 * @brief The - button on a game controller.
 */
extern const OFGameControllerButton OFGameControllerMinusButton;

/**
 * @brief The SL button on a game controller.
 */
extern const OFGameControllerButton OFGameControllerSLButton;

/**
 * @brief The SR button on a game controller.

Modified src/hid/OFGameController.m from [d96cd2e808] to [70e6c920ca].

65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
65
66
67
68
69
70
71


72
73
74
75
76
77
78







-
-







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";
const OFGameControllerButton OFGameControllerAssistantButton = @"Assistant";

@implementation OFGameController
@dynamic name, buttons, pressedButtons, hasLeftAnalogStick;