-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run Doom #323
Comments
DOOM looks simple enough to port that it's probably easier to start from the original source code dump rather than any other port. Here's a diff that I used to make it compile on a modern Linux machine: diff --git a/linuxdoom-1.10/Makefile b/linuxdoom-1.10/Makefile
index 8c69794..597aea8 100644
--- a/linuxdoom-1.10/Makefile
+++ b/linuxdoom-1.10/Makefile
@@ -6,9 +6,9 @@
#
CC= gcc # gcc or g++
-CFLAGS=-g -Wall -DNORMALUNIX -DLINUX # -DUSEASM
+CFLAGS=-g -m32 -Wall -DNORMALUNIX -DLINUX # -DUSEASM
LDFLAGS=-L/usr/X11R6/lib
-LIBS=-lXext -lX11 -lnsl -lm
+LIBS=-lXext -lX11 -lm
# subdirectory for objects
O=linux
@@ -92,4 +92,4 @@ $(O)/%.o: %.c
#############################################################
#
-#############################################################
\ No newline at end of file
+#############################################################
diff --git a/linuxdoom-1.10/i_sound.c b/linuxdoom-1.10/i_sound.c
index a327bfa..fda5024 100644
--- a/linuxdoom-1.10/i_sound.c
+++ b/linuxdoom-1.10/i_sound.c
@@ -37,6 +37,7 @@ rcsid[] = "$Id: i_unix.c,v 1.5 1997/02/03 22:45:10 b1 Exp $";
#include <sys/filio.h>
#endif
+#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
@@ -163,7 +164,7 @@ myioctl
int* arg )
{
int rc;
- extern int errno;
+ //extern int errno;
rc = ioctl(fd, command, arg);
if (rc < 0)
diff --git a/linuxdoom-1.10/i_video.c b/linuxdoom-1.10/i_video.c
index 9b311b3..2215de4 100644
--- a/linuxdoom-1.10/i_video.c
+++ b/linuxdoom-1.10/i_video.c
@@ -46,7 +46,7 @@ int XShmGetEventBase( Display* dpy ); // problems with g++?
#include <sys/socket.h>
#include <netinet/in.h>
-#include <errnos.h>
+#include <errno.h>
#include <signal.h>
#include "doomstat.h"
@@ -666,7 +666,7 @@ void grabsharedmemory(int size)
id = shmget((key_t)key, size, IPC_CREAT|0777);
if (id==-1)
{
- extern int errno;
+ //extern int errno;
fprintf(stderr, "errno=%d\n", errno);
I_Error("Could not get any shared memory");
} It doesn't run, however:
|
By downloading and extracting the WASI SDK, and applying the linked diff on the source code, I got DOOM to compile for WASI. The Here is the list of imports:
|
Using a more recent version of the wasi-libc:
|
After #335, DOOM seems to write a large amount of data (a few hundred kiBs?) on stderr then a panic happens because of an overflow when reading memory. Probably an undefined behaviour. |
After #336, the game seems to run except that there's no sound or graphics:
|
#345 finally fixes an "undefined behaviour". I've been observing. This story is that before #343 the #343 fixed that, and caused the directory name to now be #345 now replaces this directory name with an empty string, which causes |
After the spam of PRs, everything seems to be working fine. Unfortunately the graphics story of redshirt is not really there yet (cc #187). |
#418 is eventually needed for DOOM to be able to load the .wad file containing its assets. As for the DOOM executable itself, I can probably put it on https://github.com/tomaka/redshirt-packages EDIT: done |
It should be possible to legally bundle the .WAD files found at https://freedoom.github.io/ |
New hash with keyboard inputs support: |
New hash after #443: |
Doom works and this issue is more or less done, but I'm leaving it open because of the problem with the .WAD file. The last point to tackle is thus to provide some way to fix that. |
The video game.
Link: https://doom.fandom.com/wiki/Wasm-doom
The text was updated successfully, but these errors were encountered: