Skip to content

Commit

Permalink
Initial.
Browse files Browse the repository at this point in the history
  • Loading branch information
mtwomey committed May 28, 2017
0 parents commit a7f06e3
Show file tree
Hide file tree
Showing 8 changed files with 286 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Debug
.vs
28 changes: 28 additions & 0 deletions OrbiterSteamController.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25123.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OrbiterSteamController", "OrbiterSteamController\OrbiterSteamController.vcxproj", "{192604B8-A974-4EB2-9376-098B86724D39}"
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
{192604B8-A974-4EB2-9376-098B86724D39}.Debug|x64.ActiveCfg = Debug|x64
{192604B8-A974-4EB2-9376-098B86724D39}.Debug|x64.Build.0 = Debug|x64
{192604B8-A974-4EB2-9376-098B86724D39}.Debug|x86.ActiveCfg = Debug|Win32
{192604B8-A974-4EB2-9376-098B86724D39}.Debug|x86.Build.0 = Debug|Win32
{192604B8-A974-4EB2-9376-098B86724D39}.Release|x64.ActiveCfg = Release|x64
{192604B8-A974-4EB2-9376-098B86724D39}.Release|x64.Build.0 = Release|x64
{192604B8-A974-4EB2-9376-098B86724D39}.Release|x86.ActiveCfg = Release|Win32
{192604B8-A974-4EB2-9376-098B86724D39}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
125 changes: 125 additions & 0 deletions OrbiterSteamController/OrbiterSteamController.vcxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
<?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|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{192604B8-A974-4EB2-9376-098B86724D39}</ProjectGuid>
<RootNamespace>OrbiterSteamController</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>C:\Users\Administrator\Desktop\Orbitersdk\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<AdditionalLibraryDirectories>C:\Users\Administrator\Desktop\Orbitersdk\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>orbiter.lib;Orbitersdk.lib;Xinput9_1_0.lib;%(AdditionalDependencies)</AdditionalDependencies>
<IgnoreSpecificDefaultLibraries>msvcirt.lib;msvcrt.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="main.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
22 changes: 22 additions & 0 deletions OrbiterSteamController/OrbiterSteamController.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>
4 changes: 4 additions & 0 deletions OrbiterSteamController/OrbiterSteamController.vcxproj.user
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>
9 changes: 9 additions & 0 deletions OrbiterSteamController/XinputController.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include "XinputController.h"

XinputController::XinputController(int controllerNumber)
{
}

XinputController::~XinputController()
{
}
14 changes: 14 additions & 0 deletions OrbiterSteamController/XinputController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#pragma once
#include <xinput.h>

class XinputController
{

//XINPUT_STATE state;
public:
XinputController(int controllerNumber);
~XinputController();


};

82 changes: 82 additions & 0 deletions OrbiterSteamController/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
#define STRICT
#define ORBITER_MODULE

#include <Orbitersdk.h>
#include <xinput.h>

int getFirstConnectedController();
int getLX(int controller);

int firstConnectedController = -1;
XINPUT_STATE state;

DLLCLBK void InitModule(HINSTANCE hModule) {
firstConnectedController = getFirstConnectedController();
}

DLLCLBK void opcPreStep(double simt, double simdt, double mjd)
{
/*sprintf(oapiDebugString(), "%.2f", oapiGetSimTime());*/
//firstConnectedController = getFirstConnectedController();
sprintf(oapiDebugString(), "First Controller: %d", getLX(firstConnectedController));

VESSEL* vessel = oapiGetFocusInterface();
//vessel->SetADCtrlMode(DWORD(0));

vessel->SetControlSurfaceLevel(AIRCTRL_ELEVATOR, -1, false);
}

int getFirstConnectedController() {
int controllerId = -1;

for (DWORD i = 0; i < XUSER_MAX_COUNT && controllerId == -1; i++)
{

ZeroMemory(&state, sizeof(XINPUT_STATE));

if (XInputGetState(i, &state) == ERROR_SUCCESS)
controllerId = i;
}
return controllerId;
}

/*XINPUT_STATE updateControllerInputState() {
ZeroMemory(&state, sizeof(XINPUT_STATE));
XInputGetState(firstConnectedController, &state);
}*/

int getLX(int controller) {
if (controller > -1) {
ZeroMemory(&state, sizeof(XINPUT_STATE));
XInputGetState(controller, &state);
return state.Gamepad.sThumbLX;
}
else {
return -1;
}
}
int getLY(int controller) {
if (controller > -1) {
ZeroMemory(&state, sizeof(XINPUT_STATE));
XInputGetState(controller, &state);
return state.Gamepad.sThumbLY;
}
else {
return -1;
}
}


/*
int getLX() {
int controller = getFirstConnectedController();
if (controller > -1) {
XINPUT_STATE state;
ZeroMemory(&state, sizeof(XINPUT_STATE));
XInputGetState(controller, &state);
return state.Gamepad.sThumbLX;
} else {
return -1;
}
}
*/

0 comments on commit a7f06e3

Please sign in to comment.