-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 174e6ea
Showing
8 changed files
with
417 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 14 | ||
VisualStudioVersion = 14.0.24720.0 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "auto_oculus_touch", "auto_oculus_touch\auto_oculus_touch.vcxproj", "{074A20DE-E5C9-4B4B-A2B6-08E40AC24FFC}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|x64 = Debug|x64 | ||
Release|x64 = Release|x64 | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{074A20DE-E5C9-4B4B-A2B6-08E40AC24FFC}.Debug|x64.ActiveCfg = Debug|x64 | ||
{074A20DE-E5C9-4B4B-A2B6-08E40AC24FFC}.Debug|x64.Build.0 = Debug|x64 | ||
{074A20DE-E5C9-4B4B-A2B6-08E40AC24FFC}.Release|x64.ActiveCfg = Release|x64 | ||
{074A20DE-E5C9-4B4B-A2B6-08E40AC24FFC}.Release|x64.Build.0 = Release|x64 | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<ItemGroup Label="ProjectConfigurations"> | ||
<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"> | ||
<ProjectGuid>{074A20DE-E5C9-4B4B-A2B6-08E40AC24FFC}</ProjectGuid> | ||
<Keyword>Win32Proj</Keyword> | ||
<RootNamespace>auto_oculus_touch</RootNamespace> | ||
<WindowsTargetPlatformVersion>8.1</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> | ||
<CharacterSet>Unicode</CharacterSet> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> | ||
<ConfigurationType>DynamicLibrary</ConfigurationType> | ||
<UseDebugLibraries>false</UseDebugLibraries> | ||
<PlatformToolset>v140</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|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)'=='Debug|x64'"> | ||
<LinkIncremental>true</LinkIncremental> | ||
<OutDir>$(SolutionDir)bin\$(Configuration)\</OutDir> | ||
<IntDir>$(SolutionDir)temp\$(Platform)\$(Configuration)\</IntDir> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | ||
<LinkIncremental>false</LinkIncremental> | ||
<OutDir>$(SolutionDir)bin\$(Configuration)\</OutDir> | ||
<IntDir>$(SolutionDir)temp\$(Platform)\$(Configuration)\</IntDir> | ||
</PropertyGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | ||
<ClCompile> | ||
<PrecompiledHeader> | ||
</PrecompiledHeader> | ||
<WarningLevel>Level3</WarningLevel> | ||
<Optimization>Disabled</Optimization> | ||
<PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;AUTOOCULUSTOUCH_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
<SDLCheck>true</SDLCheck> | ||
<AdditionalIncludeDirectories>D:\sdk\OculusSDK_1_10_1\LibOVR\Include</AdditionalIncludeDirectories> | ||
</ClCompile> | ||
<Link> | ||
<SubSystem>Windows</SubSystem> | ||
<GenerateDebugInformation>true</GenerateDebugInformation> | ||
<AdditionalLibraryDirectories>D:\sdk\OculusSDK_1_10_1\LibOVR\Lib\Windows\x64\Release\VS2015;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> | ||
</Link> | ||
</ItemDefinitionGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | ||
<ClCompile> | ||
<WarningLevel>Level3</WarningLevel> | ||
<PrecompiledHeader> | ||
</PrecompiledHeader> | ||
<Optimization>MaxSpeed</Optimization> | ||
<FunctionLevelLinking>true</FunctionLevelLinking> | ||
<IntrinsicFunctions>true</IntrinsicFunctions> | ||
<PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;AUTOOCULUSTOUCH_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
<SDLCheck>true</SDLCheck> | ||
<AdditionalIncludeDirectories>D:\sdk\OculusSDK_1_10_1\LibOVR\Include</AdditionalIncludeDirectories> | ||
</ClCompile> | ||
<Link> | ||
<SubSystem>Windows</SubSystem> | ||
<EnableCOMDATFolding>true</EnableCOMDATFolding> | ||
<OptimizeReferences>true</OptimizeReferences> | ||
<GenerateDebugInformation>true</GenerateDebugInformation> | ||
<AdditionalLibraryDirectories>D:\sdk\OculusSDK_1_10_1\LibOVR\Lib\Windows\x64\Release\VS2015;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> | ||
</Link> | ||
</ItemDefinitionGroup> | ||
<ItemGroup> | ||
<ClInclude Include="stdafx.h" /> | ||
<ClInclude Include="targetver.h" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ClCompile Include="dllmain.cpp"> | ||
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</CompileAsManaged> | ||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | ||
</PrecompiledHeader> | ||
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</CompileAsManaged> | ||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | ||
</PrecompiledHeader> | ||
</ClCompile> | ||
<ClCompile Include="stdafx.cpp" /> | ||
</ItemGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | ||
<ImportGroup Label="ExtensionTargets"> | ||
</ImportGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<ItemGroup> | ||
<Filter Include="Source Files"> | ||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> | ||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> | ||
</Filter> | ||
<Filter Include="Header Files"> | ||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> | ||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions> | ||
</Filter> | ||
<Filter Include="Resource Files"> | ||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> | ||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> | ||
</Filter> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ClInclude Include="stdafx.h"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="targetver.h"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ClCompile Include="stdafx.cpp"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
<ClCompile Include="dllmain.cpp"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
/////////////////////////////////////////////////////////////////////////////// | ||
// AutoTouch - Helper library to provide AutoHotKey with Oculus Touch state. | ||
// Copyright (C) 2017 Kojack (rajetic@gmail.com) | ||
// | ||
// AutoTouch is released under the MIT License | ||
// https://opensource.org/licenses/MIT | ||
/////////////////////////////////////////////////////////////////////////////// | ||
|
||
#include "stdafx.h" | ||
#include "OVR_CAPI.h" | ||
|
||
ovrSession g_HMD = 0; | ||
ovrInputState g_touchStateLast; | ||
ovrInputState g_touchState; | ||
|
||
#pragma comment(lib,"LibOVR") | ||
|
||
extern "C" | ||
{ | ||
__declspec(dllexport) int initOculus() | ||
{ | ||
memset(&g_touchState, 0, sizeof(ovrInputState)); | ||
memset(&g_touchStateLast, 0, sizeof(ovrInputState)); | ||
|
||
ovrGraphicsLuid g_luid; | ||
ovrInitParams params; | ||
params.Flags = 0; | ||
params.ConnectionTimeoutMS = 0; | ||
params.RequestedMinorVersion = 8; | ||
params.UserData = 0; | ||
params.LogCallback = 0; | ||
|
||
ovrResult result = ovr_Initialize(¶ms); | ||
if (OVR_FAILURE(result)) | ||
return 0; | ||
|
||
result = ovr_Create(&g_HMD, &g_luid); | ||
return g_HMD ? 1 : 0; | ||
} | ||
|
||
__declspec(dllexport) void poll() | ||
{ | ||
if (g_HMD) | ||
{ | ||
g_touchStateLast = g_touchState; | ||
ovr_GetInputState(g_HMD, ovrControllerType_Active , &g_touchState); | ||
} | ||
} | ||
|
||
__declspec(dllexport) float getTrigger(int controller, int trigger) | ||
{ | ||
if (g_HMD) | ||
{ | ||
if(trigger>=0 && trigger<2 && controller>=0 && controller<2) | ||
switch (trigger) | ||
{ | ||
case 0: | ||
return g_touchState.IndexTrigger[controller]; | ||
case 1: | ||
return g_touchState.HandTrigger[controller]; | ||
} | ||
} | ||
return 0.0f; | ||
} | ||
|
||
__declspec(dllexport) float getThumbStick(int controller, int axis) | ||
{ | ||
if (g_HMD) | ||
{ | ||
if (axis >= 0 && axis<2 && controller >= 0 && controller<2) | ||
switch (axis) | ||
{ | ||
case 0: | ||
return g_touchState.Thumbstick[controller].x; | ||
case 1: | ||
return g_touchState.Thumbstick[controller].y; | ||
} | ||
} | ||
return 0; | ||
} | ||
|
||
__declspec(dllexport) float getButtonsDown() | ||
{ | ||
if (g_HMD) | ||
{ | ||
return g_touchState.Buttons; | ||
} | ||
return 0; | ||
} | ||
|
||
__declspec(dllexport) float getButtonsPressed() | ||
{ | ||
if (g_HMD) | ||
{ | ||
return g_touchState.Buttons & ~g_touchStateLast.Buttons; | ||
} | ||
return 0; | ||
} | ||
|
||
__declspec(dllexport) float getButtonsReleased() | ||
{ | ||
if (g_HMD) | ||
{ | ||
return ~g_touchState.Buttons & g_touchStateLast.Buttons; | ||
} | ||
return 0; | ||
} | ||
|
||
|
||
} | ||
|
||
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) | ||
{ | ||
switch (ul_reason_for_call) | ||
{ | ||
case DLL_PROCESS_ATTACH: | ||
{ | ||
break; | ||
} | ||
case DLL_THREAD_ATTACH: | ||
break; | ||
case DLL_THREAD_DETACH: | ||
break; | ||
case DLL_PROCESS_DETACH: | ||
if (g_HMD) | ||
{ | ||
ovr_Destroy(g_HMD); | ||
} | ||
ovr_Shutdown(); | ||
break; | ||
} | ||
return TRUE; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// stdafx.cpp : source file that includes just the standard includes | ||
// autotouch.pch will be the pre-compiled header | ||
// stdafx.obj will contain the pre-compiled type information | ||
|
||
#include "stdafx.h" | ||
|
||
// TODO: reference any additional headers you need in STDAFX.H | ||
// and not in this file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// stdafx.h : include file for standard system include files, | ||
// or project specific include files that are used frequently, but | ||
// are changed infrequently | ||
// | ||
|
||
#pragma once | ||
|
||
#include "targetver.h" | ||
|
||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers | ||
// Windows Header Files: | ||
#include <windows.h> | ||
|
||
|
||
|
||
// TODO: reference additional headers your program requires here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#pragma once | ||
|
||
// Including SDKDDKVer.h defines the highest available Windows platform. | ||
|
||
// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and | ||
// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. | ||
|
||
#include <SDKDDKVer.h> |
Oops, something went wrong.