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

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

Issue 2798933004: Restore mappings for older Xbox One S Bluetooth gamepads on OSX/Linux (Closed)
Patch Set: re-add old firmware mappings Created 3 years, 4 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 | « device/gamepad/gamepad_standard_mappings_linux.cc ('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 <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 12 matching lines...) Expand all
23 mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = input.buttons[12]; 23 mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = input.buttons[12];
24 mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = input.buttons[13]; 24 mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = input.buttons[13];
25 mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] = input.buttons[14]; 25 mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] = input.buttons[14];
26 mapped->buttons[BUTTON_INDEX_META] = input.buttons[10]; 26 mapped->buttons[BUTTON_INDEX_META] = input.buttons[10];
27 mapped->axes[AXIS_INDEX_RIGHT_STICK_X] = input.axes[3]; 27 mapped->axes[AXIS_INDEX_RIGHT_STICK_X] = input.axes[3];
28 mapped->axes[AXIS_INDEX_RIGHT_STICK_Y] = input.axes[4]; 28 mapped->axes[AXIS_INDEX_RIGHT_STICK_Y] = input.axes[4];
29 mapped->buttons_length = BUTTON_INDEX_COUNT; 29 mapped->buttons_length = BUTTON_INDEX_COUNT;
30 mapped->axes_length = AXIS_INDEX_COUNT; 30 mapped->axes_length = AXIS_INDEX_COUNT;
31 } 31 }
32 32
33 void MapperXboxOneHidGamepad(const Gamepad& input, Gamepad* mapped) { 33 void MapperXboxOneS2016Firmware(const Gamepad& input, Gamepad* mapped) {
34 *mapped = input;
35 mapped->buttons[BUTTON_INDEX_PRIMARY] = input.buttons[0];
36 mapped->buttons[BUTTON_INDEX_SECONDARY] = input.buttons[1];
37 mapped->buttons[BUTTON_INDEX_TERTIARY] = input.buttons[2];
38 mapped->buttons[BUTTON_INDEX_QUATERNARY] = input.buttons[3];
39 mapped->buttons[BUTTON_INDEX_LEFT_SHOULDER] = input.buttons[4];
40 mapped->buttons[BUTTON_INDEX_RIGHT_SHOULDER] = input.buttons[5];
41 mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = AxisToButton(input.axes[2]);
42 mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = AxisToButton(input.axes[5]);
43 mapped->buttons[BUTTON_INDEX_BACK_SELECT] = input.buttons[6];
44 mapped->buttons[BUTTON_INDEX_START] = input.buttons[7];
45 mapped->buttons[BUTTON_INDEX_LEFT_THUMBSTICK] = input.buttons[8];
46 mapped->buttons[BUTTON_INDEX_RIGHT_THUMBSTICK] = input.buttons[9];
47 mapped->axes[AXIS_INDEX_RIGHT_STICK_X] = input.axes[3];
48 mapped->axes[AXIS_INDEX_RIGHT_STICK_Y] = input.axes[4];
49 DpadFromAxis(mapped, input.axes[9]);
50
51 mapped->buttons_length = BUTTON_INDEX_COUNT - 1; /* no meta */
52 mapped->axes_length = AXIS_INDEX_COUNT;
53 }
54
55 void MapperXboxOneS(const Gamepad& input, Gamepad* mapped) {
34 *mapped = input; 56 *mapped = input;
35 57
36 mapped->buttons[BUTTON_INDEX_PRIMARY] = input.buttons[0]; 58 mapped->buttons[BUTTON_INDEX_PRIMARY] = input.buttons[0];
37 mapped->buttons[BUTTON_INDEX_SECONDARY] = input.buttons[1]; 59 mapped->buttons[BUTTON_INDEX_SECONDARY] = input.buttons[1];
38 mapped->buttons[BUTTON_INDEX_TERTIARY] = input.buttons[3]; 60 mapped->buttons[BUTTON_INDEX_TERTIARY] = input.buttons[3];
39 mapped->buttons[BUTTON_INDEX_QUATERNARY] = input.buttons[4]; 61 mapped->buttons[BUTTON_INDEX_QUATERNARY] = input.buttons[4];
40 mapped->buttons[BUTTON_INDEX_LEFT_SHOULDER] = input.buttons[6]; 62 mapped->buttons[BUTTON_INDEX_LEFT_SHOULDER] = input.buttons[6];
41 mapped->buttons[BUTTON_INDEX_RIGHT_SHOULDER] = input.buttons[7]; 63 mapped->buttons[BUTTON_INDEX_RIGHT_SHOULDER] = input.buttons[7];
42 mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = AxisToButton(input.axes[3]); 64 mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = AxisToButton(input.axes[3]);
43 mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = AxisToButton(input.axes[4]); 65 mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = AxisToButton(input.axes[4]);
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 const char* const vendor_id; 389 const char* const vendor_id;
368 const char* const product_id; 390 const char* const product_id;
369 GamepadStandardMappingFunction function; 391 GamepadStandardMappingFunction function;
370 } AvailableMappings[] = { 392 } AvailableMappings[] = {
371 // http://www.linux-usb.org/usb.ids 393 // http://www.linux-usb.org/usb.ids
372 {"0079", "0006", MapperDragonRiseGeneric}, // DragonRise Generic USB 394 {"0079", "0006", MapperDragonRiseGeneric}, // DragonRise Generic USB
373 {"045e", "028e", MapperXbox360Gamepad}, // Xbox 360 Wired 395 {"045e", "028e", MapperXbox360Gamepad}, // Xbox 360 Wired
374 {"045e", "028f", MapperXbox360Gamepad}, // Xbox 360 Wireless 396 {"045e", "028f", MapperXbox360Gamepad}, // Xbox 360 Wireless
375 {"045e", "02d1", MapperXbox360Gamepad}, // Xbox One Wired 397 {"045e", "02d1", MapperXbox360Gamepad}, // Xbox One Wired
376 {"045e", "02dd", MapperXbox360Gamepad}, // Xbox One Wired (2015 FW) 398 {"045e", "02dd", MapperXbox360Gamepad}, // Xbox One Wired (2015 FW)
399 {"045e", "02e0", MapperXboxOneS2016Firmware}, // Xbox One S (Bluetooth)
377 {"045e", "02e3", MapperXbox360Gamepad}, // Xbox One Elite Wired 400 {"045e", "02e3", MapperXbox360Gamepad}, // Xbox One Elite Wired
378 {"045e", "02ea", MapperXbox360Gamepad}, // Xbox One S (USB) 401 {"045e", "02ea", MapperXbox360Gamepad}, // Xbox One S (USB)
379 {"045e", "02fd", MapperXboxOneHidGamepad}, // Xbox One S (Bluetooth) 402 {"045e", "02fd", MapperXboxOneS}, // Xbox One S (Bluetooth)
380 {"045e", "0719", MapperXbox360Gamepad}, // Xbox 360 Wireless 403 {"045e", "0719", MapperXbox360Gamepad}, // Xbox 360 Wireless
381 {"046d", "c216", MapperDirectInputStyle}, // Logitech F310, D mode 404 {"046d", "c216", MapperDirectInputStyle}, // Logitech F310, D mode
382 {"046d", "c218", MapperDirectInputStyle}, // Logitech F510, D mode 405 {"046d", "c218", MapperDirectInputStyle}, // Logitech F510, D mode
383 {"046d", "c219", MapperDirectInputStyle}, // Logitech F710, D mode 406 {"046d", "c219", MapperDirectInputStyle}, // Logitech F710, D mode
384 {"054c", "0268", MapperPlaystationSixAxis}, // Playstation SIXAXIS 407 {"054c", "0268", MapperPlaystationSixAxis}, // Playstation SIXAXIS
385 {"054c", "05c4", MapperDualshock4}, // Playstation Dualshock 4 408 {"054c", "05c4", MapperDualshock4}, // Playstation Dualshock 4
386 {"054c", "09cc", MapperDualshock4}, // Dualshock 4 (PS4 Slim) 409 {"054c", "09cc", MapperDualshock4}, // Dualshock 4 (PS4 Slim)
387 {"0583", "2060", MapperIBuffalo}, // iBuffalo Classic 410 {"0583", "2060", MapperIBuffalo}, // iBuffalo Classic
388 {"0925", "0005", MapperSmartJoyPLUS}, // SmartJoy PLUS Adapter 411 {"0925", "0005", MapperSmartJoyPLUS}, // SmartJoy PLUS Adapter
389 {"0955", "7210", MapperNvShield}, // Nvidia Shield gamepad 412 {"0955", "7210", MapperNvShield}, // Nvidia Shield gamepad
(...skipping 16 matching lines...) Expand all
406 const base::StringPiece& product_id) { 429 const base::StringPiece& product_id) {
407 for (size_t i = 0; i < arraysize(AvailableMappings); ++i) { 430 for (size_t i = 0; i < arraysize(AvailableMappings); ++i) {
408 MappingData& item = AvailableMappings[i]; 431 MappingData& item = AvailableMappings[i];
409 if (vendor_id == item.vendor_id && product_id == item.product_id) 432 if (vendor_id == item.vendor_id && product_id == item.product_id)
410 return item.function; 433 return item.function;
411 } 434 }
412 return NULL; 435 return NULL;
413 } 436 }
414 437
415 } // namespace device 438 } // namespace device
OLDNEW
« no previous file with comments | « device/gamepad/gamepad_standard_mappings_linux.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698