diff --git a/shared/sdk/FSceneView.cpp b/shared/sdk/FSceneView.cpp index a56db991..93c1a23e 100644 --- a/shared/sdk/FSceneView.cpp +++ b/shared/sdk/FSceneView.cpp @@ -35,10 +35,12 @@ std::optional FSceneView::get_constructor_address() { // We need to find the string references "vr.InstancedStereo" and "r.TranslucentSortPolicy" // These two strings will reside together within the same function (the constructor) - const auto instanced_strings = utility::scan_strings(module, L"vr.InstancedStereo"); + // ADDENDUM: We are only finding the references for "r.TranslucentSortPolicy" now + // we are still making use of "vr.InstancedStereo" but we are checking whether instructions + // reference data that == L"vr.InstancedStereo" instead of checking for the string reference itself const auto translucent_strings = utility::scan_strings(module, L"r.TranslucentSortPolicy"); - if (instanced_strings.empty() || translucent_strings.empty()) { + if (translucent_strings.empty()) { SPDLOG_ERROR("[FSceneView] Failed to find string references for FSceneView constructor"); return std::nullopt; } @@ -107,13 +109,23 @@ std::optional FSceneView::get_constructor_address() { return utility::ExhaustionResult::CONTINUE; } - // Check if the displacement is any of the vr.InstancedStereo strings - for (const auto& instanced_string : instanced_strings) { - if (*displacement == instanced_string) { + // Directly check the data at the displacement instead + // because modular builds have the string in a different DLL + // and hardcoding which DLL its in seems sloppy + try { + const auto potential_string = (wchar_t*)*displacement; + + if (IsBadReadPtr(potential_string, sizeof(wchar_t) * 2)) { + return utility::ExhaustionResult::CONTINUE; + } + + if (std::wstring_view{ potential_string } == L"vr.InstancedStereo") { SPDLOG_INFO("[FSceneView] Found correct displacement at 0x{:x}", ip); is_correct_function = true; return utility::ExhaustionResult::BREAK; } + } catch(...) { + } return utility::ExhaustionResult::CONTINUE; diff --git a/src/mods/vr/FFakeStereoRenderingHook.cpp b/src/mods/vr/FFakeStereoRenderingHook.cpp index 4a9b9145..87c8f05c 100644 --- a/src/mods/vr/FFakeStereoRenderingHook.cpp +++ b/src/mods/vr/FFakeStereoRenderingHook.cpp @@ -4307,7 +4307,8 @@ uint32_t FFakeStereoRenderingHook::get_desired_number_of_views_hook(FFakeStereoR if (!is_stereo_enabled || (vr->is_using_afr() && !vr->is_splitscreen_compatibility_enabled())) { if (is_stereo_enabled && vr->is_ghosting_fix_enabled() && vr->is_using_afr() && - g_hook->m_sceneview_data.known_scene_states.size() < 2 && g_hook->m_fixed_localplayer_view_count) + g_hook->m_sceneview_data.known_scene_states.size() < 2 && g_hook->m_fixed_localplayer_view_count && + !!g_hook->m_sceneview_data.constructor_hook) { return 2; // We need to know about the second scene state to fix ghosting }