Enderal SE https://mod.pub/enderal-se/38-enderal-se
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.1 KiB
39 lines
1.1 KiB
#pragma once
|
|
|
|
inline void OpenMenu(RE::IMenu* tweenMenu, std::int32_t index)
|
|
{
|
|
using func_t = decltype(&OpenMenu);
|
|
REL::Relocation<func_t> func{ REL::RelocationID(51845, 51845) };
|
|
return func(tweenMenu, index);
|
|
}
|
|
|
|
class TweenMenuPatch final : public RE::TweenMenu
|
|
{
|
|
public:
|
|
static void Install()
|
|
{
|
|
REL::Relocation<uintptr_t> vtbl(RE::VTABLE_TweenMenu[0]);
|
|
_AcceptFn = vtbl.write_vfunc(0x1, &AcceptEx);
|
|
}
|
|
|
|
private:
|
|
|
|
void AcceptEx(CallbackProcessor* a_cbReg)
|
|
{
|
|
_AcceptFn(this, a_cbReg);
|
|
|
|
fxDelegate->callbacks.Remove("OpenHighlightedMenu");
|
|
a_cbReg->Process("OpenHighlightedMenu", [](const RE::FxDelegateArgs& args) {
|
|
auto index = args[0].GetSInt();
|
|
if (index <= 1) {
|
|
RE::BSTSmartPointer<RE::BSScript::IStackCallbackFunctor> stackCallback;
|
|
RE::BSScript::Internal::VirtualMachine::GetSingleton()->DispatchStaticCall("_00E_HeroMenu", "Show", RE::MakeFunctionArguments(), stackCallback);
|
|
} else if (index <= 4) {
|
|
OpenMenu(RE::UI::GetSingleton()->GetMenu(MENU_NAME).get(), index);
|
|
}
|
|
});
|
|
}
|
|
|
|
using AcceptFn = decltype(&Accept);
|
|
inline static REL::Relocation<AcceptFn> _AcceptFn;
|
|
};
|
|
|