git: 5fb3b275a325 - main - emulators/{mame,mess}: Update to 0.249

From: Li-Wen Hsu <lwhsu_at_FreeBSD.org>
Date: Fri, 04 Nov 2022 02:53:44 UTC
The branch main has been updated by lwhsu:

URL: https://cgit.FreeBSD.org/ports/commit/?id=5fb3b275a32501e1df45a08b034b94b8eb93b9a2

commit 5fb3b275a32501e1df45a08b034b94b8eb93b9a2
Author:     Alastair Hogge <agh@riseup.net>
AuthorDate: 2022-11-03 17:25:22 +0000
Commit:     Li-Wen Hsu <lwhsu@FreeBSD.org>
CommitDate: 2022-11-04 02:52:13 +0000

    emulators/{mame,mess}: Update to 0.249
    
    Release note: https://www.mamedev.org/releases/whatsnew_0249.txt
    
    Also transfer maintainership.
    
    PR:             252362
    Reported by:    Stéphane D'Alu <sdalu@sdalu.com> (initial patches)
    Approved by:    manu
---
 emulators/mame/Makefile                            |  187 ++-
 emulators/mame/distinfo                            |    6 +-
 ...ch-3rdparty_asio_include_asio_detail_config.hpp |   18 -
 emulators/mame/files/patch-makefile                |   81 -
 emulators/mame/files/patch-src_osd_eigccx86.h      |  110 --
 emulators/mame/files/patch-src_osd_eminline.h      |   11 -
 emulators/mame/files/patch-src_osd_sdl_sdlprefix.h |    9 +-
 emulators/mame/files/pkg-message.in                |    8 +-
 emulators/mame/files/target.ini.in                 |  304 ++--
 emulators/mame/pkg-descr                           |   11 +-
 emulators/mame/pkg-plist                           | 1674 +++++++++++++++++++-
 emulators/mess/Makefile                            |    4 +-
 emulators/mess/pkg-descr                           |   10 +-
 emulators/mess/pkg-plist                           | 1658 ++++++++++++++++++-
 14 files changed, 3583 insertions(+), 508 deletions(-)

diff --git a/emulators/mame/Makefile b/emulators/mame/Makefile
index 395aa775cb54..74ec727882e0 100644
--- a/emulators/mame/Makefile
+++ b/emulators/mame/Makefile
@@ -1,59 +1,73 @@
 PORTNAME?=	mame
-PORTVERSION=	0.226
-PORTREVISION=	3
-CATEGORIES=	emulators
+PORTVERSION=	0.249
+CATEGORIES=	emulators games
 
-MAINTAINER=	manu@FreeBSD.org
-COMMENT=	Multi Arcade Machine Emulator
+MAINTAINER=	agh@riseup.net
+COMMENT?=	MAME: a multi-purpose emulation framework
 WWW?=		https://mamedev.org/
 
-LICENSE=	GPLv2
+LICENSE=	BSD3CLAUSE GPLv2
+LICENSE_COMB=	multi
+LICENSE_FILE=	${WRKSRC}/docs/LICENSE
+LICENSE_FILE_BSD3CLAUSE=	${WRKSRC}/docs/legal/BSD-3-Clause
+LICENSE_FILE_GPLv2=	${WRKSRC}/docs/legal/GPL-2.0
 
-ONLY_FOR_ARCHS=		amd64 armv7 i386 powerpc powerpc64 powerpc64le
+ONLY_FOR_ARCHS=	amd64 armv7 i386 powerpc powerpc64 powerpc64le
 ONLY_FOR_ARCHS_REASON=	not yet ported to any architecture other than armv7, x86, and powerpc*
 
-LIB_DEPENDS=	libFLAC.so:audio/flac \
-		libexpat.so:textproc/expat2 \
+BUILD_DEPENDS=	${PYTHON_PKGNAMEPREFIX}sphinxcontrib-svg2pdfconverter>0:textproc/py-sphinxcontrib-svg2pdfconverter@${PY_FLAVOR}
+LIB_DEPENDS=	libexpat.so:textproc/expat2 \
+		libFLAC.so:audio/flac \
 		libfontconfig.so:x11-fonts/fontconfig \
 		libfreetype.so:print/freetype2 \
 		libpugixml.so:textproc/pugixml
 RUN_DEPENDS=	liberation-fonts-ttf>=0:x11-fonts/liberation-fonts-ttf
 
 USES=		compiler:c++14-lang gl gmake jpeg localbase pkgconfig \
-		python:3.7,build qt:5 sdl shebangfix sqlite:3 xorg
+		python:3.9,build qt:5 sdl shebangfix sqlite:3 xorg
+
+BINARY_ALIAS=	python3=${PYTHON_CMD} python=${PYTHON_CMD}
 
 USE_GITHUB=	yes
 GH_ACCOUNT=	mamedev
