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/platform_data_fetcher_win.h" | 5 #include "content/browser/gamepad/platform_data_fetcher_win.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "content/common/gamepad_messages.h" | 8 #include "content/common/gamepad_messages.h" |
9 #include "content/common/gamepad_hardware_buffer.h" | 9 #include "content/common/gamepad_hardware_buffer.h" |
10 | 10 |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 pad.axes[pad.axesLength++] = -NormalizeAxis(state.Gamepad.sThumbLY); | 140 pad.axes[pad.axesLength++] = -NormalizeAxis(state.Gamepad.sThumbLY); |
141 pad.axes[pad.axesLength++] = NormalizeAxis(state.Gamepad.sThumbRX); | 141 pad.axes[pad.axesLength++] = NormalizeAxis(state.Gamepad.sThumbRX); |
142 pad.axes[pad.axesLength++] = -NormalizeAxis(state.Gamepad.sThumbRY); | 142 pad.axes[pad.axesLength++] = -NormalizeAxis(state.Gamepad.sThumbRY); |
143 } else { | 143 } else { |
144 pad.connected = false; | 144 pad.connected = false; |
145 } | 145 } |
146 } | 146 } |
147 } | 147 } |
148 | 148 |
149 bool GamepadPlatformDataFetcherWin::GetXinputDllFunctions() { | 149 bool GamepadPlatformDataFetcherWin::GetXinputDllFunctions() { |
| 150 xinput_get_capabilities_ = NULL; |
| 151 xinput_get_state_ = NULL; |
150 xinput_enable_ = static_cast<XInputEnableFunc>( | 152 xinput_enable_ = static_cast<XInputEnableFunc>( |
151 xinput_dll_.GetFunctionPointer("XInputEnable")); | 153 xinput_dll_.GetFunctionPointer("XInputEnable")); |
152 if (!xinput_enable_) | 154 if (!xinput_enable_) |
153 return false; | 155 return false; |
154 xinput_get_capabilities_ = static_cast<XInputGetCapabilitiesFunc>( | 156 xinput_get_capabilities_ = static_cast<XInputGetCapabilitiesFunc>( |
155 xinput_dll_.GetFunctionPointer("XInputGetCapabilities")); | 157 xinput_dll_.GetFunctionPointer("XInputGetCapabilities")); |
156 if (!xinput_get_capabilities_) | 158 if (!xinput_get_capabilities_) |
157 return false; | 159 return false; |
158 xinput_get_state_ = static_cast<XInputGetStateFunc>( | 160 xinput_get_state_ = static_cast<XInputGetStateFunc>( |
159 xinput_dll_.GetFunctionPointer("XInputGetState")); | 161 xinput_dll_.GetFunctionPointer("XInputGetState")); |
160 if (!xinput_get_state_) | 162 if (!xinput_get_state_) |
161 return false; | 163 return false; |
162 xinput_enable_(true); | 164 xinput_enable_(true); |
163 return true; | 165 return true; |
164 } | 166 } |
165 | 167 |
166 } // namespace content | 168 } // namespace content |
OLD | NEW |