Skip to content

Commit de626d6

Browse files
committed
UE5: Fix crash case where default texture format is 10-bit
1 parent 706bd89 commit de626d6

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/mods/vr/FFakeStereoRenderingHook.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6505,6 +6505,14 @@ void VRRenderTargetManager_Base::pre_texture_hook_callback(safetyhook::Context&
65056505

65066506
x = size.x;
65076507
y = size.y;
6508+
6509+
uint8_t* format = (uint8_t*)(ctx.r9 + width_offset.value() + 15);
6510+
6511+
// some games have 10 bit format
6512+
if (*format == 18) {
6513+
*format = 2; // PF_B8G8R8A8
6514+
}
6515+
65086516
break;
65096517
}
65106518
}
@@ -7672,6 +7680,9 @@ bool VRRenderTargetManager_Base::allocate_render_target_texture(uintptr_t return
76727680
next_call_is_not_the_right_one = true;
76737681
}
76747682
}
7683+
} else if (utility::find_pattern_in_path((uint8_t*)fn, 30, true, "66 41 C7 40 34 00 FF")) {
7684+
SPDLOG_INFO("Found 66 41 C7 40 34 00 FF pattern within the function, skipping this call!");
7685+
next_call_is_not_the_right_one = true;
76757686
} else {
76767687
// Check how many instructions are in the call. If there's <= 30 AND there's no call/jmp in it, this is not the right one
76777688
size_t insn_count = 0;

0 commit comments

Comments
 (0)