From 762d96375d67cb854e547236dc0c1356d05ca321 Mon Sep 17 00:00:00 2001 From: praydog Date: Mon, 6 Nov 2023 21:47:26 -0800 Subject: [PATCH] Add SceneView compatibility mode --- src/mods/VR.cpp | 1 + src/mods/VR.hpp | 11 +++++++++-- src/mods/vr/FFakeStereoRenderingHook.cpp | 4 ++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/mods/VR.cpp b/src/mods/VR.cpp index 89c4caaa..b4c8faf8 100644 --- a/src/mods/VR.cpp +++ b/src/mods/VR.cpp @@ -2088,6 +2088,7 @@ void VR::on_draw_sidebar_entry(std::string_view name) { ImGui::SetNextItemOpen(true, ImGuiCond_::ImGuiCond_Once); if (ImGui::TreeNode("Compatibility Options")) { m_compatibility_skip_pip->draw("Skip PostInitProperties"); + m_sceneview_compatibility_mode->draw("SceneView Compatibility Mode"); m_extreme_compat_mode->draw("Extreme Compatibility Mode"); ImGui::TreePop(); } diff --git a/src/mods/VR.hpp b/src/mods/VR.hpp index e03021e1..3e1b9e90 100644 --- a/src/mods/VR.hpp +++ b/src/mods/VR.hpp @@ -448,6 +448,10 @@ class VR : public Mod { return m_splitscreen_view_index->value(); } + bool is_sceneview_compatibility_enabled() const { + return m_sceneview_compatibility_mode->value(); + } + bool is_ghosting_fix_enabled() const { return m_ghosting_fix->value(); } @@ -725,9 +729,11 @@ class VR : public Mod { const ModSlider::Ptr m_custom_z_near{ ModSlider::create(generate_name("CustomZNear"), 0.001f, 100.0f, 0.01f) }; const ModToggle::Ptr m_custom_z_near_enabled{ ModToggle::create(generate_name("EnableCustomZNear"), false) }; - const ModToggle::Ptr m_splitscreen_compatibility_mode{ ModToggle::create(generate_name("SplitscreenCompatibilityMode"), false) }; + const ModToggle::Ptr m_splitscreen_compatibility_mode{ ModToggle::create(generate_name("Compatibility_SplitScreen"), false) }; const ModInt32::Ptr m_splitscreen_view_index{ ModInt32::create(generate_name("SplitscreenViewIndex"), 0) }; + const ModToggle::Ptr m_sceneview_compatibility_mode{ ModToggle::create(generate_name("Compatibility_SceneView"), false) }; + const ModToggle::Ptr m_compatibility_skip_pip{ ModToggle::create(generate_name("Compatibility_SkipPostInitProperties"), false) }; struct DecoupledPitchData { @@ -786,7 +792,8 @@ class VR : public Mod { *m_ghosting_fix, *m_splitscreen_compatibility_mode, *m_splitscreen_view_index, - *m_compatibility_skip_pip + *m_compatibility_skip_pip, + *m_sceneview_compatibility_mode, }; diff --git a/src/mods/vr/FFakeStereoRenderingHook.cpp b/src/mods/vr/FFakeStereoRenderingHook.cpp index 4a6b3a2f..a5646dea 100644 --- a/src/mods/vr/FFakeStereoRenderingHook.cpp +++ b/src/mods/vr/FFakeStereoRenderingHook.cpp @@ -392,7 +392,7 @@ void FFakeStereoRenderingHook::attempt_hook_fsceneview_constructor() { auto& vr = VR::get(); - if (!vr->is_ghosting_fix_enabled() && !vr->is_splitscreen_compatibility_enabled()) { + if (!vr->is_ghosting_fix_enabled() && !vr->is_splitscreen_compatibility_enabled() && !vr->is_sceneview_compatibility_enabled()) { return; } @@ -2547,7 +2547,7 @@ sdk::FSceneView* FFakeStereoRenderingHook::sceneview_constructor(sdk::FSceneView const auto true_index = vr->is_using_afr() ? (g_frame_count + last_index) % 2 : last_index; - if (vr->is_splitscreen_compatibility_enabled()) { + if (vr->is_splitscreen_compatibility_enabled() || vr->is_sceneview_compatibility_enabled()) { int32_t w = vr->get_hmd_width(); int32_t h = vr->get_hmd_height();