mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-09-20 03:11:51 +02:00
InputCommon: Add setting to enable GCAdapter ControllerInterface backend.
This commit is contained in:
parent
1af21fbd65
commit
0f6b26e3fe
6 changed files with 25 additions and 3 deletions
|
@ -186,6 +186,8 @@ const Info<bool> MAIN_WIIMOTE_CONTINUOUS_SCANNING{
|
||||||
const Info<bool> MAIN_WIIMOTE_ENABLE_SPEAKER{{System::Main, "Core", "WiimoteEnableSpeaker"}, false};
|
const Info<bool> MAIN_WIIMOTE_ENABLE_SPEAKER{{System::Main, "Core", "WiimoteEnableSpeaker"}, false};
|
||||||
const Info<bool> MAIN_CONNECT_WIIMOTES_FOR_CONTROLLER_INTERFACE{
|
const Info<bool> MAIN_CONNECT_WIIMOTES_FOR_CONTROLLER_INTERFACE{
|
||||||
{System::Main, "Core", "WiimoteControllerInterface"}, false};
|
{System::Main, "Core", "WiimoteControllerInterface"}, false};
|
||||||
|
const Info<bool> MAIN_USE_GC_ADAPTER_FOR_CONTROLLER_INTERFACE{
|
||||||
|
{System::Main, "Core", "GCAdapterControllerInterface"}, false};
|
||||||
const Info<bool> MAIN_MMU{{System::Main, "Core", "MMU"}, false};
|
const Info<bool> MAIN_MMU{{System::Main, "Core", "MMU"}, false};
|
||||||
const Info<bool> MAIN_PAUSE_ON_PANIC{{System::Main, "Core", "PauseOnPanic"}, false};
|
const Info<bool> MAIN_PAUSE_ON_PANIC{{System::Main, "Core", "PauseOnPanic"}, false};
|
||||||
const Info<int> MAIN_BB_DUMP_PORT{{System::Main, "Core", "BBDumpPort"}, -1};
|
const Info<int> MAIN_BB_DUMP_PORT{{System::Main, "Core", "BBDumpPort"}, -1};
|
||||||
|
|
|
@ -106,6 +106,7 @@ extern const Info<bool> MAIN_WII_KEYBOARD;
|
||||||
extern const Info<bool> MAIN_WIIMOTE_CONTINUOUS_SCANNING;
|
extern const Info<bool> MAIN_WIIMOTE_CONTINUOUS_SCANNING;
|
||||||
extern const Info<bool> MAIN_WIIMOTE_ENABLE_SPEAKER;
|
extern const Info<bool> MAIN_WIIMOTE_ENABLE_SPEAKER;
|
||||||
extern const Info<bool> MAIN_CONNECT_WIIMOTES_FOR_CONTROLLER_INTERFACE;
|
extern const Info<bool> MAIN_CONNECT_WIIMOTES_FOR_CONTROLLER_INTERFACE;
|
||||||
|
extern const Info<bool> MAIN_USE_GC_ADAPTER_FOR_CONTROLLER_INTERFACE;
|
||||||
extern const Info<bool> MAIN_MMU;
|
extern const Info<bool> MAIN_MMU;
|
||||||
extern const Info<bool> MAIN_PAUSE_ON_PANIC;
|
extern const Info<bool> MAIN_PAUSE_ON_PANIC;
|
||||||
extern const Info<int> MAIN_BB_DUMP_PORT;
|
extern const Info<int> MAIN_BB_DUMP_PORT;
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include "DolphinQt/Config/GamecubeControllersWidget.h"
|
#include "DolphinQt/Config/GamecubeControllersWidget.h"
|
||||||
|
|
||||||
|
#include <QCheckBox>
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
#include <QGroupBox>
|
#include <QGroupBox>
|
||||||
|
@ -95,6 +96,10 @@ void GamecubeControllersWidget::CreateLayout()
|
||||||
m_gc_layout->addWidget(gc_box, controller_row, 1);
|
m_gc_layout->addWidget(gc_box, controller_row, 1);
|
||||||
m_gc_layout->addWidget(gc_button, controller_row, 2);
|
m_gc_layout->addWidget(gc_button, controller_row, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_gcpad_ciface = new QCheckBox(tr("Use Wii-U Adapter for Emulated Controllers"));
|
||||||
|
m_gc_layout->addWidget(m_gcpad_ciface, m_gc_layout->rowCount(), 0, 1, -1);
|
||||||
|
|
||||||
m_gc_box->setLayout(m_gc_layout);
|
m_gc_box->setLayout(m_gc_layout);
|
||||||
|
|
||||||
auto* layout = new QVBoxLayout;
|
auto* layout = new QVBoxLayout;
|
||||||
|
@ -114,6 +119,8 @@ void GamecubeControllersWidget::ConnectWidgets()
|
||||||
});
|
});
|
||||||
connect(m_gc_buttons[i], &QPushButton::clicked, this, [this, i] { OnGCPadConfigure(i); });
|
connect(m_gc_buttons[i], &QPushButton::clicked, this, [this, i] { OnGCPadConfigure(i); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
connect(m_gcpad_ciface, &QCheckBox::toggled, this, &GamecubeControllersWidget::SaveSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GamecubeControllersWidget::OnGCTypeChanged(size_t index)
|
void GamecubeControllersWidget::OnGCTypeChanged(size_t index)
|
||||||
|
@ -184,6 +191,9 @@ void GamecubeControllersWidget::LoadSettings(Core::State state)
|
||||||
OnGCTypeChanged(i);
|
OnGCTypeChanged(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SignalBlocking(m_gcpad_ciface)
|
||||||
|
->setChecked(Config::Get(Config::MAIN_USE_GC_ADAPTER_FOR_CONTROLLER_INTERFACE));
|
||||||
}
|
}
|
||||||
|
|
||||||
void GamecubeControllersWidget::SaveSettings()
|
void GamecubeControllersWidget::SaveSettings()
|
||||||
|
@ -203,11 +213,15 @@ void GamecubeControllersWidget::SaveSettings()
|
||||||
static_cast<s32>(i));
|
static_cast<s32>(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Config::SetBaseOrCurrent(Config::MAIN_USE_GC_ADAPTER_FOR_CONTROLLER_INTERFACE,
|
||||||
|
m_gcpad_ciface->isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SConfig::GetInstance().SaveSettings();
|
||||||
|
|
||||||
if (GCAdapter::UseAdapter())
|
if (GCAdapter::UseAdapter())
|
||||||
GCAdapter::StartScanThread();
|
GCAdapter::StartScanThread();
|
||||||
else
|
else
|
||||||
GCAdapter::StopScanThread();
|
GCAdapter::StopScanThread();
|
||||||
|
|
||||||
SConfig::GetInstance().SaveSettings();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
|
|
||||||
|
class QCheckBox;
|
||||||
class QComboBox;
|
class QComboBox;
|
||||||
class QHBoxLayout;
|
class QHBoxLayout;
|
||||||
class QGridLayout;
|
class QGridLayout;
|
||||||
|
@ -40,4 +41,5 @@ private:
|
||||||
std::array<QComboBox*, 4> m_gc_controller_boxes;
|
std::array<QComboBox*, 4> m_gc_controller_boxes;
|
||||||
std::array<QPushButton*, 4> m_gc_buttons;
|
std::array<QPushButton*, 4> m_gc_buttons;
|
||||||
std::array<QHBoxLayout*, 4> m_gc_groups;
|
std::array<QHBoxLayout*, 4> m_gc_groups;
|
||||||
|
QCheckBox* m_gcpad_ciface;
|
||||||
};
|
};
|
||||||
|
|
|
@ -87,6 +87,7 @@ void ControllerInterface::Initialize(const WindowSystemInfo& wsi)
|
||||||
m_input_backends.emplace_back(ciface::SteamDeck::CreateInputBackend(this));
|
m_input_backends.emplace_back(ciface::SteamDeck::CreateInputBackend(this));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// TODO: obey Config::Get(Config::MAIN_USE_GC_ADAPTER_FOR_CONTROLLER_INTERFACE)
|
||||||
m_input_backends.emplace_back(ciface::WiiUAdapter::CreateInputBackend(this));
|
m_input_backends.emplace_back(ciface::WiiUAdapter::CreateInputBackend(this));
|
||||||
|
|
||||||
// Don't allow backends to add devices before the first RefreshDevices() as they will be cleaned
|
// Don't allow backends to add devices before the first RefreshDevices() as they will be cleaned
|
||||||
|
|
|
@ -415,12 +415,14 @@ void SetAdapterCallback(std::function<void(void)> func)
|
||||||
|
|
||||||
static void RefreshConfig()
|
static void RefreshConfig()
|
||||||
{
|
{
|
||||||
s_is_adapter_wanted = false;
|
s_is_adapter_wanted = Config::Get(Config::MAIN_USE_GC_ADAPTER_FOR_CONTROLLER_INTERFACE);
|
||||||
|
|
||||||
for (int i = 0; i < SerialInterface::MAX_SI_CHANNELS; ++i)
|
for (int i = 0; i < SerialInterface::MAX_SI_CHANNELS; ++i)
|
||||||
{
|
{
|
||||||
s_is_adapter_wanted |= Config::Get(Config::GetInfoForSIDevice(i)) ==
|
s_is_adapter_wanted |= Config::Get(Config::GetInfoForSIDevice(i)) ==
|
||||||
SerialInterface::SIDevices::SIDEVICE_WIIU_ADAPTER;
|
SerialInterface::SIDevices::SIDEVICE_WIIU_ADAPTER;
|
||||||
|
|
||||||
|
// TODO: ControllerInterface shouldn't obey this setting.
|
||||||
s_config_rumble_enabled[i] = Config::Get(Config::GetInfoForAdapterRumble(i));
|
s_config_rumble_enabled[i] = Config::Get(Config::GetInfoForAdapterRumble(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue