diff --git a/CreateVersion/CreateVersion.vcxproj b/CreateVersion/CreateVersion.vcxproj
index 321f725..05942e5 100644
--- a/CreateVersion/CreateVersion.vcxproj
+++ b/CreateVersion/CreateVersion.vcxproj
@@ -38,58 +38,58 @@
{9EB6193B-FCC1-450F-9B1F-B64E8B380940}
Win32Proj
CreateVersion
- 8.1
+ 10.0.14393.0
Application
true
- v120
+ v140
Unicode
Application
true
- v120
+ v140
Unicode
Application
false
- v120
+ v140
true
Unicode
Application
false
- v120
+ v140
true
Unicode
Application
true
- v120
+ v140
Unicode
Application
true
- v120
+ v140
Unicode
Application
false
- v120
+ v140
true
Unicode
Application
false
- v120
+ v140
true
Unicode
diff --git a/apps/FfbMon/FfbMon.cpp b/apps/FfbMon/FfbMon.cpp
index 738be3d..c21d15f 100644
--- a/apps/FfbMon/FfbMon.cpp
+++ b/apps/FfbMon/FfbMon.cpp
@@ -12,6 +12,7 @@
#include "FfbMon.h"
#include "Math.h"
+using namespace vJoy;
int ffb_direction = 0;
int ffb_strenght = 0;
diff --git a/apps/FfbMon/FfbMon.vcxproj b/apps/FfbMon/FfbMon.vcxproj
index edc6ec9..4f491a0 100644
--- a/apps/FfbMon/FfbMon.vcxproj
+++ b/apps/FfbMon/FfbMon.vcxproj
@@ -1,10 +1,26 @@

