zoeyjodon / SoftWing

9 stars 0 forks source link

Analog stick hangs up when used with other keys #2

Open Moterrola opened 2 years ago

Moterrola commented 2 years ago

I noticed this behavior in PPSSPP, I must admit I didn't test it in any other app. When I move the left analog stick and press any other button without releasing it, it gets stuck in random position. To reproduce: -I configured all the buttons as "tap", left analog as "swipe" witch touch start at the center of analog and touch end at its edge; -In game I press and hold a button (say, right bumper) and manipulate with left analog stick; -After releasing the stick, it gets stuck as well as the bumper button. It might sound a little sophisticated, but it's easily noticeable in racing games, such as Motorstorm Arctic Edge.

zoeyjodon commented 2 years ago

Does the SoftWing analog stick still move? Or is it stuck there too? I have noticed that, with some emulators, the touch controls will sometimes stick in the emulator even though the controls in SoftWing are still performing as expected. This seems to have something to do with how motion events are being handled in these apps, and how SoftWing has to emulate touch input.

Android's accessibility service will allow multiple touch actions to be executed at once, but if you try adding a new touch gesture while another gesture is already running, the new gesture will stop the running gesture. This means that, in order to handle new controller inputs, SoftWing has to start a new touch gesture containing all of the button presses and joystick movements at the same time. Some emulators appear to have trouble handling multiple changes to touch inputs that happen simultaneously, resulting in buttons "sticking". I have tried experimenting with staggering the timing of the gestures, but that tends to result in the controller being annoyingly unresponsive.

Assuming that you are using the latest version of SoftWing, you should be able to confirm this behavior by enabling "Show taps" in your device's developer options. I was able con verify on my end that touch events are happening when and where they are supposed to, even when the controls in the emulator get stuck.

TLDR: Because of how the Accessibility service works, SoftWing has to perform touch actions all at the same time which is not always handled well by emulators. I'm not sure that there is a way to prevent this bug from SoftWing's end without introducing significant lag.