Skip to content
Permalink
Browse files

Added HIDAPI joystick drivers for more consistent support for Xbox, P…

…S4 and Nintendo Switch Pro controller support across platforms.

Added SDL_GameControllerRumble() and SDL_JoystickRumble() for simple force feedback outside of the SDL haptics API
  • Loading branch information
slouken committed Aug 9, 2018
1 parent ba90412 commit d2042e1ed4e0808103168bf1bf2135601b969c4f
Showing with 6,833 additions and 1,373 deletions.
  1. +18 −1 Android.mk
  2. +25 −5 VisualC/SDL/SDL.vcxproj
  3. +468 −460 VisualC/SDL/SDL.vcxproj.filters
  4. +69 −19 Xcode-iOS/SDL/SDL.xcodeproj/project.pbxproj
  5. +91 −0 Xcode/SDL/SDL.xcodeproj/project.pbxproj
  6. +19 −0 android-project/app/src/main/java/org/libsdl/app/HIDDevice.java
  7. +640 −0 android-project/app/src/main/java/org/libsdl/app/HIDDeviceBLESteamController.java
  8. +614 −0 android-project/app/src/main/java/org/libsdl/app/HIDDeviceManager.java
  9. +298 −0 android-project/app/src/main/java/org/libsdl/app/HIDDeviceUSB.java
  10. +17 −5 android-project/app/src/main/java/org/libsdl/app/SDLActivity.java
  11. +109 −12 configure
  12. +55 −15 configure.in
  13. +1 −0 include/SDL_config.h.in
  14. +1 −0 include/SDL_config_android.h
  15. +1 −0 include/SDL_config_iphoneos.h
  16. +1 −0 include/SDL_config_macosx.h
  17. +1 −0 include/SDL_config_windows.h
  18. +13 −0 include/SDL_gamecontroller.h
  19. +3 −3 include/SDL_haptic.h
  20. +78 −0 include/SDL_hints.h
  21. +17 −4 include/SDL_joystick.h
  22. +1 −0 include/SDL_stdinc.h
  23. +3 −0 src/dynapi/SDL_dynapi_overrides.h
  24. +3 −2 src/dynapi/SDL_dynapi_procs.h
  25. +21 −8 src/joystick/SDL_gamecontroller.c
  26. +2 −0 src/joystick/SDL_gamecontrollerdb.h
  27. +302 −74 src/joystick/SDL_joystick.c
  28. +30 −1 src/joystick/SDL_joystick_c.h
  29. +79 −52 src/joystick/SDL_sysjoystick.h
  30. +62 −139 src/joystick/android/SDL_sysjoystick.c
  31. +0 −3 src/joystick/android/SDL_sysjoystick_c.h
  32. +267 −85 src/joystick/darwin/SDL_sysjoystick.c
  33. +6 −0 src/joystick/darwin/SDL_sysjoystick_c.h
  34. +49 −56 src/joystick/dummy/SDL_sysjoystick.c
  35. +533 −0 src/joystick/hidapi/SDL_hidapi_ps4.c
  36. +899 −0 src/joystick/hidapi/SDL_hidapi_switch.c
  37. +363 −0 src/joystick/hidapi/SDL_hidapi_xbox360.c
  38. +364 −0 src/joystick/hidapi/SDL_hidapi_xboxone.c
  39. +541 −0 src/joystick/hidapi/SDL_hidapijoystick.c
  40. +70 −0 src/joystick/hidapi/SDL_hidapijoystick_c.h
  41. +75 −141 src/joystick/iphoneos/SDL_sysjoystick.m
  42. +0 −3 src/joystick/iphoneos/SDL_sysjoystick_c.h
  43. +115 −40 src/joystick/linux/SDL_sysjoystick.c
  44. +4 −0 src/joystick/linux/SDL_sysjoystick_c.h
  45. +352 −185 src/joystick/windows/SDL_dinputjoystick.c
  46. +1 −0 src/joystick/windows/SDL_dinputjoystick_c.h
  47. +67 −45 src/joystick/windows/SDL_windowsjoystick.c
  48. +5 −1 src/joystick/windows/SDL_windowsjoystick_c.h
  49. +58 −13 src/joystick/windows/SDL_xinputjoystick.c
  50. +1 −0 src/joystick/windows/SDL_xinputjoystick_c.h
  51. +12 −1 src/stdlib/SDL_string.c
  52. +5 −0 test/testgamecontroller.c
  53. +4 −0 test/testjoystick.c
