| 91 | void DetachDetours(); |
| 92 | |
| 93 | OVR_PUBLIC_FUNCTION(ovrResult) ovr_Initialize(const ovrInitParams* params) |
| 94 | { |
| 95 | if (g_InitError == vr::VRInitError_None) |
| 96 | return ovrSuccess; |
| 97 | |
| 98 | #if 0 |
| 99 | LoadRenderDoc(); |
| 100 | #endif |
| 101 | |
| 102 | MicroProfileOnThreadCreate("Main"); |
| 103 | MicroProfileSetForceEnable(true); |
| 104 | MicroProfileSetEnableAllGroups(true); |
| 105 | MicroProfileSetForceMetaCounters(true); |
| 106 | MicroProfileWebServerStart(); |
| 107 | |
| 108 | g_MinorVersion = params->RequestedMinorVersion; |
| 109 | |
| 110 | DetachDetours(); |
| 111 | |
| 112 | vr::VR_Init(&g_InitError, vr::VRApplication_Scene); |
| 113 | |
| 114 | AttachDetours(); |
| 115 | |
| 116 | uint32_t timeout = params->ConnectionTimeoutMS; |
| 117 | if (timeout == 0) |
| 118 | timeout = REV_DEFAULT_TIMEOUT; |
| 119 | |
| 120 | // Wait until the compositor is ready, if SteamVR still needs to start the nominal waiting time |
| 121 | // is 1.5 seconds. Thus we don't even attempt to wait if the requested timeout is only 100ms. |
| 122 | while (timeout > 100 && vr::VRCompositor() == nullptr) |
| 123 | { |
| 124 | Sleep(100); |
| 125 | timeout -= 100; |
| 126 | } |
| 127 | |
| 128 | if (vr::VRCompositor() == nullptr) |
| 129 | return ovrError_Timeout; |
| 130 | |
| 131 | #if MICROPROFILE_ENABLED |
| 132 | g_ProfileManager.Initialize(); |
| 133 | #endif |
| 134 | |
| 135 | return InitErrorToOvrError(g_InitError); |
| 136 | } |
| 137 | |
| 138 | OVR_PUBLIC_FUNCTION(void) ovr_Shutdown() |
| 139 | { |
nothing calls this directly
no test coverage detected