src/joystick/windows/SDL_dxjoystick_c.h
author Sam Lantinga <slouken@libsdl.org>
Wed, 21 Aug 2013 12:12:04 -0700
changeset 7686 adacc93b5213
parent 7191 75360622e65f
child 7831 214cd9137ea9
permissions -rw-r--r--
Fixed compiling on old versions of the DirectX SDK
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2713
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     1
/*
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
     2
  Simple DirectMedia Layer
6885
700f1b25f77f Happy New Year!
Sam Lantinga <slouken@libsdl.org>
parents: 6738
diff changeset
     3
  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
2713
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     4
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
     5
  This software is provided 'as-is', without any express or implied
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
     6
  warranty.  In no event will the authors be held liable for any damages
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
     7
  arising from the use of this software.
2713
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     8
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
     9
  Permission is granted to anyone to use this software for any purpose,
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    10
  including commercial applications, and to alter it and redistribute it
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    11
  freely, subject to the following restrictions:
2713
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    12
5535
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    13
  1. The origin of this software must not be misrepresented; you must not
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    14
     claim that you wrote the original software. If you use this software
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    15
     in a product, an acknowledgment in the product documentation would be
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    16
     appreciated but is not required.
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    17
  2. Altered source versions must be plainly marked as such, and must not be
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    18
     misrepresented as being the original software.
96594ac5fd1a SDL 1.3 is now under the zlib license.
Sam Lantinga <slouken@libsdl.org>
parents: 5262
diff changeset
    19
  3. This notice may not be removed or altered from any source distribution.
2713
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    20
*/
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    21
#include "SDL_config.h"
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    22
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    23
#ifndef SDL_JOYSTICK_DINPUT_H
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    24
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    25
/* DirectInput joystick driver; written by Glenn Maynard, based on Andrei de
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7133
diff changeset
    26
 * A. Formiga's WINMM driver.
2713
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    27
 *
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    28
 * Hats and sliders are completely untested; the app I'm writing this for mostly
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7133
diff changeset
    29
 * doesn't use them and I don't own any joysticks with them.
2713
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    30
 *
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    31
 * We don't bother to use event notification here.  It doesn't seem to work
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    32
 * with polled devices, and it's fine to call IDirectInputDevice2_GetDeviceData and
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    33
 * let it return 0 events. */
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    34
5090
327f181542f1 Include windows.h in a single point in the source, so we can be consistent about the definition of UNICODE and have core utility functions for Windows that all modules can share.
Sam Lantinga <slouken@libsdl.org>
parents: 5062
diff changeset
    35
#include "../../core/windows/SDL_windows.h"
2713
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    36
7133
87d4cb9bb66c Corrected spelling in C source files.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents: 6991
diff changeset
    37
#define DIRECTINPUT_VERSION 0x0800      /* Need version 7 for force feedback. Need version 8 so IDirectInput8_EnumDevices doesn't leak like a sieve... */
2713
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    38
#include <dinput.h>
6690
9548c8a58103 Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
    39
#define COBJMACROS
9548c8a58103 Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
    40
#include <wbemcli.h>
9548c8a58103 Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
    41
#include <oleauto.h>
9548c8a58103 Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
    42
#include <xinput.h>
9548c8a58103 Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
    43
#include <devguid.h>
9548c8a58103 Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents: 6138
diff changeset
    44
#include <dbt.h>
6991
ff49588e3ddb Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents: 6990
diff changeset
    45
#include <xinput.h>
ff49588e3ddb Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents: 6990
diff changeset
    46
7686
adacc93b5213 Fixed compiling on old versions of the DirectX SDK
Sam Lantinga <slouken@libsdl.org>
parents: 7191
diff changeset
    47
#ifndef XUSER_MAX_COUNT
adacc93b5213 Fixed compiling on old versions of the DirectX SDK
Sam Lantinga <slouken@libsdl.org>
parents: 7191
diff changeset
    48
#define XUSER_MAX_COUNT 4
adacc93b5213 Fixed compiling on old versions of the DirectX SDK
Sam Lantinga <slouken@libsdl.org>
parents: 7191
diff changeset
    49
#endif
adacc93b5213 Fixed compiling on old versions of the DirectX SDK
Sam Lantinga <slouken@libsdl.org>
parents: 7191
diff changeset
    50
