driver.c
author celestar
Thu, 28 Jul 2005 06:09:15 +0000
changeset 2214 75d037f8dcc4
parent 2210 58a293892a66
child 2219 a62bfd598c83
permissions -rw-r--r--
(svn r2732) -Codechange: Cleaned the order flags some more. Hit some inconsistencies while trying to locate bug 1244167
2186
461a2aff3486 (svn r2701) Insert Id tags into all source files
tron
parents: 2171
diff changeset
     1
/* $Id$ */
461a2aff3486 (svn r2701) Insert Id tags into all source files
tron
parents: 2171
diff changeset
     2
2171
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
     3
#include "stdafx.h"
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
     4
#include "openttd.h"
2210
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
     5
#include "debug.h"
2171
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
     6
#include "driver.h"
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
     7
#include "functions.h"
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
     8
#include "hal.h"
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
     9
#include "string.h"
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    10
2210
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
    11
#include "music/bemidi.h"
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
    12
#include "music/dmusic.h"
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
    13
#include "music/extmidi.h"
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
    14
#include "music/null_m.h"
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
    15
#include "music/os2_m.h"
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
    16
#include "music/win32_m.h"
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
    17
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
    18
#include "sound/null_s.h"
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
    19
#include "sound/sdl_s.h"
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
    20
#include "sound/win32_s.h"
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
    21
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
    22
#include "video/dedicated_v.h"
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
    23
#include "video/null_v.h"
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
    24
#include "video/sdl_v.h"
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
    25
#include "video/win32_v.h"
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
    26
2171
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    27
typedef struct {
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    28
	const DriverDesc *descs;
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    29
	const char *name;
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    30
	void *var;
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    31
} DriverClass;
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    32
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    33
static DriverClass _driver_classes[] = {
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    34
	{_video_driver_descs, "video", &_video_driver},
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    35
	{_sound_driver_descs, "sound", &_sound_driver},
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    36
	{_music_driver_descs, "music", &_music_driver},
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    37
};
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    38
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    39
enum {
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    40
	DF_PRIORITY_MASK = 0xF,
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    41
};
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    42
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    43
static const DriverDesc* GetDriverByName(const DriverDesc* dd, const char* name)
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    44
{
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    45
	for (; dd->name != NULL; dd++) {
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    46
		if (strcmp(dd->name, name) == 0) return dd;
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    47
	}
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    48
	return NULL;
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    49
}
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    50
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    51
void LoadDriver(int driver, const char *name)
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    52
{
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    53
	const DriverClass *dc = &_driver_classes[driver];
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    54
	const DriverDesc *dd;
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    55
	const void **var;
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    56
	const void *drv;
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    57
	const char *err;
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    58
	char *parm;
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    59
	char buffer[256];
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    60
	const char *parms[32];
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    61
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    62
	parms[0] = NULL;
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    63
2210
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
    64
	if (*name == '\0') {
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
    65
		for (dd = dc->descs; dd->name != NULL; dd++) {
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
    66
			err = ((const HalCommonDriver*)dd->drv)->start(parms);
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
    67
			if (err == NULL) break;
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
    68
			DEBUG(driver, 1) ("Probing %s driver \"%s\" failed with error: %s",
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
    69
				dc->name, dd->name, err
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
    70
			);
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
    71
		}
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
    72
		if (dd->name == NULL) {
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
    73
			error("Couldn't find any suitable %s driver", dc->name);
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
    74
		}
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
    75
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
    76
		DEBUG(driver, 1)
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
    77
			("Successfully probed %s driver \"%s\"", dc->name, dd->name);
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
    78
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
    79
		var = dc->var;
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
    80
		*var = dd->drv;
2171
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    81
	} else {
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    82
		// Extract the driver name and put parameter list in parm
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    83
		ttd_strlcpy(buffer, name, sizeof(buffer));
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    84
		parm = strchr(buffer, ':');
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    85
		if (parm) {
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    86
			uint np = 0;
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    87
			// Tokenize the parm.
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    88
			do {
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    89
				*parm++ = 0;
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    90
				if (np < lengthof(parms) - 1)
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    91
					parms[np++] = parm;
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    92
				while (*parm != 0 && *parm != ',')
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    93
					parm++;
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    94
			} while (*parm == ',');
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    95
			parms[np] = NULL;
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    96
		}
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    97
		dd = GetDriverByName(dc->descs, buffer);
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    98
		if (dd == NULL)
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
    99
			error("No such %s driver: %s\n", dc->name, buffer);
2210
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   100
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   101
		var = dc->var;
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   102
		if (*var != NULL) ((const HalCommonDriver*)*var)->stop();
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   103
		*var = NULL;
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   104
		drv = dd->drv;
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   105
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   106
		err = ((const HalCommonDriver*)drv)->start(parms);
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   107
		if (err != NULL) {
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   108
			error("Unable to load driver %s(%s). The error was: %s\n",
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   109
				dd->name, dd->longname, err
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   110
			);
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   111
		}
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   112
		*var = drv;
2171
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
   113
	}
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
   114
}
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
   115
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
   116
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
   117
