diff options
| author | Jordan Woyak <jordan.woyak@gmail.com> | 2025-12-08 20:58:08 -0600 |
|---|---|---|
| committer | Jordan Woyak <jordan.woyak@gmail.com> | 2025-12-09 16:51:41 -0600 |
| commit | 21eb43c16ece558320a7d6284a6cc3e76de5a3bd (patch) | |
| tree | 177dfba36a5dbd27d7c3a0748fb7d1023285845c | |
| parent | 213dc1c9afb4979dab357327387ab49ce17f174a (diff) | |
ControllerInterface: Turn off SDL's GameCube controller adapter handling when Dolphin is configured to use the adapter.
| -rw-r--r-- | Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp b/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp index 2778066084..b5057f09d7 100644 --- a/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp +++ b/Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp @@ -18,6 +18,10 @@ #include "Common/ScopeGuard.h" #include "Common/Thread.h" +#include "Core/Config/MainSettings.h" +#include "Core/HW/SI/SI.h" +#include "Core/HW/SI/SI_Device.h" + #include "InputCommon/ControllerInterface/ControllerInterface.h" #include "InputCommon/ControllerInterface/SDL/SDLGamepad.h" @@ -145,6 +149,21 @@ InputBackend::InputBackend(ControllerInterface* controller_interface) // call within SDL. SDL_SetHint(SDL_HINT_JOYSTICK_DIRECTINPUT, "0"); + // Disable SDL's GC Adapter handling when we want to handle it ourselves. + bool is_gc_adapter_configured = false; + for (int i = 0; i != SerialInterface::MAX_SI_CHANNELS; ++i) + { + if (Config::Get(Config::GetInfoForSIDevice(i)) == SerialInterface::SIDEVICE_WIIU_ADAPTER) + { + is_gc_adapter_configured = true; + break; + } + } + // TODO: This hint should be adjusted when the config changes, + // but SDL requires it be set before joystick initialization, + // 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"); + m_hotplug_thread = std::thread([this] { Common::SetCurrentThreadName("SDL Hotplug Thread"); |
