Don't exit if failed to init sensors

wine supertuxkart.exe at the moment doesn't support sensors
This commit is contained in:
Benau 2020-08-11 13:32:32 +08:00
parent ceb72a0606
commit 34b5b40d4e
2 changed files with 14 additions and 5 deletions

View File

@ -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();

View File

@ -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
}