diff options
Diffstat (limited to 'src/input_common/drivers/sdl_driver.cpp')
| -rw-r--r-- | src/input_common/drivers/sdl_driver.cpp | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/input_common/drivers/sdl_driver.cpp b/src/input_common/drivers/sdl_driver.cpp index d975eb815..5c20b3426 100644 --- a/src/input_common/drivers/sdl_driver.cpp +++ b/src/input_common/drivers/sdl_driver.cpp | |||
| @@ -343,6 +343,14 @@ void SDLDriver::InitJoystick(int joystick_index) { | |||
| 343 | } | 343 | } |
| 344 | } | 344 | } |
| 345 | 345 | ||
| 346 | if (Settings::values.enable_procon_driver) { | ||
| 347 | if (guid.uuid[5] == 0x05 && guid.uuid[4] == 0x7e && guid.uuid[8] == 0x09) { | ||
| 348 | LOG_WARNING(Input, "Preferring joycon driver for device index {}", joystick_index); | ||
| 349 | SDL_JoystickClose(sdl_joystick); | ||
| 350 | return; | ||
| 351 | } | ||
| 352 | } | ||
| 353 | |||
| 346 | std::scoped_lock lock{joystick_map_mutex}; | 354 | std::scoped_lock lock{joystick_map_mutex}; |
| 347 | if (joystick_map.find(guid) == joystick_map.end()) { | 355 | if (joystick_map.find(guid) == joystick_map.end()) { |
| 348 | auto joystick = std::make_shared<SDLJoystick>(guid, 0, sdl_joystick, sdl_gamecontroller); | 356 | auto joystick = std::make_shared<SDLJoystick>(guid, 0, sdl_joystick, sdl_gamecontroller); |
| @@ -465,13 +473,19 @@ SDLDriver::SDLDriver(std::string input_engine_) : InputEngine(std::move(input_en | |||
| 465 | SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE, "1"); | 473 | SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE, "1"); |
| 466 | SDL_SetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, "1"); | 474 | SDL_SetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, "1"); |
| 467 | 475 | ||
| 468 | // Disable hidapi drivers for switch controllers when the custom joycon driver is enabled | 476 | // Disable hidapi drivers for joycon controllers when the custom joycon driver is enabled |
| 469 | if (Settings::values.enable_joycon_driver) { | 477 | if (Settings::values.enable_joycon_driver) { |
| 470 | SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS, "0"); | 478 | SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS, "0"); |
| 471 | } else { | 479 | } else { |
| 472 | SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS, "1"); | 480 | SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS, "1"); |
| 473 | } | 481 | } |
| 474 | SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_SWITCH, "1"); | 482 | |
| 483 | // Disable hidapi drivers for pro controllers when the custom joycon driver is enabled | ||
| 484 | if (Settings::values.enable_procon_driver) { | ||
| 485 | SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_SWITCH, "0"); | ||
| 486 | } else { | ||
| 487 | SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_SWITCH, "1"); | ||
| 488 | } | ||
| 475 | 489 | ||
| 476 | // Disable hidapi driver for xbox. Already default on Windows, this causes conflict with native | 490 | // Disable hidapi driver for xbox. Already default on Windows, this causes conflict with native |
| 477 | // driver on Linux. | 491 | // driver on Linux. |
| @@ -602,7 +616,7 @@ bool SDLDriver::IsVibrationEnabled(const PadIdentifier& identifier) { | |||
| 602 | const auto joystick = | 616 | const auto joystick = |
| 603 | GetSDLJoystickByGUID(identifier.guid.RawString(), static_cast<int>(identifier.port)); | 617 | GetSDLJoystickByGUID(identifier.guid.RawString(), static_cast<int>(identifier.port)); |
| 604 | 618 | ||
| 605 | constexpr Common::Input::VibrationStatus test_vibration{ | 619 | static constexpr Common::Input::VibrationStatus test_vibration{ |
| 606 | .low_amplitude = 1, | 620 | .low_amplitude = 1, |
| 607 | .low_frequency = 160.0f, | 621 | .low_frequency = 160.0f, |
| 608 | .high_amplitude = 1, | 622 | .high_amplitude = 1, |
| @@ -610,7 +624,7 @@ bool SDLDriver::IsVibrationEnabled(const PadIdentifier& identifier) { | |||
| 610 | .type = Common::Input::VibrationAmplificationType::Exponential, | 624 | .type = Common::Input::VibrationAmplificationType::Exponential, |
| 611 | }; | 625 | }; |
| 612 | 626 | ||
| 613 | constexpr Common::Input::VibrationStatus zero_vibration{ | 627 | static constexpr Common::Input::VibrationStatus zero_vibration{ |
| 614 | .low_amplitude = 0, | 628 | .low_amplitude = 0, |
| 615 | .low_frequency = 160.0f, | 629 | .low_frequency = 160.0f, |
| 616 | .high_amplitude = 0, | 630 | .high_amplitude = 0, |