diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUAccelerometer.cpp b/Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUAccelerometer.cpp index 1e23c5dffe..ef9f519633 100644 --- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUAccelerometer.cpp +++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUAccelerometer.cpp @@ -4,13 +4,12 @@ #include "InputCommon/ControllerEmu/ControlGroup/IMUAccelerometer.h" +#include #include #include "Common/Common.h" #include "Core/HW/WiimoteEmu/WiimoteEmu.h" -#include "InputCommon/ControlReference/ControlReference.h" #include "InputCommon/ControllerEmu/Control/Control.h" -#include "InputCommon/ControllerEmu/Control/Input.h" namespace ControllerEmu { @@ -25,9 +24,15 @@ IMUAccelerometer::IMUAccelerometer(std::string name_, std::string ui_name_) AddInput(Translate, _trans("Backward")); } +bool IMUAccelerometer::AreInputsBound() const +{ + return std::all_of(controls.begin(), controls.end(), + [](const auto& control) { return control->control_ref->BoundCount() > 0; }); +} + std::optional IMUAccelerometer::GetState() const { - if (controls[0]->control_ref->BoundCount() == 0) + if (!AreInputsBound()) return std::nullopt; StateData state; diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUAccelerometer.h b/Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUAccelerometer.h index b5d8e0c935..57fa4ea0b6 100644 --- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUAccelerometer.h +++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUAccelerometer.h @@ -20,5 +20,7 @@ public: IMUAccelerometer(std::string name, std::string ui_name); std::optional GetState() const; + + bool AreInputsBound() const; }; } // namespace ControllerEmu