summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/GCAdapter.cpp
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2017-02-08 14:00:12 +0100
committerGitHub <noreply@github.com>2017-02-08 14:00:12 +0100
commit99492c22a6a6e7d7d565c4731b9870b6dadbf26e (patch)
tree583989737b86b107d0507517c3465a916dde9365 /Source/Core/InputCommon/GCAdapter.cpp
parent027719d8e2b09c6795d235e7d56803fb09885522 (diff)
parentb6d526ba2e94e1bcb155c7d6b2eee7833e3ae81b (diff)
Merge pull request #4839 from leoetlino/better-warnings
Be less annoying when usbdk is not installed
Diffstat (limited to 'Source/Core/InputCommon/GCAdapter.cpp')
-rw-r--r--Source/Core/InputCommon/GCAdapter.cpp18
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();