Hi,

attached patch switches the backend from LinuxX11 to SDL, and enables joystick 
support.
With the LinuxX11 backend, it's not possible to enable Joystick/Gamepad 
support, since it
relies on Linuxism (include linux/joystick.h etc.)

Switching to SDL backend, allows me to play with two GamePads Logitech F310 to 
have
a nice race against each other.

comments, tests, yay, nay, or even OK welcome ;)

cheers,
Sebastian


Index: Makefile
===================================================================
RCS file: /cvs/ports/games/supertuxkart/Makefile,v
retrieving revision 1.29
diff -u -r1.29 Makefile
--- Makefile    12 Jul 2019 20:46:25 -0000      1.29
+++ Makefile    10 Mar 2020 19:46:59 -0000
@@ -8,7 +8,7 @@
 BASENAME =             supertuxkart-${V}
 DISTNAME =             ${BASENAME}-src
 PKGNAME =              ${BASENAME}
-REVISION =             0
+REVISION =             1

 CATEGORIES =           games

@@ -20,7 +20,7 @@
 PERMIT_PACKAGE =       Yes

 WANTLIB += ${COMPILER_LIBCXX} GL X11 Xrandr c curl freetype jpeg
-WANTLIB += m ogg openal png vorbis vorbisenc vorbisfile z
+WANTLIB += m ogg openal png vorbis vorbisenc vorbisfile z SDL

 MASTER_SITES =         ${MASTER_SITE_SOURCEFORGE:=supertuxkart/SuperTuxKart/}
 EXTRACT_SUFX =         .tar.xz
@@ -31,6 +31,7 @@
 RUN_DEPENDS =          devel/desktop-file-utils
 LIB_DEPENDS =          audio/openal>=0.0.8p7 \
                        audio/libvorbis \
+                       devel/sdl \
                        net/curl \
                        graphics/png \
                        graphics/jpeg
Index: patches/patch-CMakeLists_txt
===================================================================
RCS file: patches/patch-CMakeLists_txt
diff -N patches/patch-CMakeLists_txt
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-CMakeLists_txt        10 Mar 2020 19:46:59 -0000
@@ -0,0 +1,13 @@
+$OpenBSD$
+
+Index: CMakeLists.txt
+--- CMakeLists.txt.orig
++++ CMakeLists.txt
+@@ -416,6 +416,7 @@ target_link_libraries(supertuxkart
+     ${JPEG_LIBRARIES}
+     ${TURBOJPEG_LIBRARY}
+     #${VPX_LIBRARIES}
++    SDL
+     )
+
+ if(NOT SERVER_ONLY)
Index: patches/patch-lib_irrlicht_CMakeLists_txt
===================================================================
RCS file: 
/cvs/ports/games/supertuxkart/patches/patch-lib_irrlicht_CMakeLists_txt,v
retrieving revision 1.4
diff -u -r1.4 patch-lib_irrlicht_CMakeLists_txt
--- patches/patch-lib_irrlicht_CMakeLists_txt   27 Nov 2017 15:45:19 -0000      
1.4
+++ patches/patch-lib_irrlicht_CMakeLists_txt   10 Mar 2020 19:46:59 -0000
@@ -13,12 +13,3 @@
      if(CMAKE_COMPILER_IS_GNUCC)
          set(CMAKE_C_FLAGS   "${CMAKE_C_FLAGS} -fexpensive-optimizations")
      endif()