#ifndef XUSER_INDEX_ANY
adacc93b5213 Fixed compiling on old versions of the DirectX SDK
Sam Lantinga <slouken@libsdl.org>
parents: 7191
diff changeset
    51
#define XUSER_INDEX_ANY     0x000000FF
adacc93b5213 Fixed compiling on old versions of the DirectX SDK
Sam Lantinga <slouken@libsdl.org>
parents: 7191
diff changeset
    52
#endif
adacc93b5213 Fixed compiling on old versions of the DirectX SDK
Sam Lantinga <slouken@libsdl.org>
parents: 7191
diff changeset
    53
#ifndef XINPUT_CAPS_FFB_SUPPORTED
adacc93b5213 Fixed compiling on old versions of the DirectX SDK
Sam Lantinga <slouken@libsdl.org>
parents: 7191
diff changeset
    54
#define XINPUT_CAPS_FFB_SUPPORTED 0x0001
adacc93b5213 Fixed compiling on old versions of the DirectX SDK
Sam Lantinga <slouken@libsdl.org>
parents: 7191
diff changeset
    55
#endif
adacc93b5213 Fixed compiling on old versions of the DirectX SDK
Sam Lantinga <slouken@libsdl.org>
parents: 7191
diff changeset
    56
adacc93b5213 Fixed compiling on old versions of the DirectX SDK
Sam Lantinga <slouken@libsdl.org>
parents: 7191
diff changeset
    57
6991
ff49588e3ddb Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents: 6990
diff changeset
    58
/* typedef's for XInput structs we use */
ff49588e3ddb Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents: 6990
diff changeset
    59
typedef struct
ff49588e3ddb Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents: 6990
diff changeset
    60
{
ff49588e3ddb Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents: 6990
diff changeset
    61
    WORD wButtons;
ff49588e3ddb Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents: 6990
diff changeset
    62
    BYTE bLeftTrigger;
ff49588e3ddb Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents: 6990
diff changeset
    63
    BYTE bRightTrigger;
ff49588e3ddb Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents: 6990
diff changeset
    64
    SHORT sThumbLX;
ff49588e3ddb Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents: 6990
diff changeset
    65
    SHORT sThumbLY;
ff49588e3ddb Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents: 6990
diff changeset
    66
    SHORT sThumbRX;
ff49588e3ddb Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents: 6990
diff changeset
    67
    SHORT sThumbRY;
ff49588e3ddb Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents: 6990
diff changeset
    68
    DWORD dwPaddingReserved;
ff49588e3ddb Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents: 6990
diff changeset
    69
} XINPUT_GAMEPAD_EX;
ff49588e3ddb Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents: 6990
diff changeset
    70
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7133
diff changeset
    71
typedef struct
6991
ff49588e3ddb Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents: 6990
diff changeset
    72
{
ff49588e3ddb Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents: 6990
diff changeset
    73
    DWORD dwPacketNumber;
ff49588e3ddb Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents: 6990
diff changeset
    74
    XINPUT_GAMEPAD_EX Gamepad;
ff49588e3ddb Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents: 6990
diff changeset
    75
} XINPUT_STATE_EX;
ff49588e3ddb Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents: 6990
diff changeset
    76
ff49588e3ddb Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents: 6990
diff changeset
    77
/* Forward decl's for XInput API's we load dynamically and use if available */
ff49588e3ddb Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents: 6990
diff changeset
    78
typedef DWORD (WINAPI *XInputGetState_t)
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7133
diff changeset
    79
    (
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7133
diff changeset
    80
    DWORD         dwUserIndex,  /* [in] Index of the gamer associated with the device */
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7133
diff changeset
    81
    XINPUT_STATE_EX* pState     /* [out] Receives the current state */
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7133
diff changeset
    82
    );
6991
ff49588e3ddb Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents: 6990
diff changeset
    83
ff49588e3ddb Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents: 6990
diff changeset
    84
typedef DWORD (WINAPI *XInputSetState_t)
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7133
diff changeset
    85
    (
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7133
diff changeset
    86
    DWORD             dwUserIndex,  /* [in] Index of the gamer associated with the device */
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7133
diff changeset
    87
    XINPUT_VIBRATION* pVibration    /* [in, out] The vibration information to send to the controller */
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7133
diff changeset
    88
    );
6991
ff49588e3ddb Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents: 6990
diff changeset
    89
ff49588e3ddb Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents: 6990
diff changeset
    90
