]> git.lizzy.rs Git - plan9front.git/commitdiff
doom: use wadfs to expose music lumps
authorqwx <devnull@localhost>
Sun, 15 Jul 2018 04:31:45 +0000 (06:31 +0200)
committerqwx <devnull@localhost>
Sun, 15 Jul 2018 04:31:45 +0000 (06:31 +0200)
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.

sys/src/games/doom/d_main.c
sys/src/games/doom/i_sound.c

index 6f1e8621545e224ade980acf47397386b62749b1..7063069125b2177206fa33121454497cc453a170 100644 (file)
@@ -635,6 +635,11 @@ 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, '/');
index aff0a3433d7b9253e54a4f4077d7153f4a1f4966..e15e988ab78443f073d7e50bf6ecf6d46cb0abb9 100644 (file)
@@ -462,15 +462,7 @@ void I_PlaySong(musicinfo_t *m, int loop)
        case 0:
                dup(mpfd[1], 1);
                for(n=3; n<20; n++) close(n);
-               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");
+               snprint(name, sizeof(name), "/mnt/wad/d_%s", m->name);
                if(bind("/fd/1", "/dev/audio", MREPL) < 0)
                        sysfatal("bind: %r");
                while(loop && fork() > 0){