diff options
| author | Léo Lam <leo@leolam.fr> | 2021-06-07 12:15:15 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-06-07 12:15:15 +0200 |
| commit | 8ca6ffd908aa95ffb5c7665083463c4ea1139b0d (patch) | |
| tree | 5a058d8aa001d2577f7e65d5aa44ec86737c3386 /Source/Core/InputCommon/ControllerInterface/OSX | |
| parent | ebe3fbe04c329f9bc100ded4dcf22720f375e2f4 (diff) | |
| parent | 83ea16f40238fa82981221ba65061a7094b2a64b (diff) | |
Merge pull request #9702 from Filoppi/controller_interface_fixes
Controller Interface refactor
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface/OSX')
| -rw-r--r-- | Source/Core/InputCommon/ControllerInterface/OSX/OSX.h | 3 | ||||
| -rw-r--r-- | Source/Core/InputCommon/ControllerInterface/OSX/OSX.mm | 26 |
2 files changed, 11 insertions, 18 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/OSX/OSX.h b/Source/Core/InputCommon/ControllerInterface/OSX/OSX.h index 955b426f5e..f4ebc1a911 100644 --- a/Source/Core/InputCommon/ControllerInterface/OSX/OSX.h +++ b/Source/Core/InputCommon/ControllerInterface/OSX/OSX.h @@ -6,8 +6,7 @@ namespace ciface::OSX { -void Init(void* window); -void PopulateDevices(void* window); +void Init(); void DeInit(); void DeviceElementDebugPrint(const void*, void*); diff --git a/Source/Core/InputCommon/ControllerInterface/OSX/OSX.mm b/Source/Core/InputCommon/ControllerInterface/OSX/OSX.mm index 63bddf499e..8c80e9f529 100644 --- a/Source/Core/InputCommon/ControllerInterface/OSX/OSX.mm +++ b/Source/Core/InputCommon/ControllerInterface/OSX/OSX.mm @@ -135,8 +135,6 @@ static void DeviceDebugPrint(IOHIDDeviceRef device) #endif } -static void* g_window; - static std::string GetDeviceRefName(IOHIDDeviceRef inIOHIDDeviceRef) { const NSString* name = reinterpret_cast<const NSString*>( @@ -172,10 +170,8 @@ static void DeviceMatchingCallback(void* inContext, IOReturn inResult, void* inS } } -void Init(void* window) +void Init() { - g_window = window; - HIDManager = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone); if (!HIDManager) ERROR_LOG_FMT(CONTROLLERINTERFACE, "Failed to create HID Manager reference"); @@ -210,19 +206,17 @@ void Init(void* window) }); } -void PopulateDevices(void* window) -{ - DeInit(); - Init(window); -} - void DeInit() { - s_stopper.Signal(); - s_hotplug_thread.join(); + if (HIDManager) + { + s_stopper.Signal(); + s_hotplug_thread.join(); - // This closes all devices as well - IOHIDManagerClose(HIDManager, kIOHIDOptionsTypeNone); - CFRelease(HIDManager); + // This closes all devices as well + IOHIDManagerClose(HIDManager, kIOHIDOptionsTypeNone); + CFRelease(HIDManager); + HIDManager = nullptr; + } } } // namespace ciface::OSX |
