2005-07-24 14:12:37 +00:00
|
|
|
/* $Id$ */
|
|
|
|
|
2007-02-23 18:55:07 +00:00
|
|
|
/** @file driver.cpp */
|
|
|
|
|
2005-07-23 15:16:57 +00:00
|
|
|
#include "stdafx.h"
|
|
|
|
#include "openttd.h"
|
2005-07-27 19:57:12 +00:00
|
|
|
#include "debug.h"
|
2005-07-23 15:16:57 +00:00
|
|
|
#include "driver.h"
|
|
|
|
|
2007-07-05 12:23:54 +00:00
|
|
|
#include "sound/sound_driver.hpp"
|
|
|
|
#include "music/music_driver.hpp"
|
|
|
|
#include "video/video_driver.hpp"
|
2005-07-23 15:16:57 +00:00
|
|
|
|
2008-01-13 21:41:24 +00:00
|
|
|
VideoDriver *_video_driver;
|
|
|
|
char _ini_videodriver[32];
|
|
|
|
int _num_resolutions;
|
|
|
|
uint16 _resolutions[32][2];
|
|
|
|
uint16 _cur_resolution[2];
|
|
|
|
|
2007-07-05 12:23:54 +00:00
|
|
|
SoundDriver *_sound_driver;
|
2008-01-13 21:41:24 +00:00
|
|
|
char _ini_sounddriver[32];
|
|
|
|
|
2007-07-05 12:23:54 +00:00
|
|
|
MusicDriver *_music_driver;
|
2008-01-13 21:41:24 +00:00
|
|
|
char _ini_musicdriver[32];
|
|
|
|
|
|
|
|
char _ini_blitter[32];
|
2005-07-23 15:16:57 +00:00
|
|
|
|
|
|
|
static const char* GetDriverParam(const char* const* parm, const char* name)
|
|
|
|
{
|
2005-09-25 09:04:59 +00:00
|
|
|
size_t len;
|
2005-07-29 06:20:28 +00:00
|
|
|
|
|
|
|
if (parm == NULL) return NULL;
|
2005-07-23 15:16:57 +00:00
|
|
|
|
2005-07-29 06:20:28 +00:00
|
|
|
len = strlen(name);
|
2005-07-23 15:16:57 +00:00
|
|
|
for (; *parm != NULL; parm++) {
|
|
|
|
const char* p = *parm;
|
|
|
|
|
|
|
|
if (strncmp(p, name, len) == 0) {
|
|
|
|
if (p[len] == '=') return p + len + 1;
|
|
|
|
if (p[len] == '\0') return p + len;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool GetDriverParamBool(const char* const* parm, const char* name)
|
|
|
|
{
|
|
|
|
return GetDriverParam(parm, name) != NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
int GetDriverParamInt(const char* const* parm, const char* name, int def)
|
|
|
|
{
|
|
|
|
const char* p = GetDriverParam(parm, name);
|
|
|
|
return p != NULL ? atoi(p) : def;
|
|
|
|
}
|