Beispiel #1
0
        private void InitUI()
        {
            apply = false;

            //Init any of the UI values, don't notify if possible

            useLegacyCapture.toggle.SetValueWithoutNotify(!DPSettings.config.useDDA, true);

            autoFocusGame.toggle.SetValueWithoutNotify(DPSettings.config.focusGameWhenNotInteracting, true);

            EVRSettingsError error = new EVRSettingsError();
            bool             globalOverlayInput = OpenVR.Settings.GetBool(OpenVR.k_pch_SteamVR_Section, OpenVR.k_pch_SteamVR_AllowGlobalActionSetPriority, ref error);

            blockInput.toggle.SetValueWithoutNotify(globalOverlayInput, true);

            dimGame.slider.value = Mathf.RoundToInt(Maths.Linear(DPSettings.config.dimGameAmount, 0, 1, dimGame.min, dimGame.max));


            lockWatch.toggle.SetValue(DPSettings.config.lockWatch, true);

            minimizeStartup.toggle.SetValueWithoutNotify(DPSettings.config.minimizeAtStartup, true);


            apply = true;
        }
Beispiel #2
0
        private void Awake()
        {
            WebCamDevice[] avaliableWebCams = WebCamTexture.devices;
            webcamTexture  = new WebCamTexture();
            hasDualCameras = false;
            webcamName     = "";

            foreach (var _ in avaliableWebCams.Where(webcam => dualcameraDevices.Contains(webcam.name)).Select(webcam => new { }))
            {
                hasDualCameras = true;
            }

            if (XRSettings.loadedDeviceName == "OpenVR")
            {
                SteamVR_TrackedCamera.VideoStreamTexture camSource = SteamVR_TrackedCamera.Source(false);
                bool             openvrHasCamera = camSource.hasCamera;
                EVRSettingsError error           = EVRSettingsError.None;
                bool             cameraIsEnabled = OpenVR.Settings.GetBool(OpenVR.k_pch_Camera_Section, OpenVR.k_pch_Camera_EnableCamera_Bool, ref error);
                if (Settings.instance.SelectedWebcam == "Auto" && cameraIsEnabled && openvrHasCamera)
                {
                    Settings.instance.SelectedWebcam = "SteamVR";
                    if (Settings.instance.ProjectionScale < 32)
                    {
                        new CameraOffsetMenu().SetPreset("OpenVR Projection");
                    }
                }
            }
        }
        private void SetupWebcamList()
        {
            if (!_WebcamList.Contains("None"))
            {
                bool hmdHasCamera = false;
                OpenVR.TrackedCamera.HasCamera(OpenVR.k_unTrackedDeviceIndex_Hmd, ref hmdHasCamera);
                Sprite autoicon = UIUtilities.LoadSpriteFromResources("ARCompanion.Resources.Icons.auto.png");

                CustomListTableData.CustomCellInfo defaultcamCellInfo = new CustomListTableData.CustomCellInfo("None", "No camera");
                CustomListTableData.CustomCellInfo autocamCellInfo    = new CustomListTableData.CustomCellInfo("Auto", "Automatically find any headset cameras.", autoicon);

                webcamList.data.Add(defaultcamCellInfo);
                webcamList.data.Add(autocamCellInfo);
                _WebcamList.Add("None");
                _WebcamList.Add("Auto");

                EVRSettingsError error           = EVRSettingsError.None;
                bool             cameraIsEnabled = OpenVR.Settings.GetBool(OpenVR.k_pch_Camera_Section, OpenVR.k_pch_Camera_EnableCamera_Bool, ref error);
                if (error != EVRSettingsError.None)
                {
                    Logger.Log("Error getting OpenVR camera settings: " + error, IPA.Logging.Logger.Level.Error);
                }
                else if (hmdHasCamera && cameraIsEnabled)
                {
                    Sprite openvricon = UIUtilities.LoadSpriteFromResources("ARCompanion.Resources.Icons.openvr.png");
                    CustomListTableData.CustomCellInfo openvrcamCellInfo = new CustomListTableData.CustomCellInfo("SteamVR", "Use SteamVR's camera system. (Recommended)", openvricon);
                    webcamList.data.Add(openvrcamCellInfo);
                    _WebcamList.Add("SteamVR");
                }
            }
            RefreshWebcamList();
        }
