git: ceee4b76d252 - main - emulators/ares: New port: open-source multi-system emulator with focus on accuracy and preservation
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 14 Aug 2024 19:08:41 UTC
The branch main has been updated by vvd: URL: https://cgit.FreeBSD.org/ports/commit/?id=ceee4b76d252715f6552a57c0612a16a8e2272aa commit ceee4b76d252715f6552a57c0612a16a8e2272aa Author: Stefan Schlosser <bsdcode@disroot.org> AuthorDate: 2024-08-14 19:06:03 +0000 Commit: Vladimir Druzenko <vvd@FreeBSD.org> CommitDate: 2024-08-14 19:06:03 +0000 emulators/ares: New port: open-source multi-system emulator with focus on accuracy and preservation ares is an open-source multi-system emulator with a focus on accuracy and preservation. It is a descendant of the emulators higan and bsnes. It's source code is structured to be maximally readable and self-documenting. ares supports the following systems: Arcade, WonderSwan, WonderSwan Color, Pocket Challenge V2, ColecoVision, PC-Engine / TurboGrafx, SuperGrafx, My Vision, NES / Famicom, Famicom Disk System, SNES / Super Famicom, Satellaview, Sufami Turbo, Nintendo 64, Nintendo 64DD, Game Boy, Game Boy Color, Game Boy Advance, SG-1000, Master System / Mark III, Mega Drive / Genesis, Mega CD, 32X, Game Gear, Neo Geo Pocket, Neo Geo Pocket Color. ares has experimental support for the following systems: Atari 2600, MSX, MSX2, PC-Engine CD / TurboGrafx CD, ZX Spectrum, Neo Geo (AES/MVS), PlayStation. ares has all the features one would expect from a great emulator system: native multi-platform UI, dynamic rate control, save states, run-ahead, rewind and fast-forward, pixel shaders, color correction, input multi-mapping, debugger. ares uses librashader for it's pixel shader engine. This means it is highly compatible with existing slang shaders, e.g. the slang-shaders from libretro. https://ares-emu.net/ PR: 280527 --- emulators/Makefile | 1 + emulators/ares/Makefile | 198 +++++++++++++++++++++ emulators/ares/distinfo | 3 + ...tch-ares_n64_vulkan_parallel-rdp_util_timer.cpp | 13 ++ ...-ares_n64_vulkan_parallel-rdp_vulkan_device.cpp | 13 ++ .../files/extra-patch-desktop-ui_desktop-ui.cpp | 15 ++ emulators/ares/files/patch-desktop-ui_GNUmakefile | 21 +++ emulators/ares/files/patch-hiro_GNUmakefile | 11 ++ emulators/ares/files/patch-nall_GNUmakefile | 29 +++ emulators/ares/files/pkg-message.in | 44 +++++ emulators/ares/pkg-descr | 20 +++ emulators/ares/pkg-plist | 13 ++ 12 files changed, 381 insertions(+) diff --git a/emulators/Makefile b/emulators/Makefile index e93755f0ec1c..0f8fa6defe8d 100644 --- a/emulators/Makefile +++ b/emulators/Makefile @@ -6,6 +6,7 @@ SUBDIR += anese SUBDIR += aqemu SUBDIR += aranym + SUBDIR += ares SUBDIR += atari800 SUBDIR += bfe SUBDIR += bochs diff --git a/emulators/ares/Makefile b/emulators/ares/Makefile new file mode 100644 index 000000000000..cd82a846f62d --- /dev/null +++ b/emulators/ares/Makefile @@ -0,0 +1,198 @@ +PORTNAME= ares +DISTVERSION= 139.20240809 +CATEGORIES= emulators + +MAINTAINER= bsdcode@disroot.org +COMMENT= Multi-system emulator +WWW= https://github.com/ares-emulator/ares + +LICENSE= ISCL +LICENSE_FILE= ${WRKSRC}/LICENSE + +USES= compiler:c++17-lang gmake gnome localbase:ldflags pkgconfig \ + xorg +USE_GITHUB= yes +GH_ACCOUNT= ares-emulator +GH_TAGNAME= a76847d +USE_GNOME= gtksourceview3 +USE_XORG= x11 xext xrandr + +MAKEFILE= GNUmakefile +MAKE_ARGS= compiler=${CC} \ + cores= \ + hiro=gtk3-se \ + local=false \ + lto=false \ + prefix=${PREFIX} \ + ruby=video.none \ + sdl2=false \ + symbols=false \ + threaded=true + +SUB_FILES= pkg-message + +OPTIONS_DEFINE= DEBUG DOCS NVIDIA OPENMP SHADER +OPTIONS_DEFAULT= A26 ALSA AO CV FC GB GBA GLX MD MS MSX MYVISION N64 NG \ + NGP OPENAL OPENMP OSS PCE PERFORMANCE PS1 SDLAUDIO \ + SDLINPUT SFC SG SHADER SPEC UDEV UHID WS XLIB XVIDEO +OPTIONS_GROUP= AUDIO CORES INPUT VIDEO +OPTIONS_GROUP_AUDIO= ALSA AO OPENAL OSS PULSEAUDIO SDLAUDIO +OPTIONS_GROUP_CORES= A26 CV FC GB GBA MD MS MSX MYVISION N64 NG NGP PCE PS1 \ + SFC SG SPEC WS +OPTIONS_GROUP_INPUT= SDLINPUT UDEV UHID XLIB +OPTIONS_GROUP_VIDEO= GLX XVIDEO +OPTIONS_SINGLE= PROFILE +OPTIONS_SINGLE_PROFILE= ACCURACY PERFORMANCE + +A26_DESC= Atari 2600 +ACCURACY_DESC= Slower but more accurate +CV_DESC= ColecoVision +FC_DESC= NES / Famicom +GBA_DESC= Game Boy Advance +GB_DESC= Game Boy +MD_DESC= Mega Drive / Genesis +MSX_DESC= MSX +MS_DESC= Master System / Mark III +MYVISION_DESC= My Vision +N64_DESC= Nintendo 64 +NGP_DESC= Neo Geo Pocket +NG_DESC= Neo Geo (AES/MVS) +NVIDIA_DESC= Apply shader cache workaround (implies ${NVIDIA_IMPLIES}) +PCE_DESC= PC-Engine / TurboGrafx +PERFORMANCE_DESC= Faster but less accurate +PROFILE_DESC= +PS1_DESC= PlayStation +SDLAUDIO_DESC= ${SDL_DESC} +SDLINPUT_DESC= ${SDL_DESC} +SFC_DESC= SNES / Super Famicom +SG_DESC= SG-1000 +SHADER_DESC= Build with shader support +SPEC_DESC= ZX Spectrum +UDEV_DESC= UDEV input support +UHID_DESC= UHID input support +VIDEO_DESC= +WS_DESC= WonderSwan +XLIB_DESC= XLIB input support + +A26_MAKE_ARGS= cores+=a26 + +ACCURACY_MAKE_ARGS= profile=accuracy + +ALSA_LIB_DEPENDS= libasound.so:audio/alsa-lib +ALSA_MAKE_ARGS= ruby+=audio.alsa + +AO_LIB_DEPENDS= libao.so:audio/libao +AO_MAKE_ARGS= ruby+=audio.ao + +CV_MAKE_ARGS= cores+=cv + +DEBUG_MAKE_ARGS= build=debug +DEBUG_MAKE_ARGS_OFF= build=release + +FC_MAKE_ARGS= cores+=fc + +GBA_MAKE_ARGS= cores+=gba + +GB_MAKE_ARGS= cores+=gb + +GLX_USES= gl +GLX_USE= GL=gl +GLX_MAKE_ARGS= ruby+=video.glx + +MD_MAKE_ARGS= cores+=md + +MSX_MAKE_ARGS= cores+=msx + +MS_MAKE_ARGS= cores+=ms + +MYVISION_MAKE_ARGS= cores+=myvision + +N64_RUN_DEPENDS= ${LOCALBASE}/lib/libvulkan.so:graphics/vulkan-loader +N64_MAKE_ARGS= cores+=n64 \ + vulkan=true +N64_MAKE_ARGS_OFF= vulkan=false +N64_EXTRA_PATCHES= ${PATCHDIR}/extra-patch-ares_n64_vulkan_parallel-rdp_util_timer.cpp + +NGP_MAKE_ARGS= cores+=ngp + +NG_MAKE_ARGS= cores+=ng + +NVIDIA_IMPLIES= N64 +NVIDIA_EXTRA_PATCHES= ${PATCHDIR}/extra-patch-ares_n64_vulkan_parallel-rdp_vulkan_device.cpp + +OPENAL_USES= openal +OPENAL_MAKE_ARGS= ruby+=audio.openal + +OPENMP_MAKE_ARGS= openmp=true +OPENMP_MAKE_ARGS_OFF= openmp=false + +OSS_MAKE_ARGS= ruby+=audio.oss + +PCE_MAKE_ARGS= cores+=pce + +PERFORMANCE_MAKE_ARGS= profile=performance + +PS1_MAKE_ARGS= cores+=ps1 + +PULSEAUDIO_LIB_DEPENDS= libpulse-simple.so:audio/pulseaudio \ + libpulse.so:audio/pulseaudio +PULSEAUDIO_MAKE_ARGS= ruby+=audio.pulseaudio \ + ruby+=audio.pulseaudiosimple + +SDLAUDIO_USES= sdl +SDLAUDIO_USE= SDL=sdl2 +SDLAUDIO_MAKE_ARGS= ruby+=audio.sdl \ + sdl2=true + +SDLINPUT_USES= sdl +SDLINPUT_USE= SDL=sdl2 +SDLINPUT_MAKE_ARGS= ruby+=input.sdl \ + sdl2=true + +SFC_MAKE_ARGS= cores+=sfc + +SG_MAKE_ARGS= cores+=sg + +SHADER_RUN_DEPENDS= ${LOCALBASE}/${_SHADERS}/bilinear.slangp:games/libretro-shaders-slang +SHADER_MAKE_ARGS= librashader=true +SHADER_MAKE_ARGS_OFF= librashader=false +SHADER_EXTRA_PATCHES= ${PATCHDIR}/extra-patch-desktop-ui_desktop-ui.cpp + +SPEC_MAKE_ARGS= cores+=spec + +UDEV_LIB_DEPENDS= libudev.so:devel/libudev-devd +UDEV_MAKE_ARGS= ruby+=input.udev + +UHID_MAKE_ARGS= ruby+=input.uhid + +WS_MAKE_ARGS= cores+=ws + +XLIB_MAKE_ARGS= ruby+=input.xlib + +XVIDEO_USE= XORG=xv +XVIDEO_MAKE_ARGS= ruby+=video.xvideo + +_SHADERS= share/libretro/shaders/shaders_slang + +post-patch-SHADER-on: + ${REINPLACE_CMD} 's|@@SHADERS@@|${LOCALBASE}/${_SHADERS}/|g' \ + ${WRKSRC}/desktop-ui/desktop-ui.cpp + +do-install: + ${INSTALL_PROGRAM} ${WRKSRC}/desktop-ui/out/ares \ + ${STAGEDIR}${PREFIX}/bin + ${INSTALL_DATA} ${WRKSRC}/desktop-ui/resource/ares.desktop \ + ${STAGEDIR}${PREFIX}/share/applications + ${MKDIR} ${STAGEDIR}${PREFIX}/share/icons/hicolor/256x256/apps + ${INSTALL_DATA} ${WRKSRC}/desktop-ui/resource/ares.png \ + ${STAGEDIR}${PREFIX}/share/icons/hicolor/256x256/apps + ${MKDIR} ${STAGEDIR}${DATADIR}/Database + (cd ${WRKSRC}/mia/Database && \ + ${COPYTREE_SHARE} . ${STAGEDIR}${DATADIR}/Database) + +post-install-DOCS-on: + ${MKDIR} ${STAGEDIR}${DOCSDIR} + ${INSTALL_DATA} ${WRKSRC}/README.md \ + ${STAGEDIR}${DOCSDIR} + +.include <bsd.port.mk> diff --git a/emulators/ares/distinfo b/emulators/ares/distinfo new file mode 100644 index 000000000000..f761049b436c --- /dev/null +++ b/emulators/ares/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1723230097 +SHA256 (ares-emulator-ares-139.20240809-a76847d_GH0.tar.gz) = e1a47c0b8d55214ae4980c7d8248f8024e70b04cfcf7b21cd6a0f0dcd1e3e9b2 +SIZE (ares-emulator-ares-139.20240809-a76847d_GH0.tar.gz) = 50955748 diff --git a/emulators/ares/files/extra-patch-ares_n64_vulkan_parallel-rdp_util_timer.cpp b/emulators/ares/files/extra-patch-ares_n64_vulkan_parallel-rdp_util_timer.cpp new file mode 100644 index 000000000000..a17e90da8779 --- /dev/null +++ b/emulators/ares/files/extra-patch-ares_n64_vulkan_parallel-rdp_util_timer.cpp @@ -0,0 +1,13 @@ +https://github.com/Themaister/Granite/pull/135 + +--- ares/n64/vulkan/parallel-rdp/util/timer.cpp.orig 2024-07-28 10:49:58 UTC ++++ ares/n64/vulkan/parallel-rdp/util/timer.cpp +@@ -107,7 +107,7 @@ int64_t get_current_time_nsecs() + return int64_t(double(li.QuadPart) * static_qpc_freq.inv_freq); + #else + struct timespec ts = {}; +-#ifdef ANDROID ++#if defined(ANDROID) || defined(__FreeBSD__) + constexpr auto timebase = CLOCK_MONOTONIC; + #else + constexpr auto timebase = CLOCK_MONOTONIC_RAW; diff --git a/emulators/ares/files/extra-patch-ares_n64_vulkan_parallel-rdp_vulkan_device.cpp b/emulators/ares/files/extra-patch-ares_n64_vulkan_parallel-rdp_vulkan_device.cpp new file mode 100644 index 000000000000..ac7c91bee2c2 --- /dev/null +++ b/emulators/ares/files/extra-patch-ares_n64_vulkan_parallel-rdp_vulkan_device.cpp @@ -0,0 +1,13 @@ +https://github.com/Themaister/Granite/issues/133 + +--- ares/n64/vulkan/parallel-rdp/vulkan/device.cpp.orig 2024-08-11 00:29:27 UTC ++++ ares/n64/vulkan/parallel-rdp/vulkan/device.cpp +@@ -874,7 +874,7 @@ void Device::init_workarounds() + workarounds.emulate_event_as_pipeline_barrier = true; + } + +- if (ext.driver_id == VK_DRIVER_ID_NVIDIA_PROPRIETARY && gpu_props.driverVersion < VK_VERSION_MAJOR(535)) ++ if (ext.driver_id == VK_DRIVER_ID_NVIDIA_PROPRIETARY) + { + LOGW("Disabling pipeline cache control.\n"); + workarounds.broken_pipeline_cache_control = true; diff --git a/emulators/ares/files/extra-patch-desktop-ui_desktop-ui.cpp b/emulators/ares/files/extra-patch-desktop-ui_desktop-ui.cpp new file mode 100644 index 000000000000..8fa08f942694 --- /dev/null +++ b/emulators/ares/files/extra-patch-desktop-ui_desktop-ui.cpp @@ -0,0 +1,15 @@ +--- desktop-ui/desktop-ui.cpp.orig 2024-07-28 14:18:09 UTC ++++ desktop-ui/desktop-ui.cpp +@@ -22,6 +22,12 @@ auto locate(const string& name) -> string { + location = {Path::sharedData(), "ares/", name}; + if(inode::exists(location)) return location; + ++ // 3a. The thirdparty shaders directory ++ if(name == "Shaders/") { ++ location = "@@SHADERS@@"; ++ if(inode::exists(location)) return location; ++ } ++ + // 4. The application bundle resource directory (macOS only) + #if defined(PLATFORM_MACOS) + location = {Path::resources(), name}; diff --git a/emulators/ares/files/patch-desktop-ui_GNUmakefile b/emulators/ares/files/patch-desktop-ui_GNUmakefile new file mode 100644 index 000000000000..99f77d976d74 --- /dev/null +++ b/emulators/ares/files/patch-desktop-ui_GNUmakefile @@ -0,0 +1,21 @@ +--- desktop-ui/GNUmakefile.orig 2024-08-09 17:39:54 UTC ++++ desktop-ui/GNUmakefile +@@ -8,6 +8,8 @@ flags += -I. -I.. -I../ares -I../thirdparty -I../third + lto := true + librashader := true + flags += -I. -I.. -I../ares -I../thirdparty -I../thirdparty/librashader/include -DMIA_LIBRARY ++flags += $(CFLAGS) ++options += $(LDFLAGS) + + nall.path := ../nall + include $(nall.path)/GNUmakefile +@@ -16,9 +18,6 @@ ifneq ($(filter $(arch),x86 amd64),) + ifeq ($(filter cl,$(compiler)),) + ifeq ($(local),true) + flags += -march=native +- else +- # For official builds, default to x86-64-v2 (Intel Nehalem, AMD Bulldozer) which supports up to SSE 4.2. +- flags += -march=x86-64-v2 + endif + endif + endif diff --git a/emulators/ares/files/patch-hiro_GNUmakefile b/emulators/ares/files/patch-hiro_GNUmakefile new file mode 100644 index 000000000000..c3f6b4fe5a2d --- /dev/null +++ b/emulators/ares/files/patch-hiro_GNUmakefile @@ -0,0 +1,11 @@ +--- hiro/GNUmakefile.orig 2024-08-14 11:19:20 UTC ++++ hiro/GNUmakefile +@@ -62,7 +62,7 @@ ifneq ($(filter $(platform),linux bsd),) + else ifeq ($(hiro),gtk3-se) + flags += -DHiro_SourceEdit + hiro.flags = $(flags.cpp) -DHIRO_GTK=3 $(shell $(pkg_config) --cflags gtk+-3.0 gtksourceview-3.0) -Wno-deprecated-declarations +- hiro.options = -L/usr/local/lib -lX11 $(shell $(pkg_config) --libs gtk+-3.0 gtksourceview-3.0) ++ hiro.options = -lX11 $(shell $(pkg_config) --libs gtk+-3.0 gtksourceview-3.0) + else ifeq ($(hiro),qt4) + moc = /usr/local/lib/qt4/bin/moc + hiro.flags = $(flags.cpp) -DHIRO_QT=4 $(shell $(pkg_config) --cflags QtCore QtGui) diff --git a/emulators/ares/files/patch-nall_GNUmakefile b/emulators/ares/files/patch-nall_GNUmakefile new file mode 100644 index 000000000000..2f3d96d9db09 --- /dev/null +++ b/emulators/ares/files/patch-nall_GNUmakefile @@ -0,0 +1,29 @@ +--- nall/GNUmakefile.orig 2024-08-14 12:07:36 UTC ++++ nall/GNUmakefile +@@ -169,8 +169,6 @@ ifeq ($(build),debug) + lto = false + ifeq ($(cl),true) + flags += -Od +- else +- flags += -Og + endif + flags += -DBUILD_DEBUG + else ifeq ($(build),stable) +@@ -178,7 +176,7 @@ else ifeq ($(build),release) + else ifeq ($(build),minified) + flags += -Os -DBUILD_MINIFIED + else ifeq ($(build),release) +- flags += -O2 -DBUILD_RELEASE ++ flags += -DBUILD_RELEASE + else ifeq ($(build),optimized) + ifeq ($(cl),true) + flags += -O2 +@@ -323,8 +321,6 @@ ifeq ($(platform),bsd) + + # bsd settings + ifeq ($(platform),bsd) +- flags += -I/usr/local/include +- options += -Wl,-rpath=/usr/local/lib + options += -lstdc++ -lm + endif + diff --git a/emulators/ares/files/pkg-message.in b/emulators/ares/files/pkg-message.in new file mode 100644 index 000000000000..bbd2fb81d91a --- /dev/null +++ b/emulators/ares/files/pkg-message.in @@ -0,0 +1,44 @@ +[ +{ type: install + message: <<EOM +Users are encouraged to compile the port on their systems with + + CFLAGS ?= -O3 + CPUTYPE ?= native + WITH_LTO = yes + +This can improve the performance of demanding cores like the N64. + +NVIDIA GPU users with versions >= 535 of the x11/nvidia-driver could encounter +crashes or freezes while using the N64 core, see +https://github.com/ares-emulator/ares/issues/1547 and +https://github.com/Themaister/Granite/issues/133. As a workaround either try to +compile the port with the NVIDIA option set, or disable the NVIDIA shader disk +cache at start with + + $ __GL_SHADER_DISK_CACHE=0 ares + +ares uses librashader for its shader support. This library is not available in +the FreeBSD ports tree yet, but it is being worked on, see +https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=280470. In the meantime users +have to compile the library themselves if they want to actually use shaders: + + $ doas pkg install rust-nightly + $ fetch https://github.com/SnowflakePowered/librashader/archive/refs/tags/librashader-v0.3.0.tar.gz + $ tar -xf librashader-v0.3.0.tar.gz + $ cd librashader-librashader-v0.3.0 + $ cargo run -p librashader-build-script -- --profile release + $ doas cp target/release/librashader.so %%LOCALBASE%%/lib + +The port uses the shaders from games/libretro-shaders-slang by default. Users +can curate and utilize their own provided collection of shaders by putting them +into the user data directory + + ${HOME}/.local/share/ares/Shaders/ + +ares won't process its own installed shaders if it finds any shaders in the user +data directory. Delete or rename the local shaders directory in order to make +ares use its own shaders again. +EOM +} +] diff --git a/emulators/ares/pkg-descr b/emulators/ares/pkg-descr new file mode 100644 index 000000000000..b01a978f7b90 --- /dev/null +++ b/emulators/ares/pkg-descr @@ -0,0 +1,20 @@ +ares is an open-source multi-system emulator with a focus on accuracy and +preservation. It is a descendant of the emulators higan and bsnes. It's source +code is structured to be maximally readable and self-documenting. + +ares supports the following systems: Arcade, WonderSwan, WonderSwan Color, +Pocket Challenge V2, ColecoVision, PC-Engine / TurboGrafx, SuperGrafx, My +Vision, NES / Famicom, Famicom Disk System, SNES / Super Famicom, Satellaview, +Sufami Turbo, Nintendo 64, Nintendo 64DD, Game Boy, Game Boy Color, Game Boy +Advance, SG-1000, Master System / Mark III, Mega Drive / Genesis, Mega CD, 32X, +Game Gear, Neo Geo Pocket, Neo Geo Pocket Color + +ares has experimental support for the following systems: Atari 2600, MSX, MSX2, +PC-Engine CD / TurboGrafx CD, ZX Spectrum, Neo Geo (AES/MVS), PlayStation + +ares has all the features one would expect from a great emulator system: native +multi-platform UI, dynamic rate control, save states, run-ahead, rewind and +fast-forward, pixel shaders, color correction, input multi-mapping, debugger + +ares uses librashader for it's pixel shader engine. This means it is highly +compatible with existing slang shaders, e.g. the slang-shaders from libretro. diff --git a/emulators/ares/pkg-plist b/emulators/ares/pkg-plist new file mode 100644 index 000000000000..1f5561d1700e --- /dev/null +++ b/emulators/ares/pkg-plist @@ -0,0 +1,13 @@ +bin/ares +share/applications/ares.desktop +%%DATADIR%%/Database/Arcade.bml +%%DATADIR%%/Database/BS Memory.bml +%%DATADIR%%/Database/Famicom.bml +%%DATADIR%%/Database/MSX.bml +%%DATADIR%%/Database/MSX2.bml +%%DATADIR%%/Database/Neo Geo.bml +%%DATADIR%%/Database/Sufami Turbo.bml +%%DATADIR%%/Database/Super Famicom Boards.bml +%%DATADIR%%/Database/Super Famicom.bml +%%PORTDOCS%%%%DOCSDIR%%/README.md +share/icons/hicolor/256x256/apps/ares.png