Apply Coccinelle to input/sdl3.c.

Again this isn't enough to get the file compiling, but it's a start.
This commit is contained in:
Yamagi 2024-03-29 15:05:36 +01:00
parent adfd7362b5
commit a81b065893
1 changed files with 102 additions and 93 deletions

View File

@ -34,7 +34,7 @@
* =======================================================================
*/
#include <SDL2/SDL.h>
#include <SDL3/SDL.h>
#include "header/input.h"
#include "../header/keyboard.h"
@ -78,7 +78,7 @@ typedef enum
// IN_Update() called at the beginning of a frame to the
// actual movement functions called at a later time.
static float mouse_x, mouse_y;
static unsigned char sdl_back_button = SDL_CONTROLLER_BUTTON_BACK;
static unsigned char sdl_back_button = SDL_GAMEPAD_BUTTON_BACK;
static int joystick_left_x, joystick_left_y, joystick_right_x, joystick_right_y;
static float gyro_yaw, gyro_pitch;
static qboolean mlooking;
@ -125,7 +125,7 @@ typedef struct haptic_effects_cache {
qboolean show_gamepad = false, show_haptic = false, show_gyro = false;
static SDL_Haptic *joystick_haptic = NULL;
static SDL_GameController *controller = NULL;
static SDL_Gamepad *controller = NULL;
#define HAPTIC_EFFECT_LIST_SIZE 16
@ -502,7 +502,7 @@ qboolean IN_NumpadIsOn()
{
SDL_Keymod mod = SDL_GetModState();
if ((mod & KMOD_NUM) == KMOD_NUM)
if ((mod & SDL_KMOD_NUM) == SDL_KMOD_NUM)
{
return true;
}
@ -535,13 +535,13 @@ IN_Update(void)
switch (event.type)
{
case SDL_MOUSEWHEEL:
case SDL_EVENT_MOUSE_WHEEL :
Key_Event((event.wheel.y > 0 ? K_MWHEELUP : K_MWHEELDOWN), true, true);
Key_Event((event.wheel.y > 0 ? K_MWHEELUP : K_MWHEELDOWN), false, true);
break;
case SDL_MOUSEBUTTONDOWN:
case SDL_MOUSEBUTTONUP:
case SDL_EVENT_MOUSE_BUTTON_DOWN :
case SDL_EVENT_MOUSE_BUTTON_UP :
switch (event.button.button)
{
case SDL_BUTTON_LEFT:
@ -563,10 +563,12 @@ IN_Update(void)
return;
}
Key_Event(key, (event.type == SDL_MOUSEBUTTONDOWN), true);
Key_Event(key,
(event.type == SDL_EVENT_MOUSE_BUTTON_DOWN),
true);
break;
case SDL_MOUSEMOTION:
case SDL_EVENT_MOUSE_MOTION :
if (cls.key_dest == key_game && (int) cl_paused->value == 0)
{
mouse_x += event.motion.xrel;
@ -574,7 +576,7 @@ IN_Update(void)
}
break;
case SDL_TEXTINPUT:
case SDL_EVENT_TEXT_INPUT :
{
int c = event.text.text[0];
// also make sure we don't get the char that corresponds to the
@ -587,10 +589,10 @@ IN_Update(void)
break;
case SDL_KEYDOWN:
case SDL_KEYUP:
case SDL_EVENT_KEY_DOWN :
case SDL_EVENT_KEY_UP :
{
qboolean down = (event.type == SDL_KEYDOWN);
qboolean down = (event.type == SDL_EVENT_KEY_DOWN);
/* workaround for AZERTY-keyboards, which don't have 1, 2, ..., 9, 0 in first row:
* always map those physical keys (scancodes) to those keycodes anyway
@ -620,7 +622,7 @@ IN_Update(void)
// (beneath Esc, left of 1, above Tab)
// but not if the keycode for this is a quote (like on Brazilian
// keyboards) - otherwise you couldn't type them in the console
if((event.key.keysym.mod & (KMOD_CAPS|KMOD_SHIFT|KMOD_ALT|KMOD_CTRL|KMOD_GUI)) == 0)
if((event.key.keysym.mod & (SDL_KMOD_CAPS|SDL_KMOD_SHIFT|SDL_KMOD_ALT|SDL_KMOD_CTRL|SDL_KMOD_GUI)) == 0)
{
// also, only do this if no modifiers like shift or AltGr or whatever are pressed
// so kc will most likely be the ascii char generated by this and can be ignored
@ -657,12 +659,12 @@ IN_Update(void)
}
case SDL_WINDOWEVENT:
if (event.window.event == SDL_WINDOWEVENT_FOCUS_LOST ||
event.window.event == SDL_WINDOWEVENT_FOCUS_GAINED)
if (event.window.event == SDL_EVENT_WINDOW_FOCUS_LOST ||
event.window.event == SDL_EVENT_WINDOW_FOCUS_GAINED)
{
Key_MarkAllUp();
if (event.window.event == SDL_WINDOWEVENT_FOCUS_LOST)
if (event.window.event == SDL_EVENT_WINDOW_FOCUS_LOST)
{
S_Activate(false);
@ -679,7 +681,7 @@ IN_Update(void)
}
}
if (event.window.event == SDL_WINDOWEVENT_FOCUS_GAINED)
if (event.window.event == SDL_EVENT_WINDOW_FOCUS_GAINED)
{
S_Activate(true);
@ -697,13 +699,13 @@ IN_Update(void)
}
}
}
else if (event.window.event == SDL_WINDOWEVENT_MOVED)
else if (event.window.event == SDL_EVENT_WINDOW_MOVED)
{
// make sure GLimp_GetRefreshRate() will query from SDL again - the window might
// be on another display now!
glimp_refreshRate = -1.0;
}
else if (event.window.event == SDL_WINDOWEVENT_SHOWN)
else if (event.window.event == SDL_EVENT_WINDOW_SHOWN)
{
if (cl_unpaused_scvis->value > 0)
{
@ -720,11 +722,11 @@ IN_Update(void)
}
break;
case SDL_CONTROLLERBUTTONUP:
case SDL_CONTROLLERBUTTONDOWN:
case SDL_EVENT_GAMEPAD_BUTTON_UP :
case SDL_EVENT_GAMEPAD_BUTTON_DOWN :
{
qboolean down = (event.type == SDL_CONTROLLERBUTTONDOWN);
unsigned char btn = event.cbutton.button;
qboolean down = (event.type == SDL_EVENT_GAMEPAD_BUTTON_DOWN);
unsigned char btn = event.gbutton.button;
// Handle Back Button first, to override its original key
if (btn == sdl_back_button)
@ -737,13 +739,13 @@ IN_Update(void)
break;
}
case SDL_CONTROLLERAXISMOTION: /* Handle Controller Motion */
case SDL_EVENT_GAMEPAD_AXIS_MOTION : /* Handle Controller Motion */
{
int axis_value = event.caxis.value;
int axis_value = event.gaxis.value;
switch (event.caxis.axis)
switch (event.gaxis.axis)
{
case SDL_CONTROLLER_AXIS_TRIGGERLEFT:
case SDL_GAMEPAD_AXIS_LEFT_TRIGGER :
{
qboolean new_left_trigger = axis_value > 8192;
if (new_left_trigger != left_trigger)
@ -754,7 +756,7 @@ IN_Update(void)
break;
}
case SDL_CONTROLLER_AXIS_TRIGGERRIGHT:
case SDL_GAMEPAD_AXIS_RIGHT_TRIGGER :
{
qboolean new_right_trigger = axis_value > 8192;
if (new_right_trigger != right_trigger)
@ -768,18 +770,18 @@ IN_Update(void)
if (!cl_paused->value && cls.key_dest == key_game)
{
switch (event.caxis.axis)
switch (event.gaxis.axis)
{
case SDL_CONTROLLER_AXIS_LEFTX:
case SDL_GAMEPAD_AXIS_LEFTX :
joystick_left_x = axis_value;
break;
case SDL_CONTROLLER_AXIS_LEFTY:
case SDL_GAMEPAD_AXIS_LEFTY :
joystick_left_y = axis_value;
break;
case SDL_CONTROLLER_AXIS_RIGHTX:
case SDL_GAMEPAD_AXIS_RIGHTX :
joystick_right_x = axis_value;
break;
case SDL_CONTROLLER_AXIS_RIGHTY:
case SDL_GAMEPAD_AXIS_RIGHTY :
joystick_right_y = axis_value;
break;
}
@ -788,31 +790,31 @@ IN_Update(void)
}
#ifdef NATIVE_SDL_GYRO // controller sensors' reading supported (gyro, accelerometer)
case SDL_CONTROLLERSENSORUPDATE:
if (event.csensor.sensor != SDL_SENSOR_GYRO)
case SDL_EVENT_GAMEPAD_SENSOR_UPDATE :
if (event.gsensor.sensor != SDL_SENSOR_GYRO)
{
break;
}
if (countdown_reason == REASON_GYROCALIBRATION && updates_countdown)
{
gyro_accum[0] += event.csensor.data[0];
gyro_accum[1] += event.csensor.data[1];
gyro_accum[2] += event.csensor.data[2];
gyro_accum[0] += event.gsensor.data[0];
gyro_accum[1] += event.gsensor.data[1];
gyro_accum[2] += event.gsensor.data[2];
num_samples++;
break;
}
#else // gyro read as "secondary joystick"
case SDL_JOYAXISMOTION:
if ( !imu_joystick || event.cdevice.which != SDL_JoystickInstanceID(imu_joystick) )
case SDL_EVENT_JOYSTICK_AXIS_MOTION :
if ( !imu_joystick || event.gdevice.which != SDL_GetJoystickInstanceID(imu_joystick) )
{
break; // controller axes handled by SDL_CONTROLLERAXISMOTION
}
int axis_value = event.caxis.value;
int axis_value = event.gaxis.value;
if (countdown_reason == REASON_GYROCALIBRATION && updates_countdown)
{
switch (event.caxis.axis)
switch (event.gaxis.axis)
{
case IMU_JOY_AXIS_GYRO_PITCH:
gyro_accum[0] += axis_value;
@ -837,15 +839,15 @@ IN_Update(void)
#ifdef NATIVE_SDL_GYRO
if (!gyro_turning_axis->value)
{
gyro_yaw = event.csensor.data[1] - gyro_calibration_y->value; // yaw
gyro_yaw = event.gsensor.data[1] - gyro_calibration_y->value; // yaw
}
else
{
gyro_yaw = -(event.csensor.data[2] - gyro_calibration_z->value); // roll
gyro_yaw = -(event.gsensor.data[2] - gyro_calibration_z->value); // roll
}
gyro_pitch = event.csensor.data[0] - gyro_calibration_x->value;
gyro_pitch = event.gsensor.data[0] - gyro_calibration_x->value;
#else // old "joystick" gyro
switch (event.caxis.axis) // inside "case SDL_JOYAXISMOTION" here
switch (event.gaxis.axis) // inside "case SDL_JOYAXISMOTION" here
{
case IMU_JOY_AXIS_GYRO_PITCH:
gyro_pitch = -(axis_value - gyro_calibration_x->value);
@ -870,19 +872,19 @@ IN_Update(void)
}
break;
case SDL_CONTROLLERDEVICEREMOVED:
case SDL_EVENT_GAMEPAD_REMOVED :
if (!controller)
{
break;
}
if (event.cdevice.which == SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(controller))) {
if (event.gdevice.which == SDL_GetJoystickInstanceID(SDL_GetGamepadJoystick(controller))) {
Cvar_SetValue("paused", 1);
IN_Controller_Shutdown(true);
IN_Controller_Init(false);
}
break;
case SDL_JOYDEVICEADDED:
case SDL_EVENT_JOYSTICK_ADDED :
if (!controller)
{
// This should be lower, but some controllers just don't want to get detected by the OS
@ -892,8 +894,8 @@ IN_Update(void)
break;
#if SDL_VERSION_ATLEAST(2, 24, 0) // support for battery status changes
case SDL_JOYBATTERYUPDATED:
if (!controller || event.jbattery.which != SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(controller)))
case SDL_EVENT_JOYSTICK_BATTERY_UPDATED :
if (!controller || event.jbattery.which != SDL_GetJoystickInstanceID(SDL_GetGamepadJoystick(controller)))
{
break;
}
@ -908,7 +910,7 @@ IN_Update(void)
break;
#endif // SDL_VERSION_ATLEAST(2, 24, 0)
case SDL_QUIT:
case SDL_EVENT_QUIT :
Com_Quit();
break;
}
@ -1468,7 +1470,7 @@ IN_GyroActionUp(void)
void
In_FlushQueue(void)
{
SDL_FlushEvents(SDL_FIRSTEVENT, SDL_LASTEVENT);
SDL_FlushEvents(SDL_EVENT_FIRST, SDL_EVENT_LAST);
Key_MarkAllUp();
IN_JoyAltSelectorUp();
}
@ -1511,22 +1513,25 @@ IN_Haptic_Effect_Init(int effect_x, int effect_y, int effect_z,
haptic_effect.periodic.attack_length = attack;
haptic_effect.periodic.fade_length = fade;
return SDL_HapticNewEffect(joystick_haptic, &haptic_effect);
return SDL_CreateHapticEffect(joystick_haptic, &haptic_effect);
}
static void
IN_Haptic_Effects_Info(void)
{
Com_Printf ("Joystick/Mouse haptic:\n");
Com_Printf (" * %d effects\n", SDL_HapticNumEffects(joystick_haptic));
Com_Printf (" * %d haptic effects at the same time\n", SDL_HapticNumEffectsPlaying(joystick_haptic));
Com_Printf (" * %d haptic axis\n", SDL_HapticNumAxes(joystick_haptic));
Com_Printf (" * %d effects\n",
SDL_GetMaxHapticEffects(joystick_haptic));
Com_Printf (" * %d haptic effects at the same time\n",
SDL_GetMaxHapticEffectsPlaying(joystick_haptic));
Com_Printf (" * %d haptic axis\n",
SDL_GetNumHapticAxes(joystick_haptic));
}
static void
IN_Haptic_Effects_Init(void)
{
last_haptic_effect_size = SDL_HapticNumEffectsPlaying(joystick_haptic);
last_haptic_effect_size = SDL_GetMaxHapticEffectsPlaying(joystick_haptic);
if (last_haptic_effect_size > HAPTIC_EFFECT_LIST_SIZE)
{
@ -1553,7 +1558,7 @@ IN_Haptic_Effect_Shutdown(int * effect_id)
if (*effect_id >= 0)
{
SDL_HapticDestroyEffect(joystick_haptic, *effect_id);
SDL_DestroyHapticEffect(joystick_haptic, *effect_id);
}
*effect_id = -1;
@ -1828,7 +1833,7 @@ Haptic_Feedback(const char *name, int effect_volume, int effect_duration,
return;
}
SDL_HapticRunEffect(joystick_haptic, effect_id, 1);
SDL_RunHapticEffect(joystick_haptic, effect_id, 1);
}
}
@ -1981,7 +1986,7 @@ Controller_Rumble(const char *name, vec3_t source, qboolean from_player,
// name, effect_volume, duration, dist_prop, low_freq, hi_freq);
#if SDL_VERSION_ATLEAST(2, 0, 9)
if (SDL_GameControllerRumble(controller, low_freq, hi_freq, duration) == -1)
if (SDL_RumbleGamepad(controller, low_freq, hi_freq, duration) == -1)
{
if (!joystick_haptic)
{
@ -2037,13 +2042,13 @@ IN_Controller_Init(qboolean notify_user)
switch ((int)cvar->value)
{
case 1:
sdl_back_button = SDL_CONTROLLER_BUTTON_START;
sdl_back_button = SDL_GAMEPAD_BUTTON_START;
break;
case 2:
sdl_back_button = SDL_CONTROLLER_BUTTON_GUIDE;
sdl_back_button = SDL_GAMEPAD_BUTTON_GUIDE;
break;
default:
sdl_back_button = SDL_CONTROLLER_BUTTON_BACK;
sdl_back_button = SDL_GAMEPAD_BUTTON_BACK;
}
}
@ -2058,7 +2063,7 @@ IN_Controller_Init(qboolean notify_user)
Com_Printf("- Game Controller init attempt -\n");
}
if (!SDL_WasInit(SDL_INIT_GAMECONTROLLER))
if (!SDL_WasInit(SDL_INIT_GAMEPAD))
{
#ifdef SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE // extended input reports on PS controllers (enables gyro thru bluetooth)
@ -2068,7 +2073,7 @@ IN_Controller_Init(qboolean notify_user)
SDL_SetHint( SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE, "1" );
#endif
if (SDL_Init(SDL_INIT_GAMECONTROLLER | SDL_INIT_HAPTIC) == -1)
if (SDL_Init(SDL_INIT_GAMEPAD | SDL_INIT_HAPTIC) == -1)
{
Com_Printf ("Couldn't init SDL Game Controller: %s.\n", SDL_GetError());
return;
@ -2079,13 +2084,13 @@ IN_Controller_Init(qboolean notify_user)
if (!SDL_NumJoysticks())
{
joystick_haptic = SDL_HapticOpenFromMouse();
joystick_haptic = SDL_OpenHapticFromMouse();
if (joystick_haptic &&
(SDL_HapticQuery(joystick_haptic) & SDL_HAPTIC_SINE) == 0)
(SDL_GetHapticFeatures(joystick_haptic) & SDL_HAPTIC_SINE) == 0)
{
/* Disable haptic for joysticks without SINE */
SDL_HapticClose(joystick_haptic);
SDL_CloseHaptic(joystick_haptic);
joystick_haptic = NULL;
}
@ -2101,21 +2106,21 @@ IN_Controller_Init(qboolean notify_user)
for (const char* rawPath = FS_GetNextRawPath(NULL); rawPath != NULL; rawPath = FS_GetNextRawPath(rawPath))
{
snprintf(controllerdb, MAX_OSPATH, "%s/gamecontrollerdb.txt", rawPath);
nummappings = SDL_GameControllerAddMappingsFromFile(controllerdb);
nummappings = SDL_AddGamepadMappingsFromFile(controllerdb);
if (nummappings > 0)
Com_Printf ("%d mappings loaded from gamecontrollerdb.txt\n", nummappings);
}
for (int i = 0; i < SDL_NumJoysticks(); i++)
{
joystick = SDL_JoystickOpen(i);
joystick = SDL_OpenJoystick(i);
if (!joystick)
{
Com_Printf ("Couldn't open joystick %d: %s.\n", i+1, SDL_GetError());
continue; // try next joystick
}
const char* joystick_name = SDL_JoystickName(joystick);
const char* joystick_name = SDL_GetJoystickName(joystick);
const int name_len = strlen(joystick_name);
Com_Printf ("Trying joystick %d, '%s'\n", i+1, joystick_name);
@ -2123,7 +2128,7 @@ IN_Controller_Init(qboolean notify_user)
// Ugly hack to detect IMU-only devices - works for Switch controllers at least
if (name_len > 4 && !strncmp(joystick_name + name_len - 4, " IMU", 4))
{
SDL_JoystickClose(joystick);
SDL_CloseJoystick(joystick);
joystick = NULL;
#ifdef NATIVE_SDL_GYRO
Com_Printf ("Skipping IMU device.\n");
@ -2131,7 +2136,7 @@ IN_Controller_Init(qboolean notify_user)
Com_Printf ("IMU device found.\n");
if ( !imu_joystick && name_len > 16 && strncmp(joystick_name + name_len - 16, "Left Joy-Con IMU", 16) != 0 )
{
imu_joystick = SDL_JoystickOpen(i);
imu_joystick = SDL_OpenJoystick(i);
if (imu_joystick)
{
show_gyro = true;
@ -2146,16 +2151,19 @@ IN_Controller_Init(qboolean notify_user)
continue;
}
Com_Printf ("Buttons = %d, Axes = %d, Hats = %d\n", SDL_JoystickNumButtons(joystick),
SDL_JoystickNumAxes(joystick), SDL_JoystickNumHats(joystick));
is_controller = SDL_IsGameController(i);
Com_Printf ("Buttons = %d, Axes = %d, Hats = %d\n",
SDL_GetNumJoystickButtons(joystick),
SDL_GetNumJoystickAxes(joystick),
SDL_GetNumJoystickHats(joystick));
is_controller = /* FIXME MIGRATION: check for valid instance */
SDL_IsGamepad(GetJoystickInstanceFromIndex(i));
if (!is_controller)
{
char joystick_guid[65] = {0};
SDL_JoystickGUID guid = SDL_JoystickGetDeviceGUID(i);
SDL_JoystickGetGUIDString(guid, joystick_guid, 64);
SDL_GetJoystickGUIDString(guid, joystick_guid, 64);
Com_Printf ("To use joystick as game controller, provide its config by either:\n"
" * Putting 'gamecontrollerdb.txt' file in your game directory.\n"
@ -2163,12 +2171,12 @@ IN_Controller_Init(qboolean notify_user)
Com_Printf ("SDL_GAMECONTROLLERCONFIG='%s,%s,leftx:a0,lefty:a1,rightx:a2,righty:a3,back:b1,...'\n", joystick_guid, joystick_name);
}
SDL_JoystickClose(joystick);
SDL_CloseJoystick(joystick);
joystick = NULL;
if (is_controller && !controller)
{
controller = SDL_GameControllerOpen(i);
controller = SDL_OpenGamepad(i);
if (!controller)
{
Com_Printf("SDL Controller error: %s.\n", SDL_GetError());
@ -2176,17 +2184,18 @@ IN_Controller_Init(qboolean notify_user)
}
show_gamepad = true;
Com_Printf("Enabled as Game Controller, settings:\n%s\n", SDL_GameControllerMapping(controller));
Com_Printf("Enabled as Game Controller, settings:\n%s\n",
SDL_GetGamepadMapping(controller));
#ifdef NATIVE_SDL_GYRO
if ( SDL_GameControllerHasSensor(controller, SDL_SENSOR_GYRO)
&& !SDL_GameControllerSetSensorEnabled(controller, SDL_SENSOR_GYRO, SDL_TRUE) )
if (SDL_GamepadHasSensor(controller, SDL_SENSOR_GYRO)
&& !SDL_SetGamepadSensorEnabled(controller, SDL_SENSOR_GYRO, SDL_TRUE) )
{
show_gyro = true;
#if SDL_VERSION_ATLEAST(2, 0, 16)
Com_Printf( "Gyro sensor enabled at %.2f Hz\n",
SDL_GameControllerGetSensorDataRate(controller, SDL_SENSOR_GYRO) );
SDL_GetGamepadSensorDataRate(controller, SDL_SENSOR_GYRO) );
#else
Com_Printf( "Gyro sensor enabled.\n" );
#endif // #if SDL_VERSION_ATLEAST(2, 0, 16)
@ -2198,18 +2207,18 @@ IN_Controller_Init(qboolean notify_user)
if ( SDL_GameControllerHasLED(controller) )
{
SDL_GameControllerSetLED(controller, 0, 80, 0); // green light
SDL_SetGamepadLED(controller, 0, 80, 0); // green light
}
#endif // NATIVE_SDL_GYRO
joystick_haptic = SDL_HapticOpenFromJoystick(SDL_GameControllerGetJoystick(controller));
joystick_haptic = SDL_OpenHapticFromJoystick(SDL_GetGamepadJoystick(controller));
if (joystick_haptic &&
(SDL_HapticQuery(joystick_haptic) & SDL_HAPTIC_SINE) == 0)
(SDL_GetHapticFeatures(joystick_haptic) & SDL_HAPTIC_SINE) == 0)
{
/* Disable haptic for joysticks without SINE */
SDL_HapticClose(joystick_haptic);
SDL_CloseHaptic(joystick_haptic);
joystick_haptic = NULL;
}
@ -2335,7 +2344,7 @@ IN_Haptic_Shutdown(void)
{
IN_Haptic_Effects_Shutdown();
SDL_HapticClose(joystick_haptic);
SDL_CloseHaptic(joystick_haptic);
joystick_haptic = NULL;
}
}
@ -2352,7 +2361,7 @@ IN_Controller_Shutdown(qboolean notify_user)
if (controller)
{
SDL_GameControllerClose(controller);
SDL_CloseGamepad(controller);
controller = NULL;
}
show_gamepad = show_gyro = show_haptic = false;
@ -2362,7 +2371,7 @@ IN_Controller_Shutdown(qboolean notify_user)
#ifndef NATIVE_SDL_GYRO
if (imu_joystick)
{
SDL_JoystickClose(imu_joystick);
SDL_CloseJoystick(imu_joystick);
imu_joystick = NULL;
}
#endif
@ -2387,7 +2396,7 @@ IN_Shutdown(void)
IN_Controller_Shutdown(false);
const Uint32 subsystems = SDL_INIT_GAMECONTROLLER | SDL_INIT_HAPTIC | SDL_INIT_EVENTS;
const Uint32 subsystems = SDL_INIT_GAMEPAD | SDL_INIT_HAPTIC | SDL_INIT_EVENTS;
if (SDL_WasInit(subsystems) == subsystems)
{
SDL_QuitSubSystem(subsystems);