git: 9e6023ac0e0d - main - emulators/ares: update 139.20240809 → 139.20240823

From: Vladimir Druzenko <vvd_at_FreeBSD.org>
Date: Sat, 24 Aug 2024 14:27:56 UTC
The branch main has been updated by vvd:

URL: https://cgit.FreeBSD.org/ports/commit/?id=9e6023ac0e0df4813dabe10f49023cb6343f0289

commit 9e6023ac0e0df4813dabe10f49023cb6343f0289
Author:     Stefan Schlosser <bsdcode@disroot.org>
AuthorDate: 2024-08-24 14:21:38 +0000
Commit:     Vladimir Druzenko <vvd@FreeBSD.org>
CommitDate: 2024-08-24 14:27:00 +0000

    emulators/ares: update 139.20240809 → 139.20240823
    
    The most notable change to the port is my inclusion of an inofficial
    patch to control the behaviour of hotkey execution in the emulator.
    This patch is behind the HOTKEYS option, disabled by default.
    This patch won't be accepted upstream with its current scope.
    
    Currently hotkeys share the binding space with regular game inputs.
    This can be problematic for gamepad-only users who want to bind some
    hotkey functions (screenshots, save state, load state, quit emulator,
    etc...) to gamepad buttons but who don't have enough unassigned buttons
    left on the gamepad. The patch prevents the execution of hotkey actions
    unless the emulator is paused. This way users can assign many hotkey
    actions to gamepad buttons and access them with pausing the emulator.
    
    Commit changes:
    https://github.com/ares-emulator/ares/compare/a76847d..3cd82c8
    
    Port changes:
     * add HOTKEYS option, disabled by default
     * remove upstreamed 'unbreak i386 build' patch
     * use SUB_LIST to update recommended librashader version in pkg-message
     * replace 'doas' with 'su' in pkg-message - 'doas' is not in base
    
    PR:     281023
---
 emulators/ares/Makefile                     | 12 ++++++----
 emulators/ares/distinfo                     |  6 ++---
 emulators/ares/files/extra-patch-hotkeys    | 35 +++++++++++++++++++++++++++++
 emulators/ares/files/patch-nall_GNUmakefile | 11 +--------
 emulators/ares/files/pkg-message.in         | 21 ++++++++++-------
 5 files changed, 60 insertions(+), 25 deletions(-)

diff --git a/emulators/ares/Makefile b/emulators/ares/Makefile
index a3c37e28d0a8..869f4ec3bd15 100644
--- a/emulators/ares/Makefile
+++ b/emulators/ares/Makefile
@@ -1,6 +1,5 @@
 PORTNAME=	ares
-DISTVERSION=	139.20240809
-PORTREVISION=	1
+DISTVERSION=	139.20240823
 CATEGORIES=	emulators
 
 MAINTAINER=	bsdcode@disroot.org
@@ -14,7 +13,7 @@ USES=		compiler:c++17-lang gmake gnome localbase:ldflags pkgconfig \
 		xorg
 USE_GITHUB=	yes
 GH_ACCOUNT=	ares-emulator
-GH_TAGNAME=	a76847d
+GH_TAGNAME=	3cd82c8
 USE_GNOME=	gtksourceview3
 USE_XORG=	x11 xext xrandr
 
@@ -31,8 +30,9 @@ MAKE_ARGS=	compiler=${CC} \
 		threaded=true
 
 SUB_FILES=	pkg-message
+SUB_LIST=	LIBRASHADER=${_LIBRASHADER}
 
-OPTIONS_DEFINE=		DEBUG DOCS NVIDIA OPENMP SHADER
+OPTIONS_DEFINE=		DEBUG DOCS HOTKEYS 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
@@ -51,6 +51,7 @@ CV_DESC=		ColecoVision
 FC_DESC=		NES / Famicom
 GBA_DESC=		Game Boy Advance
 GB_DESC=		Game Boy
+HOTKEYS_DESC=		Inofficial hotkeys locking patch
 MD_DESC=		Mega Drive / Genesis
 MSX_DESC=		MSX
 MS_DESC=		Master System / Mark III
@@ -100,6 +101,8 @@ GLX_USES=		gl
 GLX_USE=		GL=gl
 GLX_MAKE_ARGS=		ruby+=video.glx
 
+HOTKEYS_EXTRA_PATCHES=	${PATCHDIR}/extra-patch-hotkeys
+
 MD_MAKE_ARGS=		cores+=md
 
 MSX_MAKE_ARGS=		cores+=msx
@@ -173,6 +176,7 @@ XLIB_MAKE_ARGS=		ruby+=input.xlib
 XVIDEO_USE=		XORG=xv
 XVIDEO_MAKE_ARGS=	ruby+=video.xvideo
 
+_LIBRASHADER=		0.3.3
 _SHADERS=		share/libretro/shaders/shaders_slang
 
 .include <bsd.port.options.mk>
