Remove the vendored ViGEmClient copy that is not built

third_party carried two copies of ViGEmClient. CMake compiles b66d02d; the
1.16.18.0 directory is referenced by nothing outside itself — not the build,
not a script, not a document.

It has already cost one misdiagnosis. #66 was filed reporting that a log line
was untrustworthy, on the grounds that vigem_target_add could not return
VIGEM_ERROR_TARGET_NOT_PLUGGED_IN — reading the copy that is not built. In the
copy that is, it can and does: 9ef3609 patched exactly that path to unplug a
target whose device never became ready, and to report it rather than claim a
success for a pad that is no longer plugged in. The log line was accurate the
whole time.

A decoy that answers grep is worse than no copy at all, so it goes.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Dylan DeverillandClaude Opus 5 committed 2026-08-13 23:09:57 -07:00
1 parent 9a7f90d7f9
commit 29f7e1e50e
22 files changed
-2855

No files matched your search

@@ -1,29 +0,0 @@
---
name: Bug report
about: Create a report to help us improve
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior (example):
1. Start program '...'
2. Click on '....'
3. Plug in device '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**System details (please complete the following information):**
- OS: [e.g. Windows 10 1803]
- Feeder software: [e.g. VDX, DS4Windows, ...]
- Driver Version: [e.g. 1.14.3.0]
**Additional context**
Add any other context about the problem here.
@@ -1,17 +0,0 @@
---
name: Feature request
about: Suggest an idea for this project
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.
@@ -1,7 +0,0 @@
---
name: You need support
about: This is the wrong place to ask for support
---
**Please don't abuse the issue tracker as a helpdesk!** We have a Discord server (linked in the README) where you can ask the lovely like-minded folks for assistance. Thank you for your compliance :smiley:
@@ -1 +0,0 @@
# TBD :smiley:
@@ -1,45 +0,0 @@
################################################################################
# This .gitignore file was automatically created by Microsoft(R) Visual Studio.
################################################################################
/.vs/ViGEmBus/v15
/build/bin/Release
/build/obj/Release
/lib
/packages
/sys/x64/Release
/x64/Release
/x64/Release (dynamic)
/x64/Release (static)
/.tmp
/lib/Release (static)
/Release
/sys/Release
/Release (static)
/build/bin/Debug
/build/obj/Debug
/bin
/sys/x64
/x64
*.user
/.vs/config
/sys/RCa21300
/sys/RCb21300
/build/*.dotsettings
/artifacts
/.vs/ViGEmBus/DesignTimeBuild
/build/obj
/.vs/ViGEmClient
/src/Release (static)
/src/x64/Debug (static)
/src/x64/Release (dynamic)
/src/x64/Release (static)
*.TMP
/src/Debug_LIB
/src/x64/Debug_LIB
/x64/Debug_LIB
/Debug_LIB
*.aps
/Release_LIB
/src/Release_LIB
/src/x64
-1
View File
@@ -1 +0,0 @@
ViGEmClient.sln
-21
View File
@@ -1,21 +0,0 @@
MIT License
Copyright (c) 2018 Benjamin Höglinger-Stelzer
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.
-22
View File
@@ -1,22 +0,0 @@
# ViGEm Client Native SDK
Developer SDK for communication with `ViGEmBus`.
[![Build status](https://ci.appveyor.com/api/projects/status/k806d3m2egjr0j56?svg=true)](https://ci.appveyor.com/project/nefarius/vigemclient) [![Discord](https://img.shields.io/discord/346756263763378176.svg)](https://discord.gg/QTJpBX5) [![Website](https://img.shields.io/website-up-down-green-red/https/vigem.org.svg?label=ViGEm.org)](https://vigem.org/) [![PayPal Donate](https://img.shields.io/badge/paypal-donate-blue.svg)](<https://paypal.me/NefariusMaximus>) [![Support on Patreon](https://img.shields.io/badge/patreon-donate-orange.svg)](<https://www.patreon.com/nefarius>) [![GitHub followers](https://img.shields.io/github/followers/nefarius.svg?style=social&label=Follow)](https://github.com/nefarius) [![Twitter Follow](https://img.shields.io/twitter/follow/nefariusmaximus.svg?style=social&label=Follow)](https://twitter.com/nefariusmaximus)
## About
TBD
## How to build
### Prerequisites
- Visual Studio **2017** ([Community Edition](https://www.visualstudio.com/thank-you-downloading-visual-studio/?sku=Community&rel=15) is just fine)
- [.NET Core SDK 2.1](https://www.microsoft.com/net/download/dotnet-core/2.1) (or greater, required for building only)
You can either build directly within Visual Studio or in PowerShell by running the build script:
```PowerShell
.\build.ps1 -configuration release
```
-53
View File
@@ -1,53 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2024
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ViGEmClient", "src\ViGEmClient.vcxproj", "{7DB06674-1F4F-464B-8E1C-172E9587F9DC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "_build", "build\_build.csproj", "{A11CD588-F74A-41B5-9E5B-E60937052009}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug_DLL|x64 = Debug_DLL|x64
Debug_DLL|x86 = Debug_DLL|x86
Debug_LIB|x64 = Debug_LIB|x64
Debug_LIB|x86 = Debug_LIB|x86
Release_DLL|x64 = Release_DLL|x64
Release_DLL|x86 = Release_DLL|x86
Release_LIB|x64 = Release_LIB|x64
Release_LIB|x86 = Release_LIB|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7DB06674-1F4F-464B-8E1C-172E9587F9DC}.Debug_DLL|x64.ActiveCfg = Debug_DLL|x64
{7DB06674-1F4F-464B-8E1C-172E9587F9DC}.Debug_DLL|x64.Build.0 = Debug_DLL|x64
{7DB06674-1F4F-464B-8E1C-172E9587F9DC}.Debug_DLL|x86.ActiveCfg = Debug_DLL|Win32
{7DB06674-1F4F-464B-8E1C-172E9587F9DC}.Debug_DLL|x86.Build.0 = Debug_DLL|Win32
{7DB06674-1F4F-464B-8E1C-172E9587F9DC}.Debug_LIB|x64.ActiveCfg = Debug_LIB|x64
{7DB06674-1F4F-464B-8E1C-172E9587F9DC}.Debug_LIB|x64.Build.0 = Debug_LIB|x64
{7DB06674-1F4F-464B-8E1C-172E9587F9DC}.Debug_LIB|x86.ActiveCfg = Debug_LIB|Win32
{7DB06674-1F4F-464B-8E1C-172E9587F9DC}.Debug_LIB|x86.Build.0 = Debug_LIB|Win32
{7DB06674-1F4F-464B-8E1C-172E9587F9DC}.Release_DLL|x64.ActiveCfg = Release_DLL|x64
{7DB06674-1F4F-464B-8E1C-172E9587F9DC}.Release_DLL|x64.Build.0 = Release_DLL|x64
{7DB06674-1F4F-464B-8E1C-172E9587F9DC}.Release_DLL|x86.ActiveCfg = Release_DLL|Win32
{7DB06674-1F4F-464B-8E1C-172E9587F9DC}.Release_DLL|x86.Build.0 = Release_DLL|Win32
{7DB06674-1F4F-464B-8E1C-172E9587F9DC}.Release_LIB|x64.ActiveCfg = Release_LIB|x64
{7DB06674-1F4F-464B-8E1C-172E9587F9DC}.Release_LIB|x64.Build.0 = Release_LIB|x64
{7DB06674-1F4F-464B-8E1C-172E9587F9DC}.Release_LIB|x86.ActiveCfg = Release_LIB|Win32
{7DB06674-1F4F-464B-8E1C-172E9587F9DC}.Release_LIB|x86.Build.0 = Release_LIB|Win32
{A11CD588-F74A-41B5-9E5B-E60937052009}.Debug_DLL|x64.ActiveCfg = Debug|Any CPU
{A11CD588-F74A-41B5-9E5B-E60937052009}.Debug_DLL|x86.ActiveCfg = Debug|Any CPU
{A11CD588-F74A-41B5-9E5B-E60937052009}.Debug_LIB|x64.ActiveCfg = Debug|Any CPU
{A11CD588-F74A-41B5-9E5B-E60937052009}.Debug_LIB|x86.ActiveCfg = Debug|Any CPU
{A11CD588-F74A-41B5-9E5B-E60937052009}.Release_DLL|x64.ActiveCfg = Release|Any CPU
{A11CD588-F74A-41B5-9E5B-E60937052009}.Release_DLL|x86.ActiveCfg = Release|Any CPU
{A11CD588-F74A-41B5-9E5B-E60937052009}.Release_LIB|x64.ActiveCfg = Release|Any CPU
{A11CD588-F74A-41B5-9E5B-E60937052009}.Release_LIB|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {D5CD61FD-80BB-4E0E-840C-BAF66ABB1CF0}
EndGlobalSection
EndGlobal
-9
View File
@@ -1,9 +0,0 @@
version: 1.16.{build}.0
image: Visual Studio 2017
build_script:
- ps: .\build.ps1 -configuration Release_DLL
deploy:
- provider: Environment
name: BUILDBOT
on:
appveyor_repo_tag: true
-65
View File
@@ -1,65 +0,0 @@
[CmdletBinding()]
Param(
#[switch]$CustomParam,
[Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]
[string[]]$BuildArguments
)
Write-Output "Windows PowerShell $($Host.Version)"
Set-StrictMode -Version 2.0; $ErrorActionPreference = "Stop"; $ConfirmPreference = "None"; trap { $host.SetShouldExit(1) }
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
###########################################################################
# CONFIGURATION
###########################################################################
$BuildProjectFile = "$PSScriptRoot\build\_build.csproj"
$TempDirectory = "$PSScriptRoot\\.tmp"
$DotNetGlobalFile = "$PSScriptRoot\\global.json"
$DotNetInstallUrl = "https://raw.githubusercontent.com/dotnet/cli/master/scripts/obtain/dotnet-install.ps1"
$DotNetReleasesUrl = "https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases.json"
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = 1
$env:DOTNET_CLI_TELEMETRY_OPTOUT = 1
$env:NUGET_XMLDOC_MODE = "skip"
###########################################################################
# EXECUTION
###########################################################################
function ExecSafe([scriptblock] $cmd) {
& $cmd
if ($LASTEXITCODE) { exit $LASTEXITCODE }
}
# If global.json exists, load expected version
if (Test-Path $DotNetGlobalFile) {
$DotNetVersion = $(Get-Content $DotNetGlobalFile | Out-String | ConvertFrom-Json).sdk.version
}
# If dotnet is installed locally, and expected version is not set or installation matches the expected version
if ((Get-Command "dotnet" -ErrorAction SilentlyContinue) -ne $null -and `
(!(Test-Path variable:DotNetVersion) -or $(& dotnet --version) -eq $DotNetVersion)) {
$env:DOTNET_EXE = (Get-Command "dotnet").Path
}
else {
$DotNetDirectory = "$TempDirectory\dotnet-win"
$env:DOTNET_EXE = "$DotNetDirectory\dotnet.exe"
# If expected version is not set, get latest version
if (!(Test-Path variable:DotNetVersion)) {
$DotNetVersion = $(Invoke-WebRequest -UseBasicParsing $DotNetReleasesUrl | ConvertFrom-Json)[0]."version-sdk"
}
# Download and execute install script
$DotNetInstallFile = "$TempDirectory\dotnet-install.ps1"
md -force $TempDirectory > $null
(New-Object System.Net.WebClient).DownloadFile($DotNetInstallUrl, $DotNetInstallFile)
ExecSafe { & $DotNetInstallFile -InstallDir $DotNetDirectory -Version $DotNetVersion -NoPath }
}
Write-Output "Microsoft (R) .NET Core SDK version $(& $env:DOTNET_EXE --version)"
ExecSafe { & $env:DOTNET_EXE run --project $BuildProjectFile -- $BuildArguments }
-68
View File
@@ -1,68 +0,0 @@
#!/usr/bin/env bash
echo $(bash --version 2>&1 | head -n 1)
#CUSTOMPARAM=0
BUILD_ARGUMENTS=()
for i in "$@"; do
case $(echo $1 | awk '{print tolower($0)}') in
# -custom-param) CUSTOMPARAM=1;;
*) BUILD_ARGUMENTS+=("$1") ;;
esac
shift
done
set -eo pipefail
SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
###########################################################################
# CONFIGURATION
###########################################################################
BUILD_PROJECT_FILE="$SCRIPT_DIR/build/_build.csproj"
TEMP_DIRECTORY="$SCRIPT_DIR//.tmp"
DOTNET_GLOBAL_FILE="$SCRIPT_DIR//global.json"
DOTNET_INSTALL_URL="https://raw.githubusercontent.com/dotnet/cli/master/scripts/obtain/dotnet-install.sh"
DOTNET_RELEASES_URL="https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases.json"
export DOTNET_CLI_TELEMETRY_OPTOUT=1
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
export NUGET_XMLDOC_MODE="skip"
###########################################################################
# EXECUTION
###########################################################################
function FirstJsonValue {
perl -nle 'print $1 if m{"'$1'": "([^"\-]+)",?}' <<< ${@:2}
}
# If global.json exists, load expected version
if [ -f "$DOTNET_GLOBAL_FILE" ]; then
DOTNET_VERSION=$(FirstJsonValue "version" $(cat "$DOTNET_GLOBAL_FILE"))
fi
# If dotnet is installed locally, and expected version is not set or installation matches the expected version
if [[ -x "$(command -v dotnet)" && (-z ${DOTNET_VERSION+x} || $(dotnet --version) == "$DOTNET_VERSION") ]]; then
export DOTNET_EXE="$(command -v dotnet)"
else
DOTNET_DIRECTORY="$TEMP_DIRECTORY/dotnet-unix"
export DOTNET_EXE="$DOTNET_DIRECTORY/dotnet"
# If expected version is not set, get latest version
if [ -z ${DOTNET_VERSION+x} ]; then
DOTNET_VERSION=$(FirstJsonValue "version-sdk" $(curl -s "$DOTNET_RELEASES_URL"))
fi
# Download and execute install script
DOTNET_INSTALL_FILE="$TEMP_DIRECTORY/dotnet-install.sh"
mkdir -p "$TEMP_DIRECTORY"
curl -Lsfo "$DOTNET_INSTALL_FILE" "$DOTNET_INSTALL_URL"
chmod +x "$DOTNET_INSTALL_FILE"
"$DOTNET_INSTALL_FILE" --install-dir "$DOTNET_DIRECTORY" --version "$DOTNET_VERSION" --no-path
fi
echo "Microsoft (R) .NET Core SDK version $("$DOTNET_EXE" --version)"
"$DOTNET_EXE" run --project "$BUILD_PROJECT_FILE" -- ${BUILD_ARGUMENTS[@]}
-495
View File
@@ -1,495 +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_BUS_INVALID_HANDLE = 0xE0000013,
VIGEM_ERROR_XUSB_USERINDEX_OUT_OF_RANGE = 0xE0000014
} 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__
-206
View File
@@ -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);
}
-50
View File
@@ -1,50 +0,0 @@
#pragma once
#include "ViGEmCommon.h"
#include <limits.h>
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;
}
@@ -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
-8
View File
@@ -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`.
-794
View File
@@ -1,794 +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 <Windows.h>
#include <cstdlib>
#include <SetupAPI.h>
#include <initguid.h>
#include "km/ViGEmBusShared.h"
#include "ViGEmClient.h"
#include <winioctl.h>
#include <climits>
#include <mutex>
#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<PVIGEM_TARGET>(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()
{
const auto driver = static_cast<PVIGEM_CLIENT>(malloc(sizeof(VIGEM_CLIENT)));
if (!driver)
return nullptr;
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)
{
if (!vigem)
return VIGEM_ERROR_BUS_INVALID_HANDLE;
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;
}
const 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
const auto detailDataBuffer = static_cast<PSP_DEVICE_INTERFACE_DETAIL_DATA>(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)
return;
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)
{
const auto target = VIGEM_TARGET_ALLOC_INIT(Xbox360Wired);
if (!target)
return nullptr;
target->VendorId = 0x045E;
target->ProductId = 0x028E;
return target;
}
PVIGEM_TARGET vigem_target_ds4_alloc(void)
{
const auto target = VIGEM_TARGET_ALLOC_INIT(DualShock4Wired);
if (!target)
return nullptr;
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)
return VIGEM_ERROR_BUS_INVALID_HANDLE;
if (!target)
return VIGEM_ERROR_INVALID_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)
return VIGEM_ERROR_BUS_INVALID_HANDLE;
if (!target)
return VIGEM_ERROR_INVALID_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;
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)
return VIGEM_ERROR_BUS_INVALID_HANDLE;
if (!target)
return VIGEM_ERROR_INVALID_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);
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)
return VIGEM_ERROR_BUS_INVALID_HANDLE;
if (!target)
return VIGEM_ERROR_INVALID_TARGET;
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<DWORD_PTR>(notification))
return VIGEM_ERROR_CALLBACK_ALREADY_REGISTERED;
target->Notification = reinterpret_cast<DWORD_PTR>(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(&notify, _Target->SerialNo);
do
{
DeviceIoControl(_Client->hBusDevice,
IOCTL_XUSB_REQUEST_NOTIFICATION,
&notify,
notify.Size,
&notify,
notify.Size,
&transfered,
&lOverlapped);
if (GetOverlappedResult(_Client->hBusDevice, &lOverlapped, &transfered, TRUE) != 0)
{
if (_Target->Notification == NULL)
{
CloseHandle(lOverlapped.hEvent);
return;
}
reinterpret_cast<PFN_VIGEM_X360_NOTIFICATION>(_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)
return VIGEM_ERROR_BUS_INVALID_HANDLE;
if (!target)
return VIGEM_ERROR_INVALID_TARGET;
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<DWORD_PTR>(notification))
return VIGEM_ERROR_CALLBACK_ALREADY_REGISTERED;
target->Notification = reinterpret_cast<DWORD_PTR>(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(&notify, _Target->SerialNo);
do
{
DeviceIoControl(_Client->hBusDevice,
IOCTL_DS4_REQUEST_NOTIFICATION,
&notify,
notify.Size,
&notify,
notify.Size,
&transfered,
&lOverlapped);
if (GetOverlappedResult(_Client->hBusDevice, &lOverlapped, &transfered, TRUE) != 0)
{
if (_Target->Notification == NULL)
{
CloseHandle(lOverlapped.hEvent);
return;
}
reinterpret_cast<PFN_VIGEM_DS4_NOTIFICATION>(_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)
return VIGEM_ERROR_BUS_INVALID_HANDLE;
if (!target)
return VIGEM_ERROR_INVALID_TARGET;
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)
return VIGEM_ERROR_BUS_INVALID_HANDLE;
if (!target)
return VIGEM_ERROR_INVALID_TARGET;
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)
return VIGEM_ERROR_BUS_INVALID_HANDLE;
if (!target)
return VIGEM_ERROR_INVALID_TARGET;
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)
{
const auto error = GetLastError();
if (error == ERROR_ACCESS_DENIED)
{
CloseHandle(lOverlapped.hEvent);
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;
//}
}
CloseHandle(lOverlapped.hEvent);
*index = gui.UserIndex;
return VIGEM_ERROR_NONE;
}
-100
View File
@@ -1,100 +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
#pragma code_page(1252)
#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 "000904b0"
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", 0x9, 1200
END
END
#endif // German (Austria) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
@@ -1,313 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug_DLL|Win32">
<Configuration>Debug_DLL</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug_DLL|x64">
<Configuration>Debug_DLL</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug_LIB|Win32">
<Configuration>Debug_LIB</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release_DLL|Win32">
<Configuration>Release_DLL</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release_DLL|x64">
<Configuration>Release_DLL</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release_LIB|Win32">
<Configuration>Release_LIB</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug_LIB|x64">
<Configuration>Debug_LIB</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release_LIB|x64">
<Configuration>Release_LIB</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{7DB06674-1F4F-464B-8E1C-172E9587F9DC}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>ViGEmClient</RootNamespace>
</PropertyGroup>
<PropertyGroup Condition="'$(WindowsTargetPlatformVersion)'==''">
<!-- Latest Target Version property -->
<LatestTargetPlatformVersion>$([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0'))</LatestTargetPlatformVersion>
<WindowsTargetPlatformVersion Condition="'$(WindowsTargetPlatformVersion)' == ''">$(LatestTargetPlatformVersion)</WindowsTargetPlatformVersion>
<TargetPlatformVersion>$(WindowsTargetPlatformVersion)</TargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_LIB|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_DLL|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_LIB|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_DLL|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_LIB|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_DLL|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_LIB|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_DLL|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug_LIB|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug_DLL|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release_LIB|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release_DLL|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug_LIB|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug_DLL|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release_LIB|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release_DLL|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_LIB|Win32'">
<IncludePath>$(ProjectDir)../include;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
<OutDir>$(SolutionDir)lib\debug\$(PlatformShortName)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_DLL|Win32'">
<IncludePath>$(ProjectDir)../include;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
<OutDir>$(SolutionDir)bin\debug\$(PlatformShortName)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_LIB|Win32'">
<IncludePath>$(ProjectDir)../include;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
<OutDir>$(SolutionDir)lib\release\$(PlatformShortName)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_DLL|Win32'">
<IncludePath>$(ProjectDir)../include;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
<OutDir>$(SolutionDir)bin\release\$(PlatformShortName)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_LIB|x64'">
<IncludePath>$(ProjectDir)../include;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
<OutDir>$(SolutionDir)lib\debug\$(PlatformShortName)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_DLL|x64'">
<IncludePath>$(ProjectDir)../include;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
<OutDir>$(SolutionDir)bin\debug\$(PlatformShortName)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_LIB|x64'">
<IncludePath>$(ProjectDir)../include;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
<OutDir>$(SolutionDir)lib\release\$(PlatformShortName)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_DLL|x64'">
<IncludePath>$(ProjectDir)../include;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
<OutDir>$(SolutionDir)bin\release\$(PlatformShortName)\</OutDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug_LIB|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
</Link>
<Lib>
<TargetMachine>MachineX86</TargetMachine>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug_DLL|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>VIGEM_DYNAMIC;VIGEM_EXPORTS;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<AdditionalDependencies>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)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug_LIB|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug_DLL|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>VIGEM_DYNAMIC;VIGEM_EXPORTS;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<AdditionalDependencies>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)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_LIB|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<Lib>
<TargetMachine>MachineX86</TargetMachine>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_DLL|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>VIGEM_DYNAMIC;VIGEM_EXPORTS;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>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)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_LIB|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_DLL|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>VIGEM_DYNAMIC;VIGEM_EXPORTS;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>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)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="$(SolutionDir)\Include\ViGEmBusShared.h" />
<ClInclude Include="$(SolutionDir)\Include\ViGEmClient.h" />
<ClInclude Include="$(SolutionDir)\Include\ViGEmCommon.h" />
<ClInclude Include="$(SolutionDir)\Include\ViGEmUtil.h" />
<ClInclude Include="resource.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="ViGEmClient.cpp" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="ViGEmClient.rc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
@@ -1,44 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="resource.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="$(SolutionDir)\Include\ViGEmBusShared.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="$(SolutionDir)\Include\ViGEmClient.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="$(SolutionDir)\Include\ViGEmCommon.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="$(SolutionDir)\Include\ViGEmUtil.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="ViGEmClient.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="ViGEmClient.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
</Project>
-14
View File
@@ -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