Ports: Add emu2 DOS emulator

This commit is contained in:
Brendan Coles 2021-04-14 17:24:58 +00:00 committed by Andreas Kling
parent 6ac7d946be
commit d65e74bffa
7 changed files with 80 additions and 0 deletions

View file

@ -23,6 +23,7 @@ Please make sure to keep this list up to date when adding and updating ports. :^
| [`doom`](doom/) | DOOM | | https://github.com/SerenityOS/SerenityDOOM |
| [`dropbear`](dropbear/) | Dropbear SSH | 2019.78 | https://dropbear.nl/mirror/dropbear.html |
| [`ed`](ed/) | GNU ed | 1.15 | https://www.gnu.org/software/ed/ |
| [`emu2`](emu2/) | emu2 DOS emulator | | https://github.com/dmsc/emu2 |
| [`figlet`](figlet/) | FIGlet | 2.2.5 | http://www.figlet.org/ |
| [`flatbuffers`](flatbuffers/) | Flatbuffers | 1.12.0 | https://github.com/google/flatbuffers |
| [`flex`](flex/) | flex | 2.6.4 | https://github.com/westes/flex |

9
Ports/emu2/package.sh Executable file
View file

@ -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
}

View file

@ -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

View file

@ -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;

View file

@ -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));

View file

@ -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)
{

View file

@ -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));