This repository was archived by the owner on Sep 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 89
This repository was archived by the owner on Sep 8, 2023. It is now read-only.
vigem_target_x360_get_user_index returns wrong user index #31
Copy link
Copy link
Open
Description
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.
int main()
{
auto* client = vigem_alloc();
if (!client) {
cout << "Allocate client failed." << endl;
return -1;
}
auto ret = vigem_connect(client);
if (!VIGEM_SUCCESS(ret)) {
cout << "Connect failed" << endl;
vigem_free(client);
return -1;
}
for (size_t i = 0; i < XUSER_MAX_COUNT; i++) {
auto* xbox360 = vigem_target_x360_alloc();
if (!xbox360) {
cout << "Allocate xbox360 #" << i << " failed." << endl;
continue;
}
ret = vigem_target_add(client, xbox360);
if (!VIGEM_SUCCESS(ret)) {
cout << "Add xbox360 #" << i << " failed." << endl;
vigem_target_free(xbox360);
continue;
}
ULONG index = 0xff;
ret = vigem_target_x360_get_user_index(client, xbox360, &index);
if (!VIGEM_SUCCESS(ret)) {
cout << "Get user index #" << i << " failed." << endl;
vigem_target_remove(client, xbox360);
vigem_target_free(xbox360);
continue;
}
cout << "#" << i << ": user index: " << index << endl;
index = vigem_target_get_index(xbox360);
cout << "#" << i << ": serial number: " << index << endl;
}
vigem_disconnect(client);
vigem_free(client);
return 0;
}
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
System details (please complete the following information):
- OS: Windows 10 pro 19044.3086
- Feeder software: ViGEmBus, download from https://github.com/ViGEm/ViGEmBus/releases/tag/v1.21.442.0
- Driver Version: 1.21.442.0
Additional context
Add any other context about the problem here.
Metadata
Metadata
Assignees
Labels
No labels
