forked from OpenDingux/buildroot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
opendingux: Update joystick translator patch for SDL2
SDL2 was updated to 2.24.1 and the patch did not apply cleanly anymore. Update the patch to work with the new 2.24.1 release. Signed-off-by: Paul Cercueil <[email protected]>
- Loading branch information
Showing
1 changed file
with
55 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
From 411f05921d0d80cd62f9aeddbce4594f02f722d1 Mon Sep 17 00:00:00 2001 | ||
From 2a40944be71578b257823d7436fb862dbc0da414 Mon Sep 17 00:00:00 2001 | ||
From: Paul Cercueil <[email protected]> | ||
Date: Sat, 12 Jun 2021 12:32:46 +0100 | ||
Subject: [PATCH 1/3] SDL_joystick: Add "translator" joystick driver | ||
Date: Sun, 18 Dec 2022 16:36:46 +0100 | ||
Subject: [PATCH] SDL_joystick: Add "translator" joystick driver | ||
|
||
It permits to create a virtual joystick device created from more than | ||
one input source (e.g. other joysticks, and/or keyboard). | ||
|
@@ -59,45 +59,43 @@ Signed-off-by: Paul Cercueil <[email protected]> | |
include/SDL_config_macosx.h | 1 + | ||
include/SDL_config_os2.h | 1 + | ||
include/SDL_config_pandora.h | 1 + | ||
include/SDL_config_psp.h | 1 + | ||
include/SDL_config_windows.h | 1 + | ||
include/SDL_config_winrt.h | 1 + | ||
include/SDL_config_wiz.h | 1 + | ||
src/joystick/SDL_joystick.c | 3 + | ||
src/joystick/SDL_sysjoystick.h | 1 + | ||
src/joystick/translator/SDL_translator.c | 492 +++++++++++++++++++++++ | ||
16 files changed, 534 insertions(+) | ||
14 files changed, 532 insertions(+) | ||
create mode 100644 src/joystick/translator/SDL_translator.c | ||
|
||
diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
index 26fe83205f..a27c197023 100644 | ||
index 7617205..ee0f396 100644 | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -418,6 +418,7 @@ option_string(BACKGROUNDING_SIGNAL "number to use for magic backgrounding signal | ||
option_string(FOREGROUNDING_SIGNAL "number to use for magic foregrounding signal or 'OFF'" "OFF") | ||
set_option(HIDAPI "Use HIDAPI for low level joystick drivers" ${OPT_DEF_HIDAPI}) | ||
set_option(JOYSTICK_VIRTUAL "Enable the virtual-joystick driver" ON) | ||
+set_option(JOYSTICK_TRANSLATOR "Enable the translated-joystick driver" ON) | ||
set_option(ASAN "Use AddressSanitizer to detect memory errors" OFF) | ||
@@ -504,6 +504,7 @@ set_option(SDL_HIDAPI "Enable the HIDAPI subsystem" ON) | ||
dep_option(SDL_HIDAPI_LIBUSB "Use libusb for low level joystick drivers" OFF SDL_HIDAPI OFF) | ||
dep_option(SDL_HIDAPI_JOYSTICK "Use HIDAPI for low level joystick drivers" ON SDL_HIDAPI OFF) | ||
dep_option(SDL_VIRTUAL_JOYSTICK "Enable the virtual-joystick driver" ON SDL_HIDAPI OFF) | ||
+dep_option(SDL_TRANSLATOR_JOYSTICK "Enable the translated-joystick driver" ON SDL_HIDAPI OFF) | ||
set_option(SDL_ASAN "Use AddressSanitizer to detect memory errors" OFF) | ||
|
||
set(SDL_SHARED ${SDL_SHARED_ENABLED_BY_DEFAULT} CACHE BOOL "Build a shared version of the library") | ||
@@ -961,6 +962,11 @@ if(SDL_JOYSTICK) | ||
file(GLOB JOYSTICK_VIRTUAL_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/virtual/*.c) | ||
set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_VIRTUAL_SOURCES}) | ||
option(SDL_SHARED "Build a shared version of the library" ${SDL_SHARED_ENABLED_BY_DEFAULT}) | ||
@@ -1038,6 +1039,11 @@ else() | ||
set(HAVE_STDARG_H 1) | ||
set(HAVE_STDDEF_H 1) | ||
endif() | ||
+ if(JOYSTICK_TRANSLATOR) | ||
+ if(SDL_TRANSLATOR_JOYSTICK) | ||
+ set(SDL_JOYSTICK_TRANSLATOR 1) | ||
+ file(GLOB JOYSTICK_TRANSLATOR_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/translator/*.c) | ||
+ set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_TRANSLATOR_SOURCES}) | ||
+ endif() | ||
endif() | ||
|
||
if(SDL_VIDEO) | ||
|
||
diff --git a/configure.ac b/configure.ac | ||
index 2dbfd29f5e..210a74b399 100644 | ||
index 2dacf44..5a2ca21 100644 | ||
--- a/configure.ac | ||
+++ b/configure.ac | ||
@@ -3528,6 +3528,19 @@ CheckVirtualJoystick() | ||
@@ -3707,6 +3707,19 @@ CheckVirtualJoystick() | ||
fi | ||
} | ||
|
||
|
@@ -117,7 +115,7 @@ index 2dbfd29f5e..210a74b399 100644 | |
dnl Do this on all platforms, before everything else (other things might want to override it). | ||
CheckWarnAll | ||
CheckNoStrictAliasing | ||
@@ -4297,6 +4310,9 @@ esac | ||
@@ -4623,6 +4636,9 @@ esac | ||
dnl Permit use of virtual joystick APIs on any platform (subject to configure options) | ||
CheckVirtualJoystick | ||
|
||
|
@@ -127,7 +125,7 @@ index 2dbfd29f5e..210a74b399 100644 | |
# Check whether to install sdl2-config | ||
AC_MSG_CHECKING(whether to install sdl2-config) | ||
AC_ARG_ENABLE([sdl2-config], | ||
@@ -4535,6 +4551,11 @@ if test x$have_joystick_virtual = xyes; then | ||
@@ -4885,6 +4901,11 @@ if test x$have_joystick_virtual = xyes; then | ||
else | ||
SUMMARY="${SUMMARY}Enable virtual joystick APIs : NO\n" | ||
fi | ||
|
@@ -140,22 +138,22 @@ index 2dbfd29f5e..210a74b399 100644 | |
SUMMARY="${SUMMARY}Using libsamplerate : YES\n" | ||
else | ||
diff --git a/include/SDL_config.h.cmake b/include/SDL_config.h.cmake | ||
index 511ffc0d84..13c596e03e 100644 | ||
index 204a12e..0697ad0 100644 | ||
--- a/include/SDL_config.h.cmake | ||
+++ b/include/SDL_config.h.cmake | ||
@@ -320,6 +320,7 @@ | ||
@@ -349,6 +349,7 @@ | ||
#cmakedefine SDL_JOYSTICK_RAWINPUT @SDL_JOYSTICK_RAWINPUT@ | ||
#cmakedefine SDL_JOYSTICK_EMSCRIPTEN @SDL_JOYSTICK_EMSCRIPTEN@ | ||
#cmakedefine SDL_JOYSTICK_VIRTUAL @SDL_JOYSTICK_VIRTUAL@ | ||
+#cmakedefine SDL_JOYSTICK_TRANSLATOR @SDL_JOYSTICK_TRANSLATOR@ | ||
#cmakedefine SDL_JOYSTICK_VITA @SDL_JOYSTICK_VITA@ | ||
#cmakedefine SDL_HAPTIC_DUMMY @SDL_HAPTIC_DUMMY@ | ||
#cmakedefine SDL_HAPTIC_LINUX @SDL_HAPTIC_LINUX@ | ||
#cmakedefine SDL_JOYSTICK_PSP @SDL_JOYSTICK_PSP@ | ||
#cmakedefine SDL_JOYSTICK_PS2 @SDL_JOYSTICK_PS2@ | ||
diff --git a/include/SDL_config.h.in b/include/SDL_config.h.in | ||
index ea877237cd..a3af8ade54 100644 | ||
index 56b5302..e6f0b83 100644 | ||
--- a/include/SDL_config.h.in | ||
+++ b/include/SDL_config.h.in | ||
@@ -318,6 +318,7 @@ | ||
@@ -332,6 +332,7 @@ | ||
#undef SDL_JOYSTICK_RAWINPUT | ||
#undef SDL_JOYSTICK_EMSCRIPTEN | ||
#undef SDL_JOYSTICK_VIRTUAL | ||
|
@@ -164,10 +162,10 @@ index ea877237cd..a3af8ade54 100644 | |
#undef SDL_HAPTIC_ANDROID | ||
#undef SDL_HAPTIC_LINUX | ||
diff --git a/include/SDL_config_android.h b/include/SDL_config_android.h | ||
index 09d00d242a..ad30f10955 100644 | ||
index 5a9cfc0..1faa2fa 100644 | ||
--- a/include/SDL_config_android.h | ||
+++ b/include/SDL_config_android.h | ||
@@ -149,6 +149,7 @@ | ||
@@ -151,6 +151,7 @@ | ||
#define SDL_JOYSTICK_ANDROID 1 | ||
#define SDL_JOYSTICK_HIDAPI 1 | ||
#define SDL_JOYSTICK_VIRTUAL 1 | ||
|
@@ -176,10 +174,10 @@ index 09d00d242a..ad30f10955 100644 | |
|
||
/* Enable sensor driver */ | ||
diff --git a/include/SDL_config_iphoneos.h b/include/SDL_config_iphoneos.h | ||
index 9a748beb66..f4a1a2d579 100644 | ||
index 48f9f9f..a4ea3ef 100644 | ||
--- a/include/SDL_config_iphoneos.h | ||
+++ b/include/SDL_config_iphoneos.h | ||
@@ -147,6 +147,7 @@ | ||
@@ -150,6 +150,7 @@ | ||
/*#define SDL_JOYSTICK_HIDAPI 1*/ | ||
#define SDL_JOYSTICK_MFI 1 | ||
#define SDL_JOYSTICK_VIRTUAL 1 | ||
|
@@ -188,10 +186,10 @@ index 9a748beb66..f4a1a2d579 100644 | |
#ifdef __TVOS__ | ||
#define SDL_SENSOR_DUMMY 1 | ||
diff --git a/include/SDL_config_macosx.h b/include/SDL_config_macosx.h | ||
index ec18866232..ec462340a1 100644 | ||
index 023ecaa..9404257 100644 | ||
--- a/include/SDL_config_macosx.h | ||
+++ b/include/SDL_config_macosx.h | ||
@@ -154,6 +154,7 @@ | ||
@@ -160,6 +160,7 @@ | ||
#define SDL_JOYSTICK_HIDAPI 1 | ||
#define SDL_JOYSTICK_IOKIT 1 | ||
#define SDL_JOYSTICK_VIRTUAL 1 | ||
|
@@ -200,82 +198,58 @@ index ec18866232..ec462340a1 100644 | |
|
||
/* The MFI controller support requires ARC Objective C runtime */ | ||
diff --git a/include/SDL_config_os2.h b/include/SDL_config_os2.h | ||
index 075753fc7f..d316b90aff 100644 | ||
index c86769d..76a471f 100644 | ||
--- a/include/SDL_config_os2.h | ||
+++ b/include/SDL_config_os2.h | ||
@@ -37,6 +37,7 @@ | ||
/*#undef SDL_JOYSTICK_OS2 */ | ||
/*#undef SDL_JOYSTICK_HIDAPI */ | ||
@@ -48,6 +48,7 @@ | ||
#define SDL_LIBUSB_DYNAMIC "usb100.dll" | ||
#endif | ||
/*#undef SDL_JOYSTICK_VIRTUAL */ | ||
+/*#undef SDL_JOYSTICK_TRANSLATOR */ | ||
|
||
#define SDL_SENSOR_DUMMY 1 | ||
#define SDL_VIDEO_DRIVER_DUMMY 1 | ||
/* Enable OpenGL support */ | ||
/* #undef SDL_VIDEO_OPENGL */ | ||
diff --git a/include/SDL_config_pandora.h b/include/SDL_config_pandora.h | ||
index d57a79f22c..9dc962c926 100644 | ||
index 01bbf49..1c5d22c 100644 | ||
--- a/include/SDL_config_pandora.h | ||
+++ b/include/SDL_config_pandora.h | ||
@@ -118,6 +118,7 @@ | ||
@@ -120,6 +120,7 @@ | ||
#define SDL_INPUT_LINUXEV 1 | ||
#define SDL_JOYSTICK_LINUX 1 | ||
#define SDL_JOYSTICK_VIRTUAL 1 | ||
+/* #undef SDL_JOYSTICK_TRANSLATOR */ | ||
#define SDL_HAPTIC_LINUX 1 | ||
|
||
#define SDL_SENSOR_DUMMY 1 | ||
diff --git a/include/SDL_config_psp.h b/include/SDL_config_psp.h | ||
index 53d4ca6925..0e82efc94b 100644 | ||
--- a/include/SDL_config_psp.h | ||
+++ b/include/SDL_config_psp.h | ||
@@ -137,6 +137,7 @@ | ||
/* Enable the PSP joystick driver (src/joystick/psp/\*.c) */ | ||
#define SDL_JOYSTICK_PSP 1 | ||
#define SDL_JOYSTICK_VIRTUAL 1 | ||
+/* #undef SDL_JOYSTICK_TRANSLATOR */ | ||
|
||
/* Enable the dummy sensor driver */ | ||
#define SDL_SENSOR_DUMMY 1 | ||
diff --git a/include/SDL_config_windows.h b/include/SDL_config_windows.h | ||
index 33436c41c8..53cb90629e 100644 | ||
index 3ad3e8f..0bc20b6 100644 | ||
--- a/include/SDL_config_windows.h | ||
+++ b/include/SDL_config_windows.h | ||
@@ -229,6 +229,7 @@ typedef unsigned int uintptr_t; | ||
@@ -279,6 +279,7 @@ typedef unsigned int uintptr_t; | ||
#define SDL_JOYSTICK_RAWINPUT 1 | ||
#endif | ||
#define SDL_JOYSTICK_VIRTUAL 1 | ||
+/* #undef SDL_JOYSTICK_TRANSLATOR */ | ||
#ifdef SDL_WINDOWS10_SDK | ||
#ifdef HAVE_WINDOWS_GAMING_INPUT_H | ||
#define SDL_JOYSTICK_WGI 1 | ||
#endif | ||
diff --git a/include/SDL_config_winrt.h b/include/SDL_config_winrt.h | ||
index c6d5c135a9..acafcafc8b 100644 | ||
index 5569403..bff67f7 100644 | ||
--- a/include/SDL_config_winrt.h | ||
+++ b/include/SDL_config_winrt.h | ||
@@ -201,6 +201,7 @@ typedef unsigned int uintptr_t; | ||
@@ -209,6 +209,7 @@ typedef unsigned int uintptr_t; | ||
#define SDL_HAPTIC_DISABLED 1 | ||
#else | ||
#define SDL_JOYSTICK_VIRTUAL 1 | ||
+/* #undef SDL_JOYSTICK_TRANSLATOR */ | ||
#define SDL_JOYSTICK_XINPUT 1 | ||
#define SDL_HAPTIC_XINPUT 1 | ||
#endif | ||
diff --git a/include/SDL_config_wiz.h b/include/SDL_config_wiz.h | ||
index 7c552f257e..b7b1e48457 100644 | ||
--- a/include/SDL_config_wiz.h | ||
+++ b/include/SDL_config_wiz.h | ||
@@ -134,6 +134,7 @@ | ||
#define SDL_INPUT_LINUXEV 1 | ||
#define SDL_JOYSTICK_LINUX 1 | ||
#define SDL_JOYSTICK_VIRTUAL 1 | ||
+/* #undef SDL_JOYSTICK_TRANSLATOR */ | ||
#define SDL_HAPTIC_LINUX 1 | ||
|
||
#define SDL_SENSOR_DUMMY 1 | ||
#if (NTDDI_VERSION >= NTDDI_WIN10) | ||
#define SDL_JOYSTICK_WGI 1 | ||
#define SDL_HAPTIC_DISABLED 1 | ||
diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c | ||
index 1bab305b0b..014c1ea32f 100644 | ||
index 26b017b..c4f1a3e 100644 | ||
--- a/src/joystick/SDL_joystick.c | ||
+++ b/src/joystick/SDL_joystick.c | ||
@@ -92,6 +92,9 @@ static SDL_JoystickDriver *SDL_joystick_drivers[] = { | ||
@@ -96,6 +96,9 @@ static SDL_JoystickDriver *SDL_joystick_drivers[] = { | ||
#ifdef SDL_JOYSTICK_PSP | ||
&SDL_PSP_JoystickDriver, | ||
#endif | ||
|
@@ -286,10 +260,10 @@ index 1bab305b0b..014c1ea32f 100644 | |
&SDL_VIRTUAL_JoystickDriver, | ||
#endif | ||
diff --git a/src/joystick/SDL_sysjoystick.h b/src/joystick/SDL_sysjoystick.h | ||
index 91c9a7c6c3..1936d9bdb0 100644 | ||
index d5c8c0e..97dedf2 100644 | ||
--- a/src/joystick/SDL_sysjoystick.h | ||
+++ b/src/joystick/SDL_sysjoystick.h | ||
@@ -208,6 +208,7 @@ extern SDL_JoystickDriver SDL_RAWINPUT_JoystickDriver; | ||
@@ -227,6 +227,7 @@ extern SDL_JoystickDriver SDL_RAWINPUT_JoystickDriver; | ||
extern SDL_JoystickDriver SDL_IOS_JoystickDriver; | ||
extern SDL_JoystickDriver SDL_LINUX_JoystickDriver; | ||
extern SDL_JoystickDriver SDL_VIRTUAL_JoystickDriver; | ||
|
@@ -299,7 +273,7 @@ index 91c9a7c6c3..1936d9bdb0 100644 | |
extern SDL_JoystickDriver SDL_WINMM_JoystickDriver; | ||
diff --git a/src/joystick/translator/SDL_translator.c b/src/joystick/translator/SDL_translator.c | ||
new file mode 100644 | ||
index 0000000000..75e3f6edfb | ||
index 0000000..75e3f6e | ||
--- /dev/null | ||
+++ b/src/joystick/translator/SDL_translator.c | ||
@@ -0,0 +1,492 @@ | ||
|
@@ -796,5 +770,5 @@ index 0000000000..75e3f6edfb | |
+ | ||
+/* vi: set ts=4 sw=4 expandtab: */ | ||
-- | ||
2.33.0 | ||
2.35.1 | ||
|