25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
#import "OHGameControllerButton.h"
#include <linux/input.h>
static OFString *
buttonToName(uint16_t button, uint16_t vendorID, uint16_t productID)
{
if (vendorID == OHVendorIDNintendo &&
productID == OHProductIDLeftJoyCon) {
switch (button) {
case BTN_TL:
return @"L";
case BTN_TL2:
return @"ZL";
case BTN_THUMBL:
return @"Left Thumbstick";
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 Thumbstick";
case BTN_START:
return @"+";
case BTN_MODE:
return @"Home";
case BTN_TL:
return @"SL";
case BTN_TL2:
return @"SR";
}
}
switch (button) {
case BTN_A:
return @"A";
case BTN_B:
return @"B";
case BTN_C:
return @"C";
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#import "OHGameControllerButton.h"
#include <linux/input.h>
static OFString *
buttonToName(uint16_t button, uint16_t vendorID, uint16_t productID)
{
switch (button) {
case BTN_A:
return @"A";
case BTN_B:
return @"B";
case BTN_C:
return @"C";
|