2015-05-24 04:55:12 +00:00
|
|
|
// Copyright 2010 Dolphin Emulator Project
|
2015-05-17 23:08:10 +00:00
|
|
|
// Licensed under GPLv2+
|
2014-02-10 18:54:46 +00:00
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2010-06-26 13:03:25 +00:00
|
|
|
#include <IOKit/hid/IOHIDLib.h>
|
2010-04-27 07:33:33 +00:00
|
|
|
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "InputCommon/ControllerInterface/Device.h"
|
|
|
|
#include "InputCommon/ControllerInterface/ForceFeedback/ForceFeedbackDevice.h"
|
2010-04-27 07:33:33 +00:00
|
|
|
|
|
|
|
namespace ciface
|
|
|
|
{
|
|
|
|
namespace OSX
|
|
|
|
{
|
|
|
|
|
2014-01-28 23:11:51 +00:00
|
|
|
class Joystick : public ForceFeedback::ForceFeedbackDevice
|
2010-04-27 07:33:33 +00:00
|
|
|
{
|
2011-03-14 01:20:11 +00:00
|
|
|
private:
|
2010-04-27 07:33:33 +00:00
|
|
|
class Button : public Input
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
std::string GetName() const;
|
2011-03-14 01:20:11 +00:00
|
|
|
Button(IOHIDElementRef element, IOHIDDeviceRef device)
|
|
|
|
: m_element(element), m_device(device) {}
|
|
|
|
ControlState GetState() const;
|
2010-04-27 07:33:33 +00:00
|
|
|
private:
|
2014-02-17 04:51:41 +00:00
|
|
|
const IOHIDElementRef m_element;
|
|
|
|
const IOHIDDeviceRef m_device;
|
2010-04-27 07:33:33 +00:00
|
|
|
};
|
2010-06-26 13:03:25 +00:00
|
|
|
|
2010-04-27 07:33:33 +00:00
|
|
|
class Axis : public Input
|
|
|
|
{
|
|
|
|
public:
|
2014-02-17 04:51:41 +00:00
|
|
|
enum direction
|
|
|
|
{
|
2010-04-27 07:33:33 +00:00
|
|
|
positive = 0,
|
|
|
|
negative
|
|
|
|
};
|
|
|
|
std::string GetName() const;
|
2011-03-14 01:20:11 +00:00
|
|
|
Axis(IOHIDElementRef element, IOHIDDeviceRef device, direction dir);
|
|
|
|
ControlState GetState() const;
|
2014-02-17 04:51:41 +00:00
|
|
|
|
2010-04-27 07:33:33 +00:00
|
|
|
private:
|
2014-02-17 04:51:41 +00:00
|
|
|
const IOHIDElementRef m_element;
|
|
|
|
const IOHIDDeviceRef m_device;
|
|
|
|
std::string m_name;
|
|
|
|
const direction m_direction;
|
|
|
|
float m_neutral;
|
|
|
|
float m_scale;
|
2010-04-27 07:33:33 +00:00
|
|
|
};
|
2010-06-26 13:03:25 +00:00
|
|
|
|
2011-01-16 17:00:17 +00:00
|
|
|
class Hat : public Input
|
|
|
|
{
|
|
|
|
public:
|
2014-02-17 04:51:41 +00:00
|
|
|
enum direction
|
|
|
|
{
|
2011-01-16 17:00:17 +00:00
|
|
|
up = 0,
|
|
|
|
right,
|
|
|
|
down,
|
|
|
|
left
|
|
|
|
};
|
|
|
|
std::string GetName() const;
|
2011-03-14 01:20:11 +00:00
|
|
|
Hat(IOHIDElementRef element, IOHIDDeviceRef device, direction dir);
|
|
|
|
ControlState GetState() const;
|
2014-02-17 04:51:41 +00:00
|
|
|
|
2011-01-16 17:00:17 +00:00
|
|
|
private:
|
2014-02-17 04:51:41 +00:00
|
|
|
const IOHIDElementRef m_element;
|
|
|
|
const IOHIDDeviceRef m_device;
|
|
|
|
const char* m_name;
|
|
|
|
const direction m_direction;
|
2011-01-16 17:00:17 +00:00
|
|
|
};
|
|
|
|
|
2011-03-14 01:20:11 +00:00
|
|
|
public:
|
2011-01-30 05:46:19 +00:00
|
|
|
Joystick(IOHIDDeviceRef device, std::string name, int index);
|
2014-01-28 23:11:51 +00:00
|
|
|
~Joystick();
|
2010-06-26 13:03:25 +00:00
|
|
|
|
2010-04-27 07:33:33 +00:00
|
|
|
std::string GetName() const;
|
|
|
|
std::string GetSource() const;
|
|
|
|
int GetId() const;
|
2010-06-26 13:03:25 +00:00
|
|
|
|
2010-04-27 07:33:33 +00:00
|
|
|
private:
|
2014-02-17 04:51:41 +00:00
|
|
|
const IOHIDDeviceRef m_device;
|
|
|
|
const std::string m_device_name;
|
|
|
|
const int m_index;
|
2014-01-28 23:11:51 +00:00
|
|
|
|
|
|
|
ForceFeedback::FFDeviceAdapterReference m_ff_device;
|
2010-04-27 07:33:33 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|