diff --git a/SKSE/Plugins/EnderalSE.dll b/SKSE/Plugins/EnderalSE.dll index a7135c07..ab30b698 100644 --- a/SKSE/Plugins/EnderalSE.dll +++ b/SKSE/Plugins/EnderalSE.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bfeeb196e7eab311b69046d73815f780c10366623d693900b043c3916e059db9 -size 733696 +oid sha256:f3a662001bd6dadd6d5b1786b9f1e95e014a12c8cca16a936aa4931047024683 +size 735232 diff --git a/interface/tweenmenu.swf b/interface/tweenmenu.swf index 0aa95770..d2c7fd21 100644 --- a/interface/tweenmenu.swf +++ b/interface/tweenmenu.swf @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:349d4dca40f13efd8c4dbcca15943c2c1e711ee498bc359a82aff251630880c6 -size 22014 +oid sha256:91f04e8ed77fe1ebbd9e0791a2ed5466df49cb34fa9b37d7d307a9365dbb8f30 +size 24283 diff --git a/scripts/_00e_heromenu.pex b/scripts/_00e_heromenu.pex new file mode 100644 index 00000000..7671f0ff Binary files /dev/null and b/scripts/_00e_heromenu.pex differ diff --git a/source/Enderal DLL/src/DialogueMenuPatch.h b/source/Enderal DLL/src/DialogueMenuPatch.h index f9d38e9f..cc309ef2 100644 --- a/source/Enderal DLL/src/DialogueMenuPatch.h +++ b/source/Enderal DLL/src/DialogueMenuPatch.h @@ -1,5 +1,7 @@ #pragma once +#include "Util.h" + inline bool bTabBlocked = false; class DialogueMenuPatch final : public RE::DialogueMenu @@ -7,8 +9,6 @@ class DialogueMenuPatch final : public RE::DialogueMenu public: static void Install() { - REL::Relocation OpenJournalMenuFunc{ 0x0092412C }; - REL::Relocation vtbl(RE::VTABLE_DialogueMenu[0]); _ProcessMessageFn = vtbl.write_vfunc(0x4, &ProcessMessageEx); } diff --git a/source/Enderal DLL/src/EventListener.cpp b/source/Enderal DLL/src/EventListener.cpp index ac27aabd..e44cfade 100644 --- a/source/Enderal DLL/src/EventListener.cpp +++ b/source/Enderal DLL/src/EventListener.cpp @@ -1,7 +1,4 @@ #include "EventListener.h" -#include "Util.h" -#include "DialogueMenuPatch.h" -#include auto EventListener::GetSingleton() -> EventListener* { @@ -52,6 +49,8 @@ auto EventListener::ProcessEvent( if (a_event->menuName == RE::DialogueMenu::MENU_NAME) { // Make sure Tab is not blocked. If it should be, a Papyrus script will block it a few frames later. DialogueMenuPatch::BlockTab(false); + } else if (a_event->menuName == "CustomMenu") { + CloseTweenMenu(); } } else { if (a_event->menuName == RE::DialogueMenu::MENU_NAME) { diff --git a/source/Enderal DLL/src/EventListener.h b/source/Enderal DLL/src/EventListener.h index a6fd6c75..6c170628 100644 --- a/source/Enderal DLL/src/EventListener.h +++ b/source/Enderal DLL/src/EventListener.h @@ -1,5 +1,9 @@ #pragma once +#include "DialogueMenuPatch.h" +#include "Util.h" +#include + class EventListener : public RE::BSTEventSink, public RE::BSTEventSink, diff --git a/source/Enderal DLL/src/Main.cpp b/source/Enderal DLL/src/Main.cpp index c27a4c0c..3d22c370 100644 --- a/source/Enderal DLL/src/Main.cpp +++ b/source/Enderal DLL/src/Main.cpp @@ -7,6 +7,7 @@ #include "AchievementFix.h" #include "BinkInterruptPatch.h" #include "DialogueMenuPatch.h" +#include "Patches/TweenMenuPatch.h" using namespace SKSE; @@ -169,6 +170,7 @@ SKSEPluginLoad(const LoadInterface* skse) { GetPapyrusInterface()->Register(Papyrus::Bind); DialogueMenuPatch::Install(); + TweenMenuPatch::Install(); if (g_settings.at("VideoInterruptPatch")) { logger::info("Making videos interruptible..."); diff --git a/source/Enderal DLL/src/Patches/TweenMenuPatch.h b/source/Enderal DLL/src/Patches/TweenMenuPatch.h new file mode 100644 index 00000000..0cdefccf --- /dev/null +++ b/source/Enderal DLL/src/Patches/TweenMenuPatch.h @@ -0,0 +1,39 @@ +#pragma once + +inline void OpenMenu(RE::IMenu* tweenMenu, std::int32_t index) +{ + using func_t = decltype(&OpenMenu); + REL::Relocation func{ REL::RelocationID(51845, 51845) }; + return func(tweenMenu, index); +} + +class TweenMenuPatch final : public RE::TweenMenu +{ +public: + static void Install() + { + REL::Relocation 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 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; +}; diff --git a/source/Enderal DLL/src/Util.h b/source/Enderal DLL/src/Util.h index b95dcac1..9e7aaaf3 100644 --- a/source/Enderal DLL/src/Util.h +++ b/source/Enderal DLL/src/Util.h @@ -172,3 +172,12 @@ inline void OpenJournal(bool a_bool) REL::Relocation func{ REL::RelocationID(52428, 53327) }; return func(a_bool); } + +inline void CloseTweenMenu() +{ + if (RE::UI::GetSingleton()->IsMenuOpen(RE::TweenMenu::MENU_NAME)) { + using func_t = decltype(&CloseTweenMenu); + REL::Relocation func{ REL::RelocationID(51839, 52711) }; + return func(); + } +} diff --git a/source/scripts/_00e_heromenu.psc b/source/scripts/_00e_heromenu.psc new file mode 100644 index 00000000..df603385 --- /dev/null +++ b/source/scripts/_00e_heromenu.psc @@ -0,0 +1,5 @@ +Scriptname _00E_HeroMenu Hidden + +function Show() Global + ((Game.GetForm(0x10AA2) as Quest).GetAlias(0) as _00E_Game_SkillmenuSC).OpenSkillmenu() +endfunction