mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
Add support for motion controllers via the CemuHook controller input protocol.
This is done by: 1) Implementing said protocol in a new controller input class CemuHookUDPServer. 2) Adding functionality in the WiimoteEmu class for pushing that motion input to the emulated Wiimote and MotionPlus. 3) Suitably modifying the UI for configuring an Emulated Wii Remote.
This commit is contained in:
@ -35,6 +35,7 @@
|
||||
#include "DolphinQt/Config/Mapping/WiimoteEmuExtension.h"
|
||||
#include "DolphinQt/Config/Mapping/WiimoteEmuGeneral.h"
|
||||
#include "DolphinQt/Config/Mapping/WiimoteEmuMotionControl.h"
|
||||
#include "DolphinQt/Config/Mapping/WiimoteEmuMotionControlIMU.h"
|
||||
#include "DolphinQt/QtUtils/ModalMessageBox.h"
|
||||
#include "DolphinQt/QtUtils/WrapInScrollArea.h"
|
||||
#include "DolphinQt/Settings.h"
|
||||
@ -348,7 +349,8 @@ void MappingWindow::SetMappingType(MappingWindow::Type type)
|
||||
widget = new WiimoteEmuGeneral(this, extension);
|
||||
setWindowTitle(tr("Wii Remote %1").arg(GetPort() + 1));
|
||||
AddWidget(tr("General and Options"), widget);
|
||||
AddWidget(tr("Motion Controls"), new WiimoteEmuMotionControl(this));
|
||||
AddWidget(tr("Motion Simulation"), new WiimoteEmuMotionControl(this));
|
||||
AddWidget(tr("Motion Input"), new WiimoteEmuMotionControlIMU(this));
|
||||
AddWidget(tr("Extension"), extension);
|
||||
break;
|
||||
}
|
||||
|
@ -0,0 +1,72 @@
|
||||
// Copyright 2019 Dolphin Emulator Project
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "DolphinQt/Config/Mapping/WiimoteEmuMotionControlIMU.h"
|
||||
|
||||
#include <QFormLayout>
|
||||
#include <QGroupBox>
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QString>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "Core/HW/Wiimote.h"
|
||||
#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
|
||||
|
||||
#include "InputCommon/InputConfig.h"
|
||||
|
||||
WiimoteEmuMotionControlIMU::WiimoteEmuMotionControlIMU(MappingWindow* window)
|
||||
: MappingWidget(window)
|
||||
{
|
||||
CreateMainLayout();
|
||||
}
|
||||
|
||||
QGroupBox* WiimoteEmuMotionControlIMU::AddWarning(QGroupBox* groupbox)
|
||||
{
|
||||
QFormLayout* layout = static_cast<QFormLayout*>(groupbox->layout());
|
||||
QLabel* label;
|
||||
|
||||
label = new QLabel(QLatin1String(""));
|
||||
layout->addRow(label);
|
||||
|
||||
label = new QLabel(tr("WARNING"));
|
||||
label->setStyleSheet(QLatin1String("QLabel { color : red; }"));
|
||||
layout->addRow(label);
|
||||
|
||||
label = new QLabel(
|
||||
tr("These controls are not intended for mapping regular buttons, triggers or axes."));
|
||||
label->setWordWrap(true);
|
||||
layout->addRow(label);
|
||||
|
||||
return groupbox;
|
||||
}
|
||||
|
||||
void WiimoteEmuMotionControlIMU::CreateMainLayout()
|
||||
{
|
||||
m_main_layout = new QHBoxLayout();
|
||||
|
||||
m_main_layout->addWidget(
|
||||
CreateGroupBox(Wiimote::GetWiimoteGroup(GetPort(), WiimoteEmu::WiimoteGroup::IMUPoint)));
|
||||
m_main_layout->addWidget(AddWarning(CreateGroupBox(
|
||||
Wiimote::GetWiimoteGroup(GetPort(), WiimoteEmu::WiimoteGroup::IMUAccelerometer))));
|
||||
m_main_layout->addWidget(AddWarning(
|
||||
CreateGroupBox(Wiimote::GetWiimoteGroup(GetPort(), WiimoteEmu::WiimoteGroup::IMUGyroscope))));
|
||||
|
||||
setLayout(m_main_layout);
|
||||
}
|
||||
|
||||
void WiimoteEmuMotionControlIMU::LoadSettings()
|
||||
{
|
||||
Wiimote::LoadConfig();
|
||||
}
|
||||
|
||||
void WiimoteEmuMotionControlIMU::SaveSettings()
|
||||
{
|
||||
Wiimote::GetConfig()->SaveConfig();
|
||||
}
|
||||
|
||||
InputConfig* WiimoteEmuMotionControlIMU::GetConfig()
|
||||
{
|
||||
return Wiimote::GetConfig();
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
// Copyright 2019 Dolphin Emulator Project
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "DolphinQt/Config/Mapping/MappingWidget.h"
|
||||
|
||||
class QCheckBox;
|
||||
class QFormLayout;
|
||||
class QGroupBox;
|
||||
class QHBoxLayout;
|
||||
class QLabel;
|
||||
class QVBoxLayout;
|
||||
|
||||
class WiimoteEmuMotionControlIMU final : public MappingWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit WiimoteEmuMotionControlIMU(MappingWindow* window);
|
||||
|
||||
InputConfig* GetConfig() override;
|
||||
|
||||
private:
|
||||
void LoadSettings() override;
|
||||
void SaveSettings() override;
|
||||
void CreateMainLayout();
|
||||
static QGroupBox* AddWarning(QGroupBox* groupbox);
|
||||
|
||||
// Main
|
||||
QHBoxLayout* m_main_layout;
|
||||
};
|
Reference in New Issue
Block a user