* doom music using wadfs
@ 2018-07-15 4:12 qwx
0 siblings, 0 replies; only message in thread
From: qwx @ 2018-07-15 4:12 UTC (permalink / raw)
To: 9front
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){
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2018-07-15 4:12 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-15 4:12 doom music using wadfs qwx
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).