Skip to content

Commit

Permalink
Fix rumble detection
Browse files Browse the repository at this point in the history
Co-authored-by: Evan Ramos <hendricks266@gmail.com>
  • Loading branch information
2 people authored and dibollinger committed Nov 17, 2024
1 parent 90e8a25 commit 8d422ca
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 8d422ca

Please sign in to comment.