diff options
| author | Léo Lam <leo@innovatetechnologi.es> | 2017-02-06 23:04:14 +0100 |
|---|---|---|
| committer | Léo Lam <leo@innovatetechnologi.es> | 2017-02-07 00:47:21 +0100 |
| commit | 6a0bf24e0b9c479eacbf1fd721233ace64057356 (patch) | |
| tree | 4b0041155ae068c55367130a106de7233fcbfbb4 /Source/Core/InputCommon/GCAdapter.cpp | |
| parent | db7ee668ff205de373d9463fc485bc560acf8e7b (diff) | |
Move libusb context initialization to on first use
This prevents libusb warnings from showing up even when the user is
not using Bluetooth or USB passthrough, or the Wii U GC adapter.
Diffstat (limited to 'Source/Core/InputCommon/GCAdapter.cpp')
| -rw-r--r-- | Source/Core/InputCommon/GCAdapter.cpp | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/Source/Core/InputCommon/GCAdapter.cpp b/Source/Core/InputCommon/GCAdapter.cpp index c16b1ce635..1baaceee12 100644 --- a/Source/Core/InputCommon/GCAdapter.cpp +++ b/Source/Core/InputCommon/GCAdapter.cpp @@ -170,17 +170,8 @@ void Init() s_libusb_driver_not_supported = false; - s_libusb_context = LibusbContext::Get(); - if (!s_libusb_context) - { - s_libusb_driver_not_supported = true; - Shutdown(); - } - else - { - if (UseAdapter()) - StartScanThread(); - } + if (UseAdapter()) + StartScanThread(); } void StartScanThread() @@ -188,6 +179,9 @@ void StartScanThread() if (s_adapter_detect_thread_running.IsSet()) return; + s_libusb_context = LibusbContext::Get(); + if (!s_libusb_context) + return; s_adapter_detect_thread_running.Set(true); s_adapter_detect_thread = std::thread(ScanThreadFunc); } @@ -334,7 +328,7 @@ void Shutdown() { StopScanThread(); #if defined(LIBUSB_API_VERSION) && LIBUSB_API_VERSION >= 0x01000102 - if (s_libusb_hotplug_enabled) + if (s_libusb_context && s_libusb_hotplug_enabled) libusb_hotplug_deregister_callback(s_libusb_context.get(), s_hotplug_handle); #endif Reset(); |
