From f97d2a93c4167a4b6aec0ae69536395380d427e3 Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Thu, 17 Jan 2013 15:41:18 -0600 Subject: Add "full analog surface" support in DInput,OSX,SDL backends. (should not be needed for XInput) --- Source/Core/InputCommon/Src/ControllerInterface/SDL/SDL.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Source/Core/InputCommon/Src/ControllerInterface/SDL/SDL.cpp') diff --git a/Source/Core/InputCommon/Src/ControllerInterface/SDL/SDL.cpp b/Source/Core/InputCommon/Src/ControllerInterface/SDL/SDL.cpp index c7c6898ecd..5473f7bcb3 100644 --- a/Source/Core/InputCommon/Src/ControllerInterface/SDL/SDL.cpp +++ b/Source/Core/InputCommon/Src/ControllerInterface/SDL/SDL.cpp @@ -86,8 +86,8 @@ Joystick::Joystick(SDL_Joystick* const joystick, const int sdl_index, const unsi for (u8 i = 0; i != SDL_JoystickNumAxes(m_joystick); ++i) { // each axis gets a negative and a positive input instance associated with it - AddInput(new Axis(i, m_joystick, -32768)); - AddInput(new Axis(i, m_joystick, 32767)); + AddAnalogInputs(new Axis(i, m_joystick, -32768), + new Axis(i, m_joystick, 32767)); } #ifdef USE_SDL_HAPTIC -- cgit v1.2.3 From 708fed92c851ada9dbe191b20eafa14c378ca664 Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Tue, 5 Feb 2013 15:32:13 -0600 Subject: Clean up SDL includes a bit. Maybe fix an SDL2 problem. --- Source/Core/InputCommon/Src/ControllerInterface/SDL/SDL.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'Source/Core/InputCommon/Src/ControllerInterface/SDL/SDL.cpp') diff --git a/Source/Core/InputCommon/Src/ControllerInterface/SDL/SDL.cpp b/Source/Core/InputCommon/Src/ControllerInterface/SDL/SDL.cpp index 5473f7bcb3..b521032e9c 100644 --- a/Source/Core/InputCommon/Src/ControllerInterface/SDL/SDL.cpp +++ b/Source/Core/InputCommon/Src/ControllerInterface/SDL/SDL.cpp @@ -325,7 +325,13 @@ bool Joystick::UpdateOutput() std::string Joystick::GetName() const { - return StripSpaces(SDL_JoystickName(m_sdl_index)); + return StripSpaces( +#if SDL_VERSION_ATLEAST(2, 0, 0) + SDL_JoystickNameForIndex(m_sdl_index) +#else + SDL_JoystickName(m_sdl_index) +#endif + ); } std::string Joystick::GetSource() const -- cgit v1.2.3 From ef9d7fb789ec88b249c33a9119fb40069e68619e Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Tue, 5 Feb 2013 21:07:09 -0600 Subject: Fix compilation with SDL2. (based on a patch from matthewharveys) Fixes issue 5971. --- .../InputCommon/Src/ControllerInterface/SDL/SDL.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'Source/Core/InputCommon/Src/ControllerInterface/SDL/SDL.cpp') diff --git a/Source/Core/InputCommon/Src/ControllerInterface/SDL/SDL.cpp b/Source/Core/InputCommon/Src/ControllerInterface/SDL/SDL.cpp index b521032e9c..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& devices ) { @@ -32,7 +41,7 @@ void Init( std::vector& 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,13 +334,7 @@ bool Joystick::UpdateOutput() std::string Joystick::GetName() const { - return StripSpaces( -#if SDL_VERSION_ATLEAST(2, 0, 0) - SDL_JoystickNameForIndex(m_sdl_index) -#else - SDL_JoystickName(m_sdl_index) -#endif - ); + return StripSpaces(GetJoystickName(m_sdl_index)); } std::string Joystick::GetSource() const -- cgit v1.2.3