Add support for game controllers.

To do that, the irrlicht backend had to be switched from X11
to SDL, since the X11 backend joystick support is Linux specific,
and there is no way to combine SDL joystick support with Linux graphics
backend. Test reports by Raf Czlonka.

OK pascal@ (MAINTAINER)
This commit is contained in:
sebastia 2020-03-18 18:57:45 +00:00
parent bffdcfe8aa
commit f04eaafc81
5 changed files with 129 additions and 13 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.29 2019/07/12 20:46:25 sthen Exp $
# $OpenBSD: Makefile,v 1.30 2020/03/18 18:57:45 sebastia Exp $
ONLY_FOR_ARCHS = amd64 i386 powerpc
@ -8,7 +8,7 @@ V = 0.9.3
BASENAME = supertuxkart-${V}
DISTNAME = ${BASENAME}-src
PKGNAME = ${BASENAME}
REVISION = 0
REVISION = 1
CATEGORIES = games
@ -20,7 +20,7 @@ MAINTAINER = Pascal Stumpf <pascal@stumpf.co>
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 @@ COMPILER = base-clang ports-gcc
RUN_DEPENDS = devel/desktop-file-utils
LIB_DEPENDS = audio/openal>=0.0.8p7 \
audio/libvorbis \
devel/sdl \
net/curl \
graphics/png \
graphics/jpeg

View File

@ -0,0 +1,13 @@
$OpenBSD: patch-CMakeLists_txt,v 1.5 2020/03/18 18:57:46 sebastia Exp $
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)

View File

@ -1,4 +1,4 @@
$OpenBSD: patch-lib_irrlicht_CMakeLists_txt,v 1.4 2017/11/27 15:45:19 pascal Exp $
$OpenBSD: patch-lib_irrlicht_CMakeLists_txt,v 1.5 2020/03/18 18:57:46 sebastia Exp $
Index: lib/irrlicht/CMakeLists.txt
--- lib/irrlicht/CMakeLists.txt.orig
+++ lib/irrlicht/CMakeLists.txt
@ -13,12 +13,3 @@ Index: lib/irrlicht/CMakeLists.txt
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()

View File

@ -0,0 +1,26 @@
$OpenBSD: patch-lib_irrlicht_include_IrrCompileConfig_h,v 1.1 2020/03/18 18:57:46 sebastia Exp $
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

View File

@ -0,0 +1,85 @@
$OpenBSD: patch-lib_irrlicht_source_Irrlicht_CIrrDeviceSDL_cpp,v 1.1 2020/03/18 18:57:46 sebastia Exp $
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));