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 "device/gamepad/gamepad_platform_data_fetcher_win.h" | 5 #include "device/gamepad/gamepad_platform_data_fetcher_win.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <string.h> | 8 #include <string.h> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 default: | 61 default: |
62 return L"<UNKNOWN>"; | 62 return L"<UNKNOWN>"; |
63 } | 63 } |
64 } | 64 } |
65 | 65 |
66 const UChar* XInputDllFileName() { | 66 const UChar* XInputDllFileName() { |
67 // Xinput.h defines filename (XINPUT_DLL) on different Windows versions, but | 67 // Xinput.h defines filename (XINPUT_DLL) on different Windows versions, but |
68 // Xinput.h specifies it in build time. Approach here uses the same values | 68 // Xinput.h specifies it in build time. Approach here uses the same values |
69 // and it is resolving dll filename based on Windows version it is running on. | 69 // and it is resolving dll filename based on Windows version it is running on. |
70 if (base::win::GetVersion() >= base::win::VERSION_WIN8) { | 70 if (base::win::GetVersion() >= base::win::VERSION_WIN8) { |
71 // For Windows 8 and 10, XINPUT_DLL is xinput1_4.dll. | 71 // For Windows 8+, XINPUT_DLL is xinput1_4.dll. |
72 return FILE_PATH_LITERAL("xinput1_4.dll"); | 72 return FILE_PATH_LITERAL("xinput1_4.dll"); |
73 } else if (base::win::GetVersion() >= base::win::VERSION_WIN7) { | |
74 return FILE_PATH_LITERAL("xinput9_1_0.dll"); | |
75 } else { | |
76 NOTREACHED(); | |
77 return nullptr; | |
78 } | 73 } |
| 74 return FILE_PATH_LITERAL("xinput9_1_0.dll"); |
79 } | 75 } |
80 | 76 |
81 } // namespace | 77 } // namespace |
82 | 78 |
83 GamepadPlatformDataFetcherWin::GamepadPlatformDataFetcherWin() | 79 GamepadPlatformDataFetcherWin::GamepadPlatformDataFetcherWin() |
84 : xinput_available_(false) {} | 80 : xinput_available_(false) {} |
85 | 81 |
86 GamepadPlatformDataFetcherWin::~GamepadPlatformDataFetcherWin() { | 82 GamepadPlatformDataFetcherWin::~GamepadPlatformDataFetcherWin() { |
87 } | 83 } |
88 | 84 |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 if (!xinput_get_state_) | 221 if (!xinput_get_state_) |
226 return false; | 222 return false; |
227 if (xinput_enable) { | 223 if (xinput_enable) { |
228 // XInputEnable is unavailable before Win8 and deprecated in Win10. | 224 // XInputEnable is unavailable before Win8 and deprecated in Win10. |
229 xinput_enable(true); | 225 xinput_enable(true); |
230 } | 226 } |
231 return true; | 227 return true; |
232 } | 228 } |
233 | 229 |
234 } // namespace device | 230 } // namespace device |
OLD | NEW |