From 34b5b40d4ef5ae5584dfdc1ef5cf4444a0e002b3 Mon Sep 17 00:00:00 2001 From: Benau Date: Tue, 11 Aug 2020 13:32:32 +0800 Subject: [PATCH] Don't exit if failed to init sensors wine supertuxkart.exe at the moment doesn't support sensors --- lib/irrlicht/source/Irrlicht/CIrrDeviceSDL.cpp | 13 +++++++++---- src/input/input_manager.cpp | 6 +++++- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/lib/irrlicht/source/Irrlicht/CIrrDeviceSDL.cpp b/lib/irrlicht/source/Irrlicht/CIrrDeviceSDL.cpp index bd75fec9b..45f1496d2 100644 --- a/lib/irrlicht/source/Irrlicht/CIrrDeviceSDL.cpp +++ b/lib/irrlicht/source/Irrlicht/CIrrDeviceSDL.cpp @@ -67,15 +67,20 @@ CIrrDeviceSDL::CIrrDeviceSDL(const SIrrlichtCreationParameters& param) SDL_SetHint(SDL_HINT_NO_SIGNAL_HANDLERS, "1"); SDL_SetHint(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, "0"); u32 init_flags = SDL_INIT_TIMER | SDL_INIT_VIDEO; -#if SDL_VERSION_ATLEAST(2, 0, 9) - init_flags |= SDL_INIT_SENSOR; -#endif if (SDL_Init(init_flags) < 0) { - os::Printer::log( "Unable to initialize SDL!", SDL_GetError()); + os::Printer::log("Unable to initialize SDL!", SDL_GetError()); Close = true; } +#if SDL_VERSION_ATLEAST(2, 0, 9) + // Don't exit if failed to init sensor (doesn't work in wine) + if (SDL_InitSubSystem(SDL_INIT_SENSOR) < 0) + { + os::Printer::log("Failed to init SDL sensor!", SDL_GetError()); + } +#endif + // create keymap createKeyMap(); diff --git a/src/input/input_manager.cpp b/src/input/input_manager.cpp index cb4a7e456..c15954753 100644 --- a/src/input/input_manager.cpp +++ b/src/input/input_manager.cpp @@ -90,7 +90,11 @@ InputManager::InputManager() : m_mode(BOOTSTRAP), m_master_player_only = false; m_timer = 0; #ifndef SERVER_ONLY - SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER); + if (SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER) != 0) + { + Log::error("InputManager", "Failed to init SDL game controller: %s", + SDL_GetError()); + } #endif }