mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-12-19 17:57:49 -05:00
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.
This commit is contained in:
@@ -18,6 +18,10 @@
|
|||||||
#include "Common/ScopeGuard.h"
|
#include "Common/ScopeGuard.h"
|
||||||
#include "Common/Thread.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/ControllerInterface.h"
|
||||||
#include "InputCommon/ControllerInterface/SDL/SDLGamepad.h"
|
#include "InputCommon/ControllerInterface/SDL/SDLGamepad.h"
|
||||||
|
|
||||||
@@ -145,6 +149,21 @@ InputBackend::InputBackend(ControllerInterface* controller_interface)
|
|||||||
// call within SDL.
|
// call within SDL.
|
||||||
SDL_SetHint(SDL_HINT_JOYSTICK_DIRECTINPUT, "0");
|
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] {
|
m_hotplug_thread = std::thread([this] {
|
||||||
Common::SetCurrentThreadName("SDL Hotplug Thread");
|
Common::SetCurrentThreadName("SDL Hotplug Thread");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user