mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-26 22:44:30 -04:00
don't exit if joystick initialization failed, better report SDL_Init errors (#229)
This commit is contained in:
parent
8ae8e25b33
commit
ded6543817
@ -35,7 +35,7 @@
|
|||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
|
|
||||||
// haleyjd: SDL init flags
|
// haleyjd: SDL init flags
|
||||||
#define BASE_INIT_FLAGS (SDL_INIT_VIDEO | SDL_INIT_JOYSTICK)
|
#define BASE_INIT_FLAGS SDL_INIT_VIDEO
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
#define INIT_FLAGS (BASE_INIT_FLAGS | SDL_INIT_NOPARACHUTE)
|
#define INIT_FLAGS (BASE_INIT_FLAGS | SDL_INIT_NOPARACHUTE)
|
||||||
@ -51,7 +51,7 @@ int main(int argc, char **argv)
|
|||||||
// haleyjd: init SDL
|
// haleyjd: init SDL
|
||||||
if(SDL_Init(INIT_FLAGS) == -1)
|
if(SDL_Init(INIT_FLAGS) == -1)
|
||||||
{
|
{
|
||||||
puts("Failed to initialize SDL library.\n");
|
printf("Failed to initialize SDL library: %s\n", SDL_GetError());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -669,9 +669,10 @@ void I_InitSound(void)
|
|||||||
audio_buffers = SAMPLECOUNT * snd_samplerate / 11025;
|
audio_buffers = SAMPLECOUNT * snd_samplerate / 11025;
|
||||||
|
|
||||||
// haleyjd: the docs say we should do this
|
// haleyjd: the docs say we should do this
|
||||||
if(SDL_InitSubSystem(SDL_INIT_AUDIO))
|
// In SDL2, SDL_InitSubSystem() and SDL_Init() are interchangeable.
|
||||||
|
if (SDL_Init(SDL_INIT_AUDIO) < 0)
|
||||||
{
|
{
|
||||||
printf("Couldn't initialize SDL audio.\n");
|
printf("Couldn't initialize SDL audio: %s\n", SDL_GetError());
|
||||||
snd_card = 0;
|
snd_card = 0;
|
||||||
mus_card = 0;
|
mus_card = 0;
|
||||||
return;
|
return;
|
||||||
|
@ -170,6 +170,7 @@ void I_InitJoystick(void)
|
|||||||
|
|
||||||
if (SDL_Init(SDL_INIT_JOYSTICK) < 0)
|
if (SDL_Init(SDL_INIT_JOYSTICK) < 0)
|
||||||
{
|
{
|
||||||
|
printf("Failed to initialize joystick: %s\n", SDL_GetError());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user