diff options
author | Andrey Lihatskiy <alihatskiy@productengine.com> | 2024-10-08 18:31:52 +0300 |
---|---|---|
committer | Andrey Lihatskiy <alihatskiy@productengine.com> | 2024-10-08 18:31:52 +0300 |
commit | b16ede862f3e1414eee044c5a2b49017706af943 (patch) | |
tree | 5e223816b20f02185a487224d8dcc0dbf406142d /indra/newview/llfloaterjoystick.cpp | |
parent | a301fb2876835f799317f8a011f368eaec4894d6 (diff) | |
parent | a43b2106853b516248a2e657a28084b7d906cf5f (diff) |
Merge branch 'develop' into marchcat/xcode-16
# Conflicts:
# .github/workflows/build.yaml
# indra/llmath/raytrace.cpp
Diffstat (limited to 'indra/newview/llfloaterjoystick.cpp')
-rw-r--r-- | indra/newview/llfloaterjoystick.cpp | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/indra/newview/llfloaterjoystick.cpp b/indra/newview/llfloaterjoystick.cpp index 68b11ec92b..4736e30036 100644 --- a/indra/newview/llfloaterjoystick.cpp +++ b/indra/newview/llfloaterjoystick.cpp @@ -44,6 +44,7 @@ #include "llwindow.h" #include "llcheckboxctrl.h" #include "llcombobox.h" +#include "llgamecontrol.h" #if LL_WINDOWS && !LL_MESA_HEADLESS // Require DirectInput version 8 @@ -78,15 +79,22 @@ BOOL CALLBACK di8_list_devices_callback(LPCDIDEVICEINSTANCE device_instance_ptr, // Capable of detecting devices like Oculus Rift if (device_instance_ptr && pvRef) { + // We always include the device if it is from 3DConnexion, otherwise + // if the GameControl feature is enabled then we perfer to route other devices to it. std::string product_name = utf16str_to_utf8str(llutf16string(device_instance_ptr->tszProductName)); - S32 size = sizeof(GUID); - LLSD::Binary data; //just an std::vector - data.resize(size); - memcpy(&data[0], &device_instance_ptr->guidInstance /*POD _GUID*/, size); - - LLFloaterJoystick * floater = (LLFloaterJoystick*)pvRef; - LLSD value = data; - floater->addDevice(product_name, value); + bool include_device = LLViewerJoystick::is3DConnexionDevice(product_name) || !LLGameControl::isEnabled(); + + if (include_device) + { + S32 size = sizeof(GUID); + LLSD::Binary data; //just an std::vector + data.resize(size); + memcpy(&data[0], &device_instance_ptr->guidInstance /*POD _GUID*/, size); + + LLFloaterJoystick * floater = (LLFloaterJoystick*)pvRef; + LLSD value = data; + floater->addDevice(product_name, value); + } } return DIENUM_CONTINUE; } @@ -303,8 +311,13 @@ void LLFloaterJoystick::refreshListOfDevices() #if LL_WINDOWS && !LL_MESA_HEADLESS LL_WARNS() << "NDOF connected to device without using SL provided handle" << LL_ENDL; #endif - std::string desc = joystick->getDescription(); - if (!desc.empty()) + // We always include the device if it is from 3DConnexion, otherwise we only + // support the device in this context when GameControl feature is disabled. + std::string desc = LLViewerJoystick::getInstance()->getDescription(); + bool include_device = LLViewerJoystick::is3DConnexionDevice(desc) || + (!LLGameControl::isEnabled() && !desc.empty()); + + if (include_device) { LLSD value = LLSD::Integer(1); // value for selection addDevice(desc, value); |