Skip to content

Commit ab4c372

Browse files
committed
Fixed yet another bug with weird steam paths
1 parent 2fa613a commit ab4c372

1 file changed

Lines changed: 9 additions & 18 deletions

File tree

main.py

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
import json
33
from iobt_options import default_enabled, default_offsets, default_toggles, default_misc, temp_offsets, tooltips_enabled
44
import psutil
5-
import winreg
65
import qdarktheme
6+
import os
77

88

99

@@ -18,31 +18,22 @@ def __init__(self):
1818
dlg2 = QMessageBox()
1919
dlg2.setWindowTitle("Virtual Desktop Body Tracking Configurator")
2020
dlg2.setText("Error!\n\nvrserver.exe running!\n\nPlease close SteamVR and try again")
21-
2221
dlg2.exec()
23-
2422
if QMessageBox.StandardButton.Ok:
2523
exit()
2624

2725
self.steam = ""
2826
try:
29-
location = winreg.HKEY_LOCAL_MACHINE
30-
path = winreg.OpenKeyEx(location, r"SOFTWARE\Wow6432Node\Valve\Steam")
31-
self.steam = winreg.QueryValueEx(path, "InstallPath")[0]
32-
self.steam = self.steam.replace("\\","/")
33-
if path:
34-
winreg.CloseKey(path)
27+
with open(f"{os.getenv('LOCALAPPDATA')}\\openvr\\openvrpaths.vrpath", "r") as file:
28+
self.steam = json.load(file)["config"][0].replace("\\", "/")
3529
except Exception as e:
3630
dlg2 = QMessageBox()
3731
dlg2.setWindowTitle("Virtual Desktop Body Tracking Configurator")
3832
dlg2.setText(f"Error: {e}")
39-
4033
dlg2.exec()
41-
4234
if QMessageBox.StandardButton.Ok:
4335
exit()
44-
45-
36+
4637
self.checkboxes = {}
4738
self.offsets = {}
4839
self.misc = {}
@@ -268,7 +259,7 @@ def elbows_only_clicked(self):
268259

269260
def load_settings_clicked(self):
270261
try:
271-
with open(f"{self.steam}/config/steamvr.vrsettings", "r") as file:
262+
with open(f"{self.steam}/steamvr.vrsettings", "r") as file:
272263
current = json.load(file)["driver_VirtualDesktop"]
273264

274265
for variable in default_enabled:
@@ -379,18 +370,18 @@ def export_clicked(self):
379370
# json.dump(export_dict, indent=2, fp=outfile)
380371

381372
try:
382-
with open(f"{self.steam}/config/steamvr.vrsettings", "r+") as settings:
373+
with open(f"{self.steam}/steamvr.vrsettings", "r+") as settings:
383374

384375
temp = json.load(settings)
385376
try:
386-
with open(f"{self.steam}/config/steamvr.vrsettings.originalbackup", "x") as backup:
377+
with open(f"{self.steam}/steamvr.vrsettings.originalbackup", "x") as backup:
387378
json.dump(temp, fp=backup)
388379
backup.close()
389380
except:
390381
()
391382

392383
try:
393-
with open(f"{self.steam}/config/steamvr.vrsettings.lastbackup", "w") as backup:
384+
with open(f"{self.steam}/steamvr.vrsettings.lastbackup", "w") as backup:
394385
json.dump(temp, fp=backup)
395386
backup.close()
396387
except:
@@ -405,7 +396,7 @@ def export_clicked(self):
405396

406397
dlg = QMessageBox(self)
407398
dlg.setWindowTitle("Virtual Desktop Body Tracking Configurator")
408-
dlg.setText(f"Successfully exported to SteamVR!\n\nBackup of original is saved at: {self.steam}/config/steamvr.vrsettings.originalbackup\n\nAnd backup of previous settings is saved at: {self.steam}/config/steamvr.vrsettings.lastbackup")
399+
dlg.setText(f"Successfully exported to SteamVR!\n\nBackup of original is saved at: {self.steam}/steamvr.vrsettings.originalbackup\n\nAnd backup of previous settings is saved at: {self.steam}/steamvr.vrsettings.lastbackup")
409400

410401
dlg.exec()
411402

0 commit comments

Comments
 (0)