Fixed an issue where the application couldn't be built with an older SDL release than 2.0.14

This commit is contained in:
Leon Styhre 2024-04-08 19:32:30 +02:00
parent f839ced47b
commit 9b7685dd5d
2 changed files with 13 additions and 2 deletions

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT
//
// ES-DE
// ES-DE Frontend
// InputManager.cpp
//
// Low-level input handling.
@ -792,9 +792,15 @@ void InputManager::addControllerByDeviceIndex(Window* window, int deviceIndex)
std::make_unique<InputConfig>(joyID, SDL_GameControllerName(mControllers[joyID]), guid);
bool customConfig {loadInputConfig(mInputConfigs[joyID].get())};
#if SDL_MAJOR_VERSION > 2 || (SDL_MAJOR_VERSION == 2 && SDL_MINOR_VERSION > 0) || \
(SDL_MAJOR_VERSION == 2 && SDL_MINOR_VERSION == 0 && SDL_PATCHLEVEL >= 14)
const std::string serialNumber {SDL_GameControllerGetSerial(controller) == nullptr ?
"" :
SDL_GameControllerGetSerial(controller)};
#else
const std::string serialNumber;
#endif
if (customConfig) {
LOG(LogInfo) << "Added controller with custom configuration: \""
@ -844,9 +850,14 @@ void InputManager::removeControllerByJoystickID(Window* window, SDL_JoystickID j
return;
}
#if SDL_MAJOR_VERSION > 2 || (SDL_MAJOR_VERSION == 2 && SDL_MINOR_VERSION > 0) || \
(SDL_MAJOR_VERSION == 2 && SDL_MINOR_VERSION == 0 && SDL_PATCHLEVEL >= 14)
const std::string serialNumber {SDL_GameControllerGetSerial(mControllers[joyID]) == nullptr ?
"" :
SDL_GameControllerGetSerial(mControllers[joyID])};
#else
const std::string serialNumber;
#endif
LOG(LogInfo) << "Removed controller \"" << SDL_GameControllerName(mControllers[joyID])
<< "\" (GUID: " << guid

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT
//
// ES-DE
// ES-DE Frontend
// InputManager.h
//
// Low-level input handling.