diff --git a/rc/bin/dmus b/rc/bin/dmus index 51950d033..c0c7f4a66 100755 --- a/rc/bin/dmus +++ b/rc/bin/dmus @@ -1,6 +1,6 @@ #!/bin/rc -if(test -f /mnt/wad/genmidi) - c=(games/dmid '|' games/opl3) +if(test -f /tmp/genmidi.*) + c=(games/dmid -i /tmp/genmidi.* '|' games/opl3) if not c=(games/midi -c) if(~ `{file -m $1} audio/mus) diff --git a/sys/src/games/doom/d_main.c b/sys/src/games/doom/d_main.c index 706306912..6f1e86215 100644 --- a/sys/src/games/doom/d_main.c +++ b/sys/src/games/doom/d_main.c @@ -635,11 +635,6 @@ void IdentifyVersion (void) gamemode = indetermined; 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); basedefault[sizeof(basedefault)-5] = '\0'; slash = strrchr(basedefault, '/'); diff --git a/sys/src/games/doom/i_sound.c b/sys/src/games/doom/i_sound.c index e15e988ab..50f1f118e 100644 --- a/sys/src/games/doom/i_sound.c +++ b/sys/src/games/doom/i_sound.c @@ -422,6 +422,19 @@ void I_UpdateSoundParams(int handle, int vol, int sep, int pitch) void I_InitMusic(void) { + int fd, n, sz; + char name[64]; + uchar *gm; + + n = W_GetNumForName("GENMIDI"); + sz = W_LumpLength(n); + gm = (uchar *)W_CacheLumpNum(n, PU_STATIC); + snprint(name, sizeof(name), "/tmp/genmidi.%d", getpid()); + if((fd = create(name, ORDWR|ORCLOSE, 0666)) < 0) + sysfatal("create: %r"); + if(write(fd, gm, sz) != sz) + sysfatal("write: %r"); + Z_Free(gm); } void I_ShutdownMusic(void) @@ -462,7 +475,15 @@ void I_PlaySong(musicinfo_t *m, int loop) case 0: dup(mpfd[1], 1); for(n=3; n<20; n++) close(n); - snprint(name, sizeof(name), "/mnt/wad/d_%s", m->name); + close(0); + 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) sysfatal("bind: %r"); while(loop && fork() > 0){