-GH_PROJECT=	mame				# explicit (master port)
+GH_PROJECT=	mame # explicit (master port)
 GH_TAGNAME=	mame${PORTVERSION:S/.//}
 USE_GL=		gl
-USE_QT=		buildtools core gui qmake:build widgets
+USE_QT=		buildtools core gui qmake widgets
 USE_SDL=	sdl2 ttf2
 USE_XORG=	x11 xext xi xinerama xrender
 
-SHEBANG_FILES=	src/devices/cpu/m6502/m6502make.py \
-		src/devices/cpu/m6809/m6809make.py \
-		src/devices/cpu/mcs96/mcs96make.py \
-		src/devices/cpu/tms57002/tmsmake.py
-
 MAKEFILE=	makefile
-MAKE_ARGS=	TARGETOS=freebsd VERBOSE=1 TOOLS=1 USE_SYSTEM_LIB_PUGIXML=1 \
-		USE_SYSTEM_LIB_SQLITE3=1
-MAKE_ENV=	NOWERROR=1 USE_NETWORK=1 \
-		LD="${CXX}" PYTHON="${PYTHON_CMD}" \
-		OPT_FLAGS="${CXXFLAGS}" GCC_LDFLAGS="${LDFLAGS}" \
-		TARGET="${MTARGET}" SUBTARGET="${MSUBTARGET}" FULLNAME="mame" SDL_NETWORK="pcap"
+MAKE_ARGS=	TARGETOS=freebsd \
+		TOOLS=1 \
+		USE_SYSTEM_LIB_PUGIXML=1 \
+		USE_SYSTEM_LIB_SQLITE3=1 \
+		VERBOSE=1
+MAKE_ENV=	FULLNAME="mame" \
+		GCC_LDFLAGS="${LDFLAGS}" \
+		LD="${CXX}" \
+		NOWERROR=1 \
+		OPT_FLAGS="${CXXFLAGS}" \
+		PYTHON="${PYTHON_CMD}" \
+		SDL_NETWORK="pcap" \
+		SUBTARGET="${MSUBTARGET}" \
+		TARGET="${MTARGET}" \
+		USE_NETWORK=1
 MAKE_JOBS_UNSAFE=	yes
 
 SUB_FILES=	pkg-message target.ini
-SUB_LIST=	MTARGET=${MTARGET} MSUBTARGET=${MSUBTARGET}
+SUB_LIST=	MSUBTARGET=${MSUBTARGET} \
+		MTARGET=${MTARGET}
 
-PORTDOCS=	*
+PORTDOCS=	LICENSE html/* legal/*
 PORTEXAMPLES=	${MSUBTARGET}.ini
 
-OPTIONS_DEFINE=		DEBUG DOCS EXAMPLES
+DEBUG_MAKE_ENV=	DEBUG=1
 
-DEBUG_MAKE_ENV=		DEBUG=1
+OPTIONS_DEFINE=	DEBUG DOCS EXAMPLES
+DEBUG_DESC=	Build with debug profiling and symbols
+DOCS_DESC=	Install additional MAME documentation
+EXAMPLES_DESC=	Install example ${EMULATOR}.ini configuration
 
 GENIE=		${WRKSRC}/3rdparty/genie
 MSUBTARGET?=	mame
@@ -61,26 +75,102 @@ MTARGET?=	mame
 
 .include <bsd.port.options.mk>
 
+.if ${PORT_OPTIONS:MDEBUG}
+WITH_DEBUG=	"YES"
+MAKE_ENV+=	DEBUG="1" \
+		OPTIMIZE="0" \
+		PROFILER="1" \
+		SYMBOLS="1"
+.endif
+
 .if ${ARCH} == amd64 || ${ARCH:Mpowerpc64*}
 MAKE_ARGS+=	PTR64=1
-EMULATOR=	${MSUBTARGET}64
-.else
-EMULATOR=	${MSUBTARGET}
 .endif
+
+EMULATOR=	${MSUBTARGET}
 PLIST_SUB+=	EMULATOR=${EMULATOR}
 
+do-build-DOCS-on:
+	(cd ${WRKSRC}/docs && ${SETENV} ${MAKE_ENV} \
+		${MAKE_CMD} ${MAKE_ARGS} html \
+		SPHINXBUILD=sphinx-build-${PYTHON_VER})
+	@${RM} ${WRKSRC}/docs/build/html/.buildinfo
+
+do-install:
+.if ${MSUBTARGET:Mmame}
+	(cd ${WRKSRC} && ${INSTALL_PROGRAM} castool chdman floptool imgtool \
+		jedutil ldresample ldverify nltool nlwav pngcmp regrep \
+		romcmp split srcclean testkeys unidasm \
+		${STAGEDIR}${PREFIX}/bin)
+.endif
+
+.for data in artwork bgfx ctrlr ini language hash plugins samples
+	(cd ${WRKSRC} && ${COPYTREE_SHARE} ${data} ${STAGEDIR}${DATADIR})
+.endfor
+
+	${MKDIR} ${STAGEDIR}${DOCSDIR}
+.if ${MSUBTARGET:Mmess}
+	${INSTALL_MAN} ${WRKSRC}/docs/man/${MTARGET}.6 \
+		${STAGEDIR}${MANPREFIX}/man/man6/${EMULATOR}.6
+.else
+	${INSTALL_MAN} ${WRKSRC}/docs/man/*.1 \
+		${STAGEDIR}${MANPREFIX}/man/man1
+	${INSTALL_MAN} ${WRKSRC}/docs/build/man/*.1 \
+		${STAGEDIR}${MANPREFIX}/man/man1
+	${INSTALL_MAN} ${WRKSRC}/docs/man/${EMULATOR}.6 \
+		${STAGEDIR}${MANPREFIX}/man/man6
+	${INSTALL_MAN} ${WRKSRC}/docs/LICENSE ${STAGEDIR}${DOCSDIR}
+	(cd ${WRKSRC}/docs && ${COPYTREE_SHARE} legal ${STAGEDIR}${DOCSDIR})
+.endif
+
+do-install-DEBUG-off:
+.if ${MSUBTARGET:Mmess}
+	${INSTALL_PROGRAM} ${WRKSRC}/${MTARGET}${MSUBTARGET} \
+		${STAGEDIR}${PREFIX}/bin/${EMULATOR}
+.else
+	${INSTALL_PROGRAM} ${WRKSRC}/${MSUBTARGET} \
+		${STAGEDIR}${PREFIX}/bin/${EMULATOR}
+.endif
+
+do-install-DEBUG-on:
+.if ${MSUBTARGET:Mmess}
+	${INSTALL_PROGRAM} ${WRKSRC}/${MTARGET}${MSUBTARGET}d \
+		${STAGEDIR}${PREFIX}/bin/${EMULATOR}
+.else
+	${INSTALL_PROGRAM} ${WRKSRC}/${MSUBTARGET}d \
+		${STAGEDIR}${PREFIX}/bin/${EMULATOR}
+.endif
+
+post-build:
+.if ${MSUBTARGET:Mmame}
+	cd ${WRKSRC}/docs && ${SETENV} ${MAKE_ENV} \
+		${MAKE_CMD} ${MAKE_ARGS} man \
+		SPHINXBUILD=sphinx-build-${PYTHON_VER}
+.endif
+
+post-install-DOCS-on:
+.if ${MSUBTARGET:Mmame}
+	${MKDIR} ${STAGEDIR}${DOCSDIR}
+	(cd ${WRKSRC}/docs/build && ${COPYTREE_SHARE} html \
+		${STAGEDIR}${DOCSDIR})
+.endif
+
+post-install-EXAMPLES-on:
+	${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
+	${INSTALL_DATA} ${WRKDIR}/target.ini \
+		${STAGEDIR}${EXAMPLESDIR}/${EMULATOR}.ini
+
 post-patch:
 	@${RM} ${WRKSRC}/3rdparty/bx/include/compat/freebsd/dirent.h
 	@${RM} ${WRKSRC}/3rdparty/bx/include/compat/freebsd/signal.h
 	@${MV} ${GENIE}/build/gmake.freebsd ${GENIE}/build/gmake.bsd
 	@${REINPLACE_CMD} -e \
-		's|^\(CC \)|#\1| ; \
+		's|^\(AR \)|#\1| ; \
+		 s|^\(CC \)|#\1| ; \
 		 s|^\(CXX \)|#\1| ; \
 		 s|^\(CXX:\)|#\1| ; \
 		 s|^\(LD \)|#\1| ; \
-		 s|^\(PYTHON \)|#\1| ; \
-		 s| .(ARCH)|| ; \
-		 s|FreeBSD|${OPSYS}|g' \
+		 s| .(ARCH)||g' \
 		 ${WRKSRC}/makefile \
 		 ${GENIE}/build/gmake.bsd/genie.make
 	@${REINPLACE_CMD} -e 's|gcc|cc|; s|g++|c++|' \
@@ -90,39 +180,10 @@ post-patch:
 	@${REINPLACE_CMD} -e 's|= \"gcc|= \"cc|; s|= \"g++|= \"c++|' \
 		-e "s|'CXX =|'#CXX =|; s|'CC  =|'#CC  =|; s| .(ARCH)| |g" \
 		${GENIE}/src/host/scripts.c
-	# we can't fix two types of python shebangs, so do these manually
-	@${REINPLACE_CMD} -i "" -e "s|/usr/bin/env python|${PYTHON_CMD}|" \
-		${WRKSRC}/scripts/build/png*.py
-	@${REINPLACE_CMD} -e 's|"python"|"${PYTHON_CMD}"|' \
-		${WRKSRC}/scripts/genie.lua
 	@${GREP} -rl '"png.h"' ${WRKSRC}/src | ${XARGS} ${REINPLACE_CMD} \
 		-e 's|"png.h"|"localpng.h"|'
 	@${REINPLACE_CMD} -e 's|"util/png.h"|"util/localpng.h"|' \
 		${WRKSRC}/src/frontend/mame/ui/icorender.cpp
 	@${MV} ${WRKSRC}/src/lib/util/png.h ${WRKSRC}/src/lib/util/localpng.h
 
-do-install:
-	@${MKDIR} ${STAGEDIR}${DATADIR} \
-		${STAGEDIR}${DOCSDIR} \
-		${STAGEDIR}${EXAMPLESDIR} \
-		${STAGEDIR}${PREFIX}/libexec/${MSUBTARGET}
-	${INSTALL_PROGRAM} ${WRKSRC}/${EMULATOR} ${STAGEDIR}${PREFIX}/bin
-.if ${MSUBTARGET:Mmame}
-	(cd ${WRKSRC} && \
-		${INSTALL_PROGRAM} chdman jedutil ldresample ldverify \
-		romcmp unidasm \
-		${STAGEDIR}${PREFIX}/libexec/mame)
-.endif
-.if ${MSUBTARGET:Mmess}
-	(cd ${WRKSRC} && ${INSTALL_PROGRAM} castool chdman floptool imgtool jedutil \
-		ldresample ldverify nltool nlwav pngcmp regrep romcmp split \
-		srcclean unidasm \
-		${STAGEDIR}${PREFIX}/libexec/mess)
-.endif
-	(cd ${WRKSRC} && ${COPYTREE_SHARE} artwork ${STAGEDIR}${DATADIR})
-	(cd ${WRKSRC} && ${COPYTREE_SHARE} hash ${STAGEDIR}${DATADIR})
-	(cd ${WRKSRC} && ${COPYTREE_SHARE} docs ${STAGEDIR}${DOCSDIR})
-	${INSTALL_DATA} ${WRKDIR}/target.ini \
-		${STAGEDIR}${EXAMPLESDIR}/${MSUBTARGET}.ini
-
 .include <bsd.port.mk>
diff --git a/emulators/mame/distinfo b/emulators/mame/distinfo
index 24c58db83691..28feea164540 100644
--- a/emulators/mame/distinfo
+++ b/emulators/mame/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1608936229
-SHA256 (mamedev-mame-0.226-mame0226_GH0.tar.gz) = 7c4c9ec232ba988e65fd29665c9b8e40b5ac3aa9f561eeb107cebbf08ba94baf
-SIZE (mamedev-mame-0.226-mame0226_GH0.tar.gz) = 196379874
+TIMESTAMP = 1667010629
+SHA256 (mamedev-mame-0.249-mame0249_GH0.tar.gz) = 93df1b954c2e6c0fe8b54b3662f642f77d7d460f42c0de0bac0b03ccb86756c4
+SIZE (mamedev-mame-0.249-mame0249_GH0.tar.gz) = 185957630
diff --git a/emulators/mame/files/patch-3rdparty_asio_include_asio_detail_config.hpp b/emulators/mame/files/patch-3rdparty_asio_include_asio_detail_config.hpp
deleted file mode 100644
index 6f26555ee9cf..000000000000
--- a/emulators/mame/files/patch-3rdparty_asio_include_asio_detail_config.hpp
+++ /dev/null
@@ -1,18 +0,0 @@
---- 3rdparty/asio/include/asio/detail/config.hpp.orig	2019-04-24 05:00:38 UTC
-+++ 3rdparty/asio/include/asio/detail/config.hpp
-@@ -713,14 +713,12 @@
- #      define ASIO_HAS_STD_STRING_VIEW 1
- #     endif
- #    endif
--#    if !defined(ASIO_HAS_STD_STRING_VIEW) && __has_include(<experimental/string_view>)
-+#    if !defined(ASIO_HAS_STD_STRING_VIEW) && __has_include(<string_view>)
- #     define ASIO_HAS_STD_STRING_VIEW 1
- #     if defined(__APPLE__)
- #      if ((__clang_major__ < 10) || ((__clang_major__ == 10) && (__clang_minor__ == 0) && (__clang_patchlevel__ < 1)))
- #        define ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW 1
- #       endif // clang < 10.0.1
--#      else // for non-Xcode Clang
--#        define ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW 1
- #      endif
- #    endif // __has_include(<experimental/string_view>)
- #   endif // (__cplusplus >= 201103)
diff --git a/emulators/mame/files/patch-makefile b/emulators/mame/files/patch-makefile
deleted file mode 100644
index 14f781dc5331..000000000000
--- a/emulators/mame/files/patch-makefile
+++ /dev/null
@@ -1,81 +0,0 @@
---- makefile.orig	2020-10-27 01:00:36 UTC
-+++ makefile
-@@ -319,6 +319,9 @@ endif
- ifeq ($(firstword $(filter ppc64,$(UNAME))),ppc64)
- ARCHITECTURE := _x64
- endif
-+ifeq ($(firstword $(filter powerpc64,$(UNAME))),powerpc64)
-+ARCHITECTURE := _x64
-+endif
- ifeq ($(firstword $(filter ppc64le,$(UNAME))),ppc64le)
- ARCHITECTURE := _x64
- endif
-@@ -399,6 +402,13 @@ ifndef FORCE_DRC_C_BACKEND
- endif
- endif
- 
-+# powerpc has inline assembly support but no DRC
-+ifeq ($(findstring powerpc,$(UNAME)),powerpc)
-+ifndef FORCE_DRC_C_BACKEND
-+	FORCE_DRC_C_BACKEND := 1
-+endif
-+endif
-+
- # Autodetect BIGENDIAN
- # MacOSX
- ifndef BIGENDIAN
-@@ -416,18 +426,26 @@ endif
- ifneq (,$(findstring s390x,$(UNAME)))
- BIGENDIAN := 1
- endif
-+# FreeBSD
-+ifneq (,$(findstring powerpc,$(UNAME)))
-+ifneq (,$(findstring powerpc64le,$(UNAME)))
-+BIGENDIAN := 0
-+else
-+BIGENDIAN := 1
-+endif
-+endif
- endif # BIGENDIAN
- 
- ifndef PYTHON_EXECUTABLE
--PYTHON := python
-+#PYTHON := python
- else
--PYTHON := $(PYTHON_EXECUTABLE)
-+#PYTHON := $(PYTHON_EXECUTABLE)
- endif
- 
- ifneq ($(TARGETOS),asmjs)
--CC := $(SILENT)gcc
--LD := $(SILENT)g++
--CXX:= $(SILENT)g++
-+#CC := $(SILENT)gcc
-+#LD := $(SILENT)g++
-+#CXX:= $(SILENT)g++
- endif
- 
- #-------------------------------------------------
-@@ -558,19 +576,19 @@ endif
- ifdef OVERRIDE_CC
- PARAMS += --CC='$(OVERRIDE_CC)'
- ifndef CROSS_BUILD
--CC := $(OVERRIDE_CC)
-+#CC := $(OVERRIDE_CC)
- endif
- endif
- ifdef OVERRIDE_CXX
- PARAMS += --CXX='$(OVERRIDE_CXX)'
- ifndef CROSS_BUILD
--CXX := $(OVERRIDE_CXX)
-+#CXX := $(OVERRIDE_CXX)
- endif
- endif
- ifdef OVERRIDE_LD
- PARAMS += --LD='$(OVERRIDE_LD)'
- ifndef CROSS_BUILD
--LD := $(OVERRIDE_LD)
-+#LD := $(OVERRIDE_LD)
- endif
- endif
- 
diff --git a/emulators/mame/files/patch-src_osd_eigccx86.h b/emulators/mame/files/patch-src_osd_eigccx86.h
deleted file mode 100644
index cd230176a577..000000000000
--- a/emulators/mame/files/patch-src_osd_eigccx86.h
+++ /dev/null
@@ -1,110 +0,0 @@
---- src/osd/eigccx86.h.orig	2019-04-24 05:00:38 UTC
-+++ src/osd/eigccx86.h
-@@ -31,7 +31,7 @@
-     multiply and return the full 64 bit result
- -------------------------------------------------*/
- 
--#ifndef __x86_64__
-+#if !defined(__amd64__) && !defined(__x86_64__)
- #define mul_32x32 _mul_32x32
- inline int64_t ATTR_CONST ATTR_FORCE_INLINE
- _mul_32x32(int32_t a, int32_t b)
-@@ -55,7 +55,7 @@ _mul_32x32(int32_t a, int32_t b)
-     result
- -------------------------------------------------*/
- 
--#ifndef __x86_64__
-+#if !defined(__amd64__) && !defined(__x86_64__)
- #define mulu_32x32 _mulu_32x32
- inline uint64_t ATTR_CONST ATTR_FORCE_INLINE
- _mulu_32x32(uint32_t a, uint32_t b)
-@@ -126,7 +126,7 @@ _mulu_32x32_hi(uint32_t a, uint32_t b)
-     result to 32 bits
- -------------------------------------------------*/
- 
--#ifndef __x86_64__
-+#if !defined(__amd64__) && !defined(__x86_64__)
- #define mul_32x32_shift _mul_32x32_shift
- inline int32_t ATTR_CONST ATTR_FORCE_INLINE
- _mul_32x32_shift(int32_t a, int32_t b, uint8_t shift)
-@@ -156,7 +156,7 @@ _mul_32x32_shift(int32_t a, int32_t b, uint8_t shift)
-     result to 32 bits
- -------------------------------------------------*/
- 
--#ifndef __x86_64__
-+#if !defined(__amd64__) && !defined(__x86_64__)
- #define mulu_32x32_shift _mulu_32x32_shift
- inline uint32_t ATTR_CONST ATTR_FORCE_INLINE
- _mulu_32x32_shift(uint32_t a, uint32_t b, uint8_t shift)
-@@ -184,7 +184,7 @@ _mulu_32x32_shift(uint32_t a, uint32_t b, uint8_t shif
-     divide and return the 32 bit quotient
- -------------------------------------------------*/
- 
--#ifndef __x86_64__
-+#if !defined(__amd64__) && !defined(__x86_64__)
- #define div_64x32 _div_64x32
- inline int32_t ATTR_CONST ATTR_FORCE_INLINE
- _div_64x32(int64_t a, int32_t b)
-@@ -211,7 +211,7 @@ _div_64x32(int64_t a, int32_t b)
-     divide and return the 32 bit quotient
- -------------------------------------------------*/
- 
--#ifndef __x86_64__
-+#if !defined(__amd64__) && !defined(__x86_64__)
- #define divu_64x32 _divu_64x32
- inline uint32_t ATTR_CONST ATTR_FORCE_INLINE
- _divu_64x32(uint64_t a, uint32_t b)
-@@ -244,7 +244,7 @@ inline int32_t ATTR_FORCE_INLINE
- _div_64x32_rem(int64_t dividend, int32_t divisor, int32_t *remainder)
- {
- 	int32_t quotient;
--#ifndef __x86_64__
-+#if !defined(__amd64__) && !defined(__x86_64__)
- 
- 	// Throws arithmetic exception if result doesn't fit in 32 bits
- 	__asm__ (
-@@ -287,7 +287,7 @@ inline uint32_t ATTR_FORCE_INLINE
- _divu_64x32_rem(uint64_t dividend, uint32_t divisor, uint32_t *remainder)
- {
- 	uint32_t quotient;
--#ifndef __x86_64__
-+#if !defined(__amd64__) && !defined(__x86_64__)
- 
- 	// Throws arithmetic exception if result doesn't fit in 32 bits
- 	__asm__ (
-@@ -325,7 +325,7 @@ _divu_64x32_rem(uint64_t dividend, uint32_t divisor, u
-     division, and returning the 32 bit quotient
- -------------------------------------------------*/
- 
--#ifndef __x86_64__
-+#if !defined(__amd64__) && !defined(__x86_64__)
- #define div_32x32_shift _div_32x32_shift
- inline int32_t ATTR_CONST ATTR_FORCE_INLINE
- _div_32x32_shift(int32_t a, int32_t b, uint8_t shift)
-@@ -357,7 +357,7 @@ _div_32x32_shift(int32_t a, int32_t b, uint8_t shift)
-     division, and returning the 32 bit quotient
- -------------------------------------------------*/
- 
--#ifndef __x86_64__
-+#if !defined(__amd64__) && !defined(__x86_64__)
- #define divu_32x32_shift _divu_32x32_shift
- inline uint32_t ATTR_CONST ATTR_FORCE_INLINE
- _divu_32x32_shift(uint32_t a, uint32_t b, uint8_t shift)
-@@ -388,7 +388,7 @@ _divu_32x32_shift(uint32_t a, uint32_t b, uint8_t shif
-     divide and return the 32 bit remainder
- -------------------------------------------------*/
- 
--#ifndef __x86_64__
-+#if !defined(__amd64__) && !defined(__x86_64__)
- #define mod_64x32 _mod_64x32
- inline int32_t ATTR_CONST ATTR_FORCE_INLINE
- _mod_64x32(int64_t a, int32_t b)
-@@ -415,7 +415,7 @@ _mod_64x32(int64_t a, int32_t b)
-     divide and return the 32 bit remainder
- -------------------------------------------------*/
- 
--#ifndef __x86_64__
-+#if !defined(__amd64__) && !defined(__x86_64__)
- #define modu_64x32 _modu_64x32
- inline uint32_t ATTR_CONST ATTR_FORCE_INLINE
- _modu_64x32(uint64_t a, uint32_t b)
diff --git a/emulators/mame/files/patch-src_osd_eminline.h b/emulators/mame/files/patch-src_osd_eminline.h
deleted file mode 100644
index ca0f71526adf..000000000000
--- a/emulators/mame/files/patch-src_osd_eminline.h
+++ /dev/null
@@ -1,11 +0,0 @@
---- src/osd/eminline.h.orig	2018-02-27 15:59:06 UTC
-+++ src/osd/eminline.h
-@@ -21,7 +21,7 @@
- 
- #if defined(__GNUC__)
- 
--#if defined(__i386__) || defined(__x86_64__)
-+#if defined(__i386__) || defined(__x86_64__) || defined(__amd64__)
- #include "eigccx86.h"
- #elif defined(__ppc__) || defined (__PPC__) || defined(__ppc64__) || defined(__PPC64__)
- #include "eigccppc.h"
diff --git a/emulators/mame/files/patch-src_osd_sdl_sdlprefix.h b/emulators/mame/files/patch-src_osd_sdl_sdlprefix.h
index 1dce6ab01d76..aef78617bc07 100644
--- a/emulators/mame/files/patch-src_osd_sdl_sdlprefix.h
+++ b/emulators/mame/files/patch-src_osd_sdl_sdlprefix.h
@@ -1,7 +1,10 @@
---- src/osd/sdl/sdlprefix.h.orig	2018-02-27 15:59:06 UTC
+--- src/osd/sdl/sdlprefix.h.orig	2022-04-29 05:37:26 UTC
 +++ src/osd/sdl/sdlprefix.h
-@@ -48,6 +48,7 @@
- #define NO_AFFINITY_NP 1
+@@ -45,9 +45,9 @@
+ 
+ #elif defined(__FreeBSD__)
+ #define SDLMAME_FREEBSD 1
+-#define NO_AFFINITY_NP 1
  #elif defined(__DragonFly__)
  #define SDLMAME_DRAGONFLY 1
 +#define NO_AFFINITY_NP 1
diff --git a/emulators/mame/files/pkg-message.in b/emulators/mame/files/pkg-message.in
index 3d2ee477ee42..0d2518668aee 100644
--- a/emulators/mame/files/pkg-message.in
+++ b/emulators/mame/files/pkg-message.in
@@ -2,9 +2,11 @@
 { type: install
   message: <<EOM
 An example configuration file has been installed in
-"%%EXAMPLESDIR%%/%%MTARGET%%.ini"
-Should you create a "~/.%%MTARGET%%" directory and place it here or
-launch "%%MTARGET%% -createconfig" and place the %%MTARGET%%.ini created instead.
+"%%EXAMPLESDIR%%/%%MSUBTARGET%%.ini" This configuration can be copied to your
+"~/.%%MSUBTARGET%%" directory; alternatively, run "%%MSUBTARGET%% -createconfig" to
+create a clean copy of "%%MSUBTARGET%%.ini", which can be copied to
+"~/.%%MSUBTARGET%%", or elsewhere.
+To run %%MSUBTARGET%% with a custom path, run "%%MSUBTARGET%% -inipath path-to-%%MSUBTARGET%%.ini"
 EOM
 }
 ]
diff --git a/emulators/mame/files/target.ini.in b/emulators/mame/files/target.ini.in
index df1a88fbd17d..ce57b63419e6 100644
--- a/emulators/mame/files/target.ini.in
+++ b/emulators/mame/files/target.ini.in
@@ -1,7 +1,5 @@
-<UNADORNED0>              
-
-#
-# CORE CONFIGURATION OPTIONS
+#
+ninn# CORE CONFIGURATION OPTIONS
 #
 readconfig                1
 writeconfig               0
@@ -9,41 +7,50 @@ writeconfig               0
 #
 # CORE SEARCH PATH OPTIONS
 #
-rompath                   $HOME/.%%MTARGET%%/roms
-hashpath                  $HOME/.%%MTARGET%%/hash;/usr/local/share/%%MTARGET%%/hash/
-samplepath                $HOME/.%%MTARGET%%/samples
-artpath                   $HOME/.%%MTARGET%%/artwork;/usr/local/share/%%MTARGET%%/artwork/
-ctrlrpath                 $HOME/.%%MTARGET%%/ctrlr
-inipath                   $HOME/.%%MTARGET%%;.;ini
-fontpath                  $HOME/.%%MTARGET%%/font;/usr/local/share/%%MTARGET%%/
-cheatpath                 $HOME/.%%MTARGET%%/cheat
-crosshairpath             $HOME/.%%MTARGET%%/crosshair
+homepath                  ~/.%%MTARGET%%
+rompath                   ~/.%%MTARGET%%/roms;%%DATADIR%%/roms/
+hashpath                  ~/.%%MTARGET%%/hash;%%DATADIR%%/hash/
+samplepath                ~/.%%MTARGET%%/samples;%%DATADIR%%/samples/
+artpath                   ~/.%%MTARGET%%/artwork;%%DATADIR%%/artwork/
+ctrlrpath                 ~/.%%MTARGET%%/ctrlr;%%DATADIR%%/ctrlr/
+inipath                   ~/.%%MTARGET%%/;.;~/.%%MTARGET%%/ini;%%DATADIR%%/ini/
+fontpath                  ~/.%%MTARGET%%/font;%%DATADIR%%/font/
+cheatpath                 ~/.%%MTARGET%%/cheat;%%DATADIR%%/cheat/
+crosshairpath             ~/.%%MTARGET%%/crosshair;%%DATADIR%%/crosshair/
+pluginspath               ~/.%%MTARGET%%/plugins;%%DATADIR%%/plugins/
+languagepath              ~/.%%MTARGET%%/language;%%DATADIR%%/language/
+swpath                    ~/.%%MTARGET%%/software;%%DATADIR%%/software/
 
 #
 # CORE OUTPUT DIRECTORY OPTIONS
 #
-cfg_directory             $HOME/.%%MTARGET%%/cfg
-nvram_directory           $HOME/.%%MTARGET%%/nvram
-memcard_directory         $HOME/.%%MTARGET%%/memcard
-input_directory           $HOME/.%%MTARGET%%/inp
-state_directory           $HOME/.%%MTARGET%%/sta
-snapshot_directory        $HOME/.%%MTARGET%%/snap
-diff_directory            $HOME/.%%MTARGET%%/diff
-comment_directory         $HOME/.%%MTARGET%%/comments
+cfg_directory             ~/.%%MTARGET%%/cfg
+nvram_directory           ~/.%%MTARGET%%/nvram
+input_directory           ~/.%%MTARGET%%/inp
+state_directory           ~/.%%MTARGET%%/state
+snapshot_directory        ~/.%%MTARGET%%/snapshot
+diff_directory            ~/.%%MTARGET%%/diff
+comment_directory         ~/.%%MTARGET%%/comments
+share_directory           ~/.%%MTARGET%%/share
 
 #
 # CORE STATE/PLAYBACK OPTIONS
 #
 state                     
 autosave                  0
+rewind                    0
+rewind_capacity           100
 playback                  
 record                    
+exit_after_playback       0
 mngwrite                  
 aviwrite                  
 wavwrite                  
 snapname                  %g/%i
 snapsize                  auto
-snapview                  internal
+snapview                  auto
+snapbilinear              1
+statename                 %g
 burnin                    0
 
 #
@@ -56,6 +63,19 @@ throttle                  1
 sleep                     1
 speed                     1.0
 refreshspeed              0
+lowlatency                0
+
+#
+# CORE RENDER OPTIONS
+#
+keepaspect                1
+unevenstretch             1
+unevenstretchx            0
+unevenstretchy            0
+autostretchxy             0
+intoverscan               0
+intscalex                 0
+intscaley                 0
 
 #
 # CORE ROTATION OPTIONS
@@ -72,11 +92,8 @@ flipy                     0
 # CORE ARTWORK OPTIONS
 #
 artwork_crop              0
-use_backdrops             1
-use_overlays              1
-use_bezels                1
-use_cpanels               1
-use_marquees              1
+fallback_artwork          
+override_artwork          
 
 #
 # CORE SCREEN OPTIONS
@@ -90,17 +107,20 @@ effect                    none
 #
 # CORE VECTOR OPTIONS
 #
-antialias                 1
-beam                      1.0
+beam_width_min            1.0
+beam_width_max            1.0
+beam_dot_size             1.0
+beam_intensity_weight     0
 flicker                   0
 
 #
 # CORE SOUND OPTIONS
 #
-sound                     1
 samplerate                48000
 samples                   1
 volume                    0
+compressor                1
+speaker_report            0
 
 #
 # CORE INPUT OPTIONS
@@ -113,6 +133,7 @@ lightgun                  0
 multikeyboard             0
 multimouse                0
 steadykey                 0
+ui_active                 0
 offscreen_reload          0
 joystick_map              auto
 joystick_deadzone         0.3
@@ -136,87 +157,110 @@ mouse_device              mouse
 #
 # CORE DEBUGGING OPTIONS
 #
-log                       0
 verbose                   0
-update_in_pause           0
+log                       0
+oslog                     0
 debug                     0
+update_in_pause           0
 debugscript               
-debug_internal            0
+debuglog                  0
+
+#
+# CORE COMM OPTIONS
+#
+comm_localhost            0.0.0.0
+comm_localport            15112
+comm_remotehost           127.0.0.1
+comm_remoteport           15112
+comm_framesync            0
 
 #
 # CORE MISC OPTIONS
 #
+drc                       1
+drc_use_c                 0
+drc_log_uml               0
+drc_log_native            0
 bios                      
 cheat                     0
 skip_gameinfo             0
 uifont                    default
+ui                        cabinet
 ramsize                   
 confirm_quit              0
+ui_mouse                  1
+language                  
+nvram_save                1
 
 #
-# DEBUGGING OPTIONS
+# SCRIPTING OPTIONS
 #
-oslog                     0
+autoboot_command          
+autoboot_delay            0
+autoboot_script           
+console                   0
+plugins                   1
+plugin                    
+noplugin                  
+
+#
+# HTTP SERVER OPTIONS
+#
+http                      0
+http_port                 8080
+http_root                 web
+
+#
+# OSD KEYBOARD MAPPING OPTIONS
+#
+uimodekey                 auto
+
+#
+# OSD FONT OPTIONS
+#
+uifontprovider            auto
+
+#
+# OSD OUTPUT OPTIONS
+#
+output                    auto
+
+#
+# OSD INPUT OPTIONS
+#
+keyboardprovider          auto
+mouseprovider             auto
+lightgunprovider          auto
+joystickprovider          auto
+
+#
+# OSD DEBUGGING OPTIONS
+#
+debugger                  auto
+debugger_port             23946
+debugger_font             auto
+debugger_font_size        0
 watchdog                  0
 
 #
-# PERFORMANCE OPTIONS
+# OSD PERFORMANCE OPTIONS
 #
-multithreading            0
 numprocessors             auto
-sdlvideofps               0
 bench                     0
 
 #
-# VIDEO OPTIONS
+# OSD VIDEO OPTIONS
 #
-video                     soft
+video                     auto
 numscreens                1
 window                    0
 maximize                  1
-keepaspect                1
-unevenstretch             1
-centerh                   1
-centerv                   1
 waitvsync                 0
 syncrefresh               0
-scalemode                 none
+monitorprovider           auto
 
 #
-# OpenGL-SPECIFIC OPTIONS
-#
-filter                    1
-prescale                  1
-gl_forcepow2texture       0
-gl_notexturerect          0
-gl_vbo                    1
-gl_pbo                    1
-gl_glsl                   0
-gl_glsl_filter            1
-glsl_shader.%%MTARGET%%0         none
-glsl_shader.%%MTARGET%%1         none
-glsl_shader.%%MTARGET%%2         none
-glsl_shader.%%MTARGET%%3         none
-glsl_shader.%%MTARGET%%4         none
-glsl_shader.%%MTARGET%%5         none
-glsl_shader.%%MTARGET%%6         none
-glsl_shader.%%MTARGET%%7         none
-glsl_shader.%%MTARGET%%8         none
-glsl_shader.%%MTARGET%%9         none
-glsl_shader_screen0       none
-glsl_shader_screen1       none
-glsl_shader_screen2       none
-glsl_shader_screen3       none
-glsl_shader_screen4       none
-glsl_shader_screen5       none
-glsl_shader_screen6       none
-glsl_shader_screen7       none
-glsl_shader_screen8       none
-glsl_shader_screen9       none
-gl_glsl_vid_attr          1
-
-#
-# PER-WINDOW VIDEO OPTIONS
+# OSD PER-WINDOW VIDEO OPTIONS
 #
 screen                    auto
 aspect                    auto
@@ -240,39 +284,113 @@ resolution3               auto
 view3                     auto
 
 #
-# FULL SCREEN OPTIONS
+# OSD FULL SCREEN OPTIONS
 #
 switchres                 0
-useallheads               0
 
 #
-# SOUND OPTIONS
+# OSD ACCELERATED VIDEO OPTIONS
+#
+filter                    1
+prescale                  1
+
+#
+# OpenGL-SPECIFIC OPTIONS
+#
+gl_forcepow2texture       0
+gl_notexturerect          0
+gl_vbo                    1
+gl_pbo                    1
+gl_glsl                   0
+gl_glsl_filter            1
+glsl_shader_mame0         none
+glsl_shader_mame1         none
+glsl_shader_mame2         none
+glsl_shader_mame3         none
+glsl_shader_mame4         none
+glsl_shader_mame5         none
+glsl_shader_mame6         none
+glsl_shader_mame7         none
+glsl_shader_mame8         none
+glsl_shader_mame9         none
+glsl_shader_screen0       none
+glsl_shader_screen1       none
+glsl_shader_screen2       none
+glsl_shader_screen3       none
+glsl_shader_screen4       none
+glsl_shader_screen5       none
+glsl_shader_screen6       none
+glsl_shader_screen7       none
+glsl_shader_screen8       none
+glsl_shader_screen9       none
+
+#
+# OSD SOUND OPTIONS
+#
+sound                     auto
+audio_latency             2
+
+#
+# BGFX POST-PROCESSING OPTIONS
+#
+bgfx_path                 %%DATADIR%%/bgfx
+bgfx_backend              auto
+bgfx_debug                0
+bgfx_screen_chains        default
+bgfx_shadow_mask          slot-mask.png
+bgfx_lut                  lut-default.png
+bgfx_avi_name             auto
+
+#
+# SDL PERFORMANCE OPTIONS
+#
+sdlvideofps               0
+
+#
+# SDL VIDEO OPTIONS
 #
-audio_latency             3
+centerh                   1
+centerv                   1
+scalemode                 none
+
+#
+# SDL FULL SCREEN OPTIONS
+#
+useallheads               0
+attach_window             
 
 #
 # SDL KEYBOARD MAPPING
 #
 keymap                    0
 keymap_file               keymap.dat
-uimodekey                 auto
 
 #
 # SDL JOYSTICK MAPPING
 #
-joy_idx1                  auto
-joy_idx2                  auto
*** 4090 LINES SKIPPED ***