From 3cc8d96f42c033a1a740e445d82cdeaee6841919 Mon Sep 17 00:00:00 2001 From: praydog Date: Wed, 25 Oct 2023 23:15:23 -0700 Subject: [PATCH] Fix rare stereo view offset scan failure --- shared/sdk/UObjectBase.cpp | 6 +++--- src/mods/vr/FFakeStereoRenderingHook.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/shared/sdk/UObjectBase.cpp b/shared/sdk/UObjectBase.cpp index 06ffdc9b..a1ee48d3 100644 --- a/shared/sdk/UObjectBase.cpp +++ b/shared/sdk/UObjectBase.cpp @@ -393,9 +393,9 @@ void UObjectBase::update_offsets_post_uobjectarray() { return utility::ExhaustionResult::BREAK; } - if (!backup_functions.empty() && std::string_view{ctx.instrux.Mnemonic}.starts_with("JMP")) { - SPDLOG_INFO("[UObjectBase] Encountered jmp, using backup function {:x}", backup_functions[0]); - s_add_object = backup_functions[0]; + if (!backup_functions.empty() && std::string_view{ctx.instrux.Mnemonic}.starts_with("JMP") && ctx.instrux.IsRipRelative) { + SPDLOG_INFO("[UObjectBase] Encountered jmp, using backup function {:x}", backup_functions.back()); + s_add_object = backup_functions.back(); return utility::ExhaustionResult::BREAK; } diff --git a/src/mods/vr/FFakeStereoRenderingHook.cpp b/src/mods/vr/FFakeStereoRenderingHook.cpp index 505c493b..b7dfdb36 100644 --- a/src/mods/vr/FFakeStereoRenderingHook.cpp +++ b/src/mods/vr/FFakeStereoRenderingHook.cpp @@ -3582,7 +3582,7 @@ std::optional FFakeStereoRenderingHook::get_stereo_view_offset_index(u // We do an exhaustive decode (disassemble all possible code paths) that correctly follows the control flow // because some games are obfuscated and do huge jumps across gaps of junk code. // so we can't just linearly scan forward as the disassembler will fail at some point. - utility::exhaustive_decode((uint8_t*)func, 30, [&](INSTRUX& ix, uintptr_t ip) -> utility::ExhaustionResult { + utility::exhaustive_decode((uint8_t*)func, 50, [&](INSTRUX& ix, uintptr_t ip) -> utility::ExhaustionResult { if (found) { return utility::ExhaustionResult::BREAK; }