2017-05-20 09:53:17 -06:00
|
|
|
// Copyright 2017 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2+
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
2018-05-27 19:48:04 -06:00
|
|
|
#include "DolphinQt2/Config/Mapping/MappingWindow.h"
|
|
|
|
|
2018-04-01 08:25:34 -06:00
|
|
|
#include <QCheckBox>
|
2017-05-20 09:53:17 -06:00
|
|
|
#include <QComboBox>
|
|
|
|
#include <QDialogButtonBox>
|
|
|
|
#include <QGroupBox>
|
|
|
|
#include <QHBoxLayout>
|
|
|
|
#include <QMessageBox>
|
|
|
|
#include <QPushButton>
|
|
|
|
#include <QTabWidget>
|
|
|
|
#include <QVBoxLayout>
|
|
|
|
|
2017-06-09 14:00:19 -06:00
|
|
|
#include "Common/FileSearch.h"
|
2017-05-20 09:53:17 -06:00
|
|
|
#include "Common/FileUtil.h"
|
|
|
|
#include "Common/IniFile.h"
|
2017-06-09 14:00:19 -06:00
|
|
|
#include "Common/StringUtil.h"
|
2018-05-27 19:48:04 -06:00
|
|
|
|
2017-05-20 09:53:17 -06:00
|
|
|
#include "Core/Core.h"
|
2018-05-27 19:48:04 -06:00
|
|
|
|
2017-05-20 09:53:17 -06:00
|
|
|
#include "DolphinQt2/Config/Mapping/GCKeyboardEmu.h"
|
2018-01-04 11:38:09 -07:00
|
|
|
#include "DolphinQt2/Config/Mapping/GCMicrophone.h"
|
2017-05-20 09:53:17 -06:00
|
|
|
#include "DolphinQt2/Config/Mapping/GCPadEmu.h"
|
2017-06-06 05:49:49 -06:00
|
|
|
#include "DolphinQt2/Config/Mapping/Hotkey3D.h"
|
2018-02-14 15:25:01 -07:00
|
|
|
#include "DolphinQt2/Config/Mapping/HotkeyDebugging.h"
|
2017-06-06 05:49:49 -06:00
|
|
|
#include "DolphinQt2/Config/Mapping/HotkeyGeneral.h"
|
|
|
|
#include "DolphinQt2/Config/Mapping/HotkeyGraphics.h"
|
|
|
|
#include "DolphinQt2/Config/Mapping/HotkeyStates.h"
|
|
|
|
#include "DolphinQt2/Config/Mapping/HotkeyTAS.h"
|
|
|
|
#include "DolphinQt2/Config/Mapping/HotkeyWii.h"
|
2017-05-20 09:53:17 -06:00
|
|
|
#include "DolphinQt2/Config/Mapping/WiimoteEmuExtension.h"
|
|
|
|
#include "DolphinQt2/Config/Mapping/WiimoteEmuGeneral.h"
|
|
|
|
#include "DolphinQt2/Config/Mapping/WiimoteEmuMotionControl.h"
|
2018-03-17 09:07:51 -06:00
|
|
|
#include "DolphinQt2/QtUtils/WrapInScrollArea.h"
|
2017-05-20 09:53:17 -06:00
|
|
|
#include "DolphinQt2/Settings.h"
|
2018-05-27 19:48:04 -06:00
|
|
|
|
2017-05-20 09:53:17 -06:00
|
|
|
#include "InputCommon/ControllerEmu/ControllerEmu.h"
|
2017-11-03 15:31:17 -06:00
|
|
|
#include "InputCommon/ControllerInterface/ControllerInterface.h"
|
2017-05-20 09:53:17 -06:00
|
|
|
#include "InputCommon/ControllerInterface/Device.h"
|
|
|
|
#include "InputCommon/InputConfig.h"
|
|
|
|
|
2018-04-30 01:09:27 -06:00
|
|
|
constexpr const char* PROFILES_DIR = "Profiles/";
|
|
|
|
|
2017-11-03 15:31:17 -06:00
|
|
|
MappingWindow::MappingWindow(QWidget* parent, Type type, int port_num)
|
|
|
|
: QDialog(parent), m_port(port_num)
|
2017-05-20 09:53:17 -06:00
|
|
|
{
|
|
|
|
setWindowTitle(tr("Port %1").arg(port_num + 1));
|
2017-06-29 18:52:53 -06:00
|
|
|
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
2017-05-20 09:53:17 -06:00
|
|
|
|
|
|
|
CreateDevicesLayout();
|
|
|
|
CreateProfilesLayout();
|
|
|
|
CreateResetLayout();
|
|
|
|
CreateMainLayout();
|
|
|
|
ConnectWidgets();
|
2017-11-03 15:31:17 -06:00
|
|
|
SetMappingType(type);
|
2017-05-20 09:53:17 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
void MappingWindow::CreateDevicesLayout()
|
|
|
|
{
|
|
|
|
m_devices_layout = new QHBoxLayout();
|
2017-07-23 04:58:32 -06:00
|
|
|
m_devices_box = new QGroupBox(tr("Device"));
|
2017-05-20 09:53:17 -06:00
|
|
|
m_devices_combo = new QComboBox();
|
|
|
|
m_devices_refresh = new QPushButton(tr("Refresh"));
|
|
|
|
|
|
|
|
m_devices_refresh->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
|
|
|
m_devices_layout->addWidget(m_devices_combo);
|
|
|
|
m_devices_layout->addWidget(m_devices_refresh);
|
|
|
|
|
|
|
|
m_devices_box->setLayout(m_devices_layout);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MappingWindow::CreateProfilesLayout()
|
|
|
|
{
|
2017-06-13 22:24:24 -06:00
|
|
|
m_profiles_layout = new QHBoxLayout();
|
2017-07-23 04:58:32 -06:00
|
|
|
m_profiles_box = new QGroupBox(tr("Profile"));
|
2017-05-20 09:53:17 -06:00
|
|
|
m_profiles_combo = new QComboBox();
|
|
|
|
m_profiles_load = new QPushButton(tr("Load"));
|
|
|
|
m_profiles_save = new QPushButton(tr("Save"));
|
|
|
|
m_profiles_delete = new QPushButton(tr("Delete"));
|
|
|
|
|
|
|
|
auto* button_layout = new QHBoxLayout();
|
|
|
|
|
|
|
|
m_profiles_box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
|
|
|
m_profiles_combo->setEditable(true);
|
|
|
|
|
|
|
|
m_profiles_layout->addWidget(m_profiles_combo);
|
|
|
|
button_layout->addWidget(m_profiles_load);
|
|
|
|
button_layout->addWidget(m_profiles_save);
|
|
|
|
button_layout->addWidget(m_profiles_delete);
|
2018-05-08 17:54:47 -06:00
|
|
|
m_profiles_layout->addLayout(button_layout);
|
2017-05-20 09:53:17 -06:00
|
|
|
|
|
|
|
m_profiles_box->setLayout(m_profiles_layout);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MappingWindow::CreateResetLayout()
|
|
|
|
{
|
2017-06-13 22:24:24 -06:00
|
|
|
m_reset_layout = new QHBoxLayout();
|
2017-05-20 09:53:17 -06:00
|
|
|
m_reset_box = new QGroupBox(tr("Reset"));
|
|
|
|
m_reset_clear = new QPushButton(tr("Clear"));
|
|
|
|
m_reset_default = new QPushButton(tr("Default"));
|
|
|
|
|
|
|
|
m_reset_box->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
|
|
|
|
|
|
|
m_reset_layout->addWidget(m_reset_default);
|
2017-06-13 22:24:24 -06:00
|
|
|
m_reset_layout->addWidget(m_reset_clear);
|
2017-05-20 09:53:17 -06:00
|
|
|
|
|
|
|
m_reset_box->setLayout(m_reset_layout);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MappingWindow::CreateMainLayout()
|
|
|
|
{
|
|
|
|
m_main_layout = new QVBoxLayout();
|
|
|
|
m_config_layout = new QHBoxLayout();
|
2018-04-01 08:25:34 -06:00
|
|
|
m_iterative_input = new QCheckBox(tr("Iterative Input"));
|
2017-05-20 09:53:17 -06:00
|
|
|
m_tab_widget = new QTabWidget();
|
2018-03-20 03:12:11 -06:00
|
|
|
m_button_box = new QDialogButtonBox(QDialogButtonBox::Close);
|
2017-05-20 09:53:17 -06:00
|
|
|
|
2018-04-01 08:25:34 -06:00
|
|
|
m_iterative_input->setToolTip(tr("Automatically progress one button after another during "
|
|
|
|
"configuration. Useful for first-time setup."));
|
|
|
|
|
2017-06-13 22:24:24 -06:00
|
|
|
m_config_layout->addWidget(m_devices_box);
|
2017-05-20 09:53:17 -06:00
|
|
|
m_config_layout->addWidget(m_reset_box);
|
2017-06-13 22:24:24 -06:00
|
|
|
m_config_layout->addWidget(m_profiles_box);
|
2017-05-20 09:53:17 -06:00
|
|
|
|
2018-05-08 17:54:47 -06:00
|
|
|
m_main_layout->addLayout(m_config_layout);
|
2018-04-01 08:25:34 -06:00
|
|
|
m_main_layout->addWidget(m_iterative_input);
|
2017-05-20 09:53:17 -06:00
|
|
|
m_main_layout->addWidget(m_tab_widget);
|
|
|
|
m_main_layout->addWidget(m_button_box);
|
|
|
|
|
|
|
|
setLayout(m_main_layout);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MappingWindow::ConnectWidgets()
|
|
|
|
{
|
2018-03-20 03:12:11 -06:00
|
|
|
connect(m_button_box, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
2017-05-20 09:53:17 -06:00
|
|
|
connect(m_devices_refresh, &QPushButton::clicked, this, &MappingWindow::RefreshDevices);
|
|
|
|
connect(m_devices_combo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
|
|
|
this, &MappingWindow::OnDeviceChanged);
|
|
|
|
connect(m_reset_clear, &QPushButton::clicked, this, [this] { emit ClearFields(); });
|
|
|
|
connect(m_reset_default, &QPushButton::clicked, this, &MappingWindow::OnDefaultFieldsPressed);
|
|
|
|
connect(m_profiles_save, &QPushButton::clicked, this, &MappingWindow::OnSaveProfilePressed);
|
|
|
|
connect(m_profiles_load, &QPushButton::clicked, this, &MappingWindow::OnLoadProfilePressed);
|
|
|
|
connect(m_profiles_delete, &QPushButton::clicked, this, &MappingWindow::OnDeleteProfilePressed);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MappingWindow::OnDeleteProfilePressed()
|
|
|
|
{
|
|
|
|
const QString profile_name = m_profiles_combo->currentText();
|
2017-06-09 14:00:19 -06:00
|
|
|
const QString profile_path = m_profiles_combo->currentData().toString();
|
|
|
|
|
|
|
|
if (!File::Exists(profile_path.toStdString()))
|
2017-05-20 09:53:17 -06:00
|
|
|
{
|
2017-06-09 14:00:19 -06:00
|
|
|
QMessageBox error(this);
|
2017-05-20 09:53:17 -06:00
|
|
|
error.setIcon(QMessageBox::Critical);
|
|
|
|
error.setText(tr("The profile '%1' does not exist").arg(profile_name));
|
|
|
|
error.exec();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
QMessageBox confirm(this);
|
|
|
|
|
|
|
|
confirm.setIcon(QMessageBox::Warning);
|
|
|
|
confirm.setText(tr("Are you sure that you want to delete '%1'?").arg(profile_name));
|
|
|
|
confirm.setInformativeText(tr("This cannot be undone!"));
|
|
|
|
confirm.setStandardButtons(QMessageBox::Yes | QMessageBox::Cancel);
|
|
|
|
|
|
|
|
if (confirm.exec() != QMessageBox::Yes)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_profiles_combo->removeItem(m_profiles_combo->currentIndex());
|
|
|
|
|
2017-06-09 14:00:19 -06:00
|
|
|
File::Delete(profile_path.toStdString());
|
2017-05-20 09:53:17 -06:00
|
|
|
|
2017-06-09 14:00:19 -06:00
|
|
|
QMessageBox result(this);
|
2017-05-20 09:53:17 -06:00
|
|
|
result.setIcon(QMessageBox::Information);
|
|
|
|
result.setText(tr("Successfully deleted '%1'.").arg(profile_name));
|
|
|
|
}
|
|
|
|
|
|
|
|
void MappingWindow::OnLoadProfilePressed()
|
|
|
|
{
|
2017-06-09 14:00:19 -06:00
|
|
|
const QString profile_path = m_profiles_combo->currentData().toString();
|
2017-05-20 09:53:17 -06:00
|
|
|
|
2017-06-09 14:00:19 -06:00
|
|
|
if (m_profiles_combo->currentIndex() == 0)
|
2017-05-20 09:53:17 -06:00
|
|
|
return;
|
|
|
|
|
|
|
|
IniFile ini;
|
2017-06-09 14:00:19 -06:00
|
|
|
ini.Load(profile_path.toStdString());
|
2017-05-20 09:53:17 -06:00
|
|
|
|
|
|
|
m_controller->LoadConfig(ini.GetOrCreateSection("Profile"));
|
|
|
|
m_controller->UpdateReferences(g_controller_interface);
|
|
|
|
|
|
|
|
emit Update();
|
|
|
|
|
|
|
|
RefreshDevices();
|
|
|
|
}
|
|
|
|
|
|
|
|
void MappingWindow::OnSaveProfilePressed()
|
|
|
|
{
|
|
|
|
const QString profile_name = m_profiles_combo->currentText();
|
2018-05-01 22:43:16 -06:00
|
|
|
const std::string profile_path = File::GetUserPath(D_CONFIG_IDX) + PROFILES_DIR +
|
|
|
|
m_config->GetProfileName() + "/" + profile_name.toStdString() +
|
|
|
|
".ini";
|
2017-05-20 09:53:17 -06:00
|
|
|
|
|
|
|
if (profile_name.isEmpty())
|
|
|
|
return;
|
|
|
|
|
2018-04-30 01:09:27 -06:00
|
|
|
File::CreateFullPath(profile_path);
|
2017-05-20 09:53:17 -06:00
|
|
|
|
|
|
|
IniFile ini;
|
|
|
|
|
|
|
|
m_controller->SaveConfig(ini.GetOrCreateSection("Profile"));
|
2018-04-30 01:09:27 -06:00
|
|
|
ini.Save(profile_path);
|
2017-05-20 09:53:17 -06:00
|
|
|
|
2018-05-28 17:26:17 -06:00
|
|
|
if (m_profiles_combo->currentIndex() == 0 || m_profiles_combo->findText(profile_name) == -1)
|
2017-05-20 09:53:17 -06:00
|
|
|
{
|
2018-04-30 01:09:27 -06:00
|
|
|
m_profiles_combo->addItem(profile_name, QString::fromStdString(profile_path));
|
2017-05-20 09:53:17 -06:00
|
|
|
m_profiles_combo->setCurrentIndex(m_profiles_combo->count() - 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void MappingWindow::OnDeviceChanged(int index)
|
|
|
|
{
|
2018-05-23 15:47:42 -06:00
|
|
|
if (IsMappingAllDevices())
|
|
|
|
return;
|
|
|
|
|
2017-05-21 06:47:35 -06:00
|
|
|
const auto device = m_devices_combo->currentText().toStdString();
|
2017-11-04 15:08:26 -06:00
|
|
|
m_controller->SetDefaultDevice(device);
|
2017-05-20 09:53:17 -06:00
|
|
|
}
|
|
|
|
|
2018-05-23 15:47:42 -06:00
|
|
|
bool MappingWindow::IsMappingAllDevices() const
|
|
|
|
{
|
|
|
|
return m_devices_combo->currentIndex() == m_devices_combo->count() - 1;
|
|
|
|
}
|
|
|
|
|
2017-05-20 09:53:17 -06:00
|
|
|
void MappingWindow::RefreshDevices()
|
|
|
|
{
|
|
|
|
m_devices_combo->clear();
|
|
|
|
|
2017-07-21 00:06:02 -06:00
|
|
|
Core::RunAsCPUThread([&] {
|
|
|
|
g_controller_interface.RefreshDevices();
|
|
|
|
m_controller->UpdateReferences(g_controller_interface);
|
2017-05-20 09:53:17 -06:00
|
|
|
|
2017-11-04 15:08:26 -06:00
|
|
|
const auto default_device = m_controller->GetDefaultDevice().ToString();
|
2017-05-20 09:53:17 -06:00
|
|
|
|
2018-02-03 10:30:57 -07:00
|
|
|
if (!default_device.empty())
|
|
|
|
m_devices_combo->addItem(QString::fromStdString(default_device));
|
2017-05-20 09:53:17 -06:00
|
|
|
|
2017-07-21 00:06:02 -06:00
|
|
|
for (const auto& name : g_controller_interface.GetAllDeviceStrings())
|
|
|
|
{
|
|
|
|
if (name != default_device)
|
|
|
|
m_devices_combo->addItem(QString::fromStdString(name));
|
|
|
|
}
|
2017-05-21 06:47:35 -06:00
|
|
|
|
2018-05-23 15:47:42 -06:00
|
|
|
m_devices_combo->addItem(tr("All devices"));
|
|
|
|
|
2017-07-21 00:06:02 -06:00
|
|
|
m_devices_combo->setCurrentIndex(0);
|
|
|
|
});
|
2017-05-20 09:53:17 -06:00
|
|
|
}
|
|
|
|
|
2017-11-03 15:31:17 -06:00
|
|
|
void MappingWindow::SetMappingType(MappingWindow::Type type)
|
2017-05-20 09:53:17 -06:00
|
|
|
{
|
|
|
|
MappingWidget* widget;
|
|
|
|
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case Type::MAPPING_GC_KEYBOARD:
|
|
|
|
widget = new GCKeyboardEmu(this);
|
|
|
|
AddWidget(tr("GameCube Keyboard"), widget);
|
|
|
|
setWindowTitle(tr("GameCube Keyboard at Port %1").arg(GetPort() + 1));
|
|
|
|
break;
|
|
|
|
case Type::MAPPING_GC_BONGOS:
|
|
|
|
case Type::MAPPING_GC_STEERINGWHEEL:
|
|
|
|
case Type::MAPPING_GC_DANCEMAT:
|
|
|
|
case Type::MAPPING_GCPAD:
|
|
|
|
widget = new GCPadEmu(this);
|
|
|
|
setWindowTitle(tr("GameCube Controller at Port %1").arg(GetPort() + 1));
|
|
|
|
AddWidget(tr("GameCube Controller"), widget);
|
|
|
|
break;
|
2018-01-04 11:38:09 -07:00
|
|
|
case Type::MAPPING_GC_MICROPHONE:
|
|
|
|
widget = new GCMicrophone(this);
|
|
|
|
setWindowTitle(tr("GameCube Microphone Slot %1")
|
|
|
|
.arg(GetPort() == 0 ? QStringLiteral("A") : QStringLiteral("B")));
|
|
|
|
AddWidget(tr("Microphone"), widget);
|
|
|
|
break;
|
2017-05-20 09:53:17 -06:00
|
|
|
case Type::MAPPING_WIIMOTE_EMU:
|
|
|
|
{
|
|
|
|
auto* extension = new WiimoteEmuExtension(this);
|
|
|
|
widget = new WiimoteEmuGeneral(this, extension);
|
2017-07-23 04:58:32 -06:00
|
|
|
setWindowTitle(tr("Wii Remote %1").arg(GetPort() + 1));
|
2017-05-20 09:53:17 -06:00
|
|
|
AddWidget(tr("General and Options"), widget);
|
|
|
|
AddWidget(tr("Motion Controls and IR"), new WiimoteEmuMotionControl(this));
|
|
|
|
AddWidget(tr("Extension"), extension);
|
|
|
|
break;
|
|
|
|
}
|
2017-06-06 05:49:49 -06:00
|
|
|
case Type::MAPPING_HOTKEYS:
|
|
|
|
{
|
|
|
|
widget = new HotkeyGeneral(this);
|
|
|
|
AddWidget(tr("General"), widget);
|
|
|
|
AddWidget(tr("TAS Tools"), new HotkeyTAS(this));
|
2018-05-13 16:12:31 -06:00
|
|
|
|
|
|
|
HotkeyDebugging* debugging_widget = new HotkeyDebugging(this);
|
2018-05-21 07:47:09 -06:00
|
|
|
QWidget* debugging_widget_wrapper = GetWrappedWidget(debugging_widget, this, 150, 205);
|
2018-05-13 16:12:31 -06:00
|
|
|
connect(&Settings::Instance(), &Settings::DebugModeToggled, this, [=](bool enabled) {
|
|
|
|
if (enabled)
|
|
|
|
m_tab_widget->insertTab(2, debugging_widget_wrapper, tr("Debugging"));
|
|
|
|
else
|
|
|
|
m_tab_widget->removeTab(2);
|
|
|
|
});
|
|
|
|
if (Settings::Instance().IsDebugModeEnabled())
|
|
|
|
AddWidget(tr("Debugging"), debugging_widget);
|
|
|
|
|
2017-07-23 04:58:32 -06:00
|
|
|
AddWidget(tr("Wii and Wii Remote"), new HotkeyWii(this));
|
2017-06-06 05:49:49 -06:00
|
|
|
AddWidget(tr("Graphics"), new HotkeyGraphics(this));
|
|
|
|
AddWidget(tr("3D"), new Hotkey3D(this));
|
2017-07-23 04:58:32 -06:00
|
|
|
AddWidget(tr("Save and Load State"), new HotkeyStates(this));
|
2017-06-06 05:49:49 -06:00
|
|
|
setWindowTitle(tr("Hotkey Settings"));
|
|
|
|
break;
|
|
|
|
}
|
2017-05-20 09:53:17 -06:00
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
widget->LoadSettings();
|
|
|
|
|
|
|
|
m_config = widget->GetConfig();
|
|
|
|
|
2017-11-03 15:47:36 -06:00
|
|
|
m_controller = m_config->GetController(GetPort());
|
|
|
|
m_profiles_combo->addItem(QStringLiteral(""));
|
2017-06-09 14:00:19 -06:00
|
|
|
|
2017-11-03 15:47:36 -06:00
|
|
|
const std::string profiles_path =
|
2018-04-30 01:09:27 -06:00
|
|
|
File::GetUserPath(D_CONFIG_IDX) + PROFILES_DIR + m_config->GetProfileName();
|
2017-11-03 15:47:36 -06:00
|
|
|
for (const auto& filename : Common::DoFileSearch({profiles_path}, {".ini"}))
|
|
|
|
{
|
|
|
|
std::string basename;
|
|
|
|
SplitPath(filename, nullptr, &basename, nullptr);
|
|
|
|
m_profiles_combo->addItem(QString::fromStdString(basename), QString::fromStdString(filename));
|
2017-05-20 09:53:17 -06:00
|
|
|
}
|
|
|
|
|
2017-11-19 13:35:41 -07:00
|
|
|
RefreshDevices();
|
2017-05-20 09:53:17 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
void MappingWindow::AddWidget(const QString& name, QWidget* widget)
|
|
|
|
{
|
2018-05-21 07:47:09 -06:00
|
|
|
m_tab_widget->addTab(GetWrappedWidget(widget, this, 150, 205), name);
|
2017-05-20 09:53:17 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
int MappingWindow::GetPort() const
|
|
|
|
{
|
|
|
|
return m_port;
|
|
|
|
}
|
|
|
|
|
2017-06-13 09:16:41 -06:00
|
|
|
ControllerEmu::EmulatedController* MappingWindow::GetController() const
|
|
|
|
{
|
|
|
|
return m_controller;
|
|
|
|
}
|
|
|
|
|
2017-05-20 09:53:17 -06:00
|
|
|
std::shared_ptr<ciface::Core::Device> MappingWindow::GetDevice() const
|
|
|
|
{
|
2017-11-04 16:29:15 -06:00
|
|
|
return g_controller_interface.FindDevice(GetController()->GetDefaultDevice());
|
2017-05-20 09:53:17 -06:00
|
|
|
}
|
|
|
|
|
2017-06-13 17:57:05 -06:00
|
|
|
void MappingWindow::OnDefaultFieldsPressed()
|
|
|
|
{
|
|
|
|
m_controller->LoadDefaults(g_controller_interface);
|
|
|
|
m_controller->UpdateReferences(g_controller_interface);
|
|
|
|
emit Update();
|
2018-05-02 08:55:42 -06:00
|
|
|
emit Save();
|
2017-06-13 17:57:05 -06:00
|
|
|
}
|
2018-04-01 08:25:34 -06:00
|
|
|
|
|
|
|
bool MappingWindow::IsIterativeInput() const
|
|
|
|
{
|
|
|
|
return m_iterative_input->isChecked();
|
|
|
|
}
|