File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -2572,7 +2572,12 @@ bool SDL_IsGamepad(SDL_JoystickID instance_id)
2572
2572
SDL_LockJoysticks ();
2573
2573
{
2574
2574
const void * value ;
2575
- if (SDL_FindInHashTable (s_gamepadInstanceIDs , (void * )(uintptr_t )instance_id , & value )) {
2575
+ SDL_JoystickType js_type = SDL_GetJoystickTypeForID (instance_id );
2576
+ if (js_type != SDL_JOYSTICK_TYPE_GAMEPAD && js_type != SDL_JOYSTICK_TYPE_UNKNOWN )
2577
+ {
2578
+ // avoid creating HIDAPI mapping if type is SDL_Joystick knows it is not a game pad
2579
+ result = false;
2580
+ } else if (SDL_FindInHashTable (s_gamepadInstanceIDs , (void * )(uintptr_t )instance_id , & value )) {
2576
2581
result = (bool )(uintptr_t )value ;
2577
2582
} else {
2578
2583
if (SDL_PrivateGetGamepadMapping (instance_id , true) != NULL ) {
You can’t perform that action at this time.
0 commit comments