diff --git a/k2vr-installer-gui/Tools/InstallerState.cs b/k2vr-installer-gui/Tools/InstallerState.cs index 51d6b78..73eaea7 100644 --- a/k2vr-installer-gui/Tools/InstallerState.cs +++ b/k2vr-installer-gui/Tools/InstallerState.cs @@ -9,7 +9,7 @@ namespace k2vr_installer_gui.Tools { - public class InstallerState + public class InstallerState { public const string fileName = "installerSettings.xml"; @@ -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 + @@ -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(); @@ -165,6 +186,7 @@ public void UpdateSteamPaths() Application.Current.Shutdown(1); return; } + if (vrPathReg == "") { MessageBox.Show("VRPathReg not found!" + Environment.NewLine + @@ -172,6 +194,7 @@ public void UpdateSteamPaths() Application.Current.Shutdown(1); return; } + */ steamVrSettingsPath = Path.Combine(steamPath, "config", "steamvr.vrsettings"); copiedDriverPath = Path.Combine(steamVrPath, "drivers", "KinectToVR"); diff --git a/k2vr-installer-gui/Tools/OpenVRFiles/OpenVrPaths.cs b/k2vr-installer-gui/Tools/OpenVRFiles/OpenVrPaths.cs index f0c3a64..43020e2 100644 --- a/k2vr-installer-gui/Tools/OpenVRFiles/OpenVrPaths.cs +++ b/k2vr-installer-gui/Tools/OpenVRFiles/OpenVrPaths.cs @@ -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 diff --git a/k2vr-installer-gui/Uninstall/Uninstaller.cs b/k2vr-installer-gui/Uninstall/Uninstaller.cs index eb6704c..9be5c56 100644 --- a/k2vr-installer-gui/Uninstall/Uninstaller.cs +++ b/k2vr-installer-gui/Uninstall/Uninstaller.cs @@ -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(); diff --git a/k2vr-installer-gui/k2vr-installer-gui.csproj b/k2vr-installer-gui/k2vr-installer-gui.csproj index 027165f..91c08c5 100644 --- a/k2vr-installer-gui/k2vr-installer-gui.csproj +++ b/k2vr-installer-gui/k2vr-installer-gui.csproj @@ -245,7 +245,6 @@ -