From 467852f52ecb684ec113a0dcebe505278e73c7af Mon Sep 17 00:00:00 2001 From: Eddoursul Date: Fri, 15 Dec 2023 15:17:45 +0100 Subject: [PATCH] Open journal in locked dialogs instead of the message box - fixes the oldest issue, specific to Enderal SE --- SKSE/Plugins/EnderalSE.dll | 4 ++-- Update.esm | Bin 70097 -> 69903 bytes scripts/_00e_confirmdialogquit.pex | Bin 930 -> 0 bytes source/Enderal DLL/src/DialogueMenuPatch.h | 5 +---- source/Enderal DLL/src/EventListener.cpp | 14 +------------- source/Enderal DLL/src/Util.h | 10 +++++++++- source/scripts/_00e_confirmdialogquit.psc | 7 ------- 7 files changed, 13 insertions(+), 27 deletions(-) delete mode 100644 scripts/_00e_confirmdialogquit.pex delete mode 100644 source/scripts/_00e_confirmdialogquit.psc diff --git a/SKSE/Plugins/EnderalSE.dll b/SKSE/Plugins/EnderalSE.dll index 19d46c4e..a7135c07 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:8e26462b367894584664fea9fa029f1766ba7d38dd6357b5e832696c2b4f9b47 -size 735744 +oid sha256:bfeeb196e7eab311b69046d73815f780c10366623d693900b043c3916e059db9 +size 733696 diff --git a/Update.esm b/Update.esm index 4fe7177af08e4b3dc04ea5deae17879a9c72462e..6e3eaae26ef78171aa56fcc8e546e662c359e130 100644 GIT binary patch delta 22 ecmcb(n5BOa%LFCH8I8(Yl^JIVOs^MY3<3aRvIm*~ delta 214 zcmeBQ#By;l%LFCHS&hnDl^JIV)E{DCVDNPfb_Y^$0OC)A@@&Nz7(q-OAa-@}bP;2S zH!yIGcgal5$xkm$4J^$paZk)mWpHr~cD7&$$;d2LNY2kIOD!r+EXmBzQ%FwC%gZlO zNJ>@6%qvMPDk?1~NlnpH0O?aG$w;+VNC)b+XYllM^ko5C=>lef?DPzY2w`V%PRvVA e%>i=+8A9?wniO&qGxHR3Q}aq0rtcJB3fgc5Ph3CA5PPxl#$FVZ@Bw1wdM)tZE;?MCX zxbj0dF>A-ANF2bHW@p~aym@2q&yU}JG#e1$hrWJ)hQo`=WOnh==!Hs?S1O3j@@=l{ zc%6ml&7#QUX_m(l1FHRTp|r$3jQ-xq#NAV}=Qgke|I}Dhx!(E86zCg$LQAD9tY`F0 zN0r}RsVE|itip);LYO4bv23zH^w_z<0hvMg9$6+A-owYGKsF}xFF zV))akWBCxI@RmVB7_z)M6U|eT%vDV2yM1c;WO_@PpYUX)99- zNnLVVu_8ByiAw_MoN8XgGw|d;%7Y^KA{V?M?*F+!N;Xfm(@!$Y)6@wlr`1>D7%l#V z0u6UXoYSlw59q+VdRv=9SI&<>+Z_$AL042aOg!b&5pUx1Y%zmhqNQn}hb{E6jRA(( z!42$kx^p0KQ(#Y^=jJ!qj9xTwYaq~PY+t}Dy@AX6tPIThZ)Pa4BTzPq5&MpzS&idx z*M-<~)~)Vi-^DJtjRUq$T$9JQ1rF=#ZGj`sGupa_^5^k!r|Pb3n}NI6fd*3^{{{pz G9{mFP;JOI_ diff --git a/source/Enderal DLL/src/DialogueMenuPatch.h b/source/Enderal DLL/src/DialogueMenuPatch.h index 942b4c15..f9d38e9f 100644 --- a/source/Enderal DLL/src/DialogueMenuPatch.h +++ b/source/Enderal DLL/src/DialogueMenuPatch.h @@ -29,10 +29,7 @@ private: // Escape triggers a kTab event, added kEscape just in case if (key && (key->keyCode == RE::GFxKey::kTab || key->keyCode == RE::GFxKey::kEscape) && !RE::UI::GetSingleton()->IsMenuOpen(RE::ContainerMenu::MENU_NAME) && !RE::UI::GetSingleton()->IsMenuOpen(RE::BarterMenu::MENU_NAME)) { - // The best solution is to show the quest journal, like in LE, but showing a journal seems to mess with framerate of the UI, see dialogue menu after showing journal - //RE::UIMessageQueue::GetSingleton()->AddMessage(RE::InterfaceStrings::GetSingleton()->journalMenu, RE::UI_MESSAGE_TYPE::kShow, 0i64); - RE::BSTSmartPointer stackCallback; - RE::BSScript::Internal::VirtualMachine::GetSingleton()->DispatchStaticCall("_00E_ConfirmDialogQuit", "Show", RE::MakeFunctionArguments(), stackCallback); + OpenJournal(false); return RE::UI_MESSAGE_RESULTS::kIgnore; } } diff --git a/source/Enderal DLL/src/EventListener.cpp b/source/Enderal DLL/src/EventListener.cpp index 12999a8c..ac27aabd 100644 --- a/source/Enderal DLL/src/EventListener.cpp +++ b/source/Enderal DLL/src/EventListener.cpp @@ -49,19 +49,7 @@ auto EventListener::ProcessEvent( -> RE::BSEventNotifyControl { if (a_event->opening) { - if (a_event->menuName == RE::JournalMenu::MENU_NAME) { - if (RE::UI::GetSingleton()->IsMenuOpen(RE::DialogueMenu::MENU_NAME)) { - const auto movie = RE::UI::GetSingleton()->GetMovieView(RE::JournalMenu::MENU_NAME); - if (movie) { - // UIMessage opens quest journal uninitialized, without any tab active and hotkeys bound - // We have to activate a tab for it to work properly - std::array args; - args[0].SetNumber(2); - args[1].SetBoolean(false); - movie->Invoke("_root.QuestJournalFader.Menu_mc.RestoreSavedSettings", nullptr, args.data(), static_cast(args.size())); - } - } - } else if (a_event->menuName == RE::DialogueMenu::MENU_NAME) { + 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); } diff --git a/source/Enderal DLL/src/Util.h b/source/Enderal DLL/src/Util.h index 60326295..b95dcac1 100644 --- a/source/Enderal DLL/src/Util.h +++ b/source/Enderal DLL/src/Util.h @@ -163,4 +163,12 @@ inline void LoadINI(std::map* settings, const char* iniPath) } catch (const std::exception& e) { logger::error("{}", e.what()); } -} \ No newline at end of file +} + +// When opening from dialogue menu, a_bool must be false to not break framerate of the UI +inline void OpenJournal(bool a_bool) +{ + using func_t = decltype(&OpenJournal); + REL::Relocation func{ REL::RelocationID(52428, 53327) }; + return func(a_bool); +} diff --git a/source/scripts/_00e_confirmdialogquit.psc b/source/scripts/_00e_confirmdialogquit.psc deleted file mode 100644 index b279a972..00000000 --- a/source/scripts/_00e_confirmdialogquit.psc +++ /dev/null @@ -1,7 +0,0 @@ -Scriptname _00E_ConfirmDialogQuit Hidden - -function Show() global - if (Game.GetFormFromFile(0x163D, "Update.esm") as Message).Show() == 1 - Game.QuitToMainMenu() - endif -endfunction