diff options
| author | Jordan Woyak <jordan.woyak@gmail.com> | 2013-02-05 21:07:09 -0600 |
|---|---|---|
| committer | Ryan Houdek <Sonicadvance1@gmail.com> | 2013-02-12 14:00:51 -0600 |
| commit | 46f94203b735bbcc242cb324ac7a45c9b204b067 (patch) | |
| tree | 34bd5ddd947fb01417b370d79d11cf454d74eb4d /Source/Core/InputCommon/Src/ControllerInterface | |
| parent | e556f47db09d2eae194664c03ba28142ec702bd7 (diff) | |
Fix compilation with SDL2. (based on a patch from matthewharveys)
Fixes issue 5971.
Conflicts:
Source/Core/InputCommon/Src/ControllerInterface/SDL/SDL.cpp
Diffstat (limited to 'Source/Core/InputCommon/Src/ControllerInterface')
| -rw-r--r-- | Source/Core/InputCommon/Src/ControllerInterface/SDL/SDL.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/Source/Core/InputCommon/Src/ControllerInterface/SDL/SDL.cpp b/Source/Core/InputCommon/Src/ControllerInterface/SDL/SDL.cpp index 5473f7bcb3..c5ee3af23f 100644 --- a/Source/Core/InputCommon/Src/ControllerInterface/SDL/SDL.cpp +++ b/Source/Core/InputCommon/Src/ControllerInterface/SDL/SDL.cpp @@ -17,6 +17,15 @@ namespace ciface { namespace SDL { + +std::string GetJoystickName(int index) +{ +#if SDL_VERSION_ATLEAST(2, 0, 0) + return SDL_JoystickNameForIndex(index); +#else + return SDL_JoystickName(index); +#endif +} void Init( std::vector<ControllerInterface::Device*>& devices ) { @@ -32,7 +41,7 @@ void Init( std::vector<ControllerInterface::Device*>& devices ) SDL_Joystick* dev = SDL_JoystickOpen(i); if (dev) { - Joystick* js = new Joystick(dev, i, name_counts[SDL_JoystickName(i)]++); + Joystick* js = new Joystick(dev, i, name_counts[GetJoystickName(i)]++); // only add if it has some inputs/outputs if (js->Inputs().size() || js->Outputs().size()) devices.push_back( js ); @@ -325,7 +334,7 @@ bool Joystick::UpdateOutput() std::string Joystick::GetName() const { - return StripSpaces(SDL_JoystickName(m_sdl_index)); + return StripSpaces(GetJoystickName(m_sdl_index)); } std::string Joystick::GetSource() const |
