Camilla Löwy 8 سال پیش
والد
کامیت
e7722af9a2
3فایلهای تغییر یافته به همراه12 افزوده شده و 12 حذف شده
  1. 4 4
      src/cocoa_joystick.m
  2. 2 2
      src/linux_joystick.c
  3. 6 6
      src/win32_joystick.c

+ 4 - 4
src/cocoa_joystick.m

@@ -274,13 +274,13 @@ static void matchCallback(void* context,
     _GLFWjoystickNS* js;
     int jid;
 
-    for (jid = GLFW_JOYSTICK_1;  jid <= GLFW_JOYSTICK_LAST;  jid++)
+    for (jid = 0;  jid <= GLFW_JOYSTICK_LAST;  jid++)
     {
         if (_glfw.ns_js[jid].present && _glfw.ns_js[jid].deviceRef == deviceRef)
             return;
     }
 
-    for (jid = GLFW_JOYSTICK_1;  jid <= GLFW_JOYSTICK_LAST;  jid++)
+    for (jid = 0;  jid <= GLFW_JOYSTICK_LAST;  jid++)
     {
         if (!_glfw.ns_js[jid].present)
             break;
@@ -336,7 +336,7 @@ static void removeCallback(void* context,
 {
     int jid;
 
-    for (jid = GLFW_JOYSTICK_1;  jid <= GLFW_JOYSTICK_LAST;  jid++)
+    for (jid = 0;  jid <= GLFW_JOYSTICK_LAST;  jid++)
     {
         if (_glfw.ns_js[jid].deviceRef == deviceRef)
         {
@@ -458,7 +458,7 @@ void _glfwTerminateJoysticksNS(void)
 {
     int jid;
 
-    for (jid = GLFW_JOYSTICK_1;  jid <= GLFW_JOYSTICK_LAST;  jid++)
+    for (jid = 0;  jid <= GLFW_JOYSTICK_LAST;  jid++)
     {
         _GLFWjoystickNS* js = _glfw.ns_js + jid;
         removeJoystick(js);

+ 2 - 2
src/linux_joystick.c

@@ -53,7 +53,7 @@ static GLFWbool openJoystickDevice(const char* path)
     int jid, fd, version;
     _GLFWjoystickLinux* js;
 
-    for (jid = GLFW_JOYSTICK_1;  jid <= GLFW_JOYSTICK_LAST;  jid++)
+    for (jid = 0;  jid <= GLFW_JOYSTICK_LAST;  jid++)
     {
         if (!_glfw.linux_js.js[jid].present)
             continue;
@@ -62,7 +62,7 @@ static GLFWbool openJoystickDevice(const char* path)
             return GLFW_FALSE;
     }
 
-    for (jid = GLFW_JOYSTICK_1;  jid <= GLFW_JOYSTICK_LAST;  jid++)
+    for (jid = 0;  jid <= GLFW_JOYSTICK_LAST;  jid++)
     {
         if (!_glfw.linux_js.js[jid].present)
             break;

+ 6 - 6
src/win32_joystick.c

@@ -339,13 +339,13 @@ static BOOL CALLBACK deviceCallback(const DIDEVICEINSTANCE* di, void* user)
     _GLFWobjenumWin32 data;
     _GLFWjoystickWin32* js;
 
-    for (jid = GLFW_JOYSTICK_1;  jid <= GLFW_JOYSTICK_LAST;  jid++)
+    for (jid = 0;  jid <= GLFW_JOYSTICK_LAST;  jid++)
     {
         if (memcmp(&_glfw.win32_js[jid].guid, &di->guidInstance, sizeof(GUID)) == 0)
             return DIENUM_CONTINUE;
     }
 
-    for (jid = GLFW_JOYSTICK_1;  jid <= GLFW_JOYSTICK_LAST;  jid++)
+    for (jid = 0;  jid <= GLFW_JOYSTICK_LAST;  jid++)
     {
         if (!_glfw.win32_js[jid].present)
             break;
@@ -451,7 +451,7 @@ static GLFWbool openXinputDevice(DWORD index)
     XINPUT_CAPABILITIES xic;
     _GLFWjoystickWin32* js;
 
-    for (jid = GLFW_JOYSTICK_1;  jid <= GLFW_JOYSTICK_LAST;  jid++)
+    for (jid = 0;  jid <= GLFW_JOYSTICK_LAST;  jid++)
     {
         if (_glfw.win32_js[jid].present &&
             _glfw.win32_js[jid].device == NULL &&
@@ -461,7 +461,7 @@ static GLFWbool openXinputDevice(DWORD index)
         }
     }
 
-    for (jid = GLFW_JOYSTICK_1;  jid <= GLFW_JOYSTICK_LAST;  jid++)
+    for (jid = 0;  jid <= GLFW_JOYSTICK_LAST;  jid++)
     {
         if (!_glfw.win32_js[jid].present)
             break;
@@ -679,7 +679,7 @@ void _glfwTerminateJoysticksWin32(void)
 {
     int jid;
 
-    for (jid = GLFW_JOYSTICK_1;  jid <= GLFW_JOYSTICK_LAST;  jid++)
+    for (jid = 0;  jid <= GLFW_JOYSTICK_LAST;  jid++)
         closeJoystick(_glfw.win32_js + jid);
 
     if (_glfw.win32.dinput8.api)
@@ -719,7 +719,7 @@ void _glfwDetectJoystickDisconnectionWin32(void)
 {
     int jid;
 
-    for (jid = GLFW_JOYSTICK_1;  jid <= GLFW_JOYSTICK_LAST;  jid++)
+    for (jid = 0;  jid <= GLFW_JOYSTICK_LAST;  jid++)
         pollJoystickState(_glfw.win32_js + jid, _GLFW_PRESENCE_ONLY);
 }