mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-12-04 16:57:04 +00:00
IMUAccelerometer: consistency of BoundCount checks
Similar to the guitar, only control[0] was checked, and that felt random.
This commit is contained in:
parent
7f5b6ed788
commit
d43a06ff6a
@ -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;
|
||||
|
@ -20,5 +20,7 @@ public:
|
||||
IMUAccelerometer(std::string name, std::string ui_name);
|
||||
|
||||
std::optional<StateData> GetState() const;
|
||||
|
||||
bool AreInputsBound() const;
|
||||
};
|
||||
} // namespace ControllerEmu
|
||||
|
Loading…
Reference in New Issue
Block a user