summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJMC47 <JMC4789@gmail.com>2025-12-17 05:18:37 -0500
committerGitHub <noreply@github.com>2025-12-17 05:18:37 -0500
commite60f39c3236c18d3f4f1f4febd08f4d2b103812c (patch)
tree936bb3eed8eb1166ee84c646c3a99bd7b6d7b2d3
parented2fe134aae954836ba2eeb9d2f8beeba64e9e9b (diff)
parent21eb43c16ece558320a7d6284a6cc3e76de5a3bd (diff)
Merge pull request #14202 from jordan-woyak/sdl-gcadapter-hint
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.cpp19
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");