From 9cee08c2b8622574d6416e5df56217d8b26c97eb Mon Sep 17 00:00:00 2001 From: Matthieu Bucchianeri Date: Sat, 9 Sep 2023 14:51:15 -0700 Subject: [PATCH] Fix crash with X-Plane 12. --- pimax-openxr/session.cpp | 4 ++-- pimax-openxr/system.cpp | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pimax-openxr/session.cpp b/pimax-openxr/session.cpp index 635d9fa..28004cc 100644 --- a/pimax-openxr/session.cpp +++ b/pimax-openxr/session.cpp @@ -164,11 +164,11 @@ namespace pimax_openxr { m_sessionCreated = true; // FIXME: Reset the session and frame state here. + m_frameWaited = m_frameBegun = m_frameCompleted = 0; + m_sessionState = XR_SESSION_STATE_IDLE; updateSessionState(true); - m_frameWaited = m_frameBegun = m_frameCompleted = 0; - m_frameTimes.clear(); m_isControllerActive[0] = m_isControllerActive[1] = false; diff --git a/pimax-openxr/system.cpp b/pimax-openxr/system.cpp index 5d820dd..3d9ea47 100644 --- a/pimax-openxr/system.cpp +++ b/pimax-openxr/system.cpp @@ -140,11 +140,14 @@ namespace pimax_openxr { const float cantingAngle = PVR::Quatf{m_cachedEyeInfo[xr::StereoView::Left].HmdToEyePose.Orientation}.Angle( m_cachedEyeInfo[xr::StereoView::Right].HmdToEyePose.Orientation) / 2.f; + const bool wasUsingParallelProjection = m_useParallelProjection; m_useParallelProjection = cantingAngle > 0.0001f && getSetting("force_parallel_projection_state") .value_or(!pvr_getIntConfig(m_pvrSession, "steamvr_use_native_fov", 0)); if (m_useParallelProjection) { - Log("Parallel projection is enabled\n"); + if (!wasUsingParallelProjection) { + Log("Parallel projection is enabled\n"); + } // Per Pimax, we must set this value for parallel projection to work properly. CHECK_PVRCMD(pvr_setIntConfig(m_pvrSession, "view_rotation_fix", 1));