aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2007-12-12 03:46:43 -0800
committerChris Robinson <[email protected]>2007-12-12 03:46:43 -0800
commitba0252661237768f0da2634271de3ce18f731ec2 (patch)
tree702d59b417fc5a2ebf12a7d507604f0e2a76e96e /Alc
parent7ade93e38c531c9d252a7ebf05065c7e3fc928ff (diff)
Implement "drivers" config option
Diffstat (limited to 'Alc')
-rw-r--r--Alc/ALc.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index d7d8f493..a721f0de 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -191,11 +191,52 @@ static void InitAL(void)
if(!done)
{
int i;
+ const char *devs;
InitializeCriticalSection(&g_mutex);
ALTHUNK_INIT();
ReadALConfig();
+ devs = GetConfigValue(NULL, "drivers", "");
+ if(devs[0])
+ {
+ int n;
+ size_t len;
+ const char *next = devs;
+
+ i = 0;
+
+ do {
+ devs = next;
+ next = strchr(devs, ',');
+
+ if(!devs[0] || devs[0] == ',')
+ continue;
+
+ len = (next ? ((size_t)(next-devs)) : strlen(devs));
+ for(n = i;BackendList[n].Init;n++)
+ {
+ if(len == strlen(BackendList[n].name) &&
+ strncmp(BackendList[n].name, devs, len) == 0)
+ {
+ const char *name = BackendList[i].name;
+ void (*Init)(BackendFuncs*) = BackendList[i].Init;
+
+ BackendList[i].name = BackendList[n].name;
+ BackendList[i].Init = BackendList[n].Init;
+
+ BackendList[n].name = name;
+ BackendList[n].Init = Init;
+
+ i++;
+ }
+ }
+ } while(next++);
+
+ BackendList[i].name = NULL;
+ BackendList[i].Init = NULL;
+ }
+
for(i = 0;BackendList[i].Init;i++)
BackendList[i].Init(&BackendList[i].Funcs);
done = 1;