From 1cda80cbe7bb494ba11c8497a1b3cb49ebbe327e Mon Sep 17 00:00:00 2001 From: Lirusaito Date: Wed, 18 Jun 2014 16:15:48 -0400 Subject: [PATCH] Introduce function isXboxLike, to support Xbox-like controllers, even if they don't identify as Xbox. Support for Ouya controller added. --- indra/newview/llviewerjoystick.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/indra/newview/llviewerjoystick.cpp b/indra/newview/llviewerjoystick.cpp index 83dcc74c2..3487ade1b 100644 --- a/indra/newview/llviewerjoystick.cpp +++ b/indra/newview/llviewerjoystick.cpp @@ -78,6 +78,12 @@ enum XBoxKeys XBOX_L_STICK_CLICK, XBOX_R_STICK_CLICK }; + +bool isXboxLike(const std::string& desc) +{ + return desc.find("Xbox") != std::string::npos + || desc.find("OUYA") != std::string::npos; +} // // These constants specify the maximum absolute value coming in from the device. @@ -276,7 +282,7 @@ void LLViewerJoystick::init(bool autoenable) gSavedSettings.setString("JoystickInitialized", "SpaceNavigator"); } } - else if (getDescription().find("Xbox") != std::string::npos) + else if (isXboxLike(getDescription())) { sType = XBOX; // It's an Xbox controller, we have defaults for it.