diff --git a/CommonLibSF/include/SFSE/Utilities.h b/CommonLibSF/include/SFSE/Utilities.h index a698b949..cfb933fa 100644 --- a/CommonLibSF/include/SFSE/Utilities.h +++ b/CommonLibSF/include/SFSE/Utilities.h @@ -8,32 +8,36 @@ namespace SFSE namespace stl { template - constexpr void write_thunk_call() noexcept + constexpr void write_thunk_call(const std::uintptr_t a_address) noexcept { SFSE::AllocTrampoline(14); auto& trampoline = SFSE::GetTrampoline(); - T::func = trampoline.write_call(T::address, T::Thunk); + T::func = trampoline.write_call(a_address, T::Thunk); + } + + template + constexpr void write_thunk_call() noexcept + { + write_thunk_call(T::address); } - template - constexpr void write_vfunc() noexcept + template + constexpr void write_vfunc(const REL::Offset a_offset) noexcept { - REL::Relocation vtbl{ To::VTABLE[0] }; - From::func = vtbl.write_vfunc(From::idx, From::Thunk); + REL::Relocation vtbl{ a_offset }; + T::func = vtbl.write_vfunc(T::idx, T::Thunk); } template constexpr void write_vfunc(const std::size_t a_vtable_idx) noexcept { - REL::Relocation vtbl{ To::VTABLE[a_vtable_idx] }; - From::func = vtbl.write_vfunc(From::idx, From::Thunk); + write_vfunc(To::VTABLE[a_vtable_idx]); } - template - constexpr void write_vfunc(const REL::Offset a_offset) noexcept + template + constexpr void write_vfunc() noexcept { - REL::Relocation vtbl{ a_offset }; - T::func = vtbl.write_vfunc(T::idx, T::Thunk); + write_vfunc(To::VTABLE[0]); } } // namespace stl } // namespace SFSE