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
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
113
114
115
116
117
118
|
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
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
-
+
+
-
+
+
-
+
+
-
+
+
-
+
+
-
+
+
-
+
+
-
+
+
-
+
+
-
+
+
-
+
+
-
+
+
|
OHGameControllerButton *button;
OFMutableDictionary *directionalPads;
OHGameControllerAxis *axis, *xAxis, *yAxis;
OHGameControllerDirectionalPad *directionalPad;
for (size_t i = 0; i < numButtons; i++) {
button = [[[OHGameControllerButton alloc]
initWithName: buttonNames[i]] autorelease];
initWithName: buttonNames[i]
analog: false] autorelease];
[buttons setObject: button forKey: buttonNames[i]];
}
axis = [[[OHGameControllerAxis alloc]
initWithName: @"L2"] autorelease];
initWithName: @"L2"
analog: true] autorelease];
button = [[[OHEmulatedGameControllerTriggerButton alloc]
initWithName: @"L2"
axis: axis] autorelease];
[buttons setObject: button forKey: @"L2"];
axis = [[[OHGameControllerAxis alloc]
initWithName: @"R2"] autorelease];
initWithName: @"R2"
analog: true] autorelease];
button = [[[OHEmulatedGameControllerTriggerButton alloc]
initWithName: @"R2"
axis: axis] autorelease];
[buttons setObject: button forKey: @"R2"];
[buttons makeImmutable];
_buttons = [buttons retain];
directionalPads =
[OFMutableDictionary dictionaryWithCapacity: 3];
xAxis = [[[OHGameControllerAxis alloc]
initWithName: @"X"] autorelease];
initWithName: @"X"
analog: true] autorelease];
yAxis = [[[OHGameControllerAxis alloc]
initWithName: @"Y"] autorelease];
initWithName: @"Y"
analog: true] autorelease];
directionalPad = [[[OHGameControllerDirectionalPad alloc]
initWithName: @"Left Stick"
xAxis: xAxis
yAxis: yAxis] autorelease];
yAxis: yAxis
analog: true] autorelease];
[directionalPads setObject: directionalPad
forKey: @"Left Stick"];
xAxis = [[[OHGameControllerAxis alloc]
initWithName: @"RX"] autorelease];
initWithName: @"RX"
analog: true] autorelease];
yAxis = [[[OHGameControllerAxis alloc]
initWithName: @"RY"] autorelease];
initWithName: @"RY"
analog: true] autorelease];
directionalPad = [[[OHGameControllerDirectionalPad alloc]
initWithName: @"Right Stick"
xAxis: xAxis
yAxis: yAxis] autorelease];
yAxis: yAxis
analog: true] autorelease];
[directionalPads setObject: directionalPad
forKey: @"Right Stick"];
xAxis = [[[OHGameControllerAxis alloc]
initWithName: @"D-Pad X"] autorelease];
initWithName: @"D-Pad X"
analog: false] autorelease];
yAxis = [[[OHGameControllerAxis alloc]
initWithName: @"D-Pad Y"] autorelease];
initWithName: @"D-Pad Y"
analog: false] autorelease];
directionalPad = [[[OHGameControllerDirectionalPad alloc]
initWithName: @"D-Pad"
xAxis: xAxis
yAxis: yAxis] autorelease];
yAxis: yAxis
analog: false] autorelease];
[directionalPads setObject: directionalPad forKey: @"D-Pad"];
[directionalPads makeImmutable];
_directionalPads = [directionalPads retain];
objc_autoreleasePoolPop(pool);
} @catch (id e) {
|