From c3a1efd3a25de6bb36515a66df62be17c04f1c69 Mon Sep 17 00:00:00 2001 From: Alan Tse Date: Mon, 2 Mar 2026 10:36:11 -0800 Subject: [PATCH] refactor: allocate trampoline once --- include/PCH.h | 2 -- src/XSEPlugin.cpp | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/include/PCH.h b/include/PCH.h index 654e026d28..e3a8d9461f 100644 --- a/include/PCH.h +++ b/include/PCH.h @@ -34,7 +34,6 @@ namespace stl template void write_thunk_call(std::uintptr_t a_src) { - SKSE::AllocTrampoline(14); auto& trampoline = SKSE::GetTrampoline(); if (Size == 6) { T::func = *(uintptr_t*)trampoline.write_call<6>(a_src, T::thunk); @@ -67,7 +66,6 @@ namespace stl template void write_thunk_jmp(std::uintptr_t a_src) { - SKSE::AllocTrampoline(14); auto& trampoline = SKSE::GetTrampoline(); T::func = trampoline.write_branch<5>(a_src, T::thunk); } diff --git a/src/XSEPlugin.cpp b/src/XSEPlugin.cpp index b606286bff..210600e7c3 100644 --- a/src/XSEPlugin.cpp +++ b/src/XSEPlugin.cpp @@ -54,6 +54,7 @@ extern "C" DLLEXPORT bool SKSEAPI SKSEPlugin_Load(const SKSE::LoadInterface* a_s InitializeLog(); logger::info("Loaded {} {}", Plugin::NAME, Plugin::VERSION.string()); SKSE::Init(a_skse); + SKSE::AllocTrampoline(1 << 10); return Load(); }