Merge pull request #1923 from Sonicadvance1/remove_sdl_assumption
Remove an assumption in SDL.
This commit is contained in:
commit
ca10ce36cc
|
@ -38,8 +38,19 @@ void Init( std::vector<Core::Device*>& devices )
|
|||
// multiple joysticks with the same name shall get unique ids starting at 0
|
||||
std::map<std::string, int> name_counts;
|
||||
|
||||
if (SDL_Init( SDL_INIT_FLAGS ) >= 0)
|
||||
#ifdef USE_SDL_HAPTIC
|
||||
if (SDL_Init(SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC) >= 0)
|
||||
{
|
||||
// Correctly initialized
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (SDL_Init(SDL_INIT_JOYSTICK) < 0)
|
||||
{
|
||||
// Failed to initialize
|
||||
return;
|
||||
}
|
||||
|
||||
// joysticks
|
||||
for (int i = 0; i < SDL_NumJoysticks(); ++i)
|
||||
{
|
||||
|
@ -54,7 +65,6 @@ void Init( std::vector<Core::Device*>& devices )
|
|||
delete js;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Joystick::Joystick(SDL_Joystick* const joystick, const int sdl_index, const unsigned int index)
|
||||
|
|
|
@ -17,9 +17,6 @@
|
|||
|
||||
#ifdef USE_SDL_HAPTIC
|
||||
#include <SDL_haptic.h>
|
||||
#define SDL_INIT_FLAGS SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC
|
||||
#else
|
||||
#define SDL_INIT_FLAGS SDL_INIT_JOYSTICK
|
||||
#endif
|
||||
|
||||
namespace ciface
|
||||
|
|
Loading…
Reference in New Issue