Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 93990
Collapse All | Expand All

(-)trackballs-1.1.0/src/settings.cc (-8 / +17 lines)
Lines 196-209 Link Here
196
}
196
}
197
197
198
int Settings::hasJoystick() { 
198
int Settings::hasJoystick() { 
199
  if(!Settings::settings->joystickIndex) return 0;
199
	if (SDL_NumJoysticks() > 0) 
200
200
	{ 
201
  if(!joystick) 
201
	joystick=SDL_JoystickOpen(0); 
202
	joystick = SDL_JoystickOpen(Settings::settings->joystickIndex-1);  
202
	if (joystick) 
203
  if(!joystick) {
203
	{ 
204
	printf("Warning, failed to open joystick no. %d\n",Settings::settings->joystickIndex-1);
204
		SDL_JoystickEventState(SDL_ENABLE); 
205
	joystickIndex=0;
205
		Settings::settings->joystickIndex = 1; 
206
  }
206
		Settings::save(); 
207
		return 1; 
208
	} 
209
	else 
210
	{ 
211
		printf("Warning, failed to open joystick no. %d\n",Settings::settings->joystickIndex-1); 
212
		joystickIndex=0; 
213
		return 0; 
214
	} 
215
} 
207
  return joystickIndex; 
216
  return joystickIndex; 
208
}
217
}
209
void Settings::closeJoystick() { if(joystick) SDL_JoystickClose(joystick); joystick=NULL; }
218
void Settings::closeJoystick() { if(joystick) SDL_JoystickClose(joystick); joystick=NULL; }

Return to bug 93990