author | Sam Lantinga <slouken@libsdl.org> |
Thu, 06 Jun 2013 17:59:01 -0700 | |
changeset 7293 | 341d22fe9044 |
parent 7265 | 3bb309bb6bfe |
child 7296 | a8145f734ad3 |
permissions | -rw-r--r-- |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
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 | 3 |
Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org> |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
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. |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
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: |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
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. |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
20 |
*/ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
21 |
#include "SDL_config.h" |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
22 |
|
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
23 |
#ifdef SDL_JOYSTICK_DINPUT |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
24 |
|
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
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. |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
27 |
* |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
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. |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
30 |
* |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
31 |
* We don't bother to use event notification here. It doesn't seem to work |
6690
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
32 |
* with polled devices, and it's fine to call IDirectInputDevice8_GetDeviceData and |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
33 |
* let it return 0 events. */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
34 |
|
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
35 |
#include "SDL_error.h" |
6993
33f1e384ed56
Patched to compile on Visual Studio.
Ryan C. Gordon <icculus@icculus.org>
parents:
6991
diff
changeset
|
36 |
#include "SDL_assert.h" |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
37 |
#include "SDL_events.h" |
6690
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
38 |
#include "SDL_thread.h" |
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
39 |
#include "SDL_timer.h" |
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
40 |
#include "SDL_mutex.h" |
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
41 |
#include "SDL_events.h" |
6971
5ded971ee761
Fixed compile errors on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
6965
diff
changeset
|
42 |
#include "SDL_hints.h" |
7260
7601833a69ee
Gyrations to get the code to compile with the latest version of mingw-w64 as well as Visual Studio.
Sam Lantinga <slouken@libsdl.org>
parents:
7230
diff
changeset
|
43 |
#include "SDL_joystick.h" |
7601833a69ee
Gyrations to get the code to compile with the latest version of mingw-w64 as well as Visual Studio.
Sam Lantinga <slouken@libsdl.org>
parents:
7230
diff
changeset
|
44 |
#include "../SDL_sysjoystick.h" |
6690
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
45 |
#if !SDL_EVENTS_DISABLED |
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
46 |
#include "../../events/SDL_events_c.h" |
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
47 |
#endif |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
48 |
|
7260
7601833a69ee
Gyrations to get the code to compile with the latest version of mingw-w64 as well as Visual Studio.
Sam Lantinga <slouken@libsdl.org>
parents:
7230
diff
changeset
|
49 |
/* The latest version of mingw-w64 defines IID_IWbemLocator in wbemcli.h |
7601833a69ee
Gyrations to get the code to compile with the latest version of mingw-w64 as well as Visual Studio.
Sam Lantinga <slouken@libsdl.org>
parents:
7230
diff
changeset
|
50 |
instead of declaring it like Visual Studio and other mingw32 compilers. |
7601833a69ee
Gyrations to get the code to compile with the latest version of mingw-w64 as well as Visual Studio.
Sam Lantinga <slouken@libsdl.org>
parents:
7230
diff
changeset
|
51 |
So, we need to take care of this here before we define INITGUID. |
7601833a69ee
Gyrations to get the code to compile with the latest version of mingw-w64 as well as Visual Studio.
Sam Lantinga <slouken@libsdl.org>
parents:
7230
diff
changeset
|
52 |
*/ |
7601833a69ee
Gyrations to get the code to compile with the latest version of mingw-w64 as well as Visual Studio.
Sam Lantinga <slouken@libsdl.org>
parents:
7230
diff
changeset
|
53 |
#ifdef __MINGW32__ |
7601833a69ee
Gyrations to get the code to compile with the latest version of mingw-w64 as well as Visual Studio.
Sam Lantinga <slouken@libsdl.org>
parents:
7230
diff
changeset
|
54 |
#define __IWbemLocator_INTERFACE_DEFINED__ |
7601833a69ee
Gyrations to get the code to compile with the latest version of mingw-w64 as well as Visual Studio.
Sam Lantinga <slouken@libsdl.org>
parents:
7230
diff
changeset
|
55 |
#endif /* __MINGW32__ */ |
7601833a69ee
Gyrations to get the code to compile with the latest version of mingw-w64 as well as Visual Studio.
Sam Lantinga <slouken@libsdl.org>
parents:
7230
diff
changeset
|
56 |
|
7601833a69ee
Gyrations to get the code to compile with the latest version of mingw-w64 as well as Visual Studio.
Sam Lantinga <slouken@libsdl.org>
parents:
7230
diff
changeset
|
57 |
#define INITGUID /* Only set here, if set twice will cause mingw32 to break. */ |
7601833a69ee
Gyrations to get the code to compile with the latest version of mingw-w64 as well as Visual Studio.
Sam Lantinga <slouken@libsdl.org>
parents:
7230
diff
changeset
|
58 |
#include "SDL_dxjoystick_c.h" |
7601833a69ee
Gyrations to get the code to compile with the latest version of mingw-w64 as well as Visual Studio.
Sam Lantinga <slouken@libsdl.org>
parents:
7230
diff
changeset
|
59 |
|
7601833a69ee
Gyrations to get the code to compile with the latest version of mingw-w64 as well as Visual Studio.
Sam Lantinga <slouken@libsdl.org>
parents:
7230
diff
changeset
|
60 |
#ifdef __MINGW32__ |
7601833a69ee
Gyrations to get the code to compile with the latest version of mingw-w64 as well as Visual Studio.
Sam Lantinga <slouken@libsdl.org>
parents:
7230
diff
changeset
|
61 |
/* And now that we've included wbemcli.h we need to declare these interfaces */ |
7601833a69ee
Gyrations to get the code to compile with the latest version of mingw-w64 as well as Visual Studio.
Sam Lantinga <slouken@libsdl.org>
parents:
7230
diff
changeset
|
62 |
typedef struct IWbemLocatorVtbl { |
7601833a69ee
Gyrations to get the code to compile with the latest version of mingw-w64 as well as Visual Studio.
Sam Lantinga <slouken@libsdl.org>
parents:
7230
diff
changeset
|
63 |
BEGIN_INTERFACE |
7601833a69ee
Gyrations to get the code to compile with the latest version of mingw-w64 as well as Visual Studio.
Sam Lantinga <slouken@libsdl.org>
parents:
7230
diff
changeset
|
64 |
HRESULT (WINAPI *QueryInterface)(IWbemLocator *This,REFIID riid,void **ppvObject); |
7601833a69ee
Gyrations to get the code to compile with the latest version of mingw-w64 as well as Visual Studio.
Sam Lantinga <slouken@libsdl.org>
parents:
7230
diff
changeset
|
65 |
ULONG (WINAPI *AddRef)(IWbemLocator *This); |
7601833a69ee
Gyrations to get the code to compile with the latest version of mingw-w64 as well as Visual Studio.
Sam Lantinga <slouken@libsdl.org>
parents:
7230
diff
changeset
|
66 |
ULONG (WINAPI *Release)(IWbemLocator *This); |
7265
3bb309bb6bfe
Hopefully fixed mingw32 build
Sam Lantinga <slouken@libsdl.org>
parents:
7260
diff
changeset
|
67 |
HRESULT (WINAPI *ConnectServer)(IWbemLocator *This,const BSTR strNetworkResource,const BSTR strUser,const BSTR strPassword,const BSTR strLocale,LONG lSecurityFlags,const BSTR strAuthority,IWbemContext *pCtx,IWbemServices **ppNamespace); |
7260
7601833a69ee
Gyrations to get the code to compile with the latest version of mingw-w64 as well as Visual Studio.
Sam Lantinga <slouken@libsdl.org>
parents:
7230
diff
changeset
|
68 |
END_INTERFACE |
7601833a69ee
Gyrations to get the code to compile with the latest version of mingw-w64 as well as Visual Studio.
Sam Lantinga <slouken@libsdl.org>
parents:
7230
diff
changeset
|
69 |
} IWbemLocatorVtbl; |
7601833a69ee
Gyrations to get the code to compile with the latest version of mingw-w64 as well as Visual Studio.
Sam Lantinga <slouken@libsdl.org>
parents:
7230
diff
changeset
|
70 |
struct IWbemLocator { |
7601833a69ee
Gyrations to get the code to compile with the latest version of mingw-w64 as well as Visual Studio.
Sam Lantinga <slouken@libsdl.org>
parents:
7230
diff
changeset
|
71 |
CONST_VTBL struct IWbemLocatorVtbl *lpVtbl; |
7601833a69ee
Gyrations to get the code to compile with the latest version of mingw-w64 as well as Visual Studio.
Sam Lantinga <slouken@libsdl.org>
parents:
7230
diff
changeset
|
72 |
}; |
7601833a69ee
Gyrations to get the code to compile with the latest version of mingw-w64 as well as Visual Studio.
Sam Lantinga <slouken@libsdl.org>
parents:
7230
diff
changeset
|
73 |
#define IWbemLocator_ConnectServer(This,strNetworkResource,strUser,strPassword,strLocale,lSecurityFlags,strAuthority,pCtx,ppNamespace) (This)->lpVtbl->ConnectServer(This,strNetworkResource,strUser,strPassword,strLocale,lSecurityFlags,strAuthority,pCtx,ppNamespace) |
7601833a69ee
Gyrations to get the code to compile with the latest version of mingw-w64 as well as Visual Studio.
Sam Lantinga <slouken@libsdl.org>
parents:
7230
diff
changeset
|
74 |
#endif /* __MINGW32__ */ |
7601833a69ee
Gyrations to get the code to compile with the latest version of mingw-w64 as well as Visual Studio.
Sam Lantinga <slouken@libsdl.org>
parents:
7230
diff
changeset
|
75 |
|
2761
0c544c2eff77
Almost got this compiling on Cygwin32, just needs DirectInput 7
Sam Lantinga <slouken@libsdl.org>
parents:
2760
diff
changeset
|
76 |
#ifndef DIDFT_OPTIONAL |
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
77 |
#define DIDFT_OPTIONAL 0x80000000 |
2761
0c544c2eff77
Almost got this compiling on Cygwin32, just needs DirectInput 7
Sam Lantinga <slouken@libsdl.org>
parents:
2760
diff
changeset
|
78 |
#endif |
0c544c2eff77
Almost got this compiling on Cygwin32, just needs DirectInput 7
Sam Lantinga <slouken@libsdl.org>
parents:
2760
diff
changeset
|
79 |
|
0c544c2eff77
Almost got this compiling on Cygwin32, just needs DirectInput 7
Sam Lantinga <slouken@libsdl.org>
parents:
2760
diff
changeset
|
80 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
81 |
#define INPUT_QSIZE 32 /* Buffer up to 32 input messages */ |
6690
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
82 |
#define MAX_JOYSTICKS 8 |
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
83 |
#define AXIS_MIN -32768 /* minimum value for axis coordinate */ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
84 |
#define AXIS_MAX 32767 /* maximum value for axis coordinate */ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
85 |
#define JOY_AXIS_THRESHOLD (((AXIS_MAX)-(AXIS_MIN))/100) /* 1% motion */ |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
86 |
|
2198
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
87 |
/* external variables referenced. */ |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2198
diff
changeset
|
88 |
extern HWND SDL_HelperWindow; |
2198
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
89 |
|
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
90 |
|
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
91 |
/* local variables */ |
5591
17beb16fa838
Cleaned up CoInitialize() politics on Windows.
Ryan C. Gordon <icculus@icculus.org>
parents:
5535
diff
changeset
|
92 |
static SDL_bool coinitialized = SDL_FALSE; |
6716
1616f6b3738c
Move all DirectInput code from DI2 to DI8.
Ryan C. Gordon <icculus@icculus.org>
parents:
6712
diff
changeset
|
93 |
static LPDIRECTINPUT8 dinput = NULL; |
6690
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
94 |
static SDL_bool s_bDeviceAdded = SDL_FALSE; |
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
95 |
static SDL_bool s_bDeviceRemoved = SDL_FALSE; |
6974
11a03a79dfe8
The joystick events contain a joystick instance ID, which is a signed value, with -1 being invalid.
Sam Lantinga <slouken@libsdl.org>
parents:
6971
diff
changeset
|
96 |
static SDL_JoystickID s_nInstanceID = -1; |
6690
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
97 |
static GUID *s_pKnownJoystickGUIDs = NULL; |
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
98 |
static SDL_cond *s_condJoystickThread = NULL; |
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
99 |
static SDL_mutex *s_mutexJoyStickEnum = NULL; |
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
100 |
static SDL_Thread *s_threadJoystick = NULL; |
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
101 |
static SDL_bool s_bJoystickThreadQuit = SDL_FALSE; |
6965
ab4bb4e99961
add hint to allow disabling the use of Xinput.
Edward Rudd <urkle@outoforder.cc>
parents:
6885
diff
changeset
|
102 |
static SDL_bool s_bXInputEnabled = SDL_TRUE; |
6690
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
103 |
|
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 |
XInputGetState_t SDL_XInputGetState = NULL; |
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
105 |
XInputSetState_t SDL_XInputSetState = NULL; |
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
106 |
XInputGetCapabilities_t SDL_XInputGetCapabilities = NULL; |
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
107 |
DWORD SDL_XInputVersion = 0; |
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
108 |
|
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
109 |
static HANDLE s_pXInputDLL = 0; |
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
110 |
static int s_XInputDLLRefCount = 0; |
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
111 |
|
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
112 |
int |
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
113 |
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
|
114 |
{ |
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
115 |
DWORD version = 0; |
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
116 |
|
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
117 |
if (s_pXInputDLL) { |
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
118 |
SDL_assert(s_XInputDLLRefCount > 0); |
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
119 |
s_XInputDLLRefCount++; |
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
120 |
return 0; /* already loaded */ |
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
121 |
} |
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
122 |
|
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
123 |
version = (1 << 16) | 4; |
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
124 |
s_pXInputDLL = LoadLibrary( L"XInput1_4.dll" ); /* 1.4 Ships with Windows 8. */ |
6991
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
125 |
if (!s_pXInputDLL) { |
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
126 |
version = (1 << 16) | 3; |
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
127 |
s_pXInputDLL = LoadLibrary( L"XInput1_3.dll" ); /* 1.3 Ships with Vista and Win7, can be installed as a redistributable component. */ |
6991
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
128 |
} |
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
129 |
if (!s_pXInputDLL) { |
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
130 |
s_pXInputDLL = LoadLibrary( L"bin\\XInput1_3.dll" ); |
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
131 |
} |
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
132 |
if (!s_pXInputDLL) { |
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
133 |
return -1; |
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
134 |
} |
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
135 |
|
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
136 |
SDL_assert(s_XInputDLLRefCount == 0); |
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
137 |
SDL_XInputVersion = version; |
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
138 |
s_XInputDLLRefCount = 1; |
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
139 |
|
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
140 |
/* 100 is the ordinal for _XInputGetStateEx, which returns the same struct as XinputGetState, but with extra data in wButtons for the guide button, we think... */ |
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
141 |
SDL_XInputGetState = (XInputGetState_t)GetProcAddress( (HMODULE)s_pXInputDLL, (LPCSTR)100 ); |
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
142 |
SDL_XInputSetState = (XInputSetState_t)GetProcAddress( (HMODULE)s_pXInputDLL, "XInputSetState" ); |
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
143 |
SDL_XInputGetCapabilities = (XInputGetCapabilities_t)GetProcAddress( (HMODULE)s_pXInputDLL, "XInputGetCapabilities" ); |
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
144 |
if ( !SDL_XInputGetState || !SDL_XInputSetState || !SDL_XInputGetCapabilities ) { |
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
145 |
WIN_UnloadXInputDLL(); |
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
146 |
return -1; |
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
147 |
} |
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
148 |
|
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
149 |
return 0; |
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
150 |
} |
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
151 |
|
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
152 |
void |
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
153 |
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
|
154 |
{ |
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
155 |
if ( s_pXInputDLL ) { |
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
156 |
SDL_assert(s_XInputDLLRefCount > 0); |
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
157 |
if (--s_XInputDLLRefCount == 0) { |
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
158 |
FreeLibrary( s_pXInputDLL ); |
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
159 |
s_pXInputDLL = NULL; |
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
160 |
} |
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
161 |
} else { |
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
162 |
SDL_assert(s_XInputDLLRefCount == 0); |
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
163 |
} |
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
164 |
} |
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
165 |
|
ff49588e3ddb
Attempt to get XInput haptics building on Cygwin (or rather, avoid building).
Ryan C. Gordon <icculus@icculus.org>
parents:
6990
diff
changeset
|
166 |
|
2198
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
167 |
extern HRESULT(WINAPI * DInputCreate) (HINSTANCE hinst, DWORD dwVersion, |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
168 |
LPDIRECTINPUT * ppDI, |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
169 |
LPUNKNOWN punkOuter); |
6690
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
170 |
struct JoyStick_DeviceData_ |
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
171 |
{ |
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
172 |
SDL_JoystickGUID guid; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
173 |
DIDEVICEINSTANCE dxdevice; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
174 |
char *joystickname; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
175 |
Uint8 send_add_event; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
176 |
SDL_JoystickID nInstanceID; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
177 |
SDL_bool bXInputDevice; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
178 |
Uint8 XInputUserId; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
179 |
struct JoyStick_DeviceData_ *pNext; |
6690
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
180 |
}; |
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
181 |
|
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
182 |
typedef struct JoyStick_DeviceData_ JoyStick_DeviceData; |
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
183 |
|
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
184 |
static JoyStick_DeviceData *SYS_Joystick; /* array to hold joystick ID values */ |
2198
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
185 |
|
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
186 |
/* local prototypes */ |
7037
3fedf1f25b94
Make SDL_SetError and friends unconditionally return -1.
Ryan C. Gordon <icculus@icculus.org>
parents:
6993
diff
changeset
|
187 |
static int SetDIerror(const char *function, HRESULT code); |
2198
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
188 |
static BOOL CALLBACK EnumJoysticksCallback(const DIDEVICEINSTANCE * |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
189 |
pdidInstance, VOID * pContext); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
190 |
static BOOL CALLBACK EnumDevObjectsCallback(LPCDIDEVICEOBJECTINSTANCE dev, |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
191 |
LPVOID pvRef); |
6220
c36934808194
Fixed bug 1371 - DX joystick axis ordering fix
Sam Lantinga <slouken@libsdl.org>
parents:
6138
diff
changeset
|
192 |
static void SortDevObjects(SDL_Joystick *joystick); |
2198
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
193 |
static Uint8 TranslatePOV(DWORD value); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
194 |
static int SDL_PrivateJoystickAxis_Int(SDL_Joystick * joystick, Uint8 axis, |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
195 |
Sint16 value); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
196 |
static int SDL_PrivateJoystickHat_Int(SDL_Joystick * joystick, Uint8 hat, |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
197 |
Uint8 value); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
198 |
static int SDL_PrivateJoystickButton_Int(SDL_Joystick * joystick, |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
199 |
Uint8 button, Uint8 state); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
200 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
201 |
/* Taken from Wine - Thanks! */ |
2760
02aa80d7905f
Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents:
2717
diff
changeset
|
202 |
DIOBJECTDATAFORMAT dfDIJoystick2[] = { |
3013
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
203 |
{ &GUID_XAxis,DIJOFS_X,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
204 |
{ &GUID_YAxis,DIJOFS_Y,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
205 |
{ &GUID_ZAxis,DIJOFS_Z,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
206 |
{ &GUID_RxAxis,DIJOFS_RX,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
207 |
{ &GUID_RyAxis,DIJOFS_RY,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
208 |
{ &GUID_RzAxis,DIJOFS_RZ,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
209 |
{ &GUID_Slider,DIJOFS_SLIDER(0),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
210 |
{ &GUID_Slider,DIJOFS_SLIDER(1),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
211 |
{ &GUID_POV,DIJOFS_POV(0),DIDFT_OPTIONAL|DIDFT_POV|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
212 |
{ &GUID_POV,DIJOFS_POV(1),DIDFT_OPTIONAL|DIDFT_POV|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
213 |
{ &GUID_POV,DIJOFS_POV(2),DIDFT_OPTIONAL|DIDFT_POV|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
214 |
{ &GUID_POV,DIJOFS_POV(3),DIDFT_OPTIONAL|DIDFT_POV|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
215 |
{ NULL,DIJOFS_BUTTON(0),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
216 |
{ NULL,DIJOFS_BUTTON(1),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
217 |
{ NULL,DIJOFS_BUTTON(2),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
218 |
{ NULL,DIJOFS_BUTTON(3),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
219 |
{ NULL,DIJOFS_BUTTON(4),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
220 |
{ NULL,DIJOFS_BUTTON(5),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
221 |
{ NULL,DIJOFS_BUTTON(6),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
222 |
{ NULL,DIJOFS_BUTTON(7),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
223 |
{ NULL,DIJOFS_BUTTON(8),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
224 |
{ NULL,DIJOFS_BUTTON(9),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
225 |
{ NULL,DIJOFS_BUTTON(10),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
226 |
{ NULL,DIJOFS_BUTTON(11),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
227 |
{ NULL,DIJOFS_BUTTON(12),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
228 |
{ NULL,DIJOFS_BUTTON(13),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
229 |
{ NULL,DIJOFS_BUTTON(14),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
230 |
{ NULL,DIJOFS_BUTTON(15),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
231 |
{ NULL,DIJOFS_BUTTON(16),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
232 |
{ NULL,DIJOFS_BUTTON(17),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
233 |
{ NULL,DIJOFS_BUTTON(18),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
234 |
{ NULL,DIJOFS_BUTTON(19),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
235 |
{ NULL,DIJOFS_BUTTON(20),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
236 |
{ NULL,DIJOFS_BUTTON(21),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
237 |
{ NULL,DIJOFS_BUTTON(22),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
238 |
{ NULL,DIJOFS_BUTTON(23),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
239 |
{ NULL,DIJOFS_BUTTON(24),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
240 |
{ NULL,DIJOFS_BUTTON(25),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
241 |
{ NULL,DIJOFS_BUTTON(26),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
242 |
{ NULL,DIJOFS_BUTTON(27),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
243 |
{ NULL,DIJOFS_BUTTON(28),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
244 |
{ NULL,DIJOFS_BUTTON(29),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
245 |
{ NULL,DIJOFS_BUTTON(30),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
246 |
{ NULL,DIJOFS_BUTTON(31),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
247 |
{ NULL,DIJOFS_BUTTON(32),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
248 |
{ NULL,DIJOFS_BUTTON(33),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
249 |
{ NULL,DIJOFS_BUTTON(34),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
250 |
{ NULL,DIJOFS_BUTTON(35),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
251 |
{ NULL,DIJOFS_BUTTON(36),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
252 |
{ NULL,DIJOFS_BUTTON(37),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
253 |
{ NULL,DIJOFS_BUTTON(38),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
254 |
{ NULL,DIJOFS_BUTTON(39),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
255 |
{ NULL,DIJOFS_BUTTON(40),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
256 |
{ NULL,DIJOFS_BUTTON(41),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
257 |
{ NULL,DIJOFS_BUTTON(42),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
258 |
{ NULL,DIJOFS_BUTTON(43),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
259 |
{ NULL,DIJOFS_BUTTON(44),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
260 |
{ NULL,DIJOFS_BUTTON(45),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
261 |
{ NULL,DIJOFS_BUTTON(46),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
262 |
{ NULL,DIJOFS_BUTTON(47),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
263 |
{ NULL,DIJOFS_BUTTON(48),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
264 |
{ NULL,DIJOFS_BUTTON(49),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
265 |
{ NULL,DIJOFS_BUTTON(50),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
266 |
{ NULL,DIJOFS_BUTTON(51),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
267 |
{ NULL,DIJOFS_BUTTON(52),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
268 |
{ NULL,DIJOFS_BUTTON(53),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
269 |
{ NULL,DIJOFS_BUTTON(54),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
270 |
{ NULL,DIJOFS_BUTTON(55),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
271 |
{ NULL,DIJOFS_BUTTON(56),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
272 |
{ NULL,DIJOFS_BUTTON(57),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
273 |
{ NULL,DIJOFS_BUTTON(58),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
274 |
{ NULL,DIJOFS_BUTTON(59),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
275 |
{ NULL,DIJOFS_BUTTON(60),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
276 |
{ NULL,DIJOFS_BUTTON(61),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
277 |
{ NULL,DIJOFS_BUTTON(62),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
278 |
{ NULL,DIJOFS_BUTTON(63),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
279 |
{ NULL,DIJOFS_BUTTON(64),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
280 |
{ NULL,DIJOFS_BUTTON(65),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
281 |
{ NULL,DIJOFS_BUTTON(66),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
282 |
{ NULL,DIJOFS_BUTTON(67),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
283 |
{ NULL,DIJOFS_BUTTON(68),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
284 |
{ NULL,DIJOFS_BUTTON(69),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
285 |
{ NULL,DIJOFS_BUTTON(70),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
286 |
{ NULL,DIJOFS_BUTTON(71),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
287 |
{ NULL,DIJOFS_BUTTON(72),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
288 |
{ NULL,DIJOFS_BUTTON(73),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
289 |
{ NULL,DIJOFS_BUTTON(74),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
290 |
{ NULL,DIJOFS_BUTTON(75),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
291 |
{ NULL,DIJOFS_BUTTON(76),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
292 |
{ NULL,DIJOFS_BUTTON(77),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
293 |
{ NULL,DIJOFS_BUTTON(78),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
294 |
{ NULL,DIJOFS_BUTTON(79),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
295 |
{ NULL,DIJOFS_BUTTON(80),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
296 |
{ NULL,DIJOFS_BUTTON(81),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
297 |
{ NULL,DIJOFS_BUTTON(82),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
298 |
{ NULL,DIJOFS_BUTTON(83),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
299 |
{ NULL,DIJOFS_BUTTON(84),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
300 |
{ NULL,DIJOFS_BUTTON(85),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
301 |
{ NULL,DIJOFS_BUTTON(86),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
302 |
{ NULL,DIJOFS_BUTTON(87),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
303 |
{ NULL,DIJOFS_BUTTON(88),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
304 |
{ NULL,DIJOFS_BUTTON(89),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
305 |
{ NULL,DIJOFS_BUTTON(90),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
306 |
{ NULL,DIJOFS_BUTTON(91),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
307 |
{ NULL,DIJOFS_BUTTON(92),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
308 |
{ NULL,DIJOFS_BUTTON(93),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
309 |
{ NULL,DIJOFS_BUTTON(94),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
310 |
{ NULL,DIJOFS_BUTTON(95),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
311 |
{ NULL,DIJOFS_BUTTON(96),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
312 |
{ NULL,DIJOFS_BUTTON(97),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
313 |
{ NULL,DIJOFS_BUTTON(98),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
314 |
{ NULL,DIJOFS_BUTTON(99),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
315 |
{ NULL,DIJOFS_BUTTON(100),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
316 |
{ NULL,DIJOFS_BUTTON(101),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
317 |
{ NULL,DIJOFS_BUTTON(102),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
318 |
{ NULL,DIJOFS_BUTTON(103),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
319 |
{ NULL,DIJOFS_BUTTON(104),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
320 |
{ NULL,DIJOFS_BUTTON(105),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
321 |
{ NULL,DIJOFS_BUTTON(106),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
322 |
{ NULL,DIJOFS_BUTTON(107),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
323 |
{ NULL,DIJOFS_BUTTON(108),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
324 |
{ NULL,DIJOFS_BUTTON(109),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
325 |
{ NULL,DIJOFS_BUTTON(110),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
326 |
{ NULL,DIJOFS_BUTTON(111),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
327 |
{ NULL,DIJOFS_BUTTON(112),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
328 |
{ NULL,DIJOFS_BUTTON(113),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
329 |
{ NULL,DIJOFS_BUTTON(114),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
330 |
{ NULL,DIJOFS_BUTTON(115),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
331 |
{ NULL,DIJOFS_BUTTON(116),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
332 |
{ NULL,DIJOFS_BUTTON(117),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
333 |
{ NULL,DIJOFS_BUTTON(118),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
334 |
{ NULL,DIJOFS_BUTTON(119),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
335 |
{ NULL,DIJOFS_BUTTON(120),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
336 |
{ NULL,DIJOFS_BUTTON(121),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
337 |
{ NULL,DIJOFS_BUTTON(122),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
338 |
{ NULL,DIJOFS_BUTTON(123),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
339 |
{ NULL,DIJOFS_BUTTON(124),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
340 |
{ NULL,DIJOFS_BUTTON(125),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
341 |
{ NULL,DIJOFS_BUTTON(126),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
342 |
{ NULL,DIJOFS_BUTTON(127),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
343 |
{ &GUID_XAxis,FIELD_OFFSET(DIJOYSTATE2,lVX),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
344 |
{ &GUID_YAxis,FIELD_OFFSET(DIJOYSTATE2,lVY),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
345 |
{ &GUID_ZAxis,FIELD_OFFSET(DIJOYSTATE2,lVZ),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
346 |
{ &GUID_RxAxis,FIELD_OFFSET(DIJOYSTATE2,lVRx),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
347 |
{ &GUID_RyAxis,FIELD_OFFSET(DIJOYSTATE2,lVRy),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
348 |
{ &GUID_RzAxis,FIELD_OFFSET(DIJOYSTATE2,lVRz),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
349 |
{ &GUID_Slider,FIELD_OFFSET(DIJOYSTATE2,rglVSlider[0]),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
350 |
{ &GUID_Slider,FIELD_OFFSET(DIJOYSTATE2,rglVSlider[1]),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
351 |
{ &GUID_XAxis,FIELD_OFFSET(DIJOYSTATE2,lAX),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
352 |
{ &GUID_YAxis,FIELD_OFFSET(DIJOYSTATE2,lAY),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
353 |
{ &GUID_ZAxis,FIELD_OFFSET(DIJOYSTATE2,lAZ),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
354 |
{ &GUID_RxAxis,FIELD_OFFSET(DIJOYSTATE2,lARx),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
355 |
{ &GUID_RyAxis,FIELD_OFFSET(DIJOYSTATE2,lARy),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
356 |
{ &GUID_RzAxis,FIELD_OFFSET(DIJOYSTATE2,lARz),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
357 |
{ &GUID_Slider,FIELD_OFFSET(DIJOYSTATE2,rglASlider[0]),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
358 |
{ &GUID_Slider,FIELD_OFFSET(DIJOYSTATE2,rglASlider[1]),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
359 |
{ &GUID_XAxis,FIELD_OFFSET(DIJOYSTATE2,lFX),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
360 |
{ &GUID_YAxis,FIELD_OFFSET(DIJOYSTATE2,lFY),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
361 |
{ &GUID_ZAxis,FIELD_OFFSET(DIJOYSTATE2,lFZ),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
362 |
{ &GUID_RxAxis,FIELD_OFFSET(DIJOYSTATE2,lFRx),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
363 |
{ &GUID_RyAxis,FIELD_OFFSET(DIJOYSTATE2,lFRy),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
364 |
{ &GUID_RzAxis,FIELD_OFFSET(DIJOYSTATE2,lFRz),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
365 |
{ &GUID_Slider,FIELD_OFFSET(DIJOYSTATE2,rglFSlider[0]),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
366 |
{ &GUID_Slider,FIELD_OFFSET(DIJOYSTATE2,rglFSlider[1]),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, |
2760
02aa80d7905f
Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents:
2717
diff
changeset
|
367 |
}; |
02aa80d7905f
Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents:
2717
diff
changeset
|
368 |
|
02aa80d7905f
Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents:
2717
diff
changeset
|
369 |
const DIDATAFORMAT c_dfDIJoystick2 = { |
02aa80d7905f
Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents:
2717
diff
changeset
|
370 |
sizeof(DIDATAFORMAT), |
02aa80d7905f
Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents:
2717
diff
changeset
|
371 |
sizeof(DIOBJECTDATAFORMAT), |
02aa80d7905f
Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents:
2717
diff
changeset
|
372 |
DIDF_ABSAXIS, |
02aa80d7905f
Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents:
2717
diff
changeset
|
373 |
sizeof(DIJOYSTATE2), |
02aa80d7905f
Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents:
2717
diff
changeset
|
374 |
SDL_arraysize(dfDIJoystick2), |
02aa80d7905f
Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents:
2717
diff
changeset
|
375 |
dfDIJoystick2 |
02aa80d7905f
Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents:
2717
diff
changeset
|
376 |
}; |
02aa80d7905f
Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents:
2717
diff
changeset
|
377 |
|
2198
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
378 |
|
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
379 |
/* Convert a DirectInput return code to a text message */ |
7037
3fedf1f25b94
Make SDL_SetError and friends unconditionally return -1.
Ryan C. Gordon <icculus@icculus.org>
parents:
6993
diff
changeset
|
380 |
static int |
2198
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
381 |
SetDIerror(const char *function, HRESULT code) |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
382 |
{ |
2760
02aa80d7905f
Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents:
2717
diff
changeset
|
383 |
/* |
7037
3fedf1f25b94
Make SDL_SetError and friends unconditionally return -1.
Ryan C. Gordon <icculus@icculus.org>
parents:
6993
diff
changeset
|
384 |
return SDL_SetError("%s() [%s]: %s", function, |
3013
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
385 |
DXGetErrorString9A(code), DXGetErrorDescription9A(code)); |
2760
02aa80d7905f
Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents:
2717
diff
changeset
|
386 |
*/ |
7037
3fedf1f25b94
Make SDL_SetError and friends unconditionally return -1.
Ryan C. Gordon <icculus@icculus.org>
parents:
6993
diff
changeset
|
387 |
return SDL_SetError("%s() DirectX error %d", function, code); |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
388 |
} |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
389 |
|
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
390 |
|
6690
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
391 |
#define SAFE_RELEASE(p) \ |
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
392 |
{ \ |
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
393 |
if (p) { \ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
394 |
(p)->lpVtbl->Release((p)); \ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
395 |
(p) = 0; \ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
396 |
} \ |
6690
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
397 |
} |
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
398 |
|
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
399 |
|
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
400 |
DEFINE_GUID(CLSID_WbemLocator, 0x4590f811,0x1d3a,0x11d0,0x89,0x1F,0x00,0xaa,0x00,0x4b,0x2e,0x24); |
7230
757e9812ef1c
Fixed Visual Studio build
Sam Lantinga <slouken@libsdl.org>
parents:
7223
diff
changeset
|
401 |
/* The Windows SDK doesn't define this GUID */ |
6690
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
402 |
DEFINE_GUID(IID_IWbemLocator, 0xdc12a687,0x737f,0x11cf,0x88,0x4d,0x00,0xaa,0x00,0x4b,0x2e,0x24); |
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
403 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
404 |
/*----------------------------------------------------------------------------- |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
405 |
* |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
406 |
* code from MSDN: http://msdn.microsoft.com/en-us/library/windows/desktop/ee417014(v=vs.85).aspx |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
407 |
* |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
408 |
* Enum each PNP device using WMI and check each device ID to see if it contains |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
409 |
* "IG_" (ex. "VID_045E&PID_028E&IG_00"). If it does, then it's an XInput device |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
410 |
* Unfortunately this information can not be found by just using DirectInput |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
411 |
*-----------------------------------------------------------------------------*/ |
6690
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
412 |
BOOL IsXInputDevice( const GUID* pGuidProductFromDirectInput ) |
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
413 |
{ |
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
414 |
IWbemLocator* pIWbemLocator = NULL; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
415 |
IEnumWbemClassObject* pEnumDevices = NULL; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
416 |
IWbemClassObject* pDevices[20]; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
417 |
IWbemServices* pIWbemServices = NULL; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
418 |
DWORD uReturned = 0; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
419 |
BSTR bstrNamespace = NULL; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
420 |
BSTR bstrDeviceID = NULL; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
421 |
BSTR bstrClassName = NULL; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
422 |
SDL_bool bIsXinputDevice= SDL_FALSE; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
423 |
UINT iDevice = 0; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
424 |
VARIANT var; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
425 |
HRESULT hr; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
426 |
DWORD bCleanupCOM; |
6690
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
427 |
|
6965
ab4bb4e99961
add hint to allow disabling the use of Xinput.
Edward Rudd <urkle@outoforder.cc>
parents:
6885
diff
changeset
|
428 |
if (!s_bXInputEnabled) |
ab4bb4e99961
add hint to allow disabling the use of Xinput.
Edward Rudd <urkle@outoforder.cc>
parents:
6885
diff
changeset
|
429 |
{ |
ab4bb4e99961
add hint to allow disabling the use of Xinput.
Edward Rudd <urkle@outoforder.cc>
parents:
6885
diff
changeset
|
430 |
return SDL_FALSE; |
ab4bb4e99961
add hint to allow disabling the use of Xinput.
Edward Rudd <urkle@outoforder.cc>
parents:
6885
diff
changeset
|
431 |
} |
ab4bb4e99961
add hint to allow disabling the use of Xinput.
Edward Rudd <urkle@outoforder.cc>
parents:
6885
diff
changeset
|
432 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
433 |
SDL_memset( pDevices, 0x0, sizeof(pDevices) ); |
6690
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
434 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
435 |
/* CoInit if needed */ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
436 |
hr = CoInitialize(NULL); |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
437 |
bCleanupCOM = SUCCEEDED(hr); |
6690
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
438 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
439 |
/* Create WMI */ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
440 |
hr = CoCreateInstance( &CLSID_WbemLocator, |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
441 |
NULL, |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
442 |
CLSCTX_INPROC_SERVER, |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
443 |
&IID_IWbemLocator, |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
444 |
(LPVOID*) &pIWbemLocator); |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
445 |
if( FAILED(hr) || pIWbemLocator == NULL ) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
446 |
goto LCleanup; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
447 |
|
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
448 |
bstrNamespace = SysAllocString( L"\\\\.\\root\\cimv2" );if( bstrNamespace == NULL ) goto LCleanup; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
449 |
bstrClassName = SysAllocString( L"Win32_PNPEntity" ); if( bstrClassName == NULL ) goto LCleanup; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
450 |
bstrDeviceID = SysAllocString( L"DeviceID" ); if( bstrDeviceID == NULL ) goto LCleanup; |
6690
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
451 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
452 |
/* Connect to WMI */ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
453 |
hr = IWbemLocator_ConnectServer( pIWbemLocator, bstrNamespace, NULL, NULL, 0L, |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
454 |
0L, NULL, NULL, &pIWbemServices ); |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
455 |
if( FAILED(hr) || pIWbemServices == NULL ) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
456 |
goto LCleanup; |
6690
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
457 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
458 |
/* Switch security level to IMPERSONATE. */ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
459 |
CoSetProxyBlanket( (IUnknown *)pIWbemServices, RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NONE, NULL, |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
460 |
RPC_C_AUTHN_LEVEL_CALL, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE ); |
6690
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
461 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
462 |
hr = IWbemServices_CreateInstanceEnum( pIWbemServices, bstrClassName, 0, NULL, &pEnumDevices ); |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
463 |
if( FAILED(hr) || pEnumDevices == NULL ) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
464 |
goto LCleanup; |
6690
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
465 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
466 |
/* Loop over all devices */ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
467 |
for( ;; ) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
468 |
{ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
469 |
/* Get 20 at a time */ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
470 |
hr = IEnumWbemClassObject_Next( pEnumDevices, 10000, 20, pDevices, &uReturned ); |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
471 |
if( FAILED(hr) ) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
472 |
goto LCleanup; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
473 |
if( uReturned == 0 ) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
474 |
break; |
6690
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
475 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
476 |
for( iDevice=0; iDevice<uReturned; iDevice++ ) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
477 |
{ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
478 |
/* For each device, get its device ID */ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
479 |
hr = IWbemClassObject_Get( pDevices[iDevice], bstrDeviceID, 0L, &var, NULL, NULL ); |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
480 |
if( SUCCEEDED( hr ) && var.vt == VT_BSTR && var.bstrVal != NULL ) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
481 |
{ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
482 |
/* Check if the device ID contains "IG_". If it does, then it's an XInput device */ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
483 |
/* This information can not be found from DirectInput */ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
484 |
char *pDeviceString = WIN_StringToUTF8( var.bstrVal ); |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
485 |
if( SDL_strstr( pDeviceString, "IG_" ) ) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
486 |
{ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
487 |
/* If it does, then get the VID/PID from var.bstrVal */ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
488 |
long dwPid = 0, dwVid = 0; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
489 |
char * strPid = NULL; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
490 |
DWORD dwVidPid = 0; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
491 |
char * strVid = SDL_strstr( pDeviceString, "VID_" ); |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
492 |
if( strVid ) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
493 |
{ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
494 |
dwVid = SDL_strtol( strVid + 4, NULL, 16 ); |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
495 |
} |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
496 |
strPid = SDL_strstr( pDeviceString, "PID_" ); |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
497 |
if( strPid ) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
498 |
{ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
499 |
dwPid = SDL_strtol( strPid + 4, NULL, 16 ); |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
500 |
} |
6690
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
501 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
502 |
/* Compare the VID/PID to the DInput device */ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
503 |
dwVidPid = MAKELONG( dwVid, dwPid ); |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
504 |
if( dwVidPid == pGuidProductFromDirectInput->Data1 ) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
505 |
{ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
506 |
bIsXinputDevice = SDL_TRUE; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
507 |
} |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
508 |
} |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
509 |
if ( pDeviceString ) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
510 |
SDL_free( pDeviceString ); |
6690
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
511 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
512 |
if ( bIsXinputDevice ) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
513 |
break; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
514 |
} |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
515 |
SAFE_RELEASE( pDevices[iDevice] ); |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
516 |
} |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
517 |
} |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
518 |
|
6690
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
519 |
LCleanup: |
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
520 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
521 |
for( iDevice=0; iDevice<20; iDevice++ ) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
522 |
SAFE_RELEASE( pDevices[iDevice] ); |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
523 |
SAFE_RELEASE( pEnumDevices ); |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
524 |
SAFE_RELEASE( pIWbemLocator ); |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
525 |
SAFE_RELEASE( pIWbemServices ); |
6690
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
526 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
527 |
if ( bstrNamespace ) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
528 |
SysFreeString( bstrNamespace ); |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
529 |
if ( bstrClassName ) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
530 |
SysFreeString( bstrClassName ); |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
531 |
if ( bstrDeviceID ) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
532 |
SysFreeString( bstrDeviceID ); |
6690
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
533 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
534 |
if( bCleanupCOM ) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
535 |
CoUninitialize(); |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
536 |
|
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
537 |
return bIsXinputDevice; |
6690
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
538 |
} |
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
539 |
|
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
540 |
|
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
541 |
static SDL_bool s_bWindowsDeviceChanged = SDL_FALSE; |
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
542 |
|
7133
87d4cb9bb66c
Corrected spelling in C source files.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents:
7037
diff
changeset
|
543 |
/* windowproc for our joystick detect thread message only window, to detect any USB device addition/removal |
6690
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
544 |
*/ |
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
545 |
LRESULT CALLBACK SDL_PrivateJoystickDetectProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { |
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
546 |
switch (message) { |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
547 |
case WM_DEVICECHANGE: |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
548 |
switch (wParam) { |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
549 |
case DBT_DEVICEARRIVAL: |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
550 |
if (((DEV_BROADCAST_HDR*)lParam)->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE) { |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
551 |
s_bWindowsDeviceChanged = SDL_TRUE; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
552 |
} |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
553 |
break; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
554 |
case DBT_DEVICEREMOVECOMPLETE: |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
555 |
if (((DEV_BROADCAST_HDR*)lParam)->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE) { |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
556 |
s_bWindowsDeviceChanged = SDL_TRUE; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
557 |
} |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
558 |
break; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
559 |
} |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
560 |
return 0; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
561 |
} |
6690
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
562 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
563 |
return DefWindowProc (hwnd, message, wParam, lParam); |
6690
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
564 |
} |
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
565 |
|
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
566 |
|
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
567 |
DEFINE_GUID(GUID_DEVINTERFACE_USB_DEVICE, 0xA5DCBF10L, 0x6530, 0x11D2, 0x90, 0x1F, 0x00, \ |
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
568 |
0xC0, 0x4F, 0xB9, 0x51, 0xED); |
6690
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
569 |
|
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
570 |
/* Function/thread to scan the system for joysticks. |
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
571 |
*/ |
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
572 |
static int |
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
573 |
SDL_JoystickThread(void *_data) |
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
574 |
{ |
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
575 |
HWND messageWindow = 0; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
576 |
HDEVNOTIFY hNotify = 0; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
577 |
DEV_BROADCAST_DEVICEINTERFACE dbh; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
578 |
SDL_bool bOpenedXInputDevices[4]; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
579 |
WNDCLASSEX wincl; |
6710
e650705e2c1d
Alfred Reynolds - add scanning of XInput for controller connectedness so we can detect when the wireless controller turns on and off, the usb side doesn't change when the controller goes away
Sam Lantinga <slouken@libsdl.org>
parents:
6709
diff
changeset
|
580 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
581 |
SDL_memset( bOpenedXInputDevices, 0x0, sizeof(bOpenedXInputDevices) ); |
6690
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
582 |
|
7223
76fa20889de8
Fixed compile errors building with mingw64
Sam Lantinga <slouken@libsdl.org>
parents:
7191
diff
changeset
|
583 |
WIN_CoInitialize(); |
6690
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
584 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
585 |
SDL_memset( &wincl, 0x0, sizeof(wincl) ); |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
586 |
wincl.hInstance = GetModuleHandle( NULL ); |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
587 |
wincl.lpszClassName = L"Message"; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
588 |
wincl.lpfnWndProc = SDL_PrivateJoystickDetectProc; /* This function is called by windows */ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
589 |
wincl.cbSize = sizeof (WNDCLASSEX); |
6712
05f046f5886b
Fixed crashes in new joystick code
Sam Lantinga <slouken@libsdl.org>
parents:
6710
diff
changeset
|
590 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
591 |
if (!RegisterClassEx (&wincl)) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
592 |
{ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
593 |
return SDL_SetError("Failed to create register class for joystick autodetect.", GetLastError()); |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
594 |
} |
6712
05f046f5886b
Fixed crashes in new joystick code
Sam Lantinga <slouken@libsdl.org>
parents:
6710
diff
changeset
|
595 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
596 |
messageWindow = (HWND)CreateWindowEx( 0, L"Message", NULL, 0, 0, 0, 0, 0, HWND_MESSAGE, NULL, NULL, NULL ); |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
597 |
if ( !messageWindow ) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
598 |
{ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
599 |
return SDL_SetError("Failed to create message window for joystick autodetect.", GetLastError()); |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
600 |
} |
6690
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
601 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
602 |
SDL_memset(&dbh, 0x0, sizeof(dbh)); |
6690
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
603 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
604 |
dbh.dbcc_size = sizeof(dbh); |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
605 |
dbh.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
606 |
dbh.dbcc_classguid = GUID_DEVINTERFACE_USB_DEVICE; |
6690
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
607 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
608 |
hNotify = RegisterDeviceNotification( messageWindow, &dbh, DEVICE_NOTIFY_WINDOW_HANDLE ); |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
609 |
if ( !hNotify ) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
610 |
{ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
611 |
return SDL_SetError("Failed to create notify device for joystick autodetect.", GetLastError()); |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
612 |
} |
6690
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
613 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
614 |
SDL_LockMutex( s_mutexJoyStickEnum ); |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
615 |
while ( s_bJoystickThreadQuit == SDL_FALSE ) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
616 |
{ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
617 |
MSG messages; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
618 |
Uint8 userId; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
619 |
int nCurrentOpenedXInputDevices = 0; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
620 |
int nNewOpenedXInputDevices = 0; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
621 |
SDL_CondWaitTimeout( s_condJoystickThread, s_mutexJoyStickEnum, 300 ); |
6690
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
622 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
623 |
while ( s_bJoystickThreadQuit == SDL_FALSE && PeekMessage(&messages, messageWindow, 0, 0, PM_NOREMOVE) ) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
624 |
{ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
625 |
if ( GetMessage(&messages, messageWindow, 0, 0) != 0 ) { |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
626 |
TranslateMessage(&messages); |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
627 |
DispatchMessage(&messages); |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
628 |
} |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
629 |
} |
6690
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
630 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
631 |
if ( s_bXInputEnabled && XINPUTGETCAPABILITIES ) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
632 |
{ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
633 |
/* scan for any change in XInput devices */ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
634 |
for ( userId = 0; userId < 4; userId++ ) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
635 |
{ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
636 |
XINPUT_CAPABILITIES capabilities; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
637 |
DWORD result; |
6710
e650705e2c1d
Alfred Reynolds - add scanning of XInput for controller connectedness so we can detect when the wireless controller turns on and off, the usb side doesn't change when the controller goes away
Sam Lantinga <slouken@libsdl.org>
parents:
6709
diff
changeset
|
638 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
639 |
if ( bOpenedXInputDevices[userId] == SDL_TRUE ) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
640 |
nCurrentOpenedXInputDevices++; |
6710
e650705e2c1d
Alfred Reynolds - add scanning of XInput for controller connectedness so we can detect when the wireless controller turns on and off, the usb side doesn't change when the controller goes away
Sam Lantinga <slouken@libsdl.org>
parents:
6709
diff
changeset
|
641 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
642 |
result = XINPUTGETCAPABILITIES( userId, XINPUT_FLAG_GAMEPAD, &capabilities ); |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
643 |
if ( result == ERROR_SUCCESS ) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
644 |
{ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
645 |
bOpenedXInputDevices[userId] = SDL_TRUE; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
646 |
nNewOpenedXInputDevices++; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
647 |
} |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
648 |
else |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
649 |
{ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
650 |
bOpenedXInputDevices[userId] = SDL_FALSE; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
651 |
} |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
652 |
} |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
653 |
} |
6710
e650705e2c1d
Alfred Reynolds - add scanning of XInput for controller connectedness so we can detect when the wireless controller turns on and off, the usb side doesn't change when the controller goes away
Sam Lantinga <slouken@libsdl.org>
parents:
6709
diff
changeset
|
654 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
655 |
if ( s_pKnownJoystickGUIDs && ( s_bWindowsDeviceChanged || nNewOpenedXInputDevices != nCurrentOpenedXInputDevices ) ) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
656 |
{ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
657 |
SDL_Delay( 300 ); /* wait for direct input to find out about this device */ |
6690
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
658 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
659 |
s_bDeviceRemoved = SDL_TRUE; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
660 |
s_bDeviceAdded = SDL_TRUE; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
661 |
s_bWindowsDeviceChanged = SDL_FALSE; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
662 |
} |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
663 |
} |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
664 |
SDL_UnlockMutex( s_mutexJoyStickEnum ); |
6690
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
665 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
666 |
if ( hNotify ) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
667 |
UnregisterDeviceNotification( hNotify ); |
6690
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
668 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
669 |
if ( messageWindow ) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
670 |
DestroyWindow( messageWindow ); |
6712
05f046f5886b
Fixed crashes in new joystick code
Sam Lantinga <slouken@libsdl.org>
parents:
6710
diff
changeset
|
671 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
672 |
UnregisterClass( wincl.lpszClassName, wincl.hInstance ); |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
673 |
messageWindow = 0; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
674 |
WIN_CoUninitialize(); |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
675 |
return 1; |
6690
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
676 |
} |
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
677 |
|
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
678 |
|
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
679 |
/* Function to scan the system for joysticks. |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
680 |
* This function should set SDL_numjoysticks to the number of available |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
681 |
* joysticks. Joystick 0 should be the system default joystick. |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
682 |
* It should return 0, or -1 on an unrecoverable fatal error. |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
683 |
*/ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
684 |
int |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
685 |
SDL_SYS_JoystickInit(void) |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
686 |
{ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
687 |
HRESULT result; |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2198
diff
changeset
|
688 |
HINSTANCE instance; |
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
689 |
const char *env = SDL_GetHint(SDL_HINT_XINPUT_ENABLED); |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
690 |
if (env && !SDL_atoi(env)) { |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
691 |
s_bXInputEnabled = SDL_FALSE; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
692 |
} |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
693 |
|
5591
17beb16fa838
Cleaned up CoInitialize() politics on Windows.
Ryan C. Gordon <icculus@icculus.org>
parents:
5535
diff
changeset
|
694 |
result = WIN_CoInitialize(); |
2198
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
695 |
if (FAILED(result)) { |
7037
3fedf1f25b94
Make SDL_SetError and friends unconditionally return -1.
Ryan C. Gordon <icculus@icculus.org>
parents:
6993
diff
changeset
|
696 |
return SetDIerror("CoInitialize", result); |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
697 |
} |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
698 |
|
5591
17beb16fa838
Cleaned up CoInitialize() politics on Windows.
Ryan C. Gordon <icculus@icculus.org>
parents:
5535
diff
changeset
|
699 |
coinitialized = SDL_TRUE; |
17beb16fa838
Cleaned up CoInitialize() politics on Windows.
Ryan C. Gordon <icculus@icculus.org>
parents:
5535
diff
changeset
|
700 |
|
6690
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
701 |
result = CoCreateInstance(&CLSID_DirectInput8, NULL, CLSCTX_INPROC_SERVER, |
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
702 |
&IID_IDirectInput8, (LPVOID)&dinput); |
2198
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
703 |
|
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
704 |
if (FAILED(result)) { |
5591
17beb16fa838
Cleaned up CoInitialize() politics on Windows.
Ryan C. Gordon <icculus@icculus.org>
parents:
5535
diff
changeset
|
705 |
SDL_SYS_JoystickQuit(); |
7037
3fedf1f25b94
Make SDL_SetError and friends unconditionally return -1.
Ryan C. Gordon <icculus@icculus.org>
parents:
6993
diff
changeset
|
706 |
return SetDIerror("CoCreateInstance", result); |
2198
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
707 |
} |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
708 |
|
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
709 |
/* Because we used CoCreateInstance, we need to Initialize it, first. */ |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2198
diff
changeset
|
710 |
instance = GetModuleHandle(NULL); |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2198
diff
changeset
|
711 |
if (instance == NULL) { |
5591
17beb16fa838
Cleaned up CoInitialize() politics on Windows.
Ryan C. Gordon <icculus@icculus.org>
parents:
5535
diff
changeset
|
712 |
SDL_SYS_JoystickQuit(); |
7037
3fedf1f25b94
Make SDL_SetError and friends unconditionally return -1.
Ryan C. Gordon <icculus@icculus.org>
parents:
6993
diff
changeset
|
713 |
return SDL_SetError("GetModuleHandle() failed with error code %d.", GetLastError()); |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2198
diff
changeset
|
714 |
} |
6690
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
715 |
result = IDirectInput8_Initialize(dinput, instance, DIRECTINPUT_VERSION); |
2198
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
716 |
|
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
717 |
if (FAILED(result)) { |
5591
17beb16fa838
Cleaned up CoInitialize() politics on Windows.
Ryan C. Gordon <icculus@icculus.org>
parents:
5535
diff
changeset
|
718 |
SDL_SYS_JoystickQuit(); |
7037
3fedf1f25b94
Make SDL_SetError and friends unconditionally return -1.
Ryan C. Gordon <icculus@icculus.org>
parents:
6993
diff
changeset
|
719 |
return SetDIerror("IDirectInput::Initialize", result); |
2198
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
720 |
} |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
721 |
|
6990
2514368c2aaf
First shot at Windows XInput haptics.
Ryan C. Gordon <icculus@icculus.org>
parents:
6977
diff
changeset
|
722 |
s_mutexJoyStickEnum = SDL_CreateMutex(); |
2514368c2aaf
First shot at Windows XInput haptics.
Ryan C. Gordon <icculus@icculus.org>
parents:
6977
diff
changeset
|
723 |
s_condJoystickThread = SDL_CreateCond(); |
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
724 |
s_bDeviceAdded = SDL_TRUE; /* force a scan of the system for joysticks this first time */ |
6990
2514368c2aaf
First shot at Windows XInput haptics.
Ryan C. Gordon <icculus@icculus.org>
parents:
6977
diff
changeset
|
725 |
SDL_SYS_JoystickDetect(); |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
726 |
|
6990
2514368c2aaf
First shot at Windows XInput haptics.
Ryan C. Gordon <icculus@icculus.org>
parents:
6977
diff
changeset
|
727 |
if ((s_bXInputEnabled) && (WIN_LoadXInputDLL() == -1)) { |
2514368c2aaf
First shot at Windows XInput haptics.
Ryan C. Gordon <icculus@icculus.org>
parents:
6977
diff
changeset
|
728 |
s_bXInputEnabled = SDL_FALSE; /* oh well. */ |
6965
ab4bb4e99961
add hint to allow disabling the use of Xinput.
Edward Rudd <urkle@outoforder.cc>
parents:
6885
diff
changeset
|
729 |
} |
2198
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
730 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
731 |
if ( !s_threadJoystick ) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
732 |
{ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
733 |
s_bJoystickThreadQuit = SDL_FALSE; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
734 |
/* spin up the thread to detect hotplug of devices */ |
6690
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
735 |
#if defined(__WIN32__) && !defined(HAVE_LIBC) |
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
736 |
#undef SDL_CreateThread |
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
737 |
s_threadJoystick= SDL_CreateThread( SDL_JoystickThread, "SDL_joystick", NULL, NULL, NULL ); |
6690
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
738 |
#else |
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
739 |
s_threadJoystick = SDL_CreateThread( SDL_JoystickThread, "SDL_joystick", NULL ); |
6690
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
740 |
#endif |
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
741 |
} |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
742 |
return SDL_SYS_NumJoysticks(); |
2198
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
743 |
} |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
744 |
|
6707
70eeb7e3ec2f
Organized joystick hotplug code a bit.
Sam Lantinga <slouken@libsdl.org>
parents:
6698
diff
changeset
|
745 |
/* return the number of joysticks that are connected right now */ |
70eeb7e3ec2f
Organized joystick hotplug code a bit.
Sam Lantinga <slouken@libsdl.org>
parents:
6698
diff
changeset
|
746 |
int SDL_SYS_NumJoysticks() |
70eeb7e3ec2f
Organized joystick hotplug code a bit.
Sam Lantinga <slouken@libsdl.org>
parents:
6698
diff
changeset
|
747 |
{ |
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
748 |
int nJoysticks = 0; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
749 |
JoyStick_DeviceData *device = SYS_Joystick; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
750 |
while ( device ) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
751 |
{ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
752 |
nJoysticks++; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
753 |
device = device->pNext; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
754 |
} |
6707
70eeb7e3ec2f
Organized joystick hotplug code a bit.
Sam Lantinga <slouken@libsdl.org>
parents:
6698
diff
changeset
|
755 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
756 |
return nJoysticks; |
6707
70eeb7e3ec2f
Organized joystick hotplug code a bit.
Sam Lantinga <slouken@libsdl.org>
parents:
6698
diff
changeset
|
757 |
} |
70eeb7e3ec2f
Organized joystick hotplug code a bit.
Sam Lantinga <slouken@libsdl.org>
parents:
6698
diff
changeset
|
758 |
|
70eeb7e3ec2f
Organized joystick hotplug code a bit.
Sam Lantinga <slouken@libsdl.org>
parents:
6698
diff
changeset
|
759 |
static int s_iNewGUID = 0; |
70eeb7e3ec2f
Organized joystick hotplug code a bit.
Sam Lantinga <slouken@libsdl.org>
parents:
6698
diff
changeset
|
760 |
|
70eeb7e3ec2f
Organized joystick hotplug code a bit.
Sam Lantinga <slouken@libsdl.org>
parents:
6698
diff
changeset
|
761 |
/* helper function for direct input, gets called for each connected joystick */ |
70eeb7e3ec2f
Organized joystick hotplug code a bit.
Sam Lantinga <slouken@libsdl.org>
parents:
6698
diff
changeset
|
762 |
static BOOL CALLBACK |
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
763 |
EnumJoysticksCallback(const DIDEVICEINSTANCE * pdidInstance, VOID * pContext) |
6707
70eeb7e3ec2f
Organized joystick hotplug code a bit.
Sam Lantinga <slouken@libsdl.org>
parents:
6698
diff
changeset
|
764 |
{ |
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
765 |
JoyStick_DeviceData *pNewJoystick; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
766 |
JoyStick_DeviceData *pPrevJoystick = NULL; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
767 |
SDL_bool bXInputDevice; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
768 |
pNewJoystick = *(JoyStick_DeviceData **)pContext; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
769 |
while ( pNewJoystick ) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
770 |
{ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
771 |
if ( !SDL_memcmp( &pNewJoystick->dxdevice.guidInstance, &pdidInstance->guidInstance, sizeof(pNewJoystick->dxdevice.guidInstance) ) ) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
772 |
{ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
773 |
/* if we are replacing the front of the list then update it */ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
774 |
if ( pNewJoystick == *(JoyStick_DeviceData **)pContext ) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
775 |
{ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
776 |
*(JoyStick_DeviceData **)pContext = pNewJoystick->pNext; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
777 |
} |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
778 |
else if ( pPrevJoystick ) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
779 |
{ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
780 |
pPrevJoystick->pNext = pNewJoystick->pNext; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
781 |
} |
6712
05f046f5886b
Fixed crashes in new joystick code
Sam Lantinga <slouken@libsdl.org>
parents:
6710
diff
changeset
|
782 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
783 |
pNewJoystick->pNext = SYS_Joystick; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
784 |
SYS_Joystick = pNewJoystick; |
6707
70eeb7e3ec2f
Organized joystick hotplug code a bit.
Sam Lantinga <slouken@libsdl.org>
parents:
6698
diff
changeset
|
785 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
786 |
s_pKnownJoystickGUIDs[ s_iNewGUID ] = pdidInstance->guidInstance; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
787 |
s_iNewGUID++; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
788 |
if ( s_iNewGUID < MAX_JOYSTICKS ) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
789 |
return DIENUM_CONTINUE; /* already have this joystick loaded, just keep going */ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
790 |
else |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
791 |
return DIENUM_STOP; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
792 |
} |
6707
70eeb7e3ec2f
Organized joystick hotplug code a bit.
Sam Lantinga <slouken@libsdl.org>
parents:
6698
diff
changeset
|
793 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
794 |
pPrevJoystick = pNewJoystick; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
795 |
pNewJoystick = pNewJoystick->pNext; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
796 |
} |
6707
70eeb7e3ec2f
Organized joystick hotplug code a bit.
Sam Lantinga <slouken@libsdl.org>
parents:
6698
diff
changeset
|
797 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
798 |
s_bDeviceAdded = SDL_TRUE; |
6707
70eeb7e3ec2f
Organized joystick hotplug code a bit.
Sam Lantinga <slouken@libsdl.org>
parents:
6698
diff
changeset
|
799 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
800 |
bXInputDevice = IsXInputDevice( &pdidInstance->guidProduct ); |
6707
70eeb7e3ec2f
Organized joystick hotplug code a bit.
Sam Lantinga <slouken@libsdl.org>
parents:
6698
diff
changeset
|
801 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
802 |
pNewJoystick = (JoyStick_DeviceData *)SDL_malloc( sizeof(JoyStick_DeviceData) ); |
6707
70eeb7e3ec2f
Organized joystick hotplug code a bit.
Sam Lantinga <slouken@libsdl.org>
parents:
6698
diff
changeset
|
803 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
804 |
if ( bXInputDevice ) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
805 |
{ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
806 |
pNewJoystick->bXInputDevice = SDL_TRUE; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
807 |
pNewJoystick->XInputUserId = INVALID_XINPUT_USERID; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
808 |
} |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
809 |
else |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
810 |
{ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
811 |
pNewJoystick->bXInputDevice = SDL_FALSE; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
812 |
} |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
813 |
|
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
814 |
SDL_memcpy(&(pNewJoystick->dxdevice), pdidInstance, |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
815 |
sizeof(DIDEVICEINSTANCE)); |
6712
05f046f5886b
Fixed crashes in new joystick code
Sam Lantinga <slouken@libsdl.org>
parents:
6710
diff
changeset
|
816 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
817 |
pNewJoystick->joystickname = WIN_StringToUTF8(pdidInstance->tszProductName); |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
818 |
pNewJoystick->send_add_event = 1; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
819 |
pNewJoystick->nInstanceID = ++s_nInstanceID; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
820 |
SDL_memcpy( &pNewJoystick->guid, &pdidInstance->guidProduct, sizeof(pNewJoystick->guid) ); |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
821 |
pNewJoystick->pNext = NULL; |
6707
70eeb7e3ec2f
Organized joystick hotplug code a bit.
Sam Lantinga <slouken@libsdl.org>
parents:
6698
diff
changeset
|
822 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
823 |
if ( SYS_Joystick ) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
824 |
{ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
825 |
pNewJoystick->pNext = SYS_Joystick; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
826 |
} |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
827 |
SYS_Joystick = pNewJoystick; |
6707
70eeb7e3ec2f
Organized joystick hotplug code a bit.
Sam Lantinga <slouken@libsdl.org>
parents:
6698
diff
changeset
|
828 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
829 |
s_pKnownJoystickGUIDs[ s_iNewGUID ] = pdidInstance->guidInstance; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
830 |
s_iNewGUID++; |
6707
70eeb7e3ec2f
Organized joystick hotplug code a bit.
Sam Lantinga <slouken@libsdl.org>
parents:
6698
diff
changeset
|
831 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
832 |
if ( s_iNewGUID < MAX_JOYSTICKS ) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
833 |
return DIENUM_CONTINUE; /* already have this joystick loaded, just keep going */ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
834 |
else |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
835 |
return DIENUM_STOP; |
6707
70eeb7e3ec2f
Organized joystick hotplug code a bit.
Sam Lantinga <slouken@libsdl.org>
parents:
6698
diff
changeset
|
836 |
} |
70eeb7e3ec2f
Organized joystick hotplug code a bit.
Sam Lantinga <slouken@libsdl.org>
parents:
6698
diff
changeset
|
837 |
|
70eeb7e3ec2f
Organized joystick hotplug code a bit.
Sam Lantinga <slouken@libsdl.org>
parents:
6698
diff
changeset
|
838 |
/* detect any new joysticks being inserted into the system */ |
70eeb7e3ec2f
Organized joystick hotplug code a bit.
Sam Lantinga <slouken@libsdl.org>
parents:
6698
diff
changeset
|
839 |
void SDL_SYS_JoystickDetect() |
70eeb7e3ec2f
Organized joystick hotplug code a bit.
Sam Lantinga <slouken@libsdl.org>
parents:
6698
diff
changeset
|
840 |
{ |
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
841 |
JoyStick_DeviceData *pCurList = NULL; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
842 |
/* only enum the devices if the joystick thread told us something changed */ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
843 |
if ( s_bDeviceAdded || s_bDeviceRemoved ) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
844 |
{ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
845 |
s_bDeviceAdded = SDL_FALSE; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
846 |
s_bDeviceRemoved = SDL_FALSE; |
6707
70eeb7e3ec2f
Organized joystick hotplug code a bit.
Sam Lantinga <slouken@libsdl.org>
parents:
6698
diff
changeset
|
847 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
848 |
pCurList = SYS_Joystick; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
849 |
SYS_Joystick = NULL; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
850 |
s_iNewGUID = 0; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
851 |
SDL_LockMutex( s_mutexJoyStickEnum ); |
6707
70eeb7e3ec2f
Organized joystick hotplug code a bit.
Sam Lantinga <slouken@libsdl.org>
parents:
6698
diff
changeset
|
852 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
853 |
if ( !s_pKnownJoystickGUIDs ) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
854 |
s_pKnownJoystickGUIDs = SDL_malloc( sizeof(GUID)*MAX_JOYSTICKS ); |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
855 |
|
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
856 |
SDL_memset( s_pKnownJoystickGUIDs, 0x0, sizeof(GUID)*MAX_JOYSTICKS ); |
6707
70eeb7e3ec2f
Organized joystick hotplug code a bit.
Sam Lantinga <slouken@libsdl.org>
parents:
6698
diff
changeset
|
857 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
858 |
/* Look for joysticks, wheels, head trackers, gamepads, etc.. */ |
7223
76fa20889de8
Fixed compile errors building with mingw64
Sam Lantinga <slouken@libsdl.org>
parents:
7191
diff
changeset
|
859 |
IDirectInput8_EnumDevices(dinput, |
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
860 |
DI8DEVCLASS_GAMECTRL, |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
861 |
EnumJoysticksCallback, |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
862 |
&pCurList, DIEDFL_ATTACHEDONLY); |
6707
70eeb7e3ec2f
Organized joystick hotplug code a bit.
Sam Lantinga <slouken@libsdl.org>
parents:
6698
diff
changeset
|
863 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
864 |
SDL_UnlockMutex( s_mutexJoyStickEnum ); |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
865 |
} |
6707
70eeb7e3ec2f
Organized joystick hotplug code a bit.
Sam Lantinga <slouken@libsdl.org>
parents:
6698
diff
changeset
|
866 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
867 |
if ( pCurList ) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
868 |
{ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
869 |
while ( pCurList ) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
870 |
{ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
871 |
JoyStick_DeviceData *pListNext = NULL; |
6707
70eeb7e3ec2f
Organized joystick hotplug code a bit.
Sam Lantinga <slouken@libsdl.org>
parents:
6698
diff
changeset
|
872 |
#if !SDL_EVENTS_DISABLED |
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
873 |
SDL_Event event; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
874 |
event.type = SDL_JOYDEVICEREMOVED; |
6707
70eeb7e3ec2f
Organized joystick hotplug code a bit.
Sam Lantinga <slouken@libsdl.org>
parents:
6698
diff
changeset
|
875 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
876 |
if (SDL_GetEventState(event.type) == SDL_ENABLE) { |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
877 |
event.jdevice.which = pCurList->nInstanceID; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
878 |
if ((SDL_EventOK == NULL) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
879 |
|| (*SDL_EventOK) (SDL_EventOKParam, &event)) { |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
880 |
SDL_PushEvent(&event); |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
881 |
} |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
882 |
} |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
883 |
#endif /* !SDL_EVENTS_DISABLED */ |
6707
70eeb7e3ec2f
Organized joystick hotplug code a bit.
Sam Lantinga <slouken@libsdl.org>
parents:
6698
diff
changeset
|
884 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
885 |
pListNext = pCurList->pNext; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
886 |
SDL_free(pCurList->joystickname); |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
887 |
SDL_free( pCurList ); |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
888 |
pCurList = pListNext; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
889 |
} |
6707
70eeb7e3ec2f
Organized joystick hotplug code a bit.
Sam Lantinga <slouken@libsdl.org>
parents:
6698
diff
changeset
|
890 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
891 |
} |
6707
70eeb7e3ec2f
Organized joystick hotplug code a bit.
Sam Lantinga <slouken@libsdl.org>
parents:
6698
diff
changeset
|
892 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
893 |
if ( s_bDeviceAdded ) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
894 |
{ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
895 |
JoyStick_DeviceData *pNewJoystick; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
896 |
int device_index = 0; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
897 |
s_bDeviceAdded = SDL_FALSE; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
898 |
pNewJoystick = SYS_Joystick; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
899 |
while ( pNewJoystick ) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
900 |
{ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
901 |
if ( pNewJoystick->send_add_event ) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
902 |
{ |
6707
70eeb7e3ec2f
Organized joystick hotplug code a bit.
Sam Lantinga <slouken@libsdl.org>
parents:
6698
diff
changeset
|
903 |
#if !SDL_EVENTS_DISABLED |
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
904 |
SDL_Event event; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
905 |
event.type = SDL_JOYDEVICEADDED; |
6707
70eeb7e3ec2f
Organized joystick hotplug code a bit.
Sam Lantinga <slouken@libsdl.org>
parents:
6698
diff
changeset
|
906 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
907 |
if (SDL_GetEventState(event.type) == SDL_ENABLE) { |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
908 |
event.jdevice.which = device_index; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
909 |
if ((SDL_EventOK == NULL) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
910 |
|| (*SDL_EventOK) (SDL_EventOKParam, &event)) { |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
911 |
SDL_PushEvent(&event); |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
912 |
} |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
913 |
} |
6707
70eeb7e3ec2f
Organized joystick hotplug code a bit.
Sam Lantinga <slouken@libsdl.org>
parents:
6698
diff
changeset
|
914 |
#endif /* !SDL_EVENTS_DISABLED */ |
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
915 |
pNewJoystick->send_add_event = 0; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
916 |
} |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
917 |
device_index++; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
918 |
pNewJoystick = pNewJoystick->pNext; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
919 |
} |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
920 |
} |
6707
70eeb7e3ec2f
Organized joystick hotplug code a bit.
Sam Lantinga <slouken@libsdl.org>
parents:
6698
diff
changeset
|
921 |
} |
70eeb7e3ec2f
Organized joystick hotplug code a bit.
Sam Lantinga <slouken@libsdl.org>
parents:
6698
diff
changeset
|
922 |
|
70eeb7e3ec2f
Organized joystick hotplug code a bit.
Sam Lantinga <slouken@libsdl.org>
parents:
6698
diff
changeset
|
923 |
/* we need to poll if we have pending hotplug device changes or connected devices */ |
70eeb7e3ec2f
Organized joystick hotplug code a bit.
Sam Lantinga <slouken@libsdl.org>
parents:
6698
diff
changeset
|
924 |
SDL_bool SDL_SYS_JoystickNeedsPolling() |
70eeb7e3ec2f
Organized joystick hotplug code a bit.
Sam Lantinga <slouken@libsdl.org>
parents:
6698
diff
changeset
|
925 |
{ |
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
926 |
/* we have a new device or one was pulled, we need to think this frame please */ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
927 |
if ( s_bDeviceAdded || s_bDeviceRemoved ) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
928 |
return SDL_TRUE; |
6707
70eeb7e3ec2f
Organized joystick hotplug code a bit.
Sam Lantinga <slouken@libsdl.org>
parents:
6698
diff
changeset
|
929 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
930 |
return SDL_FALSE; |
6707
70eeb7e3ec2f
Organized joystick hotplug code a bit.
Sam Lantinga <slouken@libsdl.org>
parents:
6698
diff
changeset
|
931 |
} |
70eeb7e3ec2f
Organized joystick hotplug code a bit.
Sam Lantinga <slouken@libsdl.org>
parents:
6698
diff
changeset
|
932 |
|
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
933 |
/* Function to get the device-dependent name of a joystick */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
934 |
const char * |
6707
70eeb7e3ec2f
Organized joystick hotplug code a bit.
Sam Lantinga <slouken@libsdl.org>
parents:
6698
diff
changeset
|
935 |
SDL_SYS_JoystickNameForDeviceIndex(int device_index) |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
936 |
{ |
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
937 |
JoyStick_DeviceData *device = SYS_Joystick; |
6690
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
938 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
939 |
for (; device_index > 0; device_index--) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
940 |
device = device->pNext; |
6690
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
941 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
942 |
return device->joystickname; |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
943 |
} |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
944 |
|
6707
70eeb7e3ec2f
Organized joystick hotplug code a bit.
Sam Lantinga <slouken@libsdl.org>
parents:
6698
diff
changeset
|
945 |
/* Function to perform the mapping between current device instance and this joysticks instance id */ |
70eeb7e3ec2f
Organized joystick hotplug code a bit.
Sam Lantinga <slouken@libsdl.org>
parents:
6698
diff
changeset
|
946 |
SDL_JoystickID SDL_SYS_GetInstanceIdOfDeviceIndex(int device_index) |
70eeb7e3ec2f
Organized joystick hotplug code a bit.
Sam Lantinga <slouken@libsdl.org>
parents:
6698
diff
changeset
|
947 |
{ |
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
948 |
JoyStick_DeviceData *device = SYS_Joystick; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
949 |
int index; |
6707
70eeb7e3ec2f
Organized joystick hotplug code a bit.
Sam Lantinga <slouken@libsdl.org>
parents:
6698
diff
changeset
|
950 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
951 |
for (index = device_index; index > 0; index--) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
952 |
device = device->pNext; |
6707
70eeb7e3ec2f
Organized joystick hotplug code a bit.
Sam Lantinga <slouken@libsdl.org>
parents:
6698
diff
changeset
|
953 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
954 |
return device->nInstanceID; |
6707
70eeb7e3ec2f
Organized joystick hotplug code a bit.
Sam Lantinga <slouken@libsdl.org>
parents:
6698
diff
changeset
|
955 |
} |
70eeb7e3ec2f
Organized joystick hotplug code a bit.
Sam Lantinga <slouken@libsdl.org>
parents:
6698
diff
changeset
|
956 |
|
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
957 |
/* Function to open a joystick for use. |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
958 |
The joystick to open is specified by the index field of the joystick. |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
959 |
This should fill the nbuttons and naxes fields of the joystick structure. |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
960 |
It returns 0, or -1 if there is an error. |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
961 |
*/ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
962 |
int |
6690
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
963 |
SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index) |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
964 |
{ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
965 |
HRESULT result; |
6716
1616f6b3738c
Move all DirectInput code from DI2 to DI8.
Ryan C. Gordon <icculus@icculus.org>
parents:
6712
diff
changeset
|
966 |
LPDIRECTINPUTDEVICE8 device; |
2198
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
967 |
DIPROPDWORD dipdw; |
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
968 |
JoyStick_DeviceData *joystickdevice = SYS_Joystick; |
6690
9548c8a58103
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
Sam Lantinga <slouken@libsdl.org>
parents:
6403
diff
changeset
|
969 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
970 |
for (; device_index > 0; device_index--) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
971 |
joystickdevice = joystickdevice->pNext; |
2198
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
972 |
|
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2198
diff
changeset
|
973 |
SDL_memset(&dipdw, 0, sizeof(DIPROPDWORD)); |
2198
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
974 |
dipdw.diph.dwSize = sizeof(DIPROPDWORD); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
975 |
dipdw.diph.dwHeaderSize = sizeof(DIPROPHEADER); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
976 |
|
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
977 |
/* allocate memory for system specific hardware data */ |
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
978 |
joystick->instance_id = joystickdevice->nInstanceID; |
6965
ab4bb4e99961
add hint to allow disabling the use of Xinput.
Edward Rudd <urkle@outoforder.cc>
parents:
6885
diff
changeset
|
979 |
joystick->closed = 0; |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
980 |
joystick->hwdata = |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2198
diff
changeset
|
981 |
(struct joystick_hwdata *) SDL_malloc(sizeof(struct joystick_hwdata)); |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
982 |
if (joystick->hwdata == NULL) { |
7037
3fedf1f25b94
Make SDL_SetError and friends unconditionally return -1.
Ryan C. Gordon <icculus@icculus.org>
parents:
6993
diff
changeset
|
983 |
return SDL_OutOfMemory(); |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
984 |
} |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2198
diff
changeset
|
985 |
SDL_memset(joystick->hwdata, 0, sizeof(struct joystick_hwdata)); |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
986 |
joystick->hwdata->buffered = 1; |
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
987 |
joystick->hwdata->removed = 0; |
2198
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
988 |
joystick->hwdata->Capabilities.dwSize = sizeof(DIDEVCAPS); |
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
989 |
joystick->hwdata->guid = joystickdevice->guid; |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
990 |
|
7191
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
991 |
if ( joystickdevice->bXInputDevice ) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
992 |
{ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
993 |
XINPUT_CAPABILITIES capabilities; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
994 |
Uint8 userId = 0; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
995 |
DWORD result; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
996 |
JoyStick_DeviceData *joysticklist = SYS_Joystick; |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
997 |
/* scan the opened joysticks and pick the next free xinput userid for this one */ |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
changeset
|
998 |
for( ; joysticklist; joysticklist = joysticklist->pNext) |
75360622e65f
File style cleanup for the SDL 2.0 release
Sam Lantinga <slouken@libsdl.org>
parents:
7133
diff
|