mirror of https://github.com/libsdl-org/SDL
Added a cleanup function for virtual joysticks
This commit is contained in:
parent
00c409cff8
commit
47926d7bd0
|
@ -451,6 +451,7 @@ typedef struct SDL_VirtualJoystickDesc
|
|||
SDL_bool (SDLCALL *SetLED)(void *userdata, Uint8 red, Uint8 green, Uint8 blue); /**< Implements SDL_SetJoystickLED() */
|
||||
SDL_bool (SDLCALL *SendEffect)(void *userdata, const void *data, int size); /**< Implements SDL_SendJoystickEffect() */
|
||||
SDL_bool (SDLCALL *SetSensorsEnabled)(void *userdata, SDL_bool enabled); /**< Implements SDL_SetGamepadSensorEnabled() */
|
||||
void (SDLCALL *Cleanup)(void *userdata); /**< Cleans up the userdata when the joystick is detached */
|
||||
} SDL_VirtualJoystickDesc;
|
||||
|
||||
/**
|
||||
|
|
|
@ -70,6 +70,10 @@ static void VIRTUAL_FreeHWData(joystick_hwdata *hwdata)
|
|||
return;
|
||||
}
|
||||
|
||||
if (hwdata->desc.Cleanup) {
|
||||
hwdata->desc.Cleanup(hwdata->desc.userdata);
|
||||
}
|
||||
|
||||
// Remove hwdata from SDL-global list
|
||||
for (cur = g_VJoys; cur; prev = cur, cur = cur->next) {
|
||||
if (hwdata == cur) {
|
||||
|
|
Loading…
Reference in New Issue