Mercurial > sdl-ios-xcode
annotate src/joystick/win32/SDL_dxjoystick.c @ 3249:2befcf0c5ce0
Fix build on native 64-bit architecture
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 05 Sep 2009 14:22:12 +0000 |
parents | 8cc00819c8d6 |
children | 239ae83fc2f6 |
rev | line source |
---|---|
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 /* |
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
|
2 SDL - Simple DirectMedia Layer |
2859 | 3 Copyright (C) 1997-2009 Sam Lantinga |
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 |
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
|
5 This library is free software; you can redistribute it and/or |
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
|
6 modify it under the terms of the GNU Lesser General Public |
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
|
7 License as published by the Free Software Foundation; either |
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 version 2.1 of the License, or (at your option) any later version. |
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
|
9 |
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
|
10 This library is distributed in the hope that it will be useful, |
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
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
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 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
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
|
13 Lesser General Public License for more details. |
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
|
14 |
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
|
15 You should have received a copy of the GNU Lesser General Public |
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
|
16 License along with this library; if not, write to the Free Software |
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
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
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
|
18 |
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
|
19 Sam Lantinga |
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 slouken@libsdl.org |
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 */ |
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 #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
|
23 |
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 #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
|
25 |
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
|
26 /* DirectInput joystick driver; written by Glenn Maynard, based on Andrei de |
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 * A. Formiga's WINMM driver. |
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 * |
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
|
29 * Hats and sliders are completely untested; the app I'm writing this for mostly |
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 * doesn't use them and I don't own any joysticks with them. |
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 * |
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
|
32 * We don't bother to use event notification here. It doesn't seem to work |
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 * with polled devices, and it's fine to call IDirectInputDevice2_GetDeviceData and |
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 * 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
|
35 |
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
|
36 #include "SDL_error.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
|
37 #include "SDL_events.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
|
38 #include "SDL_joystick.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
|
39 #include "../SDL_sysjoystick.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
|
40 #include "../SDL_joystick_c.h" |
3013
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
41 #define INITGUID /* Only set here, if set twice will cause mingw32 to break. */ |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2198
diff
changeset
|
42 #include "SDL_dxjoystick_c.h" |
2198
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
43 |
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
|
44 |
2761
0c544c2eff77
Almost got this compiling on Cygwin32, just needs DirectInput 7
Sam Lantinga <slouken@libsdl.org>
parents:
2760
diff
changeset
|
45 #ifndef DIDFT_OPTIONAL |
0c544c2eff77
Almost got this compiling on Cygwin32, just needs DirectInput 7
Sam Lantinga <slouken@libsdl.org>
parents:
2760
diff
changeset
|
46 #define DIDFT_OPTIONAL 0x80000000 |
0c544c2eff77
Almost got this compiling on Cygwin32, just needs DirectInput 7
Sam Lantinga <slouken@libsdl.org>
parents:
2760
diff
changeset
|
47 #endif |
0c544c2eff77
Almost got this compiling on Cygwin32, just needs DirectInput 7
Sam Lantinga <slouken@libsdl.org>
parents:
2760
diff
changeset
|
48 |
0c544c2eff77
Almost got this compiling on Cygwin32, just needs DirectInput 7
Sam Lantinga <slouken@libsdl.org>
parents:
2760
diff
changeset
|
49 |
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
|
50 #define INPUT_QSIZE 32 /* Buffer up to 32 input messages */ |
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
|
51 #define MAX_JOYSTICKS 8 |
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
|
52 #define AXIS_MIN -32768 /* minimum value for axis coordinate */ |
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
|
53 #define AXIS_MAX 32767 /* maximum value for axis coordinate */ |
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
|
54 #define JOY_AXIS_THRESHOLD (((AXIS_MAX)-(AXIS_MIN))/100) /* 1% motion */ |
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
|
55 |
2198
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
56 /* external variables referenced. */ |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2198
diff
changeset
|
57 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
|
58 |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
59 |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
60 /* local variables */ |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
61 static LPDIRECTINPUT dinput = NULL; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
62 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
|
63 LPDIRECTINPUT * ppDI, |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
64 LPUNKNOWN punkOuter); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
65 static DIDEVICEINSTANCE SYS_Joystick[MAX_JOYSTICKS]; /* array to hold joystick ID values */ |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
66 static int SYS_NumJoysticks; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
67 static HINSTANCE DInputDLL = NULL; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
68 |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
69 |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
70 /* local prototypes */ |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
71 static void SetDIerror(const char *function, HRESULT code); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
72 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
|
73 pdidInstance, VOID * pContext); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
74 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
|
75 LPVOID pvRef); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
76 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
|
77 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
|
78 Sint16 value); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
79 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
|
80 Uint8 value); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
81 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
|
82 Uint8 button, Uint8 state); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
83 |
2760
02aa80d7905f
Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents:
2717
diff
changeset
|
84 /* Taken from Wine - Thanks! */ |
02aa80d7905f
Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents:
2717
diff
changeset
|
85 DIOBJECTDATAFORMAT dfDIJoystick2[] = { |
3013
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
86 { &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
|
87 { &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
|
88 { &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
|
89 { &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
|
90 { &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
|
91 { &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
|
92 { &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
|
93 { &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
|
94 { &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
|
95 { &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
|
96 { &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
|
97 { &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
|
98 { 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
|
99 { 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
|
100 { 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
|
101 { 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
|
102 { 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
|
103 { 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
|
104 { 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
|
105 { 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
|
106 { 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
|
107 { 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
|
108 { 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
|
109 { 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
|
110 { 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
|
111 { 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
|
112 { 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
|
113 { 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
|
114 { 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
|
115 { 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
|
116 { 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
|
117 { 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
|
118 { 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
|
119 { 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
|
120 { 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
|
121 { 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
|
122 { 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
|
123 { 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
|
124 { 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
|
125 { 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
|
126 { 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
|
127 { 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
|
128 { 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
|
129 { 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
|
130 { 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
|
131 { 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
|
132 { 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
|
133 { 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
|
134 { 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
|
135 { 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
|
136 { 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
|
137 { 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
|
138 { 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
|
139 { 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
|
140 { 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
|
141 { 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
|
142 { 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
|
143 { 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
|
144 { 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
|
145 { 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
|
146 { 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
|
147 { 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
|
148 { 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
|
149 { 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
|
150 { 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
|
151 { 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
|
152 { 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
|
153 { 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
|
154 { 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
|
155 { 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
|
156 { 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
|
157 { 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
|
158 { 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
|
159 { 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
|
160 { 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
|
161 { 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
|
162 { 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
|
163 { 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
|
164 { 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
|
165 { 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
|
166 { 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
|
167 { 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
|
168 { 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
|
169 { 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
|
170 { 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
|
171 { 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
|
172 { 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
|
173 { 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
|
174 { 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
|
175 { 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
|
176 { 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
|
177 { 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
|
178 { 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
|
179 { 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
|
180 { 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
|
181 { 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
|
182 { 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
|
183 { 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
|
184 { 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
|
185 { 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
|
186 { 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
|
187 { 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
|
188 { 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
|
189 { 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
|
190 { 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
|
191 { 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
|
192 { 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
|
193 { 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
|
194 { 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
|
195 { 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
|
196 { 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
|
197 { 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
|
198 { 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
|
199 { 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
|
200 { 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
|
201 { 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
|
202 { 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
|
203 { 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
|
204 { 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
|
205 { 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
|
206 { 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
|
207 { 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
|
208 { 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
|
209 { 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
|
210 { 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
|
211 { 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
|
212 { 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
|
213 { 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
|
214 { 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
|
215 { 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
|
216 { 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
|
217 { 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
|
218 { 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
|
219 { 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
|
220 { 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
|
221 { 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
|
222 { 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
|
223 { 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
|
224 { 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
|
225 { 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
|
226 { &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
|
227 { &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
|
228 { &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
|
229 { &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
|
230 { &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
|
231 { &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
|
232 { &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
|
233 { &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
|
234 { &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
|
235 { &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
|
236 { &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
|
237 { &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
|
238 { &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
|
239 { &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
|
240 { &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
|
241 { &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
|
242 { &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
|
243 { &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
|
244 { &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
|
245 { &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
|
246 { &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
|
247 { &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
|
248 { &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
|
249 { &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
|
250 }; |
02aa80d7905f
Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents:
2717
diff
changeset
|
251 |
02aa80d7905f
Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents:
2717
diff
changeset
|
252 const DIDATAFORMAT c_dfDIJoystick2 = { |
02aa80d7905f
Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents:
2717
diff
changeset
|
253 sizeof(DIDATAFORMAT), |
02aa80d7905f
Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents:
2717
diff
changeset
|
254 sizeof(DIOBJECTDATAFORMAT), |
02aa80d7905f
Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents:
2717
diff
changeset
|
255 DIDF_ABSAXIS, |
02aa80d7905f
Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents:
2717
diff
changeset
|
256 sizeof(DIJOYSTATE2), |
02aa80d7905f
Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents:
2717
diff
changeset
|
257 SDL_arraysize(dfDIJoystick2), |
02aa80d7905f
Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents:
2717
diff
changeset
|
258 dfDIJoystick2 |
02aa80d7905f
Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents:
2717
diff
changeset
|
259 }; |
02aa80d7905f
Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents:
2717
diff
changeset
|
260 |
2198
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
261 |
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
|
262 /* Convert a DirectInput return code to a text message */ |
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
|
263 static void |
2198
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
264 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
|
265 { |
2760
02aa80d7905f
Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents:
2717
diff
changeset
|
266 /* |
3013
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
267 SDL_SetError("%s() [%s]: %s", function, |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
268 DXGetErrorString9A(code), DXGetErrorDescription9A(code)); |
2760
02aa80d7905f
Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents:
2717
diff
changeset
|
269 */ |
02aa80d7905f
Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents:
2717
diff
changeset
|
270 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
|
271 } |
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
|
272 |
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
|
273 |
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
|
274 /* 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
|
275 * 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
|
276 * 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
|
277 * 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
|
278 */ |
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
|
279 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
|
280 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
|
281 { |
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
|
282 HRESULT result; |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2198
diff
changeset
|
283 HINSTANCE instance; |
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
|
284 |
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
|
285 SYS_NumJoysticks = 0; |
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
|
286 |
2198
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
287 result = CoInitialize(NULL); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
288 if (FAILED(result)) { |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
289 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
|
290 return (-1); |
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
|
291 } |
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
|
292 |
2198
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
293 result = CoCreateInstance(&CLSID_DirectInput, NULL, CLSCTX_INPROC_SERVER, |
3013
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
294 &IID_IDirectInput, (LPVOID)&dinput); |
2198
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
295 |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
296 if (FAILED(result)) { |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
297 SetDIerror("CoCreateInstance", result); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
298 return (-1); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
299 } |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
300 |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
301 /* 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
|
302 instance = GetModuleHandle(NULL); |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2198
diff
changeset
|
303 if (instance == NULL) { |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2198
diff
changeset
|
304 SDL_SetError("GetModuleHandle() failed with error code %d.", |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2198
diff
changeset
|
305 GetLastError()); |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2198
diff
changeset
|
306 return (-1); |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2198
diff
changeset
|
307 } |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2198
diff
changeset
|
308 result = IDirectInput_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
|
309 |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
310 if (FAILED(result)) { |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
311 SetDIerror("IDirectInput::Initialize", result); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
312 return (-1); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
313 } |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
314 |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
315 /* Look for joysticks, wheels, head trackers, gamepads, etc.. */ |
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
|
316 result = IDirectInput_EnumDevices(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
|
317 DIDEVTYPE_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
|
318 EnumJoysticksCallback, |
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
|
319 NULL, DIEDFL_ATTACHEDONLY); |
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
|
320 |
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
|
321 return SYS_NumJoysticks; |
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
|
322 } |
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
|
323 |
2198
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
324 static BOOL CALLBACK |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
325 EnumJoysticksCallback(const DIDEVICEINSTANCE * pdidInstance, VOID * pContext) |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
326 { |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2198
diff
changeset
|
327 SDL_memcpy(&SYS_Joystick[SYS_NumJoysticks], pdidInstance, |
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2198
diff
changeset
|
328 sizeof(DIDEVICEINSTANCE)); |
2198
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
329 SYS_NumJoysticks++; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
330 |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
331 if (SYS_NumJoysticks >= MAX_JOYSTICKS) |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
332 return DIENUM_STOP; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
333 |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
334 return DIENUM_CONTINUE; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
335 } |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
336 |
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
|
337 /* 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
|
338 const char * |
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
|
339 SDL_SYS_JoystickName(int index) |
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
|
340 { |
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
|
341 /***-> test for invalid index ? */ |
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
|
342 return (SYS_Joystick[index].tszProductName); |
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
|
343 } |
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
|
344 |
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
|
345 /* 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
|
346 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
|
347 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
|
348 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
|
349 */ |
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
|
350 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
|
351 SDL_SYS_JoystickOpen(SDL_Joystick * 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
|
352 { |
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
|
353 HRESULT result; |
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
|
354 LPDIRECTINPUTDEVICE device; |
2198
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
355 DIPROPDWORD dipdw; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
356 |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2198
diff
changeset
|
357 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
|
358 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
|
359 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
|
360 |
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
|
361 |
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
|
362 /* allocate memory for system specific hardware data */ |
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
|
363 joystick->hwdata = |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2198
diff
changeset
|
364 (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
|
365 if (joystick->hwdata == NULL) { |
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
|
366 SDL_OutOfMemory(); |
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
|
367 return (-1); |
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
|
368 } |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2198
diff
changeset
|
369 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
|
370 joystick->hwdata->buffered = 1; |
2198
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
371 joystick->hwdata->Capabilities.dwSize = sizeof(DIDEVCAPS); |
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
|
372 |
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
|
373 result = |
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
|
374 IDirectInput_CreateDevice(dinput, |
3013
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
375 &SYS_Joystick[joystick->index]. |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
376 guidInstance, &device, NULL); |
2198
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
377 if (FAILED(result)) { |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
378 SetDIerror("IDirectInput::CreateDevice", 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
|
379 return (-1); |
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
|
380 } |
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
|
381 |
2198
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
382 /* Now get the IDirectInputDevice2 interface, instead. */ |
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
|
383 result = IDirectInputDevice_QueryInterface(device, |
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
|
384 &IID_IDirectInputDevice2, |
3013
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
385 (LPVOID *) & joystick-> |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
386 hwdata->InputDevice); |
2198
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
387 /* We are done with this object. Use the stored one from now on. */ |
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 IDirectInputDevice_Release(device); |
2198
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
389 |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
390 if (FAILED(result)) { |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
391 SetDIerror("IDirectInputDevice::QueryInterface", 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
|
392 return (-1); |
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
|
393 } |
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
|
394 |
2198
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
395 /* Aquire shared access. Exclusive access is required for forces, |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
396 * though. */ |
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
|
397 result = |
3013
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
398 IDirectInputDevice2_SetCooperativeLevel(joystick->hwdata-> |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
399 InputDevice, SDL_HelperWindow, |
2198
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
400 DISCL_EXCLUSIVE | |
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
|
401 DISCL_BACKGROUND); |
2198
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
402 if (FAILED(result)) { |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
403 SetDIerror("IDirectInputDevice2::SetCooperativeLevel", 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
|
404 return (-1); |
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
|
405 } |
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
|
406 |
2198
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
407 /* Use the extended data structure: DIJOYSTATE2. */ |
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
|
408 result = |
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
|
409 IDirectInputDevice2_SetDataFormat(joystick->hwdata->InputDevice, |
2198
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
410 &c_dfDIJoystick2); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
411 if (FAILED(result)) { |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
412 SetDIerror("IDirectInputDevice2::SetDataFormat", result); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
413 return (-1); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
414 } |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
415 |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
416 /* Get device capabilities */ |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
417 result = |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
418 IDirectInputDevice2_GetCapabilities(joystick->hwdata->InputDevice, |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
419 &joystick->hwdata->Capabilities); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
420 |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
421 if (FAILED(result)) { |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
422 SetDIerror("IDirectInputDevice2::GetCapabilities", 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
|
423 return (-1); |
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
|
424 } |
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
|
425 |
2198
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
426 /* Force capable? */ |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
427 if (joystick->hwdata->Capabilities.dwFlags & DIDC_FORCEFEEDBACK) { |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
428 |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
429 result = IDirectInputDevice2_Acquire(joystick->hwdata->InputDevice); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
430 |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
431 if (FAILED(result)) { |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
432 SetDIerror("IDirectInputDevice2::Acquire", result); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
433 return (-1); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
434 } |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
435 |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
436 /* reset all accuators. */ |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
437 result = |
3013
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
438 IDirectInputDevice2_SendForceFeedbackCommand(joystick->hwdata-> |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
439 InputDevice, |
2198
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
440 DISFFC_RESET); |
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
|
441 |
2198
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
442 if (FAILED(result)) { |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
443 SetDIerror("IDirectInputDevice2::SendForceFeedbackCommand", |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
444 result); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
445 return (-1); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
446 } |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
447 |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
448 result = IDirectInputDevice2_Unacquire(joystick->hwdata->InputDevice); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
449 |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
450 if (FAILED(result)) { |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
451 SetDIerror("IDirectInputDevice2::Unacquire", result); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
452 return (-1); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
453 } |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
454 |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
455 /* Turn on auto-centering for a ForceFeedback device (until told |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
456 * otherwise). */ |
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
|
457 dipdw.diph.dwObj = 0; |
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
|
458 dipdw.diph.dwHow = DIPH_DEVICE; |
2198
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
459 dipdw.dwData = DIPROPAUTOCENTER_ON; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
460 |
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
|
461 result = |
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
|
462 IDirectInputDevice2_SetProperty(joystick->hwdata->InputDevice, |
2198
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
463 DIPROP_AUTOCENTER, &dipdw.diph); |
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
|
464 |
2198
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
465 if (FAILED(result)) { |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
466 SetDIerror("IDirectInputDevice2::SetProperty", 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
|
467 return (-1); |
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
|
468 } |
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
|
469 } |
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
|
470 |
2198
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
471 /* What buttons and axes does it have? */ |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
472 IDirectInputDevice2_EnumObjects(joystick->hwdata->InputDevice, |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
473 EnumDevObjectsCallback, joystick, |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
474 DIDFT_BUTTON | DIDFT_AXIS | DIDFT_POV); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
475 |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
476 dipdw.diph.dwObj = 0; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
477 dipdw.diph.dwHow = DIPH_DEVICE; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
478 dipdw.dwData = INPUT_QSIZE; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
479 |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
480 /* Set the buffer size */ |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
481 result = |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
482 IDirectInputDevice2_SetProperty(joystick->hwdata->InputDevice, |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
483 DIPROP_BUFFERSIZE, &dipdw.diph); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
484 |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
485 if (result == DI_POLLEDDEVICE) { |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
486 /* This device doesn't support buffering, so we're forced |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
487 * to use less reliable polling. */ |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
488 joystick->hwdata->buffered = 0; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
489 } else if (FAILED(result)) { |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
490 SetDIerror("IDirectInputDevice2::SetProperty", result); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
491 return (-1); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
492 } |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
493 |
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
|
494 return (0); |
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
|
495 } |
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
|
496 |
2198
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
497 static BOOL CALLBACK |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
498 EnumDevObjectsCallback(LPCDIDEVICEOBJECTINSTANCE dev, LPVOID pvRef) |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
499 { |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
500 SDL_Joystick *joystick = (SDL_Joystick *) pvRef; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
501 HRESULT result; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
502 input_t *in = &joystick->hwdata->Inputs[joystick->hwdata->NumInputs]; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
503 |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
504 in->ofs = dev->dwOfs; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
505 |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
506 if (dev->dwType & DIDFT_BUTTON) { |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
507 in->type = BUTTON; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
508 in->num = joystick->nbuttons; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
509 joystick->nbuttons++; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
510 } else if (dev->dwType & DIDFT_POV) { |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
511 in->type = HAT; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
512 in->num = joystick->nhats; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
513 joystick->nhats++; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
514 } else if (dev->dwType & DIDFT_AXIS) { |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
515 DIPROPRANGE diprg; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
516 DIPROPDWORD dilong; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
517 |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
518 in->type = AXIS; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
519 in->num = joystick->naxes; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
520 |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
521 diprg.diph.dwSize = sizeof(diprg); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
522 diprg.diph.dwHeaderSize = sizeof(diprg.diph); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
523 diprg.diph.dwObj = dev->dwOfs; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
524 diprg.diph.dwHow = DIPH_BYOFFSET; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
525 diprg.lMin = AXIS_MIN; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
526 diprg.lMax = AXIS_MAX; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
527 |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
528 result = |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
529 IDirectInputDevice2_SetProperty(joystick->hwdata->InputDevice, |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
530 DIPROP_RANGE, &diprg.diph); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
531 if (FAILED(result)) { |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
532 return DIENUM_CONTINUE; /* don't use this axis */ |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
533 } |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
534 |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
535 /* Set dead zone to 0. */ |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
536 dilong.diph.dwSize = sizeof(dilong); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
537 dilong.diph.dwHeaderSize = sizeof(dilong.diph); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
538 dilong.diph.dwObj = dev->dwOfs; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
539 dilong.diph.dwHow = DIPH_BYOFFSET; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
540 dilong.dwData = 0; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
541 result = |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
542 IDirectInputDevice2_SetProperty(joystick->hwdata->InputDevice, |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
543 DIPROP_DEADZONE, &dilong.diph); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
544 if (FAILED(result)) { |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
545 return DIENUM_CONTINUE; /* don't use this axis */ |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
546 } |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
547 |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
548 joystick->naxes++; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
549 } else { |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
550 /* not supported at this time */ |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
551 return DIENUM_CONTINUE; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
552 } |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
553 |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
554 joystick->hwdata->NumInputs++; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
555 |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
556 if (joystick->hwdata->NumInputs == MAX_INPUTS) { |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
557 return DIENUM_STOP; /* too many */ |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
558 } |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
559 |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
560 return DIENUM_CONTINUE; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
561 } |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
562 |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
563 /* Function to update the state of a joystick - called as a device poll. |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
564 * This function shouldn't update the joystick structure directly, |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
565 * but instead should call SDL_PrivateJoystick*() to deliver events |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
566 * and update joystick device state. |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
567 */ |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
568 void |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
569 SDL_SYS_JoystickUpdate_Polled(SDL_Joystick * joystick) |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
570 { |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
571 DIJOYSTATE2 state; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
572 HRESULT result; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
573 int i; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
574 |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
575 result = |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
576 IDirectInputDevice2_GetDeviceState(joystick->hwdata->InputDevice, |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
577 sizeof(DIJOYSTATE2), &state); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
578 if (result == DIERR_INPUTLOST || result == DIERR_NOTACQUIRED) { |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
579 IDirectInputDevice2_Acquire(joystick->hwdata->InputDevice); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
580 result = |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
581 IDirectInputDevice2_GetDeviceState(joystick->hwdata->InputDevice, |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
582 sizeof(DIJOYSTATE2), &state); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
583 } |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
584 |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
585 /* Set each known axis, button and POV. */ |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
586 for (i = 0; i < joystick->hwdata->NumInputs; ++i) { |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
587 const input_t *in = &joystick->hwdata->Inputs[i]; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
588 |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
589 switch (in->type) { |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
590 case AXIS: |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
591 switch (in->ofs) { |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
592 case DIJOFS_X: |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
593 SDL_PrivateJoystickAxis_Int(joystick, in->num, |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
594 (Sint16) state.lX); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
595 break; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
596 case DIJOFS_Y: |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
597 SDL_PrivateJoystickAxis_Int(joystick, in->num, |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
598 (Sint16) state.lY); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
599 break; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
600 case DIJOFS_Z: |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
601 SDL_PrivateJoystickAxis_Int(joystick, in->num, |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
602 (Sint16) state.lZ); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
603 break; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
604 case DIJOFS_RX: |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
605 SDL_PrivateJoystickAxis_Int(joystick, in->num, |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
606 (Sint16) state.lRx); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
607 break; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
608 case DIJOFS_RY: |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
609 SDL_PrivateJoystickAxis_Int(joystick, in->num, |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
610 (Sint16) state.lRy); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
611 break; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
612 case DIJOFS_RZ: |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
613 SDL_PrivateJoystickAxis_Int(joystick, in->num, |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
614 (Sint16) state.lRz); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
615 break; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
616 case DIJOFS_SLIDER(0): |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
617 SDL_PrivateJoystickAxis_Int(joystick, in->num, |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
618 (Sint16) state.rglSlider[0]); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
619 break; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
620 case DIJOFS_SLIDER(1): |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
621 SDL_PrivateJoystickAxis_Int(joystick, in->num, |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
622 (Sint16) state.rglSlider[1]); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
623 break; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
624 } |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
625 |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
626 break; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
627 |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
628 case BUTTON: |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
629 SDL_PrivateJoystickButton_Int(joystick, in->num, |
3013
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
630 (Uint8) (state. |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
631 rgbButtons[in->ofs - |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
632 DIJOFS_BUTTON0] |
2198
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
633 ? SDL_PRESSED : |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
634 SDL_RELEASED)); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
635 break; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
636 case HAT: |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
637 { |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
638 Uint8 pos = TranslatePOV(state.rgdwPOV[in->ofs - |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
639 DIJOFS_POV(0)]); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
640 SDL_PrivateJoystickHat_Int(joystick, in->num, pos); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
641 break; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
642 } |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
643 } |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
644 } |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
645 } |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
646 |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
647 void |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
648 SDL_SYS_JoystickUpdate_Buffered(SDL_Joystick * joystick) |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
649 { |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
650 int i; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
651 HRESULT result; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
652 DWORD numevents; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
653 DIDEVICEOBJECTDATA evtbuf[INPUT_QSIZE]; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
654 |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
655 numevents = INPUT_QSIZE; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
656 result = |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
657 IDirectInputDevice2_GetDeviceData(joystick->hwdata->InputDevice, |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
658 sizeof(DIDEVICEOBJECTDATA), evtbuf, |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
659 &numevents, 0); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
660 if (result == DIERR_INPUTLOST || result == DIERR_NOTACQUIRED) { |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
661 IDirectInputDevice2_Acquire(joystick->hwdata->InputDevice); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
662 result = |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
663 IDirectInputDevice2_GetDeviceData(joystick->hwdata->InputDevice, |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
664 sizeof(DIDEVICEOBJECTDATA), |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
665 evtbuf, &numevents, 0); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
666 } |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
667 |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
668 /* Handle the events or punt */ |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
669 if (FAILED(result)) |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
670 return; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
671 |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
672 for (i = 0; i < (int) numevents; ++i) { |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
673 int j; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
674 |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
675 for (j = 0; j < joystick->hwdata->NumInputs; ++j) { |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
676 const input_t *in = &joystick->hwdata->Inputs[j]; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
677 |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
678 if (evtbuf[i].dwOfs != in->ofs) |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
679 continue; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
680 |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
681 switch (in->type) { |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
682 case AXIS: |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
683 SDL_PrivateJoystickAxis(joystick, in->num, |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
684 (Sint16) evtbuf[i].dwData); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
685 break; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
686 case BUTTON: |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
687 SDL_PrivateJoystickButton(joystick, in->num, |
3013
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
688 (Uint8) (evtbuf[i]. |
8cc00819c8d6
Reverted Bob's indent checkin
Sam Lantinga <slouken@libsdl.org>
parents:
3011
diff
changeset
|
689 dwData ? SDL_PRESSED : |
2198
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
690 SDL_RELEASED)); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
691 break; |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
692 case HAT: |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
693 { |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
694 Uint8 pos = TranslatePOV(evtbuf[i].dwData); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
695 SDL_PrivateJoystickHat(joystick, in->num, pos); |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
696 } |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
697 } |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
698 } |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
699 } |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
700 } |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
701 |
fe19afb86473
Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents:
1895
diff
changeset
|
702 |
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
|
703 static Uint8 |
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
|
704 TranslatePOV(DWORD value) |
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
|
705 { |
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
|
706 const int HAT_VALS[] = { |
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
|
707 SDL_HAT_UP, |
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
|
708 SDL_HAT_UP | SDL_HAT_RIGHT, |
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
|
709 SDL_HAT_RIGHT, |
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
|
710 SDL_HAT_DOWN | SDL_HAT_RIGHT, |
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
|
711 SDL_HAT_DOWN, |
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
|
712 SDL_HAT_DOWN | SDL_HAT_LEFT, |
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
|
713 SDL_HAT_LEFT, |
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
|
714 SDL_HAT_UP | SDL_HAT_LEFT |
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
|
715 }; |
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
|
716 |
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
|
717 if (LOWORD(value) == 0xFFFF) |
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
|
718 return SDL_HAT_CENTERED; |
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
|
719 |
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
|
720 /* Round the value up: */ |
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
|
721 value += 4500 / 2; |
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
|
722 value %= 36000; |
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
|
723 value /= 4500; |
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
|
724 |
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
|
725 if (value >= 8) |
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 return SDL_HAT_CENTERED; /* shouldn't happen */ |
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
|
727 |
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
|
728 return HAT_VALS[value]; |
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
|
729 } |
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
|
730 |
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
|
731 /* SDL_PrivateJoystick* doesn't discard duplicate events, so we need to |
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
|
732 * do it. */ |
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
|
733 static 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
|
734 SDL_PrivateJoystickAxis_Int(SDL_Joystick * joystick, Uint8 axis, Sint16 value) |
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
|
735 { |
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
|
736 if (joystick->axes[axis] != value) |
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
|
737 return SDL_PrivateJoystickAxis(joystick, axis, value); |
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
|
738 return 0; |
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
|
739 } |
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
|
740 |
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
|
741 static 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
|
742 SDL_PrivateJoystickHat_Int(SDL_Joystick * joystick, Uint8 hat, Uint8 value) |
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
|
743 { |
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
|
744 if (joystick->hats[hat] != value) |
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
|
745 return SDL_PrivateJoystickHat(joystick, hat, value); |
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
|
746 return 0; |
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
|
747 } |
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
|
748 |
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
|
749 static 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
|
750 SDL_PrivateJoystickButton_Int(SDL_Joystick * joystick, Uint8 button, |
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
|
751 Uint8 state) |
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
|
752 { |
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
|
753 if (joystick->buttons[button] != state) |
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
|
754 return SDL_PrivateJoystickButton(joystick, button, state); |
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
|
755 return 0; |
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
|
756 } |
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
|
757 |
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
|
758 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
|
759 SDL_SYS_JoystickUpdate(SDL_Joystick * 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
|
760 { |
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
|
761 HRESULT result; |
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
|
762 |
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
|
763 result = IDirectInputDevice2_Poll(joystick->hwdata->InputDevice); |
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
|
764 if (result == DIERR_INPUTLOST || result == DIERR_NOTACQUIRED) { |
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
|
765 IDirectInputDevice2_Acquire(joystick->hwdata->InputDevice); |
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
|
766 IDirectInputDevice2_Poll(joystick->hwdata->InputDevice); |
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
|
767 } |
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
|
768 |
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
|
769 if (joystick->hwdata->buffered) |
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
|
770 SDL_SYS_JoystickUpdate_Buffered(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
|
771 else |
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
|
772 SDL_SYS_JoystickUpdate_Polled(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
|
773 } |
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
|
774 |
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
|
775 /* Function to close a joystick after 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
|
776 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
|
777 SDL_SYS_JoystickClose(SDL_Joystick * 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
|
778 { |
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
|
779 IDirectInputDevice2_Unacquire(joystick->hwdata->InputDevice); |
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
|
780 IDirectInputDevice2_Release(joystick->hwdata->InputDevice); |
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
|
781 |
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
|
782 if (joystick->hwdata != NULL) { |
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
|
783 /* free system specific hardware data */ |
2713
0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents:
2198
diff
changeset
|
784 SDL_free(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
|
785 } |
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
|
786 } |
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
|
787 |
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
|
788 /* Function to perform any system-specific joystick related cleanup */ |
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
|
789 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
|
790 SDL_SYS_JoystickQuit(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
|
791 { |
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
|
792 IDirectInput_Release(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
|
793 dinput = NULL; |
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
|
794 } |
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
|
795 |
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
|
796 #endif /* 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
|
797 /* vi: set ts=4 sw=4 expandtab: */ |