<commit_before>#include "SDLJoystick.h"


namespace lime {
	
	
	static SDL_Joystick* accelerometer = 0;
	static SDL_JoystickID accelerometerID = -1;
	std::map<int, SDL_Joystick*> joysticks = std::map<int, SDL_Joystick*> ();
	
	
	bool SDLJoystick::Connect (int id) {
		
		if (id != accelerometerID) {
			
			SDL_Joystick* joystick = SDL_JoystickOpen (id);
			
			if (joystick) {
				
				joysticks[id] = joystick;
				return true;
				
			}
			
		}
		
		return false;
		
	}
	
	
	bool SDLJoystick::Disconnect (int id) {
		
		if (joysticks.find (id) != joysticks.end ()) {
			
			SDL_Joystick* joystick = joysticks[id];
			SDL_JoystickClose (joystick);
			joysticks.erase (id);
			
			return true;
			
		}
		
		return false;
		
	}
	
	
	int SDLJoystick::GetInstanceID (int deviceID) {
		
		return SDL_JoystickInstanceID (joysticks[deviceID]);
		
	}
	
	
	void SDLJoystick::Init () {
		
		#if defined(IOS) || defined(ANDROID) || defined(TVOS)
		for (int i = 0; i < SDL_NumJoysticks (); i++) {
			
			if (strstr (SDL_JoystickNameForIndex (i), "Accelerometer")) {<commit_msg>Fix the IOS Accelerometer which wasn't fully linked to lime<commit_after>#include "SDLJoystick.h"


namespace lime {
	
	
	static SDL_Joystick* accelerometer = 0;
	static SDL_JoystickID accelerometerID = -1;
	std::map<int, SDL_Joystick*> joysticks = std::map<int, SDL_Joystick*> ();
	
	
	bool SDLJoystick::Connect (int id) {
		
		if (id != accelerometerID) {
			
			SDL_Joystick* joystick = SDL_JoystickOpen (id);
			
			if (joystick) {
				
				joysticks[id] = joystick;
				return true;
				
			}
			
		}
		
		return false;
		
	}
	
	
	bool SDLJoystick::Disconnect (int id) {
		
		if (joysticks.find (id) != joysticks.end ()) {
			
			SDL_Joystick* joystick = joysticks[id];
			SDL_JoystickClose (joystick);
			joysticks.erase (id);
			
			return true;
			
		}
		
		return false;
		
	}
	
	
	int SDLJoystick::GetInstanceID (int deviceID) {
		
		return SDL_JoystickInstanceID (joysticks[deviceID]);
		
	}
	
	
	void SDLJoystick::Init () {
		
		#if defined(IPHONE) || defined(ANDROID) || defined(TVOS)
		for (int i = 0; i < SDL_NumJoysticks (); i++) {
			
			if (strstr (SDL_JoystickNameForIndex (i), "Accelerometer")) {
{'fraction_non_alphanumeric': 0.12597343105817682, 'fraction_numerical': 0.002748511223087494, 'mean_word_length': 3.074626865671642, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2125015', 'n_tokens_mistral': 1049, 'n_tokens_neox': 770, 'n_words': 169}