Qt: Fix using GC Adapter requiring restart

This commit is contained in:
spycrab 2018-05-28 03:11:27 +02:00
parent 18a31e12fd
commit d0e2c353a0
1 changed files with 11 additions and 2 deletions

View File

@ -2,6 +2,8 @@
// Licensed under GPLv2+ // Licensed under GPLv2+
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "DolphinQt2/Config/ControllersWindow.h"
#include <QApplication> #include <QApplication>
#include <QBoxLayout> #include <QBoxLayout>
#include <QCheckBox> #include <QCheckBox>
@ -29,13 +31,14 @@
#include "Core/IOS/IOS.h" #include "Core/IOS/IOS.h"
#include "Core/IOS/USB/Bluetooth/BTReal.h" #include "Core/IOS/USB/Bluetooth/BTReal.h"
#include "Core/NetPlayProto.h" #include "Core/NetPlayProto.h"
#include "DolphinQt2/Config/Mapping/GCPadWiiUConfigDialog.h" #include "DolphinQt2/Config/Mapping/GCPadWiiUConfigDialog.h"
#include "DolphinQt2/Config/Mapping/MappingWindow.h" #include "DolphinQt2/Config/Mapping/MappingWindow.h"
#include "DolphinQt2/QtUtils/WrapInScrollArea.h" #include "DolphinQt2/QtUtils/WrapInScrollArea.h"
#include "DolphinQt2/Settings.h" #include "DolphinQt2/Settings.h"
#include "UICommon/UICommon.h"
#include "DolphinQt2/Config/ControllersWindow.h" #include "InputCommon/GCAdapter.h"
#include "UICommon/UICommon.h"
static const std::map<SerialInterface::SIDevices, int> s_gc_types = { static const std::map<SerialInterface::SIDevices, int> s_gc_types = {
{SerialInterface::SIDEVICE_NONE, 0}, {SerialInterface::SIDEVICE_GC_CONTROLLER, 1}, {SerialInterface::SIDEVICE_NONE, 0}, {SerialInterface::SIDEVICE_GC_CONTROLLER, 1},
@ -523,5 +526,11 @@ void ControllersWindow::SaveSettings()
m_gc_buttons[i]->setEnabled(index != 0 && index != 6); m_gc_buttons[i]->setEnabled(index != 0 && index != 6);
} }
if (GCAdapter::UseAdapter())
GCAdapter::StartScanThread();
else
GCAdapter::StopScanThread();
SConfig::GetInstance().SaveSettings(); SConfig::GetInstance().SaveSettings();
} }