SDL
2.0
SDL_windowsjoystick_c.h
Go to the documentation of this file.
1
/*
2
Simple DirectMedia Layer
3
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
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
#include "
SDL_events.h
"
24
#include "../SDL_sysjoystick.h"
25
#include "../../core/windows/SDL_windows.h"
26
#include "../../core/windows/SDL_directx.h"
27
28
#define MAX_INPUTS 256
/* each joystick can have up to 256 inputs */
29
30
typedef
struct
JoyStick_DeviceData
31
{
32
SDL_JoystickGUID
guid
;
33
char
*
joystickname
;
34
Uint8
send_add_event
;
35
SDL_JoystickID
nInstanceID
;
36
SDL_bool
bXInputDevice
;
37
BYTE
SubType
;
38
Uint8
XInputUserId
;
39
DIDEVICEINSTANCE
dxdevice
;
40
WCHAR
hidPath
[MAX_PATH];
41
struct
JoyStick_DeviceData
*
pNext
;
42
}
JoyStick_DeviceData
;
43
44
extern
JoyStick_DeviceData
*
SYS_Joystick
;
/* array to hold joystick ID values */
45
46
typedef
enum
Type
47
{
48
BUTTON
,
49
AXIS
,
50
HAT
51
}
Type
;
52
53
typedef
struct
input_t
54
{
55
/* DirectInput offset for this input type: */
56
DWORD
ofs
;
57
58
/* Button, axis or hat: */
59
Type
type
;
60
61
/* SDL input offset: */
62
Uint8
num
;
63
}
input_t
;
64
65
/* The private structure used to keep track of a joystick */
66
struct
joystick_hwdata
67
{
68
SDL_JoystickGUID
guid
;
69
70
#if SDL_JOYSTICK_DINPUT
71
LPDIRECTINPUTDEVICE8 InputDevice;
72
DIDEVCAPS Capabilities;
73
SDL_bool
buffered;
74
input_t
Inputs[
MAX_INPUTS
];
75
int
NumInputs;
76
int
NumSliders;
77
SDL_bool
ff_initialized
;
78
DIEFFECT *
ffeffect
;
79
LPDIRECTINPUTEFFECT
ffeffect_ref
;
80
#endif
81
82
SDL_bool
bXInputDevice
;
/* SDL_TRUE if this device supports using the xinput API rather than DirectInput */
83
SDL_bool
bXInputHaptic
;
/* Supports force feedback via XInput. */
84
Uint8
userid
;
/* XInput userid index for this joystick */
85
DWORD
dwPacketNumber
;
86
};
87
88
#if SDL_JOYSTICK_DINPUT
89
extern
const
DIDATAFORMAT SDL_c_dfDIJoystick2;
90
#endif
91
92
extern
void
WINDOWS_AddJoystickDevice
(
JoyStick_DeviceData
*
device
);
93
94
/* vi: set ts=4 sw=4 expandtab: */
SYS_Joystick
JoyStick_DeviceData * SYS_Joystick
Uint8
uint8_t Uint8
Definition:
SDL_stdinc.h:179
JoyStick_DeviceData::dxdevice
DIDEVICEINSTANCE dxdevice
Definition:
SDL_windowsjoystick_c.h:39
SDL_events.h
joystick_hwdata::guid
SDL_JoystickGUID guid
Definition:
SDL_sysjoystick_c.h:71
joystick_hwdata::userid
Uint8 userid
Definition:
SDL_windowsjoystick_c.h:84
AXIS
@ AXIS
Definition:
SDL_windowsjoystick_c.h:49
SDL_JoystickID
Sint32 SDL_JoystickID
Definition:
SDL_joystick.h:81
WINDOWS_AddJoystickDevice
void WINDOWS_AddJoystickDevice(JoyStick_DeviceData *device)
JoyStick_DeviceData::guid
SDL_JoystickGUID guid
Definition:
SDL_windowsjoystick_c.h:32
DIDEVICEINSTANCE
Definition:
SDL_directx.h:106
Type
Type
Definition:
SDL_windowsjoystick_c.h:47
JoyStick_DeviceData
Definition:
SDL_windowsjoystick_c.h:31
input_t::type
Type type
Definition:
SDL_windowsjoystick_c.h:59
JoyStick_DeviceData::bXInputDevice
SDL_bool bXInputDevice
Definition:
SDL_windowsjoystick_c.h:36
input_t::num
Uint8 num
Definition:
SDL_windowsjoystick_c.h:62
JoyStick_DeviceData::nInstanceID
SDL_JoystickID nInstanceID
Definition:
SDL_windowsjoystick_c.h:35
JoyStick_DeviceData::XInputUserId
Uint8 XInputUserId
Definition:
SDL_windowsjoystick_c.h:38
input_t::ofs
DWORD ofs
Definition:
SDL_windowsjoystick_c.h:56
joystick_hwdata::ffeffect_ref
FFEffectObjectReference ffeffect_ref
Definition:
SDL_sysjoystick_c.h:52
joystick_hwdata::ff_initialized
SDL_bool ff_initialized
Definition:
SDL_sysjoystick_c.h:53
joystick_hwdata::dwPacketNumber
DWORD dwPacketNumber
Definition:
SDL_windowsjoystick_c.h:85
JoyStick_DeviceData::hidPath
WCHAR hidPath[MAX_PATH]
Definition:
SDL_windowsjoystick_c.h:40
joystick_hwdata::ffeffect
FFEFFECT * ffeffect
Definition:
SDL_sysjoystick_c.h:51
JoyStick_DeviceData::joystickname
char * joystickname
Definition:
SDL_windowsjoystick_c.h:33
HAT
@ HAT
Definition:
SDL_windowsjoystick_c.h:50
SDL_bool
SDL_bool
Definition:
SDL_stdinc.h:162
JoyStick_DeviceData::send_add_event
Uint8 send_add_event
Definition:
SDL_windowsjoystick_c.h:34
device
static SDL_AudioDeviceID device
Definition:
loopwave.c:37
SDL_JoystickGUID
Definition:
SDL_joystick.h:70
joystick_hwdata::bXInputDevice
SDL_bool bXInputDevice
Definition:
SDL_windowsjoystick_c.h:82
input_t
Definition:
SDL_windowsjoystick_c.h:54
BUTTON
@ BUTTON
Definition:
SDL_windowsjoystick_c.h:48
JoyStick_DeviceData::pNext
struct JoyStick_DeviceData * pNext
Definition:
SDL_windowsjoystick_c.h:41
JoyStick_DeviceData::SubType
BYTE SubType
Definition:
SDL_windowsjoystick_c.h:37
MAX_INPUTS
#define MAX_INPUTS
Definition:
SDL_windowsjoystick_c.h:28
joystick_hwdata
Definition:
SDL_sysjoystick_c.h:47
joystick_hwdata::bXInputHaptic
SDL_bool bXInputHaptic
Definition:
SDL_windowsjoystick_c.h:83
src
joystick
windows
SDL_windowsjoystick_c.h
Generated by
1.8.18