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

Side by Side Diff: device/gamepad/gamepad_standard_mappings_mac.mm

Issue 2314553002: Add mapping for the new Xbox One S controller in BT mode (Closed)
Patch Set: Created 4 years, 3 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 | « no previous file | 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 <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 {
(...skipping 13 matching lines...) Expand all
24 mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = input.buttons[12]; 24 mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = input.buttons[12];
25 mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = input.buttons[13]; 25 mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = input.buttons[13];
26 mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] = input.buttons[14]; 26 mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] = input.buttons[14];
27 mapped->buttons[BUTTON_INDEX_META] = input.buttons[10]; 27 mapped->buttons[BUTTON_INDEX_META] = input.buttons[10];
28 mapped->axes[AXIS_INDEX_RIGHT_STICK_X] = input.axes[3]; 28 mapped->axes[AXIS_INDEX_RIGHT_STICK_X] = input.axes[3];
29 mapped->axes[AXIS_INDEX_RIGHT_STICK_Y] = input.axes[4]; 29 mapped->axes[AXIS_INDEX_RIGHT_STICK_Y] = input.axes[4];
30 mapped->buttonsLength = BUTTON_INDEX_COUNT; 30 mapped->buttonsLength = BUTTON_INDEX_COUNT;
31 mapped->axesLength = AXIS_INDEX_COUNT; 31 mapped->axesLength = AXIS_INDEX_COUNT;
32 } 32 }
33 33
34 void MapperXboxOneHidGamepad(const blink::WebGamepad& input,
35 blink::WebGamepad* mapped) {
36 *mapped = input;
37 mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = AxisToButton(input.axes[2]);
38 mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = AxisToButton(input.axes[5]);
39 mapped->buttons[BUTTON_INDEX_BACK_SELECT] = input.buttons[6];
40 mapped->buttons[BUTTON_INDEX_START] = input.buttons[7];
41 mapped->buttons[BUTTON_INDEX_LEFT_THUMBSTICK] = input.buttons[8];
42 mapped->buttons[BUTTON_INDEX_RIGHT_THUMBSTICK] = input.buttons[9];
43 mapped->axes[AXIS_INDEX_RIGHT_STICK_X] = input.axes[3];
44 mapped->axes[AXIS_INDEX_RIGHT_STICK_Y] = input.axes[4];
45 DpadFromAxis(mapped, input.axes[9]);
46
47 mapped->buttonsLength = BUTTON_INDEX_COUNT - 1; /* no meta */
48 mapped->axesLength = AXIS_INDEX_COUNT;
49 }
50
34 void MapperPlaystationSixAxis(const blink::WebGamepad& input, 51 void MapperPlaystationSixAxis(const blink::WebGamepad& input,
35 blink::WebGamepad* mapped) { 52 blink::WebGamepad* mapped) {
36 *mapped = input; 53 *mapped = input;
37 mapped->buttons[BUTTON_INDEX_PRIMARY] = input.buttons[14]; 54 mapped->buttons[BUTTON_INDEX_PRIMARY] = input.buttons[14];
38 mapped->buttons[BUTTON_INDEX_SECONDARY] = input.buttons[13]; 55 mapped->buttons[BUTTON_INDEX_SECONDARY] = input.buttons[13];
39 mapped->buttons[BUTTON_INDEX_TERTIARY] = input.buttons[15]; 56 mapped->buttons[BUTTON_INDEX_TERTIARY] = input.buttons[15];
40 mapped->buttons[BUTTON_INDEX_QUATERNARY] = input.buttons[12]; 57 mapped->buttons[BUTTON_INDEX_QUATERNARY] = input.buttons[12];
41 mapped->buttons[BUTTON_INDEX_LEFT_SHOULDER] = input.buttons[10]; 58 mapped->buttons[BUTTON_INDEX_LEFT_SHOULDER] = input.buttons[10];
42 mapped->buttons[BUTTON_INDEX_RIGHT_SHOULDER] = input.buttons[11]; 59 mapped->buttons[BUTTON_INDEX_RIGHT_SHOULDER] = input.buttons[11];
43 60
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 369
353 struct MappingData { 370 struct MappingData {
354 const char* const vendor_id; 371 const char* const vendor_id;
355 const char* const product_id; 372 const char* const product_id;
356 GamepadStandardMappingFunction function; 373 GamepadStandardMappingFunction function;
357 } AvailableMappings[] = { 374 } AvailableMappings[] = {
358 // http://www.linux-usb.org/usb.ids 375 // http://www.linux-usb.org/usb.ids
359 {"0079", "0006", MapperDragonRiseGeneric}, // DragonRise Generic USB 376 {"0079", "0006", MapperDragonRiseGeneric}, // DragonRise Generic USB
360 {"045e", "028e", MapperXbox360Gamepad}, // Xbox 360 Wired 377 {"045e", "028e", MapperXbox360Gamepad}, // Xbox 360 Wired
361 {"045e", "028f", MapperXbox360Gamepad}, // Xbox 360 Wireless 378 {"045e", "028f", MapperXbox360Gamepad}, // Xbox 360 Wireless
379 {"045e", "02e0", MapperXboxOneHidGamepad}, // Xbox One S (Bluetooth mode)
362 {"045e", "0719", MapperXbox360Gamepad}, // Xbox 360 Wireless 380 {"045e", "0719", MapperXbox360Gamepad}, // Xbox 360 Wireless
363 {"046d", "c216", MapperDirectInputStyle}, // Logitech F310, D mode 381 {"046d", "c216", MapperDirectInputStyle}, // Logitech F310, D mode
364 {"046d", "c218", MapperDirectInputStyle}, // Logitech F510, D mode 382 {"046d", "c218", MapperDirectInputStyle}, // Logitech F510, D mode
365 {"046d", "c219", MapperDirectInputStyle}, // Logitech F710, D mode 383 {"046d", "c219", MapperDirectInputStyle}, // Logitech F710, D mode
366 {"054c", "0268", MapperPlaystationSixAxis}, // Playstation SIXAXIS 384 {"054c", "0268", MapperPlaystationSixAxis}, // Playstation SIXAXIS
367 {"054c", "05c4", MapperDualshock4}, // Playstation Dualshock 4 385 {"054c", "05c4", MapperDualshock4}, // Playstation Dualshock 4
368 {"0583", "2060", MapperIBuffalo}, // iBuffalo Classic 386 {"0583", "2060", MapperIBuffalo}, // iBuffalo Classic
369 {"0925", "0005", MapperSmartJoyPLUS}, // SmartJoy PLUS Adapter 387 {"0925", "0005", MapperSmartJoyPLUS}, // SmartJoy PLUS Adapter
370 {"0955", "7210", MapperNvShield}, // Nvidia Shield gamepad 388 {"0955", "7210", MapperNvShield}, // Nvidia Shield gamepad
371 {"0b05", "4500", MapperADT1}, // Nexus Player Controller 389 {"0b05", "4500", MapperADT1}, // Nexus Player Controller
(...skipping 15 matching lines...) Expand all
387 const base::StringPiece& product_id) { 405 const base::StringPiece& product_id) {
388 for (size_t i = 0; i < arraysize(AvailableMappings); ++i) { 406 for (size_t i = 0; i < arraysize(AvailableMappings); ++i) {
389 MappingData& item = AvailableMappings[i]; 407 MappingData& item = AvailableMappings[i];
390 if (vendor_id == item.vendor_id && product_id == item.product_id) 408 if (vendor_id == item.vendor_id && product_id == item.product_id)
391 return item.function; 409 return item.function;
392 } 410 }
393 return NULL; 411 return NULL;
394 } 412 }
395 413
396 } // namespace device 414 } // namespace device
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698