diff options
| author | Matthew Parlane <parlane@gmail.com> | 2013-02-09 20:13:11 +1300 |
|---|---|---|
| committer | Matthew Parlane <parlane@gmail.com> | 2013-02-09 20:13:11 +1300 |
| commit | 3d480c088fa27c6dcadef40042a0e8deb3093985 (patch) | |
| tree | ab6b184b074261f608dff9b06b5a6e2e6bf52b30 /Source/Core/InputCommon | |
| parent | e62c9b0619a42f6e551ba928560fcb825b6ac9c5 (diff) | |
| parent | a11827cdf0ccc55b9a3f6259a27a9324e24cd018 (diff) | |
Merge branch 'master' into wii-network
Conflicts:
Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp
Diffstat (limited to 'Source/Core/InputCommon')
3 files changed, 23 insertions, 13 deletions
diff --git a/Source/Core/InputCommon/Src/ControllerInterface/OSX/OSXJoystick.mm b/Source/Core/InputCommon/Src/ControllerInterface/OSX/OSXJoystick.mm index 60c0cc8c50..0d89c2e393 100644 --- a/Source/Core/InputCommon/Src/ControllerInterface/OSX/OSXJoystick.mm +++ b/Source/Core/InputCommon/Src/ControllerInterface/OSX/OSXJoystick.mm @@ -121,7 +121,9 @@ Joystick::Axis::Axis(IOHIDElementRef element, IOHIDDeviceRef device, direction d // Need to parse the element a bit first std::string description("unk"); - switch (IOHIDElementGetUsage(m_element)) { + int const usage = IOHIDElementGetUsage(m_element); + switch (usage) + { case kHIDUsage_GD_X: description = "X"; break; @@ -146,6 +148,13 @@ Joystick::Axis::Axis(IOHIDElementRef element, IOHIDDeviceRef device, direction d case kHIDUsage_Csmr_ACPan: description = "Pan"; break; + default: + { + std::ostringstream s; + s << usage; + description = s.str(); + break; + } } m_name = std::string("Axis ") + description; 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 diff --git a/Source/Core/InputCommon/Src/ControllerInterface/SDL/SDL.h b/Source/Core/InputCommon/Src/ControllerInterface/SDL/SDL.h index 139e9f232d..fa770c403d 100644 --- a/Source/Core/InputCommon/Src/ControllerInterface/SDL/SDL.h +++ b/Source/Core/InputCommon/Src/ControllerInterface/SDL/SDL.h @@ -5,22 +5,14 @@ #include <list> -#ifdef _WIN32 - #include <SDL.h> -#else - #include <SDL/SDL.h> -#endif +#include <SDL.h> #if SDL_VERSION_ATLEAST(1, 3, 0) #define USE_SDL_HAPTIC #endif #ifdef USE_SDL_HAPTIC - #ifdef _WIN32 - #include <SDL_haptic.h> - #else - #include <SDL/SDL_haptic.h> - #endif + #include <SDL_haptic.h> #define SDL_INIT_FLAGS SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC #else #define SDL_INIT_FLAGS SDL_INIT_JOYSTICK |
