diff options
Diffstat (limited to '')
| -rw-r--r-- | src/input_common/drivers/joycon.cpp | 36 | ||||
| -rw-r--r-- | src/input_common/drivers/joycon.h | 1 | ||||
| -rw-r--r-- | src/input_common/drivers/sdl_driver.cpp | 6 | ||||
| -rw-r--r-- | src/input_common/helpers/joycon_driver.cpp | 4 |
4 files changed, 4 insertions, 43 deletions
diff --git a/src/input_common/drivers/joycon.cpp b/src/input_common/drivers/joycon.cpp index 6c03e0953..fff886ca8 100644 --- a/src/input_common/drivers/joycon.cpp +++ b/src/input_common/drivers/joycon.cpp | |||
| @@ -44,12 +44,6 @@ void Joycons::Reset() { | |||
| 44 | } | 44 | } |
| 45 | device->Stop(); | 45 | device->Stop(); |
| 46 | } | 46 | } |
| 47 | for (const auto& device : pro_joycons) { | ||
| 48 | if (!device) { | ||
| 49 | continue; | ||
| 50 | } | ||
| 51 | device->Stop(); | ||
| 52 | } | ||
| 53 | SDL_hid_exit(); | 47 | SDL_hid_exit(); |
| 54 | } | 48 | } |
| 55 | 49 | ||
| @@ -65,11 +59,6 @@ void Joycons::Setup() { | |||
| 65 | PreSetController(GetIdentifier(port, Joycon::ControllerType::Right)); | 59 | PreSetController(GetIdentifier(port, Joycon::ControllerType::Right)); |
| 66 | device = std::make_shared<Joycon::JoyconDriver>(port++); | 60 | device = std::make_shared<Joycon::JoyconDriver>(port++); |
| 67 | } | 61 | } |
| 68 | port = 0; | ||
| 69 | for (auto& device : pro_joycons) { | ||
| 70 | PreSetController(GetIdentifier(port, Joycon::ControllerType::Pro)); | ||
| 71 | device = std::make_shared<Joycon::JoyconDriver>(port++); | ||
| 72 | } | ||
| 73 | 62 | ||
| 74 | if (!scan_thread_running) { | 63 | if (!scan_thread_running) { |
| 75 | scan_thread = std::jthread([this](std::stop_token stop_token) { ScanThread(stop_token); }); | 64 | scan_thread = std::jthread([this](std::stop_token stop_token) { ScanThread(stop_token); }); |
| @@ -141,14 +130,6 @@ bool Joycons::IsDeviceNew(SDL_hid_device_info* device_info) const { | |||
| 141 | } | 130 | } |
| 142 | } | 131 | } |
| 143 | break; | 132 | break; |
| 144 | case Joycon::ControllerType::Pro: | ||
| 145 | case Joycon::ControllerType::Grip: | ||
| 146 | for (const auto& device : pro_joycons) { | ||
| 147 | if (is_handle_identical(device)) { | ||
| 148 | return false; | ||
| 149 | } | ||
| 150 | } | ||
| 151 | break; | ||
| 152 | default: | 133 | default: |
| 153 | return false; | 134 | return false; |
| 154 | } | 135 | } |
| @@ -219,13 +200,6 @@ std::shared_ptr<Joycon::JoyconDriver> Joycons::GetNextFreeHandle( | |||
| 219 | } | 200 | } |
| 220 | } | 201 | } |
| 221 | } | 202 | } |
| 222 | if (type == Joycon::ControllerType::Pro || type == Joycon::ControllerType::Grip) { | ||
| 223 | for (const auto& device : pro_joycons) { | ||
| 224 | if (!device->IsConnected()) { | ||
| 225 | return device; | ||
| 226 | } | ||
| 227 | } | ||
| 228 | } | ||
| 229 | return nullptr; | 203 | return nullptr; |
| 230 | } | 204 | } |
| 231 | 205 | ||
| @@ -431,13 +405,6 @@ std::shared_ptr<Joycon::JoyconDriver> Joycons::GetHandle(PadIdentifier identifie | |||
| 431 | } | 405 | } |
| 432 | } | 406 | } |
| 433 | } | 407 | } |
| 434 | if (type == Joycon::ControllerType::Pro || type == Joycon::ControllerType::Grip) { | ||
| 435 | for (const auto& device : pro_joycons) { | ||
| 436 | if (is_handle_active(device)) { | ||
| 437 | return device; | ||
| 438 | } | ||
| 439 | } | ||
| 440 | } | ||
| 441 | return nullptr; | 408 | return nullptr; |
| 442 | } | 409 | } |
| 443 | 410 | ||
| @@ -475,9 +442,6 @@ std::vector<Common::ParamPackage> Joycons::GetInputDevices() const { | |||
| 475 | for (const auto& controller : right_joycons) { | 442 | for (const auto& controller : right_joycons) { |
| 476 | add_entry(controller); | 443 | add_entry(controller); |
| 477 | } | 444 | } |
| 478 | for (const auto& controller : pro_joycons) { | ||
| 479 | add_entry(controller); | ||
| 480 | } | ||
| 481 | 445 | ||
| 482 | // List dual joycon pairs | 446 | // List dual joycon pairs |
| 483 | for (std::size_t i = 0; i < MaxSupportedControllers; i++) { | 447 | for (std::size_t i = 0; i < MaxSupportedControllers; i++) { |
diff --git a/src/input_common/drivers/joycon.h b/src/input_common/drivers/joycon.h index f180b7478..f5cc787db 100644 --- a/src/input_common/drivers/joycon.h +++ b/src/input_common/drivers/joycon.h | |||
| @@ -104,7 +104,6 @@ private: | |||
| 104 | // Joycon types are split by type to ease supporting dualjoycon configurations | 104 | // Joycon types are split by type to ease supporting dualjoycon configurations |
| 105 | std::array<std::shared_ptr<Joycon::JoyconDriver>, MaxSupportedControllers> left_joycons{}; | 105 | std::array<std::shared_ptr<Joycon::JoyconDriver>, MaxSupportedControllers> left_joycons{}; |
| 106 | std::array<std::shared_ptr<Joycon::JoyconDriver>, MaxSupportedControllers> right_joycons{}; | 106 | std::array<std::shared_ptr<Joycon::JoyconDriver>, MaxSupportedControllers> right_joycons{}; |
| 107 | std::array<std::shared_ptr<Joycon::JoyconDriver>, MaxSupportedControllers> pro_joycons{}; | ||
| 108 | }; | 107 | }; |
| 109 | 108 | ||
| 110 | } // namespace InputCommon | 109 | } // namespace InputCommon |
diff --git a/src/input_common/drivers/sdl_driver.cpp b/src/input_common/drivers/sdl_driver.cpp index 51a9d8962..e915ec090 100644 --- a/src/input_common/drivers/sdl_driver.cpp +++ b/src/input_common/drivers/sdl_driver.cpp | |||
| @@ -319,7 +319,8 @@ void SDLDriver::InitJoystick(int joystick_index) { | |||
| 319 | const auto guid = GetGUID(sdl_joystick); | 319 | const auto guid = GetGUID(sdl_joystick); |
| 320 | 320 | ||
| 321 | if (Settings::values.enable_joycon_driver) { | 321 | if (Settings::values.enable_joycon_driver) { |
| 322 | if (guid.uuid[5] == 0x05 && guid.uuid[4] == 0x7e) { | 322 | if (guid.uuid[5] == 0x05 && guid.uuid[4] == 0x7e && |
| 323 | (guid.uuid[8] == 0x06 || guid.uuid[8] == 0x07)) { | ||
| 323 | LOG_ERROR(Input, "Device black listed {}", joystick_index); | 324 | LOG_ERROR(Input, "Device black listed {}", joystick_index); |
| 324 | SDL_JoystickClose(sdl_joystick); | 325 | SDL_JoystickClose(sdl_joystick); |
| 325 | return; | 326 | return; |
| @@ -451,11 +452,10 @@ SDLDriver::SDLDriver(std::string input_engine_) : InputEngine(std::move(input_en | |||
| 451 | // Disable hidapi drivers for switch controllers when the custom joycon driver is enabled | 452 | // Disable hidapi drivers for switch controllers when the custom joycon driver is enabled |
| 452 | if (Settings::values.enable_joycon_driver) { | 453 | if (Settings::values.enable_joycon_driver) { |
| 453 | SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS, "0"); | 454 | SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS, "0"); |
| 454 | SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_SWITCH, "0"); | ||
| 455 | } else { | 455 | } else { |
| 456 | SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS, "1"); | 456 | SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS, "1"); |
| 457 | SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_SWITCH, "1"); | ||
| 458 | } | 457 | } |
| 458 | SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_SWITCH, "1"); | ||
| 459 | 459 | ||
| 460 | // Disable hidapi driver for xbox. Already default on Windows, this causes conflict with native | 460 | // Disable hidapi driver for xbox. Already default on Windows, this causes conflict with native |
| 461 | // driver on Linux. | 461 | // driver on Linux. |
diff --git a/src/input_common/helpers/joycon_driver.cpp b/src/input_common/helpers/joycon_driver.cpp index e8aef028a..552572343 100644 --- a/src/input_common/helpers/joycon_driver.cpp +++ b/src/input_common/helpers/joycon_driver.cpp | |||
| @@ -540,11 +540,9 @@ void JoyconDriver::SetCallbacks(const JoyconCallbacks& callbacks) { | |||
| 540 | 540 | ||
| 541 | DriverResult JoyconDriver::GetDeviceType(SDL_hid_device_info* device_info, | 541 | DriverResult JoyconDriver::GetDeviceType(SDL_hid_device_info* device_info, |
| 542 | ControllerType& controller_type) { | 542 | ControllerType& controller_type) { |
| 543 | static constexpr std::array<std::pair<u32, ControllerType>, 4> supported_devices{ | 543 | static constexpr std::array<std::pair<u32, ControllerType>, 2> supported_devices{ |
| 544 | std::pair<u32, ControllerType>{0x2006, ControllerType::Left}, | 544 | std::pair<u32, ControllerType>{0x2006, ControllerType::Left}, |
| 545 | {0x2007, ControllerType::Right}, | 545 | {0x2007, ControllerType::Right}, |
| 546 | {0x2009, ControllerType::Pro}, | ||
| 547 | {0x200E, ControllerType::Grip}, | ||
| 548 | }; | 546 | }; |
| 549 | constexpr u16 nintendo_vendor_id = 0x057e; | 547 | constexpr u16 nintendo_vendor_id = 0x057e; |
| 550 | 548 | ||