annotate src/joystick/win32/SDL_dxjoystick.c @ 2760:02aa80d7905f

Updated Visual C++ build
author Sam Lantinga <slouken@libsdl.org>
date Mon, 15 Sep 2008 07:34:36 +0000
parents 50bc882455e5
children 0c544c2eff77
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
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
3 Copyright (C) 1997-2006 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
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"
2713
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents: 2198
diff changeset
41 #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
42
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
43
c121d94672cb 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 #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
45 #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
46 #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
47 #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
48 #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
49
2198
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
50 /* external variables referenced. */
2713
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents: 2198
diff changeset
51 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
52
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
53
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
54 /* local variables */
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
55 static LPDIRECTINPUT dinput = NULL;
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
56 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
57 LPDIRECTINPUT * ppDI,
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
58 LPUNKNOWN punkOuter);
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
59 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
60 static int SYS_NumJoysticks;
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
61 static HINSTANCE DInputDLL = NULL;
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
62
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
63
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
64 /* local prototypes */
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
65 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
66 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
67 pdidInstance, VOID * pContext);
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
68 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
69 LPVOID pvRef);
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
70 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
71 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
72 Sint16 value);
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
73 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
74 Uint8 value);
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
75 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
76 Uint8 button, Uint8 state);
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
77
2760
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
78 /* Taken from Wine - Thanks! */
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
79 DIOBJECTDATAFORMAT dfDIJoystick2[] = {
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
80 { &GUID_XAxis,DIJOFS_X,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
81 { &GUID_YAxis,DIJOFS_Y,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
82 { &GUID_ZAxis,DIJOFS_Z,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
83 { &GUID_RxAxis,DIJOFS_RX,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
84 { &GUID_RyAxis,DIJOFS_RY,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
85 { &GUID_RzAxis,DIJOFS_RZ,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
86 { &GUID_Slider,DIJOFS_SLIDER(0),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
87 { &GUID_Slider,DIJOFS_SLIDER(1),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
88 { &GUID_POV,DIJOFS_POV(0),DIDFT_OPTIONAL|DIDFT_POV|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
89 { &GUID_POV,DIJOFS_POV(1),DIDFT_OPTIONAL|DIDFT_POV|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
90 { &GUID_POV,DIJOFS_POV(2),DIDFT_OPTIONAL|DIDFT_POV|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
91 { &GUID_POV,DIJOFS_POV(3),DIDFT_OPTIONAL|DIDFT_POV|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
92 { NULL,DIJOFS_BUTTON(0),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
93 { NULL,DIJOFS_BUTTON(1),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
94 { NULL,DIJOFS_BUTTON(2),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
95 { NULL,DIJOFS_BUTTON(3),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
96 { NULL,DIJOFS_BUTTON(4),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
97 { NULL,DIJOFS_BUTTON(5),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
98 { NULL,DIJOFS_BUTTON(6),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
99 { NULL,DIJOFS_BUTTON(7),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
100 { NULL,DIJOFS_BUTTON(8),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
101 { NULL,DIJOFS_BUTTON(9),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
102 { NULL,DIJOFS_BUTTON(10),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
103 { NULL,DIJOFS_BUTTON(11),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
104 { NULL,DIJOFS_BUTTON(12),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
105 { NULL,DIJOFS_BUTTON(13),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
106 { NULL,DIJOFS_BUTTON(14),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
107 { NULL,DIJOFS_BUTTON(15),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
108 { NULL,DIJOFS_BUTTON(16),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
109 { NULL,DIJOFS_BUTTON(17),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
110 { NULL,DIJOFS_BUTTON(18),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
111 { NULL,DIJOFS_BUTTON(19),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
112 { NULL,DIJOFS_BUTTON(20),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
113 { NULL,DIJOFS_BUTTON(21),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
114 { NULL,DIJOFS_BUTTON(22),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
115 { NULL,DIJOFS_BUTTON(23),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
116 { NULL,DIJOFS_BUTTON(24),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
117 { NULL,DIJOFS_BUTTON(25),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
118 { NULL,DIJOFS_BUTTON(26),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
119 { NULL,DIJOFS_BUTTON(27),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
120 { NULL,DIJOFS_BUTTON(28),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
121 { NULL,DIJOFS_BUTTON(29),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
122 { NULL,DIJOFS_BUTTON(30),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
123 { NULL,DIJOFS_BUTTON(31),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
124 { NULL,DIJOFS_BUTTON(32),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
125 { NULL,DIJOFS_BUTTON(33),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
126 { NULL,DIJOFS_BUTTON(34),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
127 { NULL,DIJOFS_BUTTON(35),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
128 { NULL,DIJOFS_BUTTON(36),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
129 { NULL,DIJOFS_BUTTON(37),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
130 { NULL,DIJOFS_BUTTON(38),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
131 { NULL,DIJOFS_BUTTON(39),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
132 { NULL,DIJOFS_BUTTON(40),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
133 { NULL,DIJOFS_BUTTON(41),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
134 { NULL,DIJOFS_BUTTON(42),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
135 { NULL,DIJOFS_BUTTON(43),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
136 { NULL,DIJOFS_BUTTON(44),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
137 { NULL,DIJOFS_BUTTON(45),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
138 { NULL,DIJOFS_BUTTON(46),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
139 { NULL,DIJOFS_BUTTON(47),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
140 { NULL,DIJOFS_BUTTON(48),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
141 { NULL,DIJOFS_BUTTON(49),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
142 { NULL,DIJOFS_BUTTON(50),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
143 { NULL,DIJOFS_BUTTON(51),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
144 { NULL,DIJOFS_BUTTON(52),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
145 { NULL,DIJOFS_BUTTON(53),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
146 { NULL,DIJOFS_BUTTON(54),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
147 { NULL,DIJOFS_BUTTON(55),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
148 { NULL,DIJOFS_BUTTON(56),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
149 { NULL,DIJOFS_BUTTON(57),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
150 { NULL,DIJOFS_BUTTON(58),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
151 { NULL,DIJOFS_BUTTON(59),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
152 { NULL,DIJOFS_BUTTON(60),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
153 { NULL,DIJOFS_BUTTON(61),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
154 { NULL,DIJOFS_BUTTON(62),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
155 { NULL,DIJOFS_BUTTON(63),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
156 { NULL,DIJOFS_BUTTON(64),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
157 { NULL,DIJOFS_BUTTON(65),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
158 { NULL,DIJOFS_BUTTON(66),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
159 { NULL,DIJOFS_BUTTON(67),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
160 { NULL,DIJOFS_BUTTON(68),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
161 { NULL,DIJOFS_BUTTON(69),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
162 { NULL,DIJOFS_BUTTON(70),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
163 { NULL,DIJOFS_BUTTON(71),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
164 { NULL,DIJOFS_BUTTON(72),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
165 { NULL,DIJOFS_BUTTON(73),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
166 { NULL,DIJOFS_BUTTON(74),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
167 { NULL,DIJOFS_BUTTON(75),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
168 { NULL,DIJOFS_BUTTON(76),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
169 { NULL,DIJOFS_BUTTON(77),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
170 { NULL,DIJOFS_BUTTON(78),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
171 { NULL,DIJOFS_BUTTON(79),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
172 { NULL,DIJOFS_BUTTON(80),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
173 { NULL,DIJOFS_BUTTON(81),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
174 { NULL,DIJOFS_BUTTON(82),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
175 { NULL,DIJOFS_BUTTON(83),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
176 { NULL,DIJOFS_BUTTON(84),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
177 { NULL,DIJOFS_BUTTON(85),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
178 { NULL,DIJOFS_BUTTON(86),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
179 { NULL,DIJOFS_BUTTON(87),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
180 { NULL,DIJOFS_BUTTON(88),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
181 { NULL,DIJOFS_BUTTON(89),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
182 { NULL,DIJOFS_BUTTON(90),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
183 { NULL,DIJOFS_BUTTON(91),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
184 { NULL,DIJOFS_BUTTON(92),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
185 { NULL,DIJOFS_BUTTON(93),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
186 { NULL,DIJOFS_BUTTON(94),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
187 { NULL,DIJOFS_BUTTON(95),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
188 { NULL,DIJOFS_BUTTON(96),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
189 { NULL,DIJOFS_BUTTON(97),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
190 { NULL,DIJOFS_BUTTON(98),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
191 { NULL,DIJOFS_BUTTON(99),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
192 { NULL,DIJOFS_BUTTON(100),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
193 { NULL,DIJOFS_BUTTON(101),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
194 { NULL,DIJOFS_BUTTON(102),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
195 { NULL,DIJOFS_BUTTON(103),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
196 { NULL,DIJOFS_BUTTON(104),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
197 { NULL,DIJOFS_BUTTON(105),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
198 { NULL,DIJOFS_BUTTON(106),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
199 { NULL,DIJOFS_BUTTON(107),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
200 { NULL,DIJOFS_BUTTON(108),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
201 { NULL,DIJOFS_BUTTON(109),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
202 { NULL,DIJOFS_BUTTON(110),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
203 { NULL,DIJOFS_BUTTON(111),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
204 { NULL,DIJOFS_BUTTON(112),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
205 { NULL,DIJOFS_BUTTON(113),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
206 { NULL,DIJOFS_BUTTON(114),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
207 { NULL,DIJOFS_BUTTON(115),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
208 { NULL,DIJOFS_BUTTON(116),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
209 { NULL,DIJOFS_BUTTON(117),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
210 { NULL,DIJOFS_BUTTON(118),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
211 { NULL,DIJOFS_BUTTON(119),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
212 { NULL,DIJOFS_BUTTON(120),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
213 { NULL,DIJOFS_BUTTON(121),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
214 { NULL,DIJOFS_BUTTON(122),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
215 { NULL,DIJOFS_BUTTON(123),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
216 { NULL,DIJOFS_BUTTON(124),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
217 { NULL,DIJOFS_BUTTON(125),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
218 { NULL,DIJOFS_BUTTON(126),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
219 { NULL,DIJOFS_BUTTON(127),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
220 { &GUID_XAxis,FIELD_OFFSET(DIJOYSTATE2,lVX),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
221 { &GUID_YAxis,FIELD_OFFSET(DIJOYSTATE2,lVY),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
222 { &GUID_ZAxis,FIELD_OFFSET(DIJOYSTATE2,lVZ),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
223 { &GUID_RxAxis,FIELD_OFFSET(DIJOYSTATE2,lVRx),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
224 { &GUID_RyAxis,FIELD_OFFSET(DIJOYSTATE2,lVRy),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
225 { &GUID_RzAxis,FIELD_OFFSET(DIJOYSTATE2,lVRz),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
226 { &GUID_Slider,FIELD_OFFSET(DIJOYSTATE2,rglVSlider[0]),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
227 { &GUID_Slider,FIELD_OFFSET(DIJOYSTATE2,rglVSlider[1]),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
228 { &GUID_XAxis,FIELD_OFFSET(DIJOYSTATE2,lAX),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
229 { &GUID_YAxis,FIELD_OFFSET(DIJOYSTATE2,lAY),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
230 { &GUID_ZAxis,FIELD_OFFSET(DIJOYSTATE2,lAZ),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
231 { &GUID_RxAxis,FIELD_OFFSET(DIJOYSTATE2,lARx),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
232 { &GUID_RyAxis,FIELD_OFFSET(DIJOYSTATE2,lARy),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
233 { &GUID_RzAxis,FIELD_OFFSET(DIJOYSTATE2,lARz),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
234 { &GUID_Slider,FIELD_OFFSET(DIJOYSTATE2,rglASlider[0]),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
235 { &GUID_Slider,FIELD_OFFSET(DIJOYSTATE2,rglASlider[1]),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
236 { &GUID_XAxis,FIELD_OFFSET(DIJOYSTATE2,lFX),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
237 { &GUID_YAxis,FIELD_OFFSET(DIJOYSTATE2,lFY),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
238 { &GUID_ZAxis,FIELD_OFFSET(DIJOYSTATE2,lFZ),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
239 { &GUID_RxAxis,FIELD_OFFSET(DIJOYSTATE2,lFRx),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
240 { &GUID_RyAxis,FIELD_OFFSET(DIJOYSTATE2,lFRy),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
241 { &GUID_RzAxis,FIELD_OFFSET(DIJOYSTATE2,lFRz),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
242 { &GUID_Slider,FIELD_OFFSET(DIJOYSTATE2,rglFSlider[0]),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
243 { &GUID_Slider,FIELD_OFFSET(DIJOYSTATE2,rglFSlider[1]),DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
244 };
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
245
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
246 const DIDATAFORMAT c_dfDIJoystick2 = {
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
247 sizeof(DIDATAFORMAT),
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
248 sizeof(DIOBJECTDATAFORMAT),
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
249 DIDF_ABSAXIS,
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
250 sizeof(DIJOYSTATE2),
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
251 SDL_arraysize(dfDIJoystick2),
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
252 dfDIJoystick2
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
253 };
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
254
2198
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
255
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
256 /* 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
257 static void
2198
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
258 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
259 {
2760
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 SDL_SetError("%s() [%s]: %s", function,
2760
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
262 DXGetErrorString9A(code), DXGetErrorDescription9A(code));
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
263 */
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2717
diff changeset
264 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
265 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
266
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
267
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
268 /* 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
269 * 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
270 * 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
271 * 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
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 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
274 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
275 {
c121d94672cb 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 HRESULT result;
2713
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents: 2198
diff changeset
277 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
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 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
280
2198
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
281 result = CoInitialize(NULL);
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
282 if (FAILED(result)) {
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
283 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
284 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
285 }
c121d94672cb 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 = CoCreateInstance(&CLSID_DirectInput, NULL, CLSCTX_INPROC_SERVER,
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
288 &IID_IDirectInput, &dinput);
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
289
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
290 if (FAILED(result)) {
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
291 SetDIerror("CoCreateInstance", result);
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
292 return (-1);
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
293 }
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
294
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
295 /* 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
296 instance = GetModuleHandle(NULL);
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents: 2198
diff changeset
297 if (instance == NULL) {
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents: 2198
diff changeset
298 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
299 GetLastError());
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents: 2198
diff changeset
300 return (-1);
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents: 2198
diff changeset
301 }
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents: 2198
diff changeset
302 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
303
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
304 if (FAILED(result)) {
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
305 SetDIerror("IDirectInput::Initialize", result);
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
306 return (-1);
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
307 }
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
308
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
309 /* 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
310 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
311 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
312 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
313 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
314
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
315 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
316 }
c121d94672cb 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
2198
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
318 static BOOL CALLBACK
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
319 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
320 {
2713
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents: 2198
diff changeset
321 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
322 sizeof(DIDEVICEINSTANCE));
2198
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
323 SYS_NumJoysticks++;
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
324
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
325 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
326 return DIENUM_STOP;
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
327
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
328 return DIENUM_CONTINUE;
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
329 }
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
330
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
331 /* 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
332 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
333 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
334 {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
335 /***-> 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
336 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
337 }
c121d94672cb 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
c121d94672cb 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 /* 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
340 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
341 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
342 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
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 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
345 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
346 {
c121d94672cb 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 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
348 LPDIRECTINPUTDEVICE device;
2198
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
349 DIPROPDWORD dipdw;
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
350
2713
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents: 2198
diff changeset
351 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
352 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
353 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
354
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
355
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
356 /* 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
357 joystick->hwdata =
2713
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents: 2198
diff changeset
358 (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
359 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
360 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
361 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
362 }
2713
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents: 2198
diff changeset
363 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
364 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
365 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
366
c121d94672cb 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 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
368 IDirectInput_CreateDevice(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
369 &SYS_Joystick[joystick->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
370 guidInstance, &device, NULL);
2198
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
371 if (FAILED(result)) {
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
372 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
373 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
374 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
375
2198
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
376 /* 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
377 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
378 &IID_IDirectInputDevice2,
c121d94672cb 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 (LPVOID *) & 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
380 hwdata->InputDevice);
2198
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
381 /* 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
382 IDirectInputDevice_Release(device);
2198
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
383
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
384 if (FAILED(result)) {
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
385 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
386 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
387 }
c121d94672cb 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
2198
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
389 /* 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
390 * 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
391 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
392 IDirectInputDevice2_SetCooperativeLevel(joystick->hwdata->
2713
0906692aa6a4 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents: 2198
diff changeset
393 InputDevice, SDL_HelperWindow,
2198
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
394 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
395 DISCL_BACKGROUND);
2198
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
396 if (FAILED(result)) {
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
397 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
398 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
399 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
400
2198
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
401 /* 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
402 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
403 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
404 &c_dfDIJoystick2);
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
405 if (FAILED(result)) {
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
406 SetDIerror("IDirectInputDevice2::SetDataFormat", result);
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
407 return (-1);
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
408 }
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
409
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
410 /* Get device capabilities */
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
411 result =
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
412 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
413 &joystick->hwdata->Capabilities);
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 if (FAILED(result)) {
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
416 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
417 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
418 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
419
2198
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
420 /* Force capable? */
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
421 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
422
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
423 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
424
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
425 if (FAILED(result)) {
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
426 SetDIerror("IDirectInputDevice2::Acquire", result);
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
427 return (-1);
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
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
430 /* reset all accuators. */
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
431 result =
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
432 IDirectInputDevice2_SendForceFeedbackCommand(joystick->hwdata->
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
433 InputDevice,
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
434 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
435
2198
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
436 if (FAILED(result)) {
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
437 SetDIerror("IDirectInputDevice2::SendForceFeedbackCommand",
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
438 result);
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
439 return (-1);
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
440 }
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
441
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
442 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
443
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
444 if (FAILED(result)) {
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
445 SetDIerror("IDirectInputDevice2::Unacquire", result);
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
446 return (-1);
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
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
449 /* 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
450 * 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
451 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
452 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
453 dipdw.dwData = DIPROPAUTOCENTER_ON;
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
454
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
455 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
456 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
457 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
458
2198
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
459 if (FAILED(result)) {
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
460 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
461 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
462 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
463 }
c121d94672cb 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 /* 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
466 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
467 EnumDevObjectsCallback, joystick,
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
468 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
469
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
470 dipdw.diph.dwObj = 0;
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
471 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
472 dipdw.dwData = INPUT_QSIZE;
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
473
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
474 /* Set the buffer size */
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
475 result =
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
476 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
477 DIPROP_BUFFERSIZE, &dipdw.diph);
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
478
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
479 if (result == DI_POLLEDDEVICE) {
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
480 /* 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
481 * 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
482 joystick->hwdata->buffered = 0;
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
483 } else if (FAILED(result)) {
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
484 SetDIerror("IDirectInputDevice2::SetProperty", result);
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
485 return (-1);
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
486 }
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
487
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
488 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
489 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
490
2198
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
491 static BOOL CALLBACK
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
492 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
493 {
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
494 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
495 HRESULT result;
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
496 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
497
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
498 in->ofs = dev->dwOfs;
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 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
501 in->type = BUTTON;
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
502 in->num = joystick->nbuttons;
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
503 joystick->nbuttons++;
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
504 } 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
505 in->type = HAT;
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
506 in->num = joystick->nhats;
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
507 joystick->nhats++;
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
508 } 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
509 DIPROPRANGE diprg;
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
510 DIPROPDWORD dilong;
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
511
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
512 in->type = AXIS;
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
513 in->num = joystick->naxes;
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
514
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
515 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
516 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
517 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
518 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
519 diprg.lMin = AXIS_MIN;
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
520 diprg.lMax = AXIS_MAX;
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
521
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
522 result =
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
523 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
524 DIPROP_RANGE, &diprg.diph);
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
525 if (FAILED(result)) {
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
526 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
527 }
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
528
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
529 /* 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
530 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
531 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
532 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
533 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
534 dilong.dwData = 0;
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
535 result =
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
536 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
537 DIPROP_DEADZONE, &dilong.diph);
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
538 if (FAILED(result)) {
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
539 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
540 }
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
541
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
542 joystick->naxes++;
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
543 } else {
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
544 /* 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
545 return DIENUM_CONTINUE;
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->hwdata->NumInputs++;
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
549
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
550 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
551 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
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 return DIENUM_CONTINUE;
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
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
557 /* 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
558 * 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
559 * 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
560 * 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
561 */
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
562 void
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
563 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
564 {
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
565 DIJOYSTATE2 state;
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
566 HRESULT result;
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
567 int i;
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
568
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
569 result =
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
570 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
571 sizeof(DIJOYSTATE2), &state);
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
572 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
573 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
574 result =
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
575 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
576 sizeof(DIJOYSTATE2), &state);
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
577 }
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
578
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
579 /* 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
580 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
581 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
582
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
583 switch (in->type) {
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
584 case AXIS:
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
585 switch (in->ofs) {
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
586 case DIJOFS_X:
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
587 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
588 (Sint16) state.lX);
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
589 break;
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
590 case DIJOFS_Y:
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
591 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
592 (Sint16) state.lY);
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
593 break;
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
594 case DIJOFS_Z:
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
595 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
596 (Sint16) state.lZ);
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
597 break;
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
598 case DIJOFS_RX:
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
599 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
600 (Sint16) state.lRx);
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
601 break;
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
602 case DIJOFS_RY:
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
603 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
604 (Sint16) state.lRy);
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
605 break;
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
606 case DIJOFS_RZ:
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
607 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
608 (Sint16) state.lRz);
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
609 break;
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
610 case DIJOFS_SLIDER(0):
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
611 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
612 (Sint16) state.rglSlider[0]);
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
613 break;
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
614 case DIJOFS_SLIDER(1):
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
615 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
616 (Sint16) state.rglSlider[1]);
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
617 break;
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
618 }
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
619
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
620 break;
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
621
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
622 case BUTTON:
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
623 SDL_PrivateJoystickButton_Int(joystick, in->num,
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
624 (Uint8) (state.
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
625 rgbButtons[in->ofs -
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
626 DIJOFS_BUTTON0]
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
627 ? SDL_PRESSED :
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
628 SDL_RELEASED));
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
629 break;
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
630 case HAT:
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
631 {
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
632 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
633 DIJOFS_POV(0)]);
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
634 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
635 break;
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
636 }
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 }
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
639 }
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
640
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
641 void
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
642 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
643 {
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
644 int i;
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
645 HRESULT result;
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
646 DWORD numevents;
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
647 DIDEVICEOBJECTDATA evtbuf[INPUT_QSIZE];
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
648
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
649 numevents = INPUT_QSIZE;
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
650 result =
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
651 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
652 sizeof(DIDEVICEOBJECTDATA), evtbuf,
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
653 &numevents, 0);
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
654 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
655 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
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),
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
659 evtbuf, &numevents, 0);
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
660 }
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
661
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
662 /* 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
663 if (FAILED(result))
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
664 return;
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
665
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
666 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
667 int j;
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
668
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
669 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
670 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
671
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
672 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
673 continue;
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 switch (in->type) {
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
676 case AXIS:
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
677 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
678 (Sint16) evtbuf[i].dwData);
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
679 break;
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
680 case BUTTON:
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
681 SDL_PrivateJoystickButton(joystick, in->num,
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
682 (Uint8) (evtbuf[i].
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
683 dwData ? SDL_PRESSED :
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
684 SDL_RELEASED));
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 HAT:
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
687 {
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
688 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
689 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
690 }
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
691 }
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
692 }
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 }
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
695
fe19afb86473 Split acinclude.m4 into its component parts for easy updating
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
696
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
697 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
698 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
699 {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
700 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
701 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
702 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
703 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
704 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
705 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
706 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
707 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
708 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
709 };
c121d94672cb 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
c121d94672cb 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 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
712 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
713
c121d94672cb 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 /* 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
715 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
716 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
717 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
718
c121d94672cb 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 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
720 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
721
c121d94672cb 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 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
723 }
c121d94672cb 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 /* 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
726 * 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
727 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
728 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
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 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
731 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
732 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
733 }
c121d94672cb 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
c121d94672cb 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 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
736 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
737 {
c121d94672cb 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 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
739 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
740 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
741 }
c121d94672cb 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
c121d94672cb 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 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
744 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
745 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
746 {
c121d94672cb 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 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
748 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
749 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
750 }
c121d94672cb 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
c121d94672cb 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 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
753 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
754 {
c121d94672cb 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 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
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 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
758 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
759 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
760 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
761 }
c121d94672cb 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 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
764 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
765 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
766 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
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 /* 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
770 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
771 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
772 {
c121d94672cb 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 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
774 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
775
c121d94672cb 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 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
777 /* 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
778 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
779 }
c121d94672cb 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 }
c121d94672cb 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 /* 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
783 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
784 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
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 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
787 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
788 }
c121d94672cb 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
c121d94672cb 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 #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
791 /* vi: set ts=4 sw=4 expandtab: */