Skip to content

Commit

Permalink
Fix sndserver build
Browse files Browse the repository at this point in the history
  • Loading branch information
lunkums committed Oct 5, 2023
1 parent 9dd1b5b commit 582a04a
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 17 deletions.
37 changes: 25 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

I was excited to discover that the original DOOM source code was open on GitHub. Unfortunately, when I tried to clone and build it for myself, it did not work OOTB. This fork/repo contains a collection of fixes that I had to apply to get it working on my computer. The goal is that others will stumble across this repo and be able to build the source code for themselves without error.

For a full list of changes made to the repo after forking it, see the [changelog](./CHANGELOG.md).

## Requirements

_Note_: Provided commands were tested on Linux Mint Victoria 21.2.
Expand All @@ -26,16 +24,31 @@ _Note_: Provided commands were tested on Linux Mint Victoria 21.2.

## Build and Run

0. Open up a terminal
1. `git clone https://github.com/lunkums/DOOM_fixed.git` (if not already done)
2. `cd DOOM_fixed/linuxdoom-1.10`
3. `make` (64-bit) or `make 32bit` (32-bit)
4. `cd linux/`
5. `curl -O https://distro.ibiblio.org/slitaz/sources/packages/d/doom1.wad` (download doom1.wad)
6. In a separate terminal, run `Xephyr :2 -ac -screen 640x400x8`
7. Back in the first terminal, run `DISPLAY=:2` then `./linuxxdoom -2` (-2 means the game is scaled by a factor of 2)
```bash
$ git clone https://github.com/lunkums/DOOM_fixed.git # clone the repo
$ cd DOOM_fixed/linuxdoom-1.10 # navigate to the linuxdoom-1.10 folder
$ make # 64-bit build
$ make 32bit # 32-bit build
$ cd linux/ # navigate to the output directory
$ curl -O https://distro.ibiblio.org/slitaz/sources/packages/d/doom1.wad # download the shareware wad
...
# in a separate terminal, run:
$ Xephyr :2 -ac -screen 320x200x8 # start an X server with Xephyr
...
# back in the first terminal, run:
$ DISPLAY=:2 # set the `DISPLAY` environment variable to be `:2`
$ ./linuxxdoom # LGTM
```

### Sound

See the [sndserv README](./sndserv/README.md) for instructions on setting up the game's sound.

### Music

Unfortunately, Linux DOOM does not support music due to a licensing issue with the [DMX](https://doomwiki.org/wiki/DMX) sound library used in the original release. Reimplementing it is out of the scope of this fork.

## Additional Info

https://hexadecimal.uoregon.edu/~stevev/Linux-DOOM-FAQ.html
https://www.youtube.com/watch?v=9JgQfQHHhTw
- [Linux DOOM FAQ](https://hexadecimal.uoregon.edu/~stevev/Linux-DOOM-FAQ.html)
- [How To Compile Vanilla Doom (Linux Doom)](https://www.youtube.com/watch?v=9JgQfQHHhTw)
4 changes: 2 additions & 2 deletions linuxdoom-1.10/i_sound.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ rcsid[] = "$Id: i_unix.c,v 1.5 1997/02/03 22:45:10 b1 Exp $";
#ifdef SNDSERV
// Separate sound server process.
FILE* sndserver=0;
char* sndserver_filename = "./sndserver ";
char* sndserver_filename = "sndserver";
#elif SNDINTR

// Update all 30 millisecs, approx. 30fps synchronized.
Expand Down Expand Up @@ -746,7 +746,7 @@ I_InitSound()
getenv("DOOMWADDIR"),
sndserver_filename);
else
sprintf(buffer, "%s", sndserver_filename);
sprintf(buffer, "./%s", sndserver_filename);

// start sound process
if ( !access(buffer, X_OK) )
Expand Down
1 change: 0 additions & 1 deletion linuxdoom-1.10/i_video.c
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,6 @@ void grabsharedmemory(int size)
id = shmget((key_t)key, size, IPC_CREAT|0777);
if (id==-1)
{
extern int errno;
fprintf(stderr, "errno=%d\n", errno);
I_Error("Could not get any shared memory");
}
Expand Down
7 changes: 6 additions & 1 deletion sndserv/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ LIBS=-lm

O=linux

all: $(O)/sndserver
TARGET := $(O)/sndserver

all: $(TARGET)

32bit: CFLAGS += -m32
32bit: $(TARGET)

clean:
rm -f *.o *~ *.flc
Expand Down
25 changes: 25 additions & 0 deletions sndserv/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# sndserv (Sound Server)

Linux DOOM plays sounds from a separate process called sndserv (sound server).

## Requirements

_Note_: Provided commands were tested on Linux Mint Victoria 21.2.

- Linux
- OSS Proxy Daemon (`sudo apt-get install osspd`)

## Build and Run

```bash
$ cd DOOM_fixed/sndserv # navigate to the `sndserv` directory
$ make # 64-bit build
$ make 32bit # 32-bit build
$ cp ./linux/sndserver ../linuxdoom-1.10/linux/ # copy sndserver to the linuxdoom output directory
```

## Additional Info

- [How exactly did the linuxdoom sndserver used to work?](https://www.doomworld.com/forum/post/2544842) ([archive](https://web.archive.org/web/20231004233042/https://www.doomworld.com/forum/topic/131304-how-exactly-did-the-linuxdoom-sndserver-used-to-work/?tab=comments#comment-2544842))
- [Where is /dev/dsp or /dev/audio?](https://askubuntu.com/questions/220370/where-is-dev-dsp-or-dev-audio?rq=1) ([archive](https://web.archive.org/web/20231004233215/https://askubuntu.com/questions/220370/where-is-dev-dsp-or-dev-audio?rq=1))
- [Package: osspd (1.3.2-13.1)](https://packages.debian.org/sid/osspd) ([archive](https://web.archive.org/web/20231004234639/https://packages.debian.org/sid/osspd))
2 changes: 1 addition & 1 deletion sndserv/linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

static const char rcsid[] = "$Id: linux.c,v 1.3 1997/01/26 07:45:01 b1 Exp $";

#include <errno.h>

#include <stdlib.h>
#include <stdio.h>
Expand All @@ -53,7 +54,6 @@ myioctl
int* arg )
{
int rc;
extern int errno;

rc = ioctl(fd, command, arg);
if (rc < 0)
Expand Down
2 changes: 2 additions & 0 deletions sndserv/linux/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore

0 comments on commit 582a04a

Please sign in to comment.