src/joystick/iphoneos/SDL_sysjoystick.m
changeset 11846 a1b2d62d5d73
parent 11845 cf80a56f6d8d
child 11923 96f71726c0b2
equal deleted inserted replaced
11845:cf80a56f6d8d 11846:a1b2d62d5d73
    58 
    58 
    59 static SDL_JoystickDeviceItem *deviceList = NULL;
    59 static SDL_JoystickDeviceItem *deviceList = NULL;
    60 
    60 
    61 static int numjoysticks = 0;
    61 static int numjoysticks = 0;
    62 static SDL_JoystickID instancecounter = 0;
    62 static SDL_JoystickID instancecounter = 0;
       
    63 int SDL_AppleTVRemoteOpenedAsJoystick = 0;
    63 
    64 
    64 static SDL_JoystickDeviceItem *
    65 static SDL_JoystickDeviceItem *
    65 GetDeviceForIndex(int device_index)
    66 GetDeviceForIndex(int device_index)
    66 {
    67 {
    67     SDL_JoystickDeviceItem *device = deviceList;
    68     SDL_JoystickDeviceItem *device = deviceList;
   114         device->guid.data[10] = 2;
   115         device->guid.data[10] = 2;
   115     }
   116     }
   116 #if TARGET_OS_TV
   117 #if TARGET_OS_TV
   117     else if (controller.microGamepad) {
   118     else if (controller.microGamepad) {
   118         device->guid.data[10] = 3;
   119         device->guid.data[10] = 3;
       
   120         device->remote = SDL_TRUE;
   119     }
   121     }
   120 #endif /* TARGET_OS_TV */
   122 #endif /* TARGET_OS_TV */
   121 
   123 
   122     if (controller.extendedGamepad) {
   124     if (controller.extendedGamepad) {
   123         device->naxes = 6; /* 2 thumbsticks and 2 triggers */
   125         device->naxes = 6; /* 2 thumbsticks and 2 triggers */
   453                 }
   455                 }
   454             };
   456             };
   455 #endif /* SDL_JOYSTICK_MFI */
   457 #endif /* SDL_JOYSTICK_MFI */
   456         }
   458         }
   457     }
   459     }
       
   460     if (device->remote) {
       
   461         ++SDL_AppleTVRemoteOpenedAsJoystick;
       
   462     }
   458 
   463 
   459     return 0;
   464     return 0;
   460 }
   465 }
   461 
   466 
   462 /* Function to determine if this joystick is attached to the system right now */
   467 /* Function to determine if this joystick is attached to the system right now */
   717             controller.controllerPausedHandler = nil;
   722             controller.controllerPausedHandler = nil;
   718             controller.playerIndex = -1;
   723             controller.playerIndex = -1;
   719 #endif
   724 #endif
   720         }
   725         }
   721     }
   726     }
       
   727     if (device->remote) {
       
   728         --SDL_AppleTVRemoteOpenedAsJoystick;
       
   729     }
   722 }
   730 }
   723 
   731 
   724 /* Function to perform any system-specific joystick related cleanup */
   732 /* Function to perform any system-specific joystick related cleanup */
   725 void
   733 void
   726 SDL_SYS_JoystickQuit(void)
   734 SDL_SYS_JoystickQuit(void)