(SDL) Fix double initialization

Signed-off-by: Higor Eurípedes <heuripedes@gmail.com>
This commit is contained in:
Higor Eurípedes 2014-08-15 19:25:27 -03:00
parent 0f7c67daab
commit e88f3b4355
3 changed files with 15 additions and 6 deletions

View File

@ -60,8 +60,11 @@ static inline int find_num_frames(int rate, int latency)
static void *sdl_audio_init(const char *device, unsigned rate, unsigned latency)
{
(void)device;
if (SDL_WasInit(0) == 0 && SDL_Init(SDL_INIT_AUDIO) < 0)
return NULL;
if (SDL_WasInit(0) == 0)
{
if (SDL_Init(SDL_INIT_AUDIO) < 0)
return NULL;
}
else if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0)
return NULL;

View File

@ -369,8 +369,11 @@ static void *sdl2_gfx_init(const video_info_t *video, const input_driver_t **inp
int i;
if (SDL_WasInit(0) == 0 && SDL_Init(SDL_INIT_VIDEO) < 0)
return NULL;
if (SDL_WasInit(0) == 0)
{
if (SDL_Init(SDL_INIT_VIDEO) < 0)
return NULL;
}
else if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0)
return NULL;

View File

@ -124,8 +124,11 @@ static void sdl_joypad_destroy(void)
static bool sdl_joypad_init(void)
{
unsigned i;
if (SDL_WasInit(0) == 0 && SDL_Init(SDL_INIT_JOYSTICK) < 0)
return false;
if (SDL_WasInit(0) == 0)
{
if (SDL_Init(SDL_INIT_JOYSTICK) < 0)
return false;
}
else if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) < 0)
return false;