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 12 matching lines...) Expand all Loading... |
23 static const BYTE kDeviceSubTypeWheel = 2; | 23 static const BYTE kDeviceSubTypeWheel = 2; |
24 static const BYTE kDeviceSubTypeArcadeStick = 3; | 24 static const BYTE kDeviceSubTypeArcadeStick = 3; |
25 static const BYTE kDeviceSubTypeFlightStick = 4; | 25 static const BYTE kDeviceSubTypeFlightStick = 4; |
26 static const BYTE kDeviceSubTypeDancePad = 5; | 26 static const BYTE kDeviceSubTypeDancePad = 5; |
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 static const float kMinAxisResetValue = 0.1f; | |
34 | |
35 float NormalizeXInputAxis(SHORT value) { | 33 float NormalizeXInputAxis(SHORT value) { |
36 return ((value + 32768.f) / 32767.5f) - 1.f; | 34 return ((value + 32768.f) / 32767.5f) - 1.f; |
37 } | 35 } |
38 | 36 |
39 const WebUChar* const GamepadSubTypeName(BYTE sub_type) { | 37 const WebUChar* const GamepadSubTypeName(BYTE sub_type) { |
40 switch (sub_type) { | 38 switch (sub_type) { |
41 case kDeviceSubTypeGamepad: return L"GAMEPAD"; | 39 case kDeviceSubTypeGamepad: return L"GAMEPAD"; |
42 case kDeviceSubTypeWheel: return L"WHEEL"; | 40 case kDeviceSubTypeWheel: return L"WHEEL"; |
43 case kDeviceSubTypeArcadeStick: return L"ARCADE_STICK"; | 41 case kDeviceSubTypeArcadeStick: return L"ARCADE_STICK"; |
44 case kDeviceSubTypeFlightStick: return L"FLIGHT_STICK"; | 42 case kDeviceSubTypeFlightStick: return L"FLIGHT_STICK"; |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 return false; | 324 return false; |
327 xinput_get_state_ = reinterpret_cast<XInputGetStateFunc>( | 325 xinput_get_state_ = reinterpret_cast<XInputGetStateFunc>( |
328 xinput_dll_.GetFunctionPointer("XInputGetState")); | 326 xinput_dll_.GetFunctionPointer("XInputGetState")); |
329 if (!xinput_get_state_) | 327 if (!xinput_get_state_) |
330 return false; | 328 return false; |
331 xinput_enable_(true); | 329 xinput_enable_(true); |
332 return true; | 330 return true; |
333 } | 331 } |
334 | 332 |
335 } // namespace content | 333 } // namespace content |
OLD | NEW |