forked from KoKuToru/koku-xinput-wine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
xinput.h
executable file
·113 lines (105 loc) · 3.45 KB
/
xinput.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#ifndef KOKU_XINPUT_H
#define KOKU_XINPUT_H
//__stdcall declaration from wine/includes/windef.h
#ifdef __LP64__
# if (__GNUC__ > 5) || ((__GNUC__ == 5) && (__GNUC_MINOR__ >= 3))
# define __stdcall __attribute__((ms_abi)) __attribute__((__force_align_arg_pointer__))
# else
# define __stdcall __attribute__((ms_abi))
# endif
#else
# if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) || defined(__APPLE__)
# define __stdcall __attribute__((__stdcall__)) __attribute__((__force_align_arg_pointer__))
# else
# define __stdcall __attribute__((__stdcall__))
# endif
#endif
#define WINAPI __stdcall
#define ERROR_SUCCESS 0x0
#define ERROR_DEVICE_NOT_CONNECTED 0x48f
#define ERROR_EMPTY 0x10D2
#define BATTERY_DEVTYPE_GAMEPAD 0x00
#define BATTERY_DEVTYPE_HEADSET 0x01
#define BATTERY_TYPE_DISCONNECTED 0x00
#define BATTERY_TYPE_WIRED 0x01
#define BATTERY_TYPE_ALKALINE 0x02
#define BATTERY_TYPE_NIMH 0x03
#define BATTERY_TYPE_UNKNOWN 0xFF
#define BATTERY_LEVEL_EMPTY 0x00
#define BATTERY_LEVEL_LOW 0x01
#define BATTERY_LEVEL_MEDIUM 0x02
#define BATTERY_LEVEL_FULL 0x03
#define XINPUT_CAPS_FFB_SUPPORTED 0x0001
#define XINPUT_GAMEPAD_DPAD_UP 0x0001
#define XINPUT_GAMEPAD_DPAD_DOWN 0x0002
#define XINPUT_GAMEPAD_DPAD_LEFT 0x0004
#define XINPUT_GAMEPAD_DPAD_RIGHT 0x0008
#define XINPUT_GAMEPAD_START 0x0010
#define XINPUT_GAMEPAD_BACK 0x0020
#define XINPUT_GAMEPAD_LEFT_THUMB 0x0040
#define XINPUT_GAMEPAD_RIGHT_THUMB 0x0080
#define XINPUT_GAMEPAD_LEFT_SHOULDER 0x0100
#define XINPUT_GAMEPAD_RIGHT_SHOULDER 0x0200
#define XINPUT_GAMEPAD_A 0x1000
#define XINPUT_GAMEPAD_B 0x2000
#define XINPUT_GAMEPAD_X 0x4000
#define XINPUT_GAMEPAD_Y 0x8000
#define XINPUT_DEVTYPE_GAMEPAD 0x01
#define XINPUT_DEVSUBTYPE_GAMEPAD 0x01
struct XINPUT_GAMEPAD
{
unsigned short wButtons;
unsigned char bLeftTrigger;
unsigned char bRightTrigger;
short sThumbLX;
short sThumbLY;
short sThumbRX;
short sThumbRY;
};
struct XINPUT_STATE
{
unsigned dwPacketNumber;
XINPUT_GAMEPAD Gamepad;
};
struct XINPUT_BATTERY_INFORMATION
{
unsigned char BatteryType;
unsigned char BatteryLevel;
};
struct XINPUT_VIBRATION
{
unsigned short wLeftMotorSpeed;
unsigned short wRightMotorSpeed;
};
struct XINPUT_CAPABILITIES
{
unsigned char Type;
unsigned char SubType;
unsigned short Flags;
XINPUT_GAMEPAD Gamepad;
XINPUT_VIBRATION Vibration;
};
struct XINPUT_KEYSTROKE
{
unsigned short VirtualKey;
unsigned short Unicode;
unsigned short Flags;
unsigned char UserIndex;
unsigned char HidCode;
};
struct GUID
{
unsigned Data1;
unsigned short Data2;
unsigned short Data3;
unsigned char Data4[8];
};
void WINAPI XInputEnable(bool enable);
unsigned WINAPI XInputGetAudioDeviceIds(unsigned dwUserIndex, short* pRenderDeviceId, unsigned *pRenderCount, short* pCaptureDeviceId, unsigned *pCaptureCount);
unsigned WINAPI XInputGetBatteryInformation(unsigned dwUserIndex, char devType, XINPUT_BATTERY_INFORMATION *pBatteryInformation);
unsigned WINAPI XInputGetCapabilities(unsigned dwUserIndex, unsigned dwFlags, XINPUT_CAPABILITIES *pCapabilities);
unsigned WINAPI XInputGetDSoundAudioDeviceGuids(unsigned dwUserIndex, GUID* pDSoundRenderGuid, GUID* pDSoundCaptureGuid);
unsigned WINAPI XInputGetKeystroke(unsigned dwUserIndex, unsigned dwReserved, XINPUT_KEYSTROKE* pKeystroke);
unsigned WINAPI XInputGetState(unsigned dwUserIndex, XINPUT_STATE *pState);
unsigned WINAPI XInputSetState(unsigned dwUserIndex, XINPUT_VIBRATION *pVibration);
#endif