static const char* GetDriverParam(const char* const* parm, const char* name)
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
   118
{
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
   119
	uint len = strlen(name);
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
   120
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
   121
	for (; *parm != NULL; parm++) {
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
   122
		const char* p = *parm;
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
   123
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
   124
		if (strncmp(p, name, len) == 0) {
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
   125
			if (p[len] == '=')  return p + len + 1;
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
   126
			if (p[len] == '\0') return p + len;
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
   127
		}
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
   128
	}
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
   129
	return NULL;
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
   130
}
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
   131
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
   132
bool GetDriverParamBool(const char* const* parm, const char* name)
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
   133
{
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
   134
	return GetDriverParam(parm, name) != NULL;
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
   135
}
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
   136
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
   137
int GetDriverParamInt(const char* const* parm, const char* name, int def)
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
   138
{
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
   139
	const char* p = GetDriverParam(parm, name);
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
   140
	return p != NULL ? atoi(p) : def;
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
   141
}
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
   142
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
   143
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
   144
void GetDriverList(char* p)
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
   145
{
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
   146
	const DriverClass* dc;
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
   147
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
   148
	for (dc = _driver_classes; dc != endof(_driver_classes); dc++) {
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
   149
		const DriverDesc* dd;
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
   150
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
   151
		p += sprintf(p, "List of %s drivers:\n", dc->name);
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
   152
		for (dd = dc->descs; dd->name != NULL; dd++) {
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
   153
			p += sprintf(p, "%10s: %s\n", dd->name, dd->longname);
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
   154
		}
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
   155
	}
008122046f7f (svn r2685) -Codechange: Split the music/sound/video drivers into separate files and move them into subfolders.
tron
parents:
diff changeset
   156
}
2210
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   157
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   158
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   159
const DriverDesc _music_driver_descs[] = {
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   160
#ifdef __BEOS__
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   161
	{ "bemidi",  "BeOS MIDI Driver",        &_bemidi_music_driver },
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   162
#endif
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   163
#ifdef __OS2__
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   164
	{ "os2",     "OS/2 Music Driver",       &_os2_music_driver},
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   165
#endif
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   166
#ifdef WIN32_ENABLE_DIRECTMUSIC_SUPPORT
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   167
	{ "dmusic",  "DirectMusic MIDI Driver", &_dmusic_midi_driver },
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   168
#endif
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   169
#ifdef WIN32
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   170
	{ "win32",   "Win32 MIDI Driver",       &_win32_music_driver },
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   171
#endif
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   172
#ifdef UNIX
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   173
#if !defined(__BEOS__) && !defined(__MORPHOS__) && !defined(__AMIGA__)
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   174
	{ "extmidi", "External MIDI Driver",    &_extmidi_music_driver },
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   175
#endif
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   176
#endif
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   177
	{ "null",    "Null Music Driver",       &_null_music_driver },
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   178
	{ NULL, NULL, NULL}
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   179
};
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   180
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   181
const DriverDesc _sound_driver_descs[] = {
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   182
#ifdef WIN32
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   183
	{ "win32", "Win32 WaveOut Driver", &_win32_sound_driver },
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   184
#endif
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   185
#ifdef WITH_SDL
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   186
	{	"sdl",   "SDL Sound Driver",     &_sdl_sound_driver },
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   187
#endif
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   188
	{	"null",  "Null Sound Driver",    &_null_sound_driver },
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   189
	{	NULL, NULL, NULL}
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   190
};
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   191
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   192
const DriverDesc _video_driver_descs[] = {
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   193
#ifdef WIN32
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   194
	{ "win32",      "Win32 GDI Video Driver", &_win32_video_driver },
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   195
#endif
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   196
#ifdef WITH_SDL
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   197
	{ "sdl",        "SDL Video Driver",       &_sdl_video_driver },
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   198
#endif
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   199
	{ "null",       "Null Video Driver",      &_null_video_driver},
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   200
#ifdef ENABLE_NETWORK
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   201
	{ "dedicated",	"Dedicated Video Driver",	&_dedicated_video_driver},
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   202
#endif
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   203
	{ NULL, NULL, NULL}
58a293892a66 (svn r2728) -Fix/Feature: Change the driver probing algorithm
tron
parents: 2186
diff changeset
   204
};