@@ -31,7 +31,7 @@ LOCAL_SRC_FILES := \
$(wildcard $(LOCAL_PATH)/src/haptic/android/*.c) \
$(wildcard $(LOCAL_PATH)/src/joystick/*.c) \
$(wildcard $(LOCAL_PATH)/src/joystick/android/*.c) \
$(LOCAL_PATH)/src/joystick/steam/SDL_steamcontroller.c \
$(wildcard $(LOCAL_PATH)/src/joystick/hidapi/*.c) \
$(wildcard $(LOCAL_PATH)/src/loadso/dlopen/*.c) \
$(wildcard $(LOCAL_PATH)/src/power/*.c) \
$(wildcard $(LOCAL_PATH)/src/power/android/*.c) \
@@ -48,6 +48,8 @@ LOCAL_SRC_FILES := \
$(wildcard $(LOCAL_PATH)/src/video/yuv2rgb/*.c) \
$(wildcard $(LOCAL_PATH)/src/test/*.c))

LOCAL_SHARED_LIBRARIES := hidapi

LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES
LOCAL_LDLIBS := -ldl -lGLESv1_CM -lGLESv2 -llog -landroid

@@ -88,4 +90,19 @@ LOCAL_MODULE_FILENAME := libSDL2main

include $(BUILD_STATIC_LIBRARY)

###########################
#
# hidapi library
#
###########################

include $(CLEAR_VARS)

LOCAL_CPPFLAGS += -std=c++11

LOCAL_SRC_FILES := $(LOCAL_PATH)/src/hidapi/android/hid.cpp

LOCAL_MODULE := libhidapi
LOCAL_LDLIBS := -llog

include $(BUILD_SHARED_LIBRARY)
@@ -80,6 +80,18 @@
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x86;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<IncludePath>D:\dev\steam\rel\streaming_client\SDL\src\hidapi\hidapi;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<IncludePath>D:\dev\steam\rel\streaming_client\SDL\src\hidapi\hidapi;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<IncludePath>D:\dev\steam\rel\streaming_client\SDL\src\hidapi\hidapi;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<IncludePath>D:\dev\steam\rel\streaming_client\SDL\src\hidapi\hidapi;$(IncludePath)</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<PreBuildEvent>
<Command>
@@ -109,7 +121,7 @@
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Link>
<AdditionalDependencies>winmm.lib;imm32.lib;version.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>setupapi.lib;winmm.lib;imm32.lib;version.lib;%(AdditionalDependencies)</AdditionalDependencies>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
@@ -140,7 +152,7 @@
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Link>
<AdditionalDependencies>winmm.lib;imm32.lib;version.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>setupapi.lib;winmm.lib;imm32.lib;version.lib;%(AdditionalDependencies)</AdditionalDependencies>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
@@ -174,7 +186,7 @@
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Link>
<AdditionalDependencies>winmm.lib;imm32.lib;version.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>setupapi.lib;winmm.lib;imm32.lib;version.lib;%(AdditionalDependencies)</AdditionalDependencies>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
@@ -206,7 +218,7 @@
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Link>
<AdditionalDependencies>winmm.lib;imm32.lib;version.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>setupapi.lib;winmm.lib;imm32.lib;version.lib;%(AdditionalDependencies)</AdditionalDependencies>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
@@ -318,6 +330,8 @@
<ClInclude Include="..\..\src\haptic\windows\SDL_dinputhaptic_c.h" />
<ClInclude Include="..\..\src\haptic\windows\SDL_windowshaptic_c.h" />
<ClInclude Include="..\..\src\haptic\windows\SDL_xinputhaptic_c.h" />
<ClInclude Include="..\..\src\joystick\hidapi\controller_type.h" />
<ClInclude Include="..\..\src\joystick\hidapi\SDL_hidapijoystick_c.h" />
<ClInclude Include="..\..\src\joystick\SDL_joystick_c.h" />
<ClInclude Include="..\..\src\joystick\SDL_sysjoystick.h" />
<ClInclude Include="..\..\src\joystick\windows\SDL_dinputjoystick_c.h" />
@@ -411,6 +425,12 @@
<ClCompile Include="..\..\src\haptic\windows\SDL_dinputhaptic.c" />
<ClCompile Include="..\..\src\haptic\windows\SDL_windowshaptic.c" />
<ClCompile Include="..\..\src\haptic\windows\SDL_xinputhaptic.c" />
<ClCompile Include="..\..\src\hidapi\windows\hid.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapijoystick.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_ps4.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_switch.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_xbox360.c" />
<ClCompile Include="..\..\src\joystick\hidapi\SDL_hidapi_xboxone.c" />
<ClCompile Include="..\..\src\joystick\SDL_gamecontroller.c" />
<ClCompile Include="..\..\src\joystick\SDL_joystick.c" />
<ClCompile Include="..\..\src\joystick\windows\SDL_dinputjoystick.c" />
@@ -523,4 +543,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>

0 comments on commit d2042e1

Please sign in to comment.