From cba4c3cdc439f213344ee4ab87c971263f670b6c Mon Sep 17 00:00:00 2001 From: shinra-electric <50119606+shinra-electric@users.noreply.github.com> Date: Thu, 11 Aug 2022 06:14:37 +0100 Subject: [PATCH] [macOS] Update hid_pad_handler.cpp to prevent DS4 from disconnecting (#12493) Prevents DS4 (and possibly DS3) from disconnecting from bluetooth after 15 minutes by using hidapi's non-exclusive mode. The most recent version of hidapi, 0.12 from two months ago, added "macOS-specific function(s) to open device(s) in non-exclusive mode". --- rpcs3/Input/hid_pad_handler.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/rpcs3/Input/hid_pad_handler.cpp b/rpcs3/Input/hid_pad_handler.cpp index 5087882567..c848ed159d 100644 --- a/rpcs3/Input/hid_pad_handler.cpp +++ b/rpcs3/Input/hid_pad_handler.cpp @@ -7,6 +7,10 @@ #include "Emu/System.h" #include "pad_thread.h" +#if defined(__APPLE__) +#include "3rdparty/hidapi/hidapi/mac/hidapi_darwin.h" +#endif + #include #include @@ -63,6 +67,10 @@ bool hid_pad_handler::Init() if (res != 0) fmt::throw_exception("%s hidapi-init error.threadproc", m_type); +#if defined(__APPLE__) + hid_darwin_set_open_exclusive(0); +#endif + for (usz i = 1; i <= MAX_GAMEPADS; i++) // Controllers 1-n in GUI { m_controllers.emplace(m_name_string + std::to_string(i), std::make_shared());