From 21eb43c16ece558320a7d6284a6cc3e76de5a3bd Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Mon, 8 Dec 2025 20:58:08 -0600 Subject: [PATCH] ControllerInterface: Turn off SDL's GameCube controller adapter handling when Dolphin is configured to use the adapter. --- .../ControllerInterface/SDL/SDL.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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");