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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "content/browser/gamepad/gamepad_standard_mappings.h" | 8 #include "device/gamepad/gamepad_standard_mappings.h" |
9 | 9 |
10 namespace content { | 10 namespace device { |
11 | 11 |
12 namespace { | 12 namespace { |
13 | 13 |
14 void MapperXbox360Gamepad(const blink::WebGamepad& input, | 14 void MapperXbox360Gamepad(const blink::WebGamepad& input, |
15 blink::WebGamepad* mapped) { | 15 blink::WebGamepad* mapped) { |
16 *mapped = input; | 16 *mapped = input; |
17 mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = AxisToButton(input.axes[2]); | 17 mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = AxisToButton(input.axes[2]); |
18 mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = AxisToButton(input.axes[5]); | 18 mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = AxisToButton(input.axes[5]); |
19 mapped->buttons[BUTTON_INDEX_BACK_SELECT] = input.buttons[9]; | 19 mapped->buttons[BUTTON_INDEX_BACK_SELECT] = input.buttons[9]; |
20 mapped->buttons[BUTTON_INDEX_START] = input.buttons[8]; | 20 mapped->buttons[BUTTON_INDEX_START] = input.buttons[8]; |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 {"045e", "028e", MapperXbox360Gamepad}, // Xbox 360 Wired | 360 {"045e", "028e", MapperXbox360Gamepad}, // Xbox 360 Wired |
361 {"045e", "028f", MapperXbox360Gamepad}, // Xbox 360 Wireless | 361 {"045e", "028f", MapperXbox360Gamepad}, // Xbox 360 Wireless |
362 {"045e", "0719", MapperXbox360Gamepad}, // Xbox 360 Wireless | 362 {"045e", "0719", MapperXbox360Gamepad}, // Xbox 360 Wireless |
363 {"046d", "c216", MapperDirectInputStyle}, // Logitech F310, D mode | 363 {"046d", "c216", MapperDirectInputStyle}, // Logitech F310, D mode |
364 {"046d", "c218", MapperDirectInputStyle}, // Logitech F510, D mode | 364 {"046d", "c218", MapperDirectInputStyle}, // Logitech F510, D mode |
365 {"046d", "c219", MapperDirectInputStyle}, // Logitech F710, D mode | 365 {"046d", "c219", MapperDirectInputStyle}, // Logitech F710, D mode |
366 {"054c", "0268", MapperPlaystationSixAxis}, // Playstation SIXAXIS | 366 {"054c", "0268", MapperPlaystationSixAxis}, // Playstation SIXAXIS |
367 {"054c", "05c4", MapperDualshock4}, // Playstation Dualshock 4 | 367 {"054c", "05c4", MapperDualshock4}, // Playstation Dualshock 4 |
368 {"0583", "2060", MapperIBuffalo}, // iBuffalo Classic | 368 {"0583", "2060", MapperIBuffalo}, // iBuffalo Classic |
369 {"0925", "0005", MapperSmartJoyPLUS}, // SmartJoy PLUS Adapter | 369 {"0925", "0005", MapperSmartJoyPLUS}, // SmartJoy PLUS Adapter |
370 {"0955", "7210", MapperNvShield}, // Nvidia Shield gamepad | 370 {"0955", "7210", MapperNvShield}, // Nvidia Shield gamepad |
371 {"0b05", "4500", MapperADT1}, // Nexus Player Controller | 371 {"0b05", "4500", MapperADT1}, // Nexus Player Controller |
372 {"0e8f", "0003", MapperXGEAR}, // XFXforce XGEAR PS2 Controller | 372 {"0e8f", "0003", MapperXGEAR}, // XFXforce XGEAR PS2 Controller |
373 {"1532", "0900", MapperRazerServal}, // Razer Serval Controller | 373 {"1532", "0900", MapperRazerServal}, // Razer Serval Controller |
374 {"18d1", "2c40", MapperADT1}, // ADT-1 Controller | 374 {"18d1", "2c40", MapperADT1}, // ADT-1 Controller |
375 {"20d6", "6271", MapperMogaPro}, // Moga Pro Controller (HID mode) | 375 {"20d6", "6271", MapperMogaPro}, // Moga Pro Controller (HID mode) |
376 {"2222", "0060", MapperDirectInputStyle}, // Macally iShockX, analog mode | 376 {"2222", "0060", MapperDirectInputStyle}, // Macally iShockX, analog mode |
377 {"2222", "4010", MapperMacallyIShock}, // Macally iShock | 377 {"2222", "4010", MapperMacallyIShock}, // Macally iShock |
378 {"2378", "1008", MapperOnLiveWireless}, // OnLive Controller (Bluetooth) | 378 {"2378", "1008", MapperOnLiveWireless}, // OnLive Controller (Bluetooth) |
379 {"2378", "100a", MapperOnLiveWireless}, // OnLive Controller (Wired) | 379 {"2378", "100a", MapperOnLiveWireless}, // OnLive Controller (Wired) |
380 {"2836", "0001", MapperOUYA}, // OUYA Controller | 380 {"2836", "0001", MapperOUYA}, // OUYA Controller |
381 }; | 381 }; |
382 | 382 |
383 } // namespace | 383 } // namespace |
384 | 384 |
385 GamepadStandardMappingFunction GetGamepadStandardMappingFunction( | 385 GamepadStandardMappingFunction GetGamepadStandardMappingFunction( |
386 const base::StringPiece& vendor_id, | 386 const base::StringPiece& vendor_id, |
387 const base::StringPiece& product_id) { | 387 const base::StringPiece& product_id) { |
388 for (size_t i = 0; i < arraysize(AvailableMappings); ++i) { | 388 for (size_t i = 0; i < arraysize(AvailableMappings); ++i) { |
389 MappingData& item = AvailableMappings[i]; | 389 MappingData& item = AvailableMappings[i]; |
390 if (vendor_id == item.vendor_id && product_id == item.product_id) | 390 if (vendor_id == item.vendor_id && product_id == item.product_id) |
391 return item.function; | 391 return item.function; |
392 } | 392 } |
393 return NULL; | 393 return NULL; |
394 } | 394 } |
395 | 395 |
396 } // namespace content | 396 } // namespace device |
OLD | NEW |