| 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 "content/browser/gamepad/gamepad_standard_mappings.h" | 5 #include "content/browser/gamepad/gamepad_standard_mappings.h" |
| 6 | 6 |
| 7 namespace content { | 7 namespace content { |
| 8 | 8 |
| 9 namespace { | 9 namespace { |
| 10 | 10 |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 mapped->axesLength = AXIS_INDEX_COUNT; | 256 mapped->axesLength = AXIS_INDEX_COUNT; |
| 257 } | 257 } |
| 258 | 258 |
| 259 struct MappingData { | 259 struct MappingData { |
| 260 const char* const vendor_id; | 260 const char* const vendor_id; |
| 261 const char* const product_id; | 261 const char* const product_id; |
| 262 GamepadStandardMappingFunction function; | 262 GamepadStandardMappingFunction function; |
| 263 } AvailableMappings[] = { | 263 } AvailableMappings[] = { |
| 264 // http://www.linux-usb.org/usb.ids | 264 // http://www.linux-usb.org/usb.ids |
| 265 {"0079", "0006", MapperDragonRiseGeneric}, // DragonRise Generic USB | 265 {"0079", "0006", MapperDragonRiseGeneric}, // DragonRise Generic USB |
| 266 {"045e", "028e", MapperXbox360Gamepad}, // Xbox 360 Controller | 266 {"045e", "028e", MapperXbox360Gamepad}, // Xbox 360 Wired |
| 267 {"045e", "028f", MapperXbox360Gamepad}, // Xbox 360 Wireless Controller | 267 {"045e", "028f", MapperXbox360Gamepad}, // Xbox 360 Wireless |
| 268 {"045e", "0719", MapperXbox360Gamepad}, // Xbox 360 Wireless |
| 268 {"046d", "c216", MapperDirectInputStyle}, // Logitech F310, D mode | 269 {"046d", "c216", MapperDirectInputStyle}, // Logitech F310, D mode |
| 269 {"046d", "c218", MapperDirectInputStyle}, // Logitech F510, D mode | 270 {"046d", "c218", MapperDirectInputStyle}, // Logitech F510, D mode |
| 270 {"046d", "c219", MapperDirectInputStyle}, // Logitech F710, D mode | 271 {"046d", "c219", MapperDirectInputStyle}, // Logitech F710, D mode |
| 271 {"054c", "0268", MapperPlaystationSixAxis}, // Playstation SIXAXIS | 272 {"054c", "0268", MapperPlaystationSixAxis}, // Playstation SIXAXIS |
| 272 {"054c", "05c4", MapperDualshock4}, // Playstation Dualshock 4 | 273 {"054c", "05c4", MapperDualshock4}, // Playstation Dualshock 4 |
| 273 {"0583", "2060", MapperIBuffalo}, // iBuffalo Classic | 274 {"0583", "2060", MapperIBuffalo}, // iBuffalo Classic |
| 274 {"0925", "0005", MapperSmartJoyPLUS}, // SmartJoy PLUS Adapter | 275 {"0925", "0005", MapperSmartJoyPLUS}, // SmartJoy PLUS Adapter |
| 275 {"0e8f", "0003", MapperXGEAR}, // XFXforce XGEAR PS2 Controller | 276 {"0e8f", "0003", MapperXGEAR}, // XFXforce XGEAR PS2 Controller |
| 276 {"18d1", "2c40", MapperADT1}, // ADT-1 Controller | 277 {"18d1", "2c40", MapperADT1}, // ADT-1 Controller |
| 277 {"2222", "0060", MapperDirectInputStyle}, // Macally iShockX, analog mode | 278 {"2222", "0060", MapperDirectInputStyle}, // Macally iShockX, analog mode |
| 278 {"2222", "4010", MapperMacallyIShock}, // Macally iShock | 279 {"2222", "4010", MapperMacallyIShock}, // Macally iShock |
| 279 {"2378", "1008", MapperOnLiveWireless}, // OnLive Controller (Bluetooth) | 280 {"2378", "1008", MapperOnLiveWireless}, // OnLive Controller (Bluetooth) |
| 280 {"2378", "100a", MapperOnLiveWireless}, // OnLive Controller (Wired) | 281 {"2378", "100a", MapperOnLiveWireless}, // OnLive Controller (Wired) |
| 281 }; | 282 }; |
| 282 | 283 |
| 283 } // namespace | 284 } // namespace |
| 284 | 285 |
| 285 GamepadStandardMappingFunction GetGamepadStandardMappingFunction( | 286 GamepadStandardMappingFunction GetGamepadStandardMappingFunction( |
| 286 const base::StringPiece& vendor_id, | 287 const base::StringPiece& vendor_id, |
| 287 const base::StringPiece& product_id) { | 288 const base::StringPiece& product_id) { |
| 288 for (size_t i = 0; i < arraysize(AvailableMappings); ++i) { | 289 for (size_t i = 0; i < arraysize(AvailableMappings); ++i) { |
| 289 MappingData& item = AvailableMappings[i]; | 290 MappingData& item = AvailableMappings[i]; |
| 290 if (vendor_id == item.vendor_id && product_id == item.product_id) | 291 if (vendor_id == item.vendor_id && product_id == item.product_id) |
| 291 return item.function; | 292 return item.function; |
| 292 } | 293 } |
| 293 return NULL; | 294 return NULL; |
| 294 } | 295 } |
| 295 | 296 |
| 296 } // namespace content | 297 } // namespace content |
| OLD | NEW |