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

Unified Diff: content/browser/gamepad/gamepad_standard_mappings_linux.cc

Issue 617103007: Revert of Revert of Use the new java_cpp_enum rule in content. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/gamepad/gamepad_standard_mappings_linux.cc
diff --git a/content/browser/gamepad/gamepad_standard_mappings_linux.cc b/content/browser/gamepad/gamepad_standard_mappings_linux.cc
index 2465938de7706e9c7716f00b44583c819c7f5bd5..a0852420c6ad9eee0cf97eca4c1488ffa047cee4 100644
--- a/content/browser/gamepad/gamepad_standard_mappings_linux.cc
+++ b/content/browser/gamepad/gamepad_standard_mappings_linux.cc
@@ -8,186 +8,182 @@
namespace {
-void MapperXInputStyleGamepad(
- const blink::WebGamepad& input,
- blink::WebGamepad* mapped) {
- *mapped = input;
- mapped->buttons[kButtonLeftTrigger] = AxisToButton(input.axes[2]);
- mapped->buttons[kButtonRightTrigger] = AxisToButton(input.axes[5]);
- mapped->buttons[kButtonBackSelect] = input.buttons[6];
- mapped->buttons[kButtonStart] = input.buttons[7];
- mapped->buttons[kButtonLeftThumbstick] = input.buttons[9];
- mapped->buttons[kButtonRightThumbstick] = input.buttons[10];
- mapped->buttons[kButtonDpadUp] = AxisNegativeAsButton(input.axes[7]);
- mapped->buttons[kButtonDpadDown] = AxisPositiveAsButton(input.axes[7]);
- mapped->buttons[kButtonDpadLeft] = AxisNegativeAsButton(input.axes[6]);
- mapped->buttons[kButtonDpadRight] = AxisPositiveAsButton(input.axes[6]);
- mapped->buttons[kButtonMeta] = input.buttons[8];
- mapped->axes[kAxisRightStickX] = input.axes[3];
- mapped->axes[kAxisRightStickY] = input.axes[4];
- mapped->buttonsLength = kNumButtons;
- mapped->axesLength = kNumAxes;
-}
-
-void MapperLakeviewResearch(
- const blink::WebGamepad& input,
- blink::WebGamepad* mapped) {
- *mapped = input;
- mapped->buttons[kButtonPrimary] = input.buttons[2];
- mapped->buttons[kButtonTertiary] = input.buttons[3];
- mapped->buttons[kButtonQuaternary] = input.buttons[0];
- mapped->buttons[kButtonLeftShoulder] = input.buttons[6];
- mapped->buttons[kButtonRightShoulder] = input.buttons[7];
- mapped->buttons[kButtonLeftTrigger] = input.buttons[4];
- mapped->buttons[kButtonRightTrigger] = input.buttons[5];
- mapped->buttons[kButtonBackSelect] = input.buttons[9];
- mapped->buttons[kButtonStart] = input.buttons[8];
- mapped->buttons[kButtonDpadUp] = AxisNegativeAsButton(input.axes[5]);
- mapped->buttons[kButtonDpadDown] = AxisPositiveAsButton(input.axes[5]);
- mapped->buttons[kButtonDpadLeft] = AxisNegativeAsButton(input.axes[4]);
- mapped->buttons[kButtonDpadRight] = AxisPositiveAsButton(input.axes[4]);
- mapped->buttonsLength = kNumButtons - 1; // no Meta on this device
- mapped->axesLength = kNumAxes;
-}
-
-void MapperPlaystationSixAxis(
- const blink::WebGamepad& input,
- blink::WebGamepad* mapped) {
- *mapped = input;
- mapped->buttons[kButtonPrimary] = input.buttons[14];
- mapped->buttons[kButtonSecondary] = input.buttons[13];
- mapped->buttons[kButtonTertiary] = input.buttons[15];
- mapped->buttons[kButtonQuaternary] = input.buttons[12];
- mapped->buttons[kButtonLeftShoulder] = input.buttons[10];
- mapped->buttons[kButtonRightShoulder] = input.buttons[11];
- mapped->buttons[kButtonLeftTrigger] = AxisToButton(input.axes[12]);
- mapped->buttons[kButtonRightTrigger] = AxisToButton(input.axes[13]);
- mapped->buttons[kButtonBackSelect] = input.buttons[0];
- mapped->buttons[kButtonStart] = input.buttons[3];
- mapped->buttons[kButtonLeftThumbstick] = input.buttons[1];
- mapped->buttons[kButtonRightThumbstick] = input.buttons[2];
- mapped->buttons[kButtonDpadUp] = AxisToButton(input.axes[8]);
- mapped->buttons[kButtonDpadDown] = AxisToButton(input.axes[10]);
- mapped->buttons[kButtonDpadLeft] = input.buttons[7];
- mapped->buttons[kButtonDpadRight] = AxisToButton(input.axes[9]);
- mapped->buttons[kButtonMeta] = input.buttons[16];
-
- mapped->buttonsLength = kNumButtons;
- mapped->axesLength = kNumAxes;
-}
-
-void MapperDualshock4(
- const blink::WebGamepad& input,
- blink::WebGamepad* mapped) {
+void MapperXInputStyleGamepad(const blink::WebGamepad& input,
+ blink::WebGamepad* mapped) {
+ *mapped = input;
+ mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = AxisToButton(input.axes[2]);
+ mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = AxisToButton(input.axes[5]);
+ mapped->buttons[BUTTON_INDEX_BACK_SELECT] = input.buttons[6];
+ mapped->buttons[BUTTON_INDEX_START] = input.buttons[7];
+ mapped->buttons[BUTTON_INDEX_LEFT_THUMBSTICK] = input.buttons[9];
+ mapped->buttons[BUTTON_INDEX_RIGHT_THUMBSTICK] = input.buttons[10];
+ mapped->buttons[BUTTON_INDEX_DPAD_UP] = AxisNegativeAsButton(input.axes[7]);
+ mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = AxisPositiveAsButton(input.axes[7]);
+ mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = AxisNegativeAsButton(input.axes[6]);
+ mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] =
+ AxisPositiveAsButton(input.axes[6]);
+ mapped->buttons[BUTTON_INDEX_META] = input.buttons[8];
+ mapped->axes[AXIS_INDEX_RIGHT_STICK_X] = input.axes[3];
+ mapped->axes[AXIS_INDEX_RIGHT_STICK_Y] = input.axes[4];
+ mapped->buttonsLength = BUTTON_INDEX_COUNT;
+ mapped->axesLength = AXIS_INDEX_COUNT;
+}
+
+void MapperLakeviewResearch(const blink::WebGamepad& input,
+ blink::WebGamepad* mapped) {
+ *mapped = input;
+ mapped->buttons[BUTTON_INDEX_PRIMARY] = input.buttons[2];
+ mapped->buttons[BUTTON_INDEX_TERTIARY] = input.buttons[3];
+ mapped->buttons[BUTTON_INDEX_QUATERNARY] = input.buttons[0];
+ mapped->buttons[BUTTON_INDEX_LEFT_SHOULDER] = input.buttons[6];
+ mapped->buttons[BUTTON_INDEX_RIGHT_SHOULDER] = input.buttons[7];
+ mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = input.buttons[4];
+ mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = input.buttons[5];
+ mapped->buttons[BUTTON_INDEX_BACK_SELECT] = input.buttons[9];
+ mapped->buttons[BUTTON_INDEX_START] = input.buttons[8];
+ mapped->buttons[BUTTON_INDEX_DPAD_UP] = AxisNegativeAsButton(input.axes[5]);
+ mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = AxisPositiveAsButton(input.axes[5]);
+ mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = AxisNegativeAsButton(input.axes[4]);
+ mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] =
+ AxisPositiveAsButton(input.axes[4]);
+ mapped->buttonsLength = BUTTON_INDEX_COUNT - 1; // no Meta on this device
+ mapped->axesLength = AXIS_INDEX_COUNT;
+}
+
+void MapperPlaystationSixAxis(const blink::WebGamepad& input,
+ blink::WebGamepad* mapped) {
+ *mapped = input;
+ mapped->buttons[BUTTON_INDEX_PRIMARY] = input.buttons[14];
+ mapped->buttons[BUTTON_INDEX_SECONDARY] = input.buttons[13];
+ mapped->buttons[BUTTON_INDEX_TERTIARY] = input.buttons[15];
+ mapped->buttons[BUTTON_INDEX_QUATERNARY] = input.buttons[12];
+ mapped->buttons[BUTTON_INDEX_LEFT_SHOULDER] = input.buttons[10];
+ mapped->buttons[BUTTON_INDEX_RIGHT_SHOULDER] = input.buttons[11];
+ mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = AxisToButton(input.axes[12]);
+ mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = AxisToButton(input.axes[13]);
+ mapped->buttons[BUTTON_INDEX_BACK_SELECT] = input.buttons[0];
+ mapped->buttons[BUTTON_INDEX_START] = input.buttons[3];
+ mapped->buttons[BUTTON_INDEX_LEFT_THUMBSTICK] = input.buttons[1];
+ mapped->buttons[BUTTON_INDEX_RIGHT_THUMBSTICK] = input.buttons[2];
+ mapped->buttons[BUTTON_INDEX_DPAD_UP] = AxisToButton(input.axes[8]);
+ mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = AxisToButton(input.axes[10]);
+ mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = input.buttons[7];
+ mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] = AxisToButton(input.axes[9]);
+ mapped->buttons[BUTTON_INDEX_META] = input.buttons[16];
+
+ mapped->buttonsLength = BUTTON_INDEX_COUNT;
+ mapped->axesLength = AXIS_INDEX_COUNT;
+}
+
+void MapperDualshock4(const blink::WebGamepad& input,
+ blink::WebGamepad* mapped) {
enum Dualshock4Buttons {
- kTouchpadButton = kNumButtons,
- kNumDualshock4Buttons
+ DUALSHOCK_BUTTON_TOUCHPAD = BUTTON_INDEX_COUNT,
+ DUALSHOCK_BUTTON_COUNT
};
*mapped = input;
- mapped->buttons[kButtonPrimary] = input.buttons[1];
- mapped->buttons[kButtonSecondary] = input.buttons[2];
- mapped->buttons[kButtonTertiary] = input.buttons[0];
- mapped->buttons[kButtonQuaternary] = input.buttons[3];
- mapped->buttons[kButtonLeftShoulder] = input.buttons[4];
- mapped->buttons[kButtonRightShoulder] = input.buttons[5];
- mapped->buttons[kButtonLeftTrigger] = AxisToButton(input.axes[3]);
- mapped->buttons[kButtonRightTrigger] = AxisToButton(input.axes[4]);
- mapped->buttons[kButtonBackSelect] = input.buttons[8];
- mapped->buttons[kButtonStart] = input.buttons[9];
- mapped->buttons[kButtonLeftThumbstick] = input.buttons[10];
- mapped->buttons[kButtonRightThumbstick] = input.buttons[11];
- mapped->buttons[kButtonDpadUp] = AxisNegativeAsButton(input.axes[7]);
- mapped->buttons[kButtonDpadDown] = AxisPositiveAsButton(input.axes[7]);
- mapped->buttons[kButtonDpadLeft] = AxisNegativeAsButton(input.axes[6]);
- mapped->buttons[kButtonDpadRight] = AxisPositiveAsButton(input.axes[6]);
- mapped->buttons[kButtonMeta] = input.buttons[12];
- mapped->buttons[kTouchpadButton] = input.buttons[13];
- mapped->axes[kAxisRightStickY] = input.axes[5];
-
- mapped->buttonsLength = kNumDualshock4Buttons;
- mapped->axesLength = kNumAxes;
-}
-
-void MapperXGEAR(
- const blink::WebGamepad& input,
- blink::WebGamepad* mapped) {
- *mapped = input;
- mapped->buttons[kButtonPrimary] = input.buttons[2];
- mapped->buttons[kButtonSecondary] = input.buttons[1];
- mapped->buttons[kButtonTertiary] = input.buttons[3];
- mapped->buttons[kButtonQuaternary] = input.buttons[0];
- mapped->buttons[kButtonLeftShoulder] = input.buttons[6];
- mapped->buttons[kButtonRightShoulder] = input.buttons[7];
- mapped->buttons[kButtonLeftTrigger] = input.buttons[4];
- mapped->buttons[kButtonRightTrigger] = input.buttons[5];
- mapped->buttons[kButtonDpadUp] = AxisNegativeAsButton(input.axes[5]);
- mapped->buttons[kButtonDpadDown] = AxisPositiveAsButton(input.axes[5]);
- mapped->buttons[kButtonDpadLeft] = AxisNegativeAsButton(input.axes[4]);
- mapped->buttons[kButtonDpadRight] = AxisPositiveAsButton(input.axes[4]);
- mapped->axes[kAxisRightStickX] = input.axes[3];
- mapped->axes[kAxisRightStickY] = input.axes[2];
- mapped->buttonsLength = kNumButtons - 1; // no Meta on this device
- mapped->axesLength = kNumAxes;
-}
-
-
-void MapperDragonRiseGeneric(
- const blink::WebGamepad& input,
- blink::WebGamepad* mapped) {
- *mapped = input;
- mapped->buttons[kButtonDpadUp] = AxisNegativeAsButton(input.axes[6]);
- mapped->buttons[kButtonDpadDown] = AxisPositiveAsButton(input.axes[6]);
- mapped->buttons[kButtonDpadLeft] = AxisNegativeAsButton(input.axes[5]);
- mapped->buttons[kButtonDpadRight] = AxisPositiveAsButton(input.axes[5]);
- mapped->axes[kAxisLeftStickX] = input.axes[0];
- mapped->axes[kAxisLeftStickY] = input.axes[1];
- mapped->axes[kAxisRightStickX] = input.axes[3];
- mapped->axes[kAxisRightStickY] = input.axes[4];
- mapped->buttonsLength = kNumButtons - 1; // no Meta on this device
- mapped->axesLength = kNumAxes;
-}
-
-void MapperOnLiveWireless(
- const blink::WebGamepad& input,
- blink::WebGamepad* mapped) {
- *mapped = input;
- mapped->buttons[kButtonLeftTrigger] = AxisToButton(input.axes[2]);
- mapped->buttons[kButtonRightTrigger] = AxisToButton(input.axes[5]);
- mapped->buttons[kButtonBackSelect] = input.buttons[6];
- mapped->buttons[kButtonStart] = input.buttons[7];
- mapped->buttons[kButtonLeftThumbstick] = input.buttons[9];
- mapped->buttons[kButtonRightThumbstick] = input.buttons[10];
- mapped->buttons[kButtonDpadUp] = AxisNegativeAsButton(input.axes[7]);
- mapped->buttons[kButtonDpadDown] = AxisPositiveAsButton(input.axes[7]);
- mapped->buttons[kButtonDpadLeft] = AxisNegativeAsButton(input.axes[6]);
- mapped->buttons[kButtonDpadRight] = AxisPositiveAsButton(input.axes[6]);
- mapped->buttons[kButtonMeta] = input.buttons[8];
- mapped->axes[kAxisRightStickX] = input.axes[3];
- mapped->axes[kAxisRightStickY] = input.axes[4];
-
- mapped->buttonsLength = kNumButtons;
- mapped->axesLength = kNumAxes;
-}
-
-void MapperADT1(
- const blink::WebGamepad& input,
- blink::WebGamepad* mapped) {
- *mapped = input;
- mapped->buttons[kButtonLeftTrigger] = AxisToButton(input.axes[5]);
- mapped->buttons[kButtonRightTrigger] = AxisToButton(input.axes[4]);
- mapped->buttons[kButtonBackSelect] = NullButton();
- mapped->buttons[kButtonStart] = NullButton();
- mapped->buttons[kButtonLeftThumbstick] = input.buttons[7];
- mapped->buttons[kButtonRightThumbstick] = input.buttons[8];
- mapped->buttons[kButtonDpadUp] = AxisNegativeAsButton(input.axes[7]);
- mapped->buttons[kButtonDpadDown] = AxisPositiveAsButton(input.axes[7]);
- mapped->buttons[kButtonDpadLeft] = AxisNegativeAsButton(input.axes[6]);
- mapped->buttons[kButtonDpadRight] = AxisPositiveAsButton(input.axes[6]);
- mapped->buttons[kButtonMeta] = input.buttons[6];
-
- mapped->buttonsLength = kNumButtons;
- mapped->axesLength = kNumAxes;
+ mapped->buttons[BUTTON_INDEX_PRIMARY] = input.buttons[1];
+ mapped->buttons[BUTTON_INDEX_SECONDARY] = input.buttons[2];
+ mapped->buttons[BUTTON_INDEX_TERTIARY] = input.buttons[0];
+ mapped->buttons[BUTTON_INDEX_QUATERNARY] = input.buttons[3];
+ mapped->buttons[BUTTON_INDEX_LEFT_SHOULDER] = input.buttons[4];
+ mapped->buttons[BUTTON_INDEX_RIGHT_SHOULDER] = input.buttons[5];
+ mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = AxisToButton(input.axes[3]);
+ mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = AxisToButton(input.axes[4]);
+ mapped->buttons[BUTTON_INDEX_BACK_SELECT] = input.buttons[8];
+ mapped->buttons[BUTTON_INDEX_START] = input.buttons[9];
+ mapped->buttons[BUTTON_INDEX_LEFT_THUMBSTICK] = input.buttons[10];
+ mapped->buttons[BUTTON_INDEX_RIGHT_THUMBSTICK] = input.buttons[11];
+ mapped->buttons[BUTTON_INDEX_DPAD_UP] = AxisNegativeAsButton(input.axes[7]);
+ mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = AxisPositiveAsButton(input.axes[7]);
+ mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = AxisNegativeAsButton(input.axes[6]);
+ mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] =
+ AxisPositiveAsButton(input.axes[6]);
+ mapped->buttons[BUTTON_INDEX_META] = input.buttons[12];
+ mapped->buttons[DUALSHOCK_BUTTON_TOUCHPAD] = input.buttons[13];
+ mapped->axes[AXIS_INDEX_RIGHT_STICK_Y] = input.axes[5];
+
+ mapped->buttonsLength = DUALSHOCK_BUTTON_COUNT;
+ mapped->axesLength = AXIS_INDEX_COUNT;
+}
+
+void MapperXGEAR(const blink::WebGamepad& input, blink::WebGamepad* mapped) {
+ *mapped = input;
+ mapped->buttons[BUTTON_INDEX_PRIMARY] = input.buttons[2];
+ mapped->buttons[BUTTON_INDEX_SECONDARY] = input.buttons[1];
+ mapped->buttons[BUTTON_INDEX_TERTIARY] = input.buttons[3];
+ mapped->buttons[BUTTON_INDEX_QUATERNARY] = input.buttons[0];
+ mapped->buttons[BUTTON_INDEX_LEFT_SHOULDER] = input.buttons[6];
+ mapped->buttons[BUTTON_INDEX_RIGHT_SHOULDER] = input.buttons[7];
+ mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = input.buttons[4];
+ mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = input.buttons[5];
+ mapped->buttons[BUTTON_INDEX_DPAD_UP] = AxisNegativeAsButton(input.axes[5]);
+ mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = AxisPositiveAsButton(input.axes[5]);
+ mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = AxisNegativeAsButton(input.axes[4]);
+ mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] =
+ AxisPositiveAsButton(input.axes[4]);
+ mapped->axes[AXIS_INDEX_RIGHT_STICK_X] = input.axes[3];
+ mapped->axes[AXIS_INDEX_RIGHT_STICK_Y] = input.axes[2];
+ mapped->buttonsLength = BUTTON_INDEX_COUNT - 1; // no Meta on this device
+ mapped->axesLength = AXIS_INDEX_COUNT;
+}
+
+void MapperDragonRiseGeneric(const blink::WebGamepad& input,
+ blink::WebGamepad* mapped) {
+ *mapped = input;
+ mapped->buttons[BUTTON_INDEX_DPAD_UP] = AxisNegativeAsButton(input.axes[6]);
+ mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = AxisPositiveAsButton(input.axes[6]);
+ mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = AxisNegativeAsButton(input.axes[5]);
+ mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] =
+ AxisPositiveAsButton(input.axes[5]);
+ mapped->axes[AXIS_INDEX_LEFT_STICK_X] = input.axes[0];
+ mapped->axes[AXIS_INDEX_LEFT_STICK_Y] = input.axes[1];
+ mapped->axes[AXIS_INDEX_RIGHT_STICK_X] = input.axes[3];
+ mapped->axes[AXIS_INDEX_RIGHT_STICK_Y] = input.axes[4];
+ mapped->buttonsLength = BUTTON_INDEX_COUNT - 1; // no Meta on this device
+ mapped->axesLength = AXIS_INDEX_COUNT;
+}
+
+void MapperOnLiveWireless(const blink::WebGamepad& input,
+ blink::WebGamepad* mapped) {
+ *mapped = input;
+ mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = AxisToButton(input.axes[2]);
+ mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = AxisToButton(input.axes[5]);
+ mapped->buttons[BUTTON_INDEX_BACK_SELECT] = input.buttons[6];
+ mapped->buttons[BUTTON_INDEX_START] = input.buttons[7];
+ mapped->buttons[BUTTON_INDEX_LEFT_THUMBSTICK] = input.buttons[9];
+ mapped->buttons[BUTTON_INDEX_RIGHT_THUMBSTICK] = input.buttons[10];
+ mapped->buttons[BUTTON_INDEX_DPAD_UP] = AxisNegativeAsButton(input.axes[7]);
+ mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = AxisPositiveAsButton(input.axes[7]);
+ mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = AxisNegativeAsButton(input.axes[6]);
+ mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] =
+ AxisPositiveAsButton(input.axes[6]);
+ mapped->buttons[BUTTON_INDEX_META] = input.buttons[8];
+ mapped->axes[AXIS_INDEX_RIGHT_STICK_X] = input.axes[3];
+ mapped->axes[AXIS_INDEX_RIGHT_STICK_Y] = input.axes[4];
+
+ mapped->buttonsLength = BUTTON_INDEX_COUNT;
+ mapped->axesLength = AXIS_INDEX_COUNT;
+}
+
+void MapperADT1(const blink::WebGamepad& input, blink::WebGamepad* mapped) {
+ *mapped = input;
+ mapped->buttons[BUTTON_INDEX_LEFT_TRIGGER] = AxisToButton(input.axes[5]);
+ mapped->buttons[BUTTON_INDEX_RIGHT_TRIGGER] = AxisToButton(input.axes[4]);
+ mapped->buttons[BUTTON_INDEX_BACK_SELECT] = NullButton();
+ mapped->buttons[BUTTON_INDEX_START] = NullButton();
+ mapped->buttons[BUTTON_INDEX_LEFT_THUMBSTICK] = input.buttons[7];
+ mapped->buttons[BUTTON_INDEX_RIGHT_THUMBSTICK] = input.buttons[8];
+ mapped->buttons[BUTTON_INDEX_DPAD_UP] = AxisNegativeAsButton(input.axes[7]);
+ mapped->buttons[BUTTON_INDEX_DPAD_DOWN] = AxisPositiveAsButton(input.axes[7]);
+ mapped->buttons[BUTTON_INDEX_DPAD_LEFT] = AxisNegativeAsButton(input.axes[6]);
+ mapped->buttons[BUTTON_INDEX_DPAD_RIGHT] =
+ AxisPositiveAsButton(input.axes[6]);
+ mapped->buttons[BUTTON_INDEX_META] = input.buttons[6];
+
+ mapped->buttonsLength = BUTTON_INDEX_COUNT;
+ mapped->axesLength = AXIS_INDEX_COUNT;
}
struct MappingData {
@@ -195,21 +191,23 @@
const char* const product_id;
GamepadStandardMappingFunction function;
} AvailableMappings[] = {
- // http://www.linux-usb.org/usb.ids
- { "0079", "0006", MapperDragonRiseGeneric }, // DragonRise Generic USB
- { "045e", "028e", MapperXInputStyleGamepad }, // Xbox 360 Controller
- { "045e", "028f", MapperXInputStyleGamepad }, // Xbox 360 Wireless Controller
- { "046d", "c21d", MapperXInputStyleGamepad }, // Logitech F310
- { "046d", "c21e", MapperXInputStyleGamepad }, // Logitech F510
- { "046d", "c21f", MapperXInputStyleGamepad }, // Logitech F710
- { "054c", "0268", MapperPlaystationSixAxis }, // Playstation SIXAXIS
- { "054c", "05c4", MapperDualshock4 }, // Playstation Dualshock 4
- { "0925", "0005", MapperLakeviewResearch }, // SmartJoy PLUS Adapter
- { "0925", "8866", MapperLakeviewResearch }, // WiseGroup MP-8866
- { "0e8f", "0003", MapperXGEAR }, // XFXforce XGEAR PS2 Controller
- { "2378", "1008", MapperOnLiveWireless }, // OnLive Controller (Bluetooth)
- { "2378", "100a", MapperOnLiveWireless }, // OnLive Controller (Wired)
- { "18d1", "2c40", MapperADT1 }, // ADT-1 Controller
+ // http://www.linux-usb.org/usb.ids
+ {"0079", "0006", MapperDragonRiseGeneric}, // DragonRise Generic USB
+ {"045e", "028e", MapperXInputStyleGamepad}, // Xbox 360 Controller
+ {"045e",
+ "028f",
+ MapperXInputStyleGamepad}, // Xbox 360 Wireless Controller
+ {"046d", "c21d", MapperXInputStyleGamepad}, // Logitech F310
+ {"046d", "c21e", MapperXInputStyleGamepad}, // Logitech F510
+ {"046d", "c21f", MapperXInputStyleGamepad}, // Logitech F710
+ {"054c", "0268", MapperPlaystationSixAxis}, // Playstation SIXAXIS
+ {"054c", "05c4", MapperDualshock4}, // Playstation Dualshock 4
+ {"0925", "0005", MapperLakeviewResearch}, // SmartJoy PLUS Adapter
+ {"0925", "8866", MapperLakeviewResearch}, // WiseGroup MP-8866
+ {"0e8f", "0003", MapperXGEAR}, // XFXforce XGEAR PS2 Controller
+ {"2378", "1008", MapperOnLiveWireless}, // OnLive Controller (Bluetooth)
+ {"2378", "100a", MapperOnLiveWireless}, // OnLive Controller (Wired)
+ {"18d1", "2c40", MapperADT1}, // ADT-1 Controller
};
} // namespace
« no previous file with comments | « content/browser/gamepad/gamepad_standard_mappings.cc ('k') | content/browser/gamepad/gamepad_standard_mappings_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698