From 50c13c1902178750ca9c36832e7e8ff7fe391f64 Mon Sep 17 00:00:00 2001 From: spycrab Date: Tue, 13 Jun 2017 17:16:41 +0200 Subject: [PATCH] Qt: Implement advanced mapping I/O windows --- Source/Core/DolphinQt2/CMakeLists.txt | 2 + .../DolphinQt2/Config/Mapping/IOWindow.cpp | 261 ++++++++++++++++++ .../Core/DolphinQt2/Config/Mapping/IOWindow.h | 99 +++++++ .../Config/Mapping/MappingButton.cpp | 119 +++----- .../DolphinQt2/Config/Mapping/MappingButton.h | 4 + .../Config/Mapping/MappingCommon.cpp | 50 ++++ .../DolphinQt2/Config/Mapping/MappingCommon.h | 27 ++ .../Config/Mapping/MappingWidget.cpp | 20 ++ .../DolphinQt2/Config/Mapping/MappingWidget.h | 3 + .../Config/Mapping/MappingWindow.cpp | 5 + .../DolphinQt2/Config/Mapping/MappingWindow.h | 1 + Source/Core/DolphinQt2/DolphinQt2.vcxproj | 6 + 12 files changed, 523 insertions(+), 74 deletions(-) create mode 100644 Source/Core/DolphinQt2/Config/Mapping/IOWindow.cpp create mode 100644 Source/Core/DolphinQt2/Config/Mapping/IOWindow.h create mode 100644 Source/Core/DolphinQt2/Config/Mapping/MappingCommon.cpp create mode 100644 Source/Core/DolphinQt2/Config/Mapping/MappingCommon.h diff --git a/Source/Core/DolphinQt2/CMakeLists.txt b/Source/Core/DolphinQt2/CMakeLists.txt index e5ff552b6c..58cca8e821 100644 --- a/Source/Core/DolphinQt2/CMakeLists.txt +++ b/Source/Core/DolphinQt2/CMakeLists.txt @@ -31,8 +31,10 @@ set(SRCS Config/Mapping/HotkeyStates.cpp Config/Mapping/HotkeyTAS.cpp Config/Mapping/HotkeyWii.cpp + Config/Mapping/IOWindow.cpp Config/Mapping/MappingBool.cpp Config/Mapping/MappingButton.cpp + Config/Mapping/MappingCommon.cpp Config/Mapping/MappingNumeric.cpp Config/Mapping/MappingWidget.cpp Config/Mapping/MappingWindow.cpp diff --git a/Source/Core/DolphinQt2/Config/Mapping/IOWindow.cpp b/Source/Core/DolphinQt2/Config/Mapping/IOWindow.cpp new file mode 100644 index 0000000000..ac2b22eb1d --- /dev/null +++ b/Source/Core/DolphinQt2/Config/Mapping/IOWindow.cpp @@ -0,0 +1,261 @@ +// Copyright 2017 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#include "DolphinQt2/Config/Mapping/IOWindow.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "Core/Core.h" +#include "DolphinQt2/Config/Mapping/MappingCommon.h" +#include "DolphinQt2/Config/Mapping/MappingWidget.h" +#include "DolphinQt2/Config/Mapping/MappingWindow.h" +#include "InputCommon/ControlReference/ControlReference.h" +#include "InputCommon/ControllerEmu/ControllerEmu.h" +#include "InputCommon/ControllerInterface/ControllerInterface.h" + +constexpr int SLIDER_TICK_COUNT = 100; + +IOWindow::IOWindow(QWidget* parent, ControllerEmu::EmulatedController* controller, + ControlReference* ref, IOWindow::Type type) + : QDialog(parent), m_reference(ref), m_controller(controller), m_type(type) +{ + CreateMainLayout(); + ConnectWidgets(); + setWindowTitle(type == IOWindow::Type::Input ? tr("Configure Input") : tr("Configure Output")); + + Update(); +} + +void IOWindow::CreateMainLayout() +{ + m_main_layout = new QVBoxLayout(); + + m_devices_combo = new QComboBox(); + m_option_list = new QListWidget(); + m_select_button = new QPushButton(tr("Select")); + m_detect_button = new QPushButton(tr("Detect")); + m_or_button = new QPushButton(tr("| OR")); + m_and_button = new QPushButton(tr("&& AND")); + m_add_button = new QPushButton(tr("+ ADD")); + m_not_button = new QPushButton(tr("! NOT")); + m_test_button = new QPushButton(tr("Test")); + m_expression_text = new QPlainTextEdit(); + m_button_box = new QDialogButtonBox(); + m_clear_button = new QPushButton(tr("Clear")); + m_apply_button = new QPushButton(tr("Apply")); + m_range_slider = new QSlider(Qt::Horizontal); + m_range_spinbox = new QSpinBox(); + + // Devices + m_main_layout->addWidget(m_devices_combo); + + // Range + auto* range_hbox = new QHBoxLayout(); + range_hbox->addWidget(new QLabel(tr("Range"))); + range_hbox->addWidget(m_range_slider); + range_hbox->addWidget(m_range_spinbox); + m_range_slider->setMinimum(-500); + m_range_slider->setMaximum(500); + m_range_spinbox->setMinimum(-500); + m_range_spinbox->setMaximum(500); + m_main_layout->addItem(range_hbox); + + // Options (Buttons, Outputs) and action buttons + for (QPushButton* button : {m_select_button, m_detect_button, m_or_button, m_and_button, + m_add_button, m_not_button, m_test_button}) + { + button->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + } + + auto* hbox = new QHBoxLayout(); + auto* button_vbox = new QVBoxLayout(); + hbox->addWidget(m_option_list, 8); + hbox->addLayout(button_vbox, 1); + + button_vbox->addWidget(m_select_button); + button_vbox->addWidget(m_type == Type::Input ? m_detect_button : m_test_button); + button_vbox->addWidget(m_or_button); + + if (m_type == Type::Input) + { + button_vbox->addWidget(m_and_button); + button_vbox->addWidget(m_add_button); + button_vbox->addWidget(m_not_button); + } + + m_main_layout->addLayout(hbox, 2); + m_main_layout->addWidget(m_expression_text, 1); + + // Button Box + m_main_layout->addWidget(m_button_box); + m_button_box->addButton(m_clear_button, QDialogButtonBox::ActionRole); + m_button_box->addButton(m_apply_button, QDialogButtonBox::ActionRole); + m_button_box->addButton(QDialogButtonBox::Ok); + + setLayout(m_main_layout); +} + +void IOWindow::Update() +{ + m_expression_text->setPlainText(QString::fromStdString(m_reference->expression)); + m_range_spinbox->setValue(m_reference->range * SLIDER_TICK_COUNT); + m_range_slider->setValue(m_reference->range * SLIDER_TICK_COUNT); + + m_devq.FromString(m_controller->default_device.ToString()); + + UpdateDeviceList(); + UpdateOptionList(); +} + +void IOWindow::ConnectWidgets() +{ + connect(m_select_button, &QPushButton::clicked, [this] { AppendSelectedOption(""); }); + connect(m_add_button, &QPushButton::clicked, [this] { AppendSelectedOption(" + "); }); + connect(m_and_button, &QPushButton::clicked, [this] { AppendSelectedOption(" & "); }); + connect(m_or_button, &QPushButton::clicked, [this] { AppendSelectedOption(" | "); }); + connect(m_not_button, &QPushButton::clicked, [this] { AppendSelectedOption("!"); }); + + connect(m_type == IOWindow::Type::Input ? m_detect_button : m_test_button, &QPushButton::clicked, + this, &IOWindow::OnDetectButtonPressed); + + connect(m_button_box, &QDialogButtonBox::clicked, this, &IOWindow::OnDialogButtonPressed); + connect(m_devices_combo, &QComboBox::currentTextChanged, this, &IOWindow::OnDeviceChanged); + connect(m_range_spinbox, static_cast(&QSpinBox::valueChanged), + this, &IOWindow::OnRangeChanged); + connect(m_range_slider, static_cast(&QSlider::valueChanged), this, + &IOWindow::OnRangeChanged); +} + +void IOWindow::AppendSelectedOption(const std::string& prefix) +{ + if (m_option_list->currentItem() == nullptr) + return; + + m_expression_text->insertPlainText( + QString::fromStdString(prefix) + + MappingCommon::GetExpressionForControl(m_option_list->currentItem()->text(), m_devq, + m_controller->default_device)); +} + +void IOWindow::OnDeviceChanged(const QString& device) +{ + m_devq.FromString(device.toStdString()); + UpdateOptionList(); +} + +void IOWindow::OnDialogButtonPressed(QAbstractButton* button) +{ + if (button == m_clear_button) + { + m_expression_text->clear(); + return; + } + + m_reference->expression = m_expression_text->toPlainText().toStdString(); + + if (button != m_apply_button) + accept(); +} + +void IOWindow::OnDetectButtonPressed() +{ + if (m_block.IsSet()) + return; + + m_block.Set(true); + m_expression_text->setEnabled(false); + std::thread([this] { + auto* btn = m_type == IOWindow::Type::Input ? m_detect_button : m_test_button; + const auto old_label = btn->text(); + + btn->setText(QStringLiteral("...")); + + const auto expr = MappingCommon::DetectExpression( + m_reference, g_controller_interface.FindDevice(m_devq).get(), m_devq, m_devq); + + btn->setText(old_label); + + if (!expr.isEmpty()) + { + const auto list = m_option_list->findItems(expr, Qt::MatchFixedString); + + if (list.size() > 0) + m_option_list->setCurrentItem(list[0]); + } + m_expression_text->setEnabled(true); + m_block.Set(false); + }).detach(); +} + +void IOWindow::OnRangeChanged(int value) +{ + m_reference->range = static_cast(value) / SLIDER_TICK_COUNT; + m_range_spinbox->setValue(m_reference->range * SLIDER_TICK_COUNT); + m_range_slider->setValue(m_reference->range * SLIDER_TICK_COUNT); +} + +void IOWindow::UpdateOptionList() +{ + if (m_block.IsSet()) + return; + + m_option_list->clear(); + + const auto device = g_controller_interface.FindDevice(m_devq); + + if (m_reference->IsInput()) + { + for (const auto* input : device->Inputs()) + { + m_option_list->addItem(QString::fromStdString(input->GetName())); + } + } + else + { + for (const auto* output : device->Outputs()) + { + m_option_list->addItem(QString::fromStdString(output->GetName())); + } + } +} + +void IOWindow::UpdateDeviceList() +{ + m_block.Set(true); + m_devices_combo->clear(); + + const bool paused = Core::PauseAndLock(true); + + g_controller_interface.RefreshDevices(); + m_controller->UpdateReferences(g_controller_interface); + m_controller->UpdateDefaultDevice(); + + // Adding default device regardless if it's currently connected or not + const auto default_device = m_controller->default_device.ToString(); + + m_devices_combo->addItem(QString::fromStdString(default_device)); + + for (const auto& name : g_controller_interface.GetAllDeviceStrings()) + { + if (name != default_device) + m_devices_combo->addItem(QString::fromStdString(name)); + } + + m_devices_combo->setCurrentIndex(0); + + Core::PauseAndLock(false, paused); + m_block.Set(false); +} diff --git a/Source/Core/DolphinQt2/Config/Mapping/IOWindow.h b/Source/Core/DolphinQt2/Config/Mapping/IOWindow.h new file mode 100644 index 0000000000..b59d84db65 --- /dev/null +++ b/Source/Core/DolphinQt2/Config/Mapping/IOWindow.h @@ -0,0 +1,99 @@ +// Copyright 2017 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#pragma once + +#include +#include + +#include "Common/Flag.h" +#include "InputCommon/ControllerInterface/Device.h" + +class ControlReference; +class QAbstractButton; +class QComboBox; +class QDialogButtonBox; +class QListWidget; +class QVBoxLayout; +class QWidget; +class QPlainTextEdit; +class QPushButton; +class QSlider; +class QSpinBox; + +namespace ControllerEmu +{ +class EmulatedController; +} + +class IOWindow final : public QDialog +{ + Q_OBJECT +public: + enum class Type + { + Input, + Output + }; + + explicit IOWindow(QWidget* parent, ControllerEmu::EmulatedController* m_controller, + ControlReference* ref, Type type); + +private: + void CreateMainLayout(); + void ConnectWidgets(); + void LoadSettings(); + void SaveSettings(); + void Update(); + + void OnDialogButtonPressed(QAbstractButton* button); + void OnDeviceChanged(const QString& device); + void OnDetectButtonPressed(); + void OnRangeChanged(int range); + + void AppendSelectedOption(const std::string& prefix); + void UpdateOptionList(); + void UpdateDeviceList(); + + // Main Layout + QVBoxLayout* m_main_layout; + + // Devices + QComboBox* m_devices_combo; + + // Options + QListWidget* m_option_list; + + // Range + QSlider* m_range_slider; + QSpinBox* m_range_spinbox; + + // Shared actions + QPushButton* m_select_button; + QPushButton* m_or_button; + + // Input actions + QPushButton* m_detect_button; + QPushButton* m_and_button; + QPushButton* m_not_button; + QPushButton* m_add_button; + + // Output actions + QPushButton* m_test_button; + + // Textarea + QPlainTextEdit* m_expression_text; + + // Buttonbox + QDialogButtonBox* m_button_box; + QPushButton* m_clear_button; + QPushButton* m_apply_button; + + ControlReference* m_reference; + ControllerEmu::EmulatedController* m_controller; + + ciface::Core::DeviceQualifier m_devq; + Common::Flag m_block; + Type m_type; +}; diff --git a/Source/Core/DolphinQt2/Config/Mapping/MappingButton.cpp b/Source/Core/DolphinQt2/Config/Mapping/MappingButton.cpp index dcb92e6072..02e6917d8c 100644 --- a/Source/Core/DolphinQt2/Config/Mapping/MappingButton.cpp +++ b/Source/Core/DolphinQt2/Config/Mapping/MappingButton.cpp @@ -2,19 +2,23 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include + #include #include #include -#include #include "DolphinQt2/Config/Mapping/MappingButton.h" #include "Common/Thread.h" +#include "DolphinQt2/Config/Mapping/IOWindow.h" +#include "DolphinQt2/Config/Mapping/MappingCommon.h" #include "DolphinQt2/Config/Mapping/MappingWidget.h" #include "DolphinQt2/Config/Mapping/MappingWindow.h" #include "InputCommon/ControlReference/ControlReference.h" #include "InputCommon/ControllerEmu/ControllerEmu.h" #include "InputCommon/ControllerInterface/ControllerInterface.h" +#include "InputCommon/ControllerInterface/Device.h" MappingButton::MappingButton(MappingWidget* widget, ControlReference* ref) : ElidedButton(QString::fromStdString(ref->expression)), m_parent(widget), m_reference(ref) @@ -27,81 +31,52 @@ void MappingButton::Connect() connect(this, &MappingButton::clicked, this, &MappingButton::OnButtonPressed); } -static QString -GetExpressionForControl(const QString& control_name, - const ciface::Core::DeviceQualifier* control_device = nullptr, - const ciface::Core::DeviceQualifier* default_device = nullptr) -{ - QString expr; - - // non-default device - if (control_device && default_device && !(*control_device == *default_device)) - { - expr += QString::fromStdString(control_device->ToString()); - expr += QStringLiteral(":"); - } - - // append the control name - expr += control_name; - - QRegExp reg(QStringLiteral("[a-zA-Z0-9_]*")); - if (!reg.exactMatch(expr)) - expr = QStringLiteral("`%1`").arg(expr); - - return expr; -} - void MappingButton::OnButtonPressed() { - if (m_block || m_parent->GetDevice() == nullptr) + if (m_block || m_parent->GetDevice() == nullptr || !m_reference->IsInput()) return; // Make sure that we don't block event handling std::thread([this] { - if (m_reference->IsInput()) + const auto dev = m_parent->GetDevice(); + + setText(QStringLiteral("...")); + + Common::SleepCurrentThread(100); + + SetBlockInputs(true); + + if (m_parent->GetFirstButtonPress()) + m_reference->Detect(10, dev.get()); + + // Avoid that the button press itself is registered as an event + Common::SleepCurrentThread(100); + + const auto expr = MappingCommon::DetectExpression(m_reference, dev.get(), + m_parent->GetParent()->GetDeviceQualifier(), + m_parent->GetController()->default_device); + + SetBlockInputs(false); + if (!expr.isEmpty()) { - const auto dev = m_parent->GetDevice(); - - setText(QStringLiteral("...")); - - Common::SleepCurrentThread(100); - - SetBlockInputs(true); - - if (m_parent->GetFirstButtonPress()) - m_reference->Detect(10, dev.get()); - - // Avoid that the button press itself is registered as an event - Common::SleepCurrentThread(100); - - ciface::Core::Device::Control* const ctrl = m_reference->Detect(5000, dev.get()); - - SetBlockInputs(false); - if (ctrl) - { - m_reference->expression = - GetExpressionForControl(QString::fromStdString(ctrl->GetName())).toStdString(); - Update(); - } - else - { - OnButtonTimeout(); - } + m_reference->expression = expr.toStdString(); + Update(); } else { - // TODO: Implement Output + OnButtonTimeout(); } }).detach(); } void MappingButton::OnButtonTimeout() { - setText(QStringLiteral("")); + setText(QString::fromStdString(m_reference->expression)); } void MappingButton::Clear() { + m_parent->Update(); m_reference->expression.clear(); Update(); } @@ -137,25 +112,21 @@ bool MappingButton::event(QEvent* event) void MappingButton::mouseReleaseEvent(QMouseEvent* event) { - if (m_reference->IsInput()) + switch (event->button()) { - switch (event->button()) - { - case Qt::MouseButton::LeftButton: + case Qt::MouseButton::LeftButton: + if (m_reference->IsInput()) QPushButton::mouseReleaseEvent(event); - break; - case Qt::MouseButton::MiddleButton: - Clear(); - break; - case Qt::MouseButton::RightButton: - // TODO Open advanced dialog - break; - default: - break; - } - } - else - { - // TODO Open output dialog + else + emit AdvancedPressed(); + return; + case Qt::MouseButton::MiddleButton: + Clear(); + return; + case Qt::MouseButton::RightButton: + emit AdvancedPressed(); + return; + default: + return; } } diff --git a/Source/Core/DolphinQt2/Config/Mapping/MappingButton.h b/Source/Core/DolphinQt2/Config/Mapping/MappingButton.h index 27249c0685..37db71cc00 100644 --- a/Source/Core/DolphinQt2/Config/Mapping/MappingButton.h +++ b/Source/Core/DolphinQt2/Config/Mapping/MappingButton.h @@ -13,12 +13,16 @@ class QMouseEvent; class MappingButton : public ElidedButton { + Q_OBJECT public: MappingButton(MappingWidget* widget, ControlReference* ref); void Clear(); void Update(); +signals: + void AdvancedPressed(); + private: bool event(QEvent* event) override; void mouseReleaseEvent(QMouseEvent* event) override; diff --git a/Source/Core/DolphinQt2/Config/Mapping/MappingCommon.cpp b/Source/Core/DolphinQt2/Config/Mapping/MappingCommon.cpp new file mode 100644 index 0000000000..43960cf762 --- /dev/null +++ b/Source/Core/DolphinQt2/Config/Mapping/MappingCommon.cpp @@ -0,0 +1,50 @@ +// Copyright 2017 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#include "DolphinQt2/Config/Mapping/MappingCommon.h" + +#include +#include + +#include "InputCommon/ControlReference/ControlReference.h" +#include "InputCommon/ControllerInterface/Device.h" + +namespace MappingCommon +{ +QString GetExpressionForControl(const QString& control_name, + const ciface::Core::DeviceQualifier& control_device, + const ciface::Core::DeviceQualifier& default_device) +{ + QString expr; + + // non-default device + if (control_device != default_device) + { + expr += QString::fromStdString(control_device.ToString()); + expr += QStringLiteral(":"); + } + + // append the control name + expr += control_name; + + QRegExp reg(QStringLiteral("[a-zA-Z]+")); + if (!reg.exactMatch(expr)) + expr = QStringLiteral("`%1`").arg(expr); + return expr; +} + +QString DetectExpression(ControlReference* reference, ciface::Core::Device* device, + const ciface::Core::DeviceQualifier& m_devq, + const ciface::Core::DeviceQualifier& default_device) +{ + ciface::Core::Device::Control* const ctrl = reference->Detect(5000, device); + + if (ctrl) + { + return MappingCommon::GetExpressionForControl(QString::fromStdString(ctrl->GetName()), m_devq, + default_device); + } + return QStringLiteral(""); +} +} diff --git a/Source/Core/DolphinQt2/Config/Mapping/MappingCommon.h b/Source/Core/DolphinQt2/Config/Mapping/MappingCommon.h new file mode 100644 index 0000000000..935eb20602 --- /dev/null +++ b/Source/Core/DolphinQt2/Config/Mapping/MappingCommon.h @@ -0,0 +1,27 @@ +// Copyright 2017 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#pragma once + +class QString; +class ControlReference; + +namespace ciface +{ +namespace Core +{ +class Device; +class DeviceQualifier; +} +} + +namespace MappingCommon +{ +QString GetExpressionForControl(const QString& control_name, + const ciface::Core::DeviceQualifier& control_device, + const ciface::Core::DeviceQualifier& default_device); +QString DetectExpression(ControlReference* reference, ciface::Core::Device* device, + const ciface::Core::DeviceQualifier& m_devq, + const ciface::Core::DeviceQualifier& default_device); +} diff --git a/Source/Core/DolphinQt2/Config/Mapping/MappingWidget.cpp b/Source/Core/DolphinQt2/Config/Mapping/MappingWidget.cpp index bb711f3058..979b01f260 100644 --- a/Source/Core/DolphinQt2/Config/Mapping/MappingWidget.cpp +++ b/Source/Core/DolphinQt2/Config/Mapping/MappingWidget.cpp @@ -8,6 +8,7 @@ #include "DolphinQt2/Config/Mapping/MappingWidget.h" +#include "DolphinQt2/Config/Mapping/IOWindow.h" #include "DolphinQt2/Config/Mapping/MappingBool.h" #include "DolphinQt2/Config/Mapping/MappingButton.h" #include "DolphinQt2/Config/Mapping/MappingNumeric.h" @@ -49,9 +50,23 @@ QGroupBox* MappingWidget::CreateGroupBox(const QString& name, ControllerEmu::Con for (auto& control : group->controls) { auto* button = new MappingButton(this, control->control_ref.get()); + button->setMinimumWidth(125); button->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); form_layout->addRow(QString::fromStdString(control->name), button); + + auto* control_ref = control->control_ref.get(); + + connect(button, &MappingButton::AdvancedPressed, [this, control_ref] { + if (m_parent->GetDevice() == nullptr) + return; + + IOWindow io(this, m_parent->GetController(), control_ref, + control_ref->IsInput() ? IOWindow::Type::Input : IOWindow::Type::Output); + io.exec(); + Update(); + }); + m_buttons.push_back(button); } @@ -108,3 +123,8 @@ bool MappingWidget::GetFirstButtonPress() } return false; } + +ControllerEmu::EmulatedController* MappingWidget::GetController() const +{ + return m_parent->GetController(); +} diff --git a/Source/Core/DolphinQt2/Config/Mapping/MappingWidget.h b/Source/Core/DolphinQt2/Config/Mapping/MappingWidget.h index f7af6a3e2d..a942038b3f 100644 --- a/Source/Core/DolphinQt2/Config/Mapping/MappingWidget.h +++ b/Source/Core/DolphinQt2/Config/Mapping/MappingWidget.h @@ -12,6 +12,7 @@ class ControlGroupBox; class InputConfig; +class IOWindow; class MappingBool; class MappingButton; class MappingNumeric; @@ -22,6 +23,7 @@ namespace ControllerEmu { class Control; class ControlGroup; +class EmulatedController; } namespace ciface @@ -38,6 +40,7 @@ class MappingWidget : public QWidget public: explicit MappingWidget(MappingWindow* window); + ControllerEmu::EmulatedController* GetController() const; std::shared_ptr GetDevice() const; void SetBlockInputs(const bool block); diff --git a/Source/Core/DolphinQt2/Config/Mapping/MappingWindow.cpp b/Source/Core/DolphinQt2/Config/Mapping/MappingWindow.cpp index 33e30a9b93..52efb0b218 100644 --- a/Source/Core/DolphinQt2/Config/Mapping/MappingWindow.cpp +++ b/Source/Core/DolphinQt2/Config/Mapping/MappingWindow.cpp @@ -354,6 +354,11 @@ int MappingWindow::GetPort() const return m_port; } +ControllerEmu::EmulatedController* MappingWindow::GetController() const +{ + return m_controller; +} + const ciface::Core::DeviceQualifier& MappingWindow::GetDeviceQualifier() const { return m_devq; diff --git a/Source/Core/DolphinQt2/Config/Mapping/MappingWindow.h b/Source/Core/DolphinQt2/Config/Mapping/MappingWindow.h index 8e6fd82d7c..730c9a8341 100644 --- a/Source/Core/DolphinQt2/Config/Mapping/MappingWindow.h +++ b/Source/Core/DolphinQt2/Config/Mapping/MappingWindow.h @@ -54,6 +54,7 @@ public: std::shared_ptr GetDevice() const; void SetBlockInputs(const bool block); + ControllerEmu::EmulatedController* GetController() const; signals: void Update(); void ClearFields(); diff --git a/Source/Core/DolphinQt2/DolphinQt2.vcxproj b/Source/Core/DolphinQt2/DolphinQt2.vcxproj index f1bce1701c..54b7a2bfd4 100644 --- a/Source/Core/DolphinQt2/DolphinQt2.vcxproj +++ b/Source/Core/DolphinQt2/DolphinQt2.vcxproj @@ -72,6 +72,8 @@ + + @@ -111,8 +113,10 @@ + + @@ -135,8 +139,10 @@ + +