summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorJMC47 <JMC4789@gmail.com>2025-10-09 14:05:16 -0400
committerGitHub <noreply@github.com>2025-10-09 14:05:16 -0400
commitefa9245565b357060c545edbe39a90476ff76d48 (patch)
tree046a46147ef6574eea1507a1825ae70d3ceab40e /Source
parent1aae1ecbaab3fefd95c36ede1a5f6cfa72c20cd9 (diff)
parent572459bc253c05207509d1c77bd1afc09af90e0a (diff)
Merge pull request #13963 from jordan-woyak/point-passthru-needs-bound-inputs
WiimoteEmu: Require IRPassthrough has any bound inputs to operate.
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp2
-rw-r--r--Source/Core/InputCommon/ControllerEmu/ControlGroup/IRPassthrough.cpp11
-rw-r--r--Source/Core/InputCommon/ControllerEmu/ControlGroup/IRPassthrough.h3
3 files changed, 10 insertions, 6 deletions
diff --git a/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp b/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp
index 75ab7083da..98f52a09f1 100644
--- a/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp
+++ b/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp
@@ -497,7 +497,7 @@ void Wiimote::BuildDesiredWiimoteState(DesiredWiimoteState* target_state,
ConvertAccelData(GetTotalAcceleration(), ACCEL_ZERO_G << 2, ACCEL_ONE_G << 2);
// Calculate IR camera state.
- if (m_ir_passthrough->enabled.GetValue())
+ if (m_ir_passthrough->enabled.GetValue() && m_ir_passthrough->AreInputsBound())
{
target_state->camera_points = GetPassthroughCameraPoints(m_ir_passthrough);
}
diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/IRPassthrough.cpp b/Source/Core/InputCommon/ControllerEmu/ControlGroup/IRPassthrough.cpp
index 119f9bcb0e..14b4151615 100644
--- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/IRPassthrough.cpp
+++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/IRPassthrough.cpp
@@ -3,15 +3,12 @@
#include "InputCommon/ControllerEmu/ControlGroup/IRPassthrough.h"
-#include <memory>
+#include <algorithm>
#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
{
@@ -48,4 +45,10 @@ ControlState IRPassthrough::GetObjectSize(size_t object_index) const
return controls[object_index * 3 + 2]->GetState();
}
+bool IRPassthrough::AreInputsBound() const
+{
+ return std::ranges::any_of(
+ controls, [](const auto& control) { return control->control_ref->BoundCount() > 0; });
+}
+
} // namespace ControllerEmu
diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/IRPassthrough.h b/Source/Core/InputCommon/ControllerEmu/ControlGroup/IRPassthrough.h
index 9e6bf9b5bb..b66fb014c1 100644
--- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/IRPassthrough.h
+++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/IRPassthrough.h
@@ -6,7 +6,6 @@
#include <string>
#include "InputCommon/ControllerEmu/ControlGroup/ControlGroup.h"
-#include "InputCommon/ControllerEmu/Setting/NumericSetting.h"
#include "InputCommon/ControllerInterface/CoreDevice.h"
namespace ControllerEmu
@@ -19,5 +18,7 @@ public:
ControlState GetObjectPositionX(size_t object_index) const;
ControlState GetObjectPositionY(size_t object_index) const;
ControlState GetObjectSize(size_t object_index) const;
+
+ bool AreInputsBound() const;
};
} // namespace ControllerEmu