diff options
| author | Jules Blok <jules.blok@gmail.com> | 2014-01-29 08:11:51 +0900 |
|---|---|---|
| committer | Jules Blok <jules.blok@gmail.com> | 2014-02-09 17:01:45 +0900 |
| commit | c6d650c0588cd054ed9a5028d56624bc293d6db3 (patch) | |
| tree | ebb1c87390f181c4ca3527944ecbdee1a616eb62 /Source/Core/InputCommon/ControllerInterface/OSX | |
| parent | 02a95c139e5ff56ceca903614b74dba73bf88fc5 (diff) | |
ForceFeedback: Add OSX rumble support
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface/OSX')
| -rw-r--r-- | Source/Core/InputCommon/ControllerInterface/OSX/OSXJoystick.h | 7 | ||||
| -rw-r--r-- | Source/Core/InputCommon/ControllerInterface/OSX/OSXJoystick.mm | 16 |
2 files changed, 18 insertions, 5 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/OSX/OSXJoystick.h b/Source/Core/InputCommon/ControllerInterface/OSX/OSXJoystick.h index ebe908522b..f53fc14cb5 100644 --- a/Source/Core/InputCommon/ControllerInterface/OSX/OSXJoystick.h +++ b/Source/Core/InputCommon/ControllerInterface/OSX/OSXJoystick.h @@ -1,13 +1,14 @@ #include <IOKit/hid/IOHIDLib.h> #include "../Device.h" +#include "../ForceFeedback/ForceFeedbackDevice.h" namespace ciface { namespace OSX { -class Joystick : public Core::Device +class Joystick : public ForceFeedback::ForceFeedbackDevice { private: class Button : public Input @@ -62,9 +63,9 @@ private: public: bool UpdateInput(); - bool UpdateOutput(); Joystick(IOHIDDeviceRef device, std::string name, int index); + ~Joystick(); std::string GetName() const; std::string GetSource() const; @@ -74,6 +75,8 @@ private: const IOHIDDeviceRef m_device; const std::string m_device_name; const int m_index; + + ForceFeedback::FFDeviceAdapterReference m_ff_device; }; } diff --git a/Source/Core/InputCommon/ControllerInterface/OSX/OSXJoystick.mm b/Source/Core/InputCommon/ControllerInterface/OSX/OSXJoystick.mm index ebd713d142..2a26e35447 100644 --- a/Source/Core/InputCommon/ControllerInterface/OSX/OSXJoystick.mm +++ b/Source/Core/InputCommon/ControllerInterface/OSX/OSXJoystick.mm @@ -15,6 +15,7 @@ Joystick::Joystick(IOHIDDeviceRef device, std::string name, int index) : m_device(device) , m_device_name(name) , m_index(index) + , m_ff_device(nullptr) { // Buttons NSDictionary *buttonDict = @@ -71,14 +72,23 @@ Joystick::Joystick(IOHIDDeviceRef device, std::string name, int index) } CFRelease(axes); } + + // Force Feedback + FFCAPABILITIES ff_caps; + if (SUCCEEDED(ForceFeedback::FFDeviceAdapter::Create(IOHIDDeviceGetService(m_device), &m_ff_device)) && + SUCCEEDED(FFDeviceGetForceFeedbackCapabilities(m_ff_device->m_device, &ff_caps))) + { + InitForceFeedback(m_ff_device, ff_caps.numFfAxes); + } } -bool Joystick::UpdateInput() +Joystick::~Joystick() { - return true; + if (m_ff_device) + m_ff_device->Release(); } -bool Joystick::UpdateOutput() +bool Joystick::UpdateInput() { return true; } |
