doom: use wadfs to expose music lumps
launch wadfs after detecting main wad, exposing GENMIDI and music lumps under /mnt/wad. /bin/dmus can then use them directly, and wadfs doesn't need to be started manually.
This commit is contained in:
parent
1a751a5939
commit
e7b1c1aad8
2 changed files with 6 additions and 9 deletions
|
@ -635,6 +635,11 @@ void IdentifyVersion (void)
|
||||||
gamemode = indetermined;
|
gamemode = indetermined;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(gamemode != indetermined && rfork(RFPROC|RFFDG) == 0){
|
||||||
|
close(2);
|
||||||
|
execl("/bin/games/wadfs", "wadfs", wadfile, nil);
|
||||||
|
sysfatal("execl: %r");
|
||||||
|
}
|
||||||
strncpy(basedefault, wadfile, sizeof(basedefault)-5);
|
strncpy(basedefault, wadfile, sizeof(basedefault)-5);
|
||||||
basedefault[sizeof(basedefault)-5] = '\0';
|
basedefault[sizeof(basedefault)-5] = '\0';
|
||||||
slash = strrchr(basedefault, '/');
|
slash = strrchr(basedefault, '/');
|
||||||
|
|
|
@ -462,15 +462,7 @@ void I_PlaySong(musicinfo_t *m, int loop)
|
||||||
case 0:
|
case 0:
|
||||||
dup(mpfd[1], 1);
|
dup(mpfd[1], 1);
|
||||||
for(n=3; n<20; n++) close(n);
|
for(n=3; n<20; n++) close(n);
|
||||||
close(0);
|
snprint(name, sizeof(name), "/mnt/wad/d_%s", m->name);
|
||||||
snprint(name, sizeof(name), "/tmp/doom.%d", getpid());
|
|
||||||
if(create(name, ORDWR|ORCLOSE, 0666) != 0)
|
|
||||||
sysfatal("create: %r");
|
|
||||||
n = W_LumpLength(m->lumpnum);
|
|
||||||
if(write(0, m->data, n) != n)
|
|
||||||
sysfatal("write: %r");
|
|
||||||
if(seek(0, 0, 0) != 0)
|
|
||||||
sysfatal("seek: %r");
|
|
||||||
if(bind("/fd/1", "/dev/audio", MREPL) < 0)
|
if(bind("/fd/1", "/dev/audio", MREPL) < 0)
|
||||||
sysfatal("bind: %r");
|
sysfatal("bind: %r");
|
||||||
while(loop && fork() > 0){
|
while(loop && fork() > 0){
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue