summaryrefslogtreecommitdiff
path: root/emulators/ucon64
diff options
context:
space:
mode:
authorwiz <wiz@pkgsrc.org>2019-07-07 22:47:57 +0000
committerwiz <wiz@pkgsrc.org>2019-07-07 22:47:57 +0000
commit418ae3abec76e2a80d30e4bbe87a52564575f2c8 (patch)
treef6b434b882e01362af38cf64b57aa3b763966420 /emulators/ucon64
parent65933e152e5b35f0c9d15760dc12497347787b15 (diff)
downloadpkgsrc-418ae3abec76e2a80d30e4bbe87a52564575f2c8.tar.gz
ucon64: update to 2.2.0.
With much help from upstream to get this compiling nicely on NetBSD. 2.2.0 - added (GB) --gp2bmp convert Game Boy Printer data (produced by --xmccl) to BMP (by dbjh; based on version of gblnk (by Chris McCormick) improved by Difegue. Many thanks to Difegue for providing me with Game Boy Printer data. Thanks to Martin Eyre for documenting his findings about Game Boy Printer commands) - added (SNES) --sminis=ID convert *.srm (SRAM) file to SNES/Super Famicom Classic Mini (hakchi2) format for game with identifier ID (by dbjh) - added (SNES) --smini2srm convert SNES/Super Famicom Classic Mini (hakchi2) SRAM data to *.srm (SRAM) file (by dbjh) - added support for NetBSD (by dbjh; thanks to Thomas Klausner for his help) - updated support for OpenBSD (64-bit) (by dbjh) - updated (all) made -o also work for --rrom, --r83 and --rjoliet, just like the other rename options (--rdat, --rl and --ru) (by dbjh) - updated (SNES) improved reliability of GDSF communication for PCs with a parallel port that supports ECP (built-in or PCIe parallel port card). At last. It is essential to correctly specify ecr_offset for this to work (by dbjh; many thanks to Mystic_Merlin for testing) - updated (SNES) improved --ufosd by adding specific support for 10 and 12 Mbit HiROMs and implementing a generic way to set the SRAM mapping bytes (by dbjh; thanks to Revenant for the information and Trenton_net for testing) - added (SNES) --xufosd send ROM to Super UFO Pro 8 SD. Be sure to use a tool like Zadig to add libusb-0.1 (libusb-win32) support (by dbjh; thanks to Revenant for the information and Trenton_net and Revenant for testing) - updated (SNES) added NTSC/PAL fix for Soul Blazer F/G and Super Metroid E (by dbjh; thanks to Mystic_Merlin) - added (SNES) work-around for using the Game Doctor SF6 protocol for parallel ports that do not support reading from the Control register. It is good enough to at least allow dumping saver data and SRAM. To enable the new functionality assign a value other than 0 to the variable gd6_send_byte_delay. See the FAQ question 55 for details (by dbjh; many thanks to NorQue and Mystic_Merlin for testing) - updated (SNES) made --gd3 specify a pass-through mapping for LoROM DSP games (by dbjh) - updated (SNES) added proper recognition of Pro Fighter headers of LoROM DSP games with 2, 8 or 32 kB SRAM (by dbjh) - updated (SNES) added interpretation of remaining part of GD3 header (DRAM and SRAM mapping) to --dbuh (by dbjh) - updated (SNES & Genesis) fixed split file detection for formats other than (M)GD and MGH which I broke in 2.1.0 (by dbjh) - added (all) --split=N split ROM in parts of N Bytes (including possible header). This is a generic file splitting option. Use -s, optionally in combination with --ssize=SIZE to split files for use with a specific console or backup unit (by dbjh) - added (SNES) support for Super Magicom/SMC IC2 file format. This format is used by several ancient backup units, including the Twin Supercom, Future Supercom Pro.9 and UFO Super Drive PRO 6 HYPER VERSION in order to run HiROM games up to 16 Mbit. Use --ic2 to convert a file to Super Magicom/SMC IC2 format (by dbjh; thanks to Mystic_Merlin for info and testing) - updated (SNES) fixed bug in --ufo that caused it to produce incorrect headers for games that do not use SRAM (by dbjh; thanks to Mystic_Merlin for feedback and testing) - updated (SNES) fixed bug in -j for files in UFO format smaller than or equal to 8 Mbit (by dbjh)
Diffstat (limited to 'emulators/ucon64')
-rw-r--r--emulators/ucon64/Makefile16
-rw-r--r--emulators/ucon64/PLIST6
-rw-r--r--emulators/ucon64/distinfo27
-rw-r--r--emulators/ucon64/options.mk5
-rw-r--r--emulators/ucon64/patches/patch-Makefile81
-rw-r--r--emulators/ucon64/patches/patch-backup_libcd64_Makefile58
-rw-r--r--emulators/ucon64/patches/patch-backup_libcd64_cd64io.c252
-rw-r--r--emulators/ucon64/patches/patch-backup_libcd64_cd64io.h80
-rw-r--r--emulators/ucon64/patches/patch-config.mak.in13
-rw-r--r--emulators/ucon64/patches/patch-configure29
-rw-r--r--emulators/ucon64/patches/patch-configure.in32
-rw-r--r--emulators/ucon64/patches/patch-libdiscmage_libdiscmage.h28
-rw-r--r--emulators/ucon64/patches/patch-libdiscmage_misc__z.h23
-rw-r--r--emulators/ucon64/patches/patch-misc_archive.h23
-rw-r--r--emulators/ucon64/patches/patch-misc_parallel.c54
-rw-r--r--emulators/ucon64/patches/patch-misc_unzip.h18
16 files changed, 402 insertions, 343 deletions
diff --git a/emulators/ucon64/Makefile b/emulators/ucon64/Makefile
index 6792eee77be..5e05d90c44f 100644
--- a/emulators/ucon64/Makefile
+++ b/emulators/ucon64/Makefile
@@ -1,8 +1,7 @@
-# $NetBSD: Makefile,v 1.12 2018/03/07 12:34:55 wiz Exp $
+# $NetBSD: Makefile,v 1.13 2019/07/07 22:47:57 wiz Exp $
-DISTNAME= ucon64-2.1.0-src
+DISTNAME= ucon64-2.2.0-src
PKGNAME= ${DISTNAME:S/-src//}
-PKGREVISION= 1
CATEGORIES= emulators
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=ucon64/}
@@ -13,23 +12,16 @@ LICENSE= gnu-gpl-v2
WRKSRC= ${WRKDIR}/${DISTNAME}/src
-CONFIGURE_ARGS+= --disable-dload
-CPPFLAGS+= -D__unix__
+CONFIGURE_ARGS+= --with-libcd64
GNU_CONFIGURE= yes
USE_TOOLS+= gmake
CHECK_PORTABILITY_SKIP+=install_beos.sh
-.include "../../mk/bsd.prefs.mk"
-
-.if ${OPSYS} == NetBSD
-MAKE_ENV+= OSTYPE=netbsd
-.endif
-
INSTALLATION_DIRS= bin lib share/examples/ucon64 share/doc/ucon64/images
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/ucon64 ${DESTDIR}${PREFIX}/bin
- ${INSTALL_LIB} ${WRKSRC}/libdiscmage/libdiscmage.so ${DESTDIR}${PREFIX}/lib
+ ${INSTALL_LIB} ${WRKSRC}/libdiscmage/discmage.so ${DESTDIR}${PREFIX}/lib
${INSTALL_DATA} ${WRKSRC}/[a-z]*.txt \
${DESTDIR}${PREFIX}/share/examples/ucon64
${INSTALL_DATA} ${WRKDIR}/${DISTNAME}/*.html \
diff --git a/emulators/ucon64/PLIST b/emulators/ucon64/PLIST
index d9095b8c831..2ce5b8c3292 100644
--- a/emulators/ucon64/PLIST
+++ b/emulators/ucon64/PLIST
@@ -1,6 +1,6 @@
-@comment $NetBSD: PLIST,v 1.4 2018/03/07 12:34:55 wiz Exp $
+@comment $NetBSD: PLIST,v 1.5 2019/07/07 22:47:57 wiz Exp $
bin/ucon64
-lib/libdiscmage.so
+lib/discmage.so
share/doc/ucon64/changes.html
share/doc/ucon64/developers.html
share/doc/ucon64/faq.html
@@ -20,6 +20,7 @@ share/doc/ucon64/images/logo.png
share/doc/ucon64/images/mdpro.png
share/doc/ucon64/images/msg.png
share/doc/ucon64/images/pcepro.png
+share/doc/ucon64/images/pl.png
share/doc/ucon64/images/qd16.png
share/doc/ucon64/images/sc.png
share/doc/ucon64/images/sf3.png
@@ -29,6 +30,7 @@ share/doc/ucon64/images/smd.png
share/doc/ucon64/images/smspro.png
share/doc/ucon64/images/snesppak.png
share/doc/ucon64/images/swc.png
+share/doc/ucon64/images/ufosd.png
share/doc/ucon64/images/v64.png
share/doc/ucon64/images/v64jr.png
share/doc/ucon64/install.html
diff --git a/emulators/ucon64/distinfo b/emulators/ucon64/distinfo
index d3f81f80155..13618b2764f 100644
--- a/emulators/ucon64/distinfo
+++ b/emulators/ucon64/distinfo
@@ -1,16 +1,13 @@
-$NetBSD: distinfo,v 1.9 2018/03/07 12:34:55 wiz Exp $
+$NetBSD: distinfo,v 1.10 2019/07/07 22:47:57 wiz Exp $
-SHA1 (ucon64-2.1.0-src.tar.gz) = 83506c965ba4ab6fa7122c9dcebbabe6c553cbc3
-RMD160 (ucon64-2.1.0-src.tar.gz) = b3b6b95a44cb50ac7e3634d07b1b50960fb971f8
-SHA512 (ucon64-2.1.0-src.tar.gz) = da2dbe8a573e7dc779f69859f4d3508d4818dcfd99b6b397a7b23a2038a1d8c85835fae9e237a1639ec6179e8ceabb95fd0d65f95f963de99bc61024f686580e
-Size (ucon64-2.1.0-src.tar.gz) = 1348408 bytes
-SHA1 (patch-Makefile) = 9cfc3c474562d5073099286a9659e4e5d4cf5d2f
-SHA1 (patch-backup_libcd64_Makefile) = b46127daa77cd9516954365897247c8f33088883
-SHA1 (patch-backup_libcd64_cd64io.c) = b47d14bb41708caa5a582444d5f4ef35cda973ea
-SHA1 (patch-backup_libcd64_cd64io.h) = 026c79ecc577e701b27113d369e6c8d977f01d53
-SHA1 (patch-config.mak.in) = 87db3e62bbd5fa94fa83878b227e3ed3ff8920e1
-SHA1 (patch-configure) = a4b89f6885abe731b75f6277bc563ec992f8d0c9
-SHA1 (patch-configure.in) = 3d5a3ecad1b50499b001eda39ec0100d0ed8ee16
-SHA1 (patch-libdiscmage_libdiscmage.h) = 7a5ced96ae619fd843d3b1acdcd28788937cc79a
-SHA1 (patch-misc_parallel.c) = 164137f352049698a2ff4758bd3dda72ab4dadec
-SHA1 (patch-misc_unzip.h) = 3a065530cd80c74985a997459ee67847b8f75864
+SHA1 (ucon64-2.2.0-src.tar.gz) = e92167c4537c9b74c879242b785d108f0f91e641
+RMD160 (ucon64-2.2.0-src.tar.gz) = 4bd6e17fbe970800f1f4e563263ccc86794eddf7
+SHA512 (ucon64-2.2.0-src.tar.gz) = 1f21083585d9e3a32546139e2b0786ff37d32e070b21ecc39a1d179e39be3e786d5d07b06c1dce8b3f43e14800974159f54a9a469e59070b2b50c4cbb85136dc
+Size (ucon64-2.2.0-src.tar.gz) = 1488002 bytes
+SHA1 (patch-backup_libcd64_Makefile) = c6d659c96ea2389266b6480f2d3afe79a647685d
+SHA1 (patch-backup_libcd64_cd64io.c) = ab1d2b9ad9c3258114f946b13c28520b40eb60b2
+SHA1 (patch-backup_libcd64_cd64io.h) = c4f915436c3867ea77ddc95942a074a8266a5c03
+SHA1 (patch-configure) = 2f56081b1ea8b0fcabc1979866fddc144241bc62
+SHA1 (patch-configure.in) = 069ffe610faec56696b71b42f2abafa53488a5ff
+SHA1 (patch-libdiscmage_misc__z.h) = 3456714ff4ea4328a7d6b3cd785e76abbca2423a
+SHA1 (patch-misc_archive.h) = 3ed6b8a6464e0fcb2992e0065b1e84ac0572f670
diff --git a/emulators/ucon64/options.mk b/emulators/ucon64/options.mk
index e9573c8c056..852c04662a9 100644
--- a/emulators/ucon64/options.mk
+++ b/emulators/ucon64/options.mk
@@ -1,4 +1,4 @@
-# $NetBSD: options.mk,v 1.2 2018/02/10 13:53:48 khorben Exp $
+# $NetBSD: options.mk,v 1.3 2019/07/07 22:47:57 wiz Exp $
PKG_OPTIONS_VAR= PKG_OPTIONS.ucon64
PKG_SUPPORTED_OPTIONS= libusb
@@ -10,8 +10,5 @@ PKG_SUPPORTED_OPTIONS= libusb
###
.if !empty(PKG_OPTIONS:Mlibusb)
CONFIGURE_ARGS+= --with-libusb
-CPPFLAGS+= -I${BUILDLINK_PREFIX.libusb}/include
-LDFLAGS+= -L${BUILDLINK_PREFIX.libusb}/lib
-LDFLAGS+= ${COMPILER_RPATH_FLAG}${BUILDLINK_PREFIX.libusb}/lib
. include "../../mk/libusb.buildlink3.mk"
.endif
diff --git a/emulators/ucon64/patches/patch-Makefile b/emulators/ucon64/patches/patch-Makefile
deleted file mode 100644
index 66aa8d76e9d..00000000000
--- a/emulators/ucon64/patches/patch-Makefile
+++ /dev/null
@@ -1,81 +0,0 @@
-$NetBSD: patch-Makefile,v 1.2 2018/03/07 12:34:55 wiz Exp $
-
-Patch from upstream to improve build on NetBSD.
-
---- Makefile.orig 2017-08-05 23:02:35.000000000 +0000
-+++ Makefile
-@@ -2,7 +2,7 @@
-
- CC=gcc
- CFLAGS0:=$(CFLAGS)
--CFLAGS+=-I. -Wall -W -O3
-+CFLAGS+=-I. -Wall -W
- LDFLAGS0:=$(LDFLAGS)
- ifeq ($(findstring darwin,$(OSTYPE)),) # false if OSTYPE contains "darwin"
- # On Mac OS X using -s gives the following warning:
-@@ -54,9 +54,14 @@ endif
-
- else # UNIX, BeOS or Mac OS X (Darwin)
-
-+ifdef USE_PARALLEL
- ifeq ($(findstring openbsd,$(OSTYPE)),openbsd) # for example "openbsd3.4"
--# i386_iopl() is located in libi386.a
--LDFLAGS+=$(LIBI386)
-+# i386_iopl() is located in libi386.a. Use -lamd64 for amd64_iopl().
-+LDFLAGS+=$(LIBIOPL_OPENBSD)
-+endif
-+ifeq ($(findstring netbsd,$(OSTYPE)),netbsd)
-+LDFLAGS+=$(LIBIOPL_NETBSD)
-+endif
- endif
-
- ifdef USE_DISCMAGE
-@@ -72,10 +77,12 @@ ifdef DLOPEN
- ifneq ($(OSTYPE),beos)
- ifeq ($(findstring freebsd,$(OSTYPE)),) # false if OSTYPE contains "freebsd"
- ifeq ($(findstring openbsd,$(OSTYPE)),) # false if OSTYPE contains "openbsd"
-+ifeq ($(findstring netbsd,$(OSTYPE)),) # false if OSTYPE contains "netbsd"
- LDFLAGS+=-ldl
- endif
- endif
- endif
-+endif
-
- else # DLOPEN
- ifdef USE_DISCMAGE # GNU specific: "simply expanded variable"
-@@ -231,7 +238,7 @@ ifdef USE_DISCMAGE
- .PHONY: libdiscmage/$(FULLLIBNAME_DM)
- libdiscmage/$(FULLLIBNAME_DM):
- ifeq ($(GCC_WIN),1)
-- cd libdiscmage && CFLAGS=$(CFLAGS0) LDFLAGS=$(LDFLAGS0) $(MAKE)
-+ cd libdiscmage && CFLAGS="$(CFLAGS0)" LDFLAGS="$(LDFLAGS0)" $(MAKE)
- else
- ifdef DJGPP
- cd libdiscmage
-@@ -240,7 +247,7 @@ ifdef DJGPP
- $(MAKE)
- cd ..
- else
-- cd libdiscmage && CFLAGS=$(CFLAGS0) LDFLAGS=$(LDFLAGS0) $(MAKE)
-+ cd libdiscmage && CFLAGS="$(CFLAGS0)" LDFLAGS="$(LDFLAGS0)" $(MAKE)
- endif # DJGPP
- endif # GCC_WIN
- endif # USE_DISCMAGE
-@@ -250,7 +257,7 @@ ifdef USE_LIBCD64
- #.PHONY: backup/libcd64/libcd64.a Do not force linking an executable.
- backup/libcd64/libcd64.a:
- ifeq ($(GCC_WIN),1)
-- cd backup/libcd64 && CFLAGS=$(CFLAGS0) LDFLAGS=$(LDFLAGS0) $(MAKE)
-+ cd backup/libcd64 && CFLAGS="$(CFLAGS0)" LDFLAGS="$(LDFLAGS0)" $(MAKE)
- else
- ifdef DJGPP
- cd backup/libcd64
-@@ -259,7 +266,7 @@ ifdef DJGPP
- $(MAKE)
- cd ../..
- else
-- cd backup/libcd64 && CFLAGS=$(CFLAGS0) LDFLAGS=$(LDFLAGS0) $(MAKE)
-+ cd backup/libcd64 && CFLAGS="$(CFLAGS0)" LDFLAGS="$(LDFLAGS0)" $(MAKE)
- endif # DJGPP
- endif # GCC_WIN
- endif # USE_LIBCD64
diff --git a/emulators/ucon64/patches/patch-backup_libcd64_Makefile b/emulators/ucon64/patches/patch-backup_libcd64_Makefile
index 4146e853747..339cf0115bc 100644
--- a/emulators/ucon64/patches/patch-backup_libcd64_Makefile
+++ b/emulators/ucon64/patches/patch-backup_libcd64_Makefile
@@ -1,54 +1,48 @@
-$NetBSD: patch-backup_libcd64_Makefile,v 1.1 2018/03/07 12:34:55 wiz Exp $
+$NetBSD: patch-backup_libcd64_Makefile,v 1.2 2019/07/07 22:47:57 wiz Exp $
Patch from upstream to improve build on NetBSD.
---- backup/libcd64/Makefile.orig 2016-02-11 00:32:59.000000000 +0000
+--- backup/libcd64/Makefile.orig 2019-05-21 00:13:14.000000000 +0000
+++ backup/libcd64/Makefile
-@@ -2,9 +2,9 @@ CC=gcc
-
- ifdef DEBUG
- # I think we only use gnu99 instead of c99 due to va_args extensions.
--CFLAGS+=-I. -Wall -W -pg -g -pedantic -ansi -DDEBUG
-+CFLAGS+=-I. -Wall -W -std=gnu99 -pg -g -pedantic -ansi -DDEBUG
- else
--CFLAGS+=-I. -Wall -W -O6 -funroll-loops -fexpensive-optimizations
-+CFLAGS+=-I. -Wall -W -std=gnu99 -O6 -funroll-loops -fexpensive-optimizations
+@@ -80,19 +80,10 @@ RAWIO=1
endif
- ifndef DJGPP
-@@ -40,14 +40,6 @@ LDFLAGS+=-Wl,--out-implib,libcd64dll.a
- endif
+ ifeq ($(OSTYPE),OpenBSD)
+-# i386_iopl() is located in libi386.a (note the .a)
+-#LIBS+=/usr/lib/libi386.a
+-#LDFLAGS+=-li386
+-LIBS+=/usr/lib/libamd64.a
+-LDFLAGS+=-lamd64
+ RAWIO=1
endif
--# The next check is not really specific to FreeBSD or OpenBSD -- the version of
--# gcc I use is just old.
--ifeq ($(findstring FreeBSD,$(OSTYPE)),)
--ifeq ($(findstring OpenBSD,$(OSTYPE)),)
--CFLAGS+=-std=gnu99
--endif
--endif
--
-
- DEFAULT_BUILD=1
+ ifeq ($(OSTYPE),NetBSD)
+-#LIBS+=/usr/lib/libi386.a
+-#LDFLAGS+=-li386
+-LIBS+=/usr/lib/libx86_64.a
+-LDFLAGS+=-lx86_64
+ RAWIO=1
+ endif
-@@ -90,8 +82,18 @@ endif
+@@ -131,6 +122,21 @@ endif
- ifeq ($(findstring OpenBSD,$(OSTYPE)),OpenBSD)
- # i386_iopl() is located in libi386.a (note the .a)
--LIBS+=/usr/lib/libi386.a
--LDFLAGS+=-L/usr/lib -li386
+ ifdef RAWIO
+ CFLAGS+=-DCD64_USE_RAWIO
++
++ifeq ($(OSTYPE),OpenBSD)
++# i386_iopl() is located in libi386.a (note the .a)
+#LIBS+=/usr/lib/libi386.a
+#LDFLAGS+=-li386
+LIBS+=/usr/lib/libamd64.a
+LDFLAGS+=-lamd64
-+RAWIO=1
+endif
+
-+ifeq ($(findstring NetBSD,$(OSTYPE)),NetBSD)
++ifeq ($(OSTYPE),NetBSD)
+#LIBS+=/usr/lib/libi386.a
+#LDFLAGS+=-li386
+LIBS+=/usr/lib/libx86_64.a
+LDFLAGS+=-lx86_64
- RAWIO=1
++endif
endif
+ default: all
diff --git a/emulators/ucon64/patches/patch-backup_libcd64_cd64io.c b/emulators/ucon64/patches/patch-backup_libcd64_cd64io.c
index e66f757f018..d65285427b5 100644
--- a/emulators/ucon64/patches/patch-backup_libcd64_cd64io.c
+++ b/emulators/ucon64/patches/patch-backup_libcd64_cd64io.c
@@ -1,39 +1,227 @@
-$NetBSD: patch-backup_libcd64_cd64io.c,v 1.1 2018/03/07 12:34:55 wiz Exp $
+$NetBSD: patch-backup_libcd64_cd64io.c,v 1.2 2019/07/07 22:47:57 wiz Exp $
Patch from upstream to improve build on NetBSD.
---- backup/libcd64/cd64io.c.orig 2017-07-29 05:55:48.000000000 +0000
+--- backup/libcd64/cd64io.c.orig 2019-05-06 06:48:17.000000000 +0000
+++ backup/libcd64/cd64io.c
-@@ -827,14 +827,29 @@ int cd64_open_rawio(struct cd64_t *cd64)
- return 0;
- }
- }
--#elif defined __OpenBSD__
-- /* I cannot test i386_set_ioperm(), so I only use i386_iopl() */
-+#elif (defined __OpenBSD__ || defined __NetBSD__) && defined __i386__
- ret = i386_iopl(3);
- if (ret == -1) {
- cd64->notice_callback2("i386_iopl: %s", strerror(errno));
- return 0;
- }
--#elif defined __FreeBSD__
+@@ -41,7 +41,20 @@
+
+ #ifdef CD64_USE_RAWIO
+
++static INLINE uint8_t inb2(uint16_t);
++static INLINE void outb2(uint8_t, uint16_t);
++
+ #if defined _WIN32 || defined __CYGWIN__
++#ifdef _MSC_VER
++#pragma warning(push)
++#pragma warning(disable: 4255) /* 'function' : no function prototype given: converting '()' to '(void)' */
++#pragma warning(disable: 4668) /* 'symbol' is not defined as a preprocessor macro, replacing with '0' for 'directives' */
++#pragma warning(disable: 4820) /* 'bytes' bytes padding added after construct 'member_name' */
+#endif
-+#ifdef __x86_64__
-+#ifdef __OpenBSD__
-+ ret = amd64_iopl(3);
-+ if (ret == -1) {
-+ cd64->notice_callback2("amd64_iopl: %s", strerror(errno));
-+ return 0;
-+ }
-+#elif defined __NetBSD__
-+ ret = x86_64_iopl(3);
-+ if (ret == -1) {
-+ cd64->notice_callback2("x86_64_iopl: %s", strerror(errno));
-+ return 0;
-+ }
++#include <windows.h> /* defines _WIN32 (checks for */
++#ifdef _MSC_VER /* __CYGWIN__ must come first) */
++#pragma warning(pop)
+#endif
+ #ifdef __CYGWIN__
+ #include <dlfcn.h>
+
+@@ -73,10 +86,8 @@ static short int (WINAPI *IsDriverInstal
+ static unsigned char (__stdcall *DlPortReadPortUchar)(unsigned short) = NULL;
+ static void (__stdcall *DlPortWritePortUchar)(unsigned short, unsigned char) = NULL;
+
+-static INLINE uint8_t inb(uint16_t);
+-static INLINE void outb(uint8_t, uint16_t);
+-static uint8_t (*input_byte)(uint16_t) = inb;
+-static void (*output_byte)(uint8_t, uint16_t) = outb;
++static uint8_t (*input_byte)(uint16_t) = inb2;
++static void (*output_byte)(uint8_t, uint16_t) = outb2;
+ #endif
+
+ #ifdef __BEOS__
+@@ -774,9 +785,8 @@ static LONG new_exception_filter(LPEXCEP
+ #endif
+ #endif /* _WIN32 || __CYGWIN__ */
+
+-#if ((defined _WIN32 || defined __CYGWIN__ || defined __BEOS__) && \
+- (defined __i386__ || defined __x86_64__)) || defined _MSC_VER
+-static INLINE uint8_t inb(uint16_t port) {
++#if defined __i386__ || defined __x86_64__ || defined _MSC_VER
++static INLINE uint8_t inb2(uint16_t port) {
+
+ #ifdef __BEOS__
+ st_ioport_t temp;
+@@ -785,27 +795,30 @@ static INLINE uint8_t inb(uint16_t port)
+ ioctl(io_portfd, 'r', &temp, 0);
+
+ return temp.data8;
+-#else /* Win32 */
++#elif defined _WIN32 || defined __CYGWIN__
+ if (io_driver_found) return input_byte(port);
+- else {
++ else
+ #ifdef _MSC_VER
+ #ifdef _M_IX86
+- return (unsigned char) _inp(port);
++ return (uint8_t) _inp(port);
+ #endif
+-#else
+- unsigned char byte;
+#endif
-+#ifdef __FreeBSD__
- cd64->portdevfd = open("/dev/io", O_RDWR);
- if (cd64->portdevfd == -1) {
- cd64->portdevfd = 0;
++#endif /* _WIN32 || __CYGWIN__ */
++#if defined __MINGW32__ || defined __CYGWIN__ || \
++ ((defined __i386__ || defined __x86_64__) && !defined __BEOS__)
++ {
++ uint8_t byte;
+ __asm__ __volatile__
+ ("inb %1, %0"
+ : "=a" (byte)
+ : "d" (port)
+ );
+ return byte;
+-#endif
+ }
+ #endif
+ }
+
+-static INLINE void outb(uint8_t byte, uint16_t port) {
++static INLINE void outb2(uint8_t byte, uint16_t port) {
+
+ #ifdef __BEOS__
+ st_ioport_t temp;
+@@ -813,24 +826,27 @@ static INLINE void outb(uint8_t byte, ui
+ temp.port = port;
+ temp.data8 = byte;
+ ioctl(io_portfd, 'w', &temp, 0);
+-#else /* Win32 */
++#elif defined _WIN32 || defined __CYGWIN__
+ if (io_driver_found) output_byte(byte, port);
+- else {
++ else
+ #ifdef _MSC_VER
+ #ifdef _M_IX86
+ _outp(port, byte);
+ #endif
+-#else
++#endif
++#endif /* _WIN32 || __CYGWIN__ */
++#if defined __MINGW32__ || defined __CYGWIN__ || \
++ ((defined __i386__ || defined __x86_64__) && !defined __BEOS__)
++ {
+ __asm__ __volatile__
+ ("outb %1, %0"
+ :
+ : "d" (port), "a" (byte)
+ );
+-#endif
+ }
+ #endif
+ }
+-#endif /* inb/outb defs */
++#endif /* inb2/outb2 defs */
+
+ int cd64_open_rawio(struct cd64_t *cd64) {
+
+@@ -1112,8 +1128,8 @@ int cd64_close_rawio(struct cd64_t *cd64
+ close_module(io_driver, cd64);
+ io_driver = NULL;
+ io_driver_found = 0;
+- input_byte = inb;
+- output_byte = outb;
++ input_byte = inb2;
++ output_byte = outb2;
+ #endif
+
+ return 1;
+@@ -1127,7 +1143,7 @@ static INLINE int cd64_wait_rawio(struct
+ i = 0;
+
+ if (cd64->using_ppa) {
+- status = inb((uint16_t) (cd64->port+1));
++ status = inb2((uint16_t) (cd64->port+1));
+
+ while (status & 0x80) {
+ i++;
+@@ -1136,15 +1152,15 @@ static INLINE int cd64_wait_rawio(struct
+ * Try to knock some sense into it. */
+ uint8_t dir = 1;
+ status = 0x06 | (dir << 5);
+- outb(status, (uint16_t) (cd64->port+2));
++ outb2(status, (uint16_t) (cd64->port+2));
+
+ dir = 0;
+ status = 0x04 | (dir << 5);
+- outb(status, (uint16_t) (cd64->port+2));
++ outb2(status, (uint16_t) (cd64->port+2));
+ status = 0x05 | (dir << 5);
+- outb(status, (uint16_t) (cd64->port+2));
++ outb2(status, (uint16_t) (cd64->port+2));
+ status = 0x04 | (dir << 5);
+- outb(status, (uint16_t) (cd64->port+2));
++ outb2(status, (uint16_t) (cd64->port+2));
+
+ reset_tries++;
+ i = 0;
+@@ -1155,14 +1171,14 @@ static INLINE int cd64_wait_rawio(struct
+ break;
+ }
+
+- status = inb((uint16_t) (cd64->port+1));
++ status = inb2((uint16_t) (cd64->port+1));
+ }
+ }
+ else { /* Comms link */
+- status = inb((uint16_t) (cd64->port+2));
++ status = inb2((uint16_t) (cd64->port+2));
+ while (status & 1) {
+ /* Do we need to handle a stuck situation here? */
+- status = inb((uint16_t) (cd64->port+2));
++ status = inb2((uint16_t) (cd64->port+2));
+ }
+ }
+
+@@ -1181,10 +1197,10 @@ int cd64_xfer_rawio(struct cd64_t *cd64,
+ if (delayms) MSLEEP(delayms);
+ dir = 1;
+ ctl = 0x06 | (dir << 5);
+- outb(ctl, (uint16_t) (cd64->port+2));
++ outb2(ctl, (uint16_t) (cd64->port+2));
+ if (delayms) MSLEEP(delayms);
+ if (rd) {
+- *rd = inb((uint16_t) cd64->port);
++ *rd = inb2((uint16_t) cd64->port);
+ #if DEBUG_LOWLEVEL
+ printf("got %xh", *rd);
+ if (*rd > 0x20) printf(" (%c)", *rd);
+@@ -1195,10 +1211,10 @@ int cd64_xfer_rawio(struct cd64_t *cd64,
+ if (delayms) MSLEEP(delayms);
+ dir = 0;
+ ctl = 0x04 | (dir << 5);
+- outb(ctl, (uint16_t) (cd64->port+2));
++ outb2(ctl, (uint16_t) (cd64->port+2));
+ if (delayms) MSLEEP(delayms);
+ if (wr) {
+- outb(*wr, (uint16_t) cd64->port);
++ outb2(*wr, (uint16_t) cd64->port);
+ #if DEBUG_LOWLEVEL
+ printf("put %xh", *wr);
+ if (*wr > 0x20) printf(" (%c)", *wr);
+@@ -1207,15 +1223,15 @@ int cd64_xfer_rawio(struct cd64_t *cd64,
+ }
+ if (delayms) MSLEEP(delayms);
+ ctl = 0x05 | (dir << 5);
+- outb(ctl, (uint16_t) (cd64->port+2));
++ outb2(ctl, (uint16_t) (cd64->port+2));
+ if (delayms) MSLEEP(delayms);
+ ctl = 0x04 | (dir << 5);
+- outb(ctl, (uint16_t) (cd64->port+2));
++ outb2(ctl, (uint16_t) (cd64->port+2));
+ }
+ else { /* Comms link */
+- outb(*wr, (uint16_t) cd64->port);
++ outb2(*wr, (uint16_t) cd64->port);
+ if (!cd64_wait_rawio(cd64)) { return 0; }
+- *rd = inb((uint16_t) cd64->port);
++ *rd = inb2((uint16_t) cd64->port);
+ }
+
+ return 1;
diff --git a/emulators/ucon64/patches/patch-backup_libcd64_cd64io.h b/emulators/ucon64/patches/patch-backup_libcd64_cd64io.h
index 8d630925e19..e736cf5ad12 100644
--- a/emulators/ucon64/patches/patch-backup_libcd64_cd64io.h
+++ b/emulators/ucon64/patches/patch-backup_libcd64_cd64io.h
@@ -1,19 +1,77 @@
-$NetBSD: patch-backup_libcd64_cd64io.h,v 1.1 2018/03/07 12:34:55 wiz Exp $
+$NetBSD: patch-backup_libcd64_cd64io.h,v 1.2 2019/07/07 22:47:57 wiz Exp $
Patch from upstream to improve build on NetBSD.
---- backup/libcd64/cd64io.h.orig 2015-11-29 19:31:07.000000000 +0000
+--- backup/libcd64/cd64io.h.orig 2018-03-07 11:09:59.000000000 +0000
+++ backup/libcd64/cd64io.h
-@@ -34,10 +34,10 @@ int cd64_xfer_portdev(struct cd64_t *cd6
- #if defined __linux__ && (defined __i386__ || defined __x86_64__)
+@@ -30,32 +30,15 @@ int cd64_xfer_portdev(struct cd64_t *cd6
+ #endif
+
+ #ifdef CD64_USE_RAWIO
+-/* #define REALLY_SLOW_IO */
+-#if defined __linux__ && (defined __i386__ || defined __x86_64__)
++#ifdef __linux__
#include <sys/io.h>
#endif
--#ifdef __OpenBSD__
-+#if (defined __OpenBSD__ || defined __NetBSD__) && (defined __i386__ || defined __x86_64__)
+-#if (defined __OpenBSD__ || defined __NetBSD__) && (defined __i386__ || defined __x86_64__)
++#if defined __OpenBSD__ || defined __NetBSD__
#include <sys/types.h>
#include <machine/sysarch.h>
--#include <i386/pio.h>
-+#include <machine/pio.h>
- /* pio.h defines several I/O functions & macros, including the macros inb() and
- * outb(). This shows that using a bit of inline assembly is not such a bad idea
- * at all. */
+-#include <machine/pio.h>
+-/* pio.h defines several I/O functions & macros, including the macros inb() and
+- * outb(). This shows that using a bit of inline assembly is not such a bad idea
+- * at all. */
+-#undef inb
+-#define inb(port) __inb(port)
+-#undef outb
+-#define outb(data, port) __outb(port, data)
+ #endif
+ #ifdef __FreeBSD__
+ #include <fcntl.h>
+-#include <machine/cpufunc.h>
+-/* Almost the same story as under OpenBSD. cpufunc.h defines the macros inb()
+- * and outb(). We redefine them. Be sure _POSIX_SOURCE is not defined before
+- * including <machine/cpufunc.h>. */
+-#undef inb
+-#define inb(port) inbv(port)
+-#undef outb
+-#define outb(data, port) outbv(port, data)
+ #endif
+ #ifdef __BEOS__
+ #include <fcntl.h>
+@@ -68,24 +51,6 @@ int cd64_xfer_portdev(struct cd64_t *cd6
+ #pragma warning(pop)
+ #define F_OK 0
+ #endif
+-#ifdef __MSDOS__
+-#include <pc.h> /* inportb() & outportb() */
+-#define inb(port) inportb(port)
+-#define outb(data, port) outportb(port, data)
+-#endif
+-#if defined _WIN32 || defined __CYGWIN__
+-#ifdef _MSC_VER
+-#pragma warning(push)
+-#pragma warning(disable: 4255) /* 'function' : no function prototype given: converting '()' to '(void)' */
+-#pragma warning(disable: 4668) /* 'symbol' is not defined as a preprocessor macro, replacing with '0' for 'directives' */
+-#pragma warning(disable: 4820) /* 'bytes' bytes padding added after construct 'member_name' */
+-#endif
+-#include <windows.h> /* defines _WIN32 (checks for */
+-#ifdef _MSC_VER /* __CYGWIN__ must come first) */
+-#pragma warning(pop)
+-#endif
+-#endif /* _WIN32 || __CYGWIN__ */
+-
+ int cd64_open_rawio(struct cd64_t *cd64);
+ int cd64_close_rawio(struct cd64_t *cd64);
+ int cd64_xfer_rawio(struct cd64_t *cd64, uint8_t *wr, uint8_t *rd, int delayms);
+@@ -99,8 +64,8 @@ int cd64_xfer_rawio(struct cd64_t *cd64,
+ #pragma warning(disable: 4668) /* 'symbol' is not defined as a preprocessor macro, replacing with '0' for 'directives' */
+ #pragma warning(disable: 4820) /* 'bytes' bytes padding added after construct 'member_name' */
+ #endif
+-#include <windows.h>
+-#ifdef _MSC_VER
++#include <windows.h> /* defines _WIN32 (checks for */
++#ifdef _MSC_VER /* __CYGWIN__ must come first) */
+ #pragma warning(pop)
+ #endif
+ #define MSLEEP(x) Sleep(x)
diff --git a/emulators/ucon64/patches/patch-config.mak.in b/emulators/ucon64/patches/patch-config.mak.in
deleted file mode 100644
index d7719d9b4bb..00000000000
--- a/emulators/ucon64/patches/patch-config.mak.in
+++ /dev/null
@@ -1,13 +0,0 @@
-$NetBSD: patch-config.mak.in,v 1.1 2018/03/07 12:34:55 wiz Exp $
-
-Patch from upstream to improve build on NetBSD.
-
---- config.mak.in.orig 2017-04-26 18:39:41.000000000 +0000
-+++ config.mak.in
-@@ -7,4 +7,5 @@
-
- CC=@CC@
- CFLAGS+=@DEFS@
--LIBI386=@LIBI386_MAKE@
-+LIBIOPL_OPENBSD=@LIBIOPL_OPENBSD_MAKE@
-+LIBIOPL_NETBSD=@LIBIOPL_NETBSD_MAKE@
diff --git a/emulators/ucon64/patches/patch-configure b/emulators/ucon64/patches/patch-configure
index 65db7026513..008667c3a45 100644
--- a/emulators/ucon64/patches/patch-configure
+++ b/emulators/ucon64/patches/patch-configure
@@ -1,24 +1,15 @@
-$NetBSD: patch-configure,v 1.1 2018/03/07 12:34:55 wiz Exp $
+$NetBSD: patch-configure,v 1.2 2019/07/07 22:47:57 wiz Exp $
Patch from upstream to improve build on NetBSD.
---- configure.orig 2017-04-28 17:02:28.000000000 +0000
+--- configure.orig 2019-05-30 15:37:45.000000000 +0000
+++ configure
-@@ -629,7 +629,7 @@ RANLIB
- LIBOBJS
- DEFINE_USB_MAKE
- DEFINE_ZLIB_MAKE
--LIBI386_MAKE
-+LIBIOPL_NETBSD_MAKE
- DEFINE_LIBCD64_MAKE
- DEFINE_DISCMAGE_MAKE
- DEFINE_DLOPEN_MAKE
-@@ -3300,7 +3300,7 @@ $as_echo "#define USE_LIBCD64 1" >>confd
+@@ -3434,7 +3434,7 @@ fi
- DEFINE_LIBCD64_MAKE="USE_LIBCD64=1"
- else
-- LIBI386_MAKE="-li386"
-+ LIBIOPL_NETBSD_MAKE="-lx86_64"
- fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_libcd64" >&5
- $as_echo "$with_libcd64" >&6; }
+ if test $with_libcd64 = yes; then
+ CFLAGS0=$CFLAGS
+- CFLAGS+=" -Ibackup/libcd64"
++ CFLAGS="$CFLAGS -Ibackup/libcd64"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h. */
+ #include "ultra64/host/cd64lib.h"
diff --git a/emulators/ucon64/patches/patch-configure.in b/emulators/ucon64/patches/patch-configure.in
index 3045a1f1628..76e33517b48 100644
--- a/emulators/ucon64/patches/patch-configure.in
+++ b/emulators/ucon64/patches/patch-configure.in
@@ -1,27 +1,15 @@
-$NetBSD: patch-configure.in,v 1.1 2018/03/07 12:34:55 wiz Exp $
+$NetBSD: patch-configure.in,v 1.2 2019/07/07 22:47:57 wiz Exp $
Patch from upstream to improve build on NetBSD.
---- configure.in.orig 2017-04-28 17:01:51.000000000 +0000
+--- configure.in.orig 2019-05-30 15:24:12.000000000 +0000
+++ configure.in
-@@ -139,13 +139,16 @@ if test $with_libcd64 = yes; then
- AC_DEFINE(USE_LIBCD64, 1, [build with libcd64 support (default: no)])
- DEFINE_LIBCD64_MAKE="USE_LIBCD64=1"
- else
-- dnl libi386 is necessary under OpenBSD, but only if libcd64 isn't enabled. The
-- dnl reason is that libcd64 already (statically) links to libi386.
-- LIBI386_MAKE="-li386"
-+ dnl libi386 or libamd64 is necessary on OpenBSD, but only if libcd64 isn't
-+ dnl enabled, because libcd64 already links to libi386 or libamd64.
-+dnl LIBIOPL_MAKE="-li386"
-+ LIBIOPL_OPENBSD_MAKE="-lamd64"
-+ LIBIOPL_NETBSD_MAKE="-lx86_64"
+@@ -125,7 +125,7 @@ AC_ARG_WITH(libcd64,
+ with_libcd64=no)
+ if test $with_libcd64 = yes; then
+ CFLAGS0=$CFLAGS
+- CFLAGS+=" -Ibackup/libcd64"
++ CFLAGS="$CFLAGS -Ibackup/libcd64"
+ AC_TRY_COMPILE([#include "ultra64/host/cd64lib.h"], , with_libcd64=yes, with_libcd64=no)
+ CFLAGS=$CFLAGS0
fi
- AC_MSG_RESULT($with_libcd64)
- AC_SUBST(DEFINE_LIBCD64_MAKE)
--AC_SUBST(LIBI386_MAKE)
-+AC_SUBST(LIBIOPL_OPENBSD_MAKE)
-+AC_SUBST(LIBIOPL_NETBSD_MAKE)
-
-
- AC_MSG_CHECKING(whether to build without gzip and zip support)
diff --git a/emulators/ucon64/patches/patch-libdiscmage_libdiscmage.h b/emulators/ucon64/patches/patch-libdiscmage_libdiscmage.h
deleted file mode 100644
index 28f69999fd4..00000000000
--- a/emulators/ucon64/patches/patch-libdiscmage_libdiscmage.h
+++ /dev/null
@@ -1,28 +0,0 @@
-$NetBSD: patch-libdiscmage_libdiscmage.h,v 1.2 2018/03/07 12:34:55 wiz Exp $
-
-Patch from upstream to improve build on NetBSD.
-
---- libdiscmage/libdiscmage.h.orig 2015-11-16 01:33:49.000000000 +0000
-+++ libdiscmage/libdiscmage.h
-@@ -1,8 +1,8 @@
- /*
- libdiscmage.h - libdiscmage
-
--Copyright (c) 2002 - 2004 NoisyB
--Copyright (c) 2002 - 2004 dbjh
-+Copyright (c) 2002 - 2004 NoisyB
-+Copyright (c) 2002 - 2004, 2018 dbjh
-
-
- This library is free software; you can redistribute it and/or
-@@ -28,9 +28,7 @@ extern "C" {
-
- #include <stdio.h> // FILENAME_MAX
-
--#if defined __linux__ || defined __FreeBSD__ || defined __OpenBSD__ || \
-- defined __solaris__ || defined __MINGW32__ || defined __CYGWIN__ || \
-- defined __BEOS__ || defined AMIGA || defined __APPLE__ // Mac OS X actually
-+#if !(defined __MSDOS__ || defined _MSC_VER)
- // We cannot use config.h (for HAVE_INTTYPES_H), because this header file may be
- // installed in a system include directory
- #include <inttypes.h>
diff --git a/emulators/ucon64/patches/patch-libdiscmage_misc__z.h b/emulators/ucon64/patches/patch-libdiscmage_misc__z.h
new file mode 100644
index 00000000000..4b9ff037bc3
--- /dev/null
+++ b/emulators/ucon64/patches/patch-libdiscmage_misc__z.h
@@ -0,0 +1,23 @@
+$NetBSD: patch-libdiscmage_misc__z.h,v 1.1 2019/07/07 22:47:57 wiz Exp $
+
+Patch from upstream to improve build on NetBSD.
+
+--- libdiscmage/misc_z.h.orig 2017-05-05 10:26:38.000000000 +0000
++++ libdiscmage/misc_z.h
+@@ -1,7 +1,7 @@
+ /*
+ misc_z.h - miscellaneous zlib functions
+
+-Copyright (c) 2001 - 2004, 2016 - 2017 dbjh
++Copyright (c) 2001 - 2004, 2016 - 2017, 2019 dbjh
+
+
+ This program is free software; you can redistribute it and/or modify
+@@ -58,6 +58,7 @@ extern off_t q_fsize2 (const char *filen
+ #define fseek(FILE, OFFSET, MODE) fseek2(FILE, OFFSET, MODE)
+ #define fread(BUF, SIZE, NUM, FILE) fread2(BUF, SIZE, NUM, FILE)
+ #define fgetc(FILE) fgetc2(FILE)
++#undef fgets // necessary on (at least) NetBSD
+ #define fgets(BUF, MAXLEN, FILE) fgets2(BUF, MAXLEN, FILE)
+ #undef feof // necessary on (at least) Cygwin
+ #define feof(FILE) feof2(FILE)
diff --git a/emulators/ucon64/patches/patch-misc_archive.h b/emulators/ucon64/patches/patch-misc_archive.h
new file mode 100644
index 00000000000..b659d97c17d
--- /dev/null
+++ b/emulators/ucon64/patches/patch-misc_archive.h
@@ -0,0 +1,23 @@
+$NetBSD: patch-misc_archive.h,v 1.1 2019/07/07 22:47:57 wiz Exp $
+
+Patch from upstream to improve build on NetBSD.
+
+--- misc/archive.h.orig 2017-05-05 09:40:40.000000000 +0000
++++ misc/archive.h
+@@ -1,7 +1,7 @@
+ /*
+ archive.h - g(un)zip and unzip support
+
+-Copyright (c) 2001 - 2004, 2015 - 2017 dbjh
++Copyright (c) 2001 - 2004, 2015 - 2017, 2019 dbjh
+
+
+ This program is free software; you can redistribute it and/or modify
+@@ -58,6 +58,7 @@ extern off_t fsizeof2 (const char *filen
+ #define fseek(FILE, OFFSET, MODE) fseek2(FILE, OFFSET, MODE)
+ #define fread(BUF, SIZE, NUM, FILE) fread2(BUF, SIZE, NUM, FILE)
+ #define fgetc(FILE) fgetc2(FILE)
++#undef fgets // necessary on (at least) NetBSD
+ #define fgets(BUF, MAXLEN, FILE) fgets2(BUF, MAXLEN, FILE)
+ #undef feof // necessary on (at least) Cygwin
+ #define feof(FILE) feof2(FILE)
diff --git a/emulators/ucon64/patches/patch-misc_parallel.c b/emulators/ucon64/patches/patch-misc_parallel.c
deleted file mode 100644
index 76b016537ae..00000000000
--- a/emulators/ucon64/patches/patch-misc_parallel.c
+++ /dev/null
@@ -1,54 +0,0 @@
-$NetBSD: patch-misc_parallel.c,v 1.1 2018/03/07 12:34:55 wiz Exp $
-
-Patch from upstream to improve build on NetBSD.
-
---- misc/parallel.c.orig 2017-10-25 17:32:00.000000000 +0000
-+++ misc/parallel.c
-@@ -45,10 +45,10 @@ Foundation, Inc., 675 Mass Ave, Cambridg
- #else
- #error No sys/io.h; configure with --disable-parallel
- #endif
--#elif defined __OpenBSD__ // __linux__ && __GLIBC__
-+#elif defined __OpenBSD__ || defined __NetBSD__ // __linux__ && __GLIBC__
- #include <machine/sysarch.h>
- #include <sys/types.h>
--#elif defined __BEOS__ || defined __FreeBSD__ // __OpenBSD__
-+#elif defined __BEOS__ || defined __FreeBSD__ // __OpenBSD__ || __NetBSD__
- #include <fcntl.h>
- #elif defined AMIGA // __BEOS__ || __FreeBSD__
- #include <fcntl.h>
-@@ -698,7 +698,7 @@ parport_open (unsigned short port)
- } // causes core dump
- #endif // __linux__ && (__i386__ || __x86_64__) && !USE_PPDEV
-
--#ifdef __OpenBSD__ // || defined __NetBSD__, add after feature request ;-)
-+#if (defined __OpenBSD__ || defined __NetBSD__) && defined __i386__
- // We use i386_iopl() on OpenBSD for the same reasons we use iopl() on Linux
- // (i386_set_ioperm() has the same limitation as ioperm()).
- if (i386_iopl (3) == -1)
-@@ -709,6 +709,25 @@ parport_open (unsigned short port)
- exit (1);
- }
- #endif
-+#ifdef __x86_64__
-+#ifdef __OpenBSD__
-+ if (amd64_iopl (3) == -1)
-+ {
-+ fputs ("ERROR: Could not set the I/O privilege level to 3\n"
-+ " (This program needs root privileges for the requested action)\n",
-+ stderr);
-+ exit (1);
-+ }
-+#elif defined __NetBSD__
-+ if (x86_64_iopl (3) == -1)
-+ {
-+ fputs ("ERROR: Could not set the I/O privilege level to 3\n"
-+ " (This program needs root privileges for the requested action)\n",
-+ stderr);
-+ exit (1);
-+ }
-+#endif
-+#endif
-
- #if (defined __i386__ || defined __x86_64__ || defined _WIN32) && !defined USE_PPDEV
-
diff --git a/emulators/ucon64/patches/patch-misc_unzip.h b/emulators/ucon64/patches/patch-misc_unzip.h
deleted file mode 100644
index 74474973671..00000000000
--- a/emulators/ucon64/patches/patch-misc_unzip.h
+++ /dev/null
@@ -1,18 +0,0 @@
-$NetBSD: patch-misc_unzip.h,v 1.2 2018/03/07 12:34:55 wiz Exp $
-
-Patch from upstream to improve build on NetBSD.
-
---- misc/unzip.h.orig 2016-03-03 14:12:07.000000000 +0000
-+++ misc/unzip.h
-@@ -49,6 +49,11 @@
- extern "C" {
- #endif
-
-+// On NetBSD, OF is not defined in zconf.h, which is included by zlib.h.
-+#ifndef OF
-+#define OF(x) x
-+#endif
-+
- #ifndef _ZLIB_H
- #include "zlib.h"
- #endif