OLD | NEW |
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 "content/browser/gamepad/gamepad_standard_mappings.h" | 5 #include "content/browser/gamepad/gamepad_standard_mappings.h" |
6 | 6 |
7 #include "content/common/gamepad_hardware_buffer.h" | 7 #include "content/common/gamepad_hardware_buffer.h" |
8 | 8 |
9 namespace content { | 9 namespace content { |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... |
36 mapped->buttons[kButtonDpadDown] = AxisPositiveAsButton(input.axes[7]); | 36 mapped->buttons[kButtonDpadDown] = AxisPositiveAsButton(input.axes[7]); |
37 mapped->buttons[kButtonDpadLeft] = AxisNegativeAsButton(input.axes[6]); | 37 mapped->buttons[kButtonDpadLeft] = AxisNegativeAsButton(input.axes[6]); |
38 mapped->buttons[kButtonDpadRight] = AxisPositiveAsButton(input.axes[6]); | 38 mapped->buttons[kButtonDpadRight] = AxisPositiveAsButton(input.axes[6]); |
39 mapped->buttons[kButtonMeta] = input.buttons[8]; | 39 mapped->buttons[kButtonMeta] = input.buttons[8]; |
40 mapped->axes[kAxisRightStickX] = input.axes[3]; | 40 mapped->axes[kAxisRightStickX] = input.axes[3]; |
41 mapped->axes[kAxisRightStickY] = input.axes[4]; | 41 mapped->axes[kAxisRightStickY] = input.axes[4]; |
42 mapped->buttonsLength = kNumButtons; | 42 mapped->buttonsLength = kNumButtons; |
43 mapped->axesLength = kNumAxes; | 43 mapped->axesLength = kNumAxes; |
44 } | 44 } |
45 | 45 |
46 void MapperMP8866( | 46 void MapperLakeviewResearch( |
47 const WebKit::WebGamepad& input, | 47 const WebKit::WebGamepad& input, |
48 WebKit::WebGamepad* mapped) { | 48 WebKit::WebGamepad* mapped) { |
49 *mapped = input; | 49 *mapped = input; |
50 mapped->buttons[kButtonPrimary] = input.buttons[2]; | 50 mapped->buttons[kButtonPrimary] = input.buttons[2]; |
51 mapped->buttons[kButtonTertiary] = input.buttons[3]; | 51 mapped->buttons[kButtonTertiary] = input.buttons[3]; |
52 mapped->buttons[kButtonQuaternary] = input.buttons[0]; | 52 mapped->buttons[kButtonQuaternary] = input.buttons[0]; |
53 mapped->buttons[kButtonLeftShoulder] = input.buttons[6]; | 53 mapped->buttons[kButtonLeftShoulder] = input.buttons[6]; |
54 mapped->buttons[kButtonRightShoulder] = input.buttons[7]; | 54 mapped->buttons[kButtonRightShoulder] = input.buttons[7]; |
55 mapped->buttons[kButtonLeftTrigger] = input.buttons[4]; | 55 mapped->buttons[kButtonLeftTrigger] = input.buttons[4]; |
56 mapped->buttons[kButtonRightTrigger] = input.buttons[5]; | 56 mapped->buttons[kButtonRightTrigger] = input.buttons[5]; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 const char* const product_id; | 118 const char* const product_id; |
119 GamepadStandardMappingFunction function; | 119 GamepadStandardMappingFunction function; |
120 } AvailableMappings[] = { | 120 } AvailableMappings[] = { |
121 // http://www.linux-usb.org/usb.ids | 121 // http://www.linux-usb.org/usb.ids |
122 { "045e", "028e", MapperXInputStyleGamepad }, // Xbox 360 Controller | 122 { "045e", "028e", MapperXInputStyleGamepad }, // Xbox 360 Controller |
123 { "045e", "028f", MapperXInputStyleGamepad }, // Xbox 360 Wireless Controller | 123 { "045e", "028f", MapperXInputStyleGamepad }, // Xbox 360 Wireless Controller |
124 { "046d", "c21d", MapperXInputStyleGamepad }, // Logitech F310 | 124 { "046d", "c21d", MapperXInputStyleGamepad }, // Logitech F310 |
125 { "046d", "c21e", MapperXInputStyleGamepad }, // Logitech F510 | 125 { "046d", "c21e", MapperXInputStyleGamepad }, // Logitech F510 |
126 { "046d", "c21f", MapperXInputStyleGamepad }, // Logitech F710 | 126 { "046d", "c21f", MapperXInputStyleGamepad }, // Logitech F710 |
127 { "054c", "0268", MapperPlaystationSixAxis }, // Playstation SIXAXIS | 127 { "054c", "0268", MapperPlaystationSixAxis }, // Playstation SIXAXIS |
128 { "0925", "8866", MapperMP8866 }, // WiseGroup MP-8866 | 128 { "0925", "0005", MapperLakeviewResearch }, // SmartJoy PLUS Adapter |
| 129 { "0925", "8866", MapperLakeviewResearch }, // WiseGroup MP-8866 |
129 { "0e8f", "0003", MapperXGEAR }, // XFXforce XGEAR PS2 Controller | 130 { "0e8f", "0003", MapperXGEAR }, // XFXforce XGEAR PS2 Controller |
130 }; | 131 }; |
131 | 132 |
132 } // namespace | 133 } // namespace |
133 | 134 |
134 GamepadStandardMappingFunction GetGamepadStandardMappingFunction( | 135 GamepadStandardMappingFunction GetGamepadStandardMappingFunction( |
135 const base::StringPiece& vendor_id, | 136 const base::StringPiece& vendor_id, |
136 const base::StringPiece& product_id) { | 137 const base::StringPiece& product_id) { |
137 for (size_t i = 0; i < arraysize(AvailableMappings); ++i) { | 138 for (size_t i = 0; i < arraysize(AvailableMappings); ++i) { |
138 MappingData& item = AvailableMappings[i]; | 139 MappingData& item = AvailableMappings[i]; |
139 if (vendor_id == item.vendor_id && product_id == item.product_id) | 140 if (vendor_id == item.vendor_id && product_id == item.product_id) |
140 return item.function; | 141 return item.function; |
141 } | 142 } |
142 return NULL; | 143 return NULL; |
143 } | 144 } |
144 | 145 |
145 } // namespace content | 146 } // namespace content |
OLD | NEW |