ObjFW  Check-in [081c229439]

Overview
Comment:OHEvdevGameController: Add button map for Joy-Cons
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 081c22943991a3283a367d673ba3f654387785bda72d0b02b54931c4736e9e64
User & Date: js on 2024-06-09 02:13:08
Other Links: manifest | tags
Context
2024-06-09
09:53
OHEvdevGameController: Buttons for N64 controller check-in: f5e3072b7e user: js tags: trunk
02:13
OHEvdevGameController: Add button map for Joy-Cons check-in: 081c229439 user: js tags: trunk
01:59
ObjFWHID: Add support for Stadia controller check-in: 67c7e7c8ae user: js tags: trunk
Changes

Modified src/hid/OHEvdevGameController.m from [a742844fc7] to [e96c61a23a].

109
110
111
112
113
114
115





116
117
118

















119
120
121
122











123
124


125


126




127
128
129
130
131
132
133
134
135
			return @"R2";
		case BTN_THUMBL:
			return @"L3";
		case BTN_THUMBR:
			return @"R3";
		case BTN_START:
			return @"Options";





		case BTN_MODE:
			return @"PS";
		}

















	}

	if (vendorID == OHVendorIDSony && productID == OHProductIDDualSense)
		if (button == BTN_SELECT)











			return @"Create";
	if (vendorID == OHVendorIDSony && productID == OHProductIDDualShock4)


		if (button == BTN_SELECT)


			return @"Share";





	if (vendorID == OHVendorIDGoogle &&
	    productID == OHProductIDStadiaController) {
		switch (button) {
		case BTN_TL:
			return @"L1";
		case BTN_TR:
			return @"R1";
		case BTN_TRIGGER_HAPPY4:







>
>
>
>
>



>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
|
>
>
>
>
>
>
>
>
>
>
>
|
<
>
>
|
>
>
|
>
>
>
>
|
|







109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156

157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
			return @"R2";
		case BTN_THUMBL:
			return @"L3";
		case BTN_THUMBR:
			return @"R3";
		case BTN_START:
			return @"Options";
		case BTN_SELECT:
			if (productID == OHProductIDDualSense)
				return @"Create";
			else
				return @"Share";
		case BTN_MODE:
			return @"PS";
		}
	} else if (vendorID == OHVendorIDNintendo &&
	    productID == OHProductIDLeftJoyCon) {
		switch (button) {
		case BTN_TL:
			return @"L";
		case BTN_TL2:
			return @"ZL";
		case BTN_THUMBL:
			return @"Left Stick";
		case BTN_SELECT:
			return @"-";
		case BTN_Z:
			return @"Capture";
		case BTN_TR:
			return @"SL";
		case BTN_TR2:
			return @"SR";
		}
	} else if (vendorID == OHVendorIDNintendo &&
	    productID == OHProductIDRightJoyCon) {
		switch (button) {
		case BTN_NORTH:
			return @"X";
		case BTN_SOUTH:
			return @"B";
		case BTN_WEST:
			return @"Y";
		case BTN_EAST:
			return @"A";
		case BTN_TR:
			return @"R";
		case BTN_TR2:
			return @"ZR";

		case BTN_THUMBR:
			return @"Right Stick";
		case BTN_START:
			return @"+";
		case BTN_MODE:
			return @"Home";
		case BTN_TL:
			return @"SL";
		case BTN_TL2:
			return @"SR";
		}
	} else if (vendorID == OHVendorIDGoogle &&
	    productID == OHProductIDStadiaController) {
		switch (button) {
		case BTN_TL:
			return @"L1";
		case BTN_TR:
			return @"R1";
		case BTN_TRIGGER_HAPPY4:

Modified src/hid/OHGameController.h from [62dbcc3482] to [711330479c].

96
97
98
99
100
101
102

103
104
105


106
107
108
109
110
111
- (void)retrieveState;
@end

#ifdef __cplusplus
extern "C" {
#endif
extern const uint16_t OHVendorIDSony;

extern const uint16_t OHVendorIDGoogle;
extern const uint16_t OHProductIDDualShock4;
extern const uint16_t OHProductIDDualSense;


extern const uint16_t OHProductIDStadiaController;
#ifdef __cplusplus
}
#endif

OF_ASSUME_NONNULL_END







>



>
>






96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
- (void)retrieveState;
@end

#ifdef __cplusplus
extern "C" {
#endif
extern const uint16_t OHVendorIDSony;
extern const uint16_t OHVendorIDNintendo;
extern const uint16_t OHVendorIDGoogle;
extern const uint16_t OHProductIDDualShock4;
extern const uint16_t OHProductIDDualSense;
extern const uint16_t OHProductIDLeftJoyCon;
extern const uint16_t OHProductIDRightJoyCon;
extern const uint16_t OHProductIDStadiaController;
#ifdef __cplusplus
}
#endif

OF_ASSUME_NONNULL_END

Modified src/hid/OHGameController.m from [7219963e3b] to [1bbd2ab193].

35
36
37
38
39
40
41

42
43
44


45
46
47
48
49
50
51
# import "OHNintendoDSGameController.h"
#endif
#ifdef OF_NINTENDO_3DS
# import "OHNintendo3DSGameController.h"
#endif

const uint16_t OHVendorIDSony = 0x054C;

const uint16_t OHVendorIDGoogle = 0x18D1;
const uint16_t OHProductIDDualShock4 = 0x09CC;
const uint16_t OHProductIDDualSense = 0x0CE6;


const uint16_t OHProductIDStadiaController = 0x9400;

@implementation OHGameController
@dynamic name, rawProfile;

+ (OFArray OF_GENERIC(OHGameController *) *)controllers
{







>



>
>







35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# import "OHNintendoDSGameController.h"
#endif
#ifdef OF_NINTENDO_3DS
# import "OHNintendo3DSGameController.h"
#endif

const uint16_t OHVendorIDSony = 0x054C;
const uint16_t OHVendorIDNintendo = 0x057E;
const uint16_t OHVendorIDGoogle = 0x18D1;
const uint16_t OHProductIDDualShock4 = 0x09CC;
const uint16_t OHProductIDDualSense = 0x0CE6;
const uint16_t OHProductIDLeftJoyCon = 0x2006;
const uint16_t OHProductIDRightJoyCon = 0x2007;
const uint16_t OHProductIDStadiaController = 0x9400;

@implementation OHGameController
@dynamic name, rawProfile;

+ (OFArray OF_GENERIC(OHGameController *) *)controllers
{