-
+
+
+ Debug-Xbox
+ Win32
+
+
+ Debug-Xbox
+ x64
+
Debug
Win32
+
+ Release-Xbox
+ Win32
+
+
+ Release-Xbox
+ x64
+
Release
Win32
@@ -19,7 +35,7 @@
- v120
+ v140
Application
None
FfbMon
@@ -37,28 +53,48 @@
{F47958E4-9FF0-4E14-910A-1BA0A0F6D863}
$(MSBuildProjectName)
- 8.1
+ 10.0.14393.0
Windows10
True
Unicode
+
+ Windows10
+ True
+ Unicode
+
Windows10
False
Unicode
+
+ Windows10
+ False
+ Unicode
+
Windows10
True
Unicode
+
+ Windows10
+ True
+ Unicode
+
Windows10
False
Unicode
+
+ Windows10
+ False
+ Unicode
+
@@ -66,29 +102,54 @@
+
+
+
+
+
+
+
+
+
+
+
+
$(WindowsSDK_IncludePath);$(VC_IncludePath)
$(VC_ExecutablePath_x86);$(WindowsSDK_ExecutablePath);$(VS_ExecutablePath);$(MSBuild_ExecutablePath);$(SystemRoot)\SysWow64;$(FxCopDir);$(PATH);$(LOCALAPPDATA)\Atlassian\SourceTree\git_local\bin
+
+ $(WindowsSDK_IncludePath);$(VC_IncludePath)
+ $(VC_ExecutablePath_x86);$(WindowsSDK_ExecutablePath);$(VS_ExecutablePath);$(MSBuild_ExecutablePath);$(SystemRoot)\SysWow64;$(FxCopDir);$(PATH);$(LOCALAPPDATA)\Atlassian\SourceTree\git_local\bin
+
$(VC_ExecutablePath_x86);$(WindowsSDK_ExecutablePath);$(VS_ExecutablePath);$(MSBuild_ExecutablePath);$(SystemRoot)\SysWow64;$(FxCopDir);$(PATH);$(LOCALAPPDATA)\Atlassian\SourceTree\git_local\bin
+
+ $(VC_ExecutablePath_x86);$(WindowsSDK_ExecutablePath);$(VS_ExecutablePath);$(MSBuild_ExecutablePath);$(SystemRoot)\SysWow64;$(FxCopDir);$(PATH);$(LOCALAPPDATA)\Atlassian\SourceTree\git_local\bin
+
$(VC_ExecutablePath_x64);$(WindowsSDK_ExecutablePath);$(VS_ExecutablePath);$(MSBuild_ExecutablePath);$(FxCopDir);$(PATH);$(LOCALAPPDATA)\Atlassian\SourceTree\git_local\bin
+
+ $(VC_ExecutablePath_x64);$(WindowsSDK_ExecutablePath);$(VS_ExecutablePath);$(MSBuild_ExecutablePath);$(FxCopDir);$(PATH);$(LOCALAPPDATA)\Atlassian\SourceTree\git_local\bin
+
$(VC_ExecutablePath_x64);$(WindowsSDK_ExecutablePath);$(VS_ExecutablePath);$(MSBuild_ExecutablePath);$(FxCopDir);$(PATH);$(LOCALAPPDATA)\Atlassian\SourceTree\git_local\bin
+
+ $(VC_ExecutablePath_x64);$(WindowsSDK_ExecutablePath);$(VS_ExecutablePath);$(MSBuild_ExecutablePath);$(FxCopDir);$(PATH);$(LOCALAPPDATA)\Atlassian\SourceTree\git_local\bin
+
@@ -108,6 +169,22 @@
Deleting Version file
+
+
+ $(OutDir)
+ vJoyInterface.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)
+
+
+ $(OutDir)CreateVersion.exe $(ProjectDir)gen-versioninfo.h
+
+
+ Generating Version File
+
+
+ DEL $(ProjectDir)gen-versioninfo.h
+ Deleting Version file
+
+
$(OutDir)
@@ -124,6 +201,22 @@
Deleting Version file
+
+
+ $(OutDir)
+ vJoyInterface.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)
+
+
+ $(OutDir)CreateVersion.exe $(ProjectDir)gen-versioninfo.h
+
+
+ Generating Version File
+
+
+ DEL $(ProjectDir)gen-versioninfo.h
+ Deleting Version file
+
+
$(OutDir)
@@ -140,6 +233,22 @@
Deleting Version file
+
+
+ $(OutDir)
+ vJoyInterface.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)
+
+
+ $(OutDir)CreateVersion.exe $(ProjectDir)gen-versioninfo.h
+
+
+ Generating Version File
+
+
+ DEL $(ProjectDir)gen-versioninfo.h
+ Deleting Version file
+
+
$(OutDir)
@@ -156,6 +265,22 @@
Deleting Version file
+
+
+ $(OutDir)
+ vJoyInterface.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)
+
+
+ $(OutDir)CreateVersion.exe $(ProjectDir)gen-versioninfo.h
+
+
+ Generating Version File
+
+
+ DEL $(ProjectDir)gen-versioninfo.h
+ Deleting Version file
+
+
diff --git a/apps/common/vJoyInterface.cpp b/apps/common/vJoyInterface.cpp
index da14fa0..ded8671 100644
--- a/apps/common/vJoyInterface.cpp
+++ b/apps/common/vJoyInterface.cpp
@@ -17,6 +17,8 @@ extern "C"
#include
#include "vJoyInterface.h"
+using namespace vJoy;
+
#define OLD_PREPARSED 0
#pragma warning( disable : 4706)
@@ -3507,7 +3509,7 @@ void Set_stat(int rID, VjdStat status)
//Else : Return VJD_STAT_UNKN
VjdStat Get_stat(int rID)
{
- VjdStat stat = VJD_STAT_UNKN;
+ VjdStat stat = VJD_STAT_UNKN;
// If doesn't exist - Return VJD_STAT_UNKN
if (vJoyDevices.find(rID) != vJoyDevices.end())
diff --git a/apps/common/vJoyInterface/Test-vXboxInterface/Debug-Xbox/.NETFramework,Version=v4.0.AssemblyAttributes.asm b/apps/common/vJoyInterface/Test-vXboxInterface/Debug-Xbox/.NETFramework,Version=v4.0.AssemblyAttributes.asm
new file mode 100644
index 0000000..98a2052
--- /dev/null
+++ b/apps/common/vJoyInterface/Test-vXboxInterface/Debug-Xbox/.NETFramework,Version=v4.0.AssemblyAttributes.asm
@@ -0,0 +1,4 @@
+; Listing generated by Microsoft (R) Optimizing Compiler Version 19.00.24213.1
+
+; Generated by VC++ for Common Language Runtime
+.file "C:\Users\FORMATEUR\AppData\Local\Temp\.NETFramework,Version=v4.0.AssemblyAttributes.cpp"
diff --git a/apps/common/vJoyInterface/Test-vXboxInterface/Test-vXboxInterface.cpp b/apps/common/vJoyInterface/Test-vXboxInterface/Test-vXboxInterface.cpp
index a5d436c..6be3a97 100644
--- a/apps/common/vJoyInterface/Test-vXboxInterface/Test-vXboxInterface.cpp
+++ b/apps/common/vJoyInterface/Test-vXboxInterface/Test-vXboxInterface.cpp
@@ -16,20 +16,22 @@ extern "C"
#include
#include
-#include "..\..\..\..\inc\public.h"
-#include "..\vJoyInterface.h"
-#include "..\vXboxInterface.h"
+#include "..\..\vXboxInterfaceCppWrap\vXboxInterfaceCppWrap\IWrapper.h"
+#include "..\..\vXboxInterfaceCppWrap\vXboxInterfaceCppWrap\IWrapper.cpp"
-#ifndef XBOX
+
+using namespace std;
+using namespace vXbox;
+#ifdef XBOX
#pragma comment(lib, "vJoyInterface")
int main()
{
BOOL res;
UCHAR nEmpty;
-
+ IWrapper w;
// Test if bus exists
- BOOL bus = isVBusExists();
+ BOOL bus = isVBusExists();
if (bus)
printf("Virtual Xbox bus exists\n\n");
else
@@ -68,7 +70,7 @@ int main()
{
res = GetNumEmptyBusSlots(&nEmpty);
if (res)
- printf("\n\nNumber of Empty Slots: %d\n",nEmpty);
+ printf("\n\nNumber of Empty Slots: %d\n", nEmpty);
else
printf("\n\nCannot determine Number of Empty Slots");
@@ -84,49 +86,46 @@ int main()
printf("\nisControllerOwned(%d): %X\n", i, res);
}
printf("\n");
- SetTriggerL(2, 0);
- SetTriggerR(2, 0);
+ SetTriggerL(2, 0, XINPUT_GAMEPAD_TRIGGER_THRESHOLD);
+ SetTriggerR(2, 0, XINPUT_GAMEPAD_TRIGGER_THRESHOLD);
for (int T = 0; T < 100; T++)
{
- SetAxisX(1, T * 300);
- SetAxisY(1, (T * 300)*-1);
- SetAxisRx(1, T * 100);
- SetAxisRy(1, (T * 100)*-1);
+ SetAxisXY(1, (BYTE)(T * 300), (BYTE)((T * 300)*-1), HID_USAGE_X, HID_USAGE_Y, XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE);
+ SetAxisRxy(1, (BYTE)(T * 100), (BYTE)((T * 100)*-1), XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE);
switch (T)
{
- case 0:
- SetDpadUp(1);
- SetBtnA(1, FALSE);
- SetBtnB(1, TRUE);
- break;
- case 20:
- SetDpadRight(1);
- SetBtnB(1, FALSE);
- break;
- case 40:
- SetDpadDown(1);
- break;
- case 60:
- SetDpadLeft(1);
- break;
- case 80:
- SetDpadOff(1);
- SetBtnA(1, TRUE);
- break;
+ case 0:
+ SetDpadUp(1);
+ SetBtnA(1, FALSE);
+ SetBtnB(1, TRUE);
+ break;
+ case 20:
+ SetDpadRight(1);
+ SetBtnB(1, FALSE);
+ break;
+ case 40:
+ SetDpadDown(1);
+ break;
+ case 60:
+ SetDpadLeft(1);
+ break;
+ case 80:
+ SetDpadOff(1);
+ SetBtnA(1, TRUE);
+ break;
}
-
- SetTriggerL(1, 2 * T);
- SetTriggerR(1, 57 +(2 * T));
+
+ SetTriggerL(1, 2 * T, XINPUT_GAMEPAD_TRIGGER_THRESHOLD);
+ SetTriggerR(1, 57 + (2 * T), XINPUT_GAMEPAD_TRIGGER_THRESHOLD);
Sleep(100);
}
- SetTriggerL(1, 255);
- SetTriggerR(1, 255);
+ SetTriggerL(1, 255, XINPUT_GAMEPAD_TRIGGER_THRESHOLD);
+ SetTriggerR(1, 255, XINPUT_GAMEPAD_TRIGGER_THRESHOLD);
printf("Press any key to detect device feedback \n");
getchar();
- WORD LeftMotor, RightMotor;
UCHAR Led;
BOOL Led_Ok, Vib_Ok;
XINPUT_VIBRATION Vib;
@@ -159,11 +158,11 @@ int main()
return 0;
}
-#else // XBOX
+#else // !XBOX
int main()
{
printf("NOT Xbox mode\n");
return 0;
}
-#endif // XBOX
\ No newline at end of file
+#endif // !XBOX
\ No newline at end of file
diff --git a/apps/common/vJoyInterface/Test-vXboxInterface/Test-vXboxInterface.vcxproj b/apps/common/vJoyInterface/Test-vXboxInterface/Test-vXboxInterface.vcxproj
index af02dd5..6ab5037 100644
--- a/apps/common/vJoyInterface/Test-vXboxInterface/Test-vXboxInterface.vcxproj
+++ b/apps/common/vJoyInterface/Test-vXboxInterface/Test-vXboxInterface.vcxproj
@@ -38,7 +38,7 @@
{8B2B1B77-C83A-4160-9CC3-2FEEFE0C407A}
Win32Proj
TestvXboxInterface
- 8.1
+ 10.0.14393.0
@@ -46,12 +46,14 @@
true
v140
Unicode
+ true
Application
true
v140
Unicode
+ true
Application
@@ -59,6 +61,7 @@
v140
true
Unicode
+ true
Application
@@ -66,18 +69,21 @@
v140
true
Unicode
+ true
Application
true
v140
Unicode
+ true
Application
true
v140
Unicode
+ true
Application
@@ -85,13 +91,15 @@
v140
true
Unicode
+ true
Application
false
- v120
+ v140
true
Unicode
+ true
@@ -125,35 +133,59 @@
true
- ;
+ $(VC_ExecutablePath_x86);$(WindowsSDK_ExecutablePath);$(VS_ExecutablePath);$(MSBuild_ExecutablePath);$(SystemRoot)\SysWow64;$(FxCopDir);$(PATH);$(LOCALAPPDATA)\Atlassian\SourceTree\git_local\bin\
+ $(VC_ReferencesPath_x86);
+ .;$(SolutionDir)\inc;$(IncludePath);$(VC_IncludePath)
+ $(SolutionDir)$(Platform)\$(Configuration)\
true
- ;
+ $(VC_ExecutablePath_x86);$(WindowsSDK_ExecutablePath);$(VS_ExecutablePath);$(MSBuild_ExecutablePath);$(SystemRoot)\SysWow64;$(FxCopDir);$(PATH);$(LOCALAPPDATA)\Atlassian\SourceTree\git_local\bin\
+ $(VC_ReferencesPath_x86);
+ .;$(SolutionDir)\inc;$(IncludePath);$(VC_IncludePath)
+ $(SolutionDir)$(Platform)\$(Configuration)\
true
$(SolutionDir)$(Platform)\$(Configuration);$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(NETFXKitsDir)Lib\um\x64
+ $(VC_ReferencesPath_x64);
+ $(VC_ExecutablePath_x64);$(WindowsSDK_ExecutablePath);$(VS_ExecutablePath);$(MSBuild_ExecutablePath);$(FxCopDir);$(PATH);$(LOCALAPPDATA)\Atlassian\SourceTree\git_local\bin\
+ .;$(SolutionDir)\inc;$(IncludePath);$(VC_IncludePath);$(WindowsSDK_IncludePath);
true
$(SolutionDir)$(Platform)\$(Configuration);$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(NETFXKitsDir)Lib\um\x64
+ $(VC_ReferencesPath_x64);
+ $(VC_ExecutablePath_x64);$(WindowsSDK_ExecutablePath);$(VS_ExecutablePath);$(MSBuild_ExecutablePath);$(FxCopDir);$(PATH);$(LOCALAPPDATA)\Atlassian\SourceTree\git_local\bin\
+ .;$(SolutionDir)\inc;$(IncludePath);$(VC_IncludePath);$(WindowsSDK_IncludePath);
- false
- ;
+ true
+ $(VC_ExecutablePath_x86);$(WindowsSDK_ExecutablePath);$(VS_ExecutablePath);$(MSBuild_ExecutablePath);$(SystemRoot)\SysWow64;$(FxCopDir);$(PATH);$(LOCALAPPDATA)\Atlassian\SourceTree\git_local\bin\
+ $(VC_ReferencesPath_x86);
+ .;$(SolutionDir)\inc;$(IncludePath);$(VC_IncludePath)
+ $(SolutionDir)$(Platform)\$(Configuration)\
- false
- ;
+ true
+ $(VC_ExecutablePath_x86);$(WindowsSDK_ExecutablePath);$(VS_ExecutablePath);$(MSBuild_ExecutablePath);$(SystemRoot)\SysWow64;$(FxCopDir);$(PATH);$(LOCALAPPDATA)\Atlassian\SourceTree\git_local\bin\
+ $(VC_ReferencesPath_x86);
+ .;$(SolutionDir)\inc;$(IncludePath);$(VC_IncludePath)
+ $(SolutionDir)$(Platform)\$(Configuration)\
- false
+ true
$(SolutionDir)$(Platform)\$(Configuration);$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(NETFXKitsDir)Lib\um\x64
+ $(VC_ReferencesPath_x64);
+ $(VC_ExecutablePath_x64);$(WindowsSDK_ExecutablePath);$(VS_ExecutablePath);$(MSBuild_ExecutablePath);$(FxCopDir);$(PATH);$(LOCALAPPDATA)\Atlassian\SourceTree\git_local\bin\
+ .;$(SolutionDir)\inc;$(IncludePath);$(VC_IncludePath);$(WindowsSDK_IncludePath);
- false
+ true
$(SolutionDir)$(Platform)\$(Configuration);$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(NETFXKitsDir)Lib\um\x64
+ $(VC_ReferencesPath_x64);
+ $(VC_ExecutablePath_x64);$(WindowsSDK_ExecutablePath);$(VS_ExecutablePath);$(MSBuild_ExecutablePath);$(FxCopDir);$(PATH);$(LOCALAPPDATA)\Atlassian\SourceTree\git_local\bin\
+ .;$(SolutionDir)\inc;$(IncludePath);$(VC_IncludePath);$(WindowsSDK_IncludePath);
@@ -166,6 +198,13 @@
Console
true
+ 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)
+ $(SolutionDir)$(Platform)\$(Configuration)\;$(WindowsSdkDir)lib\$(DDKSpec)\km\$(DDKPlatform);$(WindowsSdkLibraryPath);%(AdditionalLibraryDirectories)
+
+
+
+
+ vXboxInterfaceCLR.dll
@@ -173,12 +212,19 @@
Use
Level3
Disabled
- WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ XBOX;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
true
Console
true
+ 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)
+ $(SolutionDir)$(Platform)\$(Configuration)\;$(WindowsSdkDir)lib\$(DDKSpec)\km\$(DDKPlatform);$(WindowsSdkLibraryPath);%(AdditionalLibraryDirectories)
+
+
+
+
+ vXboxInterfaceCLR.dll
@@ -192,6 +238,13 @@
Console
true
+ 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)
+ $(SolutionDir)$(Platform)\$(Configuration)\;$(WindowsSdkDir)lib\$(DDKSpec)\km\$(DDKPlatform);$(WindowsSdkLibraryPath);%(AdditionalLibraryDirectories)
+
+
+
+
+ vXboxInterfaceCLR.dll
@@ -199,12 +252,19 @@
Use
Level3
Disabled
- _DEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ XBOX;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
true
Console
true
+ 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)
+ $(SolutionDir)$(Platform)\$(Configuration)\;$(WindowsSdkDir)lib\$(DDKSpec)\km\$(DDKPlatform);$(WindowsSdkLibraryPath);%(AdditionalLibraryDirectories)
+
+
+
+
+ vXboxInterfaceCLR.dll
@@ -222,6 +282,13 @@
true
true
true
+ 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)
+ $(SolutionDir)$(Platform)\$(Configuration)\;$(WindowsSdkDir)lib\$(DDKSpec)\km\$(DDKPlatform);$(WindowsSdkLibraryPath);%(AdditionalLibraryDirectories)
+
+
+
+
+ vXboxInterfaceCLR.dll
@@ -231,7 +298,7 @@
MaxSpeed
true
true
- WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ XBOX;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
true
@@ -239,6 +306,13 @@
true
true
true
+ 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)
+ $(SolutionDir)$(Platform)\$(Configuration)\;$(WindowsSdkDir)lib\$(DDKSpec)\km\$(DDKPlatform);$(WindowsSdkLibraryPath);%(AdditionalLibraryDirectories)
+
+
+
+
+ vXboxInterfaceCLR.dll
@@ -256,6 +330,13 @@
true
true
true
+ 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)
+ $(SolutionDir)$(Platform)\$(Configuration)\;$(WindowsSdkDir)lib\$(DDKSpec)\km\$(DDKPlatform);$(WindowsSdkLibraryPath);%(AdditionalLibraryDirectories)
+
+
+
+
+ vXboxInterfaceCLR.dll
@@ -265,7 +346,7 @@
MaxSpeed
true
true
- NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ XBOX;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
true
@@ -273,6 +354,13 @@
true
true
true
+ 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)
+ $(SolutionDir)$(Platform)\$(Configuration)\;$(WindowsSdkDir)lib\$(DDKSpec)\km\$(DDKPlatform);$(WindowsSdkLibraryPath);%(AdditionalLibraryDirectories)
+
+
+
+
+ vXboxInterfaceCLR.dll
diff --git a/apps/common/vJoyInterface/Test-vXboxInterface/Test-vXboxInterface.vcxproj.filters b/apps/common/vJoyInterface/Test-vXboxInterface/Test-vXboxInterface.vcxproj.filters
index f1aa132..4409607 100644
--- a/apps/common/vJoyInterface/Test-vXboxInterface/Test-vXboxInterface.vcxproj.filters
+++ b/apps/common/vJoyInterface/Test-vXboxInterface/Test-vXboxInterface.vcxproj.filters
@@ -9,7 +9,7 @@
{93995380-89BD-4b04-88EB-625FBE52EBFB}
h;hh;hpp;hxx;hm;inl;inc;xsd
-
+
{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
diff --git a/apps/common/vJoyInterface/Test-vXboxInterface/stdafx.h b/apps/common/vJoyInterface/Test-vXboxInterface/stdafx.h
index 8db864b..52dc2e6 100644
--- a/apps/common/vJoyInterface/Test-vXboxInterface/stdafx.h
+++ b/apps/common/vJoyInterface/Test-vXboxInterface/stdafx.h
@@ -13,4 +13,5 @@
// TODO: reference additional headers your program requires here
-#include "windows.h"
\ No newline at end of file
+#include "windows.h"
+#include
\ No newline at end of file
diff --git a/apps/common/vJoyInterface/UpgradeLog.htm b/apps/common/vJoyInterface/UpgradeLog.htm
new file mode 100644
index 0000000..0dfc29a
Binary files /dev/null and b/apps/common/vJoyInterface/UpgradeLog.htm differ
diff --git a/apps/common/vJoyInterface/stdafx.h b/apps/common/vJoyInterface/stdafx.h
index 6168576..3383e06 100644
--- a/apps/common/vJoyInterface/stdafx.h
+++ b/apps/common/vJoyInterface/stdafx.h
@@ -15,7 +15,7 @@
#include
#include
+
@@ -64,10 +65,10 @@
vJoyInterface2012
$(VCTargetsPath11)
vJoyInterface
- 8.1
+ 10.0.14393.0
- v120
+ v140
DynamicLibrary
@@ -75,41 +76,49 @@
Windows8
true
Unicode
+ true
Windows8
true
Unicode
+ true
Windows7
false
Unicode
+ true
Windows7
false
Unicode
+ true
Windows8
true
Unicode
+ true
Windows8
true
Unicode
+ true
Windows7
false
Unicode
+ true
Windows7
false
Unicode
+ true
@@ -125,7 +134,7 @@
$(VC_ExecutablePath_x64);$(WindowsSDK_ExecutablePath);$(VS_ExecutablePath);$(MSBuild_ExecutablePath);$(FxCopDir);$(PATH);$(LOCALAPPDATA)\Atlassian\SourceTree\git_local\bin\
- .;$(SolutionDir)..\..\..\inc;$(IncludePath)
+ .;$(SolutionDir)\inc;$(IncludePath);$(VC_IncludePath)
true
$(SolutionDir)$(Platform)\$(Configuration)\
$(VC_ExecutablePath_x64);$(WindowsSDK_ExecutablePath);$(VS_ExecutablePath);$(MSBuild_ExecutablePath);$(FxCopDir);$(PATH);$(LOCALAPPDATA)\Atlassian\SourceTree\git_local\bin\
@@ -137,34 +146,34 @@
$(VC_ExecutablePath_x64);$(WindowsSDK_ExecutablePath);$(VS_ExecutablePath);$(MSBuild_ExecutablePath);$(FxCopDir);$(PATH);$(LOCALAPPDATA)\Atlassian\SourceTree\git_local\bin\
- .;$(SolutionDir)..\..\..\inc;$(IncludePath)
+ .;$(SolutionDir)\inc;$(IncludePath);
true
$(SolutionDir)$(Platform)\$(Configuration)\
$(VC_ExecutablePath_x64);$(WindowsSDK_ExecutablePath);$(VS_ExecutablePath);$(MSBuild_ExecutablePath);$(FxCopDir);$(PATH);$(LOCALAPPDATA)\Atlassian\SourceTree\git_local\bin\
- .;$(SolutionDir)..\..\..\inc;$(IncludePath);$(VC_IncludePath)
+ .;$(SolutionDir)\inc;$(IncludePath);$(VC_IncludePath)
$(Platform)\$(Configuration)\
true
$(SolutionDir)$(Platform)\$(Configuration)\
$(VC_ExecutablePath_x86);$(WindowsSDK_ExecutablePath);$(VS_ExecutablePath);$(MSBuild_ExecutablePath);$(SystemRoot)\SysWow64;$(FxCopDir);$(PATH);$(LOCALAPPDATA)\Atlassian\SourceTree\git_local\bin\
- .;$(SolutionDir)..\..\..\inc;$(IncludePath);$(VC_IncludePath)
+ .;$(SolutionDir)\inc;$(IncludePath);$(VC_IncludePath)
$(Platform)\$(Configuration)\
true
$(SolutionDir)$(Platform)\$(Configuration)\
$(VC_ExecutablePath_x86);$(WindowsSDK_ExecutablePath);$(VS_ExecutablePath);$(MSBuild_ExecutablePath);$(SystemRoot)\SysWow64;$(FxCopDir);$(PATH);$(LOCALAPPDATA)\Atlassian\SourceTree\git_local\bin\
- .;$(SolutionDir)..\..\..\inc;$(IncludePath);$(VC_IncludePath)
+ .;$(SolutionDir)\inc;$(IncludePath);$(VC_IncludePath)
true
$(Platform)\$(Configuration)\
$(SolutionDir)$(Platform)\$(Configuration)\
$(VC_ExecutablePath_x86);$(WindowsSDK_ExecutablePath);$(VS_ExecutablePath);$(MSBuild_ExecutablePath);$(SystemRoot)\SysWow64;$(FxCopDir);$(PATH);$(LOCALAPPDATA)\Atlassian\SourceTree\git_local\bin\
- .;$(SolutionDir)..\..\..\inc;$(IncludePath);$(VC_IncludePath)
+ .;$(SolutionDir)\inc;$(IncludePath);$(VC_IncludePath)
true
$(Platform)\$(Configuration)\
$(SolutionDir)$(Platform)\$(Configuration)\
@@ -174,6 +183,9 @@
Create
VJOYINTERFACE_EXPORTS;%(PreprocessorDefinitions)
+ true
+ MultiThreadedDLL
+ false
setupapi.lib;hid.lib;%(AdditionalDependencies)
@@ -199,6 +211,9 @@
Create
VJOYINTERFACE_EXPORTS;%(PreprocessorDefinitions);XBOX
+ true
+ MultiThreadedDebugDLL
+ false
setupapi.lib;hid.lib;%(AdditionalDependencies)
@@ -224,7 +239,9 @@
Create
VJOYINTERFACE_EXPORTS;%(PreprocessorDefinitions)
- MultiThreaded
+ MultiThreadedDLL
+ true
+ false
setupapi.lib;hid.lib;%(AdditionalDependencies)
@@ -245,7 +262,9 @@
Create
VJOYINTERFACE_EXPORTS;%(PreprocessorDefinitions);XBOX
- MultiThreaded
+ MultiThreadedDLL
+ true
+ false
setupapi.lib;hid.lib;%(AdditionalDependencies)
@@ -273,6 +292,9 @@
VJOYINTERFACE_EXPORTS;_WIN64;_AMD64_;AMD64;%(PreprocessorDefinitions)
+ true
+ MultiThreadedDLL
+ true
_UNICODE;UNICODE;%(PreprocessorDefinitions);X64;_DEBUG
@@ -296,6 +318,9 @@
VJOYINTERFACE_EXPORTS;_WIN64;_AMD64_;AMD64;%(PreprocessorDefinitions);XBOX
+ true
+ MultiThreadedDebugDLL
+ true
_UNICODE;UNICODE;%(PreprocessorDefinitions);X64;_DEBUG;XBOX
@@ -318,7 +343,9 @@
VJOYINTERFACE_EXPORTS;_WIN64;_AMD64_;AMD64;%(PreprocessorDefinitions)
- MultiThreaded
+ MultiThreadedDLL
+ true
+ true
$(OutDir)CreateVersion.exe $(ProjectDir)gen-versioninfo.h
@@ -341,7 +368,9 @@
VJOYINTERFACE_EXPORTS;_WIN64;_AMD64_;AMD64;%(PreprocessorDefinitions);XBOX
- MultiThreaded
+ MultiThreadedDLL
+ true
+ true
$(OutDir)CreateVersion.exe $(ProjectDir)gen-versioninfo.h
diff --git a/apps/common/vJoyInterface/vJoyInterface2012.vcxproj.filters b/apps/common/vJoyInterface/vJoyInterface2012.vcxproj.filters
index b1684bb..a0e13a6 100644
--- a/apps/common/vJoyInterface/vJoyInterface2012.vcxproj.filters
+++ b/apps/common/vJoyInterface/vJoyInterface2012.vcxproj.filters
@@ -30,6 +30,7 @@
+
diff --git a/apps/common/vJoyInterface/vXboxInterface.cpp b/apps/common/vJoyInterface/vXboxInterface.cpp
index c31438c..8c221a9 100644
--- a/apps/common/vJoyInterface/vXboxInterface.cpp
+++ b/apps/common/vJoyInterface/vXboxInterface.cpp
@@ -4,7 +4,6 @@
#include
#include
#include
-using namespace std;
extern "C"
{
@@ -17,6 +16,8 @@ extern "C"
#include "vJoyInterface.h"
#include "vXboxInterface.h"
+using namespace std;
+using namespace vJoy;
extern "C"
{
@@ -71,7 +72,7 @@ extern "C"
// Prepare the User Index for sending
buffer[0] = UserIndex;
-
+
// Send request to bus
if (DeviceIoControl(g_hBus, IOCTL_BUSENUM_ISDEVPLUGGED, buffer, _countof(buffer), output, 4, &trasfered, nullptr))
{
@@ -102,11 +103,11 @@ extern "C"
// Get ID of current process
ThisProcID = GetCurrentProcessId();
if (!ThisProcID)
- return FALSE;
+ return FALSE;
// Compare
- if (ThisProcID!=OrigProcID)
- return FALSE;
+ if (ThisProcID != OrigProcID)
+ return FALSE;
return TRUE;
@@ -142,9 +143,9 @@ extern "C"
};
//CloseHandle(h);
- DWORD error = 0 ;
+ DWORD error = 0;
if (out)
- {
+ {
//std::cout << "IOCTL_BUSENUM_PLUGIN_HARDWARE 0X" << IOCTL_BUSENUM_PLUGIN_HARDWARE << "\n" << endl;
error = 0;
}
@@ -167,33 +168,18 @@ extern "C"
return UnPlug_Opt(UserIndex, TRUE);
}
- VJOYINTERFACE_API BOOL __cdecl SetAxisX(UINT UserIndex, SHORT Value) // Left Stick X
+ VJOYINTERFACE_API BOOL __cdecl SetDpad(UINT UserIndex, INT Value)
{
- g_Gamepad[UserIndex - 1].sThumbLX = Value;
+ g_Gamepad[UserIndex - 1].wButtons &= 0xFFF0;
+ g_Gamepad[UserIndex - 1].wButtons |= Value;
return XOutputSetState(UserIndex, &g_Gamepad[UserIndex - 1]);
}
- VJOYINTERFACE_API BOOL __cdecl SetAxisY(UINT UserIndex, SHORT Value) // Left Stick X
- {
- g_Gamepad[UserIndex - 1].sThumbLY = Value;
- return XOutputSetState(UserIndex, &g_Gamepad[UserIndex - 1]);
- }
-
- VJOYINTERFACE_API BOOL __cdecl SetAxisRx(UINT UserIndex, SHORT Value) // Left Stick X
- {
- g_Gamepad[UserIndex - 1].sThumbRX = Value;
- return XOutputSetState(UserIndex, &g_Gamepad[UserIndex - 1]);
- }
-
- VJOYINTERFACE_API BOOL __cdecl SetAxisRy(UINT UserIndex, SHORT Value) // Left Stick X
- {
- g_Gamepad[UserIndex - 1].sThumbRY = Value;
- return XOutputSetState(UserIndex, &g_Gamepad[UserIndex - 1]);
- }
VJOYINTERFACE_API BOOL __cdecl SetDpadUp(UINT UserIndex)
{
return SetDpad(UserIndex, DPAD_UP);
}
+
VJOYINTERFACE_API BOOL __cdecl SetDpadRight(UINT UserIndex)
{
return SetDpad(UserIndex, DPAD_RIGHT);
@@ -213,95 +199,85 @@ extern "C"
return SetDpad(UserIndex, 0);
}
- VJOYINTERFACE_API BOOL __cdecl SetBtnA(UINT UserIndex, BOOL Press)
+ VJOYINTERFACE_API BOOL __cdecl SetDpadUpRight(UINT UserIndex) {
+ return SetDpad(UserIndex, DPAD_UP | DPAD_RIGHT);
+ }
+
+ VJOYINTERFACE_API BOOL __cdecl SetDpadDownRight(UINT UserIndex) {
+ return SetDpad(UserIndex, DPAD_DOWN | DPAD_RIGHT);
+ }
+
+ VJOYINTERFACE_API BOOL __cdecl SetDpadDownLeft(UINT UserIndex) {
+ return SetDpad(UserIndex, DPAD_DOWN | DPAD_LEFT);
+ }
+
+ VJOYINTERFACE_API BOOL __cdecl SetDpadUpLeft(UINT UserIndex) {
+ return SetDpad(UserIndex, DPAD_UP | DPAD_LEFT);
+ }
+
+ VJOYINTERFACE_API BOOL __cdecl SetBtnAny(UINT UserIndex, BOOL Press, UINT xBtn)
{
- UINT Btn = XINPUT_GAMEPAD_A;
- g_Gamepad[UserIndex - 1].wButtons &= ~Btn;
- g_Gamepad[UserIndex - 1].wButtons |= Btn*Press;
+ g_Gamepad[UserIndex - 1].wButtons &= ~xBtn;
+ g_Gamepad[UserIndex - 1].wButtons |= xBtn*Press;
return XOutputSetState(UserIndex, &g_Gamepad[UserIndex - 1]);
}
+ VJOYINTERFACE_API BOOL __cdecl SetBtnA(UINT UserIndex, BOOL Press)
+ {
+ return SetBtnAny(UserIndex, Press, (UINT)XINPUT_GAMEPAD_A);
+ }
VJOYINTERFACE_API BOOL __cdecl SetBtnB(UINT UserIndex, BOOL Press)
{
- UINT Btn = XINPUT_GAMEPAD_B;
- g_Gamepad[UserIndex - 1].wButtons &= ~Btn;
- g_Gamepad[UserIndex - 1].wButtons |= Btn*Press;
- return XOutputSetState(UserIndex, &g_Gamepad[UserIndex - 1]);
+ return SetBtnAny(UserIndex, Press, (UINT)XINPUT_GAMEPAD_B);
}
VJOYINTERFACE_API BOOL __cdecl SetBtnX(UINT UserIndex, BOOL Press)
{
- UINT Btn = XINPUT_GAMEPAD_X;
- g_Gamepad[UserIndex - 1].wButtons &= ~Btn;
- g_Gamepad[UserIndex - 1].wButtons |= Btn*Press;
- return XOutputSetState(UserIndex, &g_Gamepad[UserIndex - 1]);
+ return SetBtnAny(UserIndex, Press, (UINT)XINPUT_GAMEPAD_X);
}
VJOYINTERFACE_API BOOL __cdecl SetBtnY(UINT UserIndex, BOOL Press)
{
- UINT Btn = XINPUT_GAMEPAD_Y;
- g_Gamepad[UserIndex - 1].wButtons &= ~Btn;
- g_Gamepad[UserIndex - 1].wButtons |= Btn*Press;
- return XOutputSetState(UserIndex, &g_Gamepad[UserIndex - 1]);
+ return SetBtnAny(UserIndex, Press, (UINT)XINPUT_GAMEPAD_Y);
}
VJOYINTERFACE_API BOOL __cdecl SetBtnStart(UINT UserIndex, BOOL Press)
{
- UINT Btn = XINPUT_GAMEPAD_START;
- g_Gamepad[UserIndex - 1].wButtons &= ~Btn;
- g_Gamepad[UserIndex - 1].wButtons |= Btn*Press;
- return XOutputSetState(UserIndex, &g_Gamepad[UserIndex - 1]);
+ return SetBtnAny(UserIndex, Press, (UINT)XINPUT_GAMEPAD_START);
}
VJOYINTERFACE_API BOOL __cdecl SetBtnBack(UINT UserIndex, BOOL Press)
{
- UINT Btn = XINPUT_GAMEPAD_BACK;
- g_Gamepad[UserIndex - 1].wButtons &= ~Btn;
- g_Gamepad[UserIndex - 1].wButtons |= Btn*Press;
- return XOutputSetState(UserIndex, &g_Gamepad[UserIndex - 1]);
+ return SetBtnAny(UserIndex, Press, (UINT)XINPUT_GAMEPAD_BACK);
}
VJOYINTERFACE_API BOOL __cdecl SetBtnLT(UINT UserIndex, BOOL Press)
{
- UINT Btn = XINPUT_GAMEPAD_LEFT_THUMB;
- g_Gamepad[UserIndex - 1].wButtons &= ~Btn;
- g_Gamepad[UserIndex - 1].wButtons |= Btn*Press;
- return XOutputSetState(UserIndex, &g_Gamepad[UserIndex - 1]);
+ return SetBtnAny(UserIndex, Press, (UINT)XINPUT_GAMEPAD_LEFT_THUMB);
}
VJOYINTERFACE_API BOOL __cdecl SetBtnRT(UINT UserIndex, BOOL Press)
{
- UINT Btn = XINPUT_GAMEPAD_RIGHT_THUMB;
- g_Gamepad[UserIndex - 1].wButtons &= ~Btn;
- g_Gamepad[UserIndex - 1].wButtons |= Btn*Press;
- return XOutputSetState(UserIndex, &g_Gamepad[UserIndex - 1]);
+ return SetBtnAny(UserIndex, Press, (UINT)XINPUT_GAMEPAD_RIGHT_THUMB);
}
VJOYINTERFACE_API BOOL __cdecl SetBtnLB(UINT UserIndex, BOOL Press)
{
- UINT Btn = XINPUT_GAMEPAD_LEFT_SHOULDER;
- g_Gamepad[UserIndex - 1].wButtons &= ~Btn;
- g_Gamepad[UserIndex - 1].wButtons |= Btn*Press;
- return XOutputSetState(UserIndex, &g_Gamepad[UserIndex - 1]);
+ return SetBtnAny(UserIndex, Press, (UINT)XINPUT_GAMEPAD_LEFT_SHOULDER);
}
VJOYINTERFACE_API BOOL __cdecl SetBtnRB(UINT UserIndex, BOOL Press)
{
- UINT Btn = XINPUT_GAMEPAD_RIGHT_SHOULDER;
- g_Gamepad[UserIndex - 1].wButtons &= ~Btn;
- g_Gamepad[UserIndex - 1].wButtons |= Btn*Press;
- return XOutputSetState(UserIndex, &g_Gamepad[UserIndex - 1]);
+ return SetBtnAny(UserIndex, Press, (UINT)XINPUT_GAMEPAD_RIGHT_SHOULDER);
}
- VJOYINTERFACE_API BOOL __cdecl SetTriggerL(UINT UserIndex, BYTE Value) // Left Trigger
+ VJOYINTERFACE_API BOOL __cdecl SetTriggerL(UINT UserIndex, BYTE Value, UINT Threshold = XINPUT_GAMEPAD_TRIGGER_THRESHOLD) // Left Trigger
{
- g_Gamepad[UserIndex - 1].bLeftTrigger = Value;
- return XOutputSetState(UserIndex, &g_Gamepad[UserIndex - 1]);
+ return SetTriggerLR(UserIndex, Value, 0, Threshold);
}
- VJOYINTERFACE_API BOOL __cdecl SetTriggerR(UINT UserIndex, BYTE Value) // Right Trigger
+ VJOYINTERFACE_API BOOL __cdecl SetTriggerR(UINT UserIndex, BYTE Value, UINT Threshold = XINPUT_GAMEPAD_TRIGGER_THRESHOLD) // Right Trigger
{
- g_Gamepad[UserIndex - 1].bRightTrigger = Value;
- return XOutputSetState(UserIndex, &g_Gamepad[UserIndex - 1]);
+ return SetTriggerLR(UserIndex, Value, 0, Threshold);
}
VJOYINTERFACE_API BOOL __cdecl GetLedNumber(UINT UserIndex, PBYTE pLed)
@@ -320,7 +296,7 @@ extern "C"
{
if (Vibrate)
{
- (*pVib).wLeftMotorSpeed = LargeMotor * 256;
+ (*pVib).wLeftMotorSpeed = LargeMotor * 256;
(*pVib).wRightMotorSpeed = SmallMotor * 256;
}
else
@@ -328,7 +304,6 @@ extern "C"
};
return ref;
}
-
}
@@ -399,30 +374,36 @@ VJOYINTERFACE_API BOOL __cdecl GetVJDAxisExist(UINT rID, UINT Axis) // Test if
{
switch (Axis)
{
- case HID_USAGE_X:
- case HID_USAGE_Y:
- case HID_USAGE_RX:
- case HID_USAGE_RY:
- return TRUE;
- break;
- default:
- return FALSE;
+ case HID_USAGE_X:
+ case HID_USAGE_Y:
+ case HID_USAGE_RX:
+ case HID_USAGE_RY:
+ case HID_USAGE_SL0:
+ case HID_USAGE_SL1:
+ return TRUE;
+ break;
+ default:
+ return FALSE;
};
}
VJOYINTERFACE_API BOOL __cdecl GetVJDAxisMax(UINT rID, UINT Axis, LONG * Max) // Get logical Maximum value for a given axis defined in the specified VDJ
{
switch (Axis)
{
- case HID_USAGE_X:
- case HID_USAGE_Y:
- case HID_USAGE_RX:
- case HID_USAGE_RY:
- break;
- default:
- return FALSE;
+ case HID_USAGE_X:
+ case HID_USAGE_Y:
+ case HID_USAGE_RX:
+ case HID_USAGE_RY:
+ *Max = AXIS_MAX;
+ break;
+ case HID_USAGE_SL0:
+ case HID_USAGE_SL1:
+ *Max = AXIS_SL_MAX;
+ break;
+ default:
+ return FALSE;
};
- *Max = AXIS_MAX;
return TRUE;
}
@@ -430,19 +411,24 @@ VJOYINTERFACE_API BOOL __cdecl GetVJDAxisMin(UINT rID, UINT Axis, LONG * Min) /
{
switch (Axis)
{
- case HID_USAGE_X:
- case HID_USAGE_Y:
- case HID_USAGE_RX:
- case HID_USAGE_RY:
- break;
- default:
- return FALSE;
+
+ case HID_USAGE_X:
+ case HID_USAGE_Y:
+ case HID_USAGE_RX:
+ case HID_USAGE_RY:
+ *Min = AXIS_MIN;
+ break;
+ case HID_USAGE_SL0:
+ case HID_USAGE_SL1:
+ *Min = AXIS_SL_MIN;
+ break;
+ default:
+ return FALSE;
};
- *Min = AXIS_MIN;
return TRUE;
}
-VJOYINTERFACE_API enum VjdStat __cdecl GetVJDStatus(UINT rID) // Get the status of the specified vJoy Device.
+VJOYINTERFACE_API enum vJoy::VjdStat __cdecl GetVJDStatus(UINT rID) // Get the status of the specified vJoy Device.
{
if (!isControllerExists(rID))
return VJD_STAT_MISS;
@@ -457,7 +443,7 @@ VJOYINTERFACE_API enum VjdStat __cdecl GetVJDStatus(UINT rID) // Get the statu
VJOYINTERFACE_API BOOL __cdecl isVJDExists(UINT rID) // TRUE if the specified vJoy Device exists
{
return isControllerExists(rID);
-}
+}
///// Write access to vJoy Device - Basic
@@ -474,7 +460,7 @@ VJOYINTERFACE_API BOOL __cdecl AcquireVJD(UINT rID) // Acquire the specified
}
// If the device does not exist - plug it in
- if (GetVJDStatus(rID) == VJD_STAT_FREE || GetVJDStatus(rID) == VJD_STAT_MISS)
+ if (GetVJDStatus(rID) == VJD_STAT_FREE || GetVJDStatus(rID) == VJD_STAT_MISS)
{
res = PlugIn(rID);
if (!res)
@@ -492,7 +478,7 @@ VJOYINTERFACE_API VOID __cdecl RelinquishVJD(UINT rID) // Relinquish the spec
{
UnPlug(rID);
}
-
+
//// Reset functions
VJOYINTERFACE_API BOOL __cdecl ResetVJD(UINT rID) // Reset all controls to predefined values in the specified VDJ
@@ -529,139 +515,235 @@ VJOYINTERFACE_API BOOL __cdecl ResetPovs(UINT rID) // Reset all POV Switches (
// Write data
VJOYINTERFACE_API BOOL __cdecl UpdateVJD(UINT rID, PVOID pData) // Update the position data of the specified vJoy Device.
-{
+{
PJOYSTICK_POSITION_V2 pJoyPos = (PJOYSTICK_POSITION_V2)pData;
XINPUT_GAMEPAD Gamepad;
-
+
// Init
memset(&Gamepad, 0, sizeof(XINPUT_GAMEPAD));
///// Axes
- Gamepad.sThumbLX = 2*(pJoyPos->wAxisX-1) - 32767;
- Gamepad.sThumbLY = 2*(pJoyPos->wAxisY - 1) - 32767;
- Gamepad.sThumbRX = 2*(pJoyPos->wAxisXRot - 1) - 32767;
- Gamepad.sThumbRY = 2*(pJoyPos->wAxisYRot - 1) - 32767;
- Gamepad.bLeftTrigger = (pJoyPos->wAxisZRot - 1) / 128;
- Gamepad.bRightTrigger = (pJoyPos->wAxisZ - 1) / 128;
+ Gamepad.sThumbLX = 2 * (pJoyPos->wAxisX - 1) - AXIS_MAX;
+ Gamepad.sThumbLY = 2 * (pJoyPos->wAxisY - 1) - AXIS_MAX;
+ Gamepad.sThumbRX = 2 * (pJoyPos->wAxisXRot - 1) - AXIS_MAX;
+ Gamepad.sThumbRY = 2 * (pJoyPos->wAxisYRot - 1) - AXIS_MAX;
+ Gamepad.bLeftTrigger = (pJoyPos->wAxisZRot - 1) / AXIS_SL_MAX;
+ Gamepad.bRightTrigger = (pJoyPos->wAxisZ - 1) / AXIS_SL_MAX;
//// Buttons
// Button 1 ==> Button A
Gamepad.wButtons = ConvertButton(pJoyPos->lButtons, Gamepad.wButtons, 1, XINPUT_GAMEPAD_A);
// Button 2 ==> Button B
Gamepad.wButtons = ConvertButton(pJoyPos->lButtons, Gamepad.wButtons, 2, XINPUT_GAMEPAD_B);
- // Button 3 ==> Button X
- Gamepad.wButtons = ConvertButton(pJoyPos->lButtons, Gamepad.wButtons, 3, XINPUT_GAMEPAD_X);
+ // Button 3 ==> Button X
+ Gamepad.wButtons = ConvertButton(pJoyPos->lButtons, Gamepad.wButtons, 3, XINPUT_GAMEPAD_X);
// Button 4 ==> Button Y
- Gamepad.wButtons = ConvertButton(pJoyPos->lButtons, Gamepad.wButtons, 4, XINPUT_GAMEPAD_Y);
+ Gamepad.wButtons = ConvertButton(pJoyPos->lButtons, Gamepad.wButtons, 4, XINPUT_GAMEPAD_Y);
// Button 5 ==> Button LB (Left Bumper)
- Gamepad.wButtons = ConvertButton(pJoyPos->lButtons, Gamepad.wButtons, 5, XINPUT_GAMEPAD_LEFT_SHOULDER);
+ Gamepad.wButtons = ConvertButton(pJoyPos->lButtons, Gamepad.wButtons, 5, XINPUT_GAMEPAD_LEFT_SHOULDER);
// Button 6 ==> Button RB (Right Bumper)
- Gamepad.wButtons = ConvertButton(pJoyPos->lButtons, Gamepad.wButtons, 6, XINPUT_GAMEPAD_RIGHT_SHOULDER);
+ Gamepad.wButtons = ConvertButton(pJoyPos->lButtons, Gamepad.wButtons, 6, XINPUT_GAMEPAD_RIGHT_SHOULDER);
// Button 7 ==> Back
- Gamepad.wButtons = ConvertButton(pJoyPos->lButtons, Gamepad.wButtons, 7, XINPUT_GAMEPAD_BACK);
+ Gamepad.wButtons = ConvertButton(pJoyPos->lButtons, Gamepad.wButtons, 7, XINPUT_GAMEPAD_BACK);
// Button 8 ==> Start
- Gamepad.wButtons = ConvertButton(pJoyPos->lButtons, Gamepad.wButtons, 8, XINPUT_GAMEPAD_START);
+ Gamepad.wButtons = ConvertButton(pJoyPos->lButtons, Gamepad.wButtons, 8, XINPUT_GAMEPAD_START);
// Button 9 ==> Button LSB (Left Stick Button)
- Gamepad.wButtons = ConvertButton(pJoyPos->lButtons, Gamepad.wButtons, 9, XINPUT_GAMEPAD_LEFT_THUMB);
+ Gamepad.wButtons = ConvertButton(pJoyPos->lButtons, Gamepad.wButtons, 9, XINPUT_GAMEPAD_LEFT_THUMB);
// Button 10 ==> Button RSB (Right Stick Button)
- Gamepad.wButtons = ConvertButton(pJoyPos->lButtons, Gamepad.wButtons, 10, XINPUT_GAMEPAD_RIGHT_THUMB);
+ Gamepad.wButtons = ConvertButton(pJoyPos->lButtons, Gamepad.wButtons, 10, XINPUT_GAMEPAD_RIGHT_THUMB);
// Dpad / Discrete POV #1
switch (pJoyPos->bHats)
{
- case 0:
- Gamepad.wButtons |= XINPUT_GAMEPAD_DPAD_UP;
- break;
- case 1:
- Gamepad.wButtons |= XINPUT_GAMEPAD_DPAD_RIGHT;
- break;
- case 2:
- Gamepad.wButtons |= XINPUT_GAMEPAD_DPAD_DOWN;
- break;
- case 4:
- Gamepad.wButtons |= XINPUT_GAMEPAD_DPAD_LEFT;
- break;
- default:
- Gamepad.wButtons &= 0xFFF0;
+ case 0:
+ Gamepad.wButtons |= XINPUT_GAMEPAD_DPAD_UP;
+ break;
+ case 1:
+ Gamepad.wButtons |= XINPUT_GAMEPAD_DPAD_RIGHT;
+ break;
+ case 2:
+ Gamepad.wButtons |= XINPUT_GAMEPAD_DPAD_DOWN;
+ break;
+ case 4:
+ Gamepad.wButtons |= XINPUT_GAMEPAD_DPAD_LEFT;
+ break;
+ default:
+ Gamepad.wButtons &= 0xFFF0;
}
// Send joystick position structure to vJoy device
return XOutputSetState(rID, &Gamepad);
}
+
+/**
+Axis DeadZones and Trigger Thresholds function (Xinput recommends)
+https://msdn.microsoft.com/en-us/library/windows/desktop/ee417001(v=vs.85).aspx
+*/
+VJOYINTERFACE_API BOOL __cdecl SetAxisXY(UINT UserIndex, SHORT ValueX, SHORT ValueY,
+ UINT AxisX = HID_USAGE_X, UINT AxisY = HID_USAGE_Y,
+ UINT DeadZone = XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE, SHORT Axis_Max = AXIS_MAX)
+{
+
+ float LX = ValueX;
+ float LY = ValueY;
+
+ //determine how far the controller is pushed
+ float magnitude = sqrt(LX*LX + LY*LY);
+ float normalizedMagnitude = 0;
+
+ //check if the controller is outside a circular dead zone
+ if (magnitude > DeadZone)
+ {
+ //clip the magnitude at its expected maximum value
+ if (magnitude > Axis_Max) magnitude = Axis_Max;
+
+ //adjust magnitude relative to the end of the dead zone
+ magnitude -= DeadZone;
+
+ //optionally normalize the magnitude with respect to its expected range
+ //giving a magnitude value of 0.0 to 1.0
+ normalizedMagnitude = magnitude / (Axis_Max - DeadZone);
+
+ //determine the direction the controller is pushed
+ //ValueX = (SHORT)roundf(LX / magnitude);
+ //ValueY = (SHORT)roundf(LY / magnitude);
+ }
+ else //if the controller is in the deadzone zero out the magnitude
+ {
+ magnitude = 0.0;
+ normalizedMagnitude = 0.0;
+ }
+ BOOL r = TRUE;
+ if (AxisX != 0)
+ r = r && SetAxis((LONG)roundf(LX*normalizedMagnitude), UserIndex, AxisX);
+ if (AxisY != 0)
+ r = r && SetAxis((LONG)roundf(LY*normalizedMagnitude), UserIndex, AxisY);
+ return r;
+}
+
+VJOYINTERFACE_API BOOL __cdecl SetTriggerLR(UINT UserIndex, SHORT ValueL, SHORT ValueR, UINT Threshold = XINPUT_GAMEPAD_TRIGGER_THRESHOLD)
+{
+ BOOL b = TRUE;
+ b= b && SetAxisXY(UserIndex, ValueL, 0, HID_USAGE_SL0, 0, Threshold, AXIS_SL_MAX);
+ b = b && SetAxisXY(UserIndex, 0, ValueR, 0, HID_USAGE_SL1, Threshold, AXIS_SL_MAX);
+ return FALSE;
+}
+
+VJOYINTERFACE_API BOOL __cdecl GetTriggerLR(UINT UserIndex, PBYTE ValueL, PBYTE ValueR, UINT AxisL, UINT AxisR) {
+ if (XOutputSetGetState(UserIndex, &g_Gamepad[UserIndex - 1], nullptr, nullptr, nullptr, nullptr))
+ {
+ XINPUT_GAMEPAD *pad = &g_Gamepad[UserIndex - 1];
+ if (AxisL == HID_USAGE_SL0)
+ *ValueL = (*pad).bLeftTrigger;
+ if (AxisR == HID_USAGE_SL1)
+ *ValueR = (*pad).bRightTrigger;
+ return true;
+ }
+ return false;
+}
+VJOYINTERFACE_API BOOL __cdecl GetAxisXY(UINT UserIndex, PSHORT ValueX, PSHORT ValueY, UINT AxisX, UINT AxisY) {
+ if (XOutputSetGetState(UserIndex, &g_Gamepad[UserIndex - 1], nullptr, nullptr, nullptr, nullptr))
+ {
+ XINPUT_GAMEPAD *pad = &g_Gamepad[UserIndex - 1];
+ if (AxisX == HID_USAGE_X)
+ *ValueX = (*pad).sThumbLX;
+ if (AxisY == HID_USAGE_Y)
+ *ValueY = (*pad).sThumbLY;
+
+ if (AxisX == HID_USAGE_RX)
+ *ValueX = (*pad).sThumbRX;
+ if (AxisY == HID_USAGE_RY)
+ *ValueY = (*pad).sThumbRY;
+ return true;
+ }
+ return false;
+}
+/**
+This external function doesn't manage DEADZONES. Xinput recommend using the function SetAxisXY().
+*/
VJOYINTERFACE_API BOOL __cdecl SetAxis(LONG Value, UINT rID, UINT Axis) // Write Value to a given axis defined in the specified VDJ
{
- LONG NormVal = 2 * (Value-1) - 32767;
- BYTE TrigVal = (Value-1) / 128;
-
- switch (Axis)
- {
- case HID_USAGE_X:
- SetAxisX(rID, NormVal);
- break;
- case HID_USAGE_Y:
- SetAxisY(rID, NormVal);
- break;
- case HID_USAGE_RX:
- SetAxisRx(rID, NormVal);
- break;
- case HID_USAGE_RY:
- SetAxisRy(rID, NormVal);
- break;
- case HID_USAGE_Z:
- SetTriggerR(rID, TrigVal);
- break;
- case HID_USAGE_RZ:
- SetTriggerL(rID, TrigVal);
- break;
- default:
- return FALSE;
+ /** Clip as Xinput values */
+ SHORT NormVal = max(AXIS_MIN, min(AXIS_MAX, Value));
+ UINT TrigVal = max(AXIS_SL_MIN, min(AXIS_SL_MAX, Value));
+
+ switch (Axis)
+ {
+ case HID_USAGE_X:
+ g_Gamepad[rID - 1].sThumbLX = NormVal;
+ break;
+ case HID_USAGE_Y:
+ g_Gamepad[rID - 1].sThumbLY = NormVal;
+ break;
+ case HID_USAGE_RX:
+ g_Gamepad[rID - 1].sThumbRX = NormVal;
+ break;
+ case HID_USAGE_RY:
+ g_Gamepad[rID - 1].sThumbRY = NormVal;
+ break;
+ case HID_USAGE_SL0:
+ g_Gamepad[rID - 1].bLeftTrigger = TrigVal;
+ break;
+ case HID_USAGE_SL1:
+ g_Gamepad[rID - 1].bRightTrigger = TrigVal;
+ break;
+ default:
+ return FALSE;
}
+ return XOutputSetState(rID, &g_Gamepad[rID - 1]);
- return TRUE;
}
+
+/**
+Converts UCHAR and finds the appropriate button press method. This is for configuration.
+See SetBtn(BOOL,UINT,UINT), a direct function to XINPUT.
+**/
VJOYINTERFACE_API BOOL __cdecl SetBtn(BOOL Value, UINT rID, UCHAR nBtn) // Write Value to a given button defined in the specified VDJ
{
switch (nBtn)
{
- case 1:
- SetBtnA(rID, Value);
- break;
- case 2:
- SetBtnB(rID, Value);
- break;
- case 3:
- SetBtnX(rID, Value);
- break;
- case 4:
- SetBtnY(rID, Value);
- break;
- case 5:
- SetBtnLB(rID, Value);
- break;
- case 6:
- SetBtnRB(rID, Value);
- break;
- case 7:
- SetBtnBack(rID, Value);
- break;
- case 8:
- SetBtnStart(rID, Value);
- break;
- case 9:
- SetBtnLT(rID, Value);
- break;
- case 10:
- SetBtnRT(rID, Value);
- break;
-
- default:
- return FALSE;
+ case 1:
+ SetBtnA(rID, Value);
+ break;
+ case 2:
+ SetBtnB(rID, Value);
+ break;
+ case 3:
+ SetBtnX(rID, Value);
+ break;
+ case 4:
+ SetBtnY(rID, Value);
+ break;
+ case 5:
+ SetBtnLB(rID, Value);
+ break;
+ case 6:
+ SetBtnRB(rID, Value);
+ break;
+ case 7:
+ SetBtnBack(rID, Value);
+ break;
+ case 8:
+ SetBtnStart(rID, Value);
+ break;
+ case 9:
+ SetBtnLT(rID, Value);
+ break;
+ case 10:
+ SetBtnRT(rID, Value);
+ break;
+
+ default:
+ return FALSE;
}
return TRUE;
}
+/**
+Converts UCHAR and finds the appropriate button press method. This is for configuration.
+*/
VJOYINTERFACE_API BOOL __cdecl SetDiscPov(int Value, UINT rID, UCHAR nPov) // Write Value to a given descrete POV defined in the specified VDJ
{
if (nPov != 1)
@@ -669,46 +751,57 @@ VJOYINTERFACE_API BOOL __cdecl SetDiscPov(int Value, UINT rID, UCHAR nPov) // W
switch (Value)
{
- case 0:
- SetDpadUp(rID);
- break;
- case 1:
- SetDpadRight(rID);
- break;
- case 2:
- SetDpadDown(rID);
- break;
- case 3:
- SetDpadLeft(rID);
- break;
- case 0xF:
- case -1:
- SetDpadOff(rID);
- break;
-
- default:
- return FALSE;
+ case 0:
+ SetDpadUp(rID);
+ break;
+ case 1:
+ SetDpadRight(rID);
+ break;
+ case 2:
+ SetDpadDown(rID);
+ break;
+ case 3:
+ SetDpadLeft(rID);
+ break;
+ case 4:
+ SetDpadUpRight(rID);
+ break;
+ case 5:
+ SetDpadDownRight(rID);
+ break;
+ case 6:
+ SetDpadDownRight(rID);
+ break;
+ case 7:
+ SetDpadUpLeft(rID);
+ break;
+ case 0xF:
+ case -1:
+ SetDpadOff(rID);
+ break;
+
+ default:
+ return FALSE;
}
return TRUE;
}
+
+/** TODO: handle bi-directional press (Up-Right, Down-Left, etc.) */
VJOYINTERFACE_API BOOL __cdecl SetContPov(DWORD Value, UINT rID, UCHAR nPov) // Write Value to a given continuous POV defined in the specified VDJ
{
if (nPov != 1)
return FALSE;
-
+ INT xinput = 0; //OFF
if (Value >= 31500 || Value < 4500)
- return SetDpadUp(rID);
- if (Value >= 4500 || Value < 13500)
- return SetDpadRight(rID);
- if (Value >= 13500 || Value < 22500)
- return SetDpadUp(rID);
- if (Value >= 22500 || Value < 31500)
- return SetDpadRight(rID);
-
- return SetDpadOff(rID);
-
-
+ xinput |= DPAD_UP;
+ if (Value >= 4500 && Value < 13500)
+ xinput |= DPAD_RIGHT;
+ if (Value >= 13500 && Value < 22500)
+ xinput |= DPAD_DOWN;
+ if (Value >= 22500 && Value < 31500)
+ xinput |= DPAD_LEFT;
+ return SetDpad(rID, xinput);
}
#pragma endregion
@@ -733,7 +826,7 @@ BOOL XOutputSetState(DWORD UserIndex, XINPUT_GAMEPAD* pGamepad)
if (UserIndex < 1 || UserIndex>4)
return out;
- if (!g_vDevice[UserIndex-1])
+ if (!g_vDevice[UserIndex - 1])
return out;
DWORD trasfered = 0;
@@ -762,7 +855,7 @@ BOOL XOutputSetState(DWORD UserIndex, XINPUT_GAMEPAD* pGamepad)
}
// Save last successful position data
- memcpy_s(&g_Gamepad[UserIndex-1], sizeof(XINPUT_GAMEPAD), pGamepad, sizeof(XINPUT_GAMEPAD));
+ memcpy_s(&g_Gamepad[UserIndex - 1], sizeof(XINPUT_GAMEPAD), pGamepad, sizeof(XINPUT_GAMEPAD));
return TRUE;
}
@@ -903,7 +996,7 @@ int GetVXbusPath(LPCTSTR path, UINT size)
}
// Copy the path to output buffer
- memcpy((void *)path, detailDataBuffer->DevicePath, requiredSize*sizeof(WCHAR));
+ memcpy((void *)path, detailDataBuffer->DevicePath, requiredSize * sizeof(WCHAR));
// Cleanup
SetupDiDestroyDeviceInfoList(deviceInfoSet);
@@ -921,34 +1014,27 @@ HANDLE GetVXbusHandle(void)
int n = GetVXbusPath(path, MAX_PATH);
- if (n<1)
+ if (n < 1)
return INVALID_HANDLE_VALUE;
// bus found, open it and obtain handle
g_hBus = CreateFile(path,
- GENERIC_READ | GENERIC_WRITE,
- FILE_SHARE_READ | FILE_SHARE_WRITE,
- nullptr,
- OPEN_EXISTING,
- FILE_ATTRIBUTE_NORMAL,
- nullptr);
+ GENERIC_READ | GENERIC_WRITE,
+ FILE_SHARE_READ | FILE_SHARE_WRITE,
+ nullptr,
+ OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL,
+ nullptr);
return g_hBus;
}
WORD ConvertButton(LONG vBtns, WORD xBtns, UINT vBtn, UINT xBtn)
{
WORD out;
- out = ((vBtns&(1 << (vBtn-1))) == 0) ? xBtns & ~xBtn : xBtns | xBtn;
+ out = ((vBtns&(1 << (vBtn - 1))) == 0) ? xBtns & ~xBtn : xBtns | xBtn;
return out;
}
-BOOL SetDpad(UINT UserIndex, INT Value)
-{
- g_Gamepad[UserIndex - 1].wButtons &= 0xFFF0;
- g_Gamepad[UserIndex - 1].wButtons |= Value;
- return XOutputSetState(UserIndex, &g_Gamepad[UserIndex - 1]);
-}
-
BOOL UnPlug_Opt(UINT UserIndex, BOOL Force)
{
BOOL out = FALSE;
@@ -980,4 +1066,4 @@ BOOL UnPlug_Opt(UINT UserIndex, BOOL Force)
}
return out;
-}
+}
\ No newline at end of file
diff --git a/apps/common/vJoyInterface/vXboxInterface.h b/apps/common/vJoyInterface/vXboxInterface.h
index 2f09037..e8caec3 100644
--- a/apps/common/vJoyInterface/vXboxInterface.h
+++ b/apps/common/vJoyInterface/vXboxInterface.h
@@ -30,8 +30,24 @@ DEFINE_GUID(GUID_DEVINTERFACE_SCPVBUS, 0xf679f562, 0x3164, 0x42ce, 0xa4, 0xdb, 0
#define DPAD_RIGHT XINPUT_GAMEPAD_DPAD_RIGHT
#define DPAD_OFF 0
+/** As of Xinput definitions
+typedef struct _XINPUT_GAMEPAD
+{
+WORD wButtons;
+SHORT sThumbLX;
+SHORT sThumbLY;
+SHORT sThumbRX;
+SHORT sThumbRY;
+*/
#define AXIS_MAX 32767
-#define AXIS_MIN -32768
+#define AXIS_MIN -32767
+/**
+BYTE bLeftTrigger;
+BYTE bRightTrigger;
+}
+*/
+#define AXIS_SL_MAX 255
+#define AXIS_SL_MIN 0
#define FILE_DEVICE_BUSENUM FILE_DEVICE_BUS_EXTENDER
@@ -82,6 +98,7 @@ extern "C"
VJOYINTERFACE_API BOOL __cdecl UnPlugForce(UINT UserIndex);
// Data Transfer (Data to the device)
+ VJOYINTERFACE_API BOOL __cdecl SetBtnAny(UINT UserIndex, BOOL Press, UINT xBtn);
VJOYINTERFACE_API BOOL __cdecl SetBtnA(UINT UserIndex, BOOL Press);
VJOYINTERFACE_API BOOL __cdecl SetBtnB(UINT UserIndex, BOOL Press);
VJOYINTERFACE_API BOOL __cdecl SetBtnX(UINT UserIndex, BOOL Press);
@@ -92,22 +109,32 @@ extern "C"
VJOYINTERFACE_API BOOL __cdecl SetBtnRT(UINT UserIndex, BOOL Press); // Right Thumb/Stick
VJOYINTERFACE_API BOOL __cdecl SetBtnLB(UINT UserIndex, BOOL Press); // Left Bumper
VJOYINTERFACE_API BOOL __cdecl SetBtnRB(UINT UserIndex, BOOL Press); // Right Bumper
- VJOYINTERFACE_API BOOL __cdecl SetTriggerL(UINT UserIndex, BYTE Value); // Left Trigger
- VJOYINTERFACE_API BOOL __cdecl SetTriggerR(UINT UserIndex, BYTE Value); // Right Trigger
- VJOYINTERFACE_API BOOL __cdecl SetAxisX(UINT UserIndex, SHORT Value); // Left Stick X
- VJOYINTERFACE_API BOOL __cdecl SetAxisY(UINT UserIndex, SHORT Value); // Left Stick Y
- VJOYINTERFACE_API BOOL __cdecl SetAxisRx(UINT UserIndex, SHORT Value); // Right Stick X
- VJOYINTERFACE_API BOOL __cdecl SetAxisRy(UINT UserIndex, SHORT Value); // Right Stick Y
+ VJOYINTERFACE_API BOOL __cdecl SetTriggerL(UINT UserIndex, BYTE Value, UINT Threshold); // Left Trigger
+ VJOYINTERFACE_API BOOL __cdecl SetTriggerR(UINT UserIndex, BYTE Value, UINT Threshold); // Right Trigger
+ VJOYINTERFACE_API BOOL __cdecl SetDpad(UINT UserIndex, INT Value);
VJOYINTERFACE_API BOOL __cdecl SetDpadUp(UINT UserIndex);
VJOYINTERFACE_API BOOL __cdecl SetDpadRight(UINT UserIndex);
VJOYINTERFACE_API BOOL __cdecl SetDpadDown(UINT UserIndex);
VJOYINTERFACE_API BOOL __cdecl SetDpadLeft(UINT UserIndex);
+ VJOYINTERFACE_API BOOL __cdecl SetDpadUpRight(UINT UserIndex);
+ VJOYINTERFACE_API BOOL __cdecl SetDpadDownRight(UINT UserIndex);
+ VJOYINTERFACE_API BOOL __cdecl SetDpadDownLeft(UINT UserIndex);
+ VJOYINTERFACE_API BOOL __cdecl SetDpadUpLeft(UINT UserIndex);
VJOYINTERFACE_API BOOL __cdecl SetDpadOff(UINT UserIndex);
// Data Transfer (Feedback from the device)
VJOYINTERFACE_API BOOL __cdecl GetLedNumber(UINT UserIndex, PBYTE pLed);
VJOYINTERFACE_API BOOL __cdecl GetVibration(UINT UserIndex, PXINPUT_VIBRATION pVib);
+ /**
+ Axis DeadZones and Trigger Thresholds function (Xinput recommends)
+ https://msdn.microsoft.com/en-us/library/windows/desktop/ee417001(v=vs.85).aspx
+ */
+ VJOYINTERFACE_API BOOL __cdecl SetAxisXY(UINT UserIndex, SHORT ValueX, SHORT ValueY, UINT AxisX, UINT AxisY, UINT DeadZone, SHORT Axis_Max);
+ VJOYINTERFACE_API BOOL __cdecl GetAxisXY(UINT UserIndex, PSHORT ValueX, PSHORT ValueY, UINT AxisX, UINT AxisY);
+ VJOYINTERFACE_API BOOL __cdecl GetTriggerLR(UINT UserIndex, PBYTE ValueL, PBYTE ValueR, UINT AxisL, UINT AxisR);
+
+ VJOYINTERFACE_API BOOL __cdecl SetTriggerLR(UINT UserIndex, SHORT ValueL, SHORT ValueR, UINT Threshold);
} // extern "C"
//////////// Helper Functions /////////////////////////
@@ -116,6 +143,6 @@ HANDLE GetVXbusHandle(void);
BOOL GetCreateProcID(DWORD UserIndex, PULONG ProcID);
BOOL XOutputSetState(DWORD UserIndex, XINPUT_GAMEPAD* pGamepad);
BOOL XOutputSetGetState(DWORD UserIndex, XINPUT_GAMEPAD* pGamepad, PBYTE bVibrate, PBYTE bLargeMotor, PBYTE bSmallMotor, PBYTE bLed);
-BOOL SetDpad(UINT UserIndex, INT Value);
+BOOL SetBtn(UINT UserIndex, BOOL Press, UCHAR nBtn);
WORD ConvertButton(LONG vBtns, WORD xBtns, UINT vBtn, UINT xBtn);
BOOL UnPlug_Opt(UINT UserIndex, BOOL Force);
\ No newline at end of file
diff --git a/apps/common/vJoyInterface/version.aps b/apps/common/vJoyInterface/version.aps
new file mode 100644
index 0000000..2c7b6bf
Binary files /dev/null and b/apps/common/vJoyInterface/version.aps differ
diff --git a/apps/common/vJoyInterface/vjoyinterface.h b/apps/common/vJoyInterface/vjoyinterface.h
index af47c68..f546571 100644
--- a/apps/common/vJoyInterface/vjoyinterface.h
+++ b/apps/common/vJoyInterface/vjoyinterface.h
@@ -10,19 +10,19 @@
#define VJOYINTERFACE_API __declspec(dllimport)
#endif
-
///////////////////////////// vJoy device (collection) status ////////////////////////////////////////////
#ifndef VJDSTAT
#define VJDSTAT
-enum VjdStat /* Declares an enumeration data type */
-{
- VJD_STAT_OWN, // The vJoy Device is owned by this application.
- VJD_STAT_FREE, // The vJoy Device is NOT owned by any application (including this one).
- VJD_STAT_BUSY, // The vJoy Device is owned by another application. It cannot be acquired by this application.
- VJD_STAT_MISS, // The vJoy Device is missing. It either does not exist or the driver is down.
- VJD_STAT_UNKN // Unknown
-};
-
+namespace vJoy {
+ enum VjdStat /* Declares an enumeration data type */
+ {
+ VJD_STAT_OWN, // The vJoy Device is owned by this application.
+ VJD_STAT_FREE, // The vJoy Device is NOT owned by any application (including this one).
+ VJD_STAT_BUSY, // The vJoy Device is owned by another application. It cannot be acquired by this application.
+ VJD_STAT_MISS, // The vJoy Device is missing. It either does not exist or the driver is down.
+ VJD_STAT_UNKN // Unknown
+ };
+}
/* Error codes for some of the functions */
#define NO_HANDLE_BY_INDEX -1
#define BAD_PREPARSED_DATA -2
@@ -73,7 +73,7 @@ struct DEVCTRLS {
struct DeviceStat {
HANDLE h; // Handle to the PDO interface that represents the virtual device
- VjdStat stat; // Status of the device
+ vJoy::VjdStat stat; // Status of the device
JOYSTICK_POSITION_V2 position; // Current Position of the device
HDEVNOTIFY hDeviceNotifyHandle; // Device Notification Handle
DEVCTRLS DeviceControls; // Structure Holding the data about the device's controls
@@ -276,7 +276,7 @@ VJOYINTERFACE_API int __cdecl GetVJDContPovNumber(UINT rID); // Get the number
VJOYINTERFACE_API BOOL __cdecl GetVJDAxisExist(UINT rID, UINT Axis); // Test if given axis defined in the specified VDJ
VJOYINTERFACE_API BOOL __cdecl GetVJDAxisMax(UINT rID, UINT Axis, LONG * Max); // Get logical Maximum value for a given axis defined in the specified VDJ
VJOYINTERFACE_API BOOL __cdecl GetVJDAxisMin(UINT rID, UINT Axis, LONG * Min); // Get logical Minimum value for a given axis defined in the specified VDJ
-VJOYINTERFACE_API enum VjdStat __cdecl GetVJDStatus(UINT rID); // Get the status of the specified vJoy Device.
+VJOYINTERFACE_API enum vJoy::VjdStat __cdecl GetVJDStatus(UINT rID); // Get the status of the specified vJoy Device.
// Added in 2.1.6
VJOYINTERFACE_API BOOL __cdecl isVJDExists(UINT rID); // TRUE if the specified vJoy Device exists
diff --git a/apps/common/vXboxInterfaceCppWrap/vXboxInterfaceCppWrap.sln b/apps/common/vXboxInterfaceCppWrap/vXboxInterfaceCppWrap.sln
new file mode 100644
index 0000000..55c18ee
--- /dev/null
+++ b/apps/common/vXboxInterfaceCppWrap/vXboxInterfaceCppWrap.sln
@@ -0,0 +1,28 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 14
+VisualStudioVersion = 14.0.25420.1
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vXboxInterfaceCLR", "vXboxInterfaceCppWrap\vXboxInterfaceCppWrap.vcxproj", "{A2977561-932D-48D1-BDFC-30346B745478}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|x64 = Debug|x64
+ Debug|x86 = Debug|x86
+ Release|x64 = Release|x64
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {A2977561-932D-48D1-BDFC-30346B745478}.Debug|x64.ActiveCfg = Debug-Xbox|x64
+ {A2977561-932D-48D1-BDFC-30346B745478}.Debug|x64.Build.0 = Debug-Xbox|x64
+ {A2977561-932D-48D1-BDFC-30346B745478}.Debug|x86.ActiveCfg = Debug-Xbox|Win32
+ {A2977561-932D-48D1-BDFC-30346B745478}.Debug|x86.Build.0 = Debug-Xbox|Win32
+ {A2977561-932D-48D1-BDFC-30346B745478}.Release|x64.ActiveCfg = Release-Xbox|x64
+ {A2977561-932D-48D1-BDFC-30346B745478}.Release|x64.Build.0 = Release-Xbox|x64
+ {A2977561-932D-48D1-BDFC-30346B745478}.Release|x86.ActiveCfg = Release-Xbox|Win32
+ {A2977561-932D-48D1-BDFC-30346B745478}.Release|x86.Build.0 = Release-Xbox|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/apps/common/vXboxInterfaceCppWrap/vXboxInterfaceCppWrap/AssemblyInfo.cpp b/apps/common/vXboxInterfaceCppWrap/vXboxInterfaceCppWrap/AssemblyInfo.cpp
new file mode 100644
index 0000000..dca2acc
--- /dev/null
+++ b/apps/common/vXboxInterfaceCppWrap/vXboxInterfaceCppWrap/AssemblyInfo.cpp
@@ -0,0 +1,38 @@
+#include "stdafx.h"
+
+using namespace System;
+using namespace System::Reflection;
+using namespace System::Runtime::CompilerServices;
+using namespace System::Runtime::InteropServices;
+using namespace System::Security::Permissions;
+
+//
+// Les informations générales relatives à un assembly dépendent de
+// l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations
+// associées à un assembly.
+//
+[assembly:AssemblyTitleAttribute(L"vXboxInterface")];
+[assembly:AssemblyDescriptionAttribute(L"XBox Controller interface for vJoy driver")];
+[assembly:AssemblyConfigurationAttribute(L"")];
+[assembly:AssemblyCompanyAttribute(L"Github.com")];
+[assembly:AssemblyProductAttribute(L"vXboxInterface")];
+[assembly:AssemblyCopyrightAttribute(L"Copyright (c) 2016")];
+[assembly:AssemblyTrademarkAttribute(L"B23PRODTM")];
+[assembly:AssemblyCultureAttribute(L"")];
+
+//
+// Les informations de version pour un assembly se composent des quatre valeurs suivantes :
+//
+// Version principale
+// Version secondaire
+// Numéro de build
+// Révision
+//
+// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de révision et de build par défaut
+// en utilisant '*', comme indiqué ci-dessous :
+
+[assembly:AssemblyVersionAttribute("1.0.*")];
+
+[assembly:ComVisible(false)];
+
+[assembly:CLSCompliantAttribute(true)];
\ No newline at end of file
diff --git a/apps/common/vXboxInterfaceCppWrap/vXboxInterfaceCppWrap/IWrapper.cpp b/apps/common/vXboxInterfaceCppWrap/vXboxInterfaceCppWrap/IWrapper.cpp
new file mode 100644
index 0000000..a43c226
--- /dev/null
+++ b/apps/common/vXboxInterfaceCppWrap/vXboxInterfaceCppWrap/IWrapper.cpp
@@ -0,0 +1,225 @@
+#pragma once
+#include "Stdafx.h"
+
+#include "IWrapper.h"
+
+#include "../../vjoyinterface/vXboxInterface.h"
+
+using namespace std;
+
+using namespace vXbox;
+inline bool vXbox::IWrapper::isVBusExists(void) {
+ return ::isVBusExists() == TRUE;
+}
+inline bool vXbox::IWrapper::GetNumEmptyBusSlots(UCHAR * nSlots) {
+ return ::GetNumEmptyBusSlots(nSlots) == TRUE;
+}
+inline bool vXbox::IWrapper::isControllerExists(UINT UserIndex) {
+ return ::isControllerExists(UserIndex) == TRUE;
+}
+inline bool vXbox::IWrapper::isControllerOwned(UINT UserIndex) {
+ return ::isControllerOwned(UserIndex) == TRUE;
+}
+inline bool vXbox::IWrapper::PlugIn(UINT UserIndex) {
+ return ::PlugIn(UserIndex) == TRUE;
+}
+inline bool vXbox::IWrapper::UnPlug(UINT UserIndex) {
+ return ::UnPlug(UserIndex) == TRUE;
+}
+inline bool vXbox::IWrapper::UnPlugForce(UINT UserIndex) {
+ return ::UnPlugForce(UserIndex) == TRUE;
+}
+inline bool vXbox::IWrapper::SetDpad(UINT UserIndex, UINT Value) {
+ return ::SetDpad(UserIndex, Value) == TRUE;
+}
+inline bool vXbox::IWrapper::SetDpadUp(UINT UserIndex) {
+ return ::SetDpadUp(UserIndex) == TRUE;
+}
+inline bool vXbox::IWrapper::SetDpadRight(UINT UserIndex) {
+ return ::SetDpadRight(UserIndex) == TRUE;
+}
+inline bool vXbox::IWrapper::SetDpadDown(UINT UserIndex) {
+ return ::SetDpadDown(UserIndex) == TRUE;
+}
+inline bool vXbox::IWrapper::SetDpadLeft(UINT UserIndex) {
+ return ::SetDpadLeft(UserIndex) == TRUE;
+}
+inline bool vXbox::IWrapper::SetDpadUpRight(UINT UserIndex) {
+ return ::SetDpadUpRight(UserIndex) == TRUE;
+}
+inline bool vXbox::IWrapper::SetDpadDownRight(UINT UserIndex) {
+ return ::SetDpadDownRight(UserIndex) == TRUE;
+}
+inline bool vXbox::IWrapper::SetDpadDownLeft(UINT UserIndex) {
+ return ::SetDpadDownLeft(UserIndex) == TRUE;
+}
+inline bool vXbox::IWrapper::SetDpadUpLeft(UINT UserIndex) {
+ return ::SetDpadUpLeft(UserIndex) == TRUE;
+}
+inline bool vXbox::IWrapper::SetDpadOff(UINT UserIndex) {
+ return ::SetDpadOff(UserIndex) == TRUE;
+}
+inline bool vXbox::IWrapper::SetBtnAny(UINT UserIndex, bool Press, UINT xBtn) {
+ return ::SetBtnAny(UserIndex, (Press ? TRUE : FALSE), xBtn) == TRUE;
+}
+inline bool vXbox::IWrapper::SetBtnA(UINT UserIndex, bool Press) {
+ return ::SetBtnA(UserIndex, (Press ? TRUE : FALSE)) == TRUE;
+}
+inline bool vXbox::IWrapper::SetBtnB(UINT UserIndex, bool Press) {
+ return ::SetBtnB(UserIndex, (Press ? TRUE : FALSE)) == TRUE;
+}
+inline bool vXbox::IWrapper::SetBtnX(UINT UserIndex, bool Press) {
+ return ::SetBtnX(UserIndex, (Press ? TRUE : FALSE)) == TRUE;
+}
+inline bool vXbox::IWrapper::SetBtnY(UINT UserIndex, bool Press) {
+ return ::SetBtnY(UserIndex, (Press ? TRUE : FALSE)) == TRUE;
+}
+inline bool vXbox::IWrapper::SetBtnStart(UINT UserIndex, bool Press) {
+ return ::SetBtnStart(UserIndex, (Press ? TRUE : FALSE)) == TRUE;
+}
+inline bool vXbox::IWrapper::SetBtnBack(UINT UserIndex, bool Press) {
+ return ::SetBtnBack(UserIndex, (Press ? TRUE : FALSE)) == TRUE;
+}
+inline bool vXbox::IWrapper::SetBtnLT(UINT UserIndex, bool Press) {
+ return ::SetBtnLT(UserIndex, (Press ? TRUE : FALSE)) == TRUE;
+}
+inline bool vXbox::IWrapper::SetBtnRT(UINT UserIndex, bool Press) {
+ return ::SetBtnRT(UserIndex, (Press ? TRUE : FALSE)) == TRUE;
+}
+inline bool vXbox::IWrapper::SetBtnLB(UINT UserIndex, bool Press) {
+ return ::SetBtnLB(UserIndex, (Press ? TRUE : FALSE)) == TRUE;
+}
+inline bool vXbox::IWrapper::SetBtnRB(UINT UserIndex, bool Press) {
+ return ::SetBtnRB(UserIndex, (Press ? TRUE : FALSE)) == TRUE;
+}
+inline bool vXbox::IWrapper::SetTriggerL(UINT UserIndex, BYTE Value, UINT Threshold) {
+ return ::SetTriggerL(UserIndex, Value, Threshold) == TRUE;
+}
+inline bool vXbox::IWrapper::SetTriggerR(UINT UserIndex, BYTE Value, UINT Threshold) {
+ return ::SetTriggerR(UserIndex, Value, Threshold) == TRUE;
+}
+inline bool vXbox::IWrapper::GetTriggerLR(UINT UserIndex, PBYTE ValueL, PBYTE ValueR) {
+ return ::GetTriggerLR(UserIndex, ValueL, ValueR, HID_USAGE_SL1, HID_USAGE_SL1);
+}
+inline bool vXbox::IWrapper::GetLedNumber(UINT UserIndex, PBYTE pLed) {
+ return ::GetLedNumber(UserIndex, pLed) == TRUE;
+}
+
+inline bool vXbox::IWrapper::GetVibration(UINT UserIndex, PXINPUT_VIBRATION pVib) {
+ return ::GetVibration(UserIndex, pVib) == TRUE;
+}
+
+
+#pragma region Legacy Interface Functions
+///// General driver data
+inline SHORT vXbox::IWrapper::GetvJoyVersion(void) {
+ return ::GetvJoyVersion();
+}
+
+inline bool vXbox::IWrapper::vJoyEnabled(void) {
+ return ::vJoyEnabled() == TRUE;
+}
+inline PVOID vXbox::IWrapper::GetvJoyProductString(void) {
+ return ::GetvJoyProductString();
+}
+inline PVOID vXbox::IWrapper::GetvJoyManufacturerString(void) {
+ return ::GetvJoyManufacturerString();
+}
+inline PVOID vXbox::IWrapper::GetvJoySerialNumberString(void) {
+ return ::GetvJoySerialNumberString();
+}
+//BOOL DriverMatch(WORD * DllVer, WORD * DrvVer);
+//VOID RegisterRemovalCB(RemovalCB cb, PVOID data);
+bool vXbox::IWrapper::vJoyFfbCap(bool * Supported) {
+ BOOL s = Supported ? TRUE : FALSE;
+ return ::vJoyFfbCap(&s) == TRUE;
+}
+inline bool vXbox::IWrapper::GetvJoyMaxDevices(int * n) {
+ return ::GetvJoyMaxDevices(n) == TRUE;
+}
+inline bool vXbox::IWrapper::GetNumberExistingVJD(int * n) {
+ return ::GetNumberExistingVJD(n) == TRUE;
+}
+
+///// vJoy Device properties
+inline int vXbox::IWrapper::GetVJDButtonNumber(UINT rID) {
+ return ::GetVJDButtonNumber(rID);
+}
+inline int vXbox::IWrapper::GetVJDDiscPovNumber(UINT rID) {
+ return ::GetVJDDiscPovNumber(rID);
+}
+inline int vXbox::IWrapper::GetVJDContPovNumber(UINT rID) {
+ return ::GetVJDContPovNumber(rID);
+}
+inline bool vXbox::IWrapper::GetVJDAxisExist(UINT rID, UINT Axis) {
+ return ::GetVJDAxisExist(rID, Axis) == TRUE;
+}
+inline bool vXbox::IWrapper::GetVJDAxisMax(UINT rID, UINT Axis, LONG * Max) {
+ return ::GetVJDAxisMax(rID, Axis, Max) == TRUE;
+}
+inline bool vXbox::IWrapper::GetVJDAxisMin(UINT rID, UINT Axis, LONG * Min) {
+ return ::GetVJDAxisMin(rID, Axis, Min) == TRUE;
+}
+int vXbox::IWrapper::GetVJDStatus(UINT rID) {
+ valarray all = vXbox::IWrapper::getVjdStat();
+ // return value match with "CLR" enum
+ vJoy::VjdStat ret = ::GetVJDStatus(rID);
+ for (int i = 0; i < all.size(); i++) {
+ if (all[i] == ret)
+ return all[i];
+ };
+ return VJD_STAT_UNKN;
+}
+
+inline bool vXbox::IWrapper::isVJDExists(UINT rID) {
+ return ::isVJDExists(rID) == TRUE;
+}
+
+///// Write access to vJoy Device - Basic
+inline bool vXbox::IWrapper::AcquireVJD(UINT rID) {
+ return ::AcquireVJD(rID) == TRUE;
+}
+
+
+inline VOID vXbox::IWrapper::RelinquishVJD(UINT rID) {
+ ::RelinquishVJD(rID);
+}
+
+//// Reset functions
+inline bool vXbox::IWrapper::ResetVJD(UINT rID) {
+ return ::ResetVJD(rID) == TRUE;
+}
+inline VOID vXbox::IWrapper::ResetAll(void) {
+ ::ResetAll();
+}
+inline bool vXbox::IWrapper::ResetButtons(UINT rID) {
+ return ::ResetButtons(rID) == TRUE;
+}
+inline bool vXbox::IWrapper::ResetPovs(UINT rID) {
+ return ::ResetPovs(rID) == TRUE;
+}
+
+// Write data
+inline bool vXbox::IWrapper::UpdateVJD(UINT rID, PVOID pData) {
+ return ::UpdateVJD(rID, pData) == TRUE;
+}
+inline bool vXbox::IWrapper::SetTriggerLR(UINT UserIndex, SHORT ValueL, SHORT ValueR, UINT Threshold) {
+ return ::SetTriggerLR(UserIndex, ValueL, ValueR, Threshold);
+}
+
+inline bool vXbox::IWrapper::SetAxisXY(UINT UserIndex, SHORT ValueX, SHORT ValueY, UINT AxisX, UINT AxisY, UINT DeadZone, SHORT Axis_Max) {
+ return ::SetAxisXY(UserIndex, ValueX, ValueY, AxisX, AxisY, DeadZone, Axis_Max);
+}
+inline bool vXbox::IWrapper::GetAxisXY(UINT UserIndex, PSHORT ValueX, PSHORT ValueY, UINT AxisX, UINT AxisY) {
+ return ::GetAxisXY(UserIndex, ValueX, ValueY, AxisX, AxisY);
+}
+inline bool vXbox::IWrapper::SetBtn(bool Value, UINT rID, UCHAR nBtn) {
+ return ::SetBtn((Value ? TRUE : FALSE), rID, nBtn) == TRUE;
+}
+inline bool vXbox::IWrapper::SetDiscPov(int Value, UINT rID, UCHAR nPov) {
+ return ::SetDiscPov(Value, rID, nPov) == TRUE;
+}
+inline bool vXbox::IWrapper::SetContPov(DWORD Value, UINT rID, UCHAR nPov) {
+ return ::SetContPov(Value, rID, nPov) == TRUE;
+}
+#pragma endregion
\ No newline at end of file
diff --git a/apps/common/vXboxInterfaceCppWrap/vXboxInterfaceCppWrap/IWrapper.h b/apps/common/vXboxInterfaceCppWrap/vXboxInterfaceCppWrap/IWrapper.h
new file mode 100644
index 0000000..71b66ca
--- /dev/null
+++ b/apps/common/vXboxInterfaceCppWrap/vXboxInterfaceCppWrap/IWrapper.h
@@ -0,0 +1,184 @@
+//// IWrapper.h
+#pragma once
+#include
+#include "../../vjoyinterface/vjoyinterface.h"
+#include
+
+using namespace std;
+namespace vXbox {
+
+/***
+ // HID Descriptor definitions - Axes
+#define HID_USAGE_X 0x30
+#define HID_USAGE_Y 0x31
+#define HID_USAGE_Z 0x32
+#define HID_USAGE_RX 0x33
+#define HID_USAGE_RY 0x34
+#define HID_USAGE_RZ 0x35
+#define HID_USAGE_SL0 0x36
+#define HID_USAGE_SL1 0x37
+#define HID_USAGE_WHL 0x38
+#define HID_USAGE_POV 0x39
+
+ XINPUT defined constants
+ //
+ // Constants for gamepad buttons
+ //
+#define XINPUT_GAMEPAD_DPAD_UP 0x0001
+#define XINPUT_GAMEPAD_DPAD_DOWN 0x0002
+#define XINPUT_GAMEPAD_DPAD_LEFT 0x0004
+#define XINPUT_GAMEPAD_DPAD_RIGHT 0x0008
+#define XINPUT_GAMEPAD_START 0x0010
+#define XINPUT_GAMEPAD_BACK 0x0020
+#define XINPUT_GAMEPAD_LEFT_THUMB 0x0040
+#define XINPUT_GAMEPAD_RIGHT_THUMB 0x0080
+#define XINPUT_GAMEPAD_LEFT_SHOULDER 0x0100
+#define XINPUT_GAMEPAD_RIGHT_SHOULDER 0x0200
+#define XINPUT_GAMEPAD_A 0x1000
+#define XINPUT_GAMEPAD_B 0x2000
+#define XINPUT_GAMEPAD_X 0x4000
+#define XINPUT_GAMEPAD_Y 0x8000
+
+
+ //
+ // Gamepad thresholds
+ //
+#define XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE 7849
+#define XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE 8689
+#define XINPUT_GAMEPAD_TRIGGER_THRESHOLD 30
+
+*/
+
+ public ref class IWrapper
+ {
+ public:
+ // HID8USAGE enum
+ static const unsigned int hid_X = HID_USAGE_X,
+ hid_Y = HID_USAGE_Y,
+ hid_Z = HID_USAGE_Z,
+ hid_RX = HID_USAGE_RX,
+ hid_RY = HID_USAGE_RY,
+ hid_RZ = HID_USAGE_RZ,
+ hid_SL0 = HID_USAGE_SL0,
+ hid_SL1 = HID_USAGE_SL1,
+ hid_WHL = HID_USAGE_WHL,
+ hid_POV = HID_USAGE_POV;
+ // XINPUT Deadzone and Threshold
+ static const unsigned int xinput_LAXIS_DEADZONE = XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE,
+ xinput_RAXIS_DEADZONE = XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE,
+ xinput_TRIGGER_THRESHOLD = XINPUT_GAMEPAD_TRIGGER_THRESHOLD;
+ static const unsigned int xinput_DPAD_UP = XINPUT_GAMEPAD_DPAD_UP,
+ xinput_DPAD_DOWN = XINPUT_GAMEPAD_DPAD_DOWN,
+ xinput_DPAD_LEFT = XINPUT_GAMEPAD_DPAD_LEFT,
+ xinput_DPAD_RIGHT = XINPUT_GAMEPAD_DPAD_RIGHT,
+ xinput_DPAD_OFF = 0;
+ static const unsigned int xinput_GAMEPAD_A = XINPUT_GAMEPAD_A,
+ xinput_GAMEPAD_B = XINPUT_GAMEPAD_B,
+ xinput_GAMEPAD_X = XINPUT_GAMEPAD_X,
+ xinput_GAMEPAD_Y = XINPUT_GAMEPAD_Y,
+ xinput_GAMEPAD_BACK = XINPUT_GAMEPAD_BACK,
+ xinput_GAMEPAD_START = XINPUT_GAMEPAD_START,
+ xinput_GAMEPAD_LEFT_SHOULDER = XINPUT_GAMEPAD_LEFT_SHOULDER,
+ xinput_GAMEPAD_RIGHT_SHOULDER = XINPUT_GAMEPAD_RIGHT_SHOULDER,
+ xinput_GAMEPAD_LEFT_THUMB = XINPUT_GAMEPAD_LEFT_THUMB,
+ xinput_GAMEPAD_RIGHT_THUMB = XINPUT_GAMEPAD_RIGHT_THUMB;
+ // VjdStat
+ static const int VJD_STAT_BUSY = vJoy::VJD_STAT_BUSY,
+ VJD_STAT_FREE = vJoy::VJD_STAT_FREE,
+ VJD_STAT_MISS = vJoy::VJD_STAT_MISS,
+ VJD_STAT_OWN = vJoy::VJD_STAT_OWN,
+ VJD_STAT_UNKN = vJoy::VJD_STAT_UNKN;
+ static valarray getVjdStat() {
+ valarray all = { VJD_STAT_BUSY,VJD_STAT_FREE,VJD_STAT_MISS, VJD_STAT_OWN, VJD_STAT_UNKN };
+ return all;
+ }
+ /// Status
+ bool isVBusExists();
+ bool GetNumEmptyBusSlots(UCHAR * nSlots);
+ bool isControllerExists(UINT UserIndex);
+ bool isControllerOwned(UINT UserIndex);
+
+
+ // Virtual device Plug-In/Unplug
+ bool PlugIn(UINT UserIndex);
+ bool UnPlug(UINT UserIndex);
+ bool UnPlugForce(UINT UserIndex);
+
+ // Data Transfer (Data to the device)
+ bool SetBtnAny(UINT UserIndex, bool Press, UINT xBtn);
+ bool SetBtnA(UINT UserIndex, bool Press);
+ bool SetBtnB(UINT UserIndex, bool Press);
+ bool SetBtnX(UINT UserIndex, bool Press);
+ bool SetBtnY(UINT UserIndex, bool Press);
+ bool SetBtnStart(UINT UserIndex, bool Press);
+ bool SetBtnBack(UINT UserIndex, bool Press);
+ bool SetBtnLT(UINT UserIndex, bool Press); // Left Thumb/Stick
+ bool SetBtnRT(UINT UserIndex, bool Press); // Right Thumb/Stick
+ bool SetBtnLB(UINT UserIndex, bool Press); // Left Bumper
+ bool SetBtnRB(UINT UserIndex, bool Press); // Right Bumper
+ bool SetTriggerL(UINT UserIndex, BYTE Value, UINT Threshold); // Left Trigger
+ bool SetDpad(UINT UserIndex, UINT Value);
+ bool SetTriggerR(UINT UserIndex, BYTE Value, UINT Threshold); // Right Trigger
+ bool SetDpadUp(UINT UserIndex);
+ bool SetDpadRight(UINT UserIndex);
+ bool SetDpadDown(UINT UserIndex);
+ bool SetDpadLeft(UINT UserIndex);
+ bool SetDpadUpRight(UINT UserIndex);
+ bool SetDpadDownRight(UINT UserIndex);
+ bool SetDpadDownLeft(UINT UserIndex);
+ bool SetDpadUpLeft(UINT UserIndex);
+ bool SetDpadOff(UINT UserIndex);
+
+ // Data Transfer (Feedback from the device)
+ bool GetLedNumber(UINT UserIndex, PBYTE pLed);
+ bool GetVibration(UINT UserIndex, PXINPUT_VIBRATION pVib);
+
+#pragma region Legacy Interface Functions
+ ///// General driver data
+ SHORT GetvJoyVersion(void);
+ bool vJoyEnabled(void);
+ PVOID GetvJoyProductString(void);
+ PVOID GetvJoyManufacturerString(void);
+ PVOID GetvJoySerialNumberString(void);
+ //BOOL DriverMatch(WORD * DllVer, WORD * DrvVer);
+ //VOID RegisterRemovalCB(RemovalCB cb, PVOID data);
+ bool vJoyFfbCap(bool * Supported);
+ bool GetvJoyMaxDevices(int * n);
+ bool GetNumberExistingVJD(int * n);
+
+ ///// vJoy Device properties
+ int GetVJDButtonNumber(UINT rID);
+ int GetVJDDiscPovNumber(UINT rID);
+ int GetVJDContPovNumber(UINT rID);
+ bool GetVJDAxisExist(UINT rID, UINT Axis);
+ bool GetVJDAxisMax(UINT rID, UINT Axis, LONG * Max);
+ bool GetVJDAxisMin(UINT rID, UINT Axis, LONG * Min);
+ int GetVJDStatus(UINT rID);
+ bool isVJDExists(UINT rID);
+
+ ///// Write access to vJoy Device - Basic
+
+ bool AcquireVJD(UINT rID);
+ VOID RelinquishVJD(UINT rID);
+
+
+ //// Reset functions
+ bool ResetVJD(UINT rID);
+ VOID ResetAll(void);
+ bool ResetButtons(UINT rID);
+ bool ResetPovs(UINT rID);
+
+ // Write data
+ bool UpdateVJD(UINT rID, PVOID pData);
+ bool SetBtn(bool Value, UINT rID, UCHAR nBtn);
+ bool SetDiscPov(int Value, UINT rID, UCHAR nPov);
+ bool SetContPov(DWORD Value, UINT rID, UCHAR nPov);
+
+ bool SetAxisXY(UINT UserIndex, SHORT ValueX, SHORT ValueY, UINT AxisX, UINT AxisY, UINT DeadZone,SHORT Axis_Max);
+ // Read data
+ bool GetAxisXY(UINT UserIndex, PSHORT ValueX, PSHORT ValueY, UINT AxisX, UINT AxisY);
+ bool GetTriggerLR(UINT UserIndex, PBYTE ValueL, PBYTE ValueR);
+ bool SetTriggerLR(UINT UserIndex, SHORT ValueL, SHORT ValueR, UINT Threshold);
+#pragma endregion
+ };
+}
\ No newline at end of file
diff --git a/apps/common/vXboxInterfaceCppWrap/vXboxInterfaceCppWrap/ReadMe.txt b/apps/common/vXboxInterfaceCppWrap/vXboxInterfaceCppWrap/ReadMe.txt
new file mode 100644
index 0000000..ac73fd9
--- /dev/null
+++ b/apps/common/vXboxInterfaceCppWrap/vXboxInterfaceCppWrap/ReadMe.txt
@@ -0,0 +1,38 @@
+========================================================================
+ DYNAMIC LINK LIBRARY : vXboxInterface Project Overview
+========================================================================
+
+AppWizard has created this vXboxInterface DLL for you.
+
+This file contains a summary of what you will find in each of the files that
+make up your vXboxInterface application.
+
+vXboxInterface.vcxproj
+ This is the main project file for VC++ projects generated using an Application Wizard.
+ It contains information about the version of Visual C++ that generated the file, and
+ information about the platforms, configurations, and project features selected with the
+ Application Wizard.
+
+vXboxInterface.vcxproj.filters
+ This is the filters file for VC++ projects generated using an Application Wizard.
+ It contains information about the association between the files in your project
+ and the filters. This association is used in the IDE to show grouping of files with
+ similar extensions under a specific node (for e.g. ".cpp" files are associated with the
+ "Source Files" filter).
+
+vXboxInterface.cpp
+ This is the main DLL source file.
+
+vXboxInterface.h
+ This file contains a class declaration.
+
+AssemblyInfo.cpp
+ Contains custom attributes for modifying assembly metadata.
+
+/////////////////////////////////////////////////////////////////////////////
+Other notes:
+
+AppWizard uses "TODO:" to indicate parts of the source code you
+should add to or customize.
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/apps/common/vXboxInterfaceCppWrap/vXboxInterfaceCppWrap/Stdafx.cpp b/apps/common/vXboxInterfaceCppWrap/vXboxInterfaceCppWrap/Stdafx.cpp
new file mode 100644
index 0000000..5314c34
--- /dev/null
+++ b/apps/common/vXboxInterfaceCppWrap/vXboxInterfaceCppWrap/Stdafx.cpp
@@ -0,0 +1,5 @@
+// stdafx.cpp : fichier source incluant simplement les fichiers Include standard
+// vXboxInterface.pch représente l'en-tête précompilé
+// stdafx.obj contient les informations de type précompilées
+
+#include
\ No newline at end of file
diff --git a/apps/common/vXboxInterfaceCppWrap/vXboxInterfaceCppWrap/Stdafx.h b/apps/common/vXboxInterfaceCppWrap/vXboxInterfaceCppWrap/Stdafx.h
new file mode 100644
index 0000000..a31b96d
--- /dev/null
+++ b/apps/common/vXboxInterfaceCppWrap/vXboxInterfaceCppWrap/Stdafx.h
@@ -0,0 +1,24 @@
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#undef UNICODE
+#undef _UNICODE
+
+#pragma once
+#include "targetver.h"
+
+// #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+// Windows Header Files:
+#include
+#include
+#include