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;
        }
Exemple #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();
        }
Exemple #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();
            }
        }
    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);
    }
        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();
        }
Exemple #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);
        }
Exemple #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));
        }
    }
Exemple #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));
        }
    }
Exemple #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;
	}
Exemple #13
0
	public override void Sync(ref EVRSettingsError peError)
	{
		CheckIfUsable();
		VRNativeEntrypoints.VR_IVRSettings_Sync(m_pVRSettings,ref peError);
	}
Exemple #14
0
        }                                                                                                                      // 0x00000001811DFCE0-0x00000001811DFD10

        public void SetString(string pchSection, string pchSettingsKey, string pchValue, ref EVRSettingsError peError)
        {
        }                                                                                                               // 0x00000001811DFD40-0x00000001811DFD70
Exemple #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
Exemple #16
0
 public void SetString(string pchSection, string pchSettingsKey, string pchValue, ref EVRSettingsError peError)
 {
     this.FnTable.SetString(pchSection, pchSettingsKey, pchValue, ref peError);
 }
Exemple #17
0
	public abstract string GetSettingsErrorNameFromEnum(EVRSettingsError eError);
Exemple #18
0
	internal static extern int VR_IVRSettings_GetInt32(IntPtr instancePtr, string pchSection, string pchSettingsKey, int nDefaultValue, ref EVRSettingsError peError);
Exemple #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);
 }
Exemple #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);
 }
Exemple #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);
 }
Exemple #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));
 }
Exemple #23
0
 // Token: 0x06001FE4 RID: 8164 RVA: 0x0009E2B1 File Offset: 0x0009C4B1
 public string GetSettingsErrorNameFromEnum(EVRSettingsError eError)
 {
     return(Marshal.PtrToStringAnsi(this.FnTable.GetSettingsErrorNameFromEnum(eError)));
 }
Exemple #24
0
        public string GetSettingsErrorNameFromEnum(EVRSettingsError eError)
        {
            IntPtr ptr = this.FnTable.GetSettingsErrorNameFromEnum(eError);

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

        public void RemoveKeyInSection(string pchSection, string pchSettingsKey, ref EVRSettingsError peError)
        {
        }                                                                                                                 // 0x00000001811DFC60-0x00000001811DFC90
Exemple #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);
	}
Exemple #27
0
	internal static extern void VR_IVRSettings_Sync(IntPtr instancePtr, ref EVRSettingsError peError);
Exemple #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);
 }
Exemple #29
0
	internal static extern void VR_IVRSettings_GetString(IntPtr instancePtr, string pchSection, string pchSettingsKey, string pchValue, uint unValueLen, string pchDefaultValue, ref EVRSettingsError peError);
Exemple #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));
 }
Exemple #31
0
        }                                                                                                                                                 // 0x00000001811DFC30-0x00000001811DFC60

        public void RemoveSection(string pchSection, ref EVRSettingsError peError)
        {
        }                                                                                     // 0x00000001811DFC90-0x00000001811DFCB0
Exemple #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));
 }
Exemple #33
0
 public bool Sync(bool bForce, ref EVRSettingsError peError)
 {
     return this.FnTable.Sync(bForce, ref peError);
 }
Exemple #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));
 }
Exemple #35
0
        }                                                                                                               // 0x00000001811DFD40-0x00000001811DFD70

        public bool GetBool(string pchSection, string pchSettingsKey, ref EVRSettingsError peError) => default;         // 0x00000001811DFB20-0x00000001811DFB50
Exemple #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);
 }
Exemple #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));
	}
Exemple #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);
 }
Exemple #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;
	}
Exemple #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
Exemple #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;
	}
Exemple #42
0
	public abstract bool GetBool(string pchSection,string pchSettingsKey,bool bDefaultValue,ref EVRSettingsError peError);
Exemple #43
0
	internal static extern IntPtr VR_IVRSettings_GetSettingsErrorNameFromEnum(IntPtr instancePtr, EVRSettingsError eError);
Exemple #44
0
	public abstract int GetInt32(string pchSection,string pchSettingsKey,int nDefaultValue,ref EVRSettingsError peError);
Exemple #45
0
	internal static extern bool VR_IVRSettings_GetBool(IntPtr instancePtr, string pchSection, string pchSettingsKey, bool bDefaultValue, ref EVRSettingsError peError);
Exemple #46
0
	public abstract float GetFloat(string pchSection,string pchSettingsKey,float flDefaultValue,ref EVRSettingsError peError);
Exemple #47
0
	internal static extern float VR_IVRSettings_GetFloat(IntPtr instancePtr, string pchSection, string pchSettingsKey, float flDefaultValue, ref EVRSettingsError peError);
Exemple #48
0
	public abstract void GetString(string pchSection,string pchSettingsKey,string pchValue,uint unValueLen,string pchDefaultValue,ref EVRSettingsError peError);
Exemple #49
0
	internal static extern void VR_IVRSettings_SetString(IntPtr instancePtr, string pchSection, string pchSettingsKey, string pchValue, ref EVRSettingsError peError);
Exemple #50
0
 public void SetInt32(string pchSection, string pchSettingsKey, int nValue, ref EVRSettingsError peError)
 {
     this.FnTable.SetInt32(pchSection, pchSettingsKey, nValue, ref peError);
 }
Exemple #51
0
	public abstract void Sync(ref EVRSettingsError peError);
Exemple #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
Exemple #53
0
	public abstract void SetBool(string pchSection,string pchSettingsKey,bool bValue,ref EVRSettingsError peError);
Exemple #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);
 }
Exemple #55
0
	public abstract void SetInt32(string pchSection,string pchSettingsKey,int nValue,ref EVRSettingsError peError);
Exemple #56
0
 public void RemoveSection(string pchSection, ref EVRSettingsError peError)
 {
     this.FnTable.RemoveSection(pchSection, ref peError);
 }
Exemple #57
0
	public abstract void SetFloat(string pchSection,string pchSettingsKey,float flValue,ref EVRSettingsError peError);
Exemple #58
0
 public void SetBool(string pchSection, string pchSettingsKey, bool bValue, ref EVRSettingsError peError)
 {
     this.FnTable.SetBool(pchSection, pchSettingsKey, bValue, ref peError);
 }
Exemple #59
0
	public abstract void SetString(string pchSection,string pchSettingsKey,string pchValue,ref EVRSettingsError peError);
Exemple #60
0
 public void SetFloat(string pchSection, string pchSettingsKey, float flValue, ref EVRSettingsError peError)
 {
     this.FnTable.SetFloat(pchSection, pchSettingsKey, flValue, ref peError);
 }