Skip to content

Commit

Permalink
feat: add write_thunk_jump to Utilities.h (#178)
Browse files Browse the repository at this point in the history
  • Loading branch information
ThirdEyeSqueegee authored Oct 20, 2023
1 parent d7073a4 commit 50da4a5
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions CommonLibSF/include/SFSE/Utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,12 @@ namespace SFSE::stl
{
write_vfunc<From>(To::VTABLE[a_vtableIdx]);
}

template <class T, std::size_t Size = 5>
constexpr void write_thunk_jump(const std::uintptr_t a_src) noexcept
{
SFSE::AllocTrampoline(14);
auto& trampoline = SFSE::GetTrampoline();
T::func = trampoline.write_branch<Size>(a_src, T::thunk);
}
}

0 comments on commit 50da4a5

Please sign in to comment.