summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Core/InputCommon')
-rw-r--r--Source/Core/InputCommon/CMakeLists.txt2
-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
4 files changed, 78 insertions, 1 deletions
diff --git a/Source/Core/InputCommon/CMakeLists.txt b/Source/Core/InputCommon/CMakeLists.txt
index ed19e12b74..dc4da808a1 100644
--- a/Source/Core/InputCommon/CMakeLists.txt
+++ b/Source/Core/InputCommon/CMakeLists.txt
@@ -37,6 +37,8 @@ add_library(inputcommon
ControllerEmu/ControlGroup/IMUCursor.h
ControllerEmu/ControlGroup/IMUGyroscope.cpp
ControllerEmu/ControlGroup/IMUGyroscope.h
+ ControllerEmu/ControlGroup/IRPassthrough.cpp
+ ControllerEmu/ControlGroup/IRPassthrough.h
ControllerEmu/ControlGroup/MixedTriggers.cpp
ControllerEmu/ControlGroup/MixedTriggers.h
ControllerEmu/ControlGroup/ModifySettingsButton.cpp
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