Added support for the Steam Controller on mobile devices
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
diff --git a/Xcode-iOS/SDL/SDL.xcodeproj/project.pbxproj b/Xcode-iOS/SDL/SDL.xcodeproj/project.pbxproj
old mode 100644
new mode 100755
index 9bbdf08..8166e3f
--- a/Xcode-iOS/SDL/SDL.xcodeproj/project.pbxproj
+++ b/Xcode-iOS/SDL/SDL.xcodeproj/project.pbxproj
@@ -363,6 +363,8 @@
93CB792613FC5F5300BD3E05 /* SDL_uikitviewcontroller.m in Sources */ = {isa = PBXBuildFile; fileRef = 93CB792513FC5F5300BD3E05 /* SDL_uikitviewcontroller.m */; };
A704172E20F7E74800A82227 /* controller_type.h in Headers */ = {isa = PBXBuildFile; fileRef = A704172D20F7E74800A82227 /* controller_type.h */; };
A704172F20F7E76000A82227 /* SDL_gamecontroller.c in Sources */ = {isa = PBXBuildFile; fileRef = AA0AD06116647BBB00CE5896 /* SDL_gamecontroller.c */; };
+ A704173120F7F39900A82227 /* SDL_hidapi_steam.c in Sources */ = {isa = PBXBuildFile; fileRef = A704173020F7F39400A82227 /* SDL_hidapi_steam.c */; };
+ A704173220F7F39900A82227 /* SDL_hidapi_steam.c in Sources */ = {isa = PBXBuildFile; fileRef = A704173020F7F39400A82227 /* SDL_hidapi_steam.c */; };
A7C19D29212E552C00DF2152 /* SDL_displayevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = A7C19D27212E552B00DF2152 /* SDL_displayevents_c.h */; };
A7C19D2A212E552C00DF2152 /* SDL_displayevents.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C19D28212E552B00DF2152 /* SDL_displayevents.c */; };
A7C19D2B212E552C00DF2152 /* SDL_displayevents.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C19D28212E552B00DF2152 /* SDL_displayevents.c */; };
@@ -979,6 +981,7 @@
93CB792213FC5E5200BD3E05 /* SDL_uikitviewcontroller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_uikitviewcontroller.h; sourceTree = "<group>"; };
93CB792513FC5F5300BD3E05 /* SDL_uikitviewcontroller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_uikitviewcontroller.m; sourceTree = "<group>"; };
A704172D20F7E74800A82227 /* controller_type.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = controller_type.h; sourceTree = "<group>"; };
+ A704173020F7F39400A82227 /* SDL_hidapi_steam.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_hidapi_steam.c; sourceTree = "<group>"; };
A7C19D27212E552B00DF2152 /* SDL_displayevents_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_displayevents_c.h; sourceTree = "<group>"; };
A7C19D28212E552B00DF2152 /* SDL_displayevents.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_displayevents.c; sourceTree = "<group>"; };
A7FF6B6123AC3BC6005876C6 /* SDL_hidapi_gamecube.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_hidapi_gamecube.c; sourceTree = "<group>"; };
@@ -1479,6 +1482,7 @@
children = (
A7FF6B6123AC3BC6005876C6 /* SDL_hidapi_gamecube.c */,
F3BDD78E20F51CB8004ECBF3 /* SDL_hidapi_ps4.c */,
+ A704173020F7F39400A82227 /* SDL_hidapi_steam.c */,
F3BDD78C20F51CB8004ECBF3 /* SDL_hidapi_switch.c */,
F3BDD78B20F51CB8004ECBF3 /* SDL_hidapi_xbox360.c */,
A7FF6B6623AC3BCD005876C6 /* SDL_hidapi_xbox360w.c */,
@@ -2823,6 +2827,7 @@
FAB598951BB5C31600BE72C5 /* SDL_uikitview.m in Sources */,
FAB598971BB5C31600BE72C5 /* SDL_uikitviewcontroller.m in Sources */,
FAB598991BB5C31600BE72C5 /* SDL_uikitwindow.m in Sources */,
+ A704173220F7F39900A82227 /* SDL_hidapi_steam.c in Sources */,
FAB5989A1BB5C31600BE72C5 /* SDL_nullevents.c in Sources */,
FAB5989D1BB5C31600BE72C5 /* SDL_nullframebuffer.c in Sources */,
FAB5989E1BB5C31600BE72C5 /* SDL_nullvideo.c in Sources */,
@@ -2902,6 +2907,7 @@
566726451DF72CF5001DD3DB /* SDL_dataqueue.c in Sources */,
FDA684510DF2374E00F98A1A /* SDL_blit_A.c in Sources */,
FDA684520DF2374E00F98A1A /* SDL_blit_auto.c in Sources */,
+ A704173120F7F39900A82227 /* SDL_hidapi_steam.c in Sources */,
FDA684540DF2374E00F98A1A /* SDL_blit_copy.c in Sources */,
FDA684560DF2374E00F98A1A /* SDL_blit_N.c in Sources */,
FDA684570DF2374E00F98A1A /* SDL_blit_slow.c in Sources */,
diff --git a/include/SDL_config_iphoneos.h b/include/SDL_config_iphoneos.h
index 6f598eb..38929a8 100644
--- a/include/SDL_config_iphoneos.h
+++ b/include/SDL_config_iphoneos.h
@@ -138,7 +138,7 @@
/* Enable MFi joystick support */
#define SDL_JOYSTICK_MFI 1
-/*#define SDL_JOYSTICK_HIDAPI 1*/
+#define SDL_JOYSTICK_HIDAPI 1
#ifdef __TVOS__
#define SDL_SENSOR_DUMMY 1
diff --git a/src/joystick/SDL_sysjoystick.h b/src/joystick/SDL_sysjoystick.h
index 9c6fe63..6a9ebba 100644
--- a/src/joystick/SDL_sysjoystick.h
+++ b/src/joystick/SDL_sysjoystick.h
@@ -74,14 +74,6 @@ struct _SDL_Joystick
struct _SDL_Joystick *next; /* pointer to next joystick we have allocated */
};
-#if defined(__IPHONEOS__) || defined(__ANDROID__)
-#define HAVE_STEAMCONTROLLERS
-#define USE_STEAMCONTROLLER_HIDAPI
-#elif defined(__LINUX__)
-#define HAVE_STEAMCONTROLLERS
-#define USE_STEAMCONTROLLER_LINUX
-#endif
-
/* Device bus definitions */
#define SDL_HARDWARE_BUS_USB 0x03
#define SDL_HARDWARE_BUS_BLUETOOTH 0x05
diff --git a/src/joystick/hidapi/SDL_hidapijoystick_c.h b/src/joystick/hidapi/SDL_hidapijoystick_c.h
index 816ad96..b36dcde 100644
--- a/src/joystick/hidapi/SDL_hidapijoystick_c.h
+++ b/src/joystick/hidapi/SDL_hidapijoystick_c.h
@@ -45,6 +45,11 @@
#undef SDL_JOYSTICK_HIDAPI_XBOXONE
#endif
+#if defined(__IPHONEOS__) || defined(__TVOS__) || defined(__ANDROID__)
+/* Very basic Steam Controller support on mobile devices */
+#define SDL_JOYSTICK_HIDAPI_STEAM
+#endif
+
/* Prevent rumble duration overflow */
#define SDL_MAX_RUMBLE_DURATION_MS 0x0fffffff