Skip to content

Commit

Permalink
add left handed mode to config
Browse files Browse the repository at this point in the history
  • Loading branch information
sd805 committed Jun 8, 2022
1 parent 10a7c92 commit 15a77e5
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions L4D2VR/config.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
TurnSpeed=0.3
SnapTurning=false
SnapTurnAngle=45.0
LeftHanded=false
VRScale=43.2
IPDScale=1.0
3 changes: 3 additions & 0 deletions L4D2VR/l4d2vr.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp17</LanguageStandard>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand Down Expand Up @@ -363,6 +364,7 @@
<ClInclude Include="..\dxvk\src\dxvk\dxvk_openxr.h" />
<ClInclude Include="..\dxvk\src\dxvk\dxvk_options.h" />
<ClInclude Include="..\dxvk\src\dxvk\dxvk_pipecache.h" />
<ClInclude Include="..\dxvk\src\dxvk\dxvk_pipecompiler.h" />
<ClInclude Include="..\dxvk\src\dxvk\dxvk_pipelayout.h" />
<ClInclude Include="..\dxvk\src\dxvk\dxvk_pipemanager.h" />
<ClInclude Include="..\dxvk\src\dxvk\dxvk_platform_exts.h" />
Expand Down Expand Up @@ -536,6 +538,7 @@
<ClCompile Include="..\dxvk\src\dxvk\dxvk_openxr.cpp" />
<ClCompile Include="..\dxvk\src\dxvk\dxvk_options.cpp" />
<ClCompile Include="..\dxvk\src\dxvk\dxvk_pipecache.cpp" />
<ClCompile Include="..\dxvk\src\dxvk\dxvk_pipecompiler.cpp" />
<ClCompile Include="..\dxvk\src\dxvk\dxvk_pipelayout.cpp" />
<ClCompile Include="..\dxvk\src\dxvk\dxvk_pipemanager.cpp" />
<ClCompile Include="..\dxvk\src\dxvk\dxvk_queue.cpp" />
Expand Down
6 changes: 6 additions & 0 deletions L4D2VR/l4d2vr.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,9 @@
<ClInclude Include="..\dxvk\include\version.h">
<Filter>dxvk</Filter>
</ClInclude>
<ClInclude Include="..\dxvk\src\dxvk\dxvk_pipecompiler.h">
<Filter>dxvk</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="dllmain.cpp">
Expand Down Expand Up @@ -1217,6 +1220,9 @@
<ClCompile Include="..\dxvk\src\vulkan\vulkan_presenter.cpp">
<Filter>dxvk</Filter>
</ClCompile>
<ClCompile Include="..\dxvk\src\dxvk\dxvk_pipecompiler.cpp">
<Filter>dxvk</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="..\dxvk\lib\libd3dcompiler_43.def">
Expand Down
8 changes: 6 additions & 2 deletions L4D2VR/vr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,12 @@ void VR::GetPoses()
vr::TrackedDevicePose_t hmdPose = m_Poses[vr::k_unTrackedDeviceIndex_Hmd];

vr::TrackedDeviceIndex_t leftControllerIndex = m_System->GetTrackedDeviceIndexForControllerRole(vr::TrackedControllerRole_LeftHand);
vr::TrackedDevicePose_t leftControllerPose = m_Poses[leftControllerIndex];

vr::TrackedDeviceIndex_t rightControllerIndex = m_System->GetTrackedDeviceIndexForControllerRole(vr::TrackedControllerRole_RightHand);

if (m_LeftHanded)
std::swap(leftControllerIndex, rightControllerIndex);

vr::TrackedDevicePose_t leftControllerPose = m_Poses[leftControllerIndex];
vr::TrackedDevicePose_t rightControllerPose = m_Poses[rightControllerIndex];

GetPoseData(hmdPose, m_HmdPose);
Expand Down Expand Up @@ -606,6 +609,7 @@ void VR::ParseConfigFile()
m_SnapTurning = userConfig["SnapTurning"] == "true";
m_SnapTurnAngle = std::stof(userConfig["SnapTurnAngle"]);
m_TurnSpeed = std::stof(userConfig["TurnSpeed"]);
m_LeftHanded = userConfig["LeftHanded"] == "true";
m_VRScale = std::stof(userConfig["VRScale"]);
m_IpdScale = std::stof(userConfig["IPDScale"]);
}
Expand Down
1 change: 1 addition & 0 deletions L4D2VR/vr.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ class VR
float m_TurnSpeed = 0.3;
bool m_SnapTurning = false;
float m_SnapTurnAngle = 45.0;
bool m_LeftHanded = false;
float m_VRScale = 43.2;
float m_IpdScale = 1.0;

Expand Down

0 comments on commit 15a77e5

Please sign in to comment.