diff --git a/emulators/ares/distinfo b/emulators/ares/distinfo
index f761049b436c..74c15f75fd96 100644
--- a/emulators/ares/distinfo
+++ b/emulators/ares/distinfo
@@ -1,3 +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
+TIMESTAMP = 1724488423
+SHA256 (ares-emulator-ares-139.20240823-3cd82c8_GH0.tar.gz) = ac559920cb8d54e94b37fcdae3d65343c62bd9d6fb658e97dfbb6ec5304498ff
+SIZE (ares-emulator-ares-139.20240823-3cd82c8_GH0.tar.gz) = 50955635
diff --git a/emulators/ares/files/extra-patch-hotkeys b/emulators/ares/files/extra-patch-hotkeys
new file mode 100644
index 000000000000..c97e5d0471f4
--- /dev/null
+++ b/emulators/ares/files/extra-patch-hotkeys
@@ -0,0 +1,35 @@
+--- desktop-ui/input/hotkeys.cpp.orig	2024-08-16 07:21:59 UTC
++++ desktop-ui/input/hotkeys.cpp
+@@ -106,7 +106,9 @@ auto InputManager::createHotkeys() -> void {
+     program.showMessage({"Selected state slot ", program.state.slot});
+   }));
+ 
+-  hotkeys.append(InputHotkey("Pause Emulation").onPress([&] {
++  InputHotkey pause("Pause Emulation");
++  pause.isPause = true;
++  hotkeys.append(pause.onPress([&] {
+     if(!emulator) return;
+     program.pause(!program.paused);
+   }));
+@@ -149,6 +151,9 @@ auto InputManager::pollHotkeys() -> void {
+   }
+ 
+   for(auto& hotkey : hotkeys) {
++    if(emulator && !hotkey.isPause && !program.paused) {
++      continue;
++    }
+     auto state = hotkey.value();
+     if(hotkey.state == 0 && state == 1 && hotkey.press) hotkey.press();
+     if(hotkey.state == 1 && state == 0 && hotkey.release) hotkey.release();
+
+--- desktop-ui/input/input.hpp.orig	2024-08-16 07:21:40 UTC
++++ desktop-ui/input/input.hpp
+@@ -73,6 +73,8 @@ struct InputHotkey : InputDigital {
+ 
+   const string name;
+ 
++  bool isPause = false;
++
+ private:
+   function<void ()> press;
+   function<void ()> release;
diff --git a/emulators/ares/files/patch-nall_GNUmakefile b/emulators/ares/files/patch-nall_GNUmakefile
index 1d1551df60f3..178b51348abd 100644
--- a/emulators/ares/files/patch-nall_GNUmakefile
+++ b/emulators/ares/files/patch-nall_GNUmakefile
@@ -1,14 +1,5 @@
---- nall/GNUmakefile.orig	2024-08-14 12:07:36 UTC
+--- nall/GNUmakefile.orig	2024-08-16 16:33:46 UTC
 +++ nall/GNUmakefile
-@@ -102,7 +102,7 @@ else
- else
-   machine_opt := $(if $(findstring clang,$(compiler)),-print-target-triple,-dumpmachine)
-   machine_str := $(shell $(compiler) $(machine_opt))
--  ifneq ($(filter i686-%,$(machine_str)),)
-+  ifneq ($(filter i386-% i486-% i586-% i686-%,$(machine_str)),)
-     machine := x86
-   else ifneq ($(filter amd64-% x86_64-%,$(machine_str)),)
-     machine := amd64
 @@ -169,8 +169,6 @@ ifeq ($(build),debug)
    lto = false
    ifeq ($(cl),true)
diff --git a/emulators/ares/files/pkg-message.in b/emulators/ares/files/pkg-message.in
index bbd2fb81d91a..5c53a71ed905 100644
--- a/emulators/ares/files/pkg-message.in
+++ b/emulators/ares/files/pkg-message.in
@@ -4,7 +4,7 @@
 Users are encouraged to compile the port on their systems with
 
     CFLAGS   ?= -O3
-    CPUTYPE  ?= native
+    CPUTYPE  ?= native | ... | x86-64-v3 | ... | skylake | ...
     WITH_LTO =  yes
 
 This can improve the performance of demanding cores like the N64.
@@ -13,22 +13,27 @@ 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
+compile the port with the NVIDIA option set (recommended), or disable the NVIDIA
+shader disk cache at startup with
 
     $ __GL_SHADER_DISK_CACHE=0 ares
 
+The port provides the HOTKEYS option. This applies an inofficial patch which
+locks all hotkey execution in the unpaused state of the emulator. This can be a
+convenience for gamepad-only users who want to assign hotkey actions to gamepad
+buttons but who don't have enough free unassigned buttons left on the gamepad.
+
 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
+    $ su pkg install rust-nightly
+    $ fetch https://github.com/SnowflakePowered/librashader/archive/refs/tags/librashader-v%%LIBRASHADER%%.tar.gz
+    $ tar -xf librashader-v%%LIBRASHADER%%.tar.gz
+    $ cd librashader-librashader-v%%LIBRASHADER%%
     $ cargo run -p librashader-build-script -- --profile release
-    $ doas cp target/release/librashader.so %%LOCALBASE%%/lib
+    $ su 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