summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUAccelerometer.cpp
diff options
context:
space:
mode:
authorFiloppi <filippotarpini@hotmail.it>2021-05-04 23:58:08 +0300
committerFiloppi <filippotarpini@hotmail.it>2021-05-19 20:51:34 +0300
commitd43a06ff6ad713f25b6b80ad6dc4bba8e003db04 (patch)
tree65fb498fc36cd4220f831aa4ddea8cf88651592f /Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUAccelerometer.cpp
parent7f5b6ed788afce17622b8d61dad8a267ac170b53 (diff)
IMUAccelerometer: consistency of BoundCount checks
Similar to the guitar, only control[0] was checked, and that felt random.
Diffstat (limited to 'Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUAccelerometer.cpp')
-rw-r--r--Source/Core/InputCommon/ControllerEmu/ControlGroup/IMUAccelerometer.cpp11
1 files changed, 8 insertions, 3 deletions
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 <algorithm>
#include <memory>
#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::StateData> IMUAccelerometer::GetState() const
{
- if (controls[0]->control_ref->BoundCount() == 0)
+ if (!AreInputsBound())
return std::nullopt;
StateData state;