Skip to content

Commit

Permalink
Fix rumble detection (#823)
Browse files Browse the repository at this point in the history
Co-authored-by: Evan Ramos <[email protected]>
  • Loading branch information
tmyqlfpir and Hendricks266 authored Jul 26, 2024
1 parent 5d16ff7 commit c8421de
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions source/build/src/sdlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -974,10 +974,19 @@ void joyScanDevices()

inputdevices |= DEV_JOYSTICK;

#if SDL_VERSION_ATLEAST(2, 0, 18)
if (EDUKE32_SDL_LINKED_PREREQ(linked, 2, 0, 18))
{
if (SDL_GameControllerHasRumble(controller))
joystick.hasRumble = 1;
else DVLOG_F(LOG_INPUT, "Couldn't init controller rumble: %s.", SDL_GetError());
}
else
#endif
#if SDL_VERSION_ATLEAST(2, 0, 9)
if (EDUKE32_SDL_LINKED_PREREQ(linked, 2, 0, 9))
{
if (!SDL_GameControllerRumble(controller, 0xc000, 0xc000, 10))
if (!SDL_GameControllerRumble(controller, 1, 1, 1))
joystick.hasRumble = 1;
else DVLOG_F(LOG_INPUT, "Couldn't init controller rumble: %s.", SDL_GetError());
}
Expand Down Expand Up @@ -1020,10 +1029,19 @@ void joyScanDevices()
SDL_JoystickEventState(SDL_ENABLE);
inputdevices |= DEV_JOYSTICK;

#if SDL_VERSION_ATLEAST(2, 0, 18)
if (EDUKE32_SDL_LINKED_PREREQ(linked, 2, 0, 18))
{
if (SDL_JoystickHasRumble(joydev))
joystick.hasRumble = 1;
else DVLOG_F(LOG_INPUT, "Couldn't init joystick rumble: %s.", SDL_GetError());
}
else
#endif
#if SDL_VERSION_ATLEAST(2, 0, 9)
if (EDUKE32_SDL_LINKED_PREREQ(linked, 2, 0, 9))
{
if (!SDL_JoystickRumble(joydev, 0xffff, 0xffff, 200))
if (!SDL_JoystickRumble(joydev, 1, 1, 1))
joystick.hasRumble = 1;
else DVLOG_F(LOG_INPUT, "Couldn't init joystick rumble: %s.", SDL_GetError());
}
Expand Down

0 comments on commit c8421de

Please sign in to comment.