|
@@ -332,26 +332,26 @@ static BOOL CALLBACK deviceObjectCallback(const DIDEVICEOBJECTINSTANCEW* doi,
|
|
//
|
|
//
|
|
static BOOL CALLBACK deviceCallback(const DIDEVICEINSTANCE* di, void* user)
|
|
static BOOL CALLBACK deviceCallback(const DIDEVICEINSTANCE* di, void* user)
|
|
{
|
|
{
|
|
- int joy = 0;
|
|
|
|
|
|
+ int jid = 0;
|
|
DIDEVCAPS dc;
|
|
DIDEVCAPS dc;
|
|
DIPROPDWORD dipd;
|
|
DIPROPDWORD dipd;
|
|
IDirectInputDevice8* device;
|
|
IDirectInputDevice8* device;
|
|
_GLFWobjenumWin32 data;
|
|
_GLFWobjenumWin32 data;
|
|
_GLFWjoystickWin32* js;
|
|
_GLFWjoystickWin32* js;
|
|
|
|
|
|
- for (joy = GLFW_JOYSTICK_1; joy <= GLFW_JOYSTICK_LAST; joy++)
|
|
|
|
|
|
+ for (jid = GLFW_JOYSTICK_1; jid <= GLFW_JOYSTICK_LAST; jid++)
|
|
{
|
|
{
|
|
- if (memcmp(&_glfw.win32_js[joy].guid, &di->guidInstance, sizeof(GUID)) == 0)
|
|
|
|
|
|
+ if (memcmp(&_glfw.win32_js[jid].guid, &di->guidInstance, sizeof(GUID)) == 0)
|
|
return DIENUM_CONTINUE;
|
|
return DIENUM_CONTINUE;
|
|
}
|
|
}
|
|
|
|
|
|
- for (joy = GLFW_JOYSTICK_1; joy <= GLFW_JOYSTICK_LAST; joy++)
|
|
|
|
|
|
+ for (jid = GLFW_JOYSTICK_1; jid <= GLFW_JOYSTICK_LAST; jid++)
|
|
{
|
|
{
|
|
- if (!_glfw.win32_js[joy].present)
|
|
|
|
|
|
+ if (!_glfw.win32_js[jid].present)
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
- if (joy > GLFW_JOYSTICK_LAST)
|
|
|
|
|
|
+ if (jid > GLFW_JOYSTICK_LAST)
|
|
return DIENUM_STOP;
|
|
return DIENUM_STOP;
|
|
|
|
|
|
if (supportsXInput(&di->guidProduct))
|
|
if (supportsXInput(&di->guidProduct))
|
|
@@ -426,7 +426,7 @@ static BOOL CALLBACK deviceCallback(const DIDEVICEINSTANCE* di, void* user)
|
|
sizeof(_GLFWjoyobjectWin32),
|
|
sizeof(_GLFWjoyobjectWin32),
|
|
compareJoystickObjects);
|
|
compareJoystickObjects);
|
|
|
|
|
|
- js = _glfw.win32_js + joy;
|
|
|
|
|
|
+ js = _glfw.win32_js + jid;
|
|
js->device = device;
|
|
js->device = device;
|
|
js->guid = di->guidInstance;
|
|
js->guid = di->guidInstance;
|
|
js->axisCount = data.axisCount + data.sliderCount;
|
|
js->axisCount = data.axisCount + data.sliderCount;
|
|
@@ -438,7 +438,7 @@ static BOOL CALLBACK deviceCallback(const DIDEVICEINSTANCE* di, void* user)
|
|
js->name = _glfwCreateUTF8FromWideStringWin32(di->tszInstanceName);
|
|
js->name = _glfwCreateUTF8FromWideStringWin32(di->tszInstanceName);
|
|
js->present = GLFW_TRUE;
|
|
js->present = GLFW_TRUE;
|
|
|
|
|
|
- _glfwInputJoystickChange(joy, GLFW_CONNECTED);
|
|
|
|
|
|
+ _glfwInputJoystickChange(jid, GLFW_CONNECTED);
|
|
return DIENUM_CONTINUE;
|
|
return DIENUM_CONTINUE;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -447,33 +447,33 @@ static BOOL CALLBACK deviceCallback(const DIDEVICEINSTANCE* di, void* user)
|
|
//
|
|
//
|
|
static GLFWbool openXinputDevice(DWORD index)
|
|
static GLFWbool openXinputDevice(DWORD index)
|
|
{
|
|
{
|
|
- int joy;
|
|
|
|
|
|
+ int jid;
|
|
XINPUT_CAPABILITIES xic;
|
|
XINPUT_CAPABILITIES xic;
|
|
_GLFWjoystickWin32* js;
|
|
_GLFWjoystickWin32* js;
|
|
|
|
|
|
- for (joy = GLFW_JOYSTICK_1; joy <= GLFW_JOYSTICK_LAST; joy++)
|
|
|
|
|
|
+ for (jid = GLFW_JOYSTICK_1; jid <= GLFW_JOYSTICK_LAST; jid++)
|
|
{
|
|
{
|
|
- if (_glfw.win32_js[joy].present &&
|
|
|
|
- _glfw.win32_js[joy].device == NULL &&
|
|
|
|
- _glfw.win32_js[joy].index == index)
|
|
|
|
|
|
+ if (_glfw.win32_js[jid].present &&
|
|
|
|
+ _glfw.win32_js[jid].device == NULL &&
|
|
|
|
+ _glfw.win32_js[jid].index == index)
|
|
{
|
|
{
|
|
return GLFW_FALSE;
|
|
return GLFW_FALSE;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- for (joy = GLFW_JOYSTICK_1; joy <= GLFW_JOYSTICK_LAST; joy++)
|
|
|
|
|
|
+ for (jid = GLFW_JOYSTICK_1; jid <= GLFW_JOYSTICK_LAST; jid++)
|
|
{
|
|
{
|
|
- if (!_glfw.win32_js[joy].present)
|
|
|
|
|
|
+ if (!_glfw.win32_js[jid].present)
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
- if (joy > GLFW_JOYSTICK_LAST)
|
|
|
|
|
|
+ if (jid > GLFW_JOYSTICK_LAST)
|
|
return GLFW_FALSE;
|
|
return GLFW_FALSE;
|
|
|
|
|
|
if (_glfw_XInputGetCapabilities(index, 0, &xic) != ERROR_SUCCESS)
|
|
if (_glfw_XInputGetCapabilities(index, 0, &xic) != ERROR_SUCCESS)
|
|
return GLFW_FALSE;
|
|
return GLFW_FALSE;
|
|
|
|
|
|
- js = _glfw.win32_js + joy;
|
|
|
|
|
|
+ js = _glfw.win32_js + jid;
|
|
js->axisCount = 6;
|
|
js->axisCount = 6;
|
|
js->axes = calloc(js->axisCount, sizeof(float));
|
|
js->axes = calloc(js->axisCount, sizeof(float));
|
|
js->buttonCount = 14;
|
|
js->buttonCount = 14;
|
|
@@ -482,7 +482,7 @@ static GLFWbool openXinputDevice(DWORD index)
|
|
js->name = strdup(getDeviceDescription(&xic));
|
|
js->name = strdup(getDeviceDescription(&xic));
|
|
js->index = index;
|
|
js->index = index;
|
|
|
|
|
|
- _glfwInputJoystickChange(joy, GLFW_CONNECTED);
|
|
|
|
|
|
+ _glfwInputJoystickChange(jid, GLFW_CONNECTED);
|
|
|
|
|
|
return GLFW_TRUE;
|
|
return GLFW_TRUE;
|
|
}
|
|
}
|
|
@@ -675,10 +675,10 @@ void _glfwInitJoysticksWin32(void)
|
|
//
|
|
//
|
|
void _glfwTerminateJoysticksWin32(void)
|
|
void _glfwTerminateJoysticksWin32(void)
|
|
{
|
|
{
|
|
- int joy;
|
|
|
|
|
|
+ int jid;
|
|
|
|
|
|
- for (joy = GLFW_JOYSTICK_1; joy <= GLFW_JOYSTICK_LAST; joy++)
|
|
|
|
- closeJoystick(_glfw.win32_js + joy);
|
|
|
|
|
|
+ for (jid = GLFW_JOYSTICK_1; jid <= GLFW_JOYSTICK_LAST; jid++)
|
|
|
|
+ closeJoystick(_glfw.win32_js + jid);
|
|
|
|
|
|
if (_glfw.win32.dinput8.api)
|
|
if (_glfw.win32.dinput8.api)
|
|
IDirectInput8_Release(_glfw.win32.dinput8.api);
|
|
IDirectInput8_Release(_glfw.win32.dinput8.api);
|
|
@@ -715,10 +715,10 @@ void _glfwDetectJoystickConnectionWin32(void)
|
|
//
|
|
//
|
|
void _glfwDetectJoystickDisconnectionWin32(void)
|
|
void _glfwDetectJoystickDisconnectionWin32(void)
|
|
{
|
|
{
|
|
- int joy;
|
|
|
|
|
|
+ int jid;
|
|
|
|
|
|
- for (joy = GLFW_JOYSTICK_1; joy <= GLFW_JOYSTICK_LAST; joy++)
|
|
|
|
- pollJoystickState(_glfw.win32_js + joy, _GLFW_PRESENCE_ONLY);
|
|
|
|
|
|
+ for (jid = GLFW_JOYSTICK_1; jid <= GLFW_JOYSTICK_LAST; jid++)
|
|
|
|
+ pollJoystickState(_glfw.win32_js + jid, _GLFW_PRESENCE_ONLY);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -726,15 +726,15 @@ void _glfwDetectJoystickDisconnectionWin32(void)
|
|
////// GLFW platform API //////
|
|
////// GLFW platform API //////
|
|
//////////////////////////////////////////////////////////////////////////
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
-int _glfwPlatformJoystickPresent(int joy)
|
|
|
|
|
|
+int _glfwPlatformJoystickPresent(int jid)
|
|
{
|
|
{
|
|
- _GLFWjoystickWin32* js = _glfw.win32_js + joy;
|
|
|
|
|
|
+ _GLFWjoystickWin32* js = _glfw.win32_js + jid;
|
|
return pollJoystickState(js, _GLFW_PRESENCE_ONLY);
|
|
return pollJoystickState(js, _GLFW_PRESENCE_ONLY);
|
|
}
|
|
}
|
|
|
|
|
|
-const float* _glfwPlatformGetJoystickAxes(int joy, int* count)
|
|
|
|
|
|
+const float* _glfwPlatformGetJoystickAxes(int jid, int* count)
|
|
{
|
|
{
|
|
- _GLFWjoystickWin32* js = _glfw.win32_js + joy;
|
|
|
|
|
|
+ _GLFWjoystickWin32* js = _glfw.win32_js + jid;
|
|
if (!pollJoystickState(js, _GLFW_UPDATE_STATE))
|
|
if (!pollJoystickState(js, _GLFW_UPDATE_STATE))
|
|
return NULL;
|
|
return NULL;
|
|
|
|
|
|
@@ -742,9 +742,9 @@ const float* _glfwPlatformGetJoystickAxes(int joy, int* count)
|
|
return js->axes;
|
|
return js->axes;
|
|
}
|
|
}
|
|
|
|
|
|
-const unsigned char* _glfwPlatformGetJoystickButtons(int joy, int* count)
|
|
|
|
|
|
+const unsigned char* _glfwPlatformGetJoystickButtons(int jid, int* count)
|
|
{
|
|
{
|
|
- _GLFWjoystickWin32* js = _glfw.win32_js + joy;
|
|
|
|
|
|
+ _GLFWjoystickWin32* js = _glfw.win32_js + jid;
|
|
if (!pollJoystickState(js, _GLFW_UPDATE_STATE))
|
|
if (!pollJoystickState(js, _GLFW_UPDATE_STATE))
|
|
return NULL;
|
|
return NULL;
|
|
|
|
|
|
@@ -752,9 +752,9 @@ const unsigned char* _glfwPlatformGetJoystickButtons(int joy, int* count)
|
|
return js->buttons;
|
|
return js->buttons;
|
|
}
|
|
}
|
|
|
|
|
|
-const char* _glfwPlatformGetJoystickName(int joy)
|
|
|
|
|
|
+const char* _glfwPlatformGetJoystickName(int jid)
|
|
{
|
|
{
|
|
- _GLFWjoystickWin32* js = _glfw.win32_js + joy;
|
|
|
|
|
|
+ _GLFWjoystickWin32* js = _glfw.win32_js + jid;
|
|
if (!pollJoystickState(js, _GLFW_PRESENCE_ONLY))
|
|
if (!pollJoystickState(js, _GLFW_PRESENCE_ONLY))
|
|
return NULL;
|
|
return NULL;
|
|
|
|
|