diff options
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface/OSX')
| -rw-r--r-- | Source/Core/InputCommon/ControllerInterface/OSX/OSX.h | 4 | ||||
| -rw-r--r-- | Source/Core/InputCommon/ControllerInterface/OSX/OSX.mm | 16 |
2 files changed, 9 insertions, 11 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/OSX/OSX.h b/Source/Core/InputCommon/ControllerInterface/OSX/OSX.h index c257d7e8f4..c2104774b7 100644 --- a/Source/Core/InputCommon/ControllerInterface/OSX/OSX.h +++ b/Source/Core/InputCommon/ControllerInterface/OSX/OSX.h @@ -4,13 +4,11 @@ #pragma once -#include "InputCommon/ControllerInterface/Device.h" - namespace ciface { namespace OSX { -void Init(std::vector<Core::Device*>& devices, void* window); +void Init(void* window); 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 1335b01967..ea9723c6b9 100644 --- a/Source/Core/InputCommon/ControllerInterface/OSX/OSX.mm +++ b/Source/Core/InputCommon/ControllerInterface/OSX/OSX.mm @@ -6,6 +6,7 @@ #include <Foundation/Foundation.h> #include <IOKit/hid/IOHIDLib.h> +#include "InputCommon/ControllerInterface/ControllerInterface.h" #include "InputCommon/ControllerInterface/OSX/OSX.h" #include "InputCommon/ControllerInterface/OSX/OSXJoystick.h" #include "InputCommon/ControllerInterface/OSX/OSXKeyboard.h" @@ -140,22 +141,21 @@ static void DeviceMatching_callback(void* inContext, IOReturn inResult, void* in DeviceDebugPrint(inIOHIDDeviceRef); - std::vector<Core::Device*>* devices = (std::vector<Core::Device*>*)inContext; - - // Add to the devices vector if it's of a type we want + // Add a device if it's of a type we want if (IOHIDDeviceConformsTo(inIOHIDDeviceRef, kHIDPage_GenericDesktop, kHIDUsage_GD_Keyboard)) - devices->push_back(new Keyboard(inIOHIDDeviceRef, name, kbd_name_counts[name]++, g_window)); + g_controller_interface.AddDevice( + new Keyboard(inIOHIDDeviceRef, name, kbd_name_counts[name]++, g_window)); #if 0 else if (IOHIDDeviceConformsTo(inIOHIDDeviceRef, kHIDPage_GenericDesktop, kHIDUsage_GD_Mouse)) - devices->push_back(new Mouse(inIOHIDDeviceRef, + g_controller_interface.AddDevice(new Mouse(inIOHIDDeviceRef, name, mouse_name_counts[name]++)); #endif else - devices->push_back(new Joystick(inIOHIDDeviceRef, name, joy_name_counts[name]++)); + g_controller_interface.AddDevice(new Joystick(inIOHIDDeviceRef, name, joy_name_counts[name]++)); } -void Init(std::vector<Core::Device*>& devices, void* window) +void Init(void* window) { HIDManager = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone); if (!HIDManager) @@ -166,7 +166,7 @@ void Init(std::vector<Core::Device*>& devices, void* window) IOHIDManagerSetDeviceMatching(HIDManager, nullptr); // Callbacks for acquisition or loss of a matching device - IOHIDManagerRegisterDeviceMatchingCallback(HIDManager, DeviceMatching_callback, (void*)&devices); + IOHIDManagerRegisterDeviceMatchingCallback(HIDManager, DeviceMatching_callback, nullptr); // Match devices that are plugged in right now IOHIDManagerScheduleWithRunLoop(HIDManager, CFRunLoopGetCurrent(), OurRunLoop); |
