Fix controller packet loss when zeroing analog sticks on OSC

This commit is contained in:
Cameron Gutman 2018-11-25 15:02:32 -08:00
parent 6adc9dcb2d
commit 7eac0ccaf8
2 changed files with 11 additions and 1 deletions

View File

@ -338,6 +338,16 @@ public class AnalogStick extends VirtualControllerElement {
} else { } else {
stick_state = STICK_STATE.NO_MOVEMENT; stick_state = STICK_STATE.NO_MOVEMENT;
notifyOnRevoke(); notifyOnRevoke();
// HACK: We can sometimes generate back-to-back controller events
// that cause GFE to drop newer data. Dropping zeroing events would
// be disastrous because we may not get a follow-up joystick event to
// correct the dropped zeroing packet. Delay 5 ms when raising the
// analog stick to ensure this doesn't happen.
try {
Thread.sleep(5);
} catch (InterruptedException e) {}
// not longer pressed reset analog stick // not longer pressed reset analog stick
notifyOnMovement(0, 0); notifyOnMovement(0, 0);
} }

@ -1 +1 @@
Subproject commit 4f5ce68e8ce2e6e814fa5e7c66cabd4602929993 Subproject commit 1af5c24e56e3d0b4cae477346306075129b8ddf8