summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Howard2007-02-23 23:26:26 +0000
committerSimon Howard2007-02-23 23:26:26 +0000
commitf49a12791fc4a4b20a1c4a15784f2f2a4b62fcb9 (patch)
tree9a9b04169bef2a791690e2adafbb84c726b5271d /src
parente6d0591bd0674b0c56da7ca92a3721fa48aa1464 (diff)
downloadchocolate-doom-f49a12791fc4a4b20a1c4a15784f2f2a4b62fcb9.tar.gz
chocolate-doom-f49a12791fc4a4b20a1c4a15784f2f2a4b62fcb9.tar.bz2
chocolate-doom-f49a12791fc4a4b20a1c4a15784f2f2a4b62fcb9.zip
Add a configuration file value to allow the SDL video driver to be
explicitly specified. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 838
Diffstat (limited to 'src')
-rw-r--r--src/i_video.c59
-rw-r--r--src/i_video.h1
-rw-r--r--src/m_misc.c1
3 files changed, 42 insertions, 19 deletions
diff --git a/src/i_video.c b/src/i_video.c
index 88370024..0e66154e 100644
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -67,6 +67,10 @@ enum
extern void M_QuitDOOM();
+// SDL video driver name
+
+char *video_driver = "";
+
static SDL_Surface *screen;
// palette
@@ -1100,28 +1104,19 @@ static void CreateCursors(void)
1, 1, 0, 0);
}
-void I_InitGraphics(void)
+static void SetSDLVideoDriver(void)
{
- SDL_Event dummy;
- byte *doompal;
- int flags = 0;
- char *env;
-
- // Pass through the XSCREENSAVER_WINDOW environment variable to
- // SDL_WINDOWID, to embed the SDL window into the Xscreensaver
- // window.
-
- env = getenv("XSCREENSAVER_WINDOW");
+ // Allow a default value for the SDL video driver to be specified
+ // in the configuration file.
- if (env != NULL)
+ if (strcmp(video_driver, "") != 0)
{
- char winenv[30];
- int winid;
-
- sscanf(env, "0x%x", &winid);
- sprintf(winenv, "SDL_WINDOWID=%i", winid);
+ char *env_string;
- putenv(winenv);
+ env_string = malloc(strlen(video_driver) + 30);
+ sprintf(env_string, "SDL_VIDEODRIVER=%s", env_string);
+ putenv(env_string);
+ free(env_string);
}
#ifdef _WIN32
@@ -1152,8 +1147,34 @@ void I_InitGraphics(void)
{
putenv("SDL_VIDEODRIVER=directx");
}
-
#endif
+}
+
+void I_InitGraphics(void)
+{
+ SDL_Event dummy;
+ byte *doompal;
+ int flags = 0;
+ char *env;
+
+ // Pass through the XSCREENSAVER_WINDOW environment variable to
+ // SDL_WINDOWID, to embed the SDL window into the Xscreensaver
+ // window.
+
+ env = getenv("XSCREENSAVER_WINDOW");
+
+ if (env != NULL)
+ {
+ char winenv[30];
+ int winid;
+
+ sscanf(env, "0x%x", &winid);
+ sprintf(winenv, "SDL_WINDOWID=%i", winid);
+
+ putenv(winenv);
+ }
+
+ SetSDLVideoDriver();
if (SDL_Init(SDL_INIT_VIDEO) < 0)
{
diff --git a/src/i_video.h b/src/i_video.h
index e4e73041..a9d7faa1 100644
--- a/src/i_video.h
+++ b/src/i_video.h
@@ -60,6 +60,7 @@ void I_SetWindowIcon(void);
void I_CheckIsScreensaver(void);
+extern char *video_driver;
extern int autoadjust_video_settings;
extern boolean screenvisible;
extern int screenmultiply;
diff --git a/src/m_misc.c b/src/m_misc.c
index 481539dc..9aaa0322 100644
--- a/src/m_misc.c
+++ b/src/m_misc.c
@@ -408,6 +408,7 @@ static default_t extra_defaults_list[] =
{"show_endoom", &show_endoom, DEFAULT_INT, 0, 0},
{"vanilla_savegame_limit", &vanilla_savegame_limit, DEFAULT_INT, 0, 0},
{"vanilla_demo_limit", &vanilla_demo_limit, DEFAULT_INT, 0, 0},
+ {"video_driver", &video_driver, DEFAULT_STRING, 0, 0},
#ifdef FEATURE_MULTIPLAYER
{"player_name", &net_player_name, DEFAULT_STRING, 0, 0},
#endif