Finished implementation of "vigem_target_x360_get_user_index"

This commit is contained in:
Benjamin Höglinger-Stelzer
2018-09-23 14:58:25 +02:00
parent a49b1ac113
commit bc722fec5f
2 changed files with 14 additions and 8 deletions

View File

@@ -23,8 +23,13 @@ SOFTWARE.
*/
//
// GUID identifying the bus device. Used by client library to detect and communicate.
//
// IMPORTANT: make sure to change this value if you fork it or introduce
// breaking changes!
//
// {96E42B22-F5E9-42F8-B043-ED0F932F014F}
// ReSharper disable once CppMissingIncludeGuard
DEFINE_GUID(GUID_DEVINTERFACE_BUSENUM_VIGEM,
0x96E42B22, 0xF5E9, 0x42F8, 0xB0, 0x43, 0xED, 0x0F, 0x93, 0x2F, 0x01, 0x4F);
@@ -41,7 +46,7 @@ DEFINE_GUID(GUID_DEVINTERFACE_BUSENUM_VIGEM,
// access is permitted and success reported. If they mismatch, an
// error is reported and the user-mode library skips this instance.
//
#define VIGEM_COMMON_VERSION 0x0001
#define VIGEM_COMMON_VERSION 0x0002
#define FILE_DEVICE_BUSENUM FILE_DEVICE_BUS_EXTENDER
#define BUSENUM_IOCTL(_index_) CTL_CODE(FILE_DEVICE_BUSENUM, _index_, METHOD_BUFFERED, FILE_READ_DATA)

View File

@@ -35,6 +35,8 @@ SOFTWARE.
#include <climits>
#include <mutex>
#include <iostream>
#define VIGEM_TARGETS_MAX USHRT_MAX
//
@@ -778,12 +780,11 @@ VIGEM_ERROR vigem_target_x360_get_user_index(
return VIGEM_ERROR_INVALID_TARGET;
}
// TODO: handle userindex out-of-range situation here
//if (error == ???)
//{
// CloseHandle(lOverlapped.hEvent);
// return VIGEM_ERROR_XUSB_USERINDEX_OUT_OF_RANGE;
//}
if (error == ERROR_INVALID_DEVICE_OBJECT_PARAMETER)
{
CloseHandle(lOverlapped.hEvent);
return VIGEM_ERROR_XUSB_USERINDEX_OUT_OF_RANGE;
}
}
CloseHandle(lOverlapped.hEvent);