I've added a README with an example use of the SDL_GAMECONTROLLERCONFIG env
var because I've got repeated questions off list.
On Sun, Mar 11, 2018 at 12:14:32PM +0000, Stuart Henderson wrote:
> On 2018/03/01 19:52, Thomas Frohwein wrote:
> > Index: src/video/SDL_egl.c
> ..
> > +
> > +++#elif defined(__OpenBSD__)
> > +++#define DEFAULT_OGL "libGL.so"
> > +++#define DEFAULT_EGL "libEGL.so"
> > +++#define DEFAULT_OGL_ES2 "libGLESv2.so"
> > +++#define DEFAULT_OGL_ES_PVR "libGLES_CM.so"
> > +++#define DEFAULT_OGL_ES "libGLESv1_CM.so"
>
> +++? There's something wrong here.
Ugh, yes. I guess this exposed that it finds the libraries even with the Linux
naming scheme '*.so.1'. It does run without the patch for this file indeed, but
I added the lines again (without the extra '+') to be consistent with how it
was set up before and with other OS in that file.
>
> > RCS file: /cvs/ports/devel/sdl2-image/Makefile,v
> > retrieving revision 1.8
> > diff -u -p -r1.8 Makefile
> > --- Makefile 12 Jan 2018 19:32:54 -0000 1.8
>
> If there are two things patched in the same mail, please generate
> the diff from a common parent directory.
>
New diff from parent directory below. I tested again with megaglest, neverball,
dungeon crawl stone soup, and a few FNA games without issues.
Index: sdl2/Makefile
===================================================================
RCS file: /cvs/ports/devel/sdl2/Makefile,v
retrieving revision 1.20
diff -u -p -r1.20 Makefile
--- sdl2/Makefile 12 Jan 2018 19:32:54 -0000 1.20
+++ sdl2/Makefile 11 Mar 2018 20:29:52 -0000
@@ -4,14 +4,13 @@ COMMENT= cross-platform multimedia libra
BROKEN-hppa= src/atomic/SDL_spinlock.c:101:2: error: \
#error Please implement for your platform.
-V= 2.0.7
+V= 2.0.8
DISTNAME= SDL2-${V}
PKGNAME= sdl2-${V}
CATEGORIES= devel
MASTER_SITES= https://www.libsdl.org/release/
-REVISION= 0
-SHARED_LIBS= SDL2 0.4 # 0.7
+SHARED_LIBS= SDL2 0.5 # 0.8
HOMEPAGE= https://www.libsdl.org/
Index: sdl2/distinfo
===================================================================
RCS file: /cvs/ports/devel/sdl2/distinfo,v
retrieving revision 1.6
diff -u -p -r1.6 distinfo
--- sdl2/distinfo 7 Jan 2018 22:56:46 -0000 1.6
+++ sdl2/distinfo 11 Mar 2018 20:29:52 -0000
@@ -1,2 +1,2 @@
-SHA256 (SDL2-2.0.7.tar.gz) = 7jXHTEMT4u2hBLFLG4b324SgTuq5Qw1W4AHOomi/TV4=
-SIZE (SDL2-2.0.7.tar.gz) = 4432499
+SHA256 (SDL2-2.0.8.tar.gz) = 7cd8VzCGYdV26EM0TYY44CWngYv/c/j7+rCcPF/Qkuw=
+SIZE (SDL2-2.0.8.tar.gz) = 4909017
Index: sdl2/patches/patch-Makefile_in
===================================================================
RCS file: /cvs/ports/devel/sdl2/patches/patch-Makefile_in,v
retrieving revision 1.4
diff -u -p -r1.4 patch-Makefile_in
--- sdl2/patches/patch-Makefile_in 7 Jan 2018 22:56:46 -0000 1.4
+++ sdl2/patches/patch-Makefile_in 11 Mar 2018 20:29:52 -0000
@@ -1,6 +1,5 @@
$OpenBSD: patch-Makefile_in,v 1.4 2018/01/07 22:56:46 awolk Exp $
-Should make sure only libSDL2, not libSDL2-2.0 are installed
Index: Makefile.in
--- Makefile.in.orig
+++ Makefile.in
Index: sdl2/patches/patch-src_joystick_SDL_gamecontroller_c
===================================================================
RCS file:
/cvs/ports/devel/sdl2/patches/patch-src_joystick_SDL_gamecontroller_c,v
retrieving revision 1.1
diff -u -p -r1.1 patch-src_joystick_SDL_gamecontroller_c
--- sdl2/patches/patch-src_joystick_SDL_gamecontroller_c 7 Jan 2018
22:56:46 -0000 1.1
+++ sdl2/patches/patch-src_joystick_SDL_gamecontroller_c 11 Mar 2018
20:29:52 -0000
@@ -1,15 +1,15 @@
$OpenBSD: patch-src_joystick_SDL_gamecontroller_c,v 1.1 2018/01/07 22:56:46
awolk Exp $
-enable GameController API the Linux way (by posing as Xbox360 controller)
+enable GameController API the Linux fallback way (by posing as Xbox360
+controller)
also disable checking string "Xbox 360 Wireless Receiver", so for now
everything will be Xbox360 controller (works with generic joysticks)
-- note: the actual Xbox360 controller has buttons and axes messed up on
- openbsd with these mappings
+map to SDL_GAMECONTROLLERCONFIG envvar if available
Index: src/joystick/SDL_gamecontroller.c
--- src/joystick/SDL_gamecontroller.c.orig
+++ src/joystick/SDL_gamecontroller.c
-@@ -884,15 +884,15 @@ static ControllerMapping_t *SDL_PrivateGetControllerMa
+@@ -884,15 +884,21 @@ static ControllerMapping_t *SDL_PrivateGetControllerMa
#else
(void) s_pEmscriptenMapping; /* pacify ARMCC */
#endif
@@ -20,10 +20,17 @@ Index: src/joystick/SDL_gamecontroller.c
+ //if (SDL_strstr(name, "Xbox 360 Wireless Receiver")) {
/* The Linux driver xpad.c maps the wireless dpad to buttons */
SDL_bool existing;
- mapping = SDL_PrivateAddMappingForGUID(guid,
+- mapping = SDL_PrivateAddMappingForGUID(guid,
++ char guid_str[1024];
++ SDL_JoystickGetGUIDString(guid, guid_str, sizeof(guid_str));
++ if (SDL_GetHint(SDL_HINT_GAMECONTROLLERCONFIG) == NULL) {
++ mapping = SDL_PrivateAddMappingForGUID(guid,
"none,X360 Wireless
Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
&existing, SDL_CONTROLLER_MAPPING_PRIORITY_DEFAULT);
- }
++ } else {
++ mapping = SDL_PrivateAddMappingForGUID(guid,
SDL_GetHint(SDL_HINT_GAMECONTROLLERCONFIG), &existing,
SDL_CONTROLLER_MAPPING_PRIORITY_DEFAULT);
++ }
+ //}
}
#endif /* __LINUX__ */
Index: sdl2/patches/patch-src_video_SDL_egl_c
===================================================================
RCS file: /cvs/ports/devel/sdl2/patches/patch-src_video_SDL_egl_c,v
retrieving revision 1.2
diff -u -p -r1.2 patch-src_video_SDL_egl_c
--- sdl2/patches/patch-src_video_SDL_egl_c 7 Jan 2018 22:56:46 -0000
1.2
+++ sdl2/patches/patch-src_video_SDL_egl_c 11 Mar 2018 20:29:52 -0000
@@ -1,18 +1,18 @@
-$OpenBSD: patch-src_video_SDL_egl_c,v 1.2 2018/01/07 22:56:46 awolk Exp $
+$OpenBSD$
Index: src/video/SDL_egl.c
--- src/video/SDL_egl.c.orig
+++ src/video/SDL_egl.c
-@@ -64,7 +64,12 @@
- #define DEFAULT_OGL_ES2 "libGLESv2.dll"
- #define DEFAULT_OGL_ES_PVR "libGLES_CM.dll"
- #define DEFAULT_OGL_ES "libGLESv1_CM.dll"
--
+@@ -72,6 +72,13 @@
+ #define DEFAULT_OGL_ES_PVR "libGLES_CM.dylib" //???
+ #define DEFAULT_OGL_ES "libGLESv1_CM.dylib" //???
+
+#elif defined(__OpenBSD__)
+#define DEFAULT_OGL "libGL.so"
+#define DEFAULT_EGL "libEGL.so"
+#define DEFAULT_OGL_ES2 "libGLESv2.so"
+#define DEFAULT_OGL_ES_PVR "libGLES_CM.so"
+#define DEFAULT_OGL_ES "libGLESv1_CM.so"
++
#else
/* Desktop Linux */
#define DEFAULT_OGL "libGL.so.1"
Index: sdl2/pkg/PLIST
===================================================================
RCS file: /cvs/ports/devel/sdl2/pkg/PLIST,v
retrieving revision 1.4
diff -u -p -r1.4 PLIST
--- sdl2/pkg/PLIST 7 Jan 2018 22:56:46 -0000 1.4
+++ sdl2/pkg/PLIST 11 Mar 2018 20:29:52 -0000
@@ -1,5 +1,5 @@
@comment $OpenBSD: PLIST,v 1.4 2018/01/07 22:56:46 awolk Exp $
-@bin bin/sdl2-config
+bin/sdl2-config
include/SDL2/
include/SDL2/SDL.h
include/SDL2/SDL_assert.h
@@ -85,3 +85,4 @@ lib/libSDL2main.a
lib/libSDL2main.la
lib/pkgconfig/sdl2.pc
share/aclocal/sdl2.m4
+share/doc/pkg-readmes/${FULLPKGNAME}
Index: sdl2/pkg/README
===================================================================
RCS file: sdl2/pkg/README
diff -N sdl2/pkg/README
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ sdl2/pkg/README 11 Mar 2018 20:29:52 -0000
@@ -0,0 +1,24 @@
+$OpenBSD$
+
++-----------------------------------------------------------------------
+| Customizing ${FULLPKGNAME} gamecontroller layout on OpenBSD
++-----------------------------------------------------------------------
+
+The mapping for SDL2's gamecontroller API is currently based on a workaround.
+It defaults to:
+
+"none,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,\
+dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,\
+leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,\
+righty:a4,start:b7,x:b2,y:b3,"
+
+A custom mapping can be used via the SDL_GAMECONTROLLERCONFIG env var. Note
+that the first value (for guid) should be 'none' and the second one can be any
+name under which SDL2 will list the gamecontroller device.
+
+Example mapping (for Logitech Dual Action gamepad):
+
+$ export SDL_GAMECONTROLLERCONFIG="none,X360WirelessController,a:b1,b:b2,\
+back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,\
+leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,\
+righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,"
Index: sdl2-image/Makefile
===================================================================
RCS file: /cvs/ports/devel/sdl2-image/Makefile,v
retrieving revision 1.8
diff -u -p -r1.8 Makefile
--- sdl2-image/Makefile 12 Jan 2018 19:32:54 -0000 1.8
+++ sdl2-image/Makefile 11 Mar 2018 20:29:52 -0000
@@ -1,22 +1,23 @@
# $OpenBSD: Makefile,v 1.8 2018/01/12 19:32:54 bentley Exp $
-V = 2.0.1
+V = 2.0.3
COMMENT = SDL2 image library
DISTNAME = SDL2_image-${V}
PKGNAME = sdl2-image-${V}
CATEGORIES = devel graphics
-REVISION = 0
-SHARED_LIBS += SDL2_image 0.0 # 0.0
+SHARED_LIBS += SDL2_image 0.1 # 0.3
HOMEPAGE = https://www.libsdl.org/projects/SDL_image/
+MAINTAINER = Thomas Frohwein <[email protected]>
+
# zlib
PERMIT_PACKAGE_CDROM = Yes
MASTER_SITES = https://www.libsdl.org/projects/SDL_image/release/
-WANTLIB += SDL2 jpeg m png pthread sndio tiff usbhid webp z
+WANTLIB += SDL2 jpeg m png pthread sndio tiff usbhid webp z samplerate
LIB_DEPENDS = devel/sdl2 \
graphics/jpeg \
Index: sdl2-image/distinfo
===================================================================
RCS file: /cvs/ports/devel/sdl2-image/distinfo,v
retrieving revision 1.2
diff -u -p -r1.2 distinfo
--- sdl2-image/distinfo 10 Jan 2016 08:10:16 -0000 1.2
+++ sdl2-image/distinfo 11 Mar 2018 20:29:52 -0000
@@ -1,2 +1,2 @@
-SHA256 (SDL2_image-2.0.1.tar.gz) = Oj6vvO6lElwEvlhTc7/Ys6GPJZvX6uPvxObY5g4Nf2Q=
-SIZE (SDL2_image-2.0.1.tar.gz) = 7797848
+SHA256 (SDL2_image-2.0.3.tar.gz) = NRDCXac1/82M47ZQcxUP9Pf5STuGboW4NzgIO1VtI2g=
+SIZE (SDL2_image-2.0.3.tar.gz) = 8685512
Index: sdl2-image/pkg/PLIST
===================================================================
RCS file: /cvs/ports/devel/sdl2-image/pkg/PLIST,v
retrieving revision 1.2
diff -u -p -r1.2 PLIST
--- sdl2-image/pkg/PLIST 22 May 2015 11:31:14 -0000 1.2
+++ sdl2-image/pkg/PLIST 11 Mar 2018 20:29:52 -0000
@@ -1,5 +1,4 @@
@comment $OpenBSD: PLIST,v 1.2 2015/05/22 11:31:14 ajacoutot Exp $
-include/SDL2/
include/SDL2/SDL_image.h
lib/libSDL2_image.a
lib/libSDL2_image.la