Beispiel #4
0
        public void SetGamma(ColorConfiguration configuration)
        {
            if (!IsGammaStale() && !IsSignificantChange(configuration))
            {
                return;
            }

            if (VRSettings == null)
            {
                Debug.LogError("VR Settings is not initialized. Make sure a compatible VR headet is plugged in.");
                return;
            }

            //EnsureValidDeviceContext();

            EVRSettingsError vrSettingsError = EVRSettingsError.None;

            Color color = GetColor(configuration);

            VRSettings.SetFloat(OpenVR.k_pch_SteamVR_Section, k_pch_SteamVR_HmdDisplayColorGainR_Float, color.r, ref vrSettingsError);
            VRSettings.SetFloat(OpenVR.k_pch_SteamVR_Section, k_pch_SteamVR_HmdDisplayColorGainG_Float, color.g, ref vrSettingsError);
            VRSettings.SetFloat(OpenVR.k_pch_SteamVR_Section, k_pch_SteamVR_HmdDisplayColorGainB_Float, color.b, ref vrSettingsError);

            if (vrSettingsError != EVRSettingsError.None)
            {
                Debug.LogError("SetFloat Error [HmdDisplayColorGain]: " + vrSettingsError.ToString());
            }

            _isGammaValid        = true;
            _lastConfiguration   = configuration;
            _lastUpdateTimestamp = DateTimeOffset.Now;
            //Debug.Log($"Updated gamma to {configuration}.");
        }
        public static void ShowBindingsForEditor()
        {
            bool temporarySession = InitializeTemporarySession(false);


            EVRSettingsError bindingFlagError = EVRSettingsError.None;

            OpenVR.Settings.SetBool(OpenVR.k_pch_SteamVR_Section, OpenVR.k_pch_SteamVR_DebugInputBinding, true, ref bindingFlagError);

            if (bindingFlagError != EVRSettingsError.None)
            {
                Debug.LogError("<b>[SteamVR]</b> Error turning on the debug input binding flag in steamvr: " + bindingFlagError.ToString());
            }

            if (Application.isPlaying == false)
            {
                IdentifyEditorApplication();

                SteamVR_Input.IdentifyActionsFile();
            }

            OpenVR.Input.OpenBindingUI(SteamVR_Settings.instance.editorAppKey, 0, 0, true);

            if (temporarySession)
            {
                ExitTemporarySession();
            }
        }
Beispiel #6
0
    EVRSettingsError SetTronMode(bool enable)
    {
        EVRSettingsError e = EVRSettingsError.None;

        OpenVR.Settings.SetBool(OpenVR.k_pch_Camera_Section,
                                OpenVR.k_pch_Camera_EnableCameraForCollisionBounds_Bool,
                                enable,
                                ref e);
        OpenVR.Settings.Sync(true, ref e);
        return(e);
    }
Beispiel #7
0
        private void BlockInputToggleCallback()
        {
            EVRSettingsError error = new EVRSettingsError();
            bool             globalOverlayInput = OpenVR.Settings.GetBool(OpenVR.k_pch_SteamVR_Section, OpenVR.k_pch_SteamVR_AllowGlobalActionSetPriority, ref error);

            OpenVR.Settings.SetBool(OpenVR.k_pch_SteamVR_Section, OpenVR.k_pch_SteamVR_AllowGlobalActionSetPriority, !globalOverlayInput, ref error);
            if (error != EVRSettingsError.None)
            {
                Debug.LogError("Error setting GlobalActionSetPriority! " + error.ToString());
            }

            DPRestartManager.Restart();
        }
