Open stephen9357 opened 1 year ago
This function never really was very reliable, it's timing sensitive due to the now aged code base that never really supported capturing the player index.
Here's a primitive test: add like a sleep 500 or greater after the plugin call and see if that changes things.
add like a sleep 500 or greater after the plugin call and see if that changes things.
Thanks for your reply, it does't works. I add std::this_thread::sleep_for(std::chrono::seconds(10)); and XInputGetState before call vigem_target_x360_get_user_index, still returns 0.
OK, hm, please subscribe to a EVT_VIGEM_X360_NOTIFICATION and print the LedNumber.
subscribe to a EVT_VIGEM_X360_NOTIFICATION and print the LedNumber.
Thanks you very much, it works perfectly.
subscribe to a EVT_VIGEM_X360_NOTIFICATION and print the LedNumber.
Thanks you very much, it works perfectly.
Great to hear! I guess figuring out what's wrong with the vigem_target_x360_get_user_index
is still open, will leave the issue as a reminder for 2027 😬
Hi,
Strangely, and FWIW, vigem_target_x360_get_user_index()
is working properly for me.
I haven't tried the repro example in the OP here (yet), but essentially I'm using it the same way -- vigem_target_x360_alloc()
then vigem_target_add()
and then get the LED number. The obvious differences are that:
vigem_target_get_index()
first, before vigem_target_x360_get_user_index()
(I also call vigem_target_get_vid()
and vigem_target_get_pid()
first).(The full code is in here.)
I was a bit surprised when the resulting "user index" is zero-based, but it does increment for each new device, so I guess that's right.
Similar specs to the OP...
LMK if any other details or info would be helpful.
Thanks for ViGEm!
-Max
Describe the bug Create and add four x360 devices to the bus, call vigem_target_x360_get_user_index to query the user index, it always returns 0.
To Reproduce Steps to reproduce the behavior (example): Compile and run this code.
Expected behavior Output as below.
0: user index: 0
0: serial number: 1
1: user index: 1
1: serial number: 2
2: user index: 2
2: serial number: 3
3: user index: 3
3: serial number: 4
Screenshots![image](https://github.com/ViGEm/ViGEmClient/assets/17269409/d8d2537c-3c84-4337-9c9f-d829a7aef332)
System details (please complete the following information):
Additional context Add any other context about the problem here.