src/joystick/iphoneos/SDL_sysjoystick.m
changeset 11846 a1b2d62d5d73
parent 11845 cf80a56f6d8d
child 11923 96f71726c0b2
     1.1 --- a/src/joystick/iphoneos/SDL_sysjoystick.m	Tue Feb 06 15:03:38 2018 -0800
     1.2 +++ b/src/joystick/iphoneos/SDL_sysjoystick.m	Tue Feb 06 16:43:31 2018 -0800
     1.3 @@ -60,6 +60,7 @@
     1.4  
     1.5  static int numjoysticks = 0;
     1.6  static SDL_JoystickID instancecounter = 0;
     1.7 +int SDL_AppleTVRemoteOpenedAsJoystick = 0;
     1.8  
     1.9  static SDL_JoystickDeviceItem *
    1.10  GetDeviceForIndex(int device_index)
    1.11 @@ -116,6 +117,7 @@
    1.12  #if TARGET_OS_TV
    1.13      else if (controller.microGamepad) {
    1.14          device->guid.data[10] = 3;
    1.15 +        device->remote = SDL_TRUE;
    1.16      }
    1.17  #endif /* TARGET_OS_TV */
    1.18  
    1.19 @@ -455,6 +457,9 @@
    1.20  #endif /* SDL_JOYSTICK_MFI */
    1.21          }
    1.22      }
    1.23 +    if (device->remote) {
    1.24 +        ++SDL_AppleTVRemoteOpenedAsJoystick;
    1.25 +    }
    1.26  
    1.27      return 0;
    1.28  }
    1.29 @@ -719,6 +724,9 @@
    1.30  #endif
    1.31          }
    1.32      }
    1.33 +    if (device->remote) {
    1.34 +        --SDL_AppleTVRemoteOpenedAsJoystick;
    1.35 +    }
    1.36  }
    1.37  
    1.38  /* Function to perform any system-specific joystick related cleanup */