Beispiel #8
0
    EVRSettingsError SetTronMode(bool enable)
    {
        EVRSettingsError e = EVRSettingsError.None;

        OpenVR.Settings.SetBool(OpenVR.k_pch_Camera_Section,
                                OpenVR.k_pch_Camera_EnableCameraForCollisionBounds_Bool,
                                enable, ref e);
        OpenVR.Settings.Sync(true, ref e);
        if (e == EVRSettingsError.None)
        {
            Debug.LogError("error settingn tron mode");
        }
        return(e);
    }
        /*
         * //今まで一度もトラッキングされたことがないかどうかをチェックする(True=全く位置情報がない, False=過去一度でも位置情報がある)
         * public bool GetNeverTracked(uint deviceIndex)
         * {
         *  if (openVR == null)
         *  {
         *      return true;
         *  }
         *
         *  var error = default(ETrackedPropertyError);
         *  //Prop_NeverTracked_Bool取得
         *  bool NeverTracked = openVR.GetBoolTrackedDeviceProperty(deviceIndex, ETrackedDeviceProperty.Prop_NeverTracked_Bool, ref error);
         *  if (error != ETrackedPropertyError.TrackedProp_Success) return true;
         *  return NeverTracked;
         * }
         */

        public bool GetIsSafeMode()
        {
            if (openVR == null)
            {
                return(false);
            }

            CVRSettings      cVRSettings      = OpenVR.Settings;
            EVRSettingsError eVRSettingsError = EVRSettingsError.None;
            bool             en = cVRSettings.GetBool(OpenVR.k_pch_SteamVR_Section, OpenVR.k_pch_SteamVR_EnableSafeMode, ref eVRSettingsError);

            if (eVRSettingsError != EVRSettingsError.None)
            {
                Debug.LogError("GetIsSafeMode Failed: " + eVRSettingsError.ToString());
                return(false);
            }
            return(en);
        }
Beispiel #10
0
    // Token: 0x06005ED9 RID: 24281 RVA: 0x00213320 File Offset: 0x00211720
    private void OnEnable()
    {
        this.usingSpeakers = false;
        CVRSettings settings = OpenVR.Settings;

        if (settings != null)
        {
            EVRSettingsError evrsettingsError = EVRSettingsError.None;
            if (settings.GetBool("steamvr", "usingSpeakers", ref evrsettingsError))
            {
                this.usingSpeakers = true;
                float @float = settings.GetFloat("steamvr", "speakersForwardYawOffsetDegrees", ref evrsettingsError);
                this.offset = Quaternion.Euler(0f, @float, 0f);
            }
        }
        if (this.usingSpeakers)
        {
            SteamVR_Events.NewPosesApplied.Listen(new UnityAction(this.OnNewPosesApplied));
        }
    }
Beispiel #11
0
    private void OnEnable()
    {
        this.usingSpeakers = false;
        CVRSettings settings = OpenVR.Settings;

        if (settings != null)
        {
            EVRSettingsError eVRSettingsError = EVRSettingsError.None;
            if (settings.GetBool("steamvr", "usingSpeakers", false, ref eVRSettingsError))
            {
                this.usingSpeakers = true;
                float @float = settings.GetFloat("steamvr", "speakersForwardYawOffsetDegrees", 0f, ref eVRSettingsError);
                this.offset = Quaternion.Euler(0f, @float, 0f);
            }
        }
        if (this.usingSpeakers)
        {
            SteamVR_Utils.Event.Listen("new_poses_applied", new SteamVR_Utils.Event.Handler(this.OnNewPosesApplied));
        }
    }
Beispiel #12
0
	public override int GetInt32(string pchSection,string pchSettingsKey,int nDefaultValue,ref EVRSettingsError peError)
	{
		CheckIfUsable();
		int result = VRNativeEntrypoints.VR_IVRSettings_GetInt32(m_pVRSettings,pchSection,pchSettingsKey,nDefaultValue,ref peError);
		return result;
	}
Beispiel #13
0
	public override void Sync(ref EVRSettingsError peError)
	{
		CheckIfUsable();
		VRNativeEntrypoints.VR_IVRSettings_Sync(m_pVRSettings,ref peError);
	}
Beispiel #14
0
        }                                                                                                                      // 0x00000001811DFCE0-0x00000001811DFD10

        public void SetString(string pchSection, string pchSettingsKey, string pchValue, ref EVRSettingsError peError)
        {
        }                                                                                                               // 0x00000001811DFD40-0x00000001811DFD70
