Skip to content

Commit

Permalink
Rolling back GameCube HIDAPI support
Browse files Browse the repository at this point in the history
It causes the HIDAPI devices to always be opened on enumeration, which causes crashes in the Windows drivers when multiple applications are reading and writing at the same time. We can revisit this after 2.0.10 release.
  • Loading branch information
slouken committed Jun 19, 2019
1 parent 56e2b9a commit be6cda9
Show file tree
Hide file tree
Showing 16 changed files with 176 additions and 826 deletions.
1 change: 0 additions & 1 deletion VisualC/SDL/SDL.vcxproj
Expand Up @@ -421,7 +421,6 @@
<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_gamecube.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" />
Expand Down
1 change: 0 additions & 1 deletion VisualC/SDL/SDL.vcxproj.filters
Expand Up @@ -360,7 +360,6 @@
<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_hidapi_gamecube.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" />
Expand Down
10 changes: 0 additions & 10 deletions Xcode-iOS/SDL/SDL.xcodeproj/project.pbxproj
Expand Up @@ -468,9 +468,6 @@
F3BDD79B20F51CB8004ECBF3 /* SDL_hidapijoystick_c.h in Headers */ = {isa = PBXBuildFile; fileRef = F3BDD79020F51CB8004ECBF3 /* SDL_hidapijoystick_c.h */; };
F3BDD79C20F51CB8004ECBF3 /* SDL_hidapijoystick.c in Sources */ = {isa = PBXBuildFile; fileRef = F3BDD79120F51CB8004ECBF3 /* SDL_hidapijoystick.c */; };
F3BDD79D20F51CB8004ECBF3 /* SDL_hidapijoystick.c in Sources */ = {isa = PBXBuildFile; fileRef = F3BDD79120F51CB8004ECBF3 /* SDL_hidapijoystick.c */; };
F3E3C55D223DEC6C007D243C /* SDL_hidapi_gamecube.c in Sources */ = {isa = PBXBuildFile; fileRef = F3E3C55C223DEC6C007D243C /* SDL_hidapi_gamecube.c */; };
F3E3C55E223DEC6C007D243C /* SDL_hidapi_gamecube.c in Sources */ = {isa = PBXBuildFile; fileRef = F3E3C55C223DEC6C007D243C /* SDL_hidapi_gamecube.c */; };
F3E3C55F224065AE007D243C /* SDL_hidapi_gamecube.c in Sources */ = {isa = PBXBuildFile; fileRef = F3E3C55C223DEC6C007D243C /* SDL_hidapi_gamecube.c */; };
F3E3C658224069CE007D243C /* SDL_uikit_main.c in Sources */ = {isa = PBXBuildFile; fileRef = F3E3C657224069CE007D243C /* SDL_uikit_main.c */; };
F3E3C65B2241389A007D243C /* SDL_blit.h in Headers */ = {isa = PBXBuildFile; fileRef = FDA683010DF2374E00F98A1A /* SDL_blit.h */; };
F3E3C65C2241389A007D243C /* SDL_uikitmetalview.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D7517191EE1D32200820EEA /* SDL_uikitmetalview.h */; };
Expand Down Expand Up @@ -657,7 +654,6 @@
F3E3C7122241389A007D243C /* SDL_uikitevents.m in Sources */ = {isa = PBXBuildFile; fileRef = FD689F0D0E26E5D900F90B21 /* SDL_uikitevents.m */; };
F3E3C7132241389A007D243C /* yuv_rgb.c in Sources */ = {isa = PBXBuildFile; fileRef = AA13B3561FB8B46300D9FEE6 /* yuv_rgb.c */; };
F3E3C7142241389A007D243C /* SDL_uikitopengles.m in Sources */ = {isa = PBXBuildFile; fileRef = FD689F0F0E26E5D900F90B21 /* SDL_uikitopengles.m */; };
F3E3C7152241389A007D243C /* SDL_hidapi_gamecube.c in Sources */ = {isa = PBXBuildFile; fileRef = F3E3C55C223DEC6C007D243C /* SDL_hidapi_gamecube.c */; };
F3E3C7162241389A007D243C /* SDL_uikitvideo.m in Sources */ = {isa = PBXBuildFile; fileRef = FD689F110E26E5D900F90B21 /* SDL_uikitvideo.m */; };
F3E3C7172241389A007D243C /* SDL_uikitview.m in Sources */ = {isa = PBXBuildFile; fileRef = FD689F130E26E5D900F90B21 /* SDL_uikitview.m */; };
F3E3C7182241389A007D243C /* SDL_displayevents.c in Sources */ = {isa = PBXBuildFile; fileRef = A7C19D28212E552B00DF2152 /* SDL_displayevents.c */; };
Expand Down Expand Up @@ -1062,7 +1058,6 @@
F3BDD78E20F51CB8004ECBF3 /* SDL_hidapi_ps4.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_hidapi_ps4.c; sourceTree = "<group>"; };
F3BDD79020F51CB8004ECBF3 /* SDL_hidapijoystick_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_hidapijoystick_c.h; sourceTree = "<group>"; };
F3BDD79120F51CB8004ECBF3 /* SDL_hidapijoystick.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_hidapijoystick.c; sourceTree = "<group>"; };
F3E3C55C223DEC6C007D243C /* SDL_hidapi_gamecube.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_hidapi_gamecube.c; sourceTree = "<group>"; };
F3E3C65222406928007D243C /* libSDLmain.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSDLmain.a; sourceTree = BUILT_PRODUCTS_DIR; };
F3E3C657224069CE007D243C /* SDL_uikit_main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_uikit_main.c; sourceTree = "<group>"; };
F3E3C7572241389A007D243C /* libSDL2.dylib */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSDL2.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -1463,7 +1458,6 @@
F3BDD78A20F51C8D004ECBF3 /* hidapi */ = {
isa = PBXGroup;
children = (
F3E3C55C223DEC6C007D243C /* SDL_hidapi_gamecube.c */,
F3BDD78E20F51CB8004ECBF3 /* SDL_hidapi_ps4.c */,
F3BDD78C20F51CB8004ECBF3 /* SDL_hidapi_switch.c */,
F3BDD78B20F51CB8004ECBF3 /* SDL_hidapi_xbox360.c */,
Expand Down Expand Up @@ -2518,7 +2512,6 @@
52ED1E24222889500061FCE0 /* SDL_uikitevents.m in Sources */,
52ED1E25222889500061FCE0 /* yuv_rgb.c in Sources */,
52ED1E26222889500061FCE0 /* SDL_uikitopengles.m in Sources */,
F3E3C55F224065AE007D243C /* SDL_hidapi_gamecube.c in Sources */,
52ED1E27222889500061FCE0 /* SDL_uikitvideo.m in Sources */,
52ED1E28222889500061FCE0 /* SDL_uikitview.m in Sources */,
52ED1E29222889500061FCE0 /* SDL_displayevents.c in Sources */,
Expand Down Expand Up @@ -2647,7 +2640,6 @@
F3E3C7122241389A007D243C /* SDL_uikitevents.m in Sources */,
F3E3C7132241389A007D243C /* yuv_rgb.c in Sources */,
F3E3C7142241389A007D243C /* SDL_uikitopengles.m in Sources */,
F3E3C7152241389A007D243C /* SDL_hidapi_gamecube.c in Sources */,
F3E3C7162241389A007D243C /* SDL_uikitvideo.m in Sources */,
F3E3C7172241389A007D243C /* SDL_uikitview.m in Sources */,
F3E3C7182241389A007D243C /* SDL_displayevents.c in Sources */,
Expand Down Expand Up @@ -2824,7 +2816,6 @@
FAB598BD1BB5C31600BE72C5 /* SDL_hints.c in Sources */,
FAB598BE1BB5C31600BE72C5 /* SDL_log.c in Sources */,
FAB598BF1BB5C31600BE72C5 /* SDL.c in Sources */,
F3E3C55E223DEC6C007D243C /* SDL_hidapi_gamecube.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -2895,7 +2886,6 @@
FD689F1D0E26E5D900F90B21 /* SDL_uikitevents.m in Sources */,
AA13B35A1FB8B46400D9FEE6 /* yuv_rgb.c in Sources */,
FD689F1F0E26E5D900F90B21 /* SDL_uikitopengles.m in Sources */,
F3E3C55D223DEC6C007D243C /* SDL_hidapi_gamecube.c in Sources */,
FD689F210E26E5D900F90B21 /* SDL_uikitvideo.m in Sources */,
FD689F230E26E5D900F90B21 /* SDL_uikitview.m in Sources */,
A7C19D2A212E552C00DF2152 /* SDL_displayevents.c in Sources */,
Expand Down
8 changes: 0 additions & 8 deletions Xcode/SDL/SDL.xcodeproj/project.pbxproj
Expand Up @@ -919,9 +919,6 @@
F3950CD8212BC88D00F51292 /* SDL_sensor.h in Headers */ = {isa = PBXBuildFile; fileRef = F3950CD7212BC88D00F51292 /* SDL_sensor.h */; settings = {ATTRIBUTES = (Public, ); }; };
F3950CD9212BC88D00F51292 /* SDL_sensor.h in Headers */ = {isa = PBXBuildFile; fileRef = F3950CD7212BC88D00F51292 /* SDL_sensor.h */; settings = {ATTRIBUTES = (Public, ); }; };
F3950CDA212BC88D00F51292 /* SDL_sensor.h in Headers */ = {isa = PBXBuildFile; fileRef = F3950CD7212BC88D00F51292 /* SDL_sensor.h */; settings = {ATTRIBUTES = (Public, ); }; };
F3E3C559223DEBC7007D243C /* SDL_hidapi_gamecube.c in Sources */ = {isa = PBXBuildFile; fileRef = F3E3C558223DEBC7007D243C /* SDL_hidapi_gamecube.c */; };
F3E3C55A223DEBC7007D243C /* SDL_hidapi_gamecube.c in Sources */ = {isa = PBXBuildFile; fileRef = F3E3C558223DEBC7007D243C /* SDL_hidapi_gamecube.c */; };
F3E3C55B223DEBC7007D243C /* SDL_hidapi_gamecube.c in Sources */ = {isa = PBXBuildFile; fileRef = F3E3C558223DEBC7007D243C /* SDL_hidapi_gamecube.c */; };
FA73671D19A540EF004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73671C19A540EF004122E4 /* CoreVideo.framework */; };
FA73671E19A54140004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73671C19A540EF004122E4 /* CoreVideo.framework */; };
FA73671F19A54144004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73671C19A540EF004122E4 /* CoreVideo.framework */; };
Expand Down Expand Up @@ -1252,7 +1249,6 @@
F30D9CCB212EB4810047DF2E /* SDL_displayevents_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_displayevents_c.h; sourceTree = "<group>"; };
F30D9CCC212EB4810047DF2E /* SDL_displayevents.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_displayevents.c; sourceTree = "<group>"; };
F3950CD7212BC88D00F51292 /* SDL_sensor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sensor.h; sourceTree = "<group>"; };
F3E3C558223DEBC7007D243C /* SDL_hidapi_gamecube.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_hidapi_gamecube.c; sourceTree = "<group>"; };
F59C710300D5CB5801000001 /* ReadMe.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = ReadMe.txt; sourceTree = "<group>"; };
F59C710600D5CB5801000001 /* SDL.info */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = SDL.info; sourceTree = "<group>"; };
F5A2EF3900C6A39A01000001 /* BUGS.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = BUGS.txt; path = ../../BUGS.txt; sourceTree = SOURCE_ROOT; };
Expand Down Expand Up @@ -1932,7 +1928,6 @@
A704170C20F09AA600A82227 /* hidapi */ = {
isa = PBXGroup;
children = (
F3E3C558223DEBC7007D243C /* SDL_hidapi_gamecube.c */,
A704171120F09AC900A82227 /* SDL_hidapi_ps4.c */,
A704170F20F09AC800A82227 /* SDL_hidapi_switch.c */,
A704171320F09AC900A82227 /* SDL_hidapi_xbox360.c */,
Expand Down Expand Up @@ -2707,7 +2702,6 @@
04BD005B12E6671800899322 /* SDL_syshaptic.c in Sources */,
04BD005F12E6671800899322 /* SDL_haptic.c in Sources */,
4D1664551EDD60AD003DE88E /* SDL_cocoavulkan.m in Sources */,
F3E3C559223DEBC7007D243C /* SDL_hidapi_gamecube.c in Sources */,
04BD006612E6671800899322 /* SDL_sysjoystick.c in Sources */,
04BD007012E6671800899322 /* SDL_joystick.c in Sources */,
04BD008812E6671800899322 /* SDL_sysloadso.c in Sources */,
Expand Down Expand Up @@ -2846,7 +2840,6 @@
04BD026D12E6671800899322 /* SDL_quit.c in Sources */,
04BD026F12E6671800899322 /* SDL_touch.c in Sources */,
04BD027112E6671800899322 /* SDL_windowevents.c in Sources */,
F3E3C55A223DEBC7007D243C /* SDL_hidapi_gamecube.c in Sources */,
04BD027412E6671800899322 /* SDL_rwopsbundlesupport.m in Sources */,
04BD027512E6671800899322 /* SDL_rwops.c in Sources */,
04BD027612E6671800899322 /* SDL_syshaptic.c in Sources */,
Expand Down Expand Up @@ -2985,7 +2978,6 @@
DB31401017554B71006C0E22 /* SDL_quit.c in Sources */,
DB31401117554B71006C0E22 /* SDL_touch.c in Sources */,
DB31401217554B71006C0E22 /* SDL_windowevents.c in Sources */,
F3E3C55B223DEBC7007D243C /* SDL_hidapi_gamecube.c in Sources */,
DB31401317554B71006C0E22 /* SDL_rwopsbundlesupport.m in Sources */,
DB31401417554B71006C0E22 /* SDL_rwops.c in Sources */,
DB31401517554B71006C0E22 /* SDL_syshaptic.c in Sources */,
Expand Down
11 changes: 0 additions & 11 deletions include/SDL_hints.h
Expand Up @@ -565,17 +565,6 @@ extern "C" {
*/
#define SDL_HINT_JOYSTICK_HIDAPI_XBOX "SDL_JOYSTICK_HIDAPI_XBOX"

/**
* \brief A variable controlling whether the HIDAPI driver for Nintendo GameCube controllers should be used.
*
* This variable can be set to the following values:
* "0" - HIDAPI driver is not used
* "1" - HIDAPI driver is used
*
* The default is the value of SDL_HINT_JOYSTICK_HIDAPI
*/
#define SDL_HINT_JOYSTICK_HIDAPI_GAMECUBE "SDL_JOYSTICK_HIDAPI_GAMECUBE"

/**
* \brief A variable that controls whether Steam Controllers should be exposed using the SDL joystick and game controller APIs
*
Expand Down
11 changes: 0 additions & 11 deletions src/joystick/SDL_joystick.c
Expand Up @@ -1037,11 +1037,6 @@ SDL_JoystickUpdate(void)
/* Make sure the list is unlocked while dispatching events to prevent application deadlocks */
SDL_UnlockJoysticks();

/* Special function for HIDAPI devices, as a single device can provide multiple SDL_Joysticks */
#ifdef SDL_JOYSTICK_HIDAPI
SDL_HIDAPI_UpdateDevices();
#endif /* SDL_JOYSTICK_HIDAPI */

for (joystick = SDL_joysticks; joystick; joystick = joystick->next) {
if (joystick->attached) {
/* This should always be true, but seeing a crash in the wild...? */
Expand Down Expand Up @@ -1199,12 +1194,6 @@ SDL_IsJoystickXboxOne(Uint16 vendor, Uint16 product)
return (GuessControllerType(vendor, product) == k_eControllerType_XBoxOneController);
}

SDL_bool
SDL_IsJoystickGameCube(Uint16 vendor, Uint16 product)
{
return (GuessControllerType(vendor, product) == k_eControllerType_GameCube);
}

SDL_bool
SDL_IsJoystickXInput(SDL_JoystickGUID guid)
{
Expand Down
3 changes: 0 additions & 3 deletions src/joystick/SDL_joystick_c.h
Expand Up @@ -66,9 +66,6 @@ extern SDL_bool SDL_IsJoystickXbox360(Uint16 vendor_id, Uint16 product_id);
/* Function to return whether a joystick is an Xbox One controller */
extern SDL_bool SDL_IsJoystickXboxOne(Uint16 vendor_id, Uint16 product_id);

/* Function to return whether a joystick is a GameCube controller */
extern SDL_bool SDL_IsJoystickGameCube(Uint16 vendor_id, Uint16 product_id);

/* Function to return whether a joystick guid comes from the XInput driver */
extern SDL_bool SDL_IsJoystickXInput(SDL_JoystickGUID guid);

Expand Down
3 changes: 0 additions & 3 deletions src/joystick/SDL_sysjoystick.h
Expand Up @@ -152,9 +152,6 @@ extern SDL_JoystickDriver SDL_IOS_JoystickDriver;
extern SDL_JoystickDriver SDL_LINUX_JoystickDriver;
extern SDL_JoystickDriver SDL_WINDOWS_JoystickDriver;

/* Special function to update HIDAPI devices */
extern void SDL_HIDAPI_UpdateDevices(void);

#endif /* SDL_sysjoystick_h_ */

/* vi: set ts=4 sw=4 expandtab: */
3 changes: 0 additions & 3 deletions src/joystick/controller_type.h
Expand Up @@ -57,7 +57,6 @@ typedef enum
k_eControllerType_SwitchJoyConPair = 41,
k_eControllerType_SwitchInputOnlyController = 42,
k_eControllerType_MobileTouch = 43,
k_eControllerType_GameCube = 44,
k_eControllerType_LastController, // Don't add game controllers below this enumeration - this enumeration can change value

// Keyboards and Mice
Expand Down Expand Up @@ -388,8 +387,6 @@ static const ControllerDescription_t arrControllers[] = {
{ MAKE_CONTROLLER_ID( 0x20d6, 0xa711 ), k_eControllerType_SwitchInputOnlyController }, // PowerA Wired Controller Plus
{ MAKE_CONTROLLER_ID( 0x0f0d, 0x0092 ), k_eControllerType_SwitchInputOnlyController }, // HORI Pokken Tournament DX Pro Pad

{ MAKE_CONTROLLER_ID( 0x057e, 0x0337 ), k_eControllerType_GameCube }, // Nintendo Wii U/Switch GameCube USB Adapter


// Valve products - don't add to public list
{ MAKE_CONTROLLER_ID( 0x0000, 0x11fb ), k_eControllerType_MobileTouch }, // Streaming mobile touch virtual controls
Expand Down

0 comments on commit be6cda9

Please sign in to comment.