-@@ -86,7 +86,7 @@ if(USE_GLES2)
-     add_definitions(-D_IRR_COMPILE_WITH_OGLES2_ -DNO_IRR_COMPILE_WITH_OPENGL_)
- endif()
-
--if(CYGWIN)
-+if(NOT LINUX)
-     add_definitions(-DNO_IRR_COMPILE_WITH_JOYSTICK_EVENTS_)
- endif()
-
Index: patches/patch-lib_irrlicht_include_IrrCompileConfig_h
===================================================================
RCS file: patches/patch-lib_irrlicht_include_IrrCompileConfig_h
diff -N patches/patch-lib_irrlicht_include_IrrCompileConfig_h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-lib_irrlicht_include_IrrCompileConfig_h       10 Mar 2020 
19:46:59 -0000
@@ -0,0 +1,26 @@
+$OpenBSD$
+
+We want Joystick events, so have to use
+SDL instead of X11 backend for Irrlicht
+
+Index: lib/irrlicht/include/IrrCompileConfig.h
+--- lib/irrlicht/include/IrrCompileConfig.h.orig
++++ lib/irrlicht/include/IrrCompileConfig.h
+@@ -44,7 +44,7 @@
+
+
+ //! Uncomment this line to compile with the SDL device
+-//#define _IRR_COMPILE_WITH_SDL_DEVICE_
++#define _IRR_COMPILE_WITH_SDL_DEVICE_
+ #ifdef NO_IRR_COMPILE_WITH_SDL_DEVICE_
+ #undef _IRR_COMPILE_WITH_SDL_DEVICE_
+ #endif
+@@ -111,7 +111,7 @@
+ #define _IRR_LINUX_PLATFORM_
+ #endif
+ #define _IRR_POSIX_API_
+-#define _IRR_COMPILE_WITH_X11_DEVICE_
++//#define _IRR_COMPILE_WITH_X11_DEVICE_
+ //#define _IRR_COMPILE_WITH_WAYLAND_DEVICE_
+ #endif
+
Index: patches/patch-lib_irrlicht_source_Irrlicht_CIrrDeviceSDL_cpp
===================================================================
RCS file: patches/patch-lib_irrlicht_source_Irrlicht_CIrrDeviceSDL_cpp
diff -N patches/patch-lib_irrlicht_source_Irrlicht_CIrrDeviceSDL_cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-lib_irrlicht_source_Irrlicht_CIrrDeviceSDL_cpp        10 Mar 
2020 19:46:59 -0000
@@ -0,0 +1,85 @@
+$OpenBSD$
+
+Index: lib/irrlicht/source/Irrlicht/CIrrDeviceSDL.cpp
+--- lib/irrlicht/source/Irrlicht/CIrrDeviceSDL.cpp.orig
++++ lib/irrlicht/source/Irrlicht/CIrrDeviceSDL.cpp
+@@ -884,43 +884,43 @@ void CIrrDeviceSDL::createKeyMap()
+       KeyMap.push_back(SKeyMap(SDLK_DELETE, IRR_KEY_DELETE));
+       KeyMap.push_back(SKeyMap(SDLK_HELP, IRR_KEY_HELP));
+
+-      KeyMap.push_back(SKeyMap(SDLK_0, IRR_KEY_IRR_KEY_0));
+-      KeyMap.push_back(SKeyMap(SDLK_1, IRR_KEY_IRR_KEY_1));
+-      KeyMap.push_back(SKeyMap(SDLK_2, IRR_KEY_IRR_KEY_2));
+-      KeyMap.push_back(SKeyMap(SDLK_3, IRR_KEY_IRR_KEY_3));
+-      KeyMap.push_back(SKeyMap(SDLK_4, IRR_KEY_IRR_KEY_4));
+-      KeyMap.push_back(SKeyMap(SDLK_5, IRR_KEY_IRR_KEY_5));
+-      KeyMap.push_back(SKeyMap(SDLK_6, IRR_KEY_IRR_KEY_6));
+-      KeyMap.push_back(SKeyMap(SDLK_7, IRR_KEY_IRR_KEY_7));
+-      KeyMap.push_back(SKeyMap(SDLK_8, IRR_KEY_IRR_KEY_8));
+-      KeyMap.push_back(SKeyMap(SDLK_9, IRR_KEY_IRR_KEY_9));
++      KeyMap.push_back(SKeyMap(SDLK_0, IRR_KEY_0));
++      KeyMap.push_back(SKeyMap(SDLK_1, IRR_KEY_1));
++      KeyMap.push_back(SKeyMap(SDLK_2, IRR_KEY_2));
++      KeyMap.push_back(SKeyMap(SDLK_3, IRR_KEY_3));
++      KeyMap.push_back(SKeyMap(SDLK_4, IRR_KEY_4));
++      KeyMap.push_back(SKeyMap(SDLK_5, IRR_KEY_5));
++      KeyMap.push_back(SKeyMap(SDLK_6, IRR_KEY_6));
++      KeyMap.push_back(SKeyMap(SDLK_7, IRR_KEY_7));
++      KeyMap.push_back(SKeyMap(SDLK_8, IRR_KEY_8));
++      KeyMap.push_back(SKeyMap(SDLK_9, IRR_KEY_9));
+
+-      KeyMap.push_back(SKeyMap(SDLK_a, IRR_KEY_IRR_KEY_A));
+-      KeyMap.push_back(SKeyMap(SDLK_b, IRR_KEY_IRR_KEY_B));
+-      KeyMap.push_back(SKeyMap(SDLK_c, IRR_KEY_IRR_KEY_C));
+-      KeyMap.push_back(SKeyMap(SDLK_d, IRR_KEY_IRR_KEY_D));
+-      KeyMap.push_back(SKeyMap(SDLK_e, IRR_KEY_IRR_KEY_E));
+-      KeyMap.push_back(SKeyMap(SDLK_f, IRR_KEY_IRR_KEY_F));
+-      KeyMap.push_back(SKeyMap(SDLK_g, IRR_KEY_IRR_KEY_G));
+-      KeyMap.push_back(SKeyMap(SDLK_h, IRR_KEY_IRR_KEY_H));
+-      KeyMap.push_back(SKeyMap(SDLK_i, IRR_KEY_IRR_KEY_I));
+-      KeyMap.push_back(SKeyMap(SDLK_j, IRR_KEY_IRR_KEY_J));
+-      KeyMap.push_back(SKeyMap(SDLK_k, IRR_KEY_IRR_KEY_K));
+-      KeyMap.push_back(SKeyMap(SDLK_l, IRR_KEY_IRR_KEY_L));
+-      KeyMap.push_back(SKeyMap(SDLK_m, IRR_KEY_IRR_KEY_M));
+-      KeyMap.push_back(SKeyMap(SDLK_n, IRR_KEY_IRR_KEY_N));
+-      KeyMap.push_back(SKeyMap(SDLK_o, IRR_KEY_IRR_KEY_O));
+-      KeyMap.push_back(SKeyMap(SDLK_p, IRR_KEY_IRR_KEY_P));
+-      KeyMap.push_back(SKeyMap(SDLK_q, IRR_KEY_IRR_KEY_Q));
+-      KeyMap.push_back(SKeyMap(SDLK_r, IRR_KEY_IRR_KEY_R));
+-      KeyMap.push_back(SKeyMap(SDLK_s, IRR_KEY_IRR_KEY_S));
+-      KeyMap.push_back(SKeyMap(SDLK_t, IRR_KEY_IRR_KEY_T));
+-      KeyMap.push_back(SKeyMap(SDLK_u, IRR_KEY_IRR_KEY_U));
+-      KeyMap.push_back(SKeyMap(SDLK_v, IRR_KEY_IRR_KEY_V));
+-      KeyMap.push_back(SKeyMap(SDLK_w, IRR_KEY_IRR_KEY_W));
+-      KeyMap.push_back(SKeyMap(SDLK_x, IRR_KEY_IRR_KEY_X));
+-      KeyMap.push_back(SKeyMap(SDLK_y, IRR_KEY_IRR_KEY_Y));
+-      KeyMap.push_back(SKeyMap(SDLK_z, IRR_KEY_IRR_KEY_Z));
++      KeyMap.push_back(SKeyMap(SDLK_a, IRR_KEY_A));
++      KeyMap.push_back(SKeyMap(SDLK_b, IRR_KEY_B));
++      KeyMap.push_back(SKeyMap(SDLK_c, IRR_KEY_C));
++      KeyMap.push_back(SKeyMap(SDLK_d, IRR_KEY_D));
++      KeyMap.push_back(SKeyMap(SDLK_e, IRR_KEY_E));
++      KeyMap.push_back(SKeyMap(SDLK_f, IRR_KEY_F));
++      KeyMap.push_back(SKeyMap(SDLK_g, IRR_KEY_G));
++      KeyMap.push_back(SKeyMap(SDLK_h, IRR_KEY_H));
++      KeyMap.push_back(SKeyMap(SDLK_i, IRR_KEY_I));
++      KeyMap.push_back(SKeyMap(SDLK_j, IRR_KEY_J));
++      KeyMap.push_back(SKeyMap(SDLK_k, IRR_KEY_K));
++      KeyMap.push_back(SKeyMap(SDLK_l, IRR_KEY_L));
++      KeyMap.push_back(SKeyMap(SDLK_m, IRR_KEY_M));
++      KeyMap.push_back(SKeyMap(SDLK_n, IRR_KEY_N));
++      KeyMap.push_back(SKeyMap(SDLK_o, IRR_KEY_O));
++      KeyMap.push_back(SKeyMap(SDLK_p, IRR_KEY_P));
++      KeyMap.push_back(SKeyMap(SDLK_q, IRR_KEY_Q));
++      KeyMap.push_back(SKeyMap(SDLK_r, IRR_KEY_R));
++      KeyMap.push_back(SKeyMap(SDLK_s, IRR_KEY_S));
++      KeyMap.push_back(SKeyMap(SDLK_t, IRR_KEY_T));
++      KeyMap.push_back(SKeyMap(SDLK_u, IRR_KEY_U));
++      KeyMap.push_back(SKeyMap(SDLK_v, IRR_KEY_V));
++      KeyMap.push_back(SKeyMap(SDLK_w, IRR_KEY_W));
++      KeyMap.push_back(SKeyMap(SDLK_x, IRR_KEY_X));
++      KeyMap.push_back(SKeyMap(SDLK_y, IRR_KEY_Y));
++      KeyMap.push_back(SKeyMap(SDLK_z, IRR_KEY_Z));
+
+       KeyMap.push_back(SKeyMap(SDLK_LSUPER, IRR_KEY_LWIN));
+       KeyMap.push_back(SKeyMap(SDLK_RSUPER, IRR_KEY_RWIN));

Reply via email to