summaryrefslogtreecommitdiffstats
path: root/src/input_common/drivers/sdl_driver.cpp
diff options
context:
space:
mode:
authorNarr the Reg <juangerman-13@hotmail.com>2022-12-20 19:45:54 +0100
committerNarr the Reg <juangerman-13@hotmail.com>2023-01-20 01:05:20 +0100
commit2d802893e706c4ce7fd6f320db0eed2bf90b2d45 (patch)
tree32368e503159fc82cd7362ef37eec94b9a5b3bbe /src/input_common/drivers/sdl_driver.cpp
parentinput_common: Initial skeleton for custom joycon driver (diff)
downloadyuzu-2d802893e706c4ce7fd6f320db0eed2bf90b2d45.tar
yuzu-2d802893e706c4ce7fd6f320db0eed2bf90b2d45.tar.gz
yuzu-2d802893e706c4ce7fd6f320db0eed2bf90b2d45.tar.bz2
yuzu-2d802893e706c4ce7fd6f320db0eed2bf90b2d45.tar.lz
yuzu-2d802893e706c4ce7fd6f320db0eed2bf90b2d45.tar.xz
yuzu-2d802893e706c4ce7fd6f320db0eed2bf90b2d45.tar.zst
yuzu-2d802893e706c4ce7fd6f320db0eed2bf90b2d45.zip
Diffstat (limited to 'src/input_common/drivers/sdl_driver.cpp')
-rw-r--r--src/input_common/drivers/sdl_driver.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/input_common/drivers/sdl_driver.cpp b/src/input_common/drivers/sdl_driver.cpp
index 4818bb744..c9496a0d8 100644
--- a/src/input_common/drivers/sdl_driver.cpp
+++ b/src/input_common/drivers/sdl_driver.cpp
@@ -318,6 +318,14 @@ void SDLDriver::InitJoystick(int joystick_index) {
const auto guid = GetGUID(sdl_joystick);
+ if (Settings::values.enable_joycon_driver) {
+ if (guid.uuid[5] == 0x05 && guid.uuid[4] == 0x7e) {
+ LOG_ERROR(Input, "Device black listed {}", joystick_index);
+ SDL_JoystickClose(sdl_joystick);
+ return;
+ }
+ }
+
std::scoped_lock lock{joystick_map_mutex};
if (joystick_map.find(guid) == joystick_map.end()) {
auto joystick = std::make_shared<SDLJoystick>(guid, 0, sdl_joystick, sdl_gamecontroller);
@@ -440,9 +448,14 @@ SDLDriver::SDLDriver(std::string input_engine_) : InputEngine(std::move(input_en
SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE, "1");
SDL_SetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, "1");
- // Use hidapi driver for joycons. This will allow joycons to be detected as a GameController and
- // not a generic one
- SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS, "1");
+ // Disable hidapi drivers for switch controllers when the custom joycon driver is enabled
+ if (Settings::values.enable_joycon_driver) {
+ SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS, "0");
+ SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_SWITCH, "0");
+ } else {
+ SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS, "1");
+ SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_SWITCH, "1");
+ }
// Disable hidapi driver for xbox. Already default on Windows, this causes conflict with native
// driver on Linux.