typedef DWORD (WINAPI *XInputGetCapabilities_t)
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7133
diff changeset
    91
    (
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7133
diff changeset
    92
    DWORD                dwUserIndex,   /* [in] Index of the gamer associated with the device */
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7133
diff changeset
    93
    DWORD                dwFlags,       /* [in] Input flags that identify the device type */
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7133
diff changeset
    94
    XINPUT_CAPABILITIES* pCapabilities  /* [out] Receives the capabilities */
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7133
diff changeset
    95
    );
6991
ff49588e3ddb Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents: 6990
diff changeset
    96
ff49588e3ddb Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents: 6990
diff changeset
    97
extern int WIN_LoadXInputDLL(void);
ff49588e3ddb Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents: 6990
diff changeset
    98
extern void WIN_UnloadXInputDLL(void);
ff49588e3ddb Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents: 6990
diff changeset
    99
ff49588e3ddb Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents: 6990
diff changeset
   100
extern XInputGetState_t SDL_XInputGetState;
ff49588e3ddb Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents: 6990
diff changeset
   101
extern XInputSetState_t SDL_XInputSetState;
ff49588e3ddb Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents: 6990
diff changeset
   102
extern XInputGetCapabilities_t SDL_XInputGetCapabilities;
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7133
diff changeset
   103
extern DWORD SDL_XInputVersion;  /* ((major << 16) & 0xFF00) | (minor & 0xFF) */
6991
ff49588e3ddb Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents: 6990
diff changeset
   104
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7133
diff changeset
   105
#define XINPUTGETSTATE          SDL_XInputGetState
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7133
diff changeset
   106
#define XINPUTSETSTATE          SDL_XInputSetState
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7133
diff changeset
   107
#define XINPUTGETCAPABILITIES   SDL_XInputGetCapabilities
7686
adacc93b5213 Fixed compiling on old versions of the DirectX SDK
Sam Lantinga <slouken@libsdl.org>
parents: 7191
diff changeset
   108
#define INVALID_XINPUT_USERID   XUSER_INDEX_ANY
adacc93b5213 Fixed compiling on old versions of the DirectX SDK
Sam Lantinga <slouken@libsdl.org>
parents: 7191
diff changeset
   109
#define SDL_XINPUT_MAX_DEVICES  XUSER_MAX_COUNT
2713
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   110
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7133
diff changeset
   111
#define MAX_INPUTS  256     /* each joystick can have up to 256 inputs */
2713
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   112
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   113
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   114
/* local types */
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   115
typedef enum Type
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   116
{ BUTTON, AXIS, HAT } Type;
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   117
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   118
typedef struct input_t
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   119
{
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   120
    /* DirectInput offset for this input type: */
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   121
    DWORD ofs;
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   122
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   123
    /* Button, axis or hat: */
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   124
    Type type;
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   125
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   126
    /* SDL input offset: */
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   127
    Uint8 num;
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   128
} input_t;
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   129
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   130
/* The private structure used to keep track of a joystick */
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   131
struct joystick_hwdata
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   132
{
6716
1616f6b3738c Move all DirectInput code from DI2 to DI8.
Ryan C. Gordon <icculus@icculus.org>
parents: 6690
diff changeset
   133
    LPDIRECTINPUTDEVICE8 InputDevice;
2713
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   134
    DIDEVCAPS Capabilities;
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   135
    int buffered;
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7133
diff changeset
   136
    SDL_JoystickGUID guid;
2713
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   137
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   138
    input_t Inputs[MAX_INPUTS];
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   139
    int NumInputs;
7191
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7133
diff changeset
   140
    int NumSliders;
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7133
diff changeset
   141
    Uint8 removed;
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7133
diff changeset
   142
    Uint8 send_remove_event;
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7133
diff changeset
   143
    Uint8 bXInputDevice; /* 1 if this device supports using the xinput API rather than DirectInput */
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7133
diff changeset
   144
    Uint8 bXInputHaptic; /* Supports force feedback via XInput. */
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7133
diff changeset
   145
    Uint8 userid; /* XInput userid index for this joystick */
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7133
diff changeset
   146
    Uint8 currentXInputSlot; /* the current position to write to in XInputState below, used so we can compare old and new values */
75360622e65f File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents: 7133
diff changeset
   147
    XINPUT_STATE_EX XInputState[2];
2713
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   148
};
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   149
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   150
#endif /* SDL_JOYSTICK_DINPUT_H */