Skip to content

Commit

Permalink
Remove the axis event filtering from Screen.cpp again. See #18368
Browse files Browse the repository at this point in the history
  • Loading branch information
hrydgard committed Nov 16, 2023
1 parent 4be1706 commit 211c23e
Showing 1 changed file with 2 additions and 21 deletions.
23 changes: 2 additions & 21 deletions Common/UI/Screen.cpp
Expand Up @@ -119,27 +119,8 @@ bool ScreenManager::key(const KeyInput &key) {

void ScreenManager::axis(const AxisInput *axes, size_t count) {
std::lock_guard<std::recursive_mutex> guard(inputLock_);

for (size_t i = 0; i < count; i++) {
const AxisInput &axis = axes[i];
// 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;
}
lastAxis_[key] = value;

// Send center axis to every screen layer.
if (axis.value == 0) {
for (auto &layer : stack_) {
layer.screen->UnsyncAxis(&axis, 1);
}
} else if (!stack_.empty()) {
stack_.back().screen->UnsyncAxis(&axis, 1);
}
if (!stack_.empty()) {
stack_.back().screen->UnsyncAxis(axes, count);
}
}

Expand Down

0 comments on commit 211c23e

Please sign in to comment.