summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/ControllerEmu/ControlGroup
diff options
context:
space:
mode:
authorAdmiral H. Curtiss <pikachu025@gmail.com>2024-01-10 05:26:29 +0100
committerAdmiral H. Curtiss <pikachu025@gmail.com>2024-03-11 22:49:19 +0100
commit617fcc3cf85ea723eec02ef9ce5c30983bb15cf8 (patch)
tree6fb67f64104c8b7be4f6b488f902a6ea521ad1d3 /Source/Core/InputCommon/ControllerEmu/ControlGroup
parentc3903fcc7e281a488a26b7e6d7d739c794fa4676 (diff)
WiimoteEmu: Add user-accessible controls that report the desired state of the IR camera objects.
Diffstat (limited to 'Source/Core/InputCommon/ControllerEmu/ControlGroup')
-rw-r--r--Source/Core/InputCommon/ControllerEmu/ControlGroup/ControlGroup.h3
-rw-r--r--Source/Core/InputCommon/ControllerEmu/ControlGroup/IRPassthrough.cpp51
-rw-r--r--Source/Core/InputCommon/ControllerEmu/ControlGroup/IRPassthrough.h23
3 files changed, 76 insertions, 1 deletions
diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/ControlGroup.h b/Source/Core/InputCommon/ControllerEmu/ControlGroup/ControlGroup.h
index f51fff6015..bb426e9297 100644
--- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/ControlGroup.h
+++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/ControlGroup.h
@@ -49,7 +49,8 @@ enum class GroupType
Shake,
IMUAccelerometer,
IMUGyroscope,
- IMUCursor
+ IMUCursor,
+ IRPassthrough,
};
class ControlGroup
diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/IRPassthrough.cpp b/Source/Core/InputCommon/ControllerEmu/ControlGroup/IRPassthrough.cpp
new file mode 100644
index 0000000000..119f9bcb0e
--- /dev/null
+++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/IRPassthrough.cpp
@@ -0,0 +1,51 @@
+// Copyright 2024 Dolphin Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "InputCommon/ControllerEmu/ControlGroup/IRPassthrough.h"
+
+#include <memory>
+#include <string>
+
+#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"
+
+namespace ControllerEmu
+{
+IRPassthrough::IRPassthrough(std::string name_, std::string ui_name_)
+ : ControlGroup(std::move(name_), std::move(ui_name_), GroupType::IRPassthrough,
+ ControlGroup::DefaultValue::Disabled)
+{
+ AddInput(Translatability::Translate, _trans("Object 1 X"));
+ AddInput(Translatability::Translate, _trans("Object 1 Y"));
+ AddInput(Translatability::Translate, _trans("Object 1 Size"));
+ AddInput(Translatability::Translate, _trans("Object 2 X"));
+ AddInput(Translatability::Translate, _trans("Object 2 Y"));
+ AddInput(Translatability::Translate, _trans("Object 2 Size"));
+ AddInput(Translatability::Translate, _trans("Object 3 X"));
+ AddInput(Translatability::Translate, _trans("Object 3 Y"));
+ AddInput(Translatability::Translate, _trans("Object 3 Size"));
+ AddInput(Translatability::Translate, _trans("Object 4 X"));
+ AddInput(Translatability::Translate, _trans("Object 4 Y"));
+ AddInput(Translatability::Translate, _trans("Object 4 Size"));
+}
+
+ControlState IRPassthrough::GetObjectPositionX(size_t object_index) const
+{
+ return controls[object_index * 3 + 0]->GetState();
+}
+
+ControlState IRPassthrough::GetObjectPositionY(size_t object_index) const
+{
+ return controls[object_index * 3 + 1]->GetState();
+}
+
+ControlState IRPassthrough::GetObjectSize(size_t object_index) const
+{
+ return controls[object_index * 3 + 2]->GetState();
+}
+
+} // namespace ControllerEmu
diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/IRPassthrough.h b/Source/Core/InputCommon/ControllerEmu/ControlGroup/IRPassthrough.h
new file mode 100644
index 0000000000..9e6bf9b5bb
--- /dev/null
+++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/IRPassthrough.h
@@ -0,0 +1,23 @@
+// Copyright 2024 Dolphin Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include <string>
+
+#include "InputCommon/ControllerEmu/ControlGroup/ControlGroup.h"
+#include "InputCommon/ControllerEmu/Setting/NumericSetting.h"
+#include "InputCommon/ControllerInterface/CoreDevice.h"
+
+namespace ControllerEmu
+{
+class IRPassthrough : public ControlGroup
+{
+public:
+ IRPassthrough(std::string name, std::string ui_name);
+
+ ControlState GetObjectPositionX(size_t object_index) const;
+ ControlState GetObjectPositionY(size_t object_index) const;
+ ControlState GetObjectSize(size_t object_index) const;
+};
+} // namespace ControllerEmu