From 058ae48798c022939586f0e29e9be6751c74ebf5 Mon Sep 17 00:00:00 2001 From: misyaguziya Date: Sun, 14 Apr 2024 22:31:03 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B[bugfix]=20Model=20:=20steamVR?= =?UTF-8?q?=E3=81=8C=E8=B5=B7=E5=8B=95=E3=81=97=E3=81=A6=E3=81=84=E3=81=AA?= =?UTF-8?q?=E3=81=84=E5=A0=B4=E5=90=88=E3=81=ABOverlay=E3=81=8C=E5=8B=95?= =?UTF-8?q?=E4=BD=9C=E3=82=92=E3=81=97=E3=81=AA=E3=81=84=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- models/overlay/overlay.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/models/overlay/overlay.py b/models/overlay/overlay.py index c577d31a..1f9f1fdd 100644 --- a/models/overlay/overlay.py +++ b/models/overlay/overlay.py @@ -1,9 +1,16 @@ +import psutil import ctypes import time import asyncio import openvr from PIL import Image +def check_steamvr_running(): + for proc in psutil.process_iter(): + if "vrserver" in proc.name().lower() or "vrcompositor" in proc.name().lower(): + return True + return False + # This code is based on the following source: # [GOpy](https://github.com/MeroFune/GOpy) def mat34Id(): @@ -120,8 +127,9 @@ class Overlay: def init(self): try: - openvr.init(openvr.VRApplication_Overlay) - self.initFlag = True + if check_steamvr_running() is True: + openvr.init(openvr.VRApplication_Overlay) + self.initFlag = True except Exception as e: print("Could not initialise OpenVR")