Skip to content

Commit

Permalink
FFakeStereorenderingHook: Fix crash seen in 11548cf
Browse files Browse the repository at this point in the history
  • Loading branch information
praydog committed Feb 7, 2025
1 parent b730255 commit af29b8d
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/mods/vr/FFakeStereoRenderingHook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3035,20 +3035,23 @@ void FFakeStereoRenderingHook::pre_render_viewfamily_renderthread(ISceneViewExte
return;
}

auto& vr = VR::get();

if (!vr->is_hmd_active()) {
return;
}

static size_t execution_count{0};

// This should 100% only get executed if the headset is on, because
// FFakeStereoRenderingHook::render_texture_render_thread is the first fallback for hooking
// And we don't want to miss that unintentionally
if (g_hook->m_attempted_hook_slate_thread && !g_hook->m_slate_thread_hook && !g_hook->m_attempted_hook_slate_thread_alternate && execution_count++ >= 50) {
SPDLOG_INFO("DrawWindow_RenderThread was not hooked after {} render calls, trying alternative hook", execution_count);

g_hook->attempt_hook_slate_thread(0, true);
}

auto& vr = VR::get();

if (!vr->is_hmd_active()) {
return;
}

if (vr->is_stereo_emulation_enabled()) {
return;
}
Expand Down

0 comments on commit af29b8d

Please sign in to comment.