Skip to content

Commit

Permalink
Fix rare stereo view offset scan failure
Browse files Browse the repository at this point in the history
  • Loading branch information
praydog committed Oct 26, 2023
1 parent be01bfb commit 3cc8d96
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions shared/sdk/UObjectBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion src/mods/vr/FFakeStereoRenderingHook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3582,7 +3582,7 @@ std::optional<uint32_t> 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;
}
Expand Down

0 comments on commit 3cc8d96

Please sign in to comment.