Beispiel #15
0
 public bool GetBool(string pchSection, string pchSettingsKey, ref EVRSettingsError peError) => default;         // 0x00000001811DFB20-0x00000001811DFB50
 public int GetInt32(string pchSection, string pchSettingsKey, ref EVRSettingsError peError) => default;         // 0x00000001811DFB80-0x00000001811DFBB0
Beispiel #16
0
 public void SetString(string pchSection, string pchSettingsKey, string pchValue, ref EVRSettingsError peError)
 {
     this.FnTable.SetString(pchSection, pchSettingsKey, pchValue, ref peError);
 }
Beispiel #17
0
	public abstract string GetSettingsErrorNameFromEnum(EVRSettingsError eError);
Beispiel #18
0
	internal static extern int VR_IVRSettings_GetInt32(IntPtr instancePtr, string pchSection, string pchSettingsKey, int nDefaultValue, ref EVRSettingsError peError);
Beispiel #19
0
 // Token: 0x06001FE8 RID: 8168 RVA: 0x0009E30B File Offset: 0x0009C50B
 public void SetFloat(string pchSection, string pchSettingsKey, float flValue, ref EVRSettingsError peError)
 {
     this.FnTable.SetFloat(pchSection, pchSettingsKey, flValue, ref peError);
 }
Beispiel #20
0
 // Token: 0x06001FE7 RID: 8167 RVA: 0x0009E2F4 File Offset: 0x0009C4F4
 public void SetInt32(string pchSection, string pchSettingsKey, int nValue, ref EVRSettingsError peError)
 {
     this.FnTable.SetInt32(pchSection, pchSettingsKey, nValue, ref peError);
 }
Beispiel #21
0
 // Token: 0x06001FE6 RID: 8166 RVA: 0x0009E2DD File Offset: 0x0009C4DD
 public void SetBool(string pchSection, string pchSettingsKey, bool bValue, ref EVRSettingsError peError)
 {
     this.FnTable.SetBool(pchSection, pchSettingsKey, bValue, ref peError);
 }
Beispiel #22
0
 // Token: 0x06001FE5 RID: 8165 RVA: 0x0009E2C9 File Offset: 0x0009C4C9
 public bool Sync(bool bForce, ref EVRSettingsError peError)
 {
     return(this.FnTable.Sync(bForce, ref peError));
 }
Beispiel #23
0
 // Token: 0x06001FE4 RID: 8164 RVA: 0x0009E2B1 File Offset: 0x0009C4B1
 public string GetSettingsErrorNameFromEnum(EVRSettingsError eError)
 {
     return(Marshal.PtrToStringAnsi(this.FnTable.GetSettingsErrorNameFromEnum(eError)));
 }
Beispiel #24
0
        public string GetSettingsErrorNameFromEnum(EVRSettingsError eError)
        {
            IntPtr ptr = this.FnTable.GetSettingsErrorNameFromEnum(eError);

            return((string)Marshal.PtrToStructure(ptr, typeof(string)));
        }
Beispiel #25
0
        }                                                                                     // 0x00000001811DFC90-0x00000001811DFCB0

        public void RemoveKeyInSection(string pchSection, string pchSettingsKey, ref EVRSettingsError peError)
        {
        }                                                                                                                 // 0x00000001811DFC60-0x00000001811DFC90
Beispiel #26
0
	public override void SetString(string pchSection,string pchSettingsKey,string pchValue,ref EVRSettingsError peError)
	{
		CheckIfUsable();
		VRNativeEntrypoints.VR_IVRSettings_SetString(m_pVRSettings,pchSection,pchSettingsKey,pchValue,ref peError);
	}
Beispiel #27
0
	internal static extern void VR_IVRSettings_Sync(IntPtr instancePtr, ref EVRSettingsError peError);
Beispiel #28
0
 // Token: 0x06001FE9 RID: 8169 RVA: 0x0009E322 File Offset: 0x0009C522
 public void SetString(string pchSection, string pchSettingsKey, string pchValue, ref EVRSettingsError peError)
 {
     this.FnTable.SetString(pchSection, pchSettingsKey, pchValue, ref peError);
 }
