UI: Move to ScreenManager for mapping.

Otherwise we'll detect repeated axis for some devices and you won't be
able to map what you want.
This commit is contained in:
Unknown W. Brackets committed 2021-05-23 15:18:21 -07:00
1 parent e1e5a8b49b
commit b0de7ee0e1
4 files changed
+16 -14

No files matched your search

+11
View File
@@ -106,6 +106,17 @@ bool ScreenManager::key(const KeyInput &key) {
bool ScreenManager::axis(const AxisInput &axis) {
std::lock_guard<std::recursive_mutex> guard(inputLock_);
// Ignore duplicate values to prevent axis values overwriting each other.
uint64_t key = ((uint64_t)axis.axisId << 32) | axis.deviceId;
// Center value far from zero just to ensure we send the first zero.
// PSP games can't see higher resolution than this.
int value = 128 + ceilf(axis.value * 127.5f + 127.5f);
if (lastAxis_[key] == value) {
return false;
}
lastAxis_[key] = value;
bool result = false;
// Send center axis to every screen layer.
if (axis.value == 0) {