diff options
| author | Matthew Parlane <parlane@gmail.com> | 2017-03-28 13:47:47 +1300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-03-28 13:47:47 +1300 |
| commit | 22256d1bd88739338a64c92d267967bd06d136cb (patch) | |
| tree | d9c2e35e5c3425c4d7746a20cb0e90f0e5d5e8a8 /Source/Core/Common | |
| parent | dc2d11c1a74fbc312ba36518bb7ec297a0c6f119 (diff) | |
| parent | 9aaaa2b924cbc5efa578e7522977935251e3318f (diff) | |
Merge pull request #5170 from leoetlino/bt-fix
libusb fixes (mostly for IOS)
Diffstat (limited to 'Source/Core/Common')
| -rw-r--r-- | Source/Core/Common/CMakeLists.txt | 5 | ||||
| -rw-r--r-- | Source/Core/Common/Common.vcxproj | 4 | ||||
| -rw-r--r-- | Source/Core/Common/Common.vcxproj.filters | 2 | ||||
| -rw-r--r-- | Source/Core/Common/LibusbContext.cpp | 49 | ||||
| -rw-r--r-- | Source/Core/Common/LibusbContext.h | 15 |
5 files changed, 0 insertions, 75 deletions
diff --git a/Source/Core/Common/CMakeLists.txt b/Source/Core/Common/CMakeLists.txt index c894a297c3..4e1f21b55f 100644 --- a/Source/Core/Common/CMakeLists.txt +++ b/Source/Core/Common/CMakeLists.txt @@ -40,11 +40,6 @@ set(SRCS Logging/LogManager.cpp ) -if(LIBUSB_FOUND) - set(LIBS ${LIBS} ${LIBUSB_LIBRARIES}) - set(SRCS ${SRCS} LibusbContext.cpp) -endif(LIBUSB_FOUND) - if(ANDROID) set(SRCS ${SRCS} Logging/ConsoleListenerDroid.cpp) diff --git a/Source/Core/Common/Common.vcxproj b/Source/Core/Common/Common.vcxproj index 928c8c8196..13256bdce7 100644 --- a/Source/Core/Common/Common.vcxproj +++ b/Source/Core/Common/Common.vcxproj @@ -118,7 +118,6 @@ <ClInclude Include="Hash.h" /> <ClInclude Include="IniFile.h" /> <ClInclude Include="JitRegister.h" /> - <ClInclude Include="LibusbContext.h" /> <ClInclude Include="LinearDiskCache.h" /> <ClInclude Include="MathUtil.h" /> <ClInclude Include="MD5.h" /> @@ -170,9 +169,6 @@ <ClCompile Include="Hash.cpp" /> <ClCompile Include="IniFile.cpp" /> <ClCompile Include="JitRegister.cpp" /> - <ClCompile Include="LibusbContext.cpp"> - <DisableSpecificWarnings>4200;%(DisableSpecificWarnings)</DisableSpecificWarnings> - </ClCompile> <ClCompile Include="Logging\ConsoleListenerWin.cpp" /> <ClCompile Include="MathUtil.cpp" /> <ClCompile Include="MD5.cpp" /> diff --git a/Source/Core/Common/Common.vcxproj.filters b/Source/Core/Common/Common.vcxproj.filters index b6dd7d27e0..cb6fba5ad5 100644 --- a/Source/Core/Common/Common.vcxproj.filters +++ b/Source/Core/Common/Common.vcxproj.filters @@ -49,7 +49,6 @@ <ClInclude Include="FPURoundMode.h" /> <ClInclude Include="Hash.h" /> <ClInclude Include="IniFile.h" /> - <ClInclude Include="LibusbContext.h" /> <ClInclude Include="LinearDiskCache.h" /> <ClInclude Include="MathUtil.h" /> <ClInclude Include="MemArena.h" /> @@ -251,7 +250,6 @@ <ClCompile Include="FileUtil.cpp" /> <ClCompile Include="Hash.cpp" /> <ClCompile Include="IniFile.cpp" /> - <ClCompile Include="LibusbContext.cpp" /> <ClCompile Include="MathUtil.cpp" /> <ClCompile Include="MemArena.cpp" /> <ClCompile Include="MemoryUtil.cpp" /> diff --git a/Source/Core/Common/LibusbContext.cpp b/Source/Core/Common/LibusbContext.cpp deleted file mode 100644 index 1eb729c4a0..0000000000 --- a/Source/Core/Common/LibusbContext.cpp +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2017 Dolphin Emulator Project -// Licensed under GPLv2+ -// Refer to the license.txt file included. - -#include <libusb.h> -#include <memory> -#include <mutex> - -#include "Common/LibusbContext.h" -#include "Common/MsgHandler.h" -#include "Common/StringUtil.h" - -namespace LibusbContext -{ -static std::shared_ptr<libusb_context> s_libusb_context; -static std::once_flag s_context_initialized; - -static libusb_context* Create() -{ - libusb_context* context; - const int ret = libusb_init(&context); - if (ret < LIBUSB_SUCCESS) - { - bool is_windows = false; -#ifdef _WIN32 - is_windows = true; -#endif - const std::string reason = - is_windows && ret == LIBUSB_ERROR_NOT_FOUND ? - GetStringT("Failed to initialize libusb because usbdk is not installed.") : - StringFromFormat(GetStringT("Failed to initialize libusb (%s).").c_str(), - libusb_error_name(ret)); - PanicAlertT("%s\nSome USB features will not work.", reason.c_str()); - return nullptr; - } - return context; -} - -std::shared_ptr<libusb_context> Get() -{ - std::call_once(s_context_initialized, []() { - s_libusb_context.reset(Create(), [](auto* context) { - if (context != nullptr) - libusb_exit(context); - }); - }); - return s_libusb_context; -} -} diff --git a/Source/Core/Common/LibusbContext.h b/Source/Core/Common/LibusbContext.h deleted file mode 100644 index 99af12ba4c..0000000000 --- a/Source/Core/Common/LibusbContext.h +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2017 Dolphin Emulator Project -// Licensed under GPLv2+ -// Refer to the license.txt file included. - -#include <memory> - -struct libusb_context; - -namespace LibusbContext -{ -// libusb on Windows is limited to only a single context. Trying to open more -// than one can cause issues with device enumerations. -// libusb is thread-safe so this context can be safely used from different threads. -std::shared_ptr<libusb_context> Get(); -} |