Beispiel #29
0
	internal static extern void VR_IVRSettings_GetString(IntPtr instancePtr, string pchSection, string pchSettingsKey, string pchValue, uint unValueLen, string pchDefaultValue, ref EVRSettingsError peError);
Beispiel #30
0
 // Token: 0x06001FEA RID: 8170 RVA: 0x0009E339 File Offset: 0x0009C539
 public bool GetBool(string pchSection, string pchSettingsKey, ref EVRSettingsError peError)
 {
     return(this.FnTable.GetBool(pchSection, pchSettingsKey, ref peError));
 }
Beispiel #31
0
        }                                                                                                                                                 // 0x00000001811DFC30-0x00000001811DFC60

        public void RemoveSection(string pchSection, ref EVRSettingsError peError)
        {
        }                                                                                     // 0x00000001811DFC90-0x00000001811DFCB0
Beispiel #32
0
 // Token: 0x06001FEB RID: 8171 RVA: 0x0009E34E File Offset: 0x0009C54E
 public int GetInt32(string pchSection, string pchSettingsKey, ref EVRSettingsError peError)
 {
     return(this.FnTable.GetInt32(pchSection, pchSettingsKey, ref peError));
 }
Beispiel #33
0
 public bool Sync(bool bForce, ref EVRSettingsError peError)
 {
     return this.FnTable.Sync(bForce, ref peError);
 }
Beispiel #34
0
 // Token: 0x06001FEC RID: 8172 RVA: 0x0009E363 File Offset: 0x0009C563
 public float GetFloat(string pchSection, string pchSettingsKey, ref EVRSettingsError peError)
 {
     return(this.FnTable.GetFloat(pchSection, pchSettingsKey, ref peError));
 }
Beispiel #35
0
        }                                                                                                               // 0x00000001811DFD40-0x00000001811DFD70

        public bool GetBool(string pchSection, string pchSettingsKey, ref EVRSettingsError peError) => default;         // 0x00000001811DFB20-0x00000001811DFB50
Beispiel #36
0
 // Token: 0x06001FED RID: 8173 RVA: 0x0009E378 File Offset: 0x0009C578
 public void GetString(string pchSection, string pchSettingsKey, StringBuilder pchValue, uint unValueLen, ref EVRSettingsError peError)
 {
     this.FnTable.GetString(pchSection, pchSettingsKey, pchValue, unValueLen, ref peError);
 }
Beispiel #37
0
	public override string GetSettingsErrorNameFromEnum(EVRSettingsError eError)
	{
		CheckIfUsable();
		IntPtr result = VRNativeEntrypoints.VR_IVRSettings_GetSettingsErrorNameFromEnum(m_pVRSettings,eError);
		return (string) Marshal.PtrToStructure(result, typeof(string));
	}
Beispiel #38
0
 // Token: 0x06001FEF RID: 8175 RVA: 0x0009E3A5 File Offset: 0x0009C5A5
 public void RemoveKeyInSection(string pchSection, string pchSettingsKey, ref EVRSettingsError peError)
 {
     this.FnTable.RemoveKeyInSection(pchSection, pchSettingsKey, ref peError);
 }
Beispiel #39
0
	public override bool GetBool(string pchSection,string pchSettingsKey,bool bDefaultValue,ref EVRSettingsError peError)
	{
		CheckIfUsable();
		bool result = VRNativeEntrypoints.VR_IVRSettings_GetBool(m_pVRSettings,pchSection,pchSettingsKey,bDefaultValue,ref peError);
		return result;
	}
Beispiel #40
0
 public int GetInt32(string pchSection, string pchSettingsKey, ref EVRSettingsError peError) => default;         // 0x00000001811DFB80-0x00000001811DFBB0
 public float GetFloat(string pchSection, string pchSettingsKey, ref EVRSettingsError peError) => default;       // 0x00000001811DFB50-0x00000001811DFB80
