Bring back zeroing of the opposite direction.
This commit is contained in:
parent
fa0fb6eee6
commit
88e89653b1
1 changed files with 11 additions and 1 deletions
|
@ -11,7 +11,7 @@
|
||||||
#include "Core/CoreParameter.h"
|
#include "Core/CoreParameter.h"
|
||||||
#include "Core/System.h"
|
#include "Core/System.h"
|
||||||
|
|
||||||
// TODO: Possibly make these configurable?
|
// TODO: Possibly make these thresholds configurable?
|
||||||
static float GetDeviceAxisThreshold(int device) {
|
static float GetDeviceAxisThreshold(int device) {
|
||||||
return device == DEVICE_ID_MOUSE ? AXIS_BIND_THRESHOLD_MOUSE : AXIS_BIND_THRESHOLD;
|
return device == DEVICE_ID_MOUSE ? AXIS_BIND_THRESHOLD_MOUSE : AXIS_BIND_THRESHOLD;
|
||||||
}
|
}
|
||||||
|
@ -190,6 +190,7 @@ bool ControlMapper::UpdatePSPState(const InputMapping &changedMapping) {
|
||||||
// mapping which gets a little hacky.
|
// mapping which gets a little hacky.
|
||||||
float threshold = 1.0f;
|
float threshold = 1.0f;
|
||||||
bool touchedByMapping = false;
|
bool touchedByMapping = false;
|
||||||
|
bool zeroOpposite = false;
|
||||||
float value = 0.0f;
|
float value = 0.0f;
|
||||||
for (auto &mapping : inputMappings) {
|
for (auto &mapping : inputMappings) {
|
||||||
if (mapping == changedMapping) {
|
if (mapping == changedMapping) {
|
||||||
|
@ -200,6 +201,7 @@ bool ControlMapper::UpdatePSPState(const InputMapping &changedMapping) {
|
||||||
if (iter != curInput_.end()) {
|
if (iter != curInput_.end()) {
|
||||||
if (mapping.IsAxis()) {
|
if (mapping.IsAxis()) {
|
||||||
threshold = GetDeviceAxisThreshold(iter->first.deviceId);
|
threshold = GetDeviceAxisThreshold(iter->first.deviceId);
|
||||||
|
zeroOpposite = true;
|
||||||
}
|
}
|
||||||
value += iter->second;
|
value += iter->second;
|
||||||
}
|
}
|
||||||
|
@ -219,6 +221,14 @@ bool ControlMapper::UpdatePSPState(const InputMapping &changedMapping) {
|
||||||
onVKeyAnalog(changedMapping.deviceId, vkId, value);
|
onVKeyAnalog(changedMapping.deviceId, vkId, value);
|
||||||
virtKeys_[i] = value;
|
virtKeys_[i] = value;
|
||||||
}
|
}
|
||||||
|
if (zeroOpposite) {
|
||||||
|
// For analog stick events, always zero the "opposite" when we get a valid value.
|
||||||
|
// Otherwise, lingering small values can create strange offsets when summing up later.
|
||||||
|
int opposite = GetOppositeVKey(vkId);
|
||||||
|
if (opposite) {
|
||||||
|
virtKeys_[i] = 0.0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!bPrevValue && bValue) {
|
if (!bPrevValue && bValue) {
|
||||||
// INFO_LOG(G3D, "vkeyon %s", KeyMap::GetVirtKeyName(vkId));
|
// INFO_LOG(G3D, "vkeyon %s", KeyMap::GetVirtKeyName(vkId));
|
||||||
onVKey(vkId, true);
|
onVKey(vkId, true);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue