Skip to content

Commit 21eb43c

Browse files
committed
ControllerInterface: Turn off SDL's GameCube controller adapter handling when Dolphin is configured to use the adapter.
1 parent 213dc1c commit 21eb43c

File tree

1 file changed

+19
-0
lines changed
  • Source/Core/InputCommon/ControllerInterface/SDL

1 file changed

+19
-0
lines changed

Source/Core/InputCommon/ControllerInterface/SDL/SDL.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
#include "Common/ScopeGuard.h"
1919
#include "Common/Thread.h"
2020

21+
#include "Core/Config/MainSettings.h"
22+
#include "Core/HW/SI/SI.h"
23+
#include "Core/HW/SI/SI_Device.h"
24+
2125
#include "InputCommon/ControllerInterface/ControllerInterface.h"
2226
#include "InputCommon/ControllerInterface/SDL/SDLGamepad.h"
2327

@@ -145,6 +149,21 @@ InputBackend::InputBackend(ControllerInterface* controller_interface)
145149
// call within SDL.
146150
SDL_SetHint(SDL_HINT_JOYSTICK_DIRECTINPUT, "0");
147151

152+
// Disable SDL's GC Adapter handling when we want to handle it ourselves.
153+
bool is_gc_adapter_configured = false;
154+
for (int i = 0; i != SerialInterface::MAX_SI_CHANNELS; ++i)
155+
{
156+
if (Config::Get(Config::GetInfoForSIDevice(i)) == SerialInterface::SIDEVICE_WIIU_ADAPTER)
157+
{
158+
is_gc_adapter_configured = true;
159+
break;
160+
}
161+
}
162+
// TODO: This hint should be adjusted when the config changes,
163+
// but SDL requires it be set before joystick initialization,
164+
// and ControllerInterface isn't prepared for SDL to spontaneously re-initialize itself.
165+
SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_GAMECUBE, is_gc_adapter_configured ? "0" : "1");
166+
148167
m_hotplug_thread = std::thread([this] {
149168
Common::SetCurrentThreadName("SDL Hotplug Thread");
150169

0 commit comments

Comments
 (0)