Beispiel #41
0
	public override float GetFloat(string pchSection,string pchSettingsKey,float flDefaultValue,ref EVRSettingsError peError)
	{
		CheckIfUsable();
		float result = VRNativeEntrypoints.VR_IVRSettings_GetFloat(m_pVRSettings,pchSection,pchSettingsKey,flDefaultValue,ref peError);
		return result;
	}
Beispiel #42
0
	public abstract bool GetBool(string pchSection,string pchSettingsKey,bool bDefaultValue,ref EVRSettingsError peError);
Beispiel #43
0
	internal static extern IntPtr VR_IVRSettings_GetSettingsErrorNameFromEnum(IntPtr instancePtr, EVRSettingsError eError);
Beispiel #44
0
	public abstract int GetInt32(string pchSection,string pchSettingsKey,int nDefaultValue,ref EVRSettingsError peError);
Beispiel #45
0
	internal static extern bool VR_IVRSettings_GetBool(IntPtr instancePtr, string pchSection, string pchSettingsKey, bool bDefaultValue, ref EVRSettingsError peError);
Beispiel #46
0
	public abstract float GetFloat(string pchSection,string pchSettingsKey,float flDefaultValue,ref EVRSettingsError peError);
Beispiel #47
0
	internal static extern float VR_IVRSettings_GetFloat(IntPtr instancePtr, string pchSection, string pchSettingsKey, float flDefaultValue, ref EVRSettingsError peError);
Beispiel #48
0
	public abstract void GetString(string pchSection,string pchSettingsKey,string pchValue,uint unValueLen,string pchDefaultValue,ref EVRSettingsError peError);
Beispiel #49
0
	internal static extern void VR_IVRSettings_SetString(IntPtr instancePtr, string pchSection, string pchSettingsKey, string pchValue, ref EVRSettingsError peError);
Beispiel #50
0
 public void SetInt32(string pchSection, string pchSettingsKey, int nValue, ref EVRSettingsError peError)
 {
     this.FnTable.SetInt32(pchSection, pchSettingsKey, nValue, ref peError);
 }
Beispiel #51
0
	public abstract void Sync(ref EVRSettingsError peError);
Beispiel #52
0
        public float GetFloat(string pchSection, string pchSettingsKey, ref EVRSettingsError peError) => default;       // 0x00000001811DFB50-0x00000001811DFB80

        public void GetString(string pchSection, string pchSettingsKey, StringBuilder pchValue, uint unValueLen, ref EVRSettingsError peError)
        {
        }                                                                                                                                                 // 0x00000001811DFC30-0x00000001811DFC60
Beispiel #53
0
	public abstract void SetBool(string pchSection,string pchSettingsKey,bool bValue,ref EVRSettingsError peError);
Beispiel #54
0
 public void GetString(string pchSection, string pchSettingsKey, string pchValue, uint unValueLen, string pchDefaultValue, ref EVRSettingsError peError)
 {
     this.FnTable.GetString(pchSection, pchSettingsKey, pchValue, unValueLen, pchDefaultValue, ref peError);
 }
Beispiel #55
0
	public abstract void SetInt32(string pchSection,string pchSettingsKey,int nValue,ref EVRSettingsError peError);
Beispiel #56
0
 public void RemoveSection(string pchSection, ref EVRSettingsError peError)
 {
     this.FnTable.RemoveSection(pchSection, ref peError);
 }
Beispiel #57
0
	public abstract void SetFloat(string pchSection,string pchSettingsKey,float flValue,ref EVRSettingsError peError);
Beispiel #58
0
 public void SetBool(string pchSection, string pchSettingsKey, bool bValue, ref EVRSettingsError peError)
 {
     this.FnTable.SetBool(pchSection, pchSettingsKey, bValue, ref peError);
 }
Beispiel #59
0
	public abstract void SetString(string pchSection,string pchSettingsKey,string pchValue,ref EVRSettingsError peError);
Beispiel #60
0
 public void SetFloat(string pchSection, string pchSettingsKey, float flValue, ref EVRSettingsError peError)
 {
     this.FnTable.SetFloat(pchSection, pchSettingsKey, flValue, ref peError);
 }