From 4cb3baba5cf360a02dff9d6af1a839a570c40999 Mon Sep 17 00:00:00 2001 From: rlnilsen <47765059+rlnilsen@users.noreply.github.com> Date: Fri, 6 Sep 2019 17:09:30 +0200 Subject: 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. --- .../ControllerEmu/ControlGroup/IMUCursor.cpp | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUCursor.cpp (limited to 'Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUCursor.cpp') diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUCursor.cpp b/Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUCursor.cpp new file mode 100644 index 0000000000..7133a07e59 --- /dev/null +++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUCursor.cpp @@ -0,0 +1,43 @@ +// Copyright 2019 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#include "InputCommon/ControllerEmu/ControlGroup/IMUCursor.h" + +#include + +#include "Common/Common.h" +#include "Common/MathUtil.h" + +#include "InputCommon/ControlReference/ControlReference.h" +#include "InputCommon/ControllerEmu/Control/Control.h" +#include "InputCommon/ControllerEmu/Control/Input.h" +#include "InputCommon/ControllerEmu/ControllerEmu.h" +#include "InputCommon/ControllerEmu/Setting/NumericSetting.h" + +namespace ControllerEmu +{ +IMUCursor::IMUCursor(std::string name, std::string ui_name) + : ControlGroup(std::move(name), std::move(ui_name), GroupType::IMUCursor) +{ + controls.emplace_back(std::make_unique(Translate, _trans("Recenter"))); + + // Default values are optimized for "Super Mario Galaxy 2". + // This seems to be acceptable for a good number of games. + + AddSetting(&m_yaw_setting, + // i18n: Refers to an amount of rotational movement about the "yaw" axis. + {_trans("Total Yaw"), + // i18n: The symbol/abbreviation for degrees (unit of angular measure). + _trans("°"), + // i18n: Refers to emulated wii remote movements. + _trans("Total rotation about the yaw axis.")}, + 15, 0, 360); +} + +ControlState IMUCursor::GetTotalYaw() const +{ + return m_yaw_setting.GetValue() * MathUtil::TAU / 360; +} + +} // namespace ControllerEmu -- cgit v1.2.3