[+] Win32 USB product id reporting
This commit is contained in:
parent
e4edc29fb3
commit
6b2a2675ee
@ -186,6 +186,8 @@ static GLFWbool loadLibraries(void)
|
|||||||
{
|
{
|
||||||
_glfw.win32.xinput.GetCapabilities = (PFN_XInputGetCapabilities)
|
_glfw.win32.xinput.GetCapabilities = (PFN_XInputGetCapabilities)
|
||||||
_glfwPlatformGetModuleSymbol(_glfw.win32.xinput.instance, "XInputGetCapabilities");
|
_glfwPlatformGetModuleSymbol(_glfw.win32.xinput.instance, "XInputGetCapabilities");
|
||||||
|
_glfw.win32.xinput.GetCapabilitiesEx = (PFN_XInputGetCapabilitiesEx)
|
||||||
|
_glfwPlatformGetModuleSymbol(_glfw.win32.xinput.instance, (char *)108);
|
||||||
_glfw.win32.xinput.GetState = (PFN_XInputGetState)
|
_glfw.win32.xinput.GetState = (PFN_XInputGetState)
|
||||||
_glfwPlatformGetModuleSymbol(_glfw.win32.xinput.instance, "XInputGetState");
|
_glfwPlatformGetModuleSymbol(_glfw.win32.xinput.instance, "XInputGetState");
|
||||||
|
|
||||||
|
@ -534,6 +534,14 @@ void _glfwDetectJoystickConnectionWin32(void)
|
|||||||
|
|
||||||
js->win32.index = index;
|
js->win32.index = index;
|
||||||
|
|
||||||
|
XINPUT_CAPABILITIES_EX ex;
|
||||||
|
if (XInputGetCapabilitiesEx(1, index, 0, &ex) == ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
js->usbInfo.product = ex.productId;
|
||||||
|
js->usbInfo.vendor = ex.vendorId;
|
||||||
|
js->usbInfo.version = ex.revisionId;
|
||||||
|
}
|
||||||
|
|
||||||
_glfwInputJoystick(js, GLFW_CONNECTED);
|
_glfwInputJoystick(js, GLFW_CONNECTED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -524,10 +524,22 @@ typedef enum
|
|||||||
#define ERROR_INVALID_PROFILE_ARB 0x2096
|
#define ERROR_INVALID_PROFILE_ARB 0x2096
|
||||||
#define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054
|
#define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054
|
||||||
|
|
||||||
|
typedef struct XINPUT_CAPABILITIES_EX_S
|
||||||
|
{
|
||||||
|
XINPUT_CAPABILITIES Capabilities;
|
||||||
|
WORD vendorId;
|
||||||
|
WORD productId;
|
||||||
|
WORD revisionId;
|
||||||
|
DWORD a4; //unknown
|
||||||
|
} XINPUT_CAPABILITIES_EX, *XINPUT_CAPABILITIES_EX_p;
|
||||||
|
|
||||||
// xinput.dll function pointer typedefs
|
// xinput.dll function pointer typedefs
|
||||||
typedef DWORD (WINAPI * PFN_XInputGetCapabilities)(DWORD,DWORD,XINPUT_CAPABILITIES*);
|
typedef DWORD(WINAPI *PFN_XInputGetCapabilities)(DWORD, DWORD, XINPUT_CAPABILITIES *);
|
||||||
|
typedef DWORD(WINAPI *PFN_XInputGetCapabilitiesEx)(DWORD, DWORD, DWORD, XINPUT_CAPABILITIES_EX_p);
|
||||||
|
|
||||||
typedef DWORD (WINAPI * PFN_XInputGetState)(DWORD,XINPUT_STATE*);
|
typedef DWORD (WINAPI * PFN_XInputGetState)(DWORD,XINPUT_STATE*);
|
||||||
#define XInputGetCapabilities _glfw.win32.xinput.GetCapabilities
|
#define XInputGetCapabilities _glfw.win32.xinput.GetCapabilities
|
||||||
|
#define XInputGetCapabilitiesEx _glfw.win32.xinput.GetCapabilitiesEx
|
||||||
#define XInputGetState _glfw.win32.xinput.GetState
|
#define XInputGetState _glfw.win32.xinput.GetState
|
||||||
|
|
||||||
// dinput8.dll function pointer typedefs
|
// dinput8.dll function pointer typedefs
|
||||||
@ -750,6 +762,7 @@ typedef struct _GLFWlibraryWin32
|
|||||||
struct {
|
struct {
|
||||||
HINSTANCE instance;
|
HINSTANCE instance;
|
||||||
PFN_XInputGetCapabilities GetCapabilities;
|
PFN_XInputGetCapabilities GetCapabilities;
|
||||||
|
PFN_XInputGetCapabilitiesEx GetCapabilitiesEx;
|
||||||
PFN_XInputGetState GetState;
|
PFN_XInputGetState GetState;
|
||||||
} xinput;
|
} xinput;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user