mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-04 22:11:26 +12:00
[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".
This commit is contained in:
parent
c51d3b5465
commit
cba4c3cdc4
1 changed files with 8 additions and 0 deletions
|
@ -7,6 +7,10 @@
|
||||||
#include "Emu/System.h"
|
#include "Emu/System.h"
|
||||||
#include "pad_thread.h"
|
#include "pad_thread.h"
|
||||||
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
#include "3rdparty/hidapi/hidapi/mac/hidapi_darwin.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
@ -63,6 +67,10 @@ bool hid_pad_handler<Device>::Init()
|
||||||
if (res != 0)
|
if (res != 0)
|
||||||
fmt::throw_exception("%s hidapi-init error.threadproc", m_type);
|
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
|
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<Device>());
|
m_controllers.emplace(m_name_string + std::to_string(i), std::make_shared<Device>());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue