Mercurial > sdl-ios-xcode
annotate src/joystick/os2/joyos2.h @ 2203:fca1cdc673b2
Fixed bug #428
This fix is overkill, but approved by Doug Lea, and he'll be releasing a
new version of his malloc.c sometime next month.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 16 Jul 2007 00:08:35 +0000 |
parents | c121d94672cb |
children |
rev | line source |
---|---|
1190 | 1 /*****************************************************************************/ |
2 /* */ | |
3 /* COPYRIGHT Copyright (C) 1995 IBM Corporation */ | |
4 /* */ | |
5 /* The following IBM OS/2 source code is provided to you solely for */ | |
6 /* the purpose of assisting you in your development of OS/2 device */ | |
7 /* drivers. You may use this code in accordance with the IBM License */ | |
8 /* Agreement provided in the IBM Device Driver Source Kit for OS/2. This */ | |
9 /* Copyright statement may not be removed. */ | |
10 /* */ | |
11 /*****************************************************************************/ | |
12 #ifndef JOYOS2_H | |
13 #define JOYOS2_H | |
14 | |
15 /****** GAMEPORT.SYS joystick definitions, start *****************************/ | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
16 #define GAME_VERSION 0x20 /* 2.0 First IBM version */ |
1190 | 17 #define GAMEPDDNAME "GAME$ " |
18 #define IOCTL_CAT_USER 0x80 | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
19 #define GAME_PORT_GET 0x20 /* read GAMEPORT.SYS values */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
20 #define GAME_PORT_RESET 0x60 /* reset joystick mask with given value */ |
1190 | 21 |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
22 #pragma pack(1) /* pack structure size is 1 byte */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
23 typedef struct |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
24 { /* GAMEPORT.SYS structure */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
25 USHORT usJs_AxCnt; /* Joystick_A X position */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
26 USHORT usJs_AyCnt; /* Joystick_A Y position */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
27 USHORT usJs_BxCnt; /* Joystick_B X position */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
28 USHORT usJs_ByCnt; /* Joystick_B Y position */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
29 USHORT usJs_ButtonA1Cnt; /* button A1 press count */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
30 USHORT usJs_ButtonA2Cnt; /* button A2 press count */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
31 USHORT usJs_ButtonB1Cnt; /* button B1 press count */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
32 USHORT usJs_ButtonB2Cnt; /* button B2 press count */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
33 UCHAR ucJs_JoyStickMask; /* mask of connected joystick pots */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
34 UCHAR ucJs_ButtonStatus; /* bits of switches down */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
35 ULONG ulJs_Ticks; /* joystick clock ticks */ |
1190 | 36 } GAME_PORT_STRUCT; |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
37 #pragma pack() /*reset to normal pack size */ |
1190 | 38 /****** GAMEPORT.SYS joystick definitions, end *******************************/ |
39 | |
40 | |
41 /****************************************************************************/ | |
42 #define GAME_GET_VERSION 0x01 | |
43 #define GAME_GET_PARMS 0x02 | |
44 #define GAME_SET_PARMS 0x03 | |
45 #define GAME_GET_CALIB 0x04 | |
46 #define GAME_SET_CALIB 0x05 | |
47 #define GAME_GET_DIGSET 0x06 | |
48 #define GAME_SET_DIGSET 0x07 | |
49 #define GAME_GET_STATUS 0x10 | |
50 #define GAME_GET_STATUS_BUTWAIT 0x11 | |
51 #define GAME_GET_STATUS_SAMPWAIT 0x12 | |
52 /****************************************************************************/ | |
53 | |
54 /****************************************************************************/ | |
55 // bit masks for each axis | |
56 #define JOY_AX_BIT 0x01 | |
57 #define JOY_AY_BIT 0x02 | |
58 #define JOY_A_BITS (JOY_AX_BIT|JOY_AY_BIT) | |
59 #define JOY_BX_BIT 0x04 | |
60 #define JOY_BY_BIT 0x08 | |
61 #define JOY_B_BITS (JOY_BX_BIT|JOY_BY_BIT) | |
62 #define JOY_ALLPOS_BITS (JOY_A_BITS|JOY_B_BITS) | |
63 | |
64 // bit masks for each button | |
65 #define JOY_BUT1_BIT 0x10 | |
66 #define JOY_BUT2_BIT 0x20 | |
67 #define JOY_BUT3_BIT 0x40 | |
68 #define JOY_BUT4_BIT 0x80 | |
69 #define JOY_ALL_BUTS (JOY_BUT1_BIT|JOY_BUT2_BIT|JOY_BUT3_BIT|JOY_BUT4_BIT) | |
70 /****************************************************************************/ | |
71 | |
72 /****************************************************************************/ | |
73 // 1-D position struct used for each axis | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
74 typedef SHORT GAME_POS; /* some data formats require signed values */ |
1190 | 75 |
76 // simple 2-D position for each joystick | |
77 typedef struct | |
78 { | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
79 GAME_POS x; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
80 GAME_POS y; |
1190 | 81 } |
82 GAME_2DPOS_STRUCT; | |
83 | |
84 // struct defining the instantaneous state of both sticks and all buttons | |
85 typedef struct | |
86 { | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
87 GAME_2DPOS_STRUCT A; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
88 GAME_2DPOS_STRUCT B; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
89 USHORT butMask; |
1190 | 90 } |
91 GAME_DATA_STRUCT; | |
92 | |
93 // struct to be used for calibration and digital response on each axis | |
94 typedef struct | |
95 { | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
96 GAME_POS lower; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
97 GAME_POS centre; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
98 GAME_POS upper; |
1190 | 99 } |
100 GAME_3POS_STRUCT; | |
101 /****************************************************************************/ | |
102 | |
103 /****************************************************************************/ | |
104 // status struct returned to OS/2 applications: | |
105 // current data for all sticks as well as button counts since last read | |
106 typedef struct | |
107 { | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
108 GAME_DATA_STRUCT curdata; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
109 USHORT b1cnt; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
110 USHORT b2cnt; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
111 USHORT b3cnt; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
112 USHORT b4cnt; |
1190 | 113 } |
114 GAME_STATUS_STRUCT; | |
115 /****************************************************************************/ | |
116 | |
117 /****************************************************************************/ | |
118 /* in use bitmasks originating in 0.2b */ | |
119 #define GAME_USE_BOTH_OLDMASK 0x01 /* for backward compat with bool */ | |
120 #define GAME_USE_X_NEWMASK 0x02 | |
121 #define GAME_USE_Y_NEWMASK 0x04 | |
122 #define GAME_USE_X_EITHERMASK (GAME_USE_X_NEWMASK|GAME_USE_BOTH_OLDMASK) | |
123 #define GAME_USE_Y_EITHERMASK (GAME_USE_Y_NEWMASK|GAME_USE_BOTH_OLDMASK) | |
124 #define GAME_USE_BOTH_NEWMASK (GAME_USE_X_NEWMASK|GAME_USE_Y_NEWMASK) | |
125 | |
126 /* only timed sampling implemented in version 1.0 */ | |
127 #define GAME_MODE_TIMED 1 /* timed sampling */ | |
128 #define GAME_MODE_REQUEST 2 /* request driven sampling */ | |
129 | |
130 /* only raw implemented in version 1.0 */ | |
131 #define GAME_DATA_FORMAT_RAW 1 /* [l,c,r] */ | |
132 #define GAME_DATA_FORMAT_SIGNED 2 /* [-l,0,+r] */ | |
133 #define GAME_DATA_FORMAT_BINARY 3 /* {-1,0,+1} */ | |
134 #define GAME_DATA_FORMAT_SCALED 4 /* [-10,+10] */ | |
135 | |
136 // parameters defining the operation of the driver | |
137 typedef struct | |
138 { | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
139 USHORT useA; /* new bitmasks: see above */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
140 USHORT useB; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
141 USHORT mode; /* see consts above */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
142 USHORT format; /* see consts above */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
143 USHORT sampDiv; /* samp freq = 32 / n */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
144 USHORT scale; /* scaling factor */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
145 USHORT res1; /* must be 0 */ |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
146 USHORT res2; /* must be 0 */ |
1190 | 147 } |
148 GAME_PARM_STRUCT; | |
149 /****************************************************************************/ | |
150 | |
151 /****************************************************************************/ | |
152 // calibration values for each axis: | |
153 // - upper limit on value to be considered in lower range | |
154 // - centre value | |
155 // - lower limit on value to be considered in upper range | |
156 typedef struct | |
157 { | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
158 GAME_3POS_STRUCT Ax; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
159 GAME_3POS_STRUCT Ay; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
160 GAME_3POS_STRUCT Bx; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
161 GAME_3POS_STRUCT By; |
1190 | 162 } |
163 GAME_CALIB_STRUCT; | |
164 /****************************************************************************/ | |
165 | |
166 /****************************************************************************/ | |
167 // struct defining the digital response values for all axes | |
168 typedef struct | |
169 { | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
170 GAME_3POS_STRUCT Ax; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
171 GAME_3POS_STRUCT Ay; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
172 GAME_3POS_STRUCT Bx; |
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
173 GAME_3POS_STRUCT By; |
1190 | 174 } |
175 GAME_DIGSET_STRUCT; | |
176 /****************************************************************************/ | |
177 | |
178 #endif | |
1895
c121d94672cb
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents:
1190
diff
changeset
|
179 /* vi: set ts=4 sw=4 expandtab: */ |