| 
									
										
										
										
											2015-05-24 06:55:12 +02:00
										 |  |  | // Copyright 2010 Dolphin Emulator Project
 | 
					
						
							| 
									
										
										
										
											2015-05-18 01:08:10 +02:00
										 |  |  | // Licensed under GPLv2+
 | 
					
						
							| 
									
										
										
										
											2014-02-10 13:54:46 -05: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 05:18:15 -05: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-29 08:11:51 +09:00
										 |  |  | class Joystick : public ForceFeedback::ForceFeedbackDevice | 
					
						
							| 
									
										
										
										
											2010-04-27 07:33:33 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-03-14 01:20:11 +00:00
										 |  |  | private: | 
					
						
							| 
									
										
										
										
											2016-06-24 10:43:46 +02:00
										 |  |  |   class Button : public Input | 
					
						
							|  |  |  |   { | 
					
						
							|  |  |  |   public: | 
					
						
							|  |  |  |     Button(IOHIDElementRef element, IOHIDDeviceRef device) : m_element(element), m_device(device) {} | 
					
						
							|  |  |  |     std::string GetName() const override; | 
					
						
							|  |  |  |     ControlState GetState() const override; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   private: | 
					
						
							|  |  |  |     const IOHIDElementRef m_element; | 
					
						
							|  |  |  |     const IOHIDDeviceRef m_device; | 
					
						
							|  |  |  |   }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   class Axis : public Input | 
					
						
							|  |  |  |   { | 
					
						
							|  |  |  |   public: | 
					
						
							|  |  |  |     enum direction | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |       positive = 0, | 
					
						
							|  |  |  |       negative | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     Axis(IOHIDElementRef element, IOHIDDeviceRef device, direction dir); | 
					
						
							|  |  |  |     std::string GetName() const override; | 
					
						
							|  |  |  |     ControlState GetState() const override; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   private: | 
					
						
							|  |  |  |     const IOHIDElementRef m_element; | 
					
						
							|  |  |  |     const IOHIDDeviceRef m_device; | 
					
						
							|  |  |  |     std::string m_name; | 
					
						
							|  |  |  |     const direction m_direction; | 
					
						
							|  |  |  |     float m_neutral; | 
					
						
							|  |  |  |     float m_scale; | 
					
						
							|  |  |  |   }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   class Hat : public Input | 
					
						
							|  |  |  |   { | 
					
						
							|  |  |  |   public: | 
					
						
							|  |  |  |     enum direction | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |       up = 0, | 
					
						
							|  |  |  |       right, | 
					
						
							|  |  |  |       down, | 
					
						
							|  |  |  |       left | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     Hat(IOHIDElementRef element, IOHIDDeviceRef device, direction dir); | 
					
						
							|  |  |  |     std::string GetName() const override; | 
					
						
							|  |  |  |     ControlState GetState() const override; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   private: | 
					
						
							|  |  |  |     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: | 
					
						
							| 
									
										
										
										
											2016-07-14 10:25:52 +02:00
										 |  |  |   Joystick(IOHIDDeviceRef device, std::string name); | 
					
						
							| 
									
										
										
										
											2016-06-24 10:43:46 +02:00
										 |  |  |   ~Joystick(); | 
					
						
							| 
									
										
										
										
											2010-06-26 13:03:25 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-24 10:43:46 +02:00
										 |  |  |   std::string GetName() const override; | 
					
						
							|  |  |  |   std::string GetSource() const override; | 
					
						
							| 
									
										
										
										
											2016-10-17 23:00:11 -07:00
										 |  |  |   bool IsSameDevice(const IOHIDDeviceRef) const; | 
					
						
							| 
									
										
										
										
											2010-06-26 13:03:25 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-04-27 07:33:33 +00:00
										 |  |  | private: | 
					
						
							| 
									
										
										
										
											2016-06-24 10:43:46 +02:00
										 |  |  |   const IOHIDDeviceRef m_device; | 
					
						
							|  |  |  |   const std::string m_device_name; | 
					
						
							| 
									
										
										
										
											2014-01-29 08:11:51 +09:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-24 10:43:46 +02:00
										 |  |  |   ForceFeedback::FFDeviceAdapterReference m_ff_device; | 
					
						
							| 
									
										
										
										
											2010-04-27 07:33:33 +00:00
										 |  |  | }; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | } |