diff options
| author | JMC47 <JMC4789@gmail.com> | 2026-02-20 02:44:52 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-02-20 02:44:52 -0500 |
| commit | 981b7df4203d2907278506f4115a3604d7422fbb (patch) | |
| tree | 456f8d7539bfdb0fa7e5f185ef04d52fcc97a176 /Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp | |
| parent | 3d16e0c5bec03a3015be4f78cded51e511dad6d9 (diff) | |
| parent | 61c36b0cc85c4e4ff85e9cb099c7fe16eb6db6ca (diff) | |
Merge pull request #14335 from TixoRebel/joycon-config
Core: Add SDL Hints settings
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp')
| -rw-r--r-- | Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp b/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp index b5057f09d7..f6912f67ce 100644 --- a/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp +++ b/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp @@ -135,19 +135,31 @@ InputBackend::InputBackend(ControllerInterface* controller_interface) { EnableSDLLogging(); - SDL_SetHint(SDL_HINT_JOYSTICK_ENHANCED_REPORTS, "1"); + if (Config::Get(Config::MAIN_SDL_HINT_JOYSTICK_ENHANCED_REPORTS) == "") + Config::SetBase(Config::MAIN_SDL_HINT_JOYSTICK_ENHANCED_REPORTS, "1"); // We have our own WGI backend. Enabling SDL's WGI handling creates even more redundant devices. - SDL_SetHint(SDL_HINT_JOYSTICK_WGI, "0"); + if (Config::Get(Config::MAIN_SDL_HINT_JOYSTICK_WGI) == "") + Config::SetBase(Config::MAIN_SDL_HINT_JOYSTICK_WGI, "0"); // Disable DualSense Player LEDs; We already colorize the Primary LED - SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS5_PLAYER_LED, "0"); + if (Config::Get(Config::MAIN_SDL_HINT_JOYSTICK_HIDAPI_PS5_PLAYER_LED) == "") + Config::SetBase(Config::MAIN_SDL_HINT_JOYSTICK_HIDAPI_PS5_PLAYER_LED, "0"); // Disabling DirectInput support apparently solves hangs on shutdown for users with - // "8BitDo Ultimate 2" controllers. + // "8BitDo Ultimate 2" controllers, however, it also breaks hotplug support for Dual Sense + // and DS4 Controllers, so we leave it enabled for now. // It also works around a possibly related random hang on a IDirectInputDevice8_Acquire // call within SDL. - SDL_SetHint(SDL_HINT_JOYSTICK_DIRECTINPUT, "0"); + if (Config::Get(Config::MAIN_SDL_HINT_JOYSTICK_DIRECTINPUT) == "") + Config::SetBase(Config::MAIN_SDL_HINT_JOYSTICK_DIRECTINPUT, "1"); + + // Pre-populate the default Joy-Con hints so they can be easily changed + if (Config::Get(Config::MAIN_SDL_HINT_JOYSTICK_HIDAPI_COMBINE_JOY_CONS) == "") + Config::SetBase(Config::MAIN_SDL_HINT_JOYSTICK_HIDAPI_COMBINE_JOY_CONS, "1"); + + if (Config::Get(Config::MAIN_SDL_HINT_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS) == "") + Config::SetBase(Config::MAIN_SDL_HINT_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS, "0"); // Disable SDL's GC Adapter handling when we want to handle it ourselves. bool is_gc_adapter_configured = false; @@ -164,6 +176,18 @@ InputBackend::InputBackend(ControllerInterface* controller_interface) // and ControllerInterface isn't prepared for SDL to spontaneously re-initialize itself. SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_GAMECUBE, is_gc_adapter_configured ? "0" : "1"); + // Load all the hints from the config file + std::shared_ptr<Config::Layer> layer = Config::GetLayer(Config::LayerType::Base); + const Config::Section& section = layer->GetSection(Config::System::Main, "SDL_Hints"); + for (auto& row_data : section) + { + const Config::Location& location = row_data.first; + const std::optional<std::string>& value = row_data.second; + + if (value) + SDL_SetHint(location.key.c_str(), value->c_str()); + } + m_hotplug_thread = std::thread([this] { Common::SetCurrentThreadName("SDL Hotplug Thread"); |
