mirror of
https://github.com/CrispyPin/sinpin-vr.git
synced 2024-11-22 18:10:26 +01:00
early exit if steamvr is not already running
This commit is contained in:
parent
6d2a6ce0e5
commit
766c3e2056
1 changed files with 14 additions and 2 deletions
16
src/main.cpp
16
src/main.cpp
|
@ -60,9 +60,21 @@ void init_glfw()
|
||||||
void init_vr()
|
void init_vr()
|
||||||
{
|
{
|
||||||
vr::EVRInitError init_err;
|
vr::EVRInitError init_err;
|
||||||
|
ovr_sys = vr::VR_Init(&init_err, vr::EVRApplicationType::VRApplication_Background);
|
||||||
|
if (init_err == vr::EVRInitError::VRInitError_Init_NoServerForBackgroundApp)
|
||||||
|
{
|
||||||
|
printf("SteamVR is not running\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
else if (init_err != 0)
|
||||||
|
{
|
||||||
|
printf("Could not initialize OpenVR session. Error code: %d\n", init_err);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
vr::VR_ShutdownInternal();
|
||||||
ovr_sys = vr::VR_Init(&init_err, vr::EVRApplicationType::VRApplication_Overlay);
|
ovr_sys = vr::VR_Init(&init_err, vr::EVRApplicationType::VRApplication_Overlay);
|
||||||
assert(init_err == 0);
|
assert(init_err == 0);
|
||||||
printf("Initialized openvr\n");
|
printf("Initialized OpenVR\n");
|
||||||
ovr_overlay = vr::VROverlay();
|
ovr_overlay = vr::VROverlay();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,9 +213,9 @@ int main()
|
||||||
{
|
{
|
||||||
signal(SIGINT, interrupted);
|
signal(SIGINT, interrupted);
|
||||||
|
|
||||||
|
init_vr();
|
||||||
init_x11();
|
init_x11();
|
||||||
init_glfw();
|
init_glfw();
|
||||||
init_vr();
|
|
||||||
init_overlay();
|
init_overlay();
|
||||||
|
|
||||||
while (!should_exit)
|
while (!should_exit)
|
||||||
|
|
Loading…
Reference in a new issue