Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 65 lines (50 sloc) 1.459 kb
b126e26 @tbradshaw The source of the setup program included with DOOM, Final DOOM, Strife, ...
tbradshaw authored
1 #include <stdlib.h>
2 #include <stdio.h>
3 #include <string.h>
4 #include "scguess.h"
5
6 int getSBParam(char *string, char field)
7 {
8 char *p;
9 int rc;
10
11 p = strchr(string, field);
12
13 if (!p) return -1;
14 else p++;
15
16 if (field == 'A' || field == 'P') sscanf(p, "%x", &rc); // hex field
17 else sscanf(p, "%d", &rc); // decimal field
18
19 return rc;
20 }
21
22 /*
23 * Returns 1 if it senses the BLASTER environment variable, 0 if it
24 * doesn't. If it does return 1, it will also fill in as many fields
25 * as it can extract from the environment variable. Any fields *not*
26 * filled in will be set to -1. Of course, if the midi field is filled,
27 * that means only that it's an SB16 and does not confirm whether the
28 * WaveBlaster is present.
29 */
30
31 int SmellsLikeSB(int *addr, int *irq, int *dma, int *midi)
32 {
33 char *var = getenv("BLASTER");
34
35 if (!var) return 0;
36
37 *addr = getSBParam(var, 'A');
38 *irq = getSBParam(var, 'I');
39 *dma = getSBParam(var, 'D');
40 *midi = getSBParam(var, 'P');
41
42 return 1;
43 }
44
45 /*
46 * Returns 1 if it senses the ULTRASND environment variable, 0 if it
47 * doesn't. If it does return 1, it will also fill in as many fields
48 * as it can extract from the environment variable. Any fields *not*
49 * filled in will be set to -1.
50 */
51
52 int SmellsLikeGUS(int *addr, int *irq, int *dma)
53 {
54 char *var = getenv("ULTRASND");
55 int dummy;
56
57 if (!var) return 0;
58 else
59 {
60 sscanf(var, "%x,%d,%d,%d,%d", addr, dma, &dummy, irq, &dummy);
61 return 1;
62 }
63
64 }
Something went wrong with that request. Please try again.