Skip to content

Commit

Permalink
Fixed vJoy issue with old versions (AOT was supplied with vJoy 218 bu…
Browse files Browse the repository at this point in the history
…t the latest is 219 and they aren't compatible).

Cleaned up some code.
Added the needed oculus sdk and vjoy sdk files so you can build it yourself easier.
  • Loading branch information
rajetic committed Nov 17, 2019
1 parent 26d93ba commit deb0641
Show file tree
Hide file tree
Showing 20 changed files with 10,262 additions and 36 deletions.
20 changes: 10 additions & 10 deletions auto_oculus_touch/auto_oculus_touch.vcxproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
Expand All @@ -14,19 +14,19 @@
<ProjectGuid>{074A20DE-E5C9-4B4B-A2B6-08E40AC24FFC}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>auto_oculus_touch</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0.18362.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
Expand Down Expand Up @@ -60,13 +60,13 @@
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;AUTOOCULUSTOUCH_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>D:\sdk\OculusSDK126\LibOVR\Include;D:\sdk\vjoy\inc</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\sdk\include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>D:\sdk\OculusSDK126\LibOVR\Lib\Windows\x64\Release\VS2015;D:\sdk\vjoy\lib\amd64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>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)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\sdk\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>libovr.lib;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)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
Expand All @@ -79,15 +79,15 @@
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;AUTOOCULUSTOUCH_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>D:\sdk\OculusSDK126\LibOVR\Include;D:\sdk\vjoy\inc</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\sdk\include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>D:\sdk\OculusSDK126\LibOVR\Lib\Windows\x64\Release\VS2015;D:\sdk\vjoy\lib\amd64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>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)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\sdk\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>libovr.lib;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)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
Expand Down
18 changes: 4 additions & 14 deletions auto_oculus_touch/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@

#define ROBUST
#include "stdafx.h"
#include "OVR_CAPI.h"
#include "oculus/OVR_CAPI.h"
#include "cmath"
#include "Extras\OVR_Math.h"
#include "public.h"
#include "vjoyinterface.h"

#pragma comment(lib,"LibOVR")
#include "oculus/Extras/OVR_Math.h"
#include "vjoy/public.h"
#include "vjoy/vjoyinterface.h"

// Global Variables
ovrSession g_HMD = 0; // The session of the headset
Expand Down Expand Up @@ -69,7 +67,6 @@ extern "C"
return 0;

result = ovr_Create(&g_HMD, &g_luid);

return g_HMD ? 1 : 0;
}

Expand Down Expand Up @@ -243,13 +240,6 @@ extern "C"
{
if (g_HMD)
{
unsigned int value = ~g_touchState.Buttons & g_touchStateLast.Buttons;
if(g_touchState.Buttons)
int dummy = 0;
if (g_touchStateLast.Buttons>0)
{
int dummy = 0;
}
return ~g_touchState.Buttons & g_touchStateLast.Buttons;
}
return 0;
Expand Down
9 changes: 4 additions & 5 deletions bin/auto_oculus_touch.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -149,24 +149,23 @@ ResetFacing(controller)

InitvJoy(device)
{
return DllCall("auto_oculus_touch\initvJoy", "UInt", device, "UInt")
DllCall("auto_oculus_touch\initvJoy", "UInt", device, "UInt")
}

SetvJoyAxis(axis, value)
{
return DllCall("auto_oculus_touch\setvJoyAxis", "Float", value, "UInt", axis)
DllCall("auto_oculus_touch\setvJoyAxis", "Float", value, "UInt", axis)
}

SetvJoyAxisU(axis, value)
{
return DllCall("auto_oculus_touch\setvJoyAxis", "Float", value*2-1, "UInt", axis)
DllCall("auto_oculus_touch\setvJoyAxis", "Float", value*2-1, "UInt", axis)
}

SetvJoyButton(button, value)
{
return DllCall("auto_oculus_touch\setvJoyButton", "UInt", value, "UInt", button)
DllCall("auto_oculus_touch\setvJoyButton", "UInt", value, "UInt", button)
}


; Grab the library.
hModule := DllCall("LoadLibrary", "Str", "auto_oculus_touch.dll", "Ptr")
23 changes: 16 additions & 7 deletions bin/oculus_touch_vjoy.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ Loop {
Poll()

; Get the various analog values. Triggers are 0.0-1.0, thumbsticks are -1.0-1.0
leftIndexTrigger := GetTrigger(LeftHand, IndexTrigger)
leftHandTrigger := GetTrigger(LeftHand, HandTrigger)
leftX := GetThumbStick(LeftHand, XAxis)
leftY := GetThumbStick(LeftHand, YAxis)
leftIndexTrigger := GetTrigger(LeftHand, IndexTrigger)
leftHandTrigger := GetTrigger(LeftHand, HandTrigger)
leftX := GetThumbStick(LeftHand, XAxis)
leftY := GetThumbStick(LeftHand, YAxis)
rightIndexTrigger := GetTrigger(RightHand, IndexTrigger)
rightHandTrigger := GetTrigger(RightHand, HandTrigger)
rightX := GetThumbStick(RightHand, XAxis)
Expand All @@ -26,9 +26,9 @@ Loop {
; Down is the current state. If you test with this, you get a key every poll it is down. Repeating.
; Pressed is set if transitioned to down in the last poll. Non repeating.
; Released is set if transitioned to up in the last poll. Non repeating.
down := GetButtonsDown()
pressed := GetButtonsPressed()
released := GetButtonsReleased()
down := GetButtonsDown()
pressed := GetButtonsPressed()
released := GetButtonsReleased()
touchDown := GetTouchDown()
touchPressed := GetTouchPressed()
touchReleased := GetTouchReleased()
Expand Down Expand Up @@ -63,6 +63,15 @@ Loop {
if released & ovrEnter
SetvJoyButton(5,0)

if pressed & ovrLThumb
SetvJoyButton(8,1)
if released & ovrLThumb
SetvJoyButton(8,0)
if pressed & ovrRThumb
SetvJoyButton(9,1)
if released & ovrRThumb
SetvJoyButton(9,0)

if leftHandTrigger > 0.7
SetvJoyButton(6,1)
else
Expand Down
Binary file modified bin/vJoyInterface.dll
Binary file not shown.
Loading

0 comments on commit deb0641

Please sign in to comment.