public static void Init(CefSettings settings = null) { Overlays = new List <WebKitOverlay>(); if (settings == null) { settings = new CefSettings(); } AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit; gw = new GameWindow(300, 30); // Invisible GL Context GL.Enable(EnableCap.Texture2D); Cef.Initialize(settings); InitOpenVR(); _system = OpenVR.System; _compositor = OpenVR.Compositor; _overlay = OpenVR.Overlay; _applications = OpenVR.Applications; _controllerManager = new SteamVR_ControllerManager(); Console.WriteLine("SteamVR_WebKit Initialised"); _initialised = true; }
public static void Init(CefSettings settings = null) { Overlays = new List <WebKitOverlay>(); if (settings == null) { settings = new CefSettings(); } gw = new GameWindow(300, 30); // Invisible GL Context GL.Enable(EnableCap.Texture2D); if (Cef.IsInitialized) { Cef.Shutdown(); } Cef.Initialize(settings, performDependencyCheck: true, browserProcessHandler: null); bool tryAgain = true; while (tryAgain && !_doStop) { try { InitOpenVR(); tryAgain = false; } catch (Exception e) { Log(e.Message); Log("Trying again in 3 seconds"); Thread.Sleep(3000); } } if (_doStop) { CefShutdown(); return; } _system = OpenVR.System; _compositor = OpenVR.Compositor; _overlay = OpenVR.Overlay; _applications = OpenVR.Applications; _controllerManager = new SteamVR_ControllerManager(); SteamVR_WebKit.Log("SteamVR_WebKit Initialised"); _initialised = true; }
private RunningGameInfo GetRunningGames() { RunningGameInfo runningGameInfo = new RunningGameInfo(); List <AppInfo> lAppInfo = new List <AppInfo>(); CVRApplications app = OpenVR.Applications; StringBuilder sbAppkey = new System.Text.StringBuilder((int)OpenVR.k_unMaxApplicationKeyLength); StringBuilder sbLaunchType = new System.Text.StringBuilder((Int32)OpenVR.k_unMaxPropertyStringSize); StringBuilder sbBinaryPath = new System.Text.StringBuilder((int)OpenVR.k_unMaxApplicationKeyLength); uint appCount = app.GetApplicationCount(); for (uint i = 0; i < appCount; i++) { sbAppkey.Length = 0; sbAppkey.Capacity = 0; sbLaunchType.Length = 0; sbLaunchType.Capacity = 0; sbAppkey = new StringBuilder((int)OpenVR.k_unMaxApplicationKeyLength); sbLaunchType = new StringBuilder((Int32)OpenVR.k_unMaxPropertyStringSize); sbBinaryPath = new System.Text.StringBuilder((int)OpenVR.k_unMaxApplicationKeyLength); EVRApplicationError err = app.GetApplicationKeyByIndex(i, sbAppkey, OpenVR.k_unMaxApplicationKeyLength); string appkey = sbAppkey.ToString(); uint procId = app.GetApplicationProcessId(appkey); app.GetApplicationPropertyString(appkey, EVRApplicationProperty.LaunchType_String, sbLaunchType, OpenVR.k_unMaxPropertyStringSize, ref err); app.GetApplicationPropertyString(appkey, EVRApplicationProperty.BinaryPath_String, sbBinaryPath, OpenVR.k_unMaxPropertyStringSize, ref err); bool isDashboard = app.GetApplicationPropertyBool(appkey, EVRApplicationProperty.IsDashboardOverlay_Bool, ref err); string selfName = Process.GetCurrentProcess().MainModule.FileName; if (sbLaunchType.ToString() == "binary" && !isDashboard && procId > 0 && sbBinaryPath.ToString() != selfName) { //fileN = Process.GetProcessById((int)procId).MainModule.FileName; //Debug.Log(appkey + "|||" + procId + "|||" + sbBinaryPath.ToString() + "|||" + fileN); AppInfo appInfo = new AppInfo((int)procId, sbBinaryPath.ToString()); lAppInfo.Add(appInfo); } } runningGameInfo.RunningGames = lAppInfo; return(runningGameInfo); }
public void Startup() { CVRApplications app = svrh.ovrHandler.Applications; string manifestPath = Application.dataPath + "/../" + manifestFile; app.RemoveApplicationManifest(manifestPath); app.RemoveApplicationManifest(Application.persistentDataPath + "/" + manifestFile); bool manifestExists = File.Exists(manifestPath); if (!manifestExists) { JSONNode json = new JSONObject(); json["source"] = "builtin"; JSONNode application = new JSONObject(); application["app_key"] = "steam.overlay." + appKey; application["launch_type"] = "binary"; application["binary_path_windows"] = "DiscordVROverlay.exe"; application["is_dashboard_overlay"] = false; application["strings"]["en_us"]["name"] = "Discord VR Overlay"; application["strings"]["en_us"]["description"] = "Overlays Discord voice chat into SteamVR"; json["applications"][0] = application; StreamWriter file = File.CreateText(manifestPath); file.Write(json.ToString(4)); file.Close(); } bool installed = app.IsApplicationInstalled("steam.overlay." + appKey); Debug.Log("App installed state is " + installed + "."); if (!installed) { EVRApplicationError evrae; Debug.Log("Adding manifest."); evrae = app.AddApplicationManifest(manifestPath, false); Debug.Log("Manifest file added with " + evrae); evrae = app.SetApplicationAutoLaunch("steam.overlay." + appKey, true); Debug.Log("Aplication auto launched with " + evrae); } }
// Token: 0x06005F2C RID: 24364 RVA: 0x00215578 File Offset: 0x00213978 private IEnumerator LoadLevel() { if (this.loadingScreen != null && this.loadingScreenDistance > 0f) { SteamVR_Controller.Device hmd = SteamVR_Controller.Input(0); while (!hmd.hasTracking) { yield return(null); } SteamVR_Utils.RigidTransform tloading = hmd.transform; tloading.rot = Quaternion.Euler(0f, tloading.rot.eulerAngles.y, 0f); tloading.pos += tloading.rot * new Vector3(0f, 0f, this.loadingScreenDistance); Transform t = (!(this.loadingScreenTransform != null)) ? base.transform : this.loadingScreenTransform; t.position = tloading.pos; t.rotation = tloading.rot; } SteamVR_LoadLevel._active = this; SteamVR_Events.Loading.Send(true); if (this.loadingScreenFadeInTime > 0f) { this.fadeRate = 1f / this.loadingScreenFadeInTime; } else { this.alpha = 1f; } CVROverlay overlay = OpenVR.Overlay; if (this.loadingScreen != null && overlay != null) { this.loadingScreenOverlayHandle = this.GetOverlayHandle("loadingScreen", (!(this.loadingScreenTransform != null)) ? base.transform : this.loadingScreenTransform, this.loadingScreenWidthInMeters); if (this.loadingScreenOverlayHandle != 0UL) { Texture_t texture_t = default(Texture_t); texture_t.handle = this.loadingScreen.GetNativeTexturePtr(); texture_t.eType = SteamVR.instance.textureType; texture_t.eColorSpace = EColorSpace.Auto; overlay.SetOverlayTexture(this.loadingScreenOverlayHandle, ref texture_t); } } bool fadedForeground = false; SteamVR_Events.LoadingFadeOut.Send(this.fadeOutTime); CVRCompositor compositor = OpenVR.Compositor; if (compositor != null) { if (this.front != null) { SteamVR_Skybox.SetOverride(this.front, this.back, this.left, this.right, this.top, this.bottom); compositor.FadeGrid(this.fadeOutTime, true); yield return(new WaitForSeconds(this.fadeOutTime)); } else if (this.backgroundColor != Color.clear) { if (this.showGrid) { compositor.FadeToColor(0f, this.backgroundColor.r, this.backgroundColor.g, this.backgroundColor.b, this.backgroundColor.a, true); compositor.FadeGrid(this.fadeOutTime, true); yield return(new WaitForSeconds(this.fadeOutTime)); } else { compositor.FadeToColor(this.fadeOutTime, this.backgroundColor.r, this.backgroundColor.g, this.backgroundColor.b, this.backgroundColor.a, false); yield return(new WaitForSeconds(this.fadeOutTime + 0.1f)); compositor.FadeGrid(0f, true); fadedForeground = true; } } } SteamVR_Render.pauseRendering = true; while (this.alpha < 1f) { yield return(null); } base.transform.parent = null; UnityEngine.Object.DontDestroyOnLoad(base.gameObject); if (!string.IsNullOrEmpty(this.internalProcessPath)) { UnityEngine.Debug.Log("Launching external application..."); CVRApplications applications = OpenVR.Applications; if (applications == null) { UnityEngine.Debug.Log("Failed to get OpenVR.Applications interface!"); } else { string currentDirectory = Directory.GetCurrentDirectory(); string text = Path.Combine(currentDirectory, this.internalProcessPath); UnityEngine.Debug.Log("LaunchingInternalProcess"); UnityEngine.Debug.Log("ExternalAppPath = " + this.internalProcessPath); UnityEngine.Debug.Log("FullPath = " + text); UnityEngine.Debug.Log("ExternalAppArgs = " + this.internalProcessArgs); UnityEngine.Debug.Log("WorkingDirectory = " + currentDirectory); EVRApplicationError evrapplicationError = applications.LaunchInternalProcess(text, this.internalProcessArgs, currentDirectory); UnityEngine.Debug.Log("LaunchInternalProcessError: " + evrapplicationError); Process.GetCurrentProcess().Kill(); } } else { LoadSceneMode mode = (!this.loadAdditive) ? LoadSceneMode.Single : LoadSceneMode.Additive; if (this.loadAsync) { Application.backgroundLoadingPriority = ThreadPriority.Low; this.async = SceneManager.LoadSceneAsync(this.levelName, mode); while (!this.async.isDone) { yield return(null); } } else { SceneManager.LoadScene(this.levelName, mode); } } yield return(null); GC.Collect(); yield return(null); Shader.WarmupAllShaders(); yield return(new WaitForSeconds(this.postLoadSettleTime)); SteamVR_Render.pauseRendering = false; if (this.loadingScreenFadeOutTime > 0f) { this.fadeRate = -1f / this.loadingScreenFadeOutTime; } else { this.alpha = 0f; } SteamVR_Events.LoadingFadeIn.Send(this.fadeInTime); if (compositor != null) { if (fadedForeground) { compositor.FadeGrid(0f, false); compositor.FadeToColor(this.fadeInTime, 0f, 0f, 0f, 0f, false); yield return(new WaitForSeconds(this.fadeInTime)); } else { compositor.FadeGrid(this.fadeInTime, false); yield return(new WaitForSeconds(this.fadeInTime)); if (this.front != null) { SteamVR_Skybox.ClearOverride(); } } } while (this.alpha > 0f) { yield return(null); } if (overlay != null) { if (this.progressBarOverlayHandle != 0UL) { overlay.HideOverlay(this.progressBarOverlayHandle); } if (this.loadingScreenOverlayHandle != 0UL) { overlay.HideOverlay(this.loadingScreenOverlayHandle); } } UnityEngine.Object.Destroy(base.gameObject); SteamVR_LoadLevel._active = null; SteamVR_Events.Loading.Send(false); yield break; }
public Applications() { _applicationsInstance = OpenVR.Applications; }