From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from wopr.sciops.net ([216.126.196.60]) by ewsd; Sun Jul 15 00:12:52 EDT 2018 Received: (qmail 53697 invoked from network); 14 Jul 2018 21:12:42 -0700 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on wopr.sciops.net X-Spam-Level: X-Spam-Status: No, score=0.4 required=5.0 tests=BAYES_00,RCVD_IN_RP_RNBL, RDNS_DYNAMIC,TVD_RCVD_IP autolearn=no autolearn_force=no version=3.4.1 Received: from 243.216.7.109.rev.sfr.net (HELO u24.nope) (qwx@109.7.216.243) by wopr.sciops.net with ESMTPS (ECDHE-RSA-AES128-GCM-SHA256 encrypted); 14 Jul 2018 21:12:42 -0700 Message-ID: <35031F754CF84903AC7A09BF5A058A02@wopr.sciops.net> From: qwx Date: Sun, 15 Jul 2018 06:12:45 +0200 To: 9front@9front.org Subject: doom music using wadfs MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: leveraged property-based strategy dependency backend Hello, We recently discussed on IRC the idea of games/doom launching games/wadfs itself, to allow access to GENMIDI and music lumps, perhaps more. This patch implements this; music lumps are no longer extracted in /tmp, but accessed directly under /mnt/wad, wadfs' default mountpoint. /bin/dmus can then access /mnt/wad/genmidi and use games/dmid and games/opl3. Starting wadfs manually is no longer needed to use dmid. What do you think? Is this a good idea? Thanks, qwx diff -r 2ab539b07c1d sys/src/games/doom/d_main.c --- a/sys/src/games/doom/d_main.c Sat Jul 14 20:40:26 2018 +0200 +++ b/sys/src/games/doom/d_main.c Sun Jul 15 05:50:52 2018 +0200 @@ -635,6 +635,11 @@ gamemode = indetermined; return; } + if(gamemode != indetermined && rfork(RFPROC) == 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 -r 2ab539b07c1d sys/src/games/doom/i_sound.c --- a/sys/src/games/doom/i_sound.c Sat Jul 14 20:40:26 2018 +0200 +++ b/sys/src/games/doom/i_sound.c Sun Jul 15 05:50:52 2018 +0200 @@ -462,15 +462,7 @@ 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){