Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: device/gamepad/gamepad_standard_mappings_linux.cc

Issue 2808093006: [Device Service] Move Gamepad Blink headers to be part of the Gamepad client library (Closed)
Patch Set: rebase and address comments Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "device/gamepad/gamepad_standard_mappings.h" 8 #include "device/gamepad/gamepad_standard_mappings.h"
9 9
10 namespace device { 10 namespace device {
11 11
12 namespace { 12 namespace {
13 13
14 void MapperXInputStyleGamepad(const blink::WebGamepad& input, 14 void MapperXInputStyleGamepad(const Gamepad& input, Gamepad* mapped) {
15 blink::WebGamepad* mapped) {
16 *mapped = input; 15 *mapped = input;
17 mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = AxisToButton(input.axes[2]); 16 mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = AxisToButton(input.axes[2]);
18 mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = AxisToButton(input.axes[5]); 17 mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = AxisToButton(input.axes[5]);
19 mapped->buttons[BUTTON_INDEX_BACK_SELECT] = input.buttons[6]; 18 mapped->buttons[BUTTON_INDEX_BACK_SELECT] = input.buttons[6];
20 mapped->buttons[BUTTON_INDEX_START] = input.buttons[7]; 19 mapped->buttons[BUTTON_INDEX_START] = input.buttons[7];
21 mapped->buttons[BUTTON_INDEX_LEFT_THUMBSTICK] = input.buttons[9]; 20 mapped->buttons[BUTTON_INDEX_LEFT_THUMBSTICK] = input.buttons[9];
22 mapped->buttons[BUTTON_INDEX_RIGHT_THUMBSTICK] = input.buttons[10]; 21 mapped->buttons[BUTTON_INDEX_RIGHT_THUMBSTICK] = input.buttons[10];
23 mapped->buttons[BUTTON_INDEX_DPAD_UP] = AxisNegativeAsButton(input.axes[7]); 22 mapped->buttons[BUTTON_INDEX_DPAD_UP] = AxisNegativeAsButton(input.axes[7]);
24 mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = AxisPositiveAsButton(input.axes[7]); 23 mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = AxisPositiveAsButton(input.axes[7]);
25 mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = AxisNegativeAsButton(input.axes[6]); 24 mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = AxisNegativeAsButton(input.axes[6]);
26 mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] = 25 mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] =
27 AxisPositiveAsButton(input.axes[6]); 26 AxisPositiveAsButton(input.axes[6]);
28 mapped->buttons[BUTTON_INDEX_META] = input.buttons[8]; 27 mapped->buttons[BUTTON_INDEX_META] = input.buttons[8];
29 mapped->axes[AXIS_INDEX_RIGHT_STICK_X] = input.axes[3]; 28 mapped->axes[AXIS_INDEX_RIGHT_STICK_X] = input.axes[3];
30 mapped->axes[AXIS_INDEX_RIGHT_STICK_Y] = input.axes[4]; 29 mapped->axes[AXIS_INDEX_RIGHT_STICK_Y] = input.axes[4];
31 mapped->buttons_length = BUTTON_INDEX_COUNT; 30 mapped->buttons_length = BUTTON_INDEX_COUNT;
32 mapped->axes_length = AXIS_INDEX_COUNT; 31 mapped->axes_length = AXIS_INDEX_COUNT;
33 } 32 }
34 33
35 void MapperXboxOneHidGamepad(const blink::WebGamepad& input, 34 void MapperXboxOneHidGamepad(const Gamepad& input, Gamepad* mapped) {
36 blink::WebGamepad* mapped) {
37 *mapped = input; 35 *mapped = input;
38 36
39 mapped->buttons[BUTTON_INDEX_PRIMARY] = input.buttons[0]; 37 mapped->buttons[BUTTON_INDEX_PRIMARY] = input.buttons[0];
40 mapped->buttons[BUTTON_INDEX_SECONDARY] = input.buttons[1]; 38 mapped->buttons[BUTTON_INDEX_SECONDARY] = input.buttons[1];
41 mapped->buttons[BUTTON_INDEX_TERTIARY] = input.buttons[3]; 39 mapped->buttons[BUTTON_INDEX_TERTIARY] = input.buttons[3];
42 mapped->buttons[BUTTON_INDEX_QUATERNARY] = input.buttons[4]; 40 mapped->buttons[BUTTON_INDEX_QUATERNARY] = input.buttons[4];
43 mapped->buttons[BUTTON_INDEX_LEFT_SHOULDER] = input.buttons[6]; 41 mapped->buttons[BUTTON_INDEX_LEFT_SHOULDER] = input.buttons[6];
44 mapped->buttons[BUTTON_INDEX_RIGHT_SHOULDER] = input.buttons[7]; 42 mapped->buttons[BUTTON_INDEX_RIGHT_SHOULDER] = input.buttons[7];
45 mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = AxisToButton(input.axes[5]); 43 mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = AxisToButton(input.axes[5]);
46 mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = AxisToButton(input.axes[4]); 44 mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = AxisToButton(input.axes[4]);
47 mapped->buttons[BUTTON_INDEX_BACK_SELECT] = NullButton(); 45 mapped->buttons[BUTTON_INDEX_BACK_SELECT] = NullButton();
48 mapped->buttons[BUTTON_INDEX_START] = input.buttons[11]; 46 mapped->buttons[BUTTON_INDEX_START] = input.buttons[11];
49 mapped->buttons[BUTTON_INDEX_LEFT_THUMBSTICK] = input.buttons[13]; 47 mapped->buttons[BUTTON_INDEX_LEFT_THUMBSTICK] = input.buttons[13];
50 mapped->buttons[BUTTON_INDEX_RIGHT_THUMBSTICK] = input.buttons[14]; 48 mapped->buttons[BUTTON_INDEX_RIGHT_THUMBSTICK] = input.buttons[14];
51 mapped->buttons[BUTTON_INDEX_DPAD_UP] = AxisNegativeAsButton(input.axes[7]); 49 mapped->buttons[BUTTON_INDEX_DPAD_UP] = AxisNegativeAsButton(input.axes[7]);
52 mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = AxisPositiveAsButton(input.axes[7]); 50 mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = AxisPositiveAsButton(input.axes[7]);
53 mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = AxisNegativeAsButton(input.axes[6]); 51 mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = AxisNegativeAsButton(input.axes[6]);
54 mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] = 52 mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] =
55 AxisPositiveAsButton(input.axes[6]); 53 AxisPositiveAsButton(input.axes[6]);
56 mapped->axes[AXIS_INDEX_RIGHT_STICK_Y] = input.axes[3]; 54 mapped->axes[AXIS_INDEX_RIGHT_STICK_Y] = input.axes[3];
57 55
58 mapped->buttons_length = BUTTON_INDEX_COUNT - 1; /* no meta */ 56 mapped->buttons_length = BUTTON_INDEX_COUNT - 1; /* no meta */
59 mapped->axes_length = AXIS_INDEX_COUNT; 57 mapped->axes_length = AXIS_INDEX_COUNT;
60 } 58 }
61 59
62 void MapperLakeviewResearch(const blink::WebGamepad& input, 60 void MapperLakeviewResearch(const Gamepad& input, Gamepad* mapped) {
63 blink::WebGamepad* mapped) {
64 *mapped = input; 61 *mapped = input;
65 mapped->buttons[BUTTON_INDEX_PRIMARY] = input.buttons[2]; 62 mapped->buttons[BUTTON_INDEX_PRIMARY] = input.buttons[2];
66 mapped->buttons[BUTTON_INDEX_TERTIARY] = input.buttons[3]; 63 mapped->buttons[BUTTON_INDEX_TERTIARY] = input.buttons[3];
67 mapped->buttons[BUTTON_INDEX_QUATERNARY] = input.buttons[0]; 64 mapped->buttons[BUTTON_INDEX_QUATERNARY] = input.buttons[0];
68 mapped->buttons[BUTTON_INDEX_LEFT_SHOULDER] = input.buttons[6]; 65 mapped->buttons[BUTTON_INDEX_LEFT_SHOULDER] = input.buttons[6];
69 mapped->buttons[BUTTON_INDEX_RIGHT_SHOULDER] = input.buttons[7]; 66 mapped->buttons[BUTTON_INDEX_RIGHT_SHOULDER] = input.buttons[7];
70 mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = input.buttons[4]; 67 mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = input.buttons[4];
71 mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = input.buttons[5]; 68 mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = input.buttons[5];
72 mapped->buttons[BUTTON_INDEX_BACK_SELECT] = input.buttons[9]; 69 mapped->buttons[BUTTON_INDEX_BACK_SELECT] = input.buttons[9];
73 mapped->buttons[BUTTON_INDEX_START] = input.buttons[8]; 70 mapped->buttons[BUTTON_INDEX_START] = input.buttons[8];
74 mapped->buttons[BUTTON_INDEX_DPAD_UP] = AxisNegativeAsButton(input.axes[5]); 71 mapped->buttons[BUTTON_INDEX_DPAD_UP] = AxisNegativeAsButton(input.axes[5]);
75 mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = AxisPositiveAsButton(input.axes[5]); 72 mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = AxisPositiveAsButton(input.axes[5]);
76 mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = AxisNegativeAsButton(input.axes[4]); 73 mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = AxisNegativeAsButton(input.axes[4]);
77 mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] = 74 mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] =
78 AxisPositiveAsButton(input.axes[4]); 75 AxisPositiveAsButton(input.axes[4]);
79 mapped->buttons_length = BUTTON_INDEX_COUNT - 1; // no Meta on this device 76 mapped->buttons_length = BUTTON_INDEX_COUNT - 1; // no Meta on this device
80 mapped->axes_length = AXIS_INDEX_COUNT; 77 mapped->axes_length = AXIS_INDEX_COUNT;
81 } 78 }
82 79
83 void MapperPlaystationSixAxis(const blink::WebGamepad& input, 80 void MapperPlaystationSixAxis(const Gamepad& input, Gamepad* mapped) {
84 blink::WebGamepad* mapped) {
85 *mapped = input; 81 *mapped = input;
86 mapped->buttons[BUTTON_INDEX_PRIMARY] = input.buttons[14]; 82 mapped->buttons[BUTTON_INDEX_PRIMARY] = input.buttons[14];
87 mapped->buttons[BUTTON_INDEX_SECONDARY] = input.buttons[13]; 83 mapped->buttons[BUTTON_INDEX_SECONDARY] = input.buttons[13];
88 mapped->buttons[BUTTON_INDEX_TERTIARY] = input.buttons[15]; 84 mapped->buttons[BUTTON_INDEX_TERTIARY] = input.buttons[15];
89 mapped->buttons[BUTTON_INDEX_QUATERNARY] = input.buttons[12]; 85 mapped->buttons[BUTTON_INDEX_QUATERNARY] = input.buttons[12];
90 mapped->buttons[BUTTON_INDEX_LEFT_SHOULDER] = input.buttons[10]; 86 mapped->buttons[BUTTON_INDEX_LEFT_SHOULDER] = input.buttons[10];
91 mapped->buttons[BUTTON_INDEX_RIGHT_SHOULDER] = input.buttons[11]; 87 mapped->buttons[BUTTON_INDEX_RIGHT_SHOULDER] = input.buttons[11];
92 mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = AxisToButton(input.axes[12]); 88 mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = AxisToButton(input.axes[12]);
93 mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = AxisToButton(input.axes[13]); 89 mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = AxisToButton(input.axes[13]);
94 mapped->buttons[BUTTON_INDEX_BACK_SELECT] = input.buttons[0]; 90 mapped->buttons[BUTTON_INDEX_BACK_SELECT] = input.buttons[0];
95 mapped->buttons[BUTTON_INDEX_START] = input.buttons[3]; 91 mapped->buttons[BUTTON_INDEX_START] = input.buttons[3];
96 mapped->buttons[BUTTON_INDEX_LEFT_THUMBSTICK] = input.buttons[1]; 92 mapped->buttons[BUTTON_INDEX_LEFT_THUMBSTICK] = input.buttons[1];
97 mapped->buttons[BUTTON_INDEX_RIGHT_THUMBSTICK] = input.buttons[2]; 93 mapped->buttons[BUTTON_INDEX_RIGHT_THUMBSTICK] = input.buttons[2];
98 mapped->buttons[BUTTON_INDEX_DPAD_UP] = AxisToButton(input.axes[8]); 94 mapped->buttons[BUTTON_INDEX_DPAD_UP] = AxisToButton(input.axes[8]);
99 mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = AxisToButton(input.axes[10]); 95 mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = AxisToButton(input.axes[10]);
100 mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = input.buttons[7]; 96 mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = input.buttons[7];
101 mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] = AxisToButton(input.axes[9]); 97 mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] = AxisToButton(input.axes[9]);
102 mapped->buttons[BUTTON_INDEX_META] = input.buttons[16]; 98 mapped->buttons[BUTTON_INDEX_META] = input.buttons[16];
103 99
104 mapped->buttons_length = BUTTON_INDEX_COUNT; 100 mapped->buttons_length = BUTTON_INDEX_COUNT;
105 mapped->axes_length = AXIS_INDEX_COUNT; 101 mapped->axes_length = AXIS_INDEX_COUNT;
106 } 102 }
107 103
108 void MapperDualshock4(const blink::WebGamepad& input, 104 void MapperDualshock4(const Gamepad& input, Gamepad* mapped) {
109 blink::WebGamepad* mapped) {
110 enum Dualshock4Buttons { 105 enum Dualshock4Buttons {
111 DUALSHOCK_BUTTON_TOUCHPAD = BUTTON_INDEX_COUNT, 106 DUALSHOCK_BUTTON_TOUCHPAD = BUTTON_INDEX_COUNT,
112 DUALSHOCK_BUTTON_COUNT 107 DUALSHOCK_BUTTON_COUNT
113 }; 108 };
114 109
115 *mapped = input; 110 *mapped = input;
116 mapped->buttons[BUTTON_INDEX_PRIMARY] = input.buttons[1]; 111 mapped->buttons[BUTTON_INDEX_PRIMARY] = input.buttons[1];
117 mapped->buttons[BUTTON_INDEX_SECONDARY] = input.buttons[2]; 112 mapped->buttons[BUTTON_INDEX_SECONDARY] = input.buttons[2];
118 mapped->buttons[BUTTON_INDEX_TERTIARY] = input.buttons[0]; 113 mapped->buttons[BUTTON_INDEX_TERTIARY] = input.buttons[0];
119 mapped->buttons[BUTTON_INDEX_QUATERNARY] = input.buttons[3]; 114 mapped->buttons[BUTTON_INDEX_QUATERNARY] = input.buttons[3];
(...skipping 11 matching lines...) Expand all
131 mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] = 126 mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] =
132 AxisPositiveAsButton(input.axes[6]); 127 AxisPositiveAsButton(input.axes[6]);
133 mapped->buttons[BUTTON_INDEX_META] = input.buttons[12]; 128 mapped->buttons[BUTTON_INDEX_META] = input.buttons[12];
134 mapped->buttons[DUALSHOCK_BUTTON_TOUCHPAD] = input.buttons[13]; 129 mapped->buttons[DUALSHOCK_BUTTON_TOUCHPAD] = input.buttons[13];
135 mapped->axes[AXIS_INDEX_RIGHT_STICK_Y] = input.axes[5]; 130 mapped->axes[AXIS_INDEX_RIGHT_STICK_Y] = input.axes[5];
136 131
137 mapped->buttons_length = DUALSHOCK_BUTTON_COUNT; 132 mapped->buttons_length = DUALSHOCK_BUTTON_COUNT;
138 mapped->axes_length = AXIS_INDEX_COUNT; 133 mapped->axes_length = AXIS_INDEX_COUNT;
139 } 134 }
140 135
141 void MapperIBuffalo(const blink::WebGamepad& input, blink::WebGamepad* mapped) { 136 void MapperIBuffalo(const Gamepad& input, Gamepad* mapped) {
142 *mapped = input; 137 *mapped = input;
143 mapped->buttons[BUTTON_INDEX_PRIMARY] = input.buttons[1]; 138 mapped->buttons[BUTTON_INDEX_PRIMARY] = input.buttons[1];
144 mapped->buttons[BUTTON_INDEX_SECONDARY] = input.buttons[0]; 139 mapped->buttons[BUTTON_INDEX_SECONDARY] = input.buttons[0];
145 mapped->buttons[BUTTON_INDEX_TERTIARY] = input.buttons[3]; 140 mapped->buttons[BUTTON_INDEX_TERTIARY] = input.buttons[3];
146 mapped->buttons[BUTTON_INDEX_QUATERNARY] = input.buttons[2]; 141 mapped->buttons[BUTTON_INDEX_QUATERNARY] = input.buttons[2];
147 mapped->buttons[BUTTON_INDEX_BACK_SELECT] = input.buttons[6]; 142 mapped->buttons[BUTTON_INDEX_BACK_SELECT] = input.buttons[6];
148 mapped->buttons[BUTTON_INDEX_START] = input.buttons[7]; 143 mapped->buttons[BUTTON_INDEX_START] = input.buttons[7];
149 mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = input.buttons[4]; 144 mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = input.buttons[4];
150 mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = input.buttons[5]; 145 mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = input.buttons[5];
151 mapped->buttons[BUTTON_INDEX_DPAD_UP] = AxisNegativeAsButton(input.axes[1]); 146 mapped->buttons[BUTTON_INDEX_DPAD_UP] = AxisNegativeAsButton(input.axes[1]);
152 mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = AxisPositiveAsButton(input.axes[1]); 147 mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = AxisPositiveAsButton(input.axes[1]);
153 mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = AxisNegativeAsButton(input.axes[0]); 148 mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = AxisNegativeAsButton(input.axes[0]);
154 mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] = 149 mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] =
155 AxisPositiveAsButton(input.axes[0]); 150 AxisPositiveAsButton(input.axes[0]);
156 mapped->buttons_length = BUTTON_INDEX_COUNT - 1; /* no meta */ 151 mapped->buttons_length = BUTTON_INDEX_COUNT - 1; /* no meta */
157 mapped->axes_length = 2; 152 mapped->axes_length = 2;
158 } 153 }
159 154
160 void MapperXGEAR(const blink::WebGamepad& input, blink::WebGamepad* mapped) { 155 void MapperXGEAR(const Gamepad& input, Gamepad* mapped) {
161 *mapped = input; 156 *mapped = input;
162 mapped->buttons[BUTTON_INDEX_PRIMARY] = input.buttons[2]; 157 mapped->buttons[BUTTON_INDEX_PRIMARY] = input.buttons[2];
163 mapped->buttons[BUTTON_INDEX_SECONDARY] = input.buttons[1]; 158 mapped->buttons[BUTTON_INDEX_SECONDARY] = input.buttons[1];
164 mapped->buttons[BUTTON_INDEX_TERTIARY] = input.buttons[3]; 159 mapped->buttons[BUTTON_INDEX_TERTIARY] = input.buttons[3];
165 mapped->buttons[BUTTON_INDEX_QUATERNARY] = input.buttons[0]; 160 mapped->buttons[BUTTON_INDEX_QUATERNARY] = input.buttons[0];
166 mapped->buttons[BUTTON_INDEX_LEFT_SHOULDER] = input.buttons[6]; 161 mapped->buttons[BUTTON_INDEX_LEFT_SHOULDER] = input.buttons[6];
167 mapped->buttons[BUTTON_INDEX_RIGHT_SHOULDER] = input.buttons[7]; 162 mapped->buttons[BUTTON_INDEX_RIGHT_SHOULDER] = input.buttons[7];
168 mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = input.buttons[4]; 163 mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = input.buttons[4];
169 mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = input.buttons[5]; 164 mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = input.buttons[5];
170 mapped->buttons[BUTTON_INDEX_DPAD_UP] = AxisNegativeAsButton(input.axes[5]); 165 mapped->buttons[BUTTON_INDEX_DPAD_UP] = AxisNegativeAsButton(input.axes[5]);
171 mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = AxisPositiveAsButton(input.axes[5]); 166 mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = AxisPositiveAsButton(input.axes[5]);
172 mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = AxisNegativeAsButton(input.axes[4]); 167 mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = AxisNegativeAsButton(input.axes[4]);
173 mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] = 168 mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] =
174 AxisPositiveAsButton(input.axes[4]); 169 AxisPositiveAsButton(input.axes[4]);
175 mapped->axes[AXIS_INDEX_RIGHT_STICK_X] = input.axes[3]; 170 mapped->axes[AXIS_INDEX_RIGHT_STICK_X] = input.axes[3];
176 mapped->axes[AXIS_INDEX_RIGHT_STICK_Y] = input.axes[2]; 171 mapped->axes[AXIS_INDEX_RIGHT_STICK_Y] = input.axes[2];
177 mapped->buttons_length = BUTTON_INDEX_COUNT - 1; // no Meta on this device 172 mapped->buttons_length = BUTTON_INDEX_COUNT - 1; // no Meta on this device
178 mapped->axes_length = AXIS_INDEX_COUNT; 173 mapped->axes_length = AXIS_INDEX_COUNT;
179 } 174 }
180 175
181 void MapperDragonRiseGeneric(const blink::WebGamepad& input, 176 void MapperDragonRiseGeneric(const Gamepad& input, Gamepad* mapped) {
182 blink::WebGamepad* mapped) {
183 *mapped = input; 177 *mapped = input;
184 mapped->buttons[BUTTON_INDEX_DPAD_UP] = AxisNegativeAsButton(input.axes[6]); 178 mapped->buttons[BUTTON_INDEX_DPAD_UP] = AxisNegativeAsButton(input.axes[6]);
185 mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = AxisPositiveAsButton(input.axes[6]); 179 mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = AxisPositiveAsButton(input.axes[6]);
186 mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = AxisNegativeAsButton(input.axes[5]); 180 mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = AxisNegativeAsButton(input.axes[5]);
187 mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] = 181 mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] =
188 AxisPositiveAsButton(input.axes[5]); 182 AxisPositiveAsButton(input.axes[5]);
189 mapped->axes[AXIS_INDEX_LEFT_STICK_X] = input.axes[0]; 183 mapped->axes[AXIS_INDEX_LEFT_STICK_X] = input.axes[0];
190 mapped->axes[AXIS_INDEX_LEFT_STICK_Y] = input.axes[1]; 184 mapped->axes[AXIS_INDEX_LEFT_STICK_Y] = input.axes[1];
191 mapped->axes[AXIS_INDEX_RIGHT_STICK_X] = input.axes[3]; 185 mapped->axes[AXIS_INDEX_RIGHT_STICK_X] = input.axes[3];
192 mapped->axes[AXIS_INDEX_RIGHT_STICK_Y] = input.axes[4]; 186 mapped->axes[AXIS_INDEX_RIGHT_STICK_Y] = input.axes[4];
193 mapped->buttons_length = BUTTON_INDEX_COUNT - 1; // no Meta on this device 187 mapped->buttons_length = BUTTON_INDEX_COUNT - 1; // no Meta on this device
194 mapped->axes_length = AXIS_INDEX_COUNT; 188 mapped->axes_length = AXIS_INDEX_COUNT;
195 } 189 }
196 190
197 void MapperOnLiveWireless(const blink::WebGamepad& input, 191 void MapperOnLiveWireless(const Gamepad& input, Gamepad* mapped) {
198 blink::WebGamepad* mapped) {
199 *mapped = input; 192 *mapped = input;
200 mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = AxisToButton(input.axes[2]); 193 mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = AxisToButton(input.axes[2]);
201 mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = AxisToButton(input.axes[5]); 194 mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = AxisToButton(input.axes[5]);
202 mapped->buttons[BUTTON_INDEX_BACK_SELECT] = input.buttons[6]; 195 mapped->buttons[BUTTON_INDEX_BACK_SELECT] = input.buttons[6];
203 mapped->buttons[BUTTON_INDEX_START] = input.buttons[7]; 196 mapped->buttons[BUTTON_INDEX_START] = input.buttons[7];
204 mapped->buttons[BUTTON_INDEX_LEFT_THUMBSTICK] = input.buttons[9]; 197 mapped->buttons[BUTTON_INDEX_LEFT_THUMBSTICK] = input.buttons[9];
205 mapped->buttons[BUTTON_INDEX_RIGHT_THUMBSTICK] = input.buttons[10]; 198 mapped->buttons[BUTTON_INDEX_RIGHT_THUMBSTICK] = input.buttons[10];
206 mapped->buttons[BUTTON_INDEX_DPAD_UP] = AxisNegativeAsButton(input.axes[7]); 199 mapped->buttons[BUTTON_INDEX_DPAD_UP] = AxisNegativeAsButton(input.axes[7]);
207 mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = AxisPositiveAsButton(input.axes[7]); 200 mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = AxisPositiveAsButton(input.axes[7]);
208 mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = AxisNegativeAsButton(input.axes[6]); 201 mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = AxisNegativeAsButton(input.axes[6]);
209 mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] = 202 mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] =
210 AxisPositiveAsButton(input.axes[6]); 203 AxisPositiveAsButton(input.axes[6]);
211 mapped->buttons[BUTTON_INDEX_META] = input.buttons[8]; 204 mapped->buttons[BUTTON_INDEX_META] = input.buttons[8];
212 mapped->axes[AXIS_INDEX_RIGHT_STICK_X] = input.axes[3]; 205 mapped->axes[AXIS_INDEX_RIGHT_STICK_X] = input.axes[3];
213 mapped->axes[AXIS_INDEX_RIGHT_STICK_Y] = input.axes[4]; 206 mapped->axes[AXIS_INDEX_RIGHT_STICK_Y] = input.axes[4];
214 207
215 mapped->buttons_length = BUTTON_INDEX_COUNT; 208 mapped->buttons_length = BUTTON_INDEX_COUNT;
216 mapped->axes_length = AXIS_INDEX_COUNT; 209 mapped->axes_length = AXIS_INDEX_COUNT;
217 } 210 }
218 211
219 void MapperADT1(const blink::WebGamepad& input, blink::WebGamepad* mapped) { 212 void MapperADT1(const Gamepad& input, Gamepad* mapped) {
220 *mapped = input; 213 *mapped = input;
221 mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = AxisToButton(input.axes[5]); 214 mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = AxisToButton(input.axes[5]);
222 mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = AxisToButton(input.axes[4]); 215 mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = AxisToButton(input.axes[4]);
223 mapped->buttons[BUTTON_INDEX_BACK_SELECT] = NullButton(); 216 mapped->buttons[BUTTON_INDEX_BACK_SELECT] = NullButton();
224 mapped->buttons[BUTTON_INDEX_START] = NullButton(); 217 mapped->buttons[BUTTON_INDEX_START] = NullButton();
225 mapped->buttons[BUTTON_INDEX_LEFT_THUMBSTICK] = input.buttons[7]; 218 mapped->buttons[BUTTON_INDEX_LEFT_THUMBSTICK] = input.buttons[7];
226 mapped->buttons[BUTTON_INDEX_RIGHT_THUMBSTICK] = input.buttons[8]; 219 mapped->buttons[BUTTON_INDEX_RIGHT_THUMBSTICK] = input.buttons[8];
227 mapped->buttons[BUTTON_INDEX_DPAD_UP] = AxisNegativeAsButton(input.axes[7]); 220 mapped->buttons[BUTTON_INDEX_DPAD_UP] = AxisNegativeAsButton(input.axes[7]);
228 mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = AxisPositiveAsButton(input.axes[7]); 221 mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = AxisPositiveAsButton(input.axes[7]);
229 mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = AxisNegativeAsButton(input.axes[6]); 222 mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = AxisNegativeAsButton(input.axes[6]);
230 mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] = 223 mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] =
231 AxisPositiveAsButton(input.axes[6]); 224 AxisPositiveAsButton(input.axes[6]);
232 mapped->buttons[BUTTON_INDEX_META] = input.buttons[6]; 225 mapped->buttons[BUTTON_INDEX_META] = input.buttons[6];
233 226
234 mapped->buttons_length = BUTTON_INDEX_COUNT; 227 mapped->buttons_length = BUTTON_INDEX_COUNT;
235 mapped->axes_length = AXIS_INDEX_COUNT; 228 mapped->axes_length = AXIS_INDEX_COUNT;
236 } 229 }
237 230
238 void MapperNvShield(const blink::WebGamepad& input, blink::WebGamepad* mapped) { 231 void MapperNvShield(const Gamepad& input, Gamepad* mapped) {
239 *mapped = input; 232 *mapped = input;
240 mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = AxisToButton(input.axes[5]); 233 mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = AxisToButton(input.axes[5]);
241 mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = AxisToButton(input.axes[4]); 234 mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = AxisToButton(input.axes[4]);
242 mapped->buttons[BUTTON_INDEX_BACK_SELECT] = NullButton(); 235 mapped->buttons[BUTTON_INDEX_BACK_SELECT] = NullButton();
243 mapped->buttons[BUTTON_INDEX_START] = input.buttons[7]; 236 mapped->buttons[BUTTON_INDEX_START] = input.buttons[7];
244 mapped->buttons[BUTTON_INDEX_LEFT_THUMBSTICK] = input.buttons[8]; 237 mapped->buttons[BUTTON_INDEX_LEFT_THUMBSTICK] = input.buttons[8];
245 mapped->buttons[BUTTON_INDEX_RIGHT_THUMBSTICK] = input.buttons[9]; 238 mapped->buttons[BUTTON_INDEX_RIGHT_THUMBSTICK] = input.buttons[9];
246 mapped->buttons[BUTTON_INDEX_DPAD_UP] = AxisNegativeAsButton(input.axes[7]); 239 mapped->buttons[BUTTON_INDEX_DPAD_UP] = AxisNegativeAsButton(input.axes[7]);
247 mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = AxisPositiveAsButton(input.axes[7]); 240 mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = AxisPositiveAsButton(input.axes[7]);
248 mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = AxisNegativeAsButton(input.axes[6]); 241 mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = AxisNegativeAsButton(input.axes[6]);
249 mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] = 242 mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] =
250 AxisPositiveAsButton(input.axes[6]); 243 AxisPositiveAsButton(input.axes[6]);
251 mapped->buttons[BUTTON_INDEX_META] = input.buttons[6]; 244 mapped->buttons[BUTTON_INDEX_META] = input.buttons[6];
252 245
253 mapped->buttons_length = BUTTON_INDEX_COUNT; 246 mapped->buttons_length = BUTTON_INDEX_COUNT;
254 mapped->axes_length = AXIS_INDEX_COUNT; 247 mapped->axes_length = AXIS_INDEX_COUNT;
255 } 248 }
256 249
257 void MapperOUYA(const blink::WebGamepad& input, blink::WebGamepad* mapped) { 250 void MapperOUYA(const Gamepad& input, Gamepad* mapped) {
258 *mapped = input; 251 *mapped = input;
259 mapped->buttons[BUTTON_INDEX_PRIMARY] = input.buttons[0]; 252 mapped->buttons[BUTTON_INDEX_PRIMARY] = input.buttons[0];
260 mapped->buttons[BUTTON_INDEX_SECONDARY] = input.buttons[3]; 253 mapped->buttons[BUTTON_INDEX_SECONDARY] = input.buttons[3];
261 mapped->buttons[BUTTON_INDEX_TERTIARY] = input.buttons[1]; 254 mapped->buttons[BUTTON_INDEX_TERTIARY] = input.buttons[1];
262 mapped->buttons[BUTTON_INDEX_QUATERNARY] = input.buttons[2]; 255 mapped->buttons[BUTTON_INDEX_QUATERNARY] = input.buttons[2];
263 mapped->buttons[BUTTON_INDEX_LEFT_SHOULDER] = input.buttons[4]; 256 mapped->buttons[BUTTON_INDEX_LEFT_SHOULDER] = input.buttons[4];
264 mapped->buttons[BUTTON_INDEX_RIGHT_SHOULDER] = input.buttons[5]; 257 mapped->buttons[BUTTON_INDEX_RIGHT_SHOULDER] = input.buttons[5];
265 mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = AxisToButton(input.axes[2]); 258 mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = AxisToButton(input.axes[2]);
266 mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = AxisToButton(input.axes[5]); 259 mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = AxisToButton(input.axes[5]);
267 mapped->buttons[BUTTON_INDEX_BACK_SELECT] = NullButton(); 260 mapped->buttons[BUTTON_INDEX_BACK_SELECT] = NullButton();
268 mapped->buttons[BUTTON_INDEX_START] = NullButton(); 261 mapped->buttons[BUTTON_INDEX_START] = NullButton();
269 mapped->buttons[BUTTON_INDEX_LEFT_THUMBSTICK] = input.buttons[6]; 262 mapped->buttons[BUTTON_INDEX_LEFT_THUMBSTICK] = input.buttons[6];
270 mapped->buttons[BUTTON_INDEX_RIGHT_THUMBSTICK] = input.buttons[7]; 263 mapped->buttons[BUTTON_INDEX_RIGHT_THUMBSTICK] = input.buttons[7];
271 mapped->buttons[BUTTON_INDEX_DPAD_UP] = input.buttons[8]; 264 mapped->buttons[BUTTON_INDEX_DPAD_UP] = input.buttons[8];
272 mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = input.buttons[9]; 265 mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = input.buttons[9];
273 mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = input.buttons[10]; 266 mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = input.buttons[10];
274 mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] = input.buttons[11]; 267 mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] = input.buttons[11];
275 mapped->buttons[BUTTON_INDEX_META] = input.buttons[15]; 268 mapped->buttons[BUTTON_INDEX_META] = input.buttons[15];
276 mapped->axes[AXIS_INDEX_RIGHT_STICK_X] = input.axes[3]; 269 mapped->axes[AXIS_INDEX_RIGHT_STICK_X] = input.axes[3];
277 mapped->axes[AXIS_INDEX_RIGHT_STICK_Y] = input.axes[4]; 270 mapped->axes[AXIS_INDEX_RIGHT_STICK_Y] = input.axes[4];
278 271
279 mapped->buttons_length = BUTTON_INDEX_COUNT; 272 mapped->buttons_length = BUTTON_INDEX_COUNT;
280 mapped->axes_length = AXIS_INDEX_COUNT; 273 mapped->axes_length = AXIS_INDEX_COUNT;
281 } 274 }
282 275
283 void MapperRazerServal(const blink::WebGamepad& input, 276 void MapperRazerServal(const Gamepad& input, Gamepad* mapped) {
284 blink::WebGamepad* mapped) {
285 *mapped = input; 277 *mapped = input;
286 mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = AxisToButton(input.axes[5]); 278 mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = AxisToButton(input.axes[5]);
287 mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = AxisToButton(input.axes[4]); 279 mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = AxisToButton(input.axes[4]);
288 mapped->buttons[BUTTON_INDEX_BACK_SELECT] = input.buttons[6]; 280 mapped->buttons[BUTTON_INDEX_BACK_SELECT] = input.buttons[6];
289 mapped->buttons[BUTTON_INDEX_START] = input.buttons[7]; 281 mapped->buttons[BUTTON_INDEX_START] = input.buttons[7];
290 mapped->buttons[BUTTON_INDEX_LEFT_THUMBSTICK] = input.buttons[9]; 282 mapped->buttons[BUTTON_INDEX_LEFT_THUMBSTICK] = input.buttons[9];
291 mapped->buttons[BUTTON_INDEX_RIGHT_THUMBSTICK] = input.buttons[10]; 283 mapped->buttons[BUTTON_INDEX_RIGHT_THUMBSTICK] = input.buttons[10];
292 mapped->buttons[BUTTON_INDEX_DPAD_UP] = AxisNegativeAsButton(input.axes[7]); 284 mapped->buttons[BUTTON_INDEX_DPAD_UP] = AxisNegativeAsButton(input.axes[7]);
293 mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = AxisPositiveAsButton(input.axes[7]); 285 mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = AxisPositiveAsButton(input.axes[7]);
294 mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = AxisNegativeAsButton(input.axes[6]); 286 mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = AxisNegativeAsButton(input.axes[6]);
295 mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] = 287 mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] =
296 AxisPositiveAsButton(input.axes[6]); 288 AxisPositiveAsButton(input.axes[6]);
297 289
298 mapped->buttons_length = BUTTON_INDEX_COUNT - 1; /* no meta */ 290 mapped->buttons_length = BUTTON_INDEX_COUNT - 1; /* no meta */
299 mapped->axes_length = AXIS_INDEX_COUNT; 291 mapped->axes_length = AXIS_INDEX_COUNT;
300 } 292 }
301 293
302 void MapperMogaPro(const blink::WebGamepad& input, blink::WebGamepad* mapped) { 294 void MapperMogaPro(const Gamepad& input, Gamepad* mapped) {
303 *mapped = input; 295 *mapped = input;
304 mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = AxisToButton(input.axes[5]); 296 mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = AxisToButton(input.axes[5]);
305 mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = AxisToButton(input.axes[4]); 297 mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = AxisToButton(input.axes[4]);
306 mapped->buttons[BUTTON_INDEX_BACK_SELECT] = NullButton(); 298 mapped->buttons[BUTTON_INDEX_BACK_SELECT] = NullButton();
307 mapped->buttons[BUTTON_INDEX_START] = input.buttons[6]; 299 mapped->buttons[BUTTON_INDEX_START] = input.buttons[6];
308 mapped->buttons[BUTTON_INDEX_LEFT_THUMBSTICK] = input.buttons[7]; 300 mapped->buttons[BUTTON_INDEX_LEFT_THUMBSTICK] = input.buttons[7];
309 mapped->buttons[BUTTON_INDEX_RIGHT_THUMBSTICK] = input.buttons[8]; 301 mapped->buttons[BUTTON_INDEX_RIGHT_THUMBSTICK] = input.buttons[8];
310 mapped->buttons[BUTTON_INDEX_DPAD_UP] = AxisNegativeAsButton(input.axes[7]); 302 mapped->buttons[BUTTON_INDEX_DPAD_UP] = AxisNegativeAsButton(input.axes[7]);
311 mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = AxisPositiveAsButton(input.axes[7]); 303 mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = AxisPositiveAsButton(input.axes[7]);
312 mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = AxisNegativeAsButton(input.axes[6]); 304 mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = AxisNegativeAsButton(input.axes[6]);
313 mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] = 305 mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] =
314 AxisPositiveAsButton(input.axes[6]); 306 AxisPositiveAsButton(input.axes[6]);
315 307
316 mapped->buttons_length = BUTTON_INDEX_COUNT - 1; /* no meta */ 308 mapped->buttons_length = BUTTON_INDEX_COUNT - 1; /* no meta */
317 mapped->axes_length = AXIS_INDEX_COUNT; 309 mapped->axes_length = AXIS_INDEX_COUNT;
318 } 310 }
319 311
320 void MapperSamsung_EI_GP20(const blink::WebGamepad& input, 312 void MapperSamsung_EI_GP20(const Gamepad& input, Gamepad* mapped) {
321 blink::WebGamepad* mapped) {
322 *mapped = input; 313 *mapped = input;
323 mapped->buttons[BUTTON_INDEX_PRIMARY] = input.buttons[0]; 314 mapped->buttons[BUTTON_INDEX_PRIMARY] = input.buttons[0];
324 mapped->buttons[BUTTON_INDEX_SECONDARY] = input.buttons[1]; 315 mapped->buttons[BUTTON_INDEX_SECONDARY] = input.buttons[1];
325 mapped->buttons[BUTTON_INDEX_TERTIARY] = input.buttons[3]; 316 mapped->buttons[BUTTON_INDEX_TERTIARY] = input.buttons[3];
326 mapped->buttons[BUTTON_INDEX_QUATERNARY] = input.buttons[4]; 317 mapped->buttons[BUTTON_INDEX_QUATERNARY] = input.buttons[4];
327 mapped->buttons[BUTTON_INDEX_LEFT_SHOULDER] = NullButton(); 318 mapped->buttons[BUTTON_INDEX_LEFT_SHOULDER] = NullButton();
328 mapped->buttons[BUTTON_INDEX_RIGHT_SHOULDER] = NullButton(); 319 mapped->buttons[BUTTON_INDEX_RIGHT_SHOULDER] = NullButton();
329 mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = input.buttons[6]; 320 mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = input.buttons[6];
330 mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = input.buttons[7]; 321 mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = input.buttons[7];
331 mapped->buttons[BUTTON_INDEX_BACK_SELECT] = input.buttons[10]; 322 mapped->buttons[BUTTON_INDEX_BACK_SELECT] = input.buttons[10];
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 const base::StringPiece& product_id) { 384 const base::StringPiece& product_id) {
394 for (size_t i = 0; i < arraysize(AvailableMappings); ++i) { 385 for (size_t i = 0; i < arraysize(AvailableMappings); ++i) {
395 MappingData& item = AvailableMappings[i]; 386 MappingData& item = AvailableMappings[i];
396 if (vendor_id == item.vendor_id && product_id == item.product_id) 387 if (vendor_id == item.vendor_id && product_id == item.product_id)
397 return item.function; 388 return item.function;
398 } 389 }
399 return NULL; 390 return NULL;
400 } 391 }
401 392
402 } // namespace device 393 } // namespace device
OLDNEW
« no previous file with comments | « device/gamepad/gamepad_standard_mappings.cc ('k') | device/gamepad/gamepad_standard_mappings_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698