Wise&mystical  1.0
Project about Europe
Loading...
Searching...
No Matches
win32_joystick.c
Go to the documentation of this file.
1//========================================================================
2// GLFW 3.4 Win32 - www.glfw.org
3//------------------------------------------------------------------------
4// Copyright (c) 2002-2006 Marcus Geelnard
5// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
6//
7// This software is provided 'as-is', without any express or implied
8// warranty. In no event will the authors be held liable for any damages
9// arising from the use of this software.
10//
11// Permission is granted to anyone to use this software for any purpose,
12// including commercial applications, and to alter it and redistribute it
13// freely, subject to the following restrictions:
14//
15// 1. The origin of this software must not be misrepresented; you must not
16// claim that you wrote the original software. If you use this software
17// in a product, an acknowledgment in the product documentation would
18// be appreciated but is not required.
19//
20// 2. Altered source versions must be plainly marked as such, and must not
21// be misrepresented as being the original software.
22//
23// 3. This notice may not be removed or altered from any source
24// distribution.
25//
26//========================================================================
27// Please use C89 style variable declarations in this file because VS 2010
28//========================================================================
29
30#include "internal.h"
31
32#include <stdio.h>
33#include <math.h>
34
35#define _GLFW_TYPE_AXIS 0
36#define _GLFW_TYPE_SLIDER 1
37#define _GLFW_TYPE_BUTTON 2
38#define _GLFW_TYPE_POV 3
39
40// Data produced with DirectInput device object enumeration
41//
42typedef struct _GLFWobjenumWin32
43{
44 IDirectInputDevice8W* device;
52
53// Define local copies of the necessary GUIDs
54//
55static const GUID _glfw_IID_IDirectInput8W =
56 {0xbf798031,0x483a,0x4da2,{0xaa,0x99,0x5d,0x64,0xed,0x36,0x97,0x00}};
57static const GUID _glfw_GUID_XAxis =
58 {0xa36d02e0,0xc9f3,0x11cf,{0xbf,0xc7,0x44,0x45,0x53,0x54,0x00,0x00}};
59static const GUID _glfw_GUID_YAxis =
60 {0xa36d02e1,0xc9f3,0x11cf,{0xbf,0xc7,0x44,0x45,0x53,0x54,0x00,0x00}};
61static const GUID _glfw_GUID_ZAxis =
62 {0xa36d02e2,0xc9f3,0x11cf,{0xbf,0xc7,0x44,0x45,0x53,0x54,0x00,0x00}};
63static const GUID _glfw_GUID_RxAxis =
64 {0xa36d02f4,0xc9f3,0x11cf,{0xbf,0xc7,0x44,0x45,0x53,0x54,0x00,0x00}};
65static const GUID _glfw_GUID_RyAxis =
66 {0xa36d02f5,0xc9f3,0x11cf,{0xbf,0xc7,0x44,0x45,0x53,0x54,0x00,0x00}};
67static const GUID _glfw_GUID_RzAxis =
68 {0xa36d02e3,0xc9f3,0x11cf,{0xbf,0xc7,0x44,0x45,0x53,0x54,0x00,0x00}};
69static const GUID _glfw_GUID_Slider =
70 {0xa36d02e4,0xc9f3,0x11cf,{0xbf,0xc7,0x44,0x45,0x53,0x54,0x00,0x00}};
71static const GUID _glfw_GUID_POV =
72 {0xa36d02f2,0xc9f3,0x11cf,{0xbf,0xc7,0x44,0x45,0x53,0x54,0x00,0x00}};
73
74#define IID_IDirectInput8W _glfw_IID_IDirectInput8W
75#define GUID_XAxis _glfw_GUID_XAxis
76#define GUID_YAxis _glfw_GUID_YAxis
77#define GUID_ZAxis _glfw_GUID_ZAxis
78#define GUID_RxAxis _glfw_GUID_RxAxis
79#define GUID_RyAxis _glfw_GUID_RyAxis
80#define GUID_RzAxis _glfw_GUID_RzAxis
81#define GUID_Slider _glfw_GUID_Slider
82#define GUID_POV _glfw_GUID_POV
83
84// Object data array for our clone of c_dfDIJoystick
85// Generated with https://github.com/elmindreda/c_dfDIJoystick2
86//
87static DIOBJECTDATAFORMAT _glfwObjectDataFormats[] =
88{
133};
134
135// Our clone of c_dfDIJoystick
136//
137static const DIDATAFORMAT _glfwDataFormat =
138{
139 sizeof(DIDATAFORMAT),
140 sizeof(DIOBJECTDATAFORMAT),
142 sizeof(DIJOYSTATE),
143 sizeof(_glfwObjectDataFormats) / sizeof(DIOBJECTDATAFORMAT),
144 _glfwObjectDataFormats
145};
146
147// Returns a description fitting the specified XInput capabilities
148//
149static const char* getDeviceDescription(const XINPUT_CAPABILITIES* xic)
150{
151 switch (xic->SubType)
152 {
154 return "XInput Wheel";
156 return "XInput Arcade Stick";
158 return "XInput Flight Stick";
160 return "XInput Dance Pad";
162 return "XInput Guitar";
164 return "XInput Drum Kit";
166 {
167 if (xic->Flags & XINPUT_CAPS_WIRELESS)
168 return "Wireless Xbox Controller";
169 else
170 return "Xbox Controller";
171 }
172 }
173
174 return "Unknown XInput Device";
175}
176
177// Lexically compare device objects
178//
179static int compareJoystickObjects(const void* first, const void* second)
180{
181 const _GLFWjoyobjectWin32* fo = first;
182 const _GLFWjoyobjectWin32* so = second;
183
184 if (fo->type != so->type)
185 return fo->type - so->type;
186
187 return fo->offset - so->offset;
188}
189
190// Checks whether the specified device supports XInput
191// Technique from FDInputJoystickManager::IsXInputDeviceFast in ZDoom
192//
193static GLFWbool supportsXInput(const GUID* guid)
194{
195 UINT i, count = 0;
196 RAWINPUTDEVICELIST* ridl;
197 GLFWbool result = GLFW_FALSE;
198
199 if (GetRawInputDeviceList(NULL, &count, sizeof(RAWINPUTDEVICELIST)) != 0)
200 return GLFW_FALSE;
201
202 ridl = calloc(count, sizeof(RAWINPUTDEVICELIST));
203
204 if (GetRawInputDeviceList(ridl, &count, sizeof(RAWINPUTDEVICELIST)) == (UINT) -1)
205 {
206 free(ridl);
207 return GLFW_FALSE;
208 }
209
210 for (i = 0; i < count; i++)
211 {
212 RID_DEVICE_INFO rdi;
213 char name[256];
214 UINT size;
215
216 if (ridl[i].dwType != RIM_TYPEHID)
217 continue;
218
219 ZeroMemory(&rdi, sizeof(rdi));
220 rdi.cbSize = sizeof(rdi);
221 size = sizeof(rdi);
222
223 if ((INT) GetRawInputDeviceInfoA(ridl[i].hDevice,
224 RIDI_DEVICEINFO,
225 &rdi, &size) == -1)
226 {
227 continue;
228 }
229
230 if (MAKELONG(rdi.hid.dwVendorId, rdi.hid.dwProductId) != (LONG) guid->Data1)
231 continue;
232
233 memset(name, 0, sizeof(name));
234 size = sizeof(name);
235
236 if ((INT) GetRawInputDeviceInfoA(ridl[i].hDevice,
237 RIDI_DEVICENAME,
238 name, &size) == -1)
239 {
240 break;
241 }
242
243 name[sizeof(name) - 1] = '\0';
244 if (strstr(name, "IG_"))
245 {
246 result = GLFW_TRUE;
247 break;
248 }
249 }
250
251 free(ridl);
252 return result;
253}
254
255// Frees all resources associated with the specified joystick
256//
257static void closeJoystick(_GLFWjoystick* js)
258{
259 if (js->win32.device)
260 {
261 IDirectInputDevice8_Unacquire(js->win32.device);
262 IDirectInputDevice8_Release(js->win32.device);
263 }
264
265 free(js->win32.objects);
266
269}
270
271// DirectInput device object enumeration callback
272// Insights gleaned from SDL
273//
274static BOOL CALLBACK deviceObjectCallback(const DIDEVICEOBJECTINSTANCEW* doi,
275 void* user)
276{
277 _GLFWobjenumWin32* data = user;
278 _GLFWjoyobjectWin32* object = data->objects + data->objectCount;
279
280 if (DIDFT_GETTYPE(doi->dwType) & DIDFT_AXIS)
281 {
282 DIPROPRANGE dipr;
283
284 if (memcmp(&doi->guidType, &GUID_Slider, sizeof(GUID)) == 0)
285 object->offset = DIJOFS_SLIDER(data->sliderCount);
286 else if (memcmp(&doi->guidType, &GUID_XAxis, sizeof(GUID)) == 0)
287 object->offset = DIJOFS_X;
288 else if (memcmp(&doi->guidType, &GUID_YAxis, sizeof(GUID)) == 0)
289 object->offset = DIJOFS_Y;
290 else if (memcmp(&doi->guidType, &GUID_ZAxis, sizeof(GUID)) == 0)
291 object->offset = DIJOFS_Z;
292 else if (memcmp(&doi->guidType, &GUID_RxAxis, sizeof(GUID)) == 0)
293 object->offset = DIJOFS_RX;
294 else if (memcmp(&doi->guidType, &GUID_RyAxis, sizeof(GUID)) == 0)
295 object->offset = DIJOFS_RY;
296 else if (memcmp(&doi->guidType, &GUID_RzAxis, sizeof(GUID)) == 0)
297 object->offset = DIJOFS_RZ;
298 else
299 return DIENUM_CONTINUE;
300
301 ZeroMemory(&dipr, sizeof(dipr));
302 dipr.diph.dwSize = sizeof(dipr);
303 dipr.diph.dwHeaderSize = sizeof(dipr.diph);
304 dipr.diph.dwObj = doi->dwType;
305 dipr.diph.dwHow = DIPH_BYID;
306 dipr.lMin = -32768;
307 dipr.lMax = 32767;
308
311 &dipr.diph)))
312 {
313 return DIENUM_CONTINUE;
314 }
315
316 if (memcmp(&doi->guidType, &GUID_Slider, sizeof(GUID)) == 0)
317 {
318 object->type = _GLFW_TYPE_SLIDER;
319 data->sliderCount++;
320 }
321 else
322 {
323 object->type = _GLFW_TYPE_AXIS;
324 data->axisCount++;
325 }
326 }
327 else if (DIDFT_GETTYPE(doi->dwType) & DIDFT_BUTTON)
328 {
329 object->offset = DIJOFS_BUTTON(data->buttonCount);
330 object->type = _GLFW_TYPE_BUTTON;
331 data->buttonCount++;
332 }
333 else if (DIDFT_GETTYPE(doi->dwType) & DIDFT_POV)
334 {
335 object->offset = DIJOFS_POV(data->povCount);
336 object->type = _GLFW_TYPE_POV;
337 data->povCount++;
338 }
339
340 data->objectCount++;
341 return DIENUM_CONTINUE;
342}
343
344// DirectInput device enumeration callback
345//
346static BOOL CALLBACK deviceCallback(const DIDEVICEINSTANCE* di, void* user)
347{
348 int jid = 0;
349 DIDEVCAPS dc;
350 DIPROPDWORD dipd;
351 IDirectInputDevice8* device;
353 _GLFWjoystick* js;
354 char guid[33];
355 char name[256];
356
357 for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
358 {
359 js = _glfw.joysticks + jid;
360 if (js->present)
361 {
362 if (memcmp(&js->win32.guid, &di->guidInstance, sizeof(GUID)) == 0)
363 return DIENUM_CONTINUE;
364 }
365 }
366
367 if (supportsXInput(&di->guidProduct))
368 return DIENUM_CONTINUE;
369
370 if (FAILED(IDirectInput8_CreateDevice(_glfw.win32.dinput8.api,
371 &di->guidInstance,
372 &device,
373 NULL)))
374 {
375 _glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to create device");
376 return DIENUM_CONTINUE;
377 }
378
379 if (FAILED(IDirectInputDevice8_SetDataFormat(device, &_glfwDataFormat)))
380 {
382 "Win32: Failed to set device data format");
383
385 return DIENUM_CONTINUE;
386 }
387
388 ZeroMemory(&dc, sizeof(dc));
389 dc.dwSize = sizeof(dc);
390
391 if (FAILED(IDirectInputDevice8_GetCapabilities(device, &dc)))
392 {
394 "Win32: Failed to query device capabilities");
395
397 return DIENUM_CONTINUE;
398 }
399
400 ZeroMemory(&dipd, sizeof(dipd));
401 dipd.diph.dwSize = sizeof(dipd);
402 dipd.diph.dwHeaderSize = sizeof(dipd.diph);
403 dipd.diph.dwHow = DIPH_DEVICE;
405
406 if (FAILED(IDirectInputDevice8_SetProperty(device,
408 &dipd.diph)))
409 {
411 "Win32: Failed to set device axis mode");
412
414 return DIENUM_CONTINUE;
415 }
416
417 memset(&data, 0, sizeof(data));
418 data.device = device;
419 data.objects = calloc(dc.dwAxes + (size_t) dc.dwButtons + dc.dwPOVs,
420 sizeof(_GLFWjoyobjectWin32));
421
422 if (FAILED(IDirectInputDevice8_EnumObjects(device,
423 deviceObjectCallback,
424 &data,
426 {
428 "Win32: Failed to enumerate device objects");
429
431 free(data.objects);
432 return DIENUM_CONTINUE;
433 }
434
435 qsort(data.objects, data.objectCount,
436 sizeof(_GLFWjoyobjectWin32),
437 compareJoystickObjects);
438
439 if (!WideCharToMultiByte(CP_UTF8, 0,
440 di->tszInstanceName, -1,
441 name, sizeof(name),
442 NULL, NULL))
443 {
445 "Win32: Failed to convert joystick name to UTF-8");
446
448 free(data.objects);
449 return DIENUM_STOP;
450 }
451
452 // Generate a joystick GUID that matches the SDL 2.0.5+ one
453 if (memcmp(&di->guidProduct.Data4[2], "PIDVID", 6) == 0)
454 {
455 sprintf(guid, "03000000%02x%02x0000%02x%02x000000000000",
456 (uint8_t) di->guidProduct.Data1,
457 (uint8_t) (di->guidProduct.Data1 >> 8),
458 (uint8_t) (di->guidProduct.Data1 >> 16),
459 (uint8_t) (di->guidProduct.Data1 >> 24));
460 }
461 else
462 {
463 sprintf(guid, "05000000%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x00",
464 name[0], name[1], name[2], name[3],
465 name[4], name[5], name[6], name[7],
466 name[8], name[9], name[10]);
467 }
468
469 js = _glfwAllocJoystick(name, guid,
470 data.axisCount + data.sliderCount,
471 data.buttonCount,
472 data.povCount);
473 if (!js)
474 {
476 free(data.objects);
477 return DIENUM_STOP;
478 }
479
480 js->win32.device = device;
481 js->win32.guid = di->guidInstance;
482 js->win32.objects = data.objects;
483 js->win32.objectCount = data.objectCount;
484
486 return DIENUM_CONTINUE;
487}
488
489
493
494// Checks for new joysticks after DBT_DEVICEARRIVAL
495//
497{
498 if (_glfw.win32.xinput.instance)
499 {
500 DWORD index;
501
502 for (index = 0; index < XUSER_MAX_COUNT; index++)
503 {
504 int jid;
505 char guid[33];
507 _GLFWjoystick* js;
508
509 for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
510 {
511 if (_glfw.joysticks[jid].present &&
512 _glfw.joysticks[jid].win32.device == NULL &&
513 _glfw.joysticks[jid].win32.index == index)
514 {
515 break;
516 }
517 }
518
519 if (jid <= GLFW_JOYSTICK_LAST)
520 continue;
521
522 if (XInputGetCapabilities(index, 0, &xic) != ERROR_SUCCESS)
523 continue;
524
525 // Generate a joystick GUID that matches the SDL 2.0.5+ one
526 sprintf(guid, "78696e707574%02x000000000000000000",
527 xic.SubType & 0xff);
528
529 js = _glfwAllocJoystick(getDeviceDescription(&xic), guid, 6, 10, 1);
530 if (!js)
531 continue;
532
533 js->win32.index = index;
534
536 }
537 }
538
539 if (_glfw.win32.dinput8.api)
540 {
541 if (FAILED(IDirectInput8_EnumDevices(_glfw.win32.dinput8.api,
543 deviceCallback,
544 NULL,
546 {
548 "Failed to enumerate DirectInput8 devices");
549 return;
550 }
551 }
552}
553
554// Checks for joystick disconnection after DBT_DEVICEREMOVECOMPLETE
555//
557{
558 int jid;
559
560 for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
561 {
562 _GLFWjoystick* js = _glfw.joysticks + jid;
563 if (js->present)
565 }
566}
567
568
572
574{
575 if (_glfw.win32.dinput8.instance)
576 {
577 if (FAILED(DirectInput8Create(GetModuleHandle(NULL),
580 (void**) &_glfw.win32.dinput8.api,
581 NULL)))
582 {
584 "Win32: Failed to create interface");
585 return GLFW_FALSE;
586 }
587 }
588
590 return GLFW_TRUE;
591}
592
594{
595 int jid;
596
597 for (jid = GLFW_JOYSTICK_1; jid <= GLFW_JOYSTICK_LAST; jid++)
598 closeJoystick(_glfw.joysticks + jid);
599
600 if (_glfw.win32.dinput8.api)
601 IDirectInput8_Release(_glfw.win32.dinput8.api);
602}
603
605{
606 if (js->win32.device)
607 {
608 int i, ai = 0, bi = 0, pi = 0;
609 HRESULT result;
610 DIJOYSTATE state;
611
612 IDirectInputDevice8_Poll(js->win32.device);
613 result = IDirectInputDevice8_GetDeviceState(js->win32.device,
614 sizeof(state),
615 &state);
616 if (result == DIERR_NOTACQUIRED || result == DIERR_INPUTLOST)
617 {
618 IDirectInputDevice8_Acquire(js->win32.device);
619 IDirectInputDevice8_Poll(js->win32.device);
620 result = IDirectInputDevice8_GetDeviceState(js->win32.device,
621 sizeof(state),
622 &state);
623 }
624
625 if (FAILED(result))
626 {
627 closeJoystick(js);
628 return GLFW_FALSE;
629 }
630
631 if (mode == _GLFW_POLL_PRESENCE)
632 return GLFW_TRUE;
633
634 for (i = 0; i < js->win32.objectCount; i++)
635 {
636 const void* data = (char*) &state + js->win32.objects[i].offset;
637
638 switch (js->win32.objects[i].type)
639 {
640 case _GLFW_TYPE_AXIS:
642 {
643 const float value = (*((LONG*) data) + 0.5f) / 32767.5f;
644 _glfwInputJoystickAxis(js, ai, value);
645 ai++;
646 break;
647 }
648
650 {
651 const char value = (*((BYTE*) data) & 0x80) != 0;
652 _glfwInputJoystickButton(js, bi, value);
653 bi++;
654 break;
655 }
656
657 case _GLFW_TYPE_POV:
658 {
659 const int states[9] =
660 {
670 };
671
672 // Screams of horror are appropriate at this point
673 int stateIndex = LOWORD(*(DWORD*) data) / (45 * DI_DEGREES);
674 if (stateIndex < 0 || stateIndex > 8)
675 stateIndex = 8;
676
677 _glfwInputJoystickHat(js, pi, states[stateIndex]);
678 pi++;
679 break;
680 }
681 }
682 }
683 }
684 else
685 {
686 int i, dpad = 0;
687 DWORD result;
688 XINPUT_STATE xis;
689 const WORD buttons[10] =
690 {
701 };
702
703 result = XInputGetState(js->win32.index, &xis);
704 if (result != ERROR_SUCCESS)
705 {
706 if (result == ERROR_DEVICE_NOT_CONNECTED)
707 closeJoystick(js);
708
709 return GLFW_FALSE;
710 }
711
712 if (mode == _GLFW_POLL_PRESENCE)
713 return GLFW_TRUE;
714
715 _glfwInputJoystickAxis(js, 0, (xis.Gamepad.sThumbLX + 0.5f) / 32767.5f);
716 _glfwInputJoystickAxis(js, 1, -(xis.Gamepad.sThumbLY + 0.5f) / 32767.5f);
717 _glfwInputJoystickAxis(js, 2, (xis.Gamepad.sThumbRX + 0.5f) / 32767.5f);
718 _glfwInputJoystickAxis(js, 3, -(xis.Gamepad.sThumbRY + 0.5f) / 32767.5f);
719 _glfwInputJoystickAxis(js, 4, xis.Gamepad.bLeftTrigger / 127.5f - 1.f);
720 _glfwInputJoystickAxis(js, 5, xis.Gamepad.bRightTrigger / 127.5f - 1.f);
721
722 for (i = 0; i < 10; i++)
723 {
724 const char value = (xis.Gamepad.wButtons & buttons[i]) ? 1 : 0;
725 _glfwInputJoystickButton(js, i, value);
726 }
727
729 dpad |= GLFW_HAT_UP;
731 dpad |= GLFW_HAT_RIGHT;
733 dpad |= GLFW_HAT_DOWN;
735 dpad |= GLFW_HAT_LEFT;
736
737 _glfwInputJoystickHat(js, 0, dpad);
738 }
739
740 return GLFW_TRUE;
741}
742
744{
745 if (strcmp(guid + 20, "504944564944") == 0)
746 {
747 char original[33];
748 strncpy(original, guid, sizeof(original) - 1);
749 sprintf(guid, "03000000%.4s0000%.4s000000000000",
750 original, original + 4);
751 }
752}
753
#define IDirectInputDevice8
Definition: dinput.h:151
#define DIPROP_RANGE
Definition: dinput.h:840
#define IDirectInputDevice8_GetCapabilities(p, a)
Definition: dinput.h:2036
#define DIRECTINPUT_VERSION
Definition: dinput.h:27
#define DIENUM_STOP
Definition: dinput.h:214
struct _DIDATAFORMAT DIDATAFORMAT
#define DIENUM_CONTINUE
Definition: dinput.h:215
#define DIJOFS_SLIDER(n)
Definition: dinput.h:1195
struct _DIOBJECTDATAFORMAT DIOBJECTDATAFORMAT
#define DIDFT_POV
Definition: dinput.h:677
#define DIPROPAXISMODE_ABS
Definition: dinput.h:836
#define DIEDFL_ALLDEVICES
Definition: dinput.h:217
#define IDirectInputDevice8_GetDeviceState(p, a, b)
Definition: dinput.h:2042
#define IDirectInput8_EnumDevices(p, a, b, c, d)
Definition: dinput.h:2422
#define DIJOFS_X
Definition: dinput.h:1189
#define DI_DEGREES
Definition: dinput.h:1019
#define DIJOFS_Y
Definition: dinput.h:1190
#define DIERR_NOTACQUIRED
Definition: dinput.h:194
#define IDirectInput8_CreateDevice(p, a, b, c)
Definition: dinput.h:2421
#define DIPROP_AXISMODE
Definition: dinput.h:834
#define DIDFT_GETTYPE(n)
Definition: dinput.h:683
#define DIPH_BYID
Definition: dinput.h:766
#define IDirectInput8_Release(p)
Definition: dinput.h:2419
#define IDirectInputDevice8_SetProperty(p, a, b)
Definition: dinput.h:2039
#define IDirectInputDevice8_EnumObjects(p, a, b, c)
Definition: dinput.h:2037
#define DIDFT_ABSAXIS
Definition: dinput.h:672
#define DIDFT_AXIS
Definition: dinput.h:673
#define IDirectInputDevice8_Release(p)
Definition: dinput.h:2034
#define DIDOI_ASPECTPOSITION
Definition: dinput.h:746
#define DIERR_INPUTLOST
Definition: dinput.h:190
#define IDirectInputDevice8_SetDataFormat(p, a)
Definition: dinput.h:2044
#define DIJOFS_RX
Definition: dinput.h:1192
#define DIDFT_OPTIONAL
Definition: dinput.h:693
#define IDirectInputDevice8_Poll(p)
Definition: dinput.h:2059
#define DIJOFS_Z
Definition: dinput.h:1191
#define IDirectInputDevice8_Acquire(p)
Definition: dinput.h:2040
#define DIJOFS_BUTTON(n)
Definition: dinput.h:1199
#define DIDFT_ANYINSTANCE
Definition: dinput.h:680
#define DIPH_DEVICE
Definition: dinput.h:764
#define IDirectInputDevice8_Unacquire(p)
Definition: dinput.h:2041
#define DI8DEVCLASS_GAMECTRL
Definition: dinput.h:234
#define DIJOFS_RZ
Definition: dinput.h:1194
#define DIJOFS_POV(n)
Definition: dinput.h:1197
#define DIJOFS_RY
Definition: dinput.h:1193
#define DIDFT_BUTTON
Definition: dinput.h:676
#define GLFW_DISCONNECTED
Definition: glfw3.h:1231
#define GLFW_CONNECTED
Definition: glfw3.h:1230
#define GLFW_PLATFORM_ERROR
A platform-specific error occurred that does not match any of the more specific categories.
Definition: glfw3.h:758
#define GLFW_HAT_RIGHT
Definition: glfw3.h:355
#define GLFW_HAT_LEFT_UP
Definition: glfw3.h:360
#define GLFW_HAT_LEFT_DOWN
Definition: glfw3.h:361
#define GLFW_HAT_UP
Definition: glfw3.h:354
#define GLFW_HAT_RIGHT_UP
Definition: glfw3.h:358
#define GLFW_HAT_LEFT
Definition: glfw3.h:357
#define GLFW_HAT_DOWN
Definition: glfw3.h:356
#define GLFW_HAT_RIGHT_DOWN
Definition: glfw3.h:359
#define GLFW_HAT_CENTERED
Definition: glfw3.h:353
#define GLFW_TRUE
One.
Definition: glfw3.h:310
#define GLFW_FALSE
Zero.
Definition: glfw3.h:319
#define GLFW_JOYSTICK_1
Definition: glfw3.h:590
#define GLFW_JOYSTICK_LAST
Definition: glfw3.h:606
_GLFWlibrary _glfw
Definition: init.c:46
void _glfwInputError(int code, const char *format,...)
Definition: init.c:160
_GLFWjoystick * _glfwAllocJoystick(const char *name, const char *guid, int axisCount, int buttonCount, int hatCount)
Definition: input.c:429
void _glfwInputJoystick(_GLFWjoystick *js, int event)
Definition: input.c:386
void _glfwInputJoystickAxis(_GLFWjoystick *js, int axis, float value)
Definition: input.c:396
void _glfwInputJoystickHat(_GLFWjoystick *js, int hat, char value)
Definition: input.c:410
void _glfwFreeJoystick(_GLFWjoystick *js)
Definition: input.c:465
void _glfwInputJoystickButton(_GLFWjoystick *js, int button, char value)
Definition: input.c:403
int GLFWbool
Definition: internal.h:61
#define _GLFW_POLL_PRESENCE
Definition: internal.h:54
#define NULL
Definition: miniaudio.h:3718
unsigned char uint8_t
Definition: stdint.h:78
char guid[33]
Definition: internal.h:502
GLFWbool present
Definition: internal.h:493
_GLFWjoystick joysticks[GLFW_JOYSTICK_LAST+1]
Definition: internal.h:547
IDirectInputDevice8W * device
_GLFWjoyobjectWin32 * objects
BYTE bRightTrigger
Definition: xinput.h:166
BYTE bLeftTrigger
Definition: xinput.h:165
SHORT sThumbRY
Definition: xinput.h:170
WORD wButtons
Definition: xinput.h:164
SHORT sThumbLX
Definition: xinput.h:167
SHORT sThumbLY
Definition: xinput.h:168
SHORT sThumbRX
Definition: xinput.h:169
XINPUT_GAMEPAD Gamepad
Definition: xinput.h:175
DWORD dwAxes
Definition: dinput.h:910
DWORD dwButtons
Definition: dinput.h:911
DWORD dwPOVs
Definition: dinput.h:912
DWORD dwSize
Definition: dinput.h:907
DIPROPHEADER diph
Definition: dinput.h:774
DWORD dwData
Definition: dinput.h:775
DWORD dwObj
Definition: dinput.h:759
DWORD dwSize
Definition: dinput.h:757
DWORD dwHeaderSize
Definition: dinput.h:758
DWORD dwHow
Definition: dinput.h:760
LONG lMin
Definition: dinput.h:781
LONG lMax
Definition: dinput.h:782
DIPROPHEADER diph
Definition: dinput.h:780
void _glfwDetectJoystickDisconnectionWin32(void)
void _glfwPlatformTerminateJoysticks(void)
int _glfwPlatformPollJoystick(_GLFWjoystick *js, int mode)
#define _GLFW_TYPE_AXIS
#define GUID_ZAxis
#define GUID_RxAxis
GLFWbool _glfwPlatformInitJoysticks(void)
#define _GLFW_TYPE_POV
#define _GLFW_TYPE_SLIDER
#define IID_IDirectInput8W
#define _GLFW_TYPE_BUTTON
void _glfwDetectJoystickConnectionWin32(void)
#define GUID_RyAxis
void _glfwPlatformUpdateGamepadGUID(char *guid)
#define GUID_RzAxis
#define GUID_POV
#define GUID_XAxis
#define GUID_Slider
#define GUID_YAxis
#define XInputGetState
#define XINPUT_DEVSUBTYPE_FLIGHT_STICK
#define DirectInput8Create
#define XINPUT_CAPS_WIRELESS
#define XInputGetCapabilities
#define XINPUT_GAMEPAD_Y
Definition: xinput.h:45
#define XINPUT_DEVSUBTYPE_DANCE_PAD
Definition: xinput.h:118
#define XUSER_MAX_COUNT
Definition: xinput.h:156
#define XINPUT_GAMEPAD_DPAD_UP
Definition: xinput.h:32
#define XINPUT_GAMEPAD_B
Definition: xinput.h:43
#define XINPUT_DEVSUBTYPE_GAMEPAD
Definition: xinput.h:114
#define XINPUT_GAMEPAD_START
Definition: xinput.h:36
#define XINPUT_GAMEPAD_X
Definition: xinput.h:44
#define XINPUT_GAMEPAD_BACK
Definition: xinput.h:37
#define XINPUT_DEVSUBTYPE_WHEEL
Definition: xinput.h:115
#define XINPUT_DEVSUBTYPE_ARCADE_STICK
Definition: xinput.h:116
#define XINPUT_GAMEPAD_DPAD_LEFT
Definition: xinput.h:34
#define XINPUT_GAMEPAD_DPAD_RIGHT
Definition: xinput.h:35
#define XINPUT_DEVSUBTYPE_GUITAR
Definition: xinput.h:119
#define XINPUT_GAMEPAD_DPAD_DOWN
Definition: xinput.h:33
#define XINPUT_GAMEPAD_RIGHT_SHOULDER
Definition: xinput.h:41
#define XINPUT_GAMEPAD_A
Definition: xinput.h:42
#define XINPUT_GAMEPAD_LEFT_SHOULDER
Definition: xinput.h:40
#define XINPUT_GAMEPAD_RIGHT_THUMB
Definition: xinput.h:39
#define XINPUT_GAMEPAD_LEFT_THUMB
Definition: xinput.h:38
#define XINPUT_DEVSUBTYPE_DRUM_KIT
Definition: xinput.h:120