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_platform_data_fetcher_win.h" | 5 #include "content/browser/gamepad/gamepad_platform_data_fetcher_win.h" |
6 | 6 |
7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
8 #include "base/trace_event/trace_event.h" | 8 #include "base/trace_event/trace_event.h" |
9 #include "base/win/windows_version.h" | 9 #include "base/win/windows_version.h" |
10 #include "content/common/gamepad_hardware_buffer.h" | 10 #include "content/common/gamepad_hardware_buffer.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 static const BYTE kDeviceSubTypeGuitar = 6; | 27 static const BYTE kDeviceSubTypeGuitar = 6; |
28 static const BYTE kDeviceSubTypeGuitarAlternate = 7; | 28 static const BYTE kDeviceSubTypeGuitarAlternate = 7; |
29 static const BYTE kDeviceSubTypeDrumKit = 8; | 29 static const BYTE kDeviceSubTypeDrumKit = 8; |
30 static const BYTE kDeviceSubTypeGuitarBass = 11; | 30 static const BYTE kDeviceSubTypeGuitarBass = 11; |
31 static const BYTE kDeviceSubTypeArcadePad = 19; | 31 static const BYTE kDeviceSubTypeArcadePad = 19; |
32 | 32 |
33 float NormalizeXInputAxis(SHORT value) { | 33 float NormalizeXInputAxis(SHORT value) { |
34 return ((value + 32768.f) / 32767.5f) - 1.f; | 34 return ((value + 32768.f) / 32767.5f) - 1.f; |
35 } | 35 } |
36 | 36 |
37 const WebUChar* const GamepadSubTypeName(BYTE sub_type) { | 37 const WebUChar* GamepadSubTypeName(BYTE sub_type) { |
38 switch (sub_type) { | 38 switch (sub_type) { |
39 case kDeviceSubTypeGamepad: return L"GAMEPAD"; | 39 case kDeviceSubTypeGamepad: return L"GAMEPAD"; |
40 case kDeviceSubTypeWheel: return L"WHEEL"; | 40 case kDeviceSubTypeWheel: return L"WHEEL"; |
41 case kDeviceSubTypeArcadeStick: return L"ARCADE_STICK"; | 41 case kDeviceSubTypeArcadeStick: return L"ARCADE_STICK"; |
42 case kDeviceSubTypeFlightStick: return L"FLIGHT_STICK"; | 42 case kDeviceSubTypeFlightStick: return L"FLIGHT_STICK"; |
43 case kDeviceSubTypeDancePad: return L"DANCE_PAD"; | 43 case kDeviceSubTypeDancePad: return L"DANCE_PAD"; |
44 case kDeviceSubTypeGuitar: return L"GUITAR"; | 44 case kDeviceSubTypeGuitar: return L"GUITAR"; |
45 case kDeviceSubTypeGuitarAlternate: return L"GUITAR_ALTERNATE"; | 45 case kDeviceSubTypeGuitarAlternate: return L"GUITAR_ALTERNATE"; |
46 case kDeviceSubTypeDrumKit: return L"DRUM_KIT"; | 46 case kDeviceSubTypeDrumKit: return L"DRUM_KIT"; |
47 case kDeviceSubTypeGuitarBass: return L"GUITAR_BASS"; | 47 case kDeviceSubTypeGuitarBass: return L"GUITAR_BASS"; |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 return false; | 324 return false; |
325 xinput_get_state_ = reinterpret_cast<XInputGetStateFunc>( | 325 xinput_get_state_ = reinterpret_cast<XInputGetStateFunc>( |
326 xinput_dll_.GetFunctionPointer("XInputGetState")); | 326 xinput_dll_.GetFunctionPointer("XInputGetState")); |
327 if (!xinput_get_state_) | 327 if (!xinput_get_state_) |
328 return false; | 328 return false; |
329 xinput_enable_(true); | 329 xinput_enable_(true); |
330 return true; | 330 return true; |
331 } | 331 } |
332 | 332 |
333 } // namespace content | 333 } // namespace content |
OLD | NEW |