Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/thirdparty/sdl/joystick/darwin/SDL_iokitjoystick_c.h
9904 views
1
/*
2
Simple DirectMedia Layer
3
Copyright (C) 1997-2025 Sam Lantinga <[email protected]>
4
5
This software is provided 'as-is', without any express or implied
6
warranty. In no event will the authors be held liable for any damages
7
arising from the use of this software.
8
9
Permission is granted to anyone to use this software for any purpose,
10
including commercial applications, and to alter it and redistribute it
11
freely, subject to the following restrictions:
12
13
1. The origin of this software must not be misrepresented; you must not
14
claim that you wrote the original software. If you use this software
15
in a product, an acknowledgment in the product documentation would be
16
appreciated but is not required.
17
2. Altered source versions must be plainly marked as such, and must not be
18
misrepresented as being the original software.
19
3. This notice may not be removed or altered from any source distribution.
20
*/
21
#include "SDL_internal.h"
22
23
#ifndef SDL_JOYSTICK_IOKIT_H
24
#define SDL_JOYSTICK_IOKIT_H
25
26
#include <IOKit/hid/IOHIDLib.h>
27
#include <ForceFeedback/ForceFeedback.h>
28
#include <ForceFeedback/ForceFeedbackConstants.h>
29
30
struct recElement
31
{
32
IOHIDElementRef elementRef;
33
IOHIDElementCookie cookie;
34
uint32_t usagePage, usage; // HID usage
35
SInt32 min; // reported min value possible
36
SInt32 max; // reported max value possible
37
38
// runtime variables used for auto-calibration
39
SInt32 minReport; // min returned value
40
SInt32 maxReport; // max returned value
41
42
struct recElement *pNext; // next element in list
43
};
44
typedef struct recElement recElement;
45
46
struct joystick_hwdata
47
{
48
IOHIDDeviceRef deviceRef; // HIDManager device handle
49
io_service_t ffservice; // Interface for force feedback, 0 = no ff
50
FFDeviceObjectReference ffdevice;
51
FFEFFECT *ffeffect;
52
FFEffectObjectReference ffeffect_ref;
53
bool ff_initialized;
54
55
char product[256]; // name of product
56
uint32_t usage; // usage page from IOUSBHID Parser.h which defines general usage
57
uint32_t usagePage; // usage within above page from IOUSBHID Parser.h which defines specific usage
58
59
int axes; // number of axis (calculated, not reported by device)
60
int buttons; // number of buttons (calculated, not reported by device)
61
int hats; // number of hat switches (calculated, not reported by device)
62
int elements; // number of total elements (should be total of above) (calculated, not reported by device)
63
64
recElement *firstAxis;
65
recElement *firstButton;
66
recElement *firstHat;
67
68
bool removed;
69
SDL_Joystick *joystick;
70
bool runLoopAttached; // is 'deviceRef' attached to a CFRunLoop?
71
72
int instance_id;
73
SDL_GUID guid;
74
int steam_virtual_gamepad_slot;
75
76
struct joystick_hwdata *pNext; // next device
77
};
78
typedef struct joystick_hwdata recDevice;
79
80
#endif // SDL_JOYSTICK_IOKIT_H
81
82