xfangfang / borealis

Hardware accelerated, Nintendo Switch inspired UI library for PC, Android, iOS, PSV, PS4 and Nintendo Switch
Apache License 2.0
31 stars 21 forks source link

Fix for wrong controllers count after reconnection #77

Closed XITRIX closed 6 months ago

XITRIX commented 6 months ago

Just as note, there still is a problem with controllers indexes in case Switch has blank space in controllers.

Steps to reproduce:

I.E. my Moonlight app get amount of controllers and get "2"

I iterate this amount using iterator as controller index, 0 gets handheld controller, but index 1 will try to get data from detached first controller, and I will never try to get data from controller 2

As an idea, we could iterate throw all controllers, and if we see detached controller increment requested index, so if we request controller by index 1, and we have (handheld, 1 blank, 2 blank, 3 attached) so we should do index+2 and get result index as 3