Update ViGEm

UWP_Overlay-legacy
Peter Repukat 7 years ago
parent 7ba5efb639
commit a616ddaedd

@ -24,6 +24,7 @@ SOFTWARE.
// {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);
@ -37,6 +38,17 @@ DEFINE_GUID(GUID_DEVCLASS_VIGEM_RAWPDO,
#pragma once
//
// Common version for user-mode library and driver compatibility
//
// On initialization, the user-mode library has this number embedded
// and sends it to the bus on its enumeration. The bus compares this
// number to the one it was compiled with. If they match, the bus
// 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 FILE_DEVICE_BUSENUM FILE_DEVICE_BUS_EXTENDER
#define BUSENUM_IOCTL(_index_) CTL_CODE(FILE_DEVICE_BUSENUM, _index_, METHOD_BUFFERED, FILE_READ_DATA)
#define BUSENUM_W_IOCTL(_index_) CTL_CODE(FILE_DEVICE_BUSENUM, _index_, METHOD_BUFFERED, FILE_WRITE_DATA)
@ -50,6 +62,7 @@ DEFINE_GUID(GUID_DEVCLASS_VIGEM_RAWPDO,
//
#define IOCTL_VIGEM_PLUGIN_TARGET BUSENUM_W_IOCTL (IOCTL_VIGEM_BASE + 0x000)
#define IOCTL_VIGEM_UNPLUG_TARGET BUSENUM_W_IOCTL (IOCTL_VIGEM_BASE + 0x001)
#define IOCTL_VIGEM_CHECK_VERSION BUSENUM_W_IOCTL (IOCTL_VIGEM_BASE + 0x002)
#define IOCTL_XUSB_REQUEST_NOTIFICATION BUSENUM_RW_IOCTL(IOCTL_VIGEM_BASE + 0x200)
#define IOCTL_XUSB_SUBMIT_REPORT BUSENUM_W_IOCTL (IOCTL_VIGEM_BASE + 0x201)
@ -58,8 +71,6 @@ DEFINE_GUID(GUID_DEVCLASS_VIGEM_RAWPDO,
#define IOCTL_XGIP_SUBMIT_REPORT BUSENUM_W_IOCTL (IOCTL_VIGEM_BASE + 0x204)
#define IOCTL_XGIP_SUBMIT_INTERRUPT BUSENUM_W_IOCTL (IOCTL_VIGEM_BASE + 0x205)
#define VIGEM_COMMON_VERSION 0x01
#define VIGEM_INTERFACE_STANDARD_VERSION 0x02
//
// Data structure used in PlugIn and UnPlug ioctls
@ -557,4 +568,22 @@ VOID FORCEINLINE XGIP_SUBMIT_INTERRUPT_INIT(
Report->SerialNo = SerialNo;
}
typedef struct _VIGEM_CHECK_VERSION
{
IN ULONG Size;
IN ULONG Version;
} VIGEM_CHECK_VERSION, *PVIGEM_CHECK_VERSION;
VOID FORCEINLINE VIGEM_CHECK_VERSION_INIT(
_Out_ PVIGEM_CHECK_VERSION CheckVersion,
_In_ ULONG Version
)
{
RtlZeroMemory(CheckVersion, sizeof(VIGEM_CHECK_VERSION));
CheckVersion->Size = sizeof(VIGEM_CHECK_VERSION);
CheckVersion->Version = Version;
}

@ -23,12 +23,14 @@ SOFTWARE.
*/
// ReSharper disable CppMissingIncludeGuard
#ifdef _MSC_VER
// ReSharper restore CppMissingIncludeGuard
#pragma once
#endif
#include <initguid.h>
#include <public.h>
#include <ViGEmBusShared.h>
#ifdef VIGEM_EXPORTS
#define VIGEM_API __declspec(dllexport)
@ -36,28 +38,30 @@ SOFTWARE.
#define VIGEM_API __declspec(dllimport)
#endif
#define VIGEM_TARGETS_MAX 4
#define VIGEM_TARGETS_MAX 0xFF
typedef enum _VIGEM_ERRORS
{
VIGEM_ERROR_NONE = 0x0000,
VIGEM_ERROR_BUS_NOT_FOUND,
VIGEM_ERROR_NO_FREE_SLOT,
VIGEM_ERROR_INVALID_TARGET,
VIGEM_ERROR_REMOVAL_FAILED,
VIGEM_ERROR_ALREADY_CONNECTED,
VIGEM_ERROR_TARGET_UNINITIALIZED,
VIGEM_ERROR_TARGET_NOT_PLUGGED_IN
VIGEM_ERROR_NONE = 0x20000000,
VIGEM_ERROR_BUS_NOT_FOUND = 0xE0000001,
VIGEM_ERROR_NO_FREE_SLOT = 0xE0000002,
VIGEM_ERROR_INVALID_TARGET = 0xE0000003,
VIGEM_ERROR_REMOVAL_FAILED = 0xE0000004,
VIGEM_ERROR_ALREADY_CONNECTED = 0xE0000005,
VIGEM_ERROR_TARGET_UNINITIALIZED = 0xE0000006,
VIGEM_ERROR_TARGET_NOT_PLUGGED_IN = 0xE0000007,
VIGEM_ERROR_BUS_VERSION_MISMATCH = 0xE0000008,
VIGEM_ERROR_BUS_ACCESS_FAILED = 0xE0000009
} VIGEM_ERROR;
#define VIGEM_SUCCESS(_val_) (_val_ == VIGEM_ERROR_NONE)
typedef enum _VIGEM_TARGET_STATE
{
VigemTargetNew,
VigemTargetInitialized,
VigemTargetConnected,
VigemTargetDisconnected
VIGEM_TARGET_NEW,
VIGEM_TARGET_INITIALIZED,
VIGEM_TARGET_CONNECTED,
VIGEM_TARGET_DISCONNECTED
} VIGEM_TARGET_STATE, *PVIGEM_TARGET_STATE;
//
@ -66,9 +70,10 @@ typedef enum _VIGEM_TARGET_STATE
typedef struct _VIGEM_TARGET
{
IN ULONG Size;
IN USHORT Version;
IN ULONG SerialNo;
IN VIGEM_TARGET_STATE State;
IN USHORT VendorId;
IN USHORT ProductId;
} VIGEM_TARGET, *PVIGEM_TARGET;
//
@ -81,8 +86,7 @@ VOID FORCEINLINE VIGEM_TARGET_INIT(
RtlZeroMemory(Target, sizeof(VIGEM_TARGET));
Target->Size = sizeof(VIGEM_TARGET);
Target->Version = VIGEM_COMMON_VERSION;
Target->State = VigemTargetInitialized;
Target->State = VIGEM_TARGET_INITIALIZED;
}
typedef VOID(CALLBACK* PVIGEM_XUSB_NOTIFICATION)(
@ -134,6 +138,14 @@ extern "C"
_In_ VIGEM_TARGET Target,
_In_ XGIP_REPORT Report);
VIGEM_API VOID vigem_target_set_vid(
_Out_ PVIGEM_TARGET Target,
_In_ USHORT VendorId);
VIGEM_API VOID vigem_target_set_pid(
_Out_ PVIGEM_TARGET Target,
_In_ USHORT ProductId);
#ifdef __cplusplus
}
#endif

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.
Loading…
Cancel
Save