From 75c2aba047a288fe25869d4e3fe8027ae624f07d Mon Sep 17 00:00:00 2001 From: Qudix <17361645+Qudix@users.noreply.github.com> Date: Fri, 22 Sep 2023 15:33:33 -0500 Subject: [PATCH] fix: use 'thunk', combine identical funcs --- CommonLibSF/include/SFSE/Utilities.h | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/CommonLibSF/include/SFSE/Utilities.h b/CommonLibSF/include/SFSE/Utilities.h index bbf176ba..2e266f45 100644 --- a/CommonLibSF/include/SFSE/Utilities.h +++ b/CommonLibSF/include/SFSE/Utilities.h @@ -12,7 +12,7 @@ namespace SFSE { SFSE::AllocTrampoline(14); auto& trampoline = SFSE::GetTrampoline(); - T::func = trampoline.write_call(a_address, T::Thunk); + T::func = trampoline.write_call(a_address, T::thunk); } template @@ -25,19 +25,13 @@ namespace SFSE constexpr void write_vfunc(const REL::Offset a_offset) noexcept { REL::Relocation vtbl{ a_offset }; - T::func = vtbl.write_vfunc(T::idx, T::Thunk); + T::func = vtbl.write_vfunc(T::idx, T::thunk); } template - constexpr void write_vfunc(const std::size_t a_vtable_idx) noexcept + constexpr void write_vfunc(const std::size_t a_vtableIdx = 0) noexcept { - write_vfunc(To::VTABLE[a_vtable_idx]); - } - - template - constexpr void write_vfunc() noexcept - { - write_vfunc(To::VTABLE[0]); + write_vfunc(To::VTABLE[a_vtableIdx]); } } // namespace stl } // namespace SFSE