SDL 2.0
SDL_windowsjoystick_c.h
Go to the documentation of this file.
1/*
2 Simple DirectMedia Layer
3 Copyright (C) 1997-2019 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
30typedef struct JoyStick_DeviceData
31{
37 BYTE SubType;
40 WCHAR hidPath[MAX_PATH];
43
44extern JoyStick_DeviceData *SYS_Joystick; /* array to hold joystick ID values */
45
46typedef enum Type
47{
50 HAT
52
53typedef struct input_t
54{
55 /* DirectInput offset for this input type: */
56 DWORD ofs;
57
58 /* Button, axis or hat: */
60
61 /* SDL input offset: */
63} input_t;
64
65/* The private structure used to keep track of a joystick */
66struct joystick_hwdata
67{
70
71#if SDL_JOYSTICK_DINPUT
72 LPDIRECTINPUTDEVICE8 InputDevice;
73 DIDEVCAPS Capabilities;
74 SDL_bool buffered;
75 input_t Inputs[MAX_INPUTS];
76 int NumInputs;
77 int NumSliders;
79 DIEFFECT *ffeffect;
80 LPDIRECTINPUTEFFECT ffeffect_ref;
81#endif
82
83 SDL_bool bXInputDevice; /* SDL_TRUE if this device supports using the xinput API rather than DirectInput */
84 SDL_bool bXInputHaptic; /* Supports force feedback via XInput. */
85 Uint8 userid; /* XInput userid index for this joystick */
87};
88
89#if SDL_JOYSTICK_DINPUT
90extern const DIDATAFORMAT SDL_c_dfDIJoystick2;
91#endif
92
94
95/* vi: set ts=4 sw=4 expandtab: */
Sint32 SDL_JoystickID
Definition: SDL_joystick.h:81
SDL_bool
Definition: SDL_stdinc.h:162
uint32_t Uint32
Definition: SDL_stdinc.h:203
uint8_t Uint8
Definition: SDL_stdinc.h:179
void WINDOWS_AddJoystickDevice(JoyStick_DeviceData *device)
#define MAX_INPUTS
JoyStick_DeviceData * SYS_Joystick
static SDL_AudioDeviceID device
Definition: loopwave.c:37
DIDEVICEINSTANCE dxdevice
struct JoyStick_DeviceData * pNext
FFEffectObjectReference ffeffect_ref
SDL_JoystickGUID guid