Skip to content
This repository has been archived by the owner on Aug 9, 2023. It is now read-only.

Improve SteamVR folder detection #21

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 27 additions & 4 deletions k2vr-installer-gui/Tools/InstallerState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace k2vr_installer_gui.Tools
{
public class InstallerState
public class InstallerState
{
public const string fileName = "installerSettings.xml";

Expand Down Expand Up @@ -132,7 +132,7 @@ public void UpdateSteamPaths()
{
steamPath = "";
steamPath = Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Valve\Steam", "InstallPath", "").ToString();
if (steamPath == "")
if (!Directory.Exists(steamPath))
{
MessageBox.Show("Steam installation folder not found!" + Environment.NewLine +
"Are you sure it is installed?" + Environment.NewLine +
Expand All @@ -141,8 +141,29 @@ public void UpdateSteamPaths()
return;
}

steamVrPath = "";
vrPathReg = "";
// If SteamVR is installed, it should be registered as an uninstallable application
steamVrPath = (string) Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 250820", "InstallLocation", "") ?? "";
vrPathReg = Path.Combine(steamVrPath, "bin", "win64", "vrpathreg.exe");

if (!Directory.Exists(steamVrPath))
{
MessageBox.Show("SteamVR installation folder not found!" + Environment.NewLine +
"Are you sure it is installed?" + Environment.NewLine +
"If you are, please join our Discord server for further assistance (link on www.k2vr.tech)");
Application.Current.Shutdown(1);
return;
}

if (!File.Exists(OpenVrPaths.path))
{
MessageBox.Show("OpenVRPaths not found!" + Environment.NewLine +
"Have you launched SteamVR before?" + Environment.NewLine +
"If so, please join our Discord server for further assistance (link on www.k2vr.tech)");
Application.Current.Shutdown(1);
return;
}

/*
try
{
var openVrPaths = OpenVrPaths.Read();
Expand All @@ -165,13 +186,15 @@ public void UpdateSteamPaths()
Application.Current.Shutdown(1);
return;
}

if (vrPathReg == "")
{
MessageBox.Show("VRPathReg not found!" + Environment.NewLine +
"Please join our Discord server for further assistance (link on www.k2vr.tech)");
Application.Current.Shutdown(1);
return;
}
*/

steamVrSettingsPath = Path.Combine(steamPath, "config", "steamvr.vrsettings");
copiedDriverPath = Path.Combine(steamVrPath, "drivers", "KinectToVR");
Expand Down
2 changes: 1 addition & 1 deletion k2vr-installer-gui/Tools/OpenVRFiles/OpenVrPaths.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace k2vr_installer_gui.Tools.OpenVRFiles
{
class OpenVrPaths
{
static string path = Environment.ExpandEnvironmentVariables(Path.Combine("%LocalAppData%", "openvr", "openvrpaths.vrpath"));
public static string path = Environment.ExpandEnvironmentVariables(Path.Combine("%LocalAppData%", "openvr", "openvrpaths.vrpath"));

// Prevent Warning CS0649: Field '...' is never assigned to, and will always have its default value null:
#pragma warning disable 0649
Expand Down
8 changes: 8 additions & 0 deletions k2vr-installer-gui/Uninstall/Uninstaller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,14 @@ public static void DeleteK2EXStartMenuShortcuts()
public static void UnregisterK2EX(string path)
{
string driverPath = path + @"\KinectToVR";
if (!File.Exists(App.state.vrPathReg))
{
MessageBox.Show("SteamVR installation folder not found or corrupt!" + Environment.NewLine +
"Try verifying your SteamVR install's integrity, or reinstalling it." + Environment.NewLine +
"If none of these work, please join our Discord server for further assistance (link on www.k2vr.tech)");
Application.Current.Shutdown(1);
return;
}
Process.Start(App.state.vrPathReg, "removedriver \"" + driverPath + "\"").WaitForExit();

var openVrPaths = OpenVrPaths.Read();
Expand Down
1 change: 0 additions & 1 deletion k2vr-installer-gui/k2vr-installer-gui.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@
<Resource Include="installer-icon.png" />
<Resource Include="Pages\cover.png" />
<Resource Include="installer-icon.ico" />
<Content Include="Resources\Jost-600-Semi.ttf" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
Expand Down