mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Control: Change internal interfaces to batch-process input axis updates
These naturally come in bunches on many platforms like Android, so lay some groundwork to also handle them in bunches to minimize locking in the future. Linux buildfix
This commit is contained in:
1 parent
3e6788defe
commit
80a99a67d9
12 files changed
+110
-103
No files matched your search
@@ -218,14 +218,17 @@ void XinputDevice::UpdatePad(int pad, const XINPUT_STATE &state, XINPUT_VIBRATIO
|
||||
ApplyButtons(pad, state);
|
||||
ApplyVibration(pad, vibration);
|
||||
|
||||
AxisInput axis;
|
||||
axis.deviceId = (InputDeviceID)(DEVICE_ID_XINPUT_0 + pad);
|
||||
AxisInput axis[6];
|
||||
int axisCount = 0;
|
||||
for (int i = 0; i < ARRAY_SIZE(axis); i++) {
|
||||
axis[i].deviceId = (InputDeviceID)(DEVICE_ID_XINPUT_0 + pad);
|
||||
}
|
||||
auto sendAxis = [&](InputAxis axisId, float value, int axisIndex) {
|
||||
if (value != prevAxisValue_[pad][axisIndex]) {
|
||||
prevAxisValue_[pad][axisIndex] = value;
|
||||
axis.axisId = axisId;
|
||||
axis.value = value;
|
||||
NativeAxis(axis);
|
||||
axis[axisCount].axisId = axisId;
|
||||
axis[axisCount].value = value;
|
||||
axisCount++;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -242,6 +245,10 @@ void XinputDevice::UpdatePad(int pad, const XINPUT_STATE &state, XINPUT_VIBRATIO
|
||||
sendAxis(JOYSTICK_AXIS_RTRIGGER, (float)state.Gamepad.bRightTrigger / 255.0f, 5);
|
||||
}
|
||||
|
||||
if (axisCount) {
|
||||
NativeAxis(axis, axisCount);
|
||||
}
|
||||
|
||||
prevState[pad] = state;
|
||||
check_delay[pad] = 0;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user