Open journal in locked dialogs instead of the message box - fixes the oldest issue, specific to Enderal SE

This commit is contained in:
Eddoursul 2023-12-15 15:17:45 +01:00
parent 16a89a31ba
commit 467852f52e
7 changed files with 13 additions and 27 deletions

BIN
SKSE/Plugins/EnderalSE.dll (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -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<RE::BSScript::IStackCallbackFunctor> stackCallback;
RE::BSScript::Internal::VirtualMachine::GetSingleton()->DispatchStaticCall("_00E_ConfirmDialogQuit", "Show", RE::MakeFunctionArguments(), stackCallback);
OpenJournal(false);
return RE::UI_MESSAGE_RESULTS::kIgnore;
}
}

View File

@ -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<RE::GFxValue, 2> args;
args[0].SetNumber(2);
args[1].SetBoolean(false);
movie->Invoke("_root.QuestJournalFader.Menu_mc.RestoreSavedSettings", nullptr, args.data(), static_cast<std::uint32_t>(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);
}

View File

@ -164,3 +164,11 @@ inline void LoadINI(std::map<std::string, bool>* settings, const char* iniPath)
logger::error("{}", e.what());
}
}
// 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_t> func{ REL::RelocationID(52428, 53327) };
return func(a_bool);
}

View File

@ -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