joystickapi.h (7550B) - Raw
1 /** 2 * This file has no copyright assigned and is placed in the Public Domain. 3 * This file is part of the mingw-w64 runtime package. 4 * No warranty is given; refer to the file DISCLAIMER.PD within this package. 5 */ 6 7 #ifndef _JOYSTICKAPI_H_ 8 #define _JOYSTICKAPI_H_ 9 10 #include <apiset.h> 11 #include <apisetcconv.h> 12 13 #include <mmsyscom.h> 14 15 #ifdef __cplusplus 16 extern "C" { 17 #endif 18 19 #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) 20 21 #ifndef MMNOJOY 22 23 #define JOYERR_NOERROR (0) 24 #define JOYERR_PARMS (JOYERR_BASE+5) 25 #define JOYERR_NOCANDO (JOYERR_BASE+6) 26 #define JOYERR_UNPLUGGED (JOYERR_BASE+7) 27 28 #define JOY_BUTTON1 0x0001 29 #define JOY_BUTTON2 0x0002 30 #define JOY_BUTTON3 0x0004 31 #define JOY_BUTTON4 0x0008 32 #define JOY_BUTTON1CHG 0x0100 33 #define JOY_BUTTON2CHG 0x0200 34 #define JOY_BUTTON3CHG 0x0400 35 #define JOY_BUTTON4CHG 0x0800 36 37 #define JOY_BUTTON5 __MSABI_LONG(0x00000010) 38 #define JOY_BUTTON6 __MSABI_LONG(0x00000020) 39 #define JOY_BUTTON7 __MSABI_LONG(0x00000040) 40 #define JOY_BUTTON8 __MSABI_LONG(0x00000080) 41 #define JOY_BUTTON9 __MSABI_LONG(0x00000100) 42 #define JOY_BUTTON10 __MSABI_LONG(0x00000200) 43 #define JOY_BUTTON11 __MSABI_LONG(0x00000400) 44 #define JOY_BUTTON12 __MSABI_LONG(0x00000800) 45 #define JOY_BUTTON13 __MSABI_LONG(0x00001000) 46 #define JOY_BUTTON14 __MSABI_LONG(0x00002000) 47 #define JOY_BUTTON15 __MSABI_LONG(0x00004000) 48 #define JOY_BUTTON16 __MSABI_LONG(0x00008000) 49 #define JOY_BUTTON17 __MSABI_LONG(0x00010000) 50 #define JOY_BUTTON18 __MSABI_LONG(0x00020000) 51 #define JOY_BUTTON19 __MSABI_LONG(0x00040000) 52 #define JOY_BUTTON20 __MSABI_LONG(0x00080000) 53 #define JOY_BUTTON21 __MSABI_LONG(0x00100000) 54 #define JOY_BUTTON22 __MSABI_LONG(0x00200000) 55 #define JOY_BUTTON23 __MSABI_LONG(0x00400000) 56 #define JOY_BUTTON24 __MSABI_LONG(0x00800000) 57 #define JOY_BUTTON25 __MSABI_LONG(0x01000000) 58 #define JOY_BUTTON26 __MSABI_LONG(0x02000000) 59 #define JOY_BUTTON27 __MSABI_LONG(0x04000000) 60 #define JOY_BUTTON28 __MSABI_LONG(0x08000000) 61 #define JOY_BUTTON29 __MSABI_LONG(0x10000000) 62 #define JOY_BUTTON30 __MSABI_LONG(0x20000000) 63 #define JOY_BUTTON31 __MSABI_LONG(0x40000000) 64 #define JOY_BUTTON32 __MSABI_LONG(0x80000000) 65 66 #define JOY_POVCENTERED ((WORD)-1) 67 #define JOY_POVFORWARD 0 68 #define JOY_POVRIGHT 9000 69 #define JOY_POVBACKWARD 18000 70 #define JOY_POVLEFT 27000 71 72 #define JOY_RETURNX __MSABI_LONG(0x00000001) 73 #define JOY_RETURNY __MSABI_LONG(0x00000002) 74 #define JOY_RETURNZ __MSABI_LONG(0x00000004) 75 #define JOY_RETURNR __MSABI_LONG(0x00000008) 76 #define JOY_RETURNU __MSABI_LONG(0x00000010) 77 #define JOY_RETURNV __MSABI_LONG(0x00000020) 78 #define JOY_RETURNPOV __MSABI_LONG(0x00000040) 79 #define JOY_RETURNBUTTONS __MSABI_LONG(0x00000080) 80 #define JOY_RETURNRAWDATA __MSABI_LONG(0x00000100) 81 #define JOY_RETURNPOVCTS __MSABI_LONG(0x00000200) 82 #define JOY_RETURNCENTERED __MSABI_LONG(0x00000400) 83 #define JOY_USEDEADZONE __MSABI_LONG(0x00000800) 84 #define JOY_RETURNALL (JOY_RETURNX | JOY_RETURNY | JOY_RETURNZ | JOY_RETURNR | JOY_RETURNU | JOY_RETURNV | JOY_RETURNPOV | JOY_RETURNBUTTONS) 85 #define JOY_CAL_READALWAYS __MSABI_LONG(0x00010000) 86 #define JOY_CAL_READXYONLY __MSABI_LONG(0x00020000) 87 #define JOY_CAL_READ3 __MSABI_LONG(0x00040000) 88 #define JOY_CAL_READ4 __MSABI_LONG(0x00080000) 89 #define JOY_CAL_READXONLY __MSABI_LONG(0x00100000) 90 #define JOY_CAL_READYONLY __MSABI_LONG(0x00200000) 91 #define JOY_CAL_READ5 __MSABI_LONG(0x00400000) 92 #define JOY_CAL_READ6 __MSABI_LONG(0x00800000) 93 #define JOY_CAL_READZONLY __MSABI_LONG(0x01000000) 94 #define JOY_CAL_READRONLY __MSABI_LONG(0x02000000) 95 #define JOY_CAL_READUONLY __MSABI_LONG(0x04000000) 96 #define JOY_CAL_READVONLY __MSABI_LONG(0x08000000) 97 98 #define JOYSTICKID1 0 99 #define JOYSTICKID2 1 100 101 #define JOYCAPS_HASZ 0x0001 102 #define JOYCAPS_HASR 0x0002 103 #define JOYCAPS_HASU 0x0004 104 #define JOYCAPS_HASV 0x0008 105 #define JOYCAPS_HASPOV 0x0010 106 #define JOYCAPS_POV4DIR 0x0020 107 #define JOYCAPS_POVCTS 0x0040 108 109 typedef struct tagJOYCAPSA { 110 WORD wMid; 111 WORD wPid; 112 CHAR szPname[MAXPNAMELEN]; 113 UINT wXmin; 114 UINT wXmax; 115 UINT wYmin; 116 UINT wYmax; 117 UINT wZmin; 118 UINT wZmax; 119 UINT wNumButtons; 120 UINT wPeriodMin; 121 UINT wPeriodMax; 122 UINT wRmin; 123 UINT wRmax; 124 UINT wUmin; 125 UINT wUmax; 126 UINT wVmin; 127 UINT wVmax; 128 UINT wCaps; 129 UINT wMaxAxes; 130 UINT wNumAxes; 131 UINT wMaxButtons; 132 CHAR szRegKey[MAXPNAMELEN]; 133 CHAR szOEMVxD[MAX_JOYSTICKOEMVXDNAME]; 134 } JOYCAPSA, *PJOYCAPSA, *NPJOYCAPSA, *LPJOYCAPSA; 135 136 typedef struct tagJOYCAPSW { 137 WORD wMid; 138 WORD wPid; 139 WCHAR szPname[MAXPNAMELEN]; 140 UINT wXmin; 141 UINT wXmax; 142 UINT wYmin; 143 UINT wYmax; 144 UINT wZmin; 145 UINT wZmax; 146 UINT wNumButtons; 147 UINT wPeriodMin; 148 UINT wPeriodMax; 149 UINT wRmin; 150 UINT wRmax; 151 UINT wUmin; 152 UINT wUmax; 153 UINT wVmin; 154 UINT wVmax; 155 UINT wCaps; 156 UINT wMaxAxes; 157 UINT wNumAxes; 158 UINT wMaxButtons; 159 WCHAR szRegKey[MAXPNAMELEN]; 160 WCHAR szOEMVxD[MAX_JOYSTICKOEMVXDNAME]; 161 } JOYCAPSW, *PJOYCAPSW, *NPJOYCAPSW, *LPJOYCAPSW; 162 163 __MINGW_TYPEDEF_AW(JOYCAPS) 164 __MINGW_TYPEDEF_AW(PJOYCAPS) 165 __MINGW_TYPEDEF_AW(NPJOYCAPS) 166 __MINGW_TYPEDEF_AW(LPJOYCAPS) 167 168 typedef struct tagJOYCAPS2A { 169 WORD wMid; 170 WORD wPid; 171 CHAR szPname[MAXPNAMELEN]; 172 UINT wXmin; 173 UINT wXmax; 174 UINT wYmin; 175 UINT wYmax; 176 UINT wZmin; 177 UINT wZmax; 178 UINT wNumButtons; 179 UINT wPeriodMin; 180 UINT wPeriodMax; 181 UINT wRmin; 182 UINT wRmax; 183 UINT wUmin; 184 UINT wUmax; 185 UINT wVmin; 186 UINT wVmax; 187 UINT wCaps; 188 UINT wMaxAxes; 189 UINT wNumAxes; 190 UINT wMaxButtons; 191 CHAR szRegKey[MAXPNAMELEN]; 192 CHAR szOEMVxD[MAX_JOYSTICKOEMVXDNAME]; 193 GUID ManufacturerGuid; 194 GUID ProductGuid; 195 GUID NameGuid; 196 } JOYCAPS2A, *PJOYCAPS2A, *NPJOYCAPS2A, *LPJOYCAPS2A; 197 198 typedef struct tagJOYCAPS2W { 199 WORD wMid; 200 WORD wPid; 201 WCHAR szPname[MAXPNAMELEN]; 202 UINT wXmin; 203 UINT wXmax; 204 UINT wYmin; 205 UINT wYmax; 206 UINT wZmin; 207 UINT wZmax; 208 UINT wNumButtons; 209 UINT wPeriodMin; 210 UINT wPeriodMax; 211 UINT wRmin; 212 UINT wRmax; 213 UINT wUmin; 214 UINT wUmax; 215 UINT wVmin; 216 UINT wVmax; 217 UINT wCaps; 218 UINT wMaxAxes; 219 UINT wNumAxes; 220 UINT wMaxButtons; 221 WCHAR szRegKey[MAXPNAMELEN]; 222 WCHAR szOEMVxD[MAX_JOYSTICKOEMVXDNAME]; 223 GUID ManufacturerGuid; 224 GUID ProductGuid; 225 GUID NameGuid; 226 } JOYCAPS2W, *PJOYCAPS2W, *NPJOYCAPS2W, *LPJOYCAPS2W; 227 228 __MINGW_TYPEDEF_AW(JOYCAPS2) 229 __MINGW_TYPEDEF_AW(PJOYCAPS2) 230 __MINGW_TYPEDEF_AW(NPJOYCAPS2) 231 __MINGW_TYPEDEF_AW(LPJOYCAPS2) 232 233 typedef struct joyinfo_tag { 234 UINT wXpos; 235 UINT wYpos; 236 UINT wZpos; 237 UINT wButtons; 238 } JOYINFO, *PJOYINFO, *NPJOYINFO, *LPJOYINFO; 239 240 typedef struct joyinfoex_tag { 241 DWORD dwSize; 242 DWORD dwFlags; 243 DWORD dwXpos; 244 DWORD dwYpos; 245 DWORD dwZpos; 246 DWORD dwRpos; 247 DWORD dwUpos; 248 DWORD dwVpos; 249 DWORD dwButtons; 250 DWORD dwButtonNumber; 251 DWORD dwPOV; 252 DWORD dwReserved1; 253 DWORD dwReserved2; 254 } JOYINFOEX, *PJOYINFOEX, *NPJOYINFOEX, *LPJOYINFOEX; 255 256 WINMMAPI MMRESULT WINAPI joyGetPosEx(UINT uJoyID, LPJOYINFOEX pji); 257 258 WINMMAPI UINT WINAPI joyGetNumDevs(void); 259 260 WINMMAPI MMRESULT WINAPI joyGetDevCapsA(UINT_PTR uJoyID, LPJOYCAPSA pjc, UINT cbjc); 261 WINMMAPI MMRESULT WINAPI joyGetDevCapsW(UINT_PTR uJoyID, LPJOYCAPSW pjc, UINT cbjc); 262 #define joyGetDevCaps __MINGW_NAME_AW(joyGetDevCaps) 263 264 WINMMAPI MMRESULT WINAPI joyGetPos(UINT uJoyID, LPJOYINFO pji); 265 WINMMAPI MMRESULT WINAPI joyGetThreshold(UINT uJoyID, LPUINT puThreshold); 266 WINMMAPI MMRESULT WINAPI joyReleaseCapture(UINT uJoyID); 267 WINMMAPI MMRESULT WINAPI joySetCapture(HWND hwnd, UINT uJoyID, UINT uPeriod, WINBOOL fChanged); 268 WINMMAPI MMRESULT WINAPI joySetThreshold(UINT uJoyID, UINT uThreshold); 269 270 WINMMAPI MMRESULT WINAPI joyConfigChanged(DWORD dwFlags); 271 272 #endif /* ifndef MMNOJOY */ 273 274 #endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */ 275 276 #ifdef __cplusplus 277 } 278 #endif 279 280 #endif /* _JOYSTICKAPI_H_ */