Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Look at environment variables in SDL_VideoInit() and SDL_AudioInit()

  • Loading branch information
slouken committed Jul 15, 2006
1 parent e087cb9 commit f8d13eb2e825ad1d63386b5a8c9f44a69f04058a
Showing with 12 additions and 11 deletions.
  1. +2 −3 src/SDL.c
  2. +7 −8 src/audio/SDL_audio.c
  3. +3 −0 src/video/SDL_video.c
@@ -62,8 +62,7 @@ SDL_InitSubSystem(Uint32 flags)
#if !SDL_VIDEO_DISABLED
/* Initialize the video/event subsystem */
if ((flags & SDL_INIT_VIDEO) && !(SDL_initialized & SDL_INIT_VIDEO)) {
if (SDL_VideoInit(SDL_getenv("SDL_VIDEODRIVER"),
(flags & SDL_INIT_EVENTTHREAD)) < 0) {
if (SDL_VideoInit(NULL, (flags & SDL_INIT_EVENTTHREAD)) < 0) {
return (-1);
}
SDL_initialized |= SDL_INIT_VIDEO;
@@ -78,7 +77,7 @@ SDL_InitSubSystem(Uint32 flags)
#if !SDL_AUDIO_DISABLED
/* Initialize the audio subsystem */
if ((flags & SDL_INIT_AUDIO) && !(SDL_initialized & SDL_INIT_AUDIO)) {
if (SDL_AudioInit(SDL_getenv("SDL_AUDIODRIVER")) < 0) {
if (SDL_AudioInit(NULL) < 0) {
return (-1);
}
SDL_initialized |= SDL_INIT_AUDIO;
@@ -361,6 +361,9 @@ SDL_AudioInit(const char *driver_name)
/* Select the proper audio driver */
audio = NULL;
idx = 0;
if (driver_name == NULL) {
driver_name = SDL_getenv("SDL_AUDIODRIVER");
}
#if SDL_AUDIO_DRIVER_ESD
if ((driver_name == NULL) && (SDL_getenv("ESPEAKER") != NULL)) {
/* Ahem, we know that if ESPEAKER is set, user probably wants
@@ -393,11 +396,6 @@ SDL_AudioInit(const char *driver_name)
#endif /* SDL_AUDIO_DRIVER_ESD */
if (audio == NULL) {
if (driver_name != NULL) {
#if 0 /* This will be replaced with a better driver selection API */
if (SDL_strrchr(driver_name, ':') != NULL) {
idx = atoi(SDL_strrchr(driver_name, ':') + 1);
}
#endif
for (i = 0; bootstrap[i]; ++i) {
if (SDL_strncmp(bootstrap[i]->name, driver_name,
SDL_strlen(bootstrap[i]->name)) == 0) {
@@ -423,9 +421,10 @@ SDL_AudioInit(const char *driver_name)
} else {
SDL_SetError("No available audio device");
}
#if 0 /* Don't fail SDL_Init() if audio isn't available.
SDL_OpenAudio() will handle it at that point. *sigh*
*/
#if 0
/* Don't fail SDL_Init() if audio isn't available.
SDL_OpenAudio() will handle it at that point. *sigh*
*/
return (-1);
#endif
}
@@ -201,6 +201,9 @@ SDL_VideoInit(const char *driver_name, Uint32 flags)
/* Select the proper video driver */
index = 0;
video = NULL;
if (driver_name == NULL) {
driver_name = SDL_getenv("SDL_VIDEODRIVER");
}
if (driver_name != NULL) {
for (i = 0; bootstrap[i]; ++i) {
if (SDL_strncmp(bootstrap[i]->name, driver_name,

0 comments on commit f8d13eb

Please sign in to comment.