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

Side by Side Diff: content/browser/gamepad/gamepad_standard_mappings_mac.mm

Issue 11886067: Added correct Mac mappings for the DragonRise Generic USB Gamepad. (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 11 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
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 mapped->buttons[kButtonLeftShoulder] = input.buttons[6]; 164 mapped->buttons[kButtonLeftShoulder] = input.buttons[6];
165 mapped->buttons[kButtonRightShoulder] = input.buttons[7]; 165 mapped->buttons[kButtonRightShoulder] = input.buttons[7];
166 mapped->buttons[kButtonLeftTrigger] = input.buttons[4]; 166 mapped->buttons[kButtonLeftTrigger] = input.buttons[4];
167 mapped->buttons[kButtonRightTrigger] = input.buttons[5]; 167 mapped->buttons[kButtonRightTrigger] = input.buttons[5];
168 DpadFromAxis(mapped, input.axes[9]); 168 DpadFromAxis(mapped, input.axes[9]);
169 mapped->axes[kAxisRightStickY] = input.axes[5]; 169 mapped->axes[kAxisRightStickY] = input.axes[5];
170 mapped->buttonsLength = kNumButtons - 1; /* no meta */ 170 mapped->buttonsLength = kNumButtons - 1; /* no meta */
171 mapped->axesLength = kNumAxes; 171 mapped->axesLength = kNumAxes;
172 } 172 }
173 173
174 void MapperDragonRiseGeneric(
175 const WebKit::WebGamepad& input,
176 WebKit::WebGamepad* mapped) {
177 *mapped = input;
178 DpadFromAxis(mapped, input.axes[9]);
179 mapped->axes[kAxisLeftStickX] = input.axes[0];
180 mapped->axes[kAxisLeftStickY] = input.axes[1];
181 mapped->axes[kAxisRightStickX] = input.axes[2];
182 mapped->axes[kAxisRightStickY] = input.axes[5];
183 mapped->buttonsLength = kNumButtons - 1; /* no meta */
184 mapped->axesLength = kNumAxes;
185 }
186
174 struct MappingData { 187 struct MappingData {
175 const char* const vendor_id; 188 const char* const vendor_id;
176 const char* const product_id; 189 const char* const product_id;
177 GamepadStandardMappingFunction function; 190 GamepadStandardMappingFunction function;
178 } AvailableMappings[] = { 191 } AvailableMappings[] = {
179 // http://www.linux-usb.org/usb.ids 192 // http://www.linux-usb.org/usb.ids
193 { "0079", "0006", MapperDragonRiseGeneric }, // DragonRise Generic USB
180 { "045e", "028e", MapperXbox360Gamepad }, // Xbox 360 Controller 194 { "045e", "028e", MapperXbox360Gamepad }, // Xbox 360 Controller
181 { "045e", "028f", MapperXbox360Gamepad }, // Xbox 360 Wireless Controller 195 { "045e", "028f", MapperXbox360Gamepad }, // Xbox 360 Wireless Controller
182 { "046d", "c216", MapperDirectInputStyle }, // Logitech F310, D mode 196 { "046d", "c216", MapperDirectInputStyle }, // Logitech F310, D mode
183 { "046d", "c218", MapperDirectInputStyle }, // Logitech F510, D mode 197 { "046d", "c218", MapperDirectInputStyle }, // Logitech F510, D mode
184 { "046d", "c219", MapperDirectInputStyle }, // Logitech F710, D mode 198 { "046d", "c219", MapperDirectInputStyle }, // Logitech F710, D mode
185 { "054c", "0268", MapperPlaystationSixAxis }, // Playstation SIXAXIS 199 { "054c", "0268", MapperPlaystationSixAxis }, // Playstation SIXAXIS
186 { "0925", "0005", MapperSmartJoyPLUS }, // SmartJoy PLUS Adapter 200 { "0925", "0005", MapperSmartJoyPLUS }, // SmartJoy PLUS Adapter
187 { "0e8f", "0003", MapperXGEAR }, // XFXforce XGEAR PS2 Controller 201 { "0e8f", "0003", MapperXGEAR }, // XFXforce XGEAR PS2 Controller
188 { "2222", "0060", MapperDirectInputStyle }, // Macally iShockX, analog mode 202 { "2222", "0060", MapperDirectInputStyle }, // Macally iShockX, analog mode
189 { "2222", "4010", MapperMacallyIShock }, // Macally iShock 203 { "2222", "4010", MapperMacallyIShock }, // Macally iShock
190 }; 204 };
191 205
192 } // namespace 206 } // namespace
193 207
194 GamepadStandardMappingFunction GetGamepadStandardMappingFunction( 208 GamepadStandardMappingFunction GetGamepadStandardMappingFunction(
195 const base::StringPiece& vendor_id, 209 const base::StringPiece& vendor_id,
196 const base::StringPiece& product_id) { 210 const base::StringPiece& product_id) {
197 for (size_t i = 0; i < arraysize(AvailableMappings); ++i) { 211 for (size_t i = 0; i < arraysize(AvailableMappings); ++i) {
198 MappingData& item = AvailableMappings[i]; 212 MappingData& item = AvailableMappings[i];
199 if (vendor_id == item.vendor_id && product_id == item.product_id) 213 if (vendor_id == item.vendor_id && product_id == item.product_id)
200 return item.function; 214 return item.function;
201 } 215 }
202 return NULL; 216 return NULL;
203 } 217 }
204 218
205 } // namespace content 219 } // namespace content
OLDNEW
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698