diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..ea63b40 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "client"] + path = client + url = https://github.com/ViGEm/ViGEmClient.git diff --git a/client b/client new file mode 160000 index 0000000..14011d6 --- /dev/null +++ b/client @@ -0,0 +1 @@ +Subproject commit 14011d6794fc364a430eb88ccf291cf07ee9ccce diff --git a/include/ViGEmBusShared.h b/include/ViGEmBusShared.h deleted file mode 100644 index 941da48..0000000 --- a/include/ViGEmBusShared.h +++ /dev/null @@ -1,493 +0,0 @@ -/* -MIT License - -Copyright (c) 2016 Benjamin "Nefarius" Höglinger - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -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); - -#pragma once - -#include "ViGEmCommon.h" - -// -// 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) -#define BUSENUM_R_IOCTL(_index_) CTL_CODE(FILE_DEVICE_BUSENUM, _index_, METHOD_BUFFERED, FILE_READ_DATA) -#define BUSENUM_RW_IOCTL(_index_) CTL_CODE(FILE_DEVICE_BUSENUM, _index_, METHOD_BUFFERED, FILE_WRITE_DATA | FILE_READ_DATA) - -#define IOCTL_VIGEM_BASE 0x801 - -// -// IO control codes -// -#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) -#define IOCTL_DS4_SUBMIT_REPORT BUSENUM_W_IOCTL (IOCTL_VIGEM_BASE + 0x202) -#define IOCTL_DS4_REQUEST_NOTIFICATION BUSENUM_W_IOCTL (IOCTL_VIGEM_BASE + 0x203) -#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 IOCTL_XUSB_GET_USER_INDEX BUSENUM_RW_IOCTL(IOCTL_VIGEM_BASE + 0x206) - - -// -// Data structure used in PlugIn and UnPlug ioctls -// - -#pragma region Plugin - -// -// Data structure used in IOCTL_VIGEM_PLUGIN_TARGET requests. -// -typedef struct _VIGEM_PLUGIN_TARGET -{ - // - // sizeof (struct _BUSENUM_HARDWARE) - // - IN ULONG Size; - - // - // Serial number of target device. - // - IN ULONG SerialNo; - - // - // Type of the target device to emulate. - // - VIGEM_TARGET_TYPE TargetType; - - // - // If set, the vendor ID the emulated device is reporting - // - USHORT VendorId; - - // - // If set, the product ID the emulated device is reporting - // - USHORT ProductId; - -} VIGEM_PLUGIN_TARGET, *PVIGEM_PLUGIN_TARGET; - -// -// Initializes a VIGEM_PLUGIN_TARGET structure. -// -VOID FORCEINLINE VIGEM_PLUGIN_TARGET_INIT( - _Out_ PVIGEM_PLUGIN_TARGET PlugIn, - _In_ ULONG SerialNo, - _In_ VIGEM_TARGET_TYPE TargetType -) -{ - RtlZeroMemory(PlugIn, sizeof(VIGEM_PLUGIN_TARGET)); - - PlugIn->Size = sizeof(VIGEM_PLUGIN_TARGET); - PlugIn->SerialNo = SerialNo; - PlugIn->TargetType = TargetType; -} - -#pragma endregion - -#pragma region Unplug - -// -// Data structure used in IOCTL_VIGEM_UNPLUG_TARGET requests. -// -typedef struct _VIGEM_UNPLUG_TARGET -{ - // - // sizeof (struct _REMOVE_HARDWARE) - // - IN ULONG Size; - - // - // Serial number of target device. - // - ULONG SerialNo; - -} VIGEM_UNPLUG_TARGET, *PVIGEM_UNPLUG_TARGET; - -// -// Initializes a VIGEM_UNPLUG_TARGET structure. -// -VOID FORCEINLINE VIGEM_UNPLUG_TARGET_INIT( - _Out_ PVIGEM_UNPLUG_TARGET UnPlug, - _In_ ULONG SerialNo -) -{ - RtlZeroMemory(UnPlug, sizeof(VIGEM_UNPLUG_TARGET)); - - UnPlug->Size = sizeof(VIGEM_UNPLUG_TARGET); - UnPlug->SerialNo = SerialNo; -} - -#pragma endregion - -#pragma region Check version - -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; -} - -#pragma endregion - -#pragma region XUSB (aka Xbox 360 device) section - -// -// Data structure used in IOCTL_XUSB_REQUEST_NOTIFICATION requests. -// -typedef struct _XUSB_REQUEST_NOTIFICATION -{ - // - // sizeof(struct _XUSB_REQUEST_NOTIFICATION) - // - ULONG Size; - - // - // Serial number of target device. - // - ULONG SerialNo; - - // - // Vibration intensity value of the large motor (0-255). - // - UCHAR LargeMotor; - - // - // Vibration intensity value of the small motor (0-255). - // - UCHAR SmallMotor; - - // - // Index number of the slot/LED that XUSB.sys has assigned. - // - UCHAR LedNumber; - -} XUSB_REQUEST_NOTIFICATION, *PXUSB_REQUEST_NOTIFICATION; - -// -// Initializes a XUSB_REQUEST_NOTIFICATION structure. -// -VOID FORCEINLINE XUSB_REQUEST_NOTIFICATION_INIT( - _Out_ PXUSB_REQUEST_NOTIFICATION Request, - _In_ ULONG SerialNo -) -{ - RtlZeroMemory(Request, sizeof(XUSB_REQUEST_NOTIFICATION)); - - Request->Size = sizeof(XUSB_REQUEST_NOTIFICATION); - Request->SerialNo = SerialNo; -} - -// -// Data structure used in IOCTL_XUSB_SUBMIT_REPORT requests. -// -typedef struct _XUSB_SUBMIT_REPORT -{ - // - // sizeof(struct _XUSB_SUBMIT_REPORT) - // - ULONG Size; - - // - // Serial number of target device. - // - ULONG SerialNo; - - // - // Report to submit to the target device. - // - XUSB_REPORT Report; - -} XUSB_SUBMIT_REPORT, *PXUSB_SUBMIT_REPORT; - -// -// Initializes an XUSB report. -// -VOID FORCEINLINE XUSB_SUBMIT_REPORT_INIT( - _Out_ PXUSB_SUBMIT_REPORT Report, - _In_ ULONG SerialNo -) -{ - RtlZeroMemory(Report, sizeof(XUSB_SUBMIT_REPORT)); - - Report->Size = sizeof(XUSB_SUBMIT_REPORT); - Report->SerialNo = SerialNo; -} - -typedef struct _XUSB_GET_USER_INDEX -{ - // - // sizeof(struct _XUSB_GET_USER_INDEX) - // - ULONG Size; - - // - // Serial number of target device. - // - ULONG SerialNo; - - // - // User index of target device. - // - OUT ULONG UserIndex; - -} XUSB_GET_USER_INDEX, *PXUSB_GET_USER_INDEX; - -// -// Initializes XUSB_GET_USER_INDEX structure. -// -VOID FORCEINLINE XUSB_GET_USER_INDEX_INIT( - _Out_ PXUSB_GET_USER_INDEX GetRequest, - _In_ ULONG SerialNo -) -{ - RtlZeroMemory(GetRequest, sizeof(XUSB_GET_USER_INDEX)); - - GetRequest->Size = sizeof(XUSB_GET_USER_INDEX); - GetRequest->SerialNo = SerialNo; -} - -#pragma endregion - -#pragma region DualShock 4 section - -typedef struct _DS4_OUTPUT_REPORT -{ - // - // Vibration intensity value of the small motor (0-255). - // - UCHAR SmallMotor; - - // - // Vibration intensity value of the large motor (0-255). - // - UCHAR LargeMotor; - - // - // Color values of the Lightbar. - // - DS4_LIGHTBAR_COLOR LightbarColor; - -} DS4_OUTPUT_REPORT, *PDS4_OUTPUT_REPORT; - -// -// Data structure used in IOCTL_DS4_REQUEST_NOTIFICATION requests. -// -typedef struct _DS4_REQUEST_NOTIFICATION -{ - // - // sizeof(struct _XUSB_REQUEST_NOTIFICATION) - // - ULONG Size; - - // - // Serial number of target device. - // - ULONG SerialNo; - - // - // The HID output report - // - DS4_OUTPUT_REPORT Report; - -} DS4_REQUEST_NOTIFICATION, *PDS4_REQUEST_NOTIFICATION; - -// -// Initializes a DS4_REQUEST_NOTIFICATION structure. -// -VOID FORCEINLINE DS4_REQUEST_NOTIFICATION_INIT( - _Out_ PDS4_REQUEST_NOTIFICATION Request, - _In_ ULONG SerialNo -) -{ - RtlZeroMemory(Request, sizeof(DS4_REQUEST_NOTIFICATION)); - - Request->Size = sizeof(DS4_REQUEST_NOTIFICATION); - Request->SerialNo = SerialNo; -} - -// -// DualShock 4 request data -// -typedef struct _DS4_SUBMIT_REPORT -{ - // - // sizeof(struct _DS4_SUBMIT_REPORT) - // - ULONG Size; - - // - // Serial number of target device. - // - ULONG SerialNo; - - // - // HID Input report - // - DS4_REPORT Report; - -} DS4_SUBMIT_REPORT, *PDS4_SUBMIT_REPORT; - -// -// Initializes a DualShock 4 report. -// -VOID FORCEINLINE DS4_SUBMIT_REPORT_INIT( - _Out_ PDS4_SUBMIT_REPORT Report, - _In_ ULONG SerialNo -) -{ - RtlZeroMemory(Report, sizeof(DS4_SUBMIT_REPORT)); - - Report->Size = sizeof(DS4_SUBMIT_REPORT); - Report->SerialNo = SerialNo; - - DS4_REPORT_INIT(&Report->Report); -} - -#pragma endregion - -#pragma region XGIP (aka Xbox One device) section - EXPERIMENTAL - -typedef struct _XGIP_REPORT -{ - UCHAR Buttons1; - UCHAR Buttons2; - SHORT LeftTrigger; - SHORT RightTrigger; - SHORT ThumbLX; - SHORT ThumbLY; - SHORT ThumbRX; - SHORT ThumbRY; - -} XGIP_REPORT, *PXGIP_REPORT; - -// -// Xbox One request data -// -typedef struct _XGIP_SUBMIT_REPORT -{ - // - // sizeof(struct _XGIP_SUBMIT_REPORT) - // - ULONG Size; - - // - // Serial number of target device. - // - ULONG SerialNo; - - // - // HID Input report - // - XGIP_REPORT Report; - -} XGIP_SUBMIT_REPORT, *PXGIP_SUBMIT_REPORT; - -// -// Initializes an Xbox One report. -// -VOID FORCEINLINE XGIP_SUBMIT_REPORT_INIT( - _Out_ PXGIP_SUBMIT_REPORT Report, - _In_ ULONG SerialNo -) -{ - RtlZeroMemory(Report, sizeof(XGIP_SUBMIT_REPORT)); - - Report->Size = sizeof(XGIP_SUBMIT_REPORT); - Report->SerialNo = SerialNo; -} - -// -// Xbox One interrupt data -// -typedef struct _XGIP_SUBMIT_INTERRUPT -{ - // - // sizeof(struct _XGIP_SUBMIT_INTERRUPT) - // - ULONG Size; - - // - // Serial number of target device. - // - ULONG SerialNo; - - // - // Interrupt buffer. - // - UCHAR Interrupt[64]; - - // - // Length of interrupt buffer. - // - ULONG InterruptLength; - -} XGIP_SUBMIT_INTERRUPT, *PXGIP_SUBMIT_INTERRUPT; - -// -// Initializes an Xbox One interrupt. -// -VOID FORCEINLINE XGIP_SUBMIT_INTERRUPT_INIT( - _Out_ PXGIP_SUBMIT_INTERRUPT Report, - _In_ ULONG SerialNo -) -{ - RtlZeroMemory(Report, sizeof(XGIP_SUBMIT_INTERRUPT)); - - Report->Size = sizeof(XGIP_SUBMIT_INTERRUPT); - Report->SerialNo = SerialNo; -} - -#pragma endregion - diff --git a/include/ViGEmClient.h b/include/ViGEmClient.h deleted file mode 100644 index 51bd7e0..0000000 --- a/include/ViGEmClient.h +++ /dev/null @@ -1,493 +0,0 @@ -/* -MIT License - -Copyright (c) 2017 Benjamin "Nefarius" Höglinger - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -*/ - - -#ifndef ViGEmClient_h__ -#define ViGEmClient_h__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "ViGEmCommon.h" - -#ifdef VIGEM_DYNAMIC -#ifdef VIGEM_EXPORTS -#define VIGEM_API __declspec(dllexport) -#else -#define VIGEM_API __declspec(dllimport) -#endif -#else -#define VIGEM_API -#endif - - /** - * \typedef enum _VIGEM_ERRORS - * - * \brief Defines an alias representing the ViGEm errors. - */ - typedef enum _VIGEM_ERRORS - { - 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_CALLBACK_ALREADY_REGISTERED = 0xE0000010, - VIGEM_ERROR_CALLBACK_NOT_FOUND = 0xE0000011, - VIGEM_ERROR_BUS_ALREADY_CONNECTED = 0xE0000012 - } VIGEM_ERROR; - - /** - * \def VIGEM_SUCCESS(_val_) (_val_ == VIGEM_ERROR_NONE); - * - * \brief A macro that defines success. - * - * \author Benjamin "Nefarius" Höglinger - * \date 28.08.2017 - * - * \param _val_ The VIGEM_ERROR value. - */ -#define VIGEM_SUCCESS(_val_) (_val_ == VIGEM_ERROR_NONE) - - /** - * \typedef struct _VIGEM_CLIENT_T *PVIGEM_CLIENT - * - * \brief Defines an alias representing a driver connection object. - */ - typedef struct _VIGEM_CLIENT_T *PVIGEM_CLIENT; - - /** - * \typedef struct _VIGEM_TARGET_T *PVIGEM_TARGET - * - * \brief Defines an alias representing a target device object. - */ - typedef struct _VIGEM_TARGET_T *PVIGEM_TARGET; - - typedef - _Function_class_(EVT_VIGEM_TARGET_ADD_RESULT) - VOID - EVT_VIGEM_TARGET_ADD_RESULT( - PVIGEM_CLIENT Client, - PVIGEM_TARGET Target, - VIGEM_ERROR Result - ); - - typedef EVT_VIGEM_TARGET_ADD_RESULT *PFN_VIGEM_TARGET_ADD_RESULT; - - typedef - _Function_class_(EVT_VIGEM_X360_NOTIFICATION) - VOID - EVT_VIGEM_X360_NOTIFICATION( - PVIGEM_CLIENT Client, - PVIGEM_TARGET Target, - UCHAR LargeMotor, - UCHAR SmallMotor, - UCHAR LedNumber - ); - - typedef EVT_VIGEM_X360_NOTIFICATION *PFN_VIGEM_X360_NOTIFICATION; - - typedef - _Function_class_(EVT_VIGEM_DS4_NOTIFICATION) - VOID - EVT_VIGEM_DS4_NOTIFICATION( - PVIGEM_CLIENT Client, - PVIGEM_TARGET Target, - UCHAR LargeMotor, - UCHAR SmallMotor, - DS4_LIGHTBAR_COLOR LightbarColor - ); - - typedef EVT_VIGEM_DS4_NOTIFICATION *PFN_VIGEM_DS4_NOTIFICATION; - - /** - * \fn PVIGEM_CLIENT vigem_alloc(void); - * - * \brief Allocates an object representing a driver connection. - * - * \author Benjamin "Nefarius" Höglinger - * \date 28.08.2017 - * - * \return A new driver connection object. - */ - VIGEM_API PVIGEM_CLIENT vigem_alloc(void); - - /** - * \fn void vigem_free(PVIGEM_CLIENT vigem); - * - * \brief Frees up memory used by the driver connection object. - * - * \author Benjamin "Nefarius" Höglinger - * \date 28.08.2017 - * - * \param vigem The driver connection object. - */ - VIGEM_API void vigem_free(PVIGEM_CLIENT vigem); - - /** - * \fn VIGEM_ERROR vigem_connect(PVIGEM_CLIENT vigem); - * - * \brief Initializes the driver object and establishes a connection to the emulation bus - * driver. Returns an error if no compatible bus device has been found. - * - * \author Benjamin "Nefarius" Höglinger - * \date 28.08.2017 - * - * \param vigem The driver connection object. - * - * \return A VIGEM_ERROR. - */ - VIGEM_API VIGEM_ERROR vigem_connect(PVIGEM_CLIENT vigem); - - /** - * \fn void vigem_disconnect(PVIGEM_CLIENT vigem); - * - * \brief Disconnects from the bus device and resets the driver object state. The driver object - * may be reused again after calling this function. When called, all targets which may - * still be connected will be destroyed automatically. Be aware, that allocated target - * objects won't be automatically freed, this has to be taken care of by the caller. - * - * \author Benjamin "Nefarius" Höglinger - * \date 28.08.2017 - * - * \param vigem The driver connection object. - */ - VIGEM_API void vigem_disconnect(PVIGEM_CLIENT vigem); - - /** - * \fn PVIGEM_TARGET vigem_target_x360_alloc(void); - * - * \brief Allocates an object representing an Xbox 360 Controller device. - * - * \author Benjamin "Nefarius" Höglinger - * \date 28.08.2017 - * - * \return A PVIGEM_TARGET representing an Xbox 360 Controller device. - */ - VIGEM_API PVIGEM_TARGET vigem_target_x360_alloc(void); - - /** - * \fn PVIGEM_TARGET vigem_target_ds4_alloc(void); - * - * \brief Allocates an object representing a DualShock 4 Controller device. - * - * \author Benjamin "Nefarius" Höglinger - * \date 28.08.2017 - * - * \return A PVIGEM_TARGET representing a DualShock 4 Controller device. - */ - VIGEM_API PVIGEM_TARGET vigem_target_ds4_alloc(void); - - /** - * \fn void vigem_target_free(PVIGEM_TARGET target); - * - * \brief Frees up memory used by the target device object. This does not automatically remove - * the associated device from the bus, if present. If the target device doesn't get - * removed before this call, the device becomes orphaned until the owning process is - * terminated. - * - * \author Benjamin "Nefarius" Höglinger - * \date 28.08.2017 - * - * \param target The target device object. - */ - VIGEM_API void vigem_target_free(PVIGEM_TARGET target); - - /** - * \fn VIGEM_ERROR vigem_target_add(PVIGEM_CLIENT vigem, PVIGEM_TARGET target); - * - * \brief Adds a provided target device to the bus driver, which is equal to a device plug-in - * event of a physical hardware device. This function blocks until the target device is - * in full operational mode. - * - * \author Benjamin "Nefarius" Höglinger - * \date 28.08.2017 - * - * \param vigem The driver connection object. - * \param target The target device object. - * - * \return A VIGEM_ERROR. - */ - VIGEM_API VIGEM_ERROR vigem_target_add(PVIGEM_CLIENT vigem, PVIGEM_TARGET target); - - /** - * \fn VIGEM_ERROR vigem_target_add_async(PVIGEM_CLIENT vigem, PVIGEM_TARGET target, PVIGEM_TARGET_ADD_RESULT result); - * - * \brief Adds a provided target device to the bus driver, which is equal to a device plug-in - * event of a physical hardware device. This function immediately returns. An optional - * callback may be registered which gets called on error or if the target device has - * become fully operational. - * - * \author Benjamin "Nefarius" Höglinger - * \date 28.08.2017 - * - * \param vigem The driver connection object. - * \param target The target device object. - * \param result An optional function getting called when the target device becomes available. - * - * \return A VIGEM_ERROR. - */ - VIGEM_API VIGEM_ERROR vigem_target_add_async(PVIGEM_CLIENT vigem, PVIGEM_TARGET target, PFN_VIGEM_TARGET_ADD_RESULT result); - - /** - * \fn VIGEM_ERROR vigem_target_remove(PVIGEM_CLIENT vigem, PVIGEM_TARGET target); - * - * \brief Removes a provided target device from the bus driver, which is equal to a device - * unplug event of a physical hardware device. The target device object may be reused - * after this function is called. If this function is never called on target device - * objects, they will be removed from the bus when the owning process terminates. - * - * \author Benjamin "Nefarius" Höglinger - * \date 28.08.2017 - * - * \param vigem The driver connection object. - * \param target The target device object. - * - * \return A VIGEM_ERROR. - */ - VIGEM_API VIGEM_ERROR vigem_target_remove(PVIGEM_CLIENT vigem, PVIGEM_TARGET target); - - /** - * \fn VIGEM_ERROR vigem_target_x360_register_notification(PVIGEM_CLIENT vigem, PVIGEM_TARGET target, PVIGEM_X360_NOTIFICATION notification); - * - * \brief Registers a function which gets called, when LED index or vibration state changes - * occur on the provided target device. This function fails if the provided target - * device isn't fully operational or in an erroneous state. - * - * \author Benjamin "Nefarius" Höglinger - * \date 28.08.2017 - * - * \param vigem The driver connection object. - * \param target The target device object. - * \param notification The notification callback. - * - * \return A VIGEM_ERROR. - */ - VIGEM_API VIGEM_ERROR vigem_target_x360_register_notification(PVIGEM_CLIENT vigem, PVIGEM_TARGET target, PFN_VIGEM_X360_NOTIFICATION notification); - - /** - * \fn VIGEM_ERROR vigem_target_ds4_register_notification(PVIGEM_CLIENT vigem, PVIGEM_TARGET target, PVIGEM_DS4_NOTIFICATION notification); - * - * \brief Registers a function which gets called, when LightBar or vibration state changes - * occur on the provided target device. This function fails if the provided target - * device isn't fully operational or in an erroneous state. - * - * \author Benjamin "Nefarius" Höglinger - * \date 28.08.2017 - * - * \param vigem The driver connection object. - * \param target The target device object. - * \param notification The notification callback. - * - * \return A VIGEM_ERROR. - */ - VIGEM_API VIGEM_ERROR vigem_target_ds4_register_notification(PVIGEM_CLIENT vigem, PVIGEM_TARGET target, PFN_VIGEM_DS4_NOTIFICATION notification); - - /** - * \fn void vigem_target_x360_unregister_notification(PVIGEM_TARGET target); - * - * \brief Removes a previously registered callback function from the provided target object. - * - * \author Benjamin "Nefarius" Höglinger - * \date 28.08.2017 - * - * \param target The target device object. - */ - VIGEM_API void vigem_target_x360_unregister_notification(PVIGEM_TARGET target); - - /** - * \fn void vigem_target_ds4_unregister_notification(PVIGEM_TARGET target); - * - * \brief Removes a previously registered callback function from the provided target object. - * - * \author Benjamin "Nefarius" Höglinger - * \date 28.08.2017 - * - * \param target The target device object. - */ - VIGEM_API void vigem_target_ds4_unregister_notification(PVIGEM_TARGET target); - - /** - * \fn void vigem_target_set_vid(PVIGEM_TARGET target, USHORT vid); - * - * \brief Overrides the default Vendor ID value with the provided one. - * - * \author Benjamin "Nefarius" Höglinger - * \date 28.08.2017 - * - * \param target The target device object. - * \param vid The Vendor ID to set. - */ - VIGEM_API void vigem_target_set_vid(PVIGEM_TARGET target, USHORT vid); - - /** - * \fn void vigem_target_set_pid(PVIGEM_TARGET target, USHORT pid); - * - * \brief Overrides the default Product ID value with the provided one. - * - * \author Benjamin "Nefarius" Höglinger - * \date 28.08.2017 - * - * \param target The target device object. - * \param pid The Product ID to set. - */ - VIGEM_API void vigem_target_set_pid(PVIGEM_TARGET target, USHORT pid); - - /** - * \fn USHORT vigem_target_get_vid(PVIGEM_TARGET target); - * - * \brief Returns the Vendor ID of the provided target device object. - * - * \author Benjamin "Nefarius" Höglinger - * \date 28.08.2017 - * - * \param target The target device object. - * - * \return The Vendor ID. - */ - VIGEM_API USHORT vigem_target_get_vid(PVIGEM_TARGET target); - - /** - * \fn USHORT vigem_target_get_pid(PVIGEM_TARGET target); - * - * \brief Returns the Product ID of the provided target device object. - * - * \author Benjamin "Nefarius" Höglinger - * \date 28.08.2017 - * - * \param target The target device object. - * - * \return The Product ID. - */ - VIGEM_API USHORT vigem_target_get_pid(PVIGEM_TARGET target); - - /** - * \fn VIGEM_ERROR vigem_target_x360_update(PVIGEM_CLIENT vigem, PVIGEM_TARGET target, XUSB_REPORT report); - * - * \brief Sends a state report to the provided target device. - * - * \author Benjamin "Nefarius" Höglinger - * \date 28.08.2017 - * - * \param vigem The driver connection object. - * \param target The target device object. - * \param report The report to send to the target device. - * - * \return A VIGEM_ERROR. - */ - VIGEM_API VIGEM_ERROR vigem_target_x360_update(PVIGEM_CLIENT vigem, PVIGEM_TARGET target, XUSB_REPORT report); - - /** - * \fn VIGEM_ERROR vigem_target_ds4_update(PVIGEM_CLIENT vigem, PVIGEM_TARGET target, DS4_REPORT report); - * - * \brief Sends a state report to the provided target device. - * - * \author Benjamin "Nefarius" Höglinger - * \date 28.08.2017 - * - * \param vigem The driver connection object. - * \param target The target device object. - * \param report The report to send to the target device. - * - * \return A VIGEM_ERROR. - */ - VIGEM_API VIGEM_ERROR vigem_target_ds4_update(PVIGEM_CLIENT vigem, PVIGEM_TARGET target, DS4_REPORT report); - - /** - * \fn ULONG vigem_target_get_index(PVIGEM_TARGET target); - * - * \brief Returns the internal index (serial number) the bus driver assigned to the provided - * target device object. Note that this value is specific to the inner workings of the - * bus driver, it does not reflect related values like player index or device arrival - * order experienced by other APIs. It may be used to identify the target device object - * for its lifetime. This value becomes invalid once the target device is removed from - * the bus and may change on the next addition of the device. - * - * \author Benjamin "Nefarius" Höglinger - * \date 28.08.2017 - * - * \param target The target device object. - * - * \return The internally used index of the target device. - */ - VIGEM_API ULONG vigem_target_get_index(PVIGEM_TARGET target); - - /** - * \fn VIGEM_TARGET_TYPE vigem_target_get_type(PVIGEM_TARGET target); - * - * \brief Returns the type of the provided target device object. - * - * \author Benjamin "Nefarius" Höglinger - * \date 28.08.2017 - * - * \param target The target device object. - * - * \return A VIGEM_TARGET_TYPE. - */ - VIGEM_API VIGEM_TARGET_TYPE vigem_target_get_type(PVIGEM_TARGET target); - - /** - * \fn BOOL vigem_target_is_attached(PVIGEM_TARGET target); - * - * \brief Returns TRUE if the provided target device object is currently attached to the bus, - * FALSE otherwise. - * - * \author Benjamin "Nefarius" Höglinger - * \date 30.08.2017 - * - * \param target The target device object. - * - * \return TRUE if device is attached to the bus, FALSE otherwise. - */ - VIGEM_API BOOL vigem_target_is_attached(PVIGEM_TARGET target); - - /** - * \fn VIGEM_API VIGEM_ERROR vigem_target_x360_get_user_index(PVIGEM_CLIENT vigem, PVIGEM_TARGET target, PULONG index); - * - * \brief Returns the user index of the emulated Xenon device. This value correspondents to the - * (zero-based) index number representing the player number via LED present on a - * physical controller and is compatible to the dwUserIndex propery of the XInput* APIs. - * - * \author Benjamin "Nefarius" Höglinger - * \date 10.05.2018 - * - * \param vigem The driver connection object. - * \param target The target device object. - * \param index The (zero-based) user index of the Xenon device. - * - * \return A VIGEM_ERROR. - */ - VIGEM_API VIGEM_ERROR vigem_target_x360_get_user_index(PVIGEM_CLIENT vigem, PVIGEM_TARGET target, PULONG index); - -#ifdef __cplusplus -} -#endif - -#endif // ViGEmClient_h__ diff --git a/include/ViGEmCommon.h b/include/ViGEmCommon.h deleted file mode 100644 index 990b50e..0000000 --- a/include/ViGEmCommon.h +++ /dev/null @@ -1,206 +0,0 @@ -/* -MIT License - -Copyright (c) 2017 Benjamin "Nefarius" Höglinger - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -*/ - - -#pragma once - -// -// Represents the desired target type for the emulated device. -// -typedef enum _VIGEM_TARGET_TYPE -{ - // - // Microsoft Xbox 360 Controller (wired) - // - Xbox360Wired, - // - // Microsoft Xbox One Controller (wired) - // - XboxOneWired, - // - // Sony DualShock 4 (wired) - // - DualShock4Wired - -} VIGEM_TARGET_TYPE, *PVIGEM_TARGET_TYPE; - -// -// Possible XUSB report buttons. -// -typedef enum _XUSB_BUTTON -{ - XUSB_GAMEPAD_DPAD_UP = 0x0001, - XUSB_GAMEPAD_DPAD_DOWN = 0x0002, - XUSB_GAMEPAD_DPAD_LEFT = 0x0004, - XUSB_GAMEPAD_DPAD_RIGHT = 0x0008, - XUSB_GAMEPAD_START = 0x0010, - XUSB_GAMEPAD_BACK = 0x0020, - XUSB_GAMEPAD_LEFT_THUMB = 0x0040, - XUSB_GAMEPAD_RIGHT_THUMB = 0x0080, - XUSB_GAMEPAD_LEFT_SHOULDER = 0x0100, - XUSB_GAMEPAD_RIGHT_SHOULDER = 0x0200, - XUSB_GAMEPAD_GUIDE = 0x0400, - XUSB_GAMEPAD_A = 0x1000, - XUSB_GAMEPAD_B = 0x2000, - XUSB_GAMEPAD_X = 0x4000, - XUSB_GAMEPAD_Y = 0x8000 - -} XUSB_BUTTON, *PXUSB_BUTTON; - -// -// Represents an XINPUT_GAMEPAD-compatible report structure. -// -typedef struct _XUSB_REPORT -{ - USHORT wButtons; - BYTE bLeftTrigger; - BYTE bRightTrigger; - SHORT sThumbLX; - SHORT sThumbLY; - SHORT sThumbRX; - SHORT sThumbRY; - -} XUSB_REPORT, *PXUSB_REPORT; - -// -// Initializes a _XUSB_REPORT structure. -// -VOID FORCEINLINE XUSB_REPORT_INIT( - _Out_ PXUSB_REPORT Report -) -{ - RtlZeroMemory(Report, sizeof(XUSB_REPORT)); -} - -// -// The color value (RGB) of a DualShock 4 Lightbar -// -typedef struct _DS4_LIGHTBAR_COLOR -{ - // - // Red part of the Lightbar (0-255). - // - UCHAR Red; - - // - // Green part of the Lightbar (0-255). - // - UCHAR Green; - - // - // Blue part of the Lightbar (0-255). - // - UCHAR Blue; - -} DS4_LIGHTBAR_COLOR, *PDS4_LIGHTBAR_COLOR; - -// -// DualShock 4 digital buttons -// -typedef enum _DS4_BUTTONS -{ - DS4_BUTTON_THUMB_RIGHT = 1 << 15, - DS4_BUTTON_THUMB_LEFT = 1 << 14, - DS4_BUTTON_OPTIONS = 1 << 13, - DS4_BUTTON_SHARE = 1 << 12, - DS4_BUTTON_TRIGGER_RIGHT = 1 << 11, - DS4_BUTTON_TRIGGER_LEFT = 1 << 10, - DS4_BUTTON_SHOULDER_RIGHT = 1 << 9, - DS4_BUTTON_SHOULDER_LEFT = 1 << 8, - DS4_BUTTON_TRIANGLE = 1 << 7, - DS4_BUTTON_CIRCLE = 1 << 6, - DS4_BUTTON_CROSS = 1 << 5, - DS4_BUTTON_SQUARE = 1 << 4 - -} DS4_BUTTONS, *PDS4_BUTTONS; - -// -// DualShock 4 special buttons -// -typedef enum _DS4_SPECIAL_BUTTONS -{ - DS4_SPECIAL_BUTTON_PS = 1 << 0, - DS4_SPECIAL_BUTTON_TOUCHPAD = 1 << 1 - -} DS4_SPECIAL_BUTTONS, *PDS4_SPECIAL_BUTTONS; - -// -// DualShock 4 directional pad (HAT) values -// -typedef enum _DS4_DPAD_DIRECTIONS -{ - DS4_BUTTON_DPAD_NONE = 0x8, - DS4_BUTTON_DPAD_NORTHWEST = 0x7, - DS4_BUTTON_DPAD_WEST = 0x6, - DS4_BUTTON_DPAD_SOUTHWEST = 0x5, - DS4_BUTTON_DPAD_SOUTH = 0x4, - DS4_BUTTON_DPAD_SOUTHEAST = 0x3, - DS4_BUTTON_DPAD_EAST = 0x2, - DS4_BUTTON_DPAD_NORTHEAST = 0x1, - DS4_BUTTON_DPAD_NORTH = 0x0 - -} DS4_DPAD_DIRECTIONS, *PDS4_DPAD_DIRECTIONS; - -// -// DualShock 4 HID Input report -// -typedef struct _DS4_REPORT -{ - BYTE bThumbLX; - BYTE bThumbLY; - BYTE bThumbRX; - BYTE bThumbRY; - USHORT wButtons; - BYTE bSpecial; - BYTE bTriggerL; - BYTE bTriggerR; - -} DS4_REPORT, *PDS4_REPORT; - -// -// Sets the current state of the D-PAD on a DualShock 4 report. -// -VOID FORCEINLINE DS4_SET_DPAD( - _Out_ PDS4_REPORT Report, - _In_ DS4_DPAD_DIRECTIONS Dpad -) -{ - Report->wButtons &= ~0xF; - Report->wButtons |= (USHORT)Dpad; -} - -VOID FORCEINLINE DS4_REPORT_INIT( - _Out_ PDS4_REPORT Report -) -{ - RtlZeroMemory(Report, sizeof(DS4_REPORT)); - - Report->bThumbLX = 0x80; - Report->bThumbLY = 0x80; - Report->bThumbRX = 0x80; - Report->bThumbRY = 0x80; - - DS4_SET_DPAD(Report, DS4_BUTTON_DPAD_NONE); -} - diff --git a/include/ViGEmUtil.h b/include/ViGEmUtil.h deleted file mode 100644 index 3233f15..0000000 --- a/include/ViGEmUtil.h +++ /dev/null @@ -1,50 +0,0 @@ -#pragma once - -#include "ViGEmCommon.h" -#include - -VOID FORCEINLINE XUSB_TO_DS4_REPORT( - _Out_ PXUSB_REPORT Input, - _Out_ PDS4_REPORT Output -) -{ - if (Input->wButtons & XUSB_GAMEPAD_BACK) Output->wButtons |= DS4_BUTTON_SHARE; - if (Input->wButtons & XUSB_GAMEPAD_START) Output->wButtons |= DS4_BUTTON_OPTIONS; - if (Input->wButtons & XUSB_GAMEPAD_LEFT_THUMB) Output->wButtons |= DS4_BUTTON_THUMB_LEFT; - if (Input->wButtons & XUSB_GAMEPAD_RIGHT_THUMB) Output->wButtons |= DS4_BUTTON_THUMB_RIGHT; - if (Input->wButtons & XUSB_GAMEPAD_LEFT_SHOULDER) Output->wButtons |= DS4_BUTTON_SHOULDER_LEFT; - if (Input->wButtons & XUSB_GAMEPAD_RIGHT_SHOULDER) Output->wButtons |= DS4_BUTTON_SHOULDER_RIGHT; - if (Input->wButtons & XUSB_GAMEPAD_GUIDE) Output->bSpecial |= DS4_SPECIAL_BUTTON_PS; - if (Input->wButtons & XUSB_GAMEPAD_A) Output->wButtons |= DS4_BUTTON_CROSS; - if (Input->wButtons & XUSB_GAMEPAD_B) Output->wButtons |= DS4_BUTTON_CIRCLE; - if (Input->wButtons & XUSB_GAMEPAD_X) Output->wButtons |= DS4_BUTTON_SQUARE; - if (Input->wButtons & XUSB_GAMEPAD_Y) Output->wButtons |= DS4_BUTTON_TRIANGLE; - - Output->bTriggerL = Input->bLeftTrigger; - Output->bTriggerR = Input->bRightTrigger; - - if (Input->bLeftTrigger > 0)Output->wButtons |= DS4_BUTTON_TRIGGER_LEFT; - if (Input->bRightTrigger > 0)Output->wButtons |= DS4_BUTTON_TRIGGER_RIGHT; - - if (Input->wButtons & XUSB_GAMEPAD_DPAD_UP) DS4_SET_DPAD(Output, DS4_BUTTON_DPAD_NORTH); - if (Input->wButtons & XUSB_GAMEPAD_DPAD_RIGHT) DS4_SET_DPAD(Output, DS4_BUTTON_DPAD_EAST); - if (Input->wButtons & XUSB_GAMEPAD_DPAD_DOWN) DS4_SET_DPAD(Output, DS4_BUTTON_DPAD_SOUTH); - if (Input->wButtons & XUSB_GAMEPAD_DPAD_LEFT) DS4_SET_DPAD(Output, DS4_BUTTON_DPAD_WEST); - - if (Input->wButtons & XUSB_GAMEPAD_DPAD_UP - && Input->wButtons & XUSB_GAMEPAD_DPAD_RIGHT) DS4_SET_DPAD(Output, DS4_BUTTON_DPAD_NORTHEAST); - if (Input->wButtons & XUSB_GAMEPAD_DPAD_RIGHT - && Input->wButtons & XUSB_GAMEPAD_DPAD_DOWN) DS4_SET_DPAD(Output, DS4_BUTTON_DPAD_SOUTHEAST); - if (Input->wButtons & XUSB_GAMEPAD_DPAD_DOWN - && Input->wButtons & XUSB_GAMEPAD_DPAD_LEFT) DS4_SET_DPAD(Output, DS4_BUTTON_DPAD_SOUTHWEST); - if (Input->wButtons & XUSB_GAMEPAD_DPAD_LEFT - && Input->wButtons & XUSB_GAMEPAD_DPAD_UP) DS4_SET_DPAD(Output, DS4_BUTTON_DPAD_NORTHWEST); - - Output->bThumbLX = ((Input->sThumbLX + ((USHRT_MAX / 2) + 1)) / 257); - Output->bThumbLY = (-(Input->sThumbLY + ((USHRT_MAX / 2) - 1)) / 257); - Output->bThumbLY = (Output->bThumbLY == 0) ? 0xFF : Output->bThumbLY; - Output->bThumbRX = ((Input->sThumbRX + ((USHRT_MAX / 2) + 1)) / 257); - Output->bThumbRY = (-(Input->sThumbRY + ((USHRT_MAX / 2) + 1)) / 257); - Output->bThumbRY = (Output->bThumbRY == 0) ? 0xFF : Output->bThumbRY; -} - diff --git a/lib/README.md b/lib/README.md deleted file mode 100644 index 5f4e113..0000000 --- a/lib/README.md +++ /dev/null @@ -1,8 +0,0 @@ -# ViGEm user-mode client library -This static library provides the gateway to the bus drivers functionalities. It offers: - * Searching and connecting to a library-compatible bus device on the system - * Attaching and removing a (artificially limited) number of virtual devices - * Feeding the emulated devices (aka providing input state changes) - -## Dependencies -In addition to this library you'll need to link against `setupapi.lib`. \ No newline at end of file diff --git a/lib/ViGEmClient.cpp b/lib/ViGEmClient.cpp deleted file mode 100644 index 63af076..0000000 --- a/lib/ViGEmClient.cpp +++ /dev/null @@ -1,682 +0,0 @@ -/* -MIT License - -Copyright (c) 2017 Benjamin "Nefarius" Höglinger - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -*/ - - -#define WIN32_LEAN_AND_MEAN -#include -#include -#include -#include - -#include "ViGEmBusShared.h" -#include "ViGEmClient.h" -#include -#include -#include - -#define VIGEM_TARGETS_MAX USHRT_MAX - -// -// Represents a driver connection object. -// -typedef struct _VIGEM_CLIENT_T -{ - HANDLE hBusDevice; - -} VIGEM_CLIENT; - -// -// Represents the (connection) state of a target device object. -// -typedef enum _VIGEM_TARGET_STATE -{ - VIGEM_TARGET_NEW, - VIGEM_TARGET_INITIALIZED, - VIGEM_TARGET_CONNECTED, - VIGEM_TARGET_DISCONNECTED -} VIGEM_TARGET_STATE, *PVIGEM_TARGET_STATE; - -// -// Represents a virtual gamepad object. -// -typedef struct _VIGEM_TARGET_T -{ - ULONG Size; - ULONG SerialNo; - VIGEM_TARGET_STATE State; - USHORT VendorId; - USHORT ProductId; - VIGEM_TARGET_TYPE Type; - DWORD_PTR Notification; - -} VIGEM_TARGET; - -// -// Initializes a virtual gamepad object. -// -PVIGEM_TARGET FORCEINLINE VIGEM_TARGET_ALLOC_INIT( - _In_ VIGEM_TARGET_TYPE Type -) -{ - auto target = static_cast(malloc(sizeof(VIGEM_TARGET))); - RtlZeroMemory(target, sizeof(VIGEM_TARGET)); - - target->Size = sizeof(VIGEM_TARGET); - target->State = VIGEM_TARGET_INITIALIZED; - target->Type = Type; - - return target; -} - - -PVIGEM_CLIENT vigem_alloc() -{ - auto driver = static_cast(malloc(sizeof(VIGEM_CLIENT))); - - RtlZeroMemory(driver, sizeof(VIGEM_CLIENT)); - driver->hBusDevice = INVALID_HANDLE_VALUE; - - return driver; -} - -void vigem_free(PVIGEM_CLIENT vigem) -{ - if (vigem) - free(vigem); -} - -VIGEM_ERROR vigem_connect(PVIGEM_CLIENT vigem) -{ - SP_DEVICE_INTERFACE_DATA deviceInterfaceData = { 0 }; - deviceInterfaceData.cbSize = sizeof(deviceInterfaceData); - DWORD memberIndex = 0; - DWORD requiredSize = 0; - auto error = VIGEM_ERROR_BUS_NOT_FOUND; - - // check for already open handle as re-opening accidentally would destroy all live targets - if (vigem->hBusDevice != INVALID_HANDLE_VALUE) - { - return VIGEM_ERROR_BUS_ALREADY_CONNECTED; - } - - auto deviceInfoSet = SetupDiGetClassDevs(&GUID_DEVINTERFACE_BUSENUM_VIGEM, nullptr, nullptr, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE); - - // enumerate device instances - while (SetupDiEnumDeviceInterfaces(deviceInfoSet, nullptr, &GUID_DEVINTERFACE_BUSENUM_VIGEM, memberIndex++, &deviceInterfaceData)) - { - // get required target buffer size - SetupDiGetDeviceInterfaceDetail(deviceInfoSet, &deviceInterfaceData, nullptr, 0, &requiredSize, nullptr); - - // allocate target buffer - auto detailDataBuffer = static_cast(malloc(requiredSize)); - detailDataBuffer->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA); - - // get detail buffer - if (!SetupDiGetDeviceInterfaceDetail(deviceInfoSet, &deviceInterfaceData, detailDataBuffer, requiredSize, &requiredSize, nullptr)) - { - SetupDiDestroyDeviceInfoList(deviceInfoSet); - free(detailDataBuffer); - error = VIGEM_ERROR_BUS_NOT_FOUND; - continue; - } - - // bus found, open it - vigem->hBusDevice = CreateFile(detailDataBuffer->DevicePath, - GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ | FILE_SHARE_WRITE, - nullptr, - OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL | FILE_FLAG_NO_BUFFERING | FILE_FLAG_WRITE_THROUGH | FILE_FLAG_OVERLAPPED, - nullptr); - - // check bus open result - if (vigem->hBusDevice == INVALID_HANDLE_VALUE) - { - error = VIGEM_ERROR_BUS_ACCESS_FAILED; - free(detailDataBuffer); - continue; - } - - DWORD transfered = 0; - OVERLAPPED lOverlapped = { 0 }; - lOverlapped.hEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr); - - VIGEM_CHECK_VERSION version; - VIGEM_CHECK_VERSION_INIT(&version, VIGEM_COMMON_VERSION); - - // send compiled library version to driver to check compatibility - DeviceIoControl(vigem->hBusDevice, IOCTL_VIGEM_CHECK_VERSION, &version, version.Size, nullptr, 0, &transfered, &lOverlapped); - - // wait for result - if (GetOverlappedResult(vigem->hBusDevice, &lOverlapped, &transfered, TRUE) != 0) - { - error = VIGEM_ERROR_NONE; - free(detailDataBuffer); - CloseHandle(lOverlapped.hEvent); - break; - } - - error = VIGEM_ERROR_BUS_VERSION_MISMATCH; - - CloseHandle(lOverlapped.hEvent); - free(detailDataBuffer); - } - - SetupDiDestroyDeviceInfoList(deviceInfoSet); - - return error; -} - -void vigem_disconnect(PVIGEM_CLIENT vigem) -{ - if (vigem->hBusDevice != INVALID_HANDLE_VALUE) - { - CloseHandle(vigem->hBusDevice); - - RtlZeroMemory(vigem, sizeof(VIGEM_CLIENT)); - vigem->hBusDevice = INVALID_HANDLE_VALUE; - } -} - -PVIGEM_TARGET vigem_target_x360_alloc(void) -{ - auto target = VIGEM_TARGET_ALLOC_INIT(Xbox360Wired); - - target->VendorId = 0x045E; - target->ProductId = 0x028E; - - return target; -} - -PVIGEM_TARGET vigem_target_ds4_alloc(void) -{ - auto target = VIGEM_TARGET_ALLOC_INIT(DualShock4Wired); - - target->VendorId = 0x054C; - target->ProductId = 0x05C4; - - return target; -} - -void vigem_target_free(PVIGEM_TARGET target) -{ - if (target) - free(target); -} - -VIGEM_ERROR vigem_target_add(PVIGEM_CLIENT vigem, PVIGEM_TARGET target) -{ - if (vigem->hBusDevice == nullptr) - { - return VIGEM_ERROR_BUS_NOT_FOUND; - } - - if (target->State == VIGEM_TARGET_NEW) - { - return VIGEM_ERROR_TARGET_UNINITIALIZED; - } - - if (target->State == VIGEM_TARGET_CONNECTED) - { - return VIGEM_ERROR_ALREADY_CONNECTED; - } - - DWORD transfered = 0; - VIGEM_PLUGIN_TARGET plugin; - OVERLAPPED lOverlapped = { 0 }; - lOverlapped.hEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr); - - for (target->SerialNo = 1; target->SerialNo <= VIGEM_TARGETS_MAX; target->SerialNo++) - { - VIGEM_PLUGIN_TARGET_INIT(&plugin, target->SerialNo, target->Type); - - plugin.VendorId = target->VendorId; - plugin.ProductId = target->ProductId; - - DeviceIoControl(vigem->hBusDevice, IOCTL_VIGEM_PLUGIN_TARGET, &plugin, plugin.Size, nullptr, 0, &transfered, &lOverlapped); - - if (GetOverlappedResult(vigem->hBusDevice, &lOverlapped, &transfered, TRUE) != 0) - { - target->State = VIGEM_TARGET_CONNECTED; - CloseHandle(lOverlapped.hEvent); - - return VIGEM_ERROR_NONE; - } - } - - CloseHandle(lOverlapped.hEvent); - - return VIGEM_ERROR_NO_FREE_SLOT; -} - -VIGEM_ERROR vigem_target_add_async(PVIGEM_CLIENT vigem, PVIGEM_TARGET target, PFN_VIGEM_TARGET_ADD_RESULT result) -{ - if (vigem->hBusDevice == nullptr) - { - return VIGEM_ERROR_BUS_NOT_FOUND; - } - - if (target->State == VIGEM_TARGET_NEW) - { - return VIGEM_ERROR_TARGET_UNINITIALIZED; - } - - if (target->State == VIGEM_TARGET_CONNECTED) - { - return VIGEM_ERROR_ALREADY_CONNECTED; - } - - std::thread _async{ []( - PVIGEM_TARGET _Target, - PVIGEM_CLIENT _Client, - PFN_VIGEM_TARGET_ADD_RESULT _Result) - { - DWORD transfered = 0; - VIGEM_PLUGIN_TARGET plugin; - OVERLAPPED lOverlapped = { 0 }; - lOverlapped.hEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr); - - for (_Target->SerialNo = 1; _Target->SerialNo <= VIGEM_TARGETS_MAX; _Target->SerialNo++) - { - VIGEM_PLUGIN_TARGET_INIT(&plugin, _Target->SerialNo, _Target->Type); - - plugin.VendorId = _Target->VendorId; - plugin.ProductId = _Target->ProductId; - - DeviceIoControl(_Client->hBusDevice, IOCTL_VIGEM_PLUGIN_TARGET, &plugin, plugin.Size, nullptr, 0, &transfered, &lOverlapped); - - if (GetOverlappedResult(_Client->hBusDevice, &lOverlapped, &transfered, TRUE) != 0) - { - _Target->State = VIGEM_TARGET_CONNECTED; - CloseHandle(lOverlapped.hEvent); - - if (_Result) - _Result(_Client, _Target, VIGEM_ERROR_NONE); - - return; - } - } - - CloseHandle(lOverlapped.hEvent); - - if (_Result) - _Result(_Client, _Target, VIGEM_ERROR_NO_FREE_SLOT); - - }, target, vigem, result }; - - _async.detach(); - - return VIGEM_ERROR_NONE; -} - -VIGEM_ERROR vigem_target_remove(PVIGEM_CLIENT vigem, PVIGEM_TARGET target) -{ - if (vigem->hBusDevice == nullptr) - { - return VIGEM_ERROR_BUS_NOT_FOUND; - } - - if (target->State == VIGEM_TARGET_NEW) - { - return VIGEM_ERROR_TARGET_UNINITIALIZED; - } - - if (target->State != VIGEM_TARGET_CONNECTED) - { - return VIGEM_ERROR_TARGET_NOT_PLUGGED_IN; - } - - DWORD transfered = 0; - VIGEM_UNPLUG_TARGET unplug; - OVERLAPPED lOverlapped = { 0 }; - lOverlapped.hEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr); - - VIGEM_UNPLUG_TARGET_INIT(&unplug, target->SerialNo); - - DeviceIoControl(vigem->hBusDevice, IOCTL_VIGEM_UNPLUG_TARGET, &unplug, unplug.Size, nullptr, 0, &transfered, &lOverlapped); - - if (GetOverlappedResult(vigem->hBusDevice, &lOverlapped, &transfered, TRUE) != 0) - { - target->State = VIGEM_TARGET_DISCONNECTED; - CloseHandle(lOverlapped.hEvent); - - //g_xusbCallbacks.erase(Target->SerialNo); - //g_ds4Callbacks.erase(Target->SerialNo); - - return VIGEM_ERROR_NONE; - } - - CloseHandle(lOverlapped.hEvent); - - return VIGEM_ERROR_REMOVAL_FAILED; -} - -VIGEM_ERROR vigem_target_x360_register_notification(PVIGEM_CLIENT vigem, PVIGEM_TARGET target, PFN_VIGEM_X360_NOTIFICATION notification) -{ - if (vigem->hBusDevice == nullptr) - { - return VIGEM_ERROR_BUS_NOT_FOUND; - } - - if (target->SerialNo == 0 || notification == nullptr) - { - return VIGEM_ERROR_INVALID_TARGET; - } - - if (target->Notification == reinterpret_cast(notification)) - { - return VIGEM_ERROR_CALLBACK_ALREADY_REGISTERED; - } - - target->Notification = reinterpret_cast(notification); - - std::thread _async{ []( - PVIGEM_TARGET _Target, - PVIGEM_CLIENT _Client) - { - DWORD error = ERROR_SUCCESS; - DWORD transfered = 0; - OVERLAPPED lOverlapped = { 0 }; - lOverlapped.hEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr); - - XUSB_REQUEST_NOTIFICATION notify; - XUSB_REQUEST_NOTIFICATION_INIT(¬ify, _Target->SerialNo); - - do - { - DeviceIoControl(_Client->hBusDevice, - IOCTL_XUSB_REQUEST_NOTIFICATION, - ¬ify, - notify.Size, - ¬ify, - notify.Size, - &transfered, - &lOverlapped); - - if (GetOverlappedResult(_Client->hBusDevice, &lOverlapped, &transfered, TRUE) != 0) - { - if (_Target->Notification == NULL) - { - CloseHandle(lOverlapped.hEvent); - return; - } - - reinterpret_cast(_Target->Notification)( - _Client, - _Target, - notify.LargeMotor, - notify.SmallMotor, - notify.LedNumber); - } - else - { - error = GetLastError(); - } - } while (error != ERROR_OPERATION_ABORTED && error != ERROR_ACCESS_DENIED); - - CloseHandle(lOverlapped.hEvent); - - }, target, vigem }; - - _async.detach(); - - return VIGEM_ERROR_NONE; -} - -VIGEM_ERROR vigem_target_ds4_register_notification(PVIGEM_CLIENT vigem, PVIGEM_TARGET target, PFN_VIGEM_DS4_NOTIFICATION notification) -{ - if (vigem->hBusDevice == nullptr) - { - return VIGEM_ERROR_BUS_NOT_FOUND; - } - - if (target->SerialNo == 0 || notification == nullptr) - { - return VIGEM_ERROR_INVALID_TARGET; - } - - if (target->Notification == reinterpret_cast(notification)) - { - return VIGEM_ERROR_CALLBACK_ALREADY_REGISTERED; - } - - target->Notification = reinterpret_cast(notification); - - std::thread _async{ []( - PVIGEM_TARGET _Target, - PVIGEM_CLIENT _Client) - { - DWORD error = ERROR_SUCCESS; - DWORD transfered = 0; - OVERLAPPED lOverlapped = { 0 }; - lOverlapped.hEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr); - - DS4_REQUEST_NOTIFICATION notify; - DS4_REQUEST_NOTIFICATION_INIT(¬ify, _Target->SerialNo); - - do - { - DeviceIoControl(_Client->hBusDevice, - IOCTL_DS4_REQUEST_NOTIFICATION, - ¬ify, - notify.Size, - ¬ify, - notify.Size, - &transfered, - &lOverlapped); - - if (GetOverlappedResult(_Client->hBusDevice, &lOverlapped, &transfered, TRUE) != 0) - { - if (_Target->Notification == NULL) - { - CloseHandle(lOverlapped.hEvent); - return; - } - - reinterpret_cast(_Target->Notification)( - _Client, - _Target, - notify.Report.LargeMotor, - notify.Report.SmallMotor, - notify.Report.LightbarColor); - } - else - { - error = GetLastError(); - } - } while (error != ERROR_OPERATION_ABORTED && error != ERROR_ACCESS_DENIED); - - CloseHandle(lOverlapped.hEvent); - - }, target, vigem }; - - _async.detach(); - - return VIGEM_ERROR_NONE; -} - -void vigem_target_x360_unregister_notification(PVIGEM_TARGET target) -{ - target->Notification = NULL; -} - -void vigem_target_ds4_unregister_notification(PVIGEM_TARGET target) -{ - target->Notification = NULL; -} - -void vigem_target_set_vid(PVIGEM_TARGET target, USHORT vid) -{ - target->VendorId = vid; -} - -void vigem_target_set_pid(PVIGEM_TARGET target, USHORT pid) -{ - target->ProductId = pid; -} - -USHORT vigem_target_get_vid(PVIGEM_TARGET target) -{ - return target->VendorId; -} - -USHORT vigem_target_get_pid(PVIGEM_TARGET target) -{ - return target->ProductId; -} - -VIGEM_ERROR vigem_target_x360_update(PVIGEM_CLIENT vigem, PVIGEM_TARGET target, XUSB_REPORT report) -{ - if (vigem->hBusDevice == nullptr) - { - return VIGEM_ERROR_BUS_NOT_FOUND; - } - - if (target->SerialNo == 0) - { - return VIGEM_ERROR_INVALID_TARGET; - } - - DWORD transfered = 0; - OVERLAPPED lOverlapped = { 0 }; - lOverlapped.hEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr); - - XUSB_SUBMIT_REPORT xsr; - XUSB_SUBMIT_REPORT_INIT(&xsr, target->SerialNo); - - xsr.Report = report; - - DeviceIoControl(vigem->hBusDevice, IOCTL_XUSB_SUBMIT_REPORT, &xsr, xsr.Size, nullptr, 0, &transfered, &lOverlapped); - - if (GetOverlappedResult(vigem->hBusDevice, &lOverlapped, &transfered, TRUE) == 0) - { - if (GetLastError() == ERROR_ACCESS_DENIED) - { - CloseHandle(lOverlapped.hEvent); - return VIGEM_ERROR_INVALID_TARGET; - } - } - - CloseHandle(lOverlapped.hEvent); - - return VIGEM_ERROR_NONE; -} - -VIGEM_ERROR vigem_target_ds4_update(PVIGEM_CLIENT vigem, PVIGEM_TARGET target, DS4_REPORT report) -{ - if (vigem->hBusDevice == nullptr) - { - return VIGEM_ERROR_BUS_NOT_FOUND; - } - - if (target->SerialNo == 0) - { - return VIGEM_ERROR_INVALID_TARGET; - } - - DWORD transfered = 0; - OVERLAPPED lOverlapped = { 0 }; - lOverlapped.hEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr); - - DS4_SUBMIT_REPORT dsr; - DS4_SUBMIT_REPORT_INIT(&dsr, target->SerialNo); - - dsr.Report = report; - - DeviceIoControl(vigem->hBusDevice, IOCTL_DS4_SUBMIT_REPORT, &dsr, dsr.Size, nullptr, 0, &transfered, &lOverlapped); - - if (GetOverlappedResult(vigem->hBusDevice, &lOverlapped, &transfered, TRUE) == 0) - { - if (GetLastError() == ERROR_ACCESS_DENIED) - { - CloseHandle(lOverlapped.hEvent); - return VIGEM_ERROR_INVALID_TARGET; - } - } - - CloseHandle(lOverlapped.hEvent); - - return VIGEM_ERROR_NONE; -} - -ULONG vigem_target_get_index(PVIGEM_TARGET target) -{ - return target->SerialNo; -} - -VIGEM_TARGET_TYPE vigem_target_get_type(PVIGEM_TARGET target) -{ - return target->Type; -} - -BOOL vigem_target_is_attached(PVIGEM_TARGET target) -{ - return (target->State == VIGEM_TARGET_CONNECTED); -} - -VIGEM_ERROR vigem_target_x360_get_user_index(PVIGEM_CLIENT vigem, PVIGEM_TARGET target, PULONG index) -{ - if (vigem->hBusDevice == nullptr) - { - return VIGEM_ERROR_BUS_NOT_FOUND; - } - - if (target->SerialNo == 0 || target->Type != Xbox360Wired) - { - return VIGEM_ERROR_INVALID_TARGET; - } - - DWORD transfered = 0; - OVERLAPPED lOverlapped = { 0 }; - lOverlapped.hEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr); - - XUSB_GET_USER_INDEX gui; - XUSB_GET_USER_INDEX_INIT(&gui, target->SerialNo); - - DeviceIoControl( - vigem->hBusDevice, - IOCTL_XUSB_GET_USER_INDEX, - &gui, - gui.Size, - &gui, - gui.Size, - &transfered, - &lOverlapped - ); - - if (GetOverlappedResult(vigem->hBusDevice, &lOverlapped, &transfered, TRUE) == 0) - { - if (GetLastError() == ERROR_ACCESS_DENIED) - { - CloseHandle(lOverlapped.hEvent); - return VIGEM_ERROR_INVALID_TARGET; - } - } - - CloseHandle(lOverlapped.hEvent); - - *index = gui.UserIndex; - - return VIGEM_ERROR_NONE; -} diff --git a/lib/ViGEmClient.rc b/lib/ViGEmClient.rc deleted file mode 100644 index 7ae36a9..0000000 --- a/lib/ViGEmClient.rc +++ /dev/null @@ -1,99 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// German (Austria) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEA) -LANGUAGE LANG_GERMAN, SUBLANG_GERMAN_AUSTRIAN - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,14,3,0 - PRODUCTVERSION 1,14,3,0 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x40004L - FILETYPE 0x7L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "0c0704b0" - BEGIN - VALUE "CompanyName", "Benjamin Höglinger-Stelzer" - VALUE "FileDescription", "Virtual Gamepad Emulation User-Mode Library" -VALUE "FileVersion", "1.14.3.0" - VALUE "InternalName", "Virtual Gamepad Emulation User-Mode Library" - VALUE "LegalCopyright", "Copyright (C) Benjamin Höglinger-Stelzer 2017" - VALUE "OriginalFilename", "ViGEmCli.lib" - VALUE "ProductName", "Virtual Gamepad Emulation User-Mode Library" -VALUE "ProductVersion", "1.14.3.0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0xc07, 1200 - END -END - -#endif // German (Austria) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/lib/ViGEmClient.vcxproj b/lib/ViGEmClient.vcxproj deleted file mode 100644 index 3c9995f..0000000 --- a/lib/ViGEmClient.vcxproj +++ /dev/null @@ -1,295 +0,0 @@ - - - - - Debug (dynamic) - Win32 - - - Debug (dynamic) - x64 - - - Debug (static) - Win32 - - - Release (dynamic) - Win32 - - - Release (dynamic) - x64 - - - Release (static) - Win32 - - - Debug (static) - x64 - - - Release (static) - x64 - - - - {7DB06674-1F4F-464B-8E1C-172E9587F9DC} - Win32Proj - ViGEmClient - - - - $([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0')) - $(LatestTargetPlatformVersion) - $(WindowsTargetPlatformVersion) - - - - StaticLibrary - true - v141 - Unicode - - - DynamicLibrary - true - v141 - Unicode - - - StaticLibrary - false - v141 - true - Unicode - - - DynamicLibrary - false - v141 - true - Unicode - - - StaticLibrary - true - v141 - Unicode - - - DynamicLibrary - true - v141 - Unicode - - - StaticLibrary - false - v141 - true - Unicode - - - DynamicLibrary - false - v141 - true - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - $(SolutionDir)Include;$(VC_IncludePath);$(WindowsSDK_IncludePath); - - - $(SolutionDir)Include;$(VC_IncludePath);$(WindowsSDK_IncludePath); - - - $(SolutionDir)Include;$(VC_IncludePath);$(WindowsSDK_IncludePath); - - - $(SolutionDir)Include;$(VC_IncludePath);$(WindowsSDK_IncludePath); - - - $(SolutionDir)Include;$(VC_IncludePath);$(WindowsSDK_IncludePath); - - - $(SolutionDir)Include;$(VC_IncludePath);$(WindowsSDK_IncludePath); - - - $(SolutionDir)Include;$(VC_IncludePath);$(WindowsSDK_IncludePath); - - - $(SolutionDir)Include;$(VC_IncludePath);$(WindowsSDK_IncludePath); - - - - - - Level3 - Disabled - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - - - Windows - - - - - - - Level3 - Disabled - VIGEM_DYNAMIC;VIGEM_EXPORTS;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - - - Windows - setupapi.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) - - - - - - - Level3 - Disabled - _DEBUG;_LIB;%(PreprocessorDefinitions) - true - - - Windows - - - - - - - Level3 - Disabled - VIGEM_DYNAMIC;VIGEM_EXPORTS;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - - - Windows - setupapi.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) - - - - - Level3 - - - MaxSpeed - true - true - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - - - Windows - true - true - - - - - Level3 - - - MaxSpeed - true - true - VIGEM_DYNAMIC;VIGEM_EXPORTS;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - - - Windows - true - true - setupapi.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) - - - - - Level3 - - - MaxSpeed - true - true - NDEBUG;_LIB;%(PreprocessorDefinitions) - true - - - Windows - true - true - - - - - Level3 - - - MaxSpeed - true - true - VIGEM_DYNAMIC;VIGEM_EXPORTS;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - - - Windows - true - true - setupapi.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/lib/ViGEmClient.vcxproj.filters b/lib/ViGEmClient.vcxproj.filters deleted file mode 100644 index b783fc4..0000000 --- a/lib/ViGEmClient.vcxproj.filters +++ /dev/null @@ -1,44 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - - - Resource Files - - - \ No newline at end of file diff --git a/lib/resource.h b/lib/resource.h deleted file mode 100644 index ab53b9b..0000000 --- a/lib/resource.h +++ /dev/null @@ -1,14 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by ViGEmClient.rc - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 101 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1001 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif