mirror of
https://github.com/OpenDriver2/REDRIVER2.git
synced 2024-11-25 03:42:34 +01:00
- [Psy-X] fix crash in Pad system
This commit is contained in:
parent
e79e828017
commit
ed9f38c684
@ -113,6 +113,8 @@ void PsyX_Pad_OpenController(Sint32 deviceId, int slot)
|
||||
else // try open using device ID
|
||||
controller->haptic = SDL_HapticOpen(controller->deviceId);
|
||||
|
||||
controller->hapticEffect = -1;
|
||||
|
||||
if (!controller->haptic)
|
||||
{
|
||||
eprintwarn("No haptic for '%s'\n", SDL_GameControllerNameForIndex(deviceId));
|
||||
@ -125,12 +127,14 @@ void PsyX_Pad_CloseController(int slot)
|
||||
{
|
||||
PsyXController* controller = &g_controllers[slot];
|
||||
|
||||
SDL_HapticDestroyEffect(controller->haptic, controller->hapticEffect);
|
||||
SDL_HapticClose(controller->haptic);
|
||||
SDL_GameControllerClose(controller->gc);
|
||||
|
||||
//controller->deviceId = -1;
|
||||
controller->gc = NULL;
|
||||
controller->haptic = NULL;
|
||||
controller->hapticEffect = -1;
|
||||
}
|
||||
|
||||
// Called from LIBPAD
|
||||
|
Loading…
Reference in New Issue
Block a user