summaryrefslogtreecommitdiff
path: root/Ports/emu2
diff options
context:
space:
mode:
authorBrendan Coles <bcoles@gmail.com>2021-04-14 17:24:58 +0000
committerAndreas Kling <kling@serenityos.org>2021-04-14 21:48:55 +0200
commitd65e74bffa169310fc25ff36a1ca2e2dc3bf693c (patch)
treeba5cd24bed95c60eef0c754891fd4132465e06f0 /Ports/emu2
parent6ac7d946be8e0d3dbe0a7238a8462c4634e042d8 (diff)
downloadserenity-d65e74bffa169310fc25ff36a1ca2e2dc3bf693c.zip
Ports: Add emu2 DOS emulator
Diffstat (limited to 'Ports/emu2')
-rwxr-xr-xPorts/emu2/package.sh9
-rw-r--r--Ports/emu2/patches/codepage.patch9
-rw-r--r--Ports/emu2/patches/dosnames.patch27
-rw-r--r--Ports/emu2/patches/keyb.patch10
-rw-r--r--Ports/emu2/patches/main.patch14
-rw-r--r--Ports/emu2/patches/video.patch10
6 files changed, 79 insertions, 0 deletions
diff --git a/Ports/emu2/package.sh b/Ports/emu2/package.sh
new file mode 100755
index 0000000000..e7618ff3eb
--- /dev/null
+++ b/Ports/emu2/package.sh
@@ -0,0 +1,9 @@
+#!/usr/bin/env -S bash ../.port_include.sh
+port=emu2
+version=ff276eb0a755a3e784f73da00b5db6c1b25c1f83
+files="https://github.com/dmsc/emu2/archive/${version}.zip emu2-${version}.zip 2640a713d6c7ed98d020e0b7dccbc404"
+
+build() {
+ export CC="${SERENITY_ROOT}/Toolchain/Local/${SERENITY_ARCH}/bin/${SERENITY_ARCH}-pc-serenity-gcc"
+ run make DESTDIR="${SERENITY_BUILD_DIR}/Root" CC="${CC}" $installopts
+}
diff --git a/Ports/emu2/patches/codepage.patch b/Ports/emu2/patches/codepage.patch
new file mode 100644
index 0000000000..daba393bb1
--- /dev/null
+++ b/Ports/emu2/patches/codepage.patch
@@ -0,0 +1,9 @@
++++ emu2-master/src/codepage.c 2021-04-14 07:13:48.165698165 -0700
+@@ -3,6 +3,7 @@
+ #include "env.h"
+ #include <stdlib.h>
+ #include <string.h>
++#include <strings.h>
+
+ /* List of code-pages */
+ struct cp_data
diff --git a/Ports/emu2/patches/dosnames.patch b/Ports/emu2/patches/dosnames.patch
new file mode 100644
index 0000000000..bec40c66df
--- /dev/null
+++ b/Ports/emu2/patches/dosnames.patch
@@ -0,0 +1,27 @@
++++ emu2-master/src/dosnames.c 2021-04-14 07:15:44.036839086 -0700
+@@ -9,6 +9,7 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
++#include <strings.h>
+ #include <sys/stat.h>
+
+ // DOS directory entries.
+@@ -179,7 +180,7 @@
+ struct dirent **dir;
+ struct dos_file_list *ret;
+
+- int n = scandir(path, &dir, 0, dos_unix_sort);
++ int n = 0; //scandir(path, &dir, 0, dos_unix_sort);
+ if(n <= 0)
+ return 0;
+
+@@ -589,7 +590,7 @@
+ static struct dos_file_list *find_first_file(char *fspec)
+ {
+ // Now, separate the path to the spec
+- char *glob, *unixpath, *p = rindex(fspec, '/');
++ char *glob, *unixpath, *p = strrchr(fspec, '/');
+ if(!p)
+ {
+ glob = fspec;
diff --git a/Ports/emu2/patches/keyb.patch b/Ports/emu2/patches/keyb.patch
new file mode 100644
index 0000000000..5ab794b2cf
--- /dev/null
+++ b/Ports/emu2/patches/keyb.patch
@@ -0,0 +1,10 @@
++++ emu2-master/src/keyb.c 2021-04-14 09:28:52.597237515 -0700
+@@ -385,7 +385,7 @@
+ {
+ if(tty_fd < 0)
+ {
+- tty_fd = open("/dev/tty", O_NOCTTY | O_RDONLY);
++ tty_fd = open(ttyname(0), O_NOCTTY | O_RDONLY);
+ if(tty_fd < 0)
+ {
+ print_error("error at open TTY, %s\n", strerror(errno));
diff --git a/Ports/emu2/patches/main.patch b/Ports/emu2/patches/main.patch
new file mode 100644
index 0000000000..9a82281cb2
--- /dev/null
+++ b/Ports/emu2/patches/main.patch
@@ -0,0 +1,14 @@
++++ emu2-master/src/main.c 2021-04-14 07:16:54.192314882 -0700
+@@ -304,12 +304,6 @@
+ signal(SIGQUIT, exit_handler);
+ signal(SIGPIPE, exit_handler);
+ signal(SIGTERM, exit_handler);
+- struct itimerval itv;
+- itv.it_interval.tv_sec = 0;
+- itv.it_interval.tv_usec = 54925;
+- itv.it_value.tv_sec = 0;
+- itv.it_value.tv_usec = 54925;
+- setitimer(ITIMER_REAL, &itv, 0);
+ init_bios_mem();
+ while(1)
+ {
diff --git a/Ports/emu2/patches/video.patch b/Ports/emu2/patches/video.patch
new file mode 100644
index 0000000000..95bfe39852
--- /dev/null
+++ b/Ports/emu2/patches/video.patch
@@ -0,0 +1,10 @@
++++ emu2-master/src/video.c 2021-04-14 09:29:03.273155128 -0700
+@@ -154,7 +154,7 @@
+ static void init_video(void)
+ {
+ debug(debug_video, "starting video emulation.\n");
+- int tty_fd = open("/dev/tty", O_NOCTTY | O_WRONLY);
++ int tty_fd = open(ttyname(0), O_NOCTTY | O_WRONLY);
+ if(tty_fd < 0)
+ {
+ print_error("error at open TTY, %s\n", strerror(errno));