Added tester console application

Typo fixes
Fixed a bug where bus handle wasn't checked correctly
This commit is contained in:
Benjamin Höglinger-Stelzer
2019-04-16 18:10:50 +02:00
parent 005a152323
commit 7d8a5248f0
5 changed files with 325 additions and 20 deletions

View File

@@ -7,16 +7,24 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ViGEmClient", "src\ViGEmCli
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "_build", "build\_build.csproj", "{A11CD588-F74A-41B5-9E5B-E60937052009}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "App", "App", "{8169FFB3-60F9-4A0C-B172-8E26B982B45F}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Tester", "app\Tester\Tester.vcxproj", "{2F4ED0AB-0B51-4506-91AA-1984C5D44B85}"
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
Debug|x64 = Debug|x64
Debug|x86 = Debug|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
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7DB06674-1F4F-464B-8E1C-172E9587F9DC}.Debug_DLL|x64.ActiveCfg = Debug_DLL|x64
@@ -27,6 +35,10 @@ Global
{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}.Debug|x64.ActiveCfg = Debug_LIB|x64
{7DB06674-1F4F-464B-8E1C-172E9587F9DC}.Debug|x64.Build.0 = Debug_LIB|x64
{7DB06674-1F4F-464B-8E1C-172E9587F9DC}.Debug|x86.ActiveCfg = Debug_LIB|Win32
{7DB06674-1F4F-464B-8E1C-172E9587F9DC}.Debug|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
@@ -35,6 +47,10 @@ Global
{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
{7DB06674-1F4F-464B-8E1C-172E9587F9DC}.Release|x64.ActiveCfg = Release_LIB|x64
{7DB06674-1F4F-464B-8E1C-172E9587F9DC}.Release|x64.Build.0 = Release_LIB|x64
{7DB06674-1F4F-464B-8E1C-172E9587F9DC}.Release|x86.ActiveCfg = Release_LIB|Win32
{7DB06674-1F4F-464B-8E1C-172E9587F9DC}.Release|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|x64.Build.0 = Debug|Any CPU
{A11CD588-F74A-41B5-9E5B-E60937052009}.Debug_DLL|x86.ActiveCfg = Debug|Any CPU
@@ -43,6 +59,10 @@ Global
{A11CD588-F74A-41B5-9E5B-E60937052009}.Debug_LIB|x64.Build.0 = Debug|Any CPU
{A11CD588-F74A-41B5-9E5B-E60937052009}.Debug_LIB|x86.ActiveCfg = Debug|Any CPU
{A11CD588-F74A-41B5-9E5B-E60937052009}.Debug_LIB|x86.Build.0 = Debug|Any CPU
{A11CD588-F74A-41B5-9E5B-E60937052009}.Debug|x64.ActiveCfg = Debug|Any CPU
{A11CD588-F74A-41B5-9E5B-E60937052009}.Debug|x64.Build.0 = Debug|Any CPU
{A11CD588-F74A-41B5-9E5B-E60937052009}.Debug|x86.ActiveCfg = Debug|Any CPU
{A11CD588-F74A-41B5-9E5B-E60937052009}.Debug|x86.Build.0 = Debug|Any CPU
{A11CD588-F74A-41B5-9E5B-E60937052009}.Release_DLL|x64.ActiveCfg = Release|Any CPU
{A11CD588-F74A-41B5-9E5B-E60937052009}.Release_DLL|x64.Build.0 = Release|Any CPU
{A11CD588-F74A-41B5-9E5B-E60937052009}.Release_DLL|x86.ActiveCfg = Release|Any CPU
@@ -51,10 +71,41 @@ Global
{A11CD588-F74A-41B5-9E5B-E60937052009}.Release_LIB|x64.Build.0 = Release|Any CPU
{A11CD588-F74A-41B5-9E5B-E60937052009}.Release_LIB|x86.ActiveCfg = Release|Any CPU
{A11CD588-F74A-41B5-9E5B-E60937052009}.Release_LIB|x86.Build.0 = Release|Any CPU
{A11CD588-F74A-41B5-9E5B-E60937052009}.Release|x64.ActiveCfg = Release|Any CPU
{A11CD588-F74A-41B5-9E5B-E60937052009}.Release|x64.Build.0 = Release|Any CPU
{A11CD588-F74A-41B5-9E5B-E60937052009}.Release|x86.ActiveCfg = Release|Any CPU
{A11CD588-F74A-41B5-9E5B-E60937052009}.Release|x86.Build.0 = Release|Any CPU
{2F4ED0AB-0B51-4506-91AA-1984C5D44B85}.Debug_DLL|x64.ActiveCfg = Debug|x64
{2F4ED0AB-0B51-4506-91AA-1984C5D44B85}.Debug_DLL|x64.Build.0 = Debug|x64
{2F4ED0AB-0B51-4506-91AA-1984C5D44B85}.Debug_DLL|x86.ActiveCfg = Debug|Win32
{2F4ED0AB-0B51-4506-91AA-1984C5D44B85}.Debug_DLL|x86.Build.0 = Debug|Win32
{2F4ED0AB-0B51-4506-91AA-1984C5D44B85}.Debug_LIB|x64.ActiveCfg = Debug|x64
{2F4ED0AB-0B51-4506-91AA-1984C5D44B85}.Debug_LIB|x64.Build.0 = Debug|x64
{2F4ED0AB-0B51-4506-91AA-1984C5D44B85}.Debug_LIB|x86.ActiveCfg = Debug|Win32
{2F4ED0AB-0B51-4506-91AA-1984C5D44B85}.Debug_LIB|x86.Build.0 = Debug|Win32
{2F4ED0AB-0B51-4506-91AA-1984C5D44B85}.Debug|x64.ActiveCfg = Debug|x64
{2F4ED0AB-0B51-4506-91AA-1984C5D44B85}.Debug|x64.Build.0 = Debug|x64
{2F4ED0AB-0B51-4506-91AA-1984C5D44B85}.Debug|x86.ActiveCfg = Debug|Win32
{2F4ED0AB-0B51-4506-91AA-1984C5D44B85}.Debug|x86.Build.0 = Debug|Win32
{2F4ED0AB-0B51-4506-91AA-1984C5D44B85}.Release_DLL|x64.ActiveCfg = Release|x64
{2F4ED0AB-0B51-4506-91AA-1984C5D44B85}.Release_DLL|x64.Build.0 = Release|x64
{2F4ED0AB-0B51-4506-91AA-1984C5D44B85}.Release_DLL|x86.ActiveCfg = Release|Win32
{2F4ED0AB-0B51-4506-91AA-1984C5D44B85}.Release_DLL|x86.Build.0 = Release|Win32
{2F4ED0AB-0B51-4506-91AA-1984C5D44B85}.Release_LIB|x64.ActiveCfg = Release|x64
{2F4ED0AB-0B51-4506-91AA-1984C5D44B85}.Release_LIB|x64.Build.0 = Release|x64
{2F4ED0AB-0B51-4506-91AA-1984C5D44B85}.Release_LIB|x86.ActiveCfg = Release|Win32
{2F4ED0AB-0B51-4506-91AA-1984C5D44B85}.Release_LIB|x86.Build.0 = Release|Win32
{2F4ED0AB-0B51-4506-91AA-1984C5D44B85}.Release|x64.ActiveCfg = Release|x64
{2F4ED0AB-0B51-4506-91AA-1984C5D44B85}.Release|x64.Build.0 = Release|x64
{2F4ED0AB-0B51-4506-91AA-1984C5D44B85}.Release|x86.ActiveCfg = Release|Win32
{2F4ED0AB-0B51-4506-91AA-1984C5D44B85}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{2F4ED0AB-0B51-4506-91AA-1984C5D44B85} = {8169FFB3-60F9-4A0C-B172-8E26B982B45F}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {D5CD61FD-80BB-4E0E-840C-BAF66ABB1CF0}
EndGlobalSection

47
app/Tester/Tester.cpp Normal file
View File

@@ -0,0 +1,47 @@
// Tester.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#include <ViGEm/Client.h>
#include <iostream>
VOID CALLBACK notification(
PVIGEM_CLIENT Client,
PVIGEM_TARGET Target,
UCHAR LargeMotor,
UCHAR SmallMotor,
UCHAR LedNumber
)
{
std::cout << LargeMotor << " " << SmallMotor << std::endl;
}
int main()
{
const auto client = vigem_alloc();
const auto x360 = vigem_target_x360_alloc();
auto ret = vigem_target_add(client, x360);
ret = vigem_target_x360_register_notification(client, x360, &notification);
getchar();
vigem_target_remove(client, x360);
vigem_target_free(x360);
vigem_free(client);
}
// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu
// Tips for Getting Started:
// 1. Use the Solution Explorer window to add/manage files
// 2. Use the Team Explorer window to connect to source control
// 3. Use the Output window to see build output and other messages
// 4. Use the Error List window to view errors
// 5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
// 6. In the future, to open this project again, go to File > Open > Project and select the .sln file

176
app/Tester/Tester.vcxproj Normal file
View File

@@ -0,0 +1,176 @@
<?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|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>15.0</VCProjectVersion>
<ProjectGuid>{2F4ED0AB-0B51-4506-91AA-1984C5D44B85}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>Tester</RootNamespace>
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</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|Win32'">
<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|Win32'">
<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|x64'">
<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|x64'">
<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)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>$(SolutionDir)include;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>$(SolutionDir)include;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>$(SolutionDir)include;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>$(SolutionDir)include;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<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|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<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|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<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|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<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>
<ClCompile Include="Tester.cpp" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\ViGEmClient.vcxproj">
<Project>{7db06674-1f4f-464b-8e1c-172e9587f9dc}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,22 @@
<?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;ipp;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>
<ClCompile Include="Tester.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@@ -418,7 +418,7 @@ VIGEM_ERROR vigem_target_add(PVIGEM_CLIENT vigem, PVIGEM_TARGET target)
if (!target)
return VIGEM_ERROR_INVALID_TARGET;
if (vigem->hBusDevice == nullptr)
if (vigem->hBusDevice == INVALID_HANDLE_VALUE)
return VIGEM_ERROR_BUS_NOT_FOUND;
if (target->State == VIGEM_TARGET_NEW)
@@ -472,7 +472,7 @@ VIGEM_ERROR vigem_target_add_async(PVIGEM_CLIENT vigem, PVIGEM_TARGET target, PF
if (!target)
return VIGEM_ERROR_INVALID_TARGET;
if (vigem->hBusDevice == nullptr)
if (vigem->hBusDevice == INVALID_HANDLE_VALUE)
return VIGEM_ERROR_BUS_NOT_FOUND;
if (target->State == VIGEM_TARGET_NEW)
@@ -486,7 +486,7 @@ VIGEM_ERROR vigem_target_add_async(PVIGEM_CLIENT vigem, PVIGEM_TARGET target, PF
PVIGEM_CLIENT _Client,
PFN_VIGEM_TARGET_ADD_RESULT _Result)
{
DWORD transfered = 0;
DWORD transferred = 0;
VIGEM_PLUGIN_TARGET plugin;
OVERLAPPED lOverlapped = { 0 };
lOverlapped.hEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr);
@@ -498,9 +498,18 @@ VIGEM_ERROR vigem_target_add_async(PVIGEM_CLIENT vigem, PVIGEM_TARGET target, PF
plugin.VendorId = _Target->VendorId;
plugin.ProductId = _Target->ProductId;
DeviceIoControl(_Client->hBusDevice, IOCTL_VIGEM_PLUGIN_TARGET, &plugin, plugin.Size, nullptr, 0, &transfered, &lOverlapped);
DeviceIoControl(
_Client->hBusDevice,
IOCTL_VIGEM_PLUGIN_TARGET,
&plugin,
plugin.Size,
nullptr,
0,
&transferred,
&lOverlapped
);
if (GetOverlappedResult(_Client->hBusDevice, &lOverlapped, &transfered, TRUE) != 0)
if (GetOverlappedResult(_Client->hBusDevice, &lOverlapped, &transferred, TRUE) != 0)
{
_Target->State = VIGEM_TARGET_CONNECTED;
CloseHandle(lOverlapped.hEvent);
@@ -532,7 +541,7 @@ VIGEM_ERROR vigem_target_remove(PVIGEM_CLIENT vigem, PVIGEM_TARGET target)
if (!target)
return VIGEM_ERROR_INVALID_TARGET;
if (vigem->hBusDevice == nullptr)
if (vigem->hBusDevice == INVALID_HANDLE_VALUE)
return VIGEM_ERROR_BUS_NOT_FOUND;
if (target->State == VIGEM_TARGET_NEW)
@@ -584,7 +593,7 @@ VIGEM_ERROR vigem_target_x360_register_notification(
if (!target)
return VIGEM_ERROR_INVALID_TARGET;
if (vigem->hBusDevice == nullptr)
if (vigem->hBusDevice == INVALID_HANDLE_VALUE)
return VIGEM_ERROR_BUS_NOT_FOUND;
if (target->SerialNo == 0 || notification == nullptr)
@@ -613,7 +622,7 @@ VIGEM_ERROR vigem_target_ds4_register_notification(
if (!target)
return VIGEM_ERROR_INVALID_TARGET;
if (vigem->hBusDevice == nullptr)
if (vigem->hBusDevice == INVALID_HANDLE_VALUE)
return VIGEM_ERROR_BUS_NOT_FOUND;
if (target->SerialNo == 0 || notification == nullptr)
@@ -726,13 +735,13 @@ VIGEM_ERROR vigem_target_x360_update(
if (!target)
return VIGEM_ERROR_INVALID_TARGET;
if (vigem->hBusDevice == nullptr)
if (vigem->hBusDevice == INVALID_HANDLE_VALUE)
return VIGEM_ERROR_BUS_NOT_FOUND;
if (target->SerialNo == 0)
return VIGEM_ERROR_INVALID_TARGET;
DWORD transfered = 0;
DWORD transferred = 0;
OVERLAPPED lOverlapped = { 0 };
lOverlapped.hEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr);
@@ -748,11 +757,11 @@ VIGEM_ERROR vigem_target_x360_update(
xsr.Size,
nullptr,
0,
&transfered,
&transferred,
&lOverlapped
);
if (GetOverlappedResult(vigem->hBusDevice, &lOverlapped, &transfered, TRUE) == 0)
if (GetOverlappedResult(vigem->hBusDevice, &lOverlapped, &transferred, TRUE) == 0)
{
if (GetLastError() == ERROR_ACCESS_DENIED)
{
@@ -778,13 +787,13 @@ VIGEM_ERROR vigem_target_ds4_update(
if (!target)
return VIGEM_ERROR_INVALID_TARGET;
if (vigem->hBusDevice == nullptr)
if (vigem->hBusDevice == INVALID_HANDLE_VALUE)
return VIGEM_ERROR_BUS_NOT_FOUND;
if (target->SerialNo == 0)
return VIGEM_ERROR_INVALID_TARGET;
DWORD transfered = 0;
DWORD transferred = 0;
OVERLAPPED lOverlapped = { 0 };
lOverlapped.hEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr);
@@ -800,11 +809,11 @@ VIGEM_ERROR vigem_target_ds4_update(
dsr.Size,
nullptr,
0,
&transfered,
&transferred,
&lOverlapped
);
if (GetOverlappedResult(vigem->hBusDevice, &lOverlapped, &transfered, TRUE) == 0)
if (GetOverlappedResult(vigem->hBusDevice, &lOverlapped, &transferred, TRUE) == 0)
{
if (GetLastError() == ERROR_ACCESS_DENIED)
{
@@ -845,13 +854,13 @@ VIGEM_ERROR vigem_target_x360_get_user_index(
if (!target)
return VIGEM_ERROR_INVALID_TARGET;
if (vigem->hBusDevice == nullptr)
if (vigem->hBusDevice == INVALID_HANDLE_VALUE)
return VIGEM_ERROR_BUS_NOT_FOUND;
if (target->SerialNo == 0 || target->Type != Xbox360Wired)
return VIGEM_ERROR_INVALID_TARGET;
DWORD transfered = 0;
DWORD transferred = 0;
OVERLAPPED lOverlapped = { 0 };
lOverlapped.hEvent = CreateEvent(nullptr, FALSE, FALSE, nullptr);
@@ -865,11 +874,11 @@ VIGEM_ERROR vigem_target_x360_get_user_index(
gui.Size,
&gui,
gui.Size,
&transfered,
&transferred,
&lOverlapped
);
if (GetOverlappedResult(vigem->hBusDevice, &lOverlapped, &transfered, TRUE) == 0)
if (GetOverlappedResult(vigem->hBusDevice, &lOverlapped, &transferred, TRUE) == 0)
{
